@ishibashi0112/spreadsheet-grid-core 0.47.0 → 0.48.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.
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/geometry.cjs"),n=require("../logic/autoScrollGeometry.cjs"),r=require("../logic/slotDom.cjs");function i(e,n,r,i){let a=e.find(e=>e.key===n);if(!a)return null;let o=t.getColumnPane(a),s={left:[],center:[],right:[]},c=new Map;for(let n of e)s[t.getColumnPane(n)].push(n.key),c.set(n.key,n.visible!==!1);let l=s[r].filter(e=>c.get(e)).indexOf(n),u=s[o].indexOf(n);if(u<0)return null;s[o].splice(u,1);let d=i;o===r&&l>=0&&d>l&&--d;let f=s[r].filter(e=>c.get(e));if(d=Math.max(0,Math.min(d,f.length)),o===r&&l>=0&&d===l)return null;let p;return p=d>=f.length?s[r].length:s[r].indexOf(f[d]),s[r].splice(p,0,n),[...s.left,...s.center,...s.right]}var a=32,o=2,s=14,c=12,l=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="5 9 2 12 5 15"/><polyline points="9 5 12 2 15 5"/><polyline points="15 19 12 22 9 19"/><polyline points="19 9 22 12 19 15"/><line x1="2" y1="12" x2="22" y2="12"/><line x1="12" y1="2" x2="12" y2="22"/></svg>`,u=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="17" x2="12" y2="22"/><path d="M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"/></svg>`,d=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="4.9" y1="4.9" x2="19.1" y2="19.1"/></svg>`,f=`0.5`,p=200,m=`cubic-bezier(0.2, 0.7, 0.3, 1)`,h=e=>e?.closest(`.ssg-motion-off`)!=null,g=`transform 160ms ${m}`,_=`data-ssg-col-dragging`,v=`4`,y=t=>{let n=[];return t.querySelectorAll(`[data-ssg-col-key]`).forEach(r=>{e.isInsideDetailCardOf(t,r)||n.push(r)}),n},b=t=>{if(!t)return null;let n=new Map;return t.querySelectorAll(`[data-ssg-col-key]`).forEach(r=>{if(e.isInsideDetailCardOf(t,r))return;let i=r.dataset.ssgColKey;i&&!n.has(i)&&n.set(i,r.getBoundingClientRect().left)}),n},x=()=>{let x=null,S=null,C=null,w=null,T={x:0,y:0},E=null,D=!1,O=null,k=null,A=null,j=null,M=null,N=null,P=0,F=null,I=null,L=``,R=()=>x?.motion===`live`,z=()=>({left:x?.leftIndicatorRef.current??null,center:x?.centerIndicatorRef.current??null,right:x?.rightIndicatorRef.current??null}),B=()=>{for(let e of Object.values(z()))e&&(e.style.display=`none`)},V=e=>{if(A)return;let t=document.createElement(`div`);t.setAttribute(`data-grid-drag-ghost`,``),x?.scrollContainerRef.current?.closest(`.ssg-theme-dark`)!=null&&t.classList.add(`ssg-theme-dark`),x?.scrollContainerRef.current?.closest(`.ssg-motion-off`)!=null&&t.classList.add(`ssg-motion-off`),t.style.cssText=[`position:fixed`,`top:0`,`left:0`,`display:inline-flex`,`align-items:center`,`gap:7px`,`padding:7px 12px 7px 10px`,`border-radius:9px`,`border:1px solid var(--ssg-ghost-border)`,`background:var(--ssg-ghost-bg)`,`color:var(--ssg-ghost-text)`,`font-size:12px`,`font-weight:600`,`line-height:1`,`white-space:nowrap`,`box-shadow:var(--ssg-ghost-shadow)`,`pointer-events:none`,`user-select:none`,`z-index:9999`,`will-change:transform`,`transform:translate(-9999px,-9999px)`].join(`;`),r.applySlotToElement(t,x?.ghostSlot);let n=document.createElement(`span`);n.style.cssText=`display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none`;let i=document.createElement(`span`);i.textContent=e,t.appendChild(n),t.appendChild(i),document.body.appendChild(t),A=t,j=n,M=null},H=e=>{let t=A;if(!t)return;t.style.transform=`translate(`+(T.x+s)+`px,`+(T.y+c)+`px)`;let n=e??`out`;if(M===n)return;M=n;let r=j;n===`out`?(t.style.opacity=f,r&&(r.innerHTML=d)):(t.style.opacity=`1`,r&&(r.innerHTML=n===`center`?l:u))},U=()=>{A&&A.parentNode&&A.parentNode.removeChild(A),A=null,j=null,M=null},W=(e,n)=>{if(x===null)return null;let{paneLayout:r,leftPaneScrollRef:i,rightPaneScrollRef:s,bodyScrollRef:c,scrollContainerRef:l,leftLeadingWidth:u,centerLeadingWidth:d,rightLeadingWidth:f}=x,p=l.current;if(p){let t=p.getBoundingClientRect();if(e<t.left||e>t.right||n<t.top||n>t.bottom)return null}let m=i.current,h=s.current;if(m&&r.left.entries.length===0&&e<=m.getBoundingClientRect().left+a)return{pane:`left`,slot:0,leftPx:o};if(m&&r.left.entries.length>0){let n=m.getBoundingClientRect();if(e<n.right){let i=e-n.left-u,a=t.findPaneDropSlot(r.left,i);return{pane:`left`,slot:a,leftPx:u+t.paneDropSlotBoundaryX(r.left,a)}}}if(h&&r.right.entries.length===0&&e>=h.getBoundingClientRect().left-a)return{pane:`right`,slot:0,leftPx:-2};if(h&&r.right.entries.length>0){let n=h.getBoundingClientRect();if(e>=n.left){let i=e-n.left-f,a=t.findPaneDropSlot(r.right,i);return{pane:`right`,slot:a,leftPx:f+t.paneDropSlotBoundaryX(r.right,a)}}}let g=c.current;if(g&&r.center.entries.length>0){let n=g.getBoundingClientRect(),i=g.scrollLeft+e-n.left-d,a=t.findPaneDropSlot(r.center,Math.max(i,0));return{pane:`center`,slot:a,leftPx:d+t.paneDropSlotBoundaryX(r.center,a)}}return null},G=e=>{let t=z();for(let n of[`left`,`center`,`right`]){let r=t[n];r&&(n===e.pane?(r.style.left=`${e.leftPx}px`,r.style.display=`block`):r.style.display=`none`)}},K=(e,t)=>{let n=I?.get(t);n!==void 0&&I?.delete(t),e.set(t,n??t.style.zIndex)},q=(e,t)=>{let n=F,r=S,i=N;if(!n||r===null||i===null||x===null)return;let a=x.scrollContainerRef.current;if(!a)return;let o=x.paneLayout[i].entries,s=o.findIndex(e=>e.column.key===r);if(s<0)return;let c=o[s].paneLocalSize,l=!t||e===null?s:e>s?e-1:e,u=new Map;for(let e=Math.min(s,l);e<=Math.max(s,l);e+=1)e!==s&&u.set(o[e].column.key,e>s?-c:c);let d=i===`center`?a.scrollLeft-P:0,f=(E?T.x-E.x:0)+d;for(let e of y(a)){let i=e.dataset.ssgColKey;if(i===void 0)continue;if(i===r){n.has(e)||(K(n,e),e.style.zIndex=v,e.style.willChange=`transform`),t?(e.setAttribute(_,`live`),e.style.transition=`none`,e.style.transform=`translateX(${f}px)`):(e.removeAttribute(_),e.style.transition=g,e.style.transform=`translateX(0px)`);continue}let a=u.get(i)??0;if(a===0&&!n.has(e))continue;n.has(e)||K(n,e);let o=`translateX(${a}px)`;e.style.transform!==o&&(e.style.transition=g,e.style.transform=o)}},J=e=>{e.forEach((e,t)=>{t.style.transition=``,t.style.transform=``,t.style.willChange=``,t.style.zIndex=e,t.removeAttribute(_)})},Y=()=>{let e=W(T.x,T.y);if(R()){e&&(C={pane:e.pane,slot:e.slot});let t=C;if(t!==null&&t.pane!==N){V(L),H(t.pane),e&&G(e),q(null,!1);return}U(),B(),q(t===null?null:t.slot,!0);return}if(H(e?e.pane:null),!e){C=null,B();return}C={pane:e.pane,slot:e.slot},G(e)},X=()=>{if(S===null){k=null;return}let e=x?.scrollContainerRef.current??null;if(e&&(D||(!E||n.hasPointerLeftActivationRadius(E,T,6))&&(D=!0),D)){let t=e.getBoundingClientRect(),r=n.resolveScrollContentBox({rectLeft:t.left,rectTop:t.top,clientLeft:e.clientLeft,clientTop:e.clientTop,clientWidth:e.clientWidth,clientHeight:e.clientHeight}),i=n.resolveAutoScrollAxisDirection(T.x,r.left,r.right,24),a=n.computeNextScrollPosition(e.scrollLeft,i,18,e.scrollWidth-e.clientWidth);a!==e.scrollLeft&&e.scrollTo({left:a,behavior:`auto`})}Y(),k=requestAnimationFrame(X)},Z=e=>{k!==null&&(cancelAnimationFrame(k),k=null),document.body.style.cursor=``,B(),U();let n=S,r=C;S=null,C=null,E=null;let a=F;F=null,N=null;let o=e&&n&&r&&x!==null?i(x.columns,n,r.pane,r.slot):null;if(a&&!o&&(a.forEach((e,t)=>{t.isConnected&&(t.style.transition=g,t.style.transform=`translateX(0px)`)}),I=a,window.setTimeout(()=>{J(a),I===a&&(I=null)},200)),!o||!n||!r||x===null)return;let{columns:s,applyColumnOrderAndPin:c,scrollContainerRef:l}=x,u=s.find(e=>e.key===n),d=u?t.getColumnPane(u):null;w=d!==null&&d===r.pane&&!h(l.current)?b(l.current):null,a&&J(a),c(o,new Map([[n,r.pane===`center`?void 0:r.pane]]))};return{update:e=>{x=e},onColumnDragHandlePointerDown:(e,n)=>{if(x===null||!x.enabled||n.button!==0)return;n.stopPropagation(),n.preventDefault(),S=e.key,C=null,T={x:n.clientX,y:n.clientY},E={x:n.clientX,y:n.clientY},D=!1,document.body.style.cursor=`grabbing`,L=e.title||e.key,R()?(N=t.getColumnPane(e),P=x.scrollContainerRef.current?.scrollLeft??0,F=new Map):V(L);let r=n.currentTarget,i=n.pointerId;try{r.setPointerCapture(i)}catch{}let a=e=>{e.pointerId===i&&(T={x:e.clientX,y:e.clientY},Y())},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),window.removeEventListener(`keydown`,l),O=null;try{r.releasePointerCapture(i)}catch{}};function s(e){e.pointerId===i&&(o(),Z(!0))}function c(e){e.pointerId===i&&(o(),Z(!1))}function l(e){e.key===`Escape`&&(o(),Z(!1))}window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,c),window.addEventListener(`keydown`,l),O=o,Y(),k=requestAnimationFrame(X)},applyReorderSettle:()=>{let t=w;if(w=null,!t)return;let n=x?.scrollContainerRef.current??null;if(!n)return;let r=new Map,i=new Map;n.querySelectorAll(`[data-ssg-col-key]`).forEach(a=>{if(e.isInsideDetailCardOf(n,a))return;let o=a.dataset.ssgColKey;if(!o||!t.has(o))return;let s=r.get(o);s?s.push(a):(r.set(o,[a]),i.set(o,a.getBoundingClientRect().left))});let a=[];if(r.forEach((e,n)=>{let r=t.get(n),o=i.get(n);if(r===void 0||o===void 0)return;let s=r-o;if(!(Math.abs(s)<.5))for(let t of e)t.style.transition=`none`,t.style.transform=`translateX(${s}px)`,t.style.willChange=`transform`,a.push(t)}),a.length!==0){n.getBoundingClientRect();for(let e of a)e.style.transition=`transform ${p}ms ${m}`,e.style.transform=`translateX(0)`;window.setTimeout(()=>{for(let e of a)e.style.transition=``,e.style.transform=``,e.style.willChange=``},280)}},dispose:()=>{O?.(),O=null,k!==null&&(cancelAnimationFrame(k),k=null),S=null,C=null,document.body.style.cursor=``,U(),F&&J(F),F=null,N=null}}};exports.computeHeaderReorderedKeys=i,exports.createColumnHeaderDragController=x;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/geometry.cjs"),n=require("../logic/autoScrollGeometry.cjs"),r=require("../logic/slotDom.cjs");function i(e,n,r,i){let a=e.find(e=>e.key===n);if(!a)return null;let o=t.getColumnPane(a),s={left:[],center:[],right:[]},c=new Map;for(let n of e)s[t.getColumnPane(n)].push(n.key),c.set(n.key,n.visible!==!1);let l=s[r].filter(e=>c.get(e)).indexOf(n),u=s[o].indexOf(n);if(u<0)return null;s[o].splice(u,1);let d=i;o===r&&l>=0&&d>l&&--d;let f=s[r].filter(e=>c.get(e));if(d=Math.max(0,Math.min(d,f.length)),o===r&&l>=0&&d===l)return null;let p;return p=d>=f.length?s[r].length:s[r].indexOf(f[d]),s[r].splice(p,0,n),[...s.left,...s.center,...s.right]}function a(n,r,i,a){let o=n.filter(e=>t.getColumnPane(e)===i&&e.visible!==!1).map(e=>e.key),{entries:s}=r;for(let t=Math.max(a,0);t<s.length;t+=1){let n=s[t].column.key;if(e.isSyntheticColumnKey(n))continue;let r=o.indexOf(n);return r<0?o.length:r}return o.length}var o=t=>{let n=0;for(;n<t.entries.length&&e.isSyntheticColumnKey(t.entries[n].column.key);)n+=1;return n},s=32,c=2,l=14,u=12,d=14,f=e=>`<svg viewBox="0 0 24 24" width="`+e+`" height="`+e+`" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="5 9 2 12 5 15"/><polyline points="9 5 12 2 15 5"/><polyline points="15 19 12 22 9 19"/><polyline points="19 9 22 12 19 15"/><line x1="2" y1="12" x2="22" y2="12"/><line x1="12" y1="2" x2="12" y2="22"/></svg>`,p=e=>`<svg viewBox="0 0 24 24" width="`+e+`" height="`+e+`" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="17" x2="12" y2="22"/><path d="M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"/></svg>`,m=f(d),h=p(d),g=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="4.9" y1="4.9" x2="19.1" y2="19.1"/></svg>`,_=`0.5`,v=200,y=`cubic-bezier(0.2, 0.7, 0.3, 1)`,ee=e=>e?.closest(`.ssg-motion-off`)!=null,te=160,b=`transform ${te}ms ${y}`,x=`data-ssg-col-dragging`,ne=`4`,re=`9`,ie=`ssg-col-drag-float`,ae=`ssg-col-drag-pin`,oe=12,se=`ssg-col-drop-indicator`,ce=`ssg-header-cell`,le=[`data-ssg-col-key`,`data-ssg-tooltip`,`data-autoheight-cell`,`id`,`tabindex`],ue=180,de=400,S=t=>{let n=[];return t.querySelectorAll(`[data-ssg-col-key]`).forEach(r=>{e.isInsideDetailCardOf(t,r)||n.push(r)}),n},fe=t=>{if(!t)return null;let n=new Map;return t.querySelectorAll(`[data-ssg-col-key]`).forEach(r=>{if(e.isInsideDetailCardOf(t,r))return;let i=r.dataset.ssgColKey;i&&!n.has(i)&&n.set(i,r.getBoundingClientRect().left)}),n},pe=e=>{let t=getComputedStyle(e).transform,n=/^matrix(3d)?\(([^)]*)\)$/.exec(t);if(n===null)return 0;let r=Number(n[2].split(`,`)[n[1]===`3d`?12:4]);return Number.isFinite(r)?r:0},C=()=>{let d=null,C=null,w=null,T=null,E={x:0,y:0},D=null,O=!1,k=null,A=null,j=null,M=null,N=null,P=null,F=null,I=null,me=0,L=null,R=null,z=``,B=null,V=0,H=null,U=null,he=()=>d?.motion===`live`,W=()=>({left:d?.leftIndicatorRef.current??null,center:d?.centerIndicatorRef.current??null,right:d?.rightIndicatorRef.current??null}),G=()=>{for(let e of Object.values(W()))e&&(e.style.display=`none`)},ge=e=>{if(N)return;let t=document.createElement(`div`);t.setAttribute(`data-grid-drag-ghost`,``),d?.scrollContainerRef.current?.closest(`.ssg-theme-dark`)!=null&&t.classList.add(`ssg-theme-dark`),d?.scrollContainerRef.current?.closest(`.ssg-motion-off`)!=null&&t.classList.add(`ssg-motion-off`),t.style.cssText=[`position:fixed`,`top:0`,`left:0`,`display:inline-flex`,`align-items:center`,`gap:7px`,`padding:7px 12px 7px 10px`,`border-radius:9px`,`border:1px solid var(--ssg-ghost-border)`,`background:var(--ssg-ghost-bg)`,`color:var(--ssg-ghost-text)`,`font-size:12px`,`font-weight:600`,`line-height:1`,`white-space:nowrap`,`box-shadow:var(--ssg-ghost-shadow)`,`pointer-events:none`,`user-select:none`,`z-index:9999`,`will-change:transform`,`transform:translate(-9999px,-9999px)`].join(`;`),r.applySlotToElement(t,d?.ghostSlot);let n=document.createElement(`span`);n.style.cssText=`display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none`;let i=document.createElement(`span`);i.textContent=e,t.appendChild(n),t.appendChild(i),document.body.appendChild(t),N=t,P=n,F=null},_e=e=>{let t=N;if(!t)return;t.style.transform=`translate(`+(E.x+l)+`px,`+(E.y+u)+`px)`;let n=e??`out`;if(F===n)return;F=n;let r=P;n===`out`?(t.style.opacity=_,r&&(r.innerHTML=g)):(t.style.opacity=`1`,r&&(r.innerHTML=n===`center`?m:h))},K=()=>{N&&N.parentNode&&N.parentNode.removeChild(N),N=null,P=null,F=null},ve=(e,n)=>{if(d===null)return null;let{paneLayout:r,leftPaneScrollRef:i,rightPaneScrollRef:a,bodyScrollRef:l,scrollContainerRef:u,leftLeadingWidth:f,centerLeadingWidth:p,rightLeadingWidth:m}=d,h=u.current;if(h){let t=h.getBoundingClientRect();if(e<t.left||e>t.right||n<t.top||n>t.bottom)return null}let g=i.current,_=a.current;if(g&&r.left.entries.length===0&&e<=g.getBoundingClientRect().left+s)return{pane:`left`,slot:0,leftPx:c};if(g&&r.left.entries.length>0){let n=g.getBoundingClientRect();if(e<n.right){let i=e-n.left-f,a=Math.max(t.findPaneDropSlot(r.left,i),o(r.left));return{pane:`left`,slot:a,leftPx:f+t.paneDropSlotBoundaryX(r.left,a)}}}if(_&&r.right.entries.length===0&&e>=_.getBoundingClientRect().left-s)return{pane:`right`,slot:0,leftPx:-2};if(_&&r.right.entries.length>0){let n=_.getBoundingClientRect();if(e>=n.left){let i=e-n.left-m,a=Math.max(t.findPaneDropSlot(r.right,i),o(r.right));return{pane:`right`,slot:a,leftPx:m+t.paneDropSlotBoundaryX(r.right,a)}}}let v=l.current;if(v&&r.center.entries.length>0){let n=v.getBoundingClientRect(),i=v.scrollLeft+e-n.left-p,a=Math.max(t.findPaneDropSlot(r.center,Math.max(i,0)),o(r.center));return{pane:`center`,slot:a,leftPx:p+t.paneDropSlotBoundaryX(r.center,a)}}return null},ye=e=>{let t=W();for(let n of[`left`,`center`,`right`]){let r=t[n];r&&(n===e.pane?(r.style.left=`${e.leftPx}px`,r.style.display=`block`):r.style.display=`none`)}},be=(e,t)=>{let n=R?.get(t);n!==void 0&&R?.delete(t),e.set(t,n??{zIndex:t.style.zIndex,visibility:t.style.visibility})},q=(e,t)=>{let n=[],r=L,i=C,a=I;if(!r||i===null||a===null||d===null)return n;let o=d.scrollContainerRef.current;if(!o)return n;let s=d.paneLayout[a].entries,c=s.findIndex(e=>e.column.key===i);if(c<0)return n;let l=s[c].paneLocalSize,u=t===`lift-out`?s.length-1:t===`rest`||e===null?c:e>c?e-1:e,f=new Map;for(let e=Math.min(c,u);e<=Math.max(c,u);e+=1)e!==c&&f.set(s[e].column.key,e>c?-l:l);let p=a===`center`?o.scrollLeft-me:0,m=(D?E.x-D.x:0)+p,h=U,g=new WeakSet;U=g;for(let e of S(o)){let a=e.dataset.ssgColKey;if(a===void 0)continue;g.add(e);let o=h!==null&&!h.has(e)?`none`:b;if(a===i){n.push(e),r.has(e)||(be(r,e),e.style.zIndex=ne,e.style.willChange=`transform`);let i=r.get(e);t===`follow`?(e.style.visibility=i?.visibility??``,e.setAttribute(x,`live`),e.style.transition=`none`,e.style.transform=`translateX(${m}px)`):t===`lift-out`?(e.style.visibility=`hidden`,e.removeAttribute(x),e.style.transition=`none`,e.style.transform=`translateX(0px)`):(e.style.visibility=i?.visibility??``,e.removeAttribute(x),e.style.transition=o,e.style.transform=`translateX(0px)`);continue}let s=f.get(a)??0;if(s===0&&!r.has(e))continue;r.has(e)||be(r,e);let c=`translateX(${s}px)`;e.style.transform!==c&&(e.style.transition=o,e.style.transform=c)}return n},J=e=>{e.forEach((e,t)=>{t.style.transition=``,t.style.transform=``,t.style.willChange=``,t.style.zIndex=e.zIndex,t.style.visibility=e.visibility,t.removeAttribute(x)})},xe=e=>{let t=e=>{for(let t of le)e.removeAttribute(t)};t(e),e.querySelectorAll(`*`).forEach(t),e.querySelectorAll(`.ssg-header-actions`).forEach(e=>e.remove())},Se=(e,t,n)=>{let r=B;if(r===null){let e=document.createElement(`div`);e.className=ie,e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`inert`,``);let n=document.createElement(`div`);n.style.cssText=`position:absolute;top:0;left:0;height:100%;will-change:transform`;let i=document.createElement(`div`);i.className=se,i.style.cssText=`position:absolute;display:none`,e.append(n,i),t.appendChild(e),r={layer:e,column:n,guide:i,badge:null,badgeKind:null,layerWidth:0,columnWidth:0,scrollTop:0,cellCount:0},B=r}let i=t.getBoundingClientRect(),a=e.getBoundingClientRect(),o=a.left+e.clientLeft,s=a.top+e.clientTop;r.layer.style.cssText=[`position:absolute`,`left:${o-i.left-t.clientLeft+t.scrollLeft}px`,`top:${s-i.top-t.clientTop+t.scrollTop}px`,`width:${e.clientWidth}px`,`height:${e.clientHeight}px`,`overflow:hidden`,`pointer-events:none`,`z-index:${re}`].join(`;`);let c=[],l=[],u=0;for(let e of n){let t=e.getBoundingClientRect(),n=e.cloneNode(!0);xe(n),n.setAttribute(x,`live`);let r=n.style;r.position=`absolute`,r.left=`0px`,r.top=`${t.top-s}px`,r.width=`${t.width}px`,r.minWidth=`${t.width}px`,r.height=`${t.height}px`,r.transform=``,r.transition=``,r.visibility=``,r.willChange=``,r.zIndex=``,u=Math.max(u,t.width),(n.classList.contains(ce)?l:c).push(n)}let d=null;for(let e of l)e.style.zIndex=`1`,d===null&&(d=document.createElement(`span`),d.className=ae,e.insertBefore(d,e.firstChild));return r.column.replaceChildren(...c,...l),r.column.style.width=`${u}px`,r.badge=d,r.badgeKind=null,r.layerWidth=e.clientWidth,r.columnWidth=u,r.scrollTop=e.scrollTop,r.cellCount=n.length,r},Ce=e=>{let t=d?.scrollContainerRef.current??null,n=t?.parentElement??null;return!t||!n?null:e.length===0||B!==null&&B.scrollTop===t.scrollTop&&B.cellCount===e.length?B:Se(t,n,e)},we=e=>{if(d===null)return!1;let t=d.leftPaneScrollRef.current;if(t&&d.paneLayout.left.entries.length>0&&e<t.getBoundingClientRect().right-.5)return!0;let n=d.rightPaneScrollRef.current;return!!(n&&d.paneLayout.right.entries.length>0&&e>n.getBoundingClientRect().left+.5)},Te=(e,t,n)=>{let r=e.guide,i=t===null?null:W()[t];if(!i||i.style.display!==`block`){r.style.display=`none`;return}let a=i.getBoundingClientRect();if(t===`center`&&we(a.left+a.width/2)){r.style.display=`none`;return}r.style.left=`${a.left-n.left}px`,r.style.top=`${a.top-n.top}px`,r.style.height=`${a.height}px`,r.style.display=`block`},Ee=(e,t)=>{let n=e.layer.getBoundingClientRect(),r=Math.max(e.layerWidth-e.columnWidth,0),i=Math.min(Math.max(E.x-V-n.left,0),r);e.column.style.transition=`none`,e.column.style.transform=`translateX(${i}px)`;let a=t===null?`none`:t===`center`?`move`:`pin`;e.badge!==null&&e.badgeKind!==a&&(e.badgeKind=a,e.badge.innerHTML=a===`none`?``:a===`move`?f(oe):p(oe),e.badge.style.display=a===`none`?`none`:``),Te(e,t,n)},Y=()=>{B?.layer.remove(),B=null},De=(e,t,n)=>{let r=e.layer.getBoundingClientRect();e.column.style.transition=`transform ${n}ms ${y}`,e.column.style.transform=`translateX(${t-r.left}px)`,e.badge?.remove(),e.guide.style.display=`none`},X=()=>{let e=H;if(H=null,e!==null){e.timer!==null&&window.clearTimeout(e.timer);for(let[t,n]of e.hiddenCells)t.style.visibility=n;e.float.layer.remove()}},Oe=()=>{let e=H;if(e===null||e.key===null)return;let t=e.key;if(e.pane!==null&&!d?.paneLayout[e.pane].entries.some(e=>e.column.key===t))return;e.key=null;let n=d?.scrollContainerRef.current??null,r=n?S(n).filter(e=>e.dataset.ssgColKey===t):[];if(r.length===0){X();return}let i=r[0].getBoundingClientRect().left;for(let t of r)e.hiddenCells.push([t,t.style.visibility]),t.style.visibility=`hidden`;De(e.float,i,ue),e.timer!==null&&window.clearTimeout(e.timer),e.timer=window.setTimeout(X,220)},Z=()=>{let e=ve(E.x,E.y);if(he()){e&&(w={pane:e.pane,slot:e.slot});let t=w;if(t!==null&&t.pane!==I){if(e&&ye(e),(d?.scrollContainerRef.current??null)?.parentElement!=null){let e=Ce(q(null,`lift-out`));if(e!==null){K(),Ee(e,t.pane);return}}Y(),ge(z),_e(t.pane),q(null,`rest`);return}if(K(),G(),q(t===null?null:t.slot,`follow`).length===0&&B!==null){Ee(B,null);return}Y();return}if(_e(e?e.pane:null),!e){w=null,G();return}w={pane:e.pane,slot:e.slot},ye(e)},Q=()=>{if(C===null){j=null;return}let e=d?.scrollContainerRef.current??null;if(e&&(O||(!D||n.hasPointerLeftActivationRadius(D,E,6))&&(O=!0),O)){let t=e.getBoundingClientRect(),r=n.resolveScrollContentBox({rectLeft:t.left,rectTop:t.top,clientLeft:e.clientLeft,clientTop:e.clientTop,clientWidth:e.clientWidth,clientHeight:e.clientHeight}),i=n.resolveAutoScrollAxisDirection(E.x,r.left,r.right,24),a=n.computeNextScrollPosition(e.scrollLeft,i,18,e.scrollWidth-e.clientWidth);a!==e.scrollLeft&&e.scrollTo({left:a,behavior:`auto`})}Z(),j=requestAnimationFrame(Q)},$=e=>{j!==null&&(cancelAnimationFrame(j),j=null),document.body.style.cursor=``,G(),K();let n=C,r=w;C=null,A=null,U=null,w=null,D=null;let o=L;L=null,I=null;let s=n!==null&&r!==null&&d!==null?d.paneLayout[r.pane].entries.findIndex(e=>e.column.key===n):-1,c=r!==null&&s>=0&&(r.slot===s||r.slot===s+1),l=e&&n&&r&&d!==null&&!c?i(d.columns,n,r.pane,a(d.columns,d.paneLayout[r.pane],r.pane,r.slot)):null,u=B;if(B=null,o&&!l){o.forEach((e,t)=>{t.isConnected&&(t.style.transition=b,t.style.transform=`translateX(0px)`)});let e=null;if(u!==null){let t=null;for(let e of o.keys())if(e.isConnected&&e.dataset.ssgColKey===n){t=e;break}t===null?u.layer.remove():(De(u,t.getBoundingClientRect().left,te),e={float:u,key:null,pane:null,timer:null,hiddenCells:[]},H=e)}R=o,window.setTimeout(()=>{J(o),R===o&&(R=null),e!==null&&H===e&&X()},200)}else u!==null&&!l&&u.layer.remove();if(!l||!n||!r||d===null)return;let{columns:f,applyColumnOrderAndPin:p,scrollContainerRef:m}=d,h=f.find(e=>e.key===n),g=h?t.getColumnPane(h):null;T=g!==null&&g===r.pane&&!ee(m.current)?fe(m.current):null,o&&J(o),u!==null&&(u.badge?.remove(),u.guide.style.display=`none`,H={float:u,key:n,pane:r.pane,timer:window.setTimeout(X,de),hiddenCells:[]}),p(l,new Map([[n,r.pane===`center`?void 0:r.pane]]))},ke=()=>{Oe();let t=T;if(T=null,!t)return;let n=d?.scrollContainerRef.current??null;if(!n)return;let r=new Map,i=new Map;n.querySelectorAll(`[data-ssg-col-key]`).forEach(a=>{if(e.isInsideDetailCardOf(n,a))return;let o=a.dataset.ssgColKey;if(!o||!t.has(o))return;let s=r.get(o);s?s.push(a):(r.set(o,[a]),i.set(o,a.getBoundingClientRect().left))});let a=[];if(r.forEach((e,n)=>{let r=t.get(n),o=i.get(n);if(r===void 0||o===void 0)return;let s=r-o;if(!(Math.abs(s)<.5))for(let t of e)t.style.transition=`none`,t.style.transform=`translateX(${s}px)`,t.style.willChange=`transform`,a.push(t)}),a.length===0)return;n.getBoundingClientRect();for(let e of a)e.style.transition=`transform ${v}ms ${y}`,e.style.transform=`translateX(0)`;Ae();let o=()=>{for(let e of a)e.style.transition=``,e.style.transform=``,e.style.willChange=``},s={run:o,timer:window.setTimeout(()=>{M===s&&(M=null),o()},280)};M=s},Ae=()=>{let e=M;M=null,e!==null&&(window.clearTimeout(e.timer),e.run())};return{update:e=>{d=e},onColumnDragHandlePointerDown:(e,n)=>{if(d===null||!d.enabled||n.button!==0)return;if(n.stopPropagation(),n.preventDefault(),C!==null){if(n.pointerId!==A)return;k?.(),$(!1)}if(Ae(),X(),Y(),R?.forEach((e,t)=>{t.style.visibility=e.visibility}),C=e.key,A=n.pointerId,w=null,U=null,E={x:n.clientX,y:n.clientY},D={x:n.clientX,y:n.clientY},O=!1,document.body.style.cursor=`grabbing`,z=e.title||e.key,he()){let r=d.scrollContainerRef.current;I=t.getColumnPane(e),me=r?.scrollLeft??0,L=new Map;let i=r?S(r).find(t=>t.dataset.ssgColKey===e.key):void 0;V=i?n.clientX-(i.getBoundingClientRect().left-pe(i)):(d.paneLayout[I].entries.find(t=>t.column.key===e.key)?.paneLocalSize??0)/2}else ge(z);let r=n.currentTarget,i=n.pointerId;try{r.setPointerCapture(i)}catch{}let a=e=>{e.pointerId===i&&(E={x:e.clientX,y:e.clientY},Z())},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),window.removeEventListener(`keydown`,l),k=null;try{r.releasePointerCapture(i)}catch{}};function s(e){e.pointerId===i&&(o(),$(!0))}function c(e){e.pointerId===i&&(o(),$(!1))}function l(e){e.key===`Escape`&&(o(),$(!1))}window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,c),window.addEventListener(`keydown`,l),k=o,Z(),j=requestAnimationFrame(Q)},applyReorderSettle:ke,dispose:()=>{k?.(),k=null,j!==null&&(cancelAnimationFrame(j),j=null),C=null,A=null,w=null,document.body.style.cursor=``,K(),L&&J(L),L=null,I=null,Y(),X()}}};exports.computeHeaderReorderedKeys=i,exports.createColumnHeaderDragController=C,exports.resolveConsumerDropSlot=a;
@@ -1,7 +1,8 @@
1
1
  import type { GridColumn, GridColumnPinned, GridResolvedSlot } from '../model/gridTypes.unbound.js';
2
- import { type ColumnPane, type GridPaneLayout } from '../logic/geometry.js';
2
+ import { type ColumnPane, type GridPaneLayout, type PaneGeometry } from '../logic/geometry.js';
3
3
  type ApplyColumnOrderAndPin = (orderedKeys: string[], pinOverride?: Map<string, GridColumnPinned | undefined>) => void;
4
4
  export declare function computeHeaderReorderedKeys<T>(columns: GridColumn<T>[], draggedKey: string, targetPane: ColumnPane, slotInTargetVisible: number): string[] | null;
5
+ export declare function resolveConsumerDropSlot<T>(columns: GridColumn<T>[], paneGeometry: PaneGeometry<T>, pane: ColumnPane, slot: number): number;
5
6
  type ReadonlyRef<V> = {
6
7
  readonly current: V;
7
8
  };
@@ -1,37 +1,57 @@
1
- import { isInsideDetailCardOf as e } from "../logic/detailRow.js";
2
- import { findPaneDropSlot as t, getColumnPane as n, paneDropSlotBoundaryX as r } from "../logic/geometry.js";
3
- import { computeNextScrollPosition as i, hasPointerLeftActivationRadius as a, resolveAutoScrollAxisDirection as o, resolveScrollContentBox as s } from "../logic/autoScrollGeometry.js";
4
- import { applySlotToElement as c } from "../logic/slotDom.js";
1
+ import { isInsideDetailCardOf as e, isSyntheticColumnKey as t } from "../logic/detailRow.js";
2
+ import { findPaneDropSlot as n, getColumnPane as r, paneDropSlotBoundaryX as i } from "../logic/geometry.js";
3
+ import { computeNextScrollPosition as a, hasPointerLeftActivationRadius as o, resolveAutoScrollAxisDirection as s, resolveScrollContentBox as c } from "../logic/autoScrollGeometry.js";
4
+ import { applySlotToElement as l } from "../logic/slotDom.js";
5
5
  //#region src/controllers/columnHeaderDragController.ts
6
- function l(e, t, r, i) {
6
+ function u(e, t, n, i) {
7
7
  let a = e.find((e) => e.key === t);
8
8
  if (!a) return null;
9
- let o = n(a), s = {
9
+ let o = r(a), s = {
10
10
  left: [],
11
11
  center: [],
12
12
  right: []
13
13
  }, c = /* @__PURE__ */ new Map();
14
- for (let t of e) s[n(t)].push(t.key), c.set(t.key, t.visible !== !1);
15
- let l = s[r].filter((e) => c.get(e)).indexOf(t), u = s[o].indexOf(t);
14
+ for (let t of e) s[r(t)].push(t.key), c.set(t.key, t.visible !== !1);
15
+ let l = s[n].filter((e) => c.get(e)).indexOf(t), u = s[o].indexOf(t);
16
16
  if (u < 0) return null;
17
17
  s[o].splice(u, 1);
18
18
  let d = i;
19
- o === r && l >= 0 && d > l && --d;
20
- let f = s[r].filter((e) => c.get(e));
21
- if (d = Math.max(0, Math.min(d, f.length)), o === r && l >= 0 && d === l) return null;
19
+ o === n && l >= 0 && d > l && --d;
20
+ let f = s[n].filter((e) => c.get(e));
21
+ if (d = Math.max(0, Math.min(d, f.length)), o === n && l >= 0 && d === l) return null;
22
22
  let p;
23
- return p = d >= f.length ? s[r].length : s[r].indexOf(f[d]), s[r].splice(p, 0, t), [
23
+ return p = d >= f.length ? s[n].length : s[n].indexOf(f[d]), s[n].splice(p, 0, t), [
24
24
  ...s.left,
25
25
  ...s.center,
26
26
  ...s.right
27
27
  ];
28
28
  }
29
- var u = 32, d = 2, f = 14, p = 12, m = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"5 9 2 12 5 15\"/><polyline points=\"9 5 12 2 15 5\"/><polyline points=\"15 19 12 22 9 19\"/><polyline points=\"19 9 22 12 19 15\"/><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"/><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"22\"/></svg>", h = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"22\"/><path d=\"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z\"/></svg>", g = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"4.9\" y1=\"4.9\" x2=\"19.1\" y2=\"19.1\"/></svg>", _ = "0.5", v = 200, y = "cubic-bezier(0.2, 0.7, 0.3, 1)", ee = (e) => e?.closest(".ssg-motion-off") != null, b = `transform 160ms ${y}`, x = "data-ssg-col-dragging", S = "4", C = (t) => {
29
+ function d(e, n, i, a) {
30
+ let o = e.filter((e) => r(e) === i && e.visible !== !1).map((e) => e.key), { entries: s } = n;
31
+ for (let e = Math.max(a, 0); e < s.length; e += 1) {
32
+ let n = s[e].column.key;
33
+ if (t(n)) continue;
34
+ let r = o.indexOf(n);
35
+ return r < 0 ? o.length : r;
36
+ }
37
+ return o.length;
38
+ }
39
+ var f = (e) => {
40
+ let n = 0;
41
+ for (; n < e.entries.length && t(e.entries[n].column.key);) n += 1;
42
+ return n;
43
+ }, p = 32, m = 2, h = 14, g = 12, _ = 14, v = (e) => "<svg viewBox=\"0 0 24 24\" width=\"" + e + "\" height=\"" + e + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"5 9 2 12 5 15\"/><polyline points=\"9 5 12 2 15 5\"/><polyline points=\"15 19 12 22 9 19\"/><polyline points=\"19 9 22 12 19 15\"/><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"/><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"22\"/></svg>", y = (e) => "<svg viewBox=\"0 0 24 24\" width=\"" + e + "\" height=\"" + e + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"22\"/><path d=\"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z\"/></svg>", ee = v(_), te = y(_), ne = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"4.9\" y1=\"4.9\" x2=\"19.1\" y2=\"19.1\"/></svg>", re = "0.5", ie = 200, b = "cubic-bezier(0.2, 0.7, 0.3, 1)", ae = (e) => e?.closest(".ssg-motion-off") != null, oe = 160, x = `transform ${oe}ms ${b}`, S = "data-ssg-col-dragging", se = "4", ce = "9", le = "ssg-col-drag-float", ue = "ssg-col-drag-pin", C = 12, de = "ssg-col-drop-indicator", fe = "ssg-header-cell", pe = [
44
+ "data-ssg-col-key",
45
+ "data-ssg-tooltip",
46
+ "data-autoheight-cell",
47
+ "id",
48
+ "tabindex"
49
+ ], me = 180, he = 400, w = (t) => {
30
50
  let n = [];
31
51
  return t.querySelectorAll("[data-ssg-col-key]").forEach((r) => {
32
52
  e(t, r) || n.push(r);
33
53
  }), n;
34
- }, te = (t) => {
54
+ }, ge = (t) => {
35
55
  if (!t) return null;
36
56
  let n = /* @__PURE__ */ new Map();
37
57
  return t.querySelectorAll("[data-ssg-col-key]").forEach((r) => {
@@ -39,20 +59,25 @@ var u = 32, d = 2, f = 14, p = 12, m = "<svg viewBox=\"0 0 24 24\" width=\"14\"
39
59
  let i = r.dataset.ssgColKey;
40
60
  i && !n.has(i) && n.set(i, r.getBoundingClientRect().left);
41
61
  }), n;
42
- }, w = () => {
43
- let w = null, T = null, E = null, D = null, O = {
62
+ }, _e = (e) => {
63
+ let t = getComputedStyle(e).transform, n = /^matrix(3d)?\(([^)]*)\)$/.exec(t);
64
+ if (n === null) return 0;
65
+ let r = Number(n[2].split(",")[n[1] === "3d" ? 12 : 4]);
66
+ return Number.isFinite(r) ? r : 0;
67
+ }, T = () => {
68
+ let t = null, _ = null, T = null, E = null, D = {
44
69
  x: 0,
45
70
  y: 0
46
- }, k = null, A = !1, j = null, M = null, N = null, P = null, F = null, I = null, L = 0, R = null, z = null, B = "", V = () => w?.motion === "live", H = () => ({
47
- left: w?.leftIndicatorRef.current ?? null,
48
- center: w?.centerIndicatorRef.current ?? null,
49
- right: w?.rightIndicatorRef.current ?? null
50
- }), U = () => {
51
- for (let e of Object.values(H())) e && (e.style.display = "none");
52
- }, W = (e) => {
53
- if (N) return;
54
- let t = document.createElement("div");
55
- t.setAttribute("data-grid-drag-ghost", ""), w?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), w?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && t.classList.add("ssg-motion-off"), t.style.cssText = [
71
+ }, O = null, k = !1, A = null, j = null, M = null, N = null, P = null, F = null, I = null, L = null, ve = 0, R = null, z = null, B = "", V = null, ye = 0, H = null, U = null, be = () => t?.motion === "live", W = () => ({
72
+ left: t?.leftIndicatorRef.current ?? null,
73
+ center: t?.centerIndicatorRef.current ?? null,
74
+ right: t?.rightIndicatorRef.current ?? null
75
+ }), G = () => {
76
+ for (let e of Object.values(W())) e && (e.style.display = "none");
77
+ }, xe = (e) => {
78
+ if (P) return;
79
+ let n = document.createElement("div");
80
+ n.setAttribute("data-grid-drag-ghost", ""), t?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && n.classList.add("ssg-theme-dark"), t?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && n.classList.add("ssg-motion-off"), n.style.cssText = [
56
81
  "position:fixed",
57
82
  "top:0",
58
83
  "left:0",
@@ -74,74 +99,74 @@ var u = 32, d = 2, f = 14, p = 12, m = "<svg viewBox=\"0 0 24 24\" width=\"14\"
74
99
  "z-index:9999",
75
100
  "will-change:transform",
76
101
  "transform:translate(-9999px,-9999px)"
77
- ].join(";"), c(t, w?.ghostSlot);
78
- let n = document.createElement("span");
79
- n.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
102
+ ].join(";"), l(n, t?.ghostSlot);
80
103
  let r = document.createElement("span");
81
- r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t), N = t, P = n, F = null;
82
- }, G = (e) => {
83
- let t = N;
104
+ r.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
105
+ let i = document.createElement("span");
106
+ i.textContent = e, n.appendChild(r), n.appendChild(i), document.body.appendChild(n), P = n, F = r, I = null;
107
+ }, Se = (e) => {
108
+ let t = P;
84
109
  if (!t) return;
85
- t.style.transform = "translate(" + (O.x + f) + "px," + (O.y + p) + "px)";
110
+ t.style.transform = "translate(" + (D.x + h) + "px," + (D.y + g) + "px)";
86
111
  let n = e ?? "out";
87
- if (F === n) return;
88
- F = n;
89
- let r = P;
90
- n === "out" ? (t.style.opacity = _, r && (r.innerHTML = g)) : (t.style.opacity = "1", r && (r.innerHTML = n === "center" ? m : h));
112
+ if (I === n) return;
113
+ I = n;
114
+ let r = F;
115
+ n === "out" ? (t.style.opacity = re, r && (r.innerHTML = ne)) : (t.style.opacity = "1", r && (r.innerHTML = n === "center" ? ee : te));
91
116
  }, K = () => {
92
- N && N.parentNode && N.parentNode.removeChild(N), N = null, P = null, F = null;
93
- }, ne = (e, n) => {
94
- if (w === null) return null;
95
- let { paneLayout: i, leftPaneScrollRef: a, rightPaneScrollRef: o, bodyScrollRef: s, scrollContainerRef: c, leftLeadingWidth: l, centerLeadingWidth: f, rightLeadingWidth: p } = w, m = c.current;
96
- if (m) {
97
- let t = m.getBoundingClientRect();
98
- if (e < t.left || e > t.right || n < t.top || n > t.bottom) return null;
117
+ P && P.parentNode && P.parentNode.removeChild(P), P = null, F = null, I = null;
118
+ }, Ce = (e, r) => {
119
+ if (t === null) return null;
120
+ let { paneLayout: a, leftPaneScrollRef: o, rightPaneScrollRef: s, bodyScrollRef: c, scrollContainerRef: l, leftLeadingWidth: u, centerLeadingWidth: d, rightLeadingWidth: h } = t, g = l.current;
121
+ if (g) {
122
+ let t = g.getBoundingClientRect();
123
+ if (e < t.left || e > t.right || r < t.top || r > t.bottom) return null;
99
124
  }
100
- let h = a.current, g = o.current;
101
- if (h && i.left.entries.length === 0 && e <= h.getBoundingClientRect().left + u) return {
125
+ let _ = o.current, v = s.current;
126
+ if (_ && a.left.entries.length === 0 && e <= _.getBoundingClientRect().left + p) return {
102
127
  pane: "left",
103
128
  slot: 0,
104
- leftPx: d
129
+ leftPx: m
105
130
  };
106
- if (h && i.left.entries.length > 0) {
107
- let n = h.getBoundingClientRect();
108
- if (e < n.right) {
109
- let a = e - n.left - l, o = t(i.left, a);
131
+ if (_ && a.left.entries.length > 0) {
132
+ let t = _.getBoundingClientRect();
133
+ if (e < t.right) {
134
+ let r = e - t.left - u, o = Math.max(n(a.left, r), f(a.left));
110
135
  return {
111
136
  pane: "left",
112
137
  slot: o,
113
- leftPx: l + r(i.left, o)
138
+ leftPx: u + i(a.left, o)
114
139
  };
115
140
  }
116
141
  }
117
- if (g && i.right.entries.length === 0 && e >= g.getBoundingClientRect().left - u) return {
142
+ if (v && a.right.entries.length === 0 && e >= v.getBoundingClientRect().left - p) return {
118
143
  pane: "right",
119
144
  slot: 0,
120
145
  leftPx: -2
121
146
  };
122
- if (g && i.right.entries.length > 0) {
123
- let n = g.getBoundingClientRect();
124
- if (e >= n.left) {
125
- let a = e - n.left - p, o = t(i.right, a);
147
+ if (v && a.right.entries.length > 0) {
148
+ let t = v.getBoundingClientRect();
149
+ if (e >= t.left) {
150
+ let r = e - t.left - h, o = Math.max(n(a.right, r), f(a.right));
126
151
  return {
127
152
  pane: "right",
128
153
  slot: o,
129
- leftPx: p + r(i.right, o)
154
+ leftPx: h + i(a.right, o)
130
155
  };
131
156
  }
132
157
  }
133
- let _ = s.current;
134
- if (_ && i.center.entries.length > 0) {
135
- let n = _.getBoundingClientRect(), a = _.scrollLeft + e - n.left - f, o = t(i.center, Math.max(a, 0));
158
+ let y = c.current;
159
+ if (y && a.center.entries.length > 0) {
160
+ let t = y.getBoundingClientRect(), r = y.scrollLeft + e - t.left - d, o = Math.max(n(a.center, Math.max(r, 0)), f(a.center));
136
161
  return {
137
162
  pane: "center",
138
163
  slot: o,
139
- leftPx: f + r(i.center, o)
164
+ leftPx: d + i(a.center, o)
140
165
  };
141
166
  }
142
167
  return null;
143
- }, q = (e) => {
144
- let t = H();
168
+ }, we = (e) => {
169
+ let t = W();
145
170
  for (let n of [
146
171
  "left",
147
172
  "center",
@@ -150,165 +175,329 @@ var u = 32, d = 2, f = 14, p = 12, m = "<svg viewBox=\"0 0 24 24\" width=\"14\"
150
175
  let r = t[n];
151
176
  r && (n === e.pane ? (r.style.left = `${e.leftPx}px`, r.style.display = "block") : r.style.display = "none");
152
177
  }
153
- }, J = (e, t) => {
178
+ }, Te = (e, t) => {
154
179
  let n = z?.get(t);
155
- n !== void 0 && z?.delete(t), e.set(t, n ?? t.style.zIndex);
156
- }, Y = (e, t) => {
157
- let n = R, r = T, i = I;
158
- if (!n || r === null || i === null || w === null) return;
159
- let a = w.scrollContainerRef.current;
160
- if (!a) return;
161
- let o = w.paneLayout[i].entries, s = o.findIndex((e) => e.column.key === r);
162
- if (s < 0) return;
163
- let c = o[s].paneLocalSize, l = !t || e === null ? s : e > s ? e - 1 : e, u = /* @__PURE__ */ new Map();
164
- for (let e = Math.min(s, l); e <= Math.max(s, l); e += 1) e !== s && u.set(o[e].column.key, e > s ? -c : c);
165
- let d = i === "center" ? a.scrollLeft - L : 0, f = (k ? O.x - k.x : 0) + d;
166
- for (let e of C(a)) {
167
- let i = e.dataset.ssgColKey;
168
- if (i === void 0) continue;
169
- if (i === r) {
170
- n.has(e) || (J(n, e), e.style.zIndex = S, e.style.willChange = "transform"), t ? (e.setAttribute(x, "live"), e.style.transition = "none", e.style.transform = `translateX(${f}px)`) : (e.removeAttribute(x), e.style.transition = b, e.style.transform = "translateX(0px)");
180
+ n !== void 0 && z?.delete(t), e.set(t, n ?? {
181
+ zIndex: t.style.zIndex,
182
+ visibility: t.style.visibility
183
+ });
184
+ }, q = (e, n) => {
185
+ let r = [], i = R, a = _, o = L;
186
+ if (!i || a === null || o === null || t === null) return r;
187
+ let s = t.scrollContainerRef.current;
188
+ if (!s) return r;
189
+ let c = t.paneLayout[o].entries, l = c.findIndex((e) => e.column.key === a);
190
+ if (l < 0) return r;
191
+ let u = c[l].paneLocalSize, d = n === "lift-out" ? c.length - 1 : n === "rest" || e === null ? l : e > l ? e - 1 : e, f = /* @__PURE__ */ new Map();
192
+ for (let e = Math.min(l, d); e <= Math.max(l, d); e += 1) e !== l && f.set(c[e].column.key, e > l ? -u : u);
193
+ let p = o === "center" ? s.scrollLeft - ve : 0, m = (O ? D.x - O.x : 0) + p, h = U, g = /* @__PURE__ */ new WeakSet();
194
+ U = g;
195
+ for (let e of w(s)) {
196
+ let t = e.dataset.ssgColKey;
197
+ if (t === void 0) continue;
198
+ g.add(e);
199
+ let o = h !== null && !h.has(e) ? "none" : x;
200
+ if (t === a) {
201
+ r.push(e), i.has(e) || (Te(i, e), e.style.zIndex = se, e.style.willChange = "transform");
202
+ let t = i.get(e);
203
+ n === "follow" ? (e.style.visibility = t?.visibility ?? "", e.setAttribute(S, "live"), e.style.transition = "none", e.style.transform = `translateX(${m}px)`) : n === "lift-out" ? (e.style.visibility = "hidden", e.removeAttribute(S), e.style.transition = "none", e.style.transform = "translateX(0px)") : (e.style.visibility = t?.visibility ?? "", e.removeAttribute(S), e.style.transition = o, e.style.transform = "translateX(0px)");
171
204
  continue;
172
205
  }
173
- let a = u.get(i) ?? 0;
174
- if (a === 0 && !n.has(e)) continue;
175
- n.has(e) || J(n, e);
176
- let o = `translateX(${a}px)`;
177
- e.style.transform !== o && (e.style.transition = b, e.style.transform = o);
206
+ let s = f.get(t) ?? 0;
207
+ if (s === 0 && !i.has(e)) continue;
208
+ i.has(e) || Te(i, e);
209
+ let c = `translateX(${s}px)`;
210
+ e.style.transform !== c && (e.style.transition = o, e.style.transform = c);
178
211
  }
179
- }, X = (e) => {
212
+ return r;
213
+ }, J = (e) => {
180
214
  e.forEach((e, t) => {
181
- t.style.transition = "", t.style.transform = "", t.style.willChange = "", t.style.zIndex = e, t.removeAttribute(x);
215
+ t.style.transition = "", t.style.transform = "", t.style.willChange = "", t.style.zIndex = e.zIndex, t.style.visibility = e.visibility, t.removeAttribute(S);
182
216
  });
217
+ }, Ee = (e) => {
218
+ let t = (e) => {
219
+ for (let t of pe) e.removeAttribute(t);
220
+ };
221
+ t(e), e.querySelectorAll("*").forEach(t), e.querySelectorAll(".ssg-header-actions").forEach((e) => e.remove());
222
+ }, De = (e, t, n) => {
223
+ let r = V;
224
+ if (r === null) {
225
+ let e = document.createElement("div");
226
+ e.className = le, e.setAttribute("aria-hidden", "true"), e.setAttribute("inert", "");
227
+ let n = document.createElement("div");
228
+ n.style.cssText = "position:absolute;top:0;left:0;height:100%;will-change:transform";
229
+ let i = document.createElement("div");
230
+ i.className = de, i.style.cssText = "position:absolute;display:none", e.append(n, i), t.appendChild(e), r = {
231
+ layer: e,
232
+ column: n,
233
+ guide: i,
234
+ badge: null,
235
+ badgeKind: null,
236
+ layerWidth: 0,
237
+ columnWidth: 0,
238
+ scrollTop: 0,
239
+ cellCount: 0
240
+ }, V = r;
241
+ }
242
+ let i = t.getBoundingClientRect(), a = e.getBoundingClientRect(), o = a.left + e.clientLeft, s = a.top + e.clientTop;
243
+ r.layer.style.cssText = [
244
+ "position:absolute",
245
+ `left:${o - i.left - t.clientLeft + t.scrollLeft}px`,
246
+ `top:${s - i.top - t.clientTop + t.scrollTop}px`,
247
+ `width:${e.clientWidth}px`,
248
+ `height:${e.clientHeight}px`,
249
+ "overflow:hidden",
250
+ "pointer-events:none",
251
+ `z-index:${ce}`
252
+ ].join(";");
253
+ let c = [], l = [], u = 0;
254
+ for (let e of n) {
255
+ let t = e.getBoundingClientRect(), n = e.cloneNode(!0);
256
+ Ee(n), n.setAttribute(S, "live");
257
+ let r = n.style;
258
+ r.position = "absolute", r.left = "0px", r.top = `${t.top - s}px`, r.width = `${t.width}px`, r.minWidth = `${t.width}px`, r.height = `${t.height}px`, r.transform = "", r.transition = "", r.visibility = "", r.willChange = "", r.zIndex = "", u = Math.max(u, t.width), (n.classList.contains(fe) ? l : c).push(n);
259
+ }
260
+ let d = null;
261
+ for (let e of l) e.style.zIndex = "1", d === null && (d = document.createElement("span"), d.className = ue, e.insertBefore(d, e.firstChild));
262
+ return r.column.replaceChildren(...c, ...l), r.column.style.width = `${u}px`, r.badge = d, r.badgeKind = null, r.layerWidth = e.clientWidth, r.columnWidth = u, r.scrollTop = e.scrollTop, r.cellCount = n.length, r;
263
+ }, Oe = (e) => {
264
+ let n = t?.scrollContainerRef.current ?? null, r = n?.parentElement ?? null;
265
+ return !n || !r ? null : e.length === 0 || V !== null && V.scrollTop === n.scrollTop && V.cellCount === e.length ? V : De(n, r, e);
266
+ }, ke = (e) => {
267
+ if (t === null) return !1;
268
+ let n = t.leftPaneScrollRef.current;
269
+ if (n && t.paneLayout.left.entries.length > 0 && e < n.getBoundingClientRect().right - .5) return !0;
270
+ let r = t.rightPaneScrollRef.current;
271
+ return !!(r && t.paneLayout.right.entries.length > 0 && e > r.getBoundingClientRect().left + .5);
272
+ }, Ae = (e, t, n) => {
273
+ let r = e.guide, i = t === null ? null : W()[t];
274
+ if (!i || i.style.display !== "block") {
275
+ r.style.display = "none";
276
+ return;
277
+ }
278
+ let a = i.getBoundingClientRect();
279
+ if (t === "center" && ke(a.left + a.width / 2)) {
280
+ r.style.display = "none";
281
+ return;
282
+ }
283
+ r.style.left = `${a.left - n.left}px`, r.style.top = `${a.top - n.top}px`, r.style.height = `${a.height}px`, r.style.display = "block";
284
+ }, je = (e, t) => {
285
+ let n = e.layer.getBoundingClientRect(), r = Math.max(e.layerWidth - e.columnWidth, 0), i = Math.min(Math.max(D.x - ye - n.left, 0), r);
286
+ e.column.style.transition = "none", e.column.style.transform = `translateX(${i}px)`;
287
+ let a = t === null ? "none" : t === "center" ? "move" : "pin";
288
+ e.badge !== null && e.badgeKind !== a && (e.badgeKind = a, e.badge.innerHTML = a === "none" ? "" : a === "move" ? v(C) : y(C), e.badge.style.display = a === "none" ? "none" : ""), Ae(e, t, n);
289
+ }, Y = () => {
290
+ V?.layer.remove(), V = null;
291
+ }, Me = (e, t, n) => {
292
+ let r = e.layer.getBoundingClientRect();
293
+ e.column.style.transition = `transform ${n}ms ${b}`, e.column.style.transform = `translateX(${t - r.left}px)`, e.badge?.remove(), e.guide.style.display = "none";
294
+ }, X = () => {
295
+ let e = H;
296
+ if (H = null, e !== null) {
297
+ e.timer !== null && window.clearTimeout(e.timer);
298
+ for (let [t, n] of e.hiddenCells) t.style.visibility = n;
299
+ e.float.layer.remove();
300
+ }
301
+ }, Ne = () => {
302
+ let e = H;
303
+ if (e === null || e.key === null) return;
304
+ let n = e.key;
305
+ if (e.pane !== null && !t?.paneLayout[e.pane].entries.some((e) => e.column.key === n)) return;
306
+ e.key = null;
307
+ let r = t?.scrollContainerRef.current ?? null, i = r ? w(r).filter((e) => e.dataset.ssgColKey === n) : [];
308
+ if (i.length === 0) {
309
+ X();
310
+ return;
311
+ }
312
+ let a = i[0].getBoundingClientRect().left;
313
+ for (let t of i) e.hiddenCells.push([t, t.style.visibility]), t.style.visibility = "hidden";
314
+ Me(e.float, a, me), e.timer !== null && window.clearTimeout(e.timer), e.timer = window.setTimeout(X, 220);
183
315
  }, Z = () => {
184
- let e = ne(O.x, O.y);
185
- if (V()) {
186
- e && (E = {
316
+ let e = Ce(D.x, D.y);
317
+ if (be()) {
318
+ e && (T = {
187
319
  pane: e.pane,
188
320
  slot: e.slot
189
321
  });
190
- let t = E;
191
- if (t !== null && t.pane !== I) {
192
- W(B), G(t.pane), e && q(e), Y(null, !1);
322
+ let n = T;
323
+ if (n !== null && n.pane !== L) {
324
+ if (e && we(e), (t?.scrollContainerRef.current ?? null)?.parentElement != null) {
325
+ let e = Oe(q(null, "lift-out"));
326
+ if (e !== null) {
327
+ K(), je(e, n.pane);
328
+ return;
329
+ }
330
+ }
331
+ Y(), xe(B), Se(n.pane), q(null, "rest");
332
+ return;
333
+ }
334
+ if (K(), G(), q(n === null ? null : n.slot, "follow").length === 0 && V !== null) {
335
+ je(V, null);
193
336
  return;
194
337
  }
195
- K(), U(), Y(t === null ? null : t.slot, !0);
338
+ Y();
196
339
  return;
197
340
  }
198
- if (G(e ? e.pane : null), !e) {
199
- E = null, U();
341
+ if (Se(e ? e.pane : null), !e) {
342
+ T = null, G();
200
343
  return;
201
344
  }
202
- E = {
345
+ T = {
203
346
  pane: e.pane,
204
347
  slot: e.slot
205
- }, q(e);
206
- }, Q = () => {
207
- if (T === null) {
348
+ }, we(e);
349
+ }, Pe = () => {
350
+ if (_ === null) {
208
351
  M = null;
209
352
  return;
210
353
  }
211
- let e = w?.scrollContainerRef.current ?? null;
212
- if (e && (A || (!k || a(k, O, 6)) && (A = !0), A)) {
213
- let t = e.getBoundingClientRect(), n = s({
354
+ let e = t?.scrollContainerRef.current ?? null;
355
+ if (e && (k || (!O || o(O, D, 6)) && (k = !0), k)) {
356
+ let t = e.getBoundingClientRect(), n = c({
214
357
  rectLeft: t.left,
215
358
  rectTop: t.top,
216
359
  clientLeft: e.clientLeft,
217
360
  clientTop: e.clientTop,
218
361
  clientWidth: e.clientWidth,
219
362
  clientHeight: e.clientHeight
220
- }), r = o(O.x, n.left, n.right, 24), a = i(e.scrollLeft, r, 18, e.scrollWidth - e.clientWidth);
221
- a !== e.scrollLeft && e.scrollTo({
222
- left: a,
363
+ }), r = s(D.x, n.left, n.right, 24), i = a(e.scrollLeft, r, 18, e.scrollWidth - e.clientWidth);
364
+ i !== e.scrollLeft && e.scrollTo({
365
+ left: i,
223
366
  behavior: "auto"
224
367
  });
225
368
  }
226
- Z(), M = requestAnimationFrame(Q);
227
- }, $ = (e) => {
228
- M !== null && (cancelAnimationFrame(M), M = null), document.body.style.cursor = "", U(), K();
229
- let t = T, r = E;
230
- T = null, E = null, k = null;
231
- let i = R;
232
- R = null, I = null;
233
- let a = e && t && r && w !== null ? l(w.columns, t, r.pane, r.slot) : null;
234
- if (i && !a && (i.forEach((e, t) => {
235
- t.isConnected && (t.style.transition = b, t.style.transform = "translateX(0px)");
236
- }), z = i, window.setTimeout(() => {
237
- X(i), z === i && (z = null);
238
- }, 200)), !a || !t || !r || w === null) return;
239
- let { columns: o, applyColumnOrderAndPin: s, scrollContainerRef: c } = w, u = o.find((e) => e.key === t), d = u ? n(u) : null;
240
- D = d !== null && d === r.pane && !ee(c.current) ? te(c.current) : null, i && X(i), s(a, /* @__PURE__ */ new Map([[t, r.pane === "center" ? void 0 : r.pane]]));
369
+ Z(), M = requestAnimationFrame(Pe);
370
+ }, Q = (e) => {
371
+ M !== null && (cancelAnimationFrame(M), M = null), document.body.style.cursor = "", G(), K();
372
+ let n = _, i = T;
373
+ _ = null, j = null, U = null, T = null, O = null;
374
+ let a = R;
375
+ R = null, L = null;
376
+ let o = n !== null && i !== null && t !== null ? t.paneLayout[i.pane].entries.findIndex((e) => e.column.key === n) : -1, s = i !== null && o >= 0 && (i.slot === o || i.slot === o + 1), c = e && n && i && t !== null && !s ? u(t.columns, n, i.pane, d(t.columns, t.paneLayout[i.pane], i.pane, i.slot)) : null, l = V;
377
+ if (V = null, a && !c) {
378
+ a.forEach((e, t) => {
379
+ t.isConnected && (t.style.transition = x, t.style.transform = "translateX(0px)");
380
+ });
381
+ let e = null;
382
+ if (l !== null) {
383
+ let t = null;
384
+ for (let e of a.keys()) if (e.isConnected && e.dataset.ssgColKey === n) {
385
+ t = e;
386
+ break;
387
+ }
388
+ t === null ? l.layer.remove() : (Me(l, t.getBoundingClientRect().left, oe), e = {
389
+ float: l,
390
+ key: null,
391
+ pane: null,
392
+ timer: null,
393
+ hiddenCells: []
394
+ }, H = e);
395
+ }
396
+ z = a, window.setTimeout(() => {
397
+ J(a), z === a && (z = null), e !== null && H === e && X();
398
+ }, 200);
399
+ } else l !== null && !c && l.layer.remove();
400
+ if (!c || !n || !i || t === null) return;
401
+ let { columns: f, applyColumnOrderAndPin: p, scrollContainerRef: m } = t, h = f.find((e) => e.key === n), g = h ? r(h) : null;
402
+ E = g !== null && g === i.pane && !ae(m.current) ? ge(m.current) : null, a && J(a), l !== null && (l.badge?.remove(), l.guide.style.display = "none", H = {
403
+ float: l,
404
+ key: n,
405
+ pane: i.pane,
406
+ timer: window.setTimeout(X, he),
407
+ hiddenCells: []
408
+ }), p(c, /* @__PURE__ */ new Map([[n, i.pane === "center" ? void 0 : i.pane]]));
409
+ }, Fe = () => {
410
+ Ne();
411
+ let n = E;
412
+ if (E = null, !n) return;
413
+ let r = t?.scrollContainerRef.current ?? null;
414
+ if (!r) return;
415
+ let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
416
+ r.querySelectorAll("[data-ssg-col-key]").forEach((t) => {
417
+ if (e(r, t)) return;
418
+ let o = t.dataset.ssgColKey;
419
+ if (!o || !n.has(o)) return;
420
+ let s = i.get(o);
421
+ s ? s.push(t) : (i.set(o, [t]), a.set(o, t.getBoundingClientRect().left));
422
+ });
423
+ let o = [];
424
+ if (i.forEach((e, t) => {
425
+ let r = n.get(t), i = a.get(t);
426
+ if (r === void 0 || i === void 0) return;
427
+ let s = r - i;
428
+ if (!(Math.abs(s) < .5)) for (let t of e) t.style.transition = "none", t.style.transform = `translateX(${s}px)`, t.style.willChange = "transform", o.push(t);
429
+ }), o.length === 0) return;
430
+ r.getBoundingClientRect();
431
+ for (let e of o) e.style.transition = `transform ${ie}ms ${b}`, e.style.transform = "translateX(0)";
432
+ $();
433
+ let s = () => {
434
+ for (let e of o) e.style.transition = "", e.style.transform = "", e.style.willChange = "";
435
+ }, c = {
436
+ run: s,
437
+ timer: window.setTimeout(() => {
438
+ N === c && (N = null), s();
439
+ }, 280)
440
+ };
441
+ N = c;
442
+ }, $ = () => {
443
+ let e = N;
444
+ N = null, e !== null && (window.clearTimeout(e.timer), e.run());
241
445
  };
242
446
  return {
243
447
  update: (e) => {
244
- w = e;
448
+ t = e;
245
449
  },
246
- onColumnDragHandlePointerDown: (e, t) => {
247
- if (w === null || !w.enabled || t.button !== 0) return;
248
- t.stopPropagation(), t.preventDefault(), T = e.key, E = null, O = {
249
- x: t.clientX,
250
- y: t.clientY
251
- }, k = {
252
- x: t.clientX,
253
- y: t.clientY
254
- }, A = !1, document.body.style.cursor = "grabbing", B = e.title || e.key, V() ? (I = n(e), L = w.scrollContainerRef.current?.scrollLeft ?? 0, R = /* @__PURE__ */ new Map()) : W(B);
255
- let r = t.currentTarget, i = t.pointerId;
450
+ onColumnDragHandlePointerDown: (e, n) => {
451
+ if (t === null || !t.enabled || n.button !== 0) return;
452
+ if (n.stopPropagation(), n.preventDefault(), _ !== null) {
453
+ if (n.pointerId !== j) return;
454
+ A?.(), Q(!1);
455
+ }
456
+ if ($(), X(), Y(), z?.forEach((e, t) => {
457
+ t.style.visibility = e.visibility;
458
+ }), _ = e.key, j = n.pointerId, T = null, U = null, D = {
459
+ x: n.clientX,
460
+ y: n.clientY
461
+ }, O = {
462
+ x: n.clientX,
463
+ y: n.clientY
464
+ }, k = !1, document.body.style.cursor = "grabbing", B = e.title || e.key, be()) {
465
+ let i = t.scrollContainerRef.current;
466
+ L = r(e), ve = i?.scrollLeft ?? 0, R = /* @__PURE__ */ new Map();
467
+ let a = i ? w(i).find((t) => t.dataset.ssgColKey === e.key) : void 0;
468
+ ye = a ? n.clientX - (a.getBoundingClientRect().left - _e(a)) : (t.paneLayout[L].entries.find((t) => t.column.key === e.key)?.paneLocalSize ?? 0) / 2;
469
+ } else xe(B);
470
+ let i = n.currentTarget, a = n.pointerId;
256
471
  try {
257
- r.setPointerCapture(i);
472
+ i.setPointerCapture(a);
258
473
  } catch {}
259
- let a = (e) => {
260
- e.pointerId === i && (O = {
474
+ let o = (e) => {
475
+ e.pointerId === a && (D = {
261
476
  x: e.clientX,
262
477
  y: e.clientY
263
478
  }, Z());
264
- }, o = () => {
265
- window.removeEventListener("pointermove", a), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", c), window.removeEventListener("keydown", l), j = null;
479
+ }, s = () => {
480
+ window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", c), window.removeEventListener("pointercancel", l), window.removeEventListener("keydown", u), A = null;
266
481
  try {
267
- r.releasePointerCapture(i);
482
+ i.releasePointerCapture(a);
268
483
  } catch {}
269
484
  };
270
- function s(e) {
271
- e.pointerId === i && (o(), $(!0));
272
- }
273
485
  function c(e) {
274
- e.pointerId === i && (o(), $(!1));
486
+ e.pointerId === a && (s(), Q(!0));
275
487
  }
276
488
  function l(e) {
277
- e.key === "Escape" && (o(), $(!1));
489
+ e.pointerId === a && (s(), Q(!1));
278
490
  }
279
- window.addEventListener("pointermove", a), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", c), window.addEventListener("keydown", l), j = o, Z(), M = requestAnimationFrame(Q);
280
- },
281
- applyReorderSettle: () => {
282
- let t = D;
283
- if (D = null, !t) return;
284
- let n = w?.scrollContainerRef.current ?? null;
285
- if (!n) return;
286
- let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
287
- n.querySelectorAll("[data-ssg-col-key]").forEach((a) => {
288
- if (e(n, a)) return;
289
- let o = a.dataset.ssgColKey;
290
- if (!o || !t.has(o)) return;
291
- let s = r.get(o);
292
- s ? s.push(a) : (r.set(o, [a]), i.set(o, a.getBoundingClientRect().left));
293
- });
294
- let a = [];
295
- if (r.forEach((e, n) => {
296
- let r = t.get(n), o = i.get(n);
297
- if (r === void 0 || o === void 0) return;
298
- let s = r - o;
299
- if (!(Math.abs(s) < .5)) for (let t of e) t.style.transition = "none", t.style.transform = `translateX(${s}px)`, t.style.willChange = "transform", a.push(t);
300
- }), a.length !== 0) {
301
- n.getBoundingClientRect();
302
- for (let e of a) e.style.transition = `transform ${v}ms ${y}`, e.style.transform = "translateX(0)";
303
- window.setTimeout(() => {
304
- for (let e of a) e.style.transition = "", e.style.transform = "", e.style.willChange = "";
305
- }, 280);
491
+ function u(e) {
492
+ e.key === "Escape" && (s(), Q(!1));
306
493
  }
494
+ window.addEventListener("pointermove", o), window.addEventListener("pointerup", c), window.addEventListener("pointercancel", l), window.addEventListener("keydown", u), A = s, Z(), M = requestAnimationFrame(Pe);
307
495
  },
496
+ applyReorderSettle: Fe,
308
497
  dispose: () => {
309
- j?.(), j = null, M !== null && (cancelAnimationFrame(M), M = null), T = null, E = null, document.body.style.cursor = "", K(), R && X(R), R = null, I = null;
498
+ A?.(), A = null, M !== null && (cancelAnimationFrame(M), M = null), _ = null, j = null, T = null, document.body.style.cursor = "", K(), R && J(R), R = null, L = null, Y(), X();
310
499
  }
311
500
  };
312
501
  };
313
502
  //#endregion
314
- export { l as computeHeaderReorderedKeys, w as createColumnHeaderDragController };
503
+ export { u as computeHeaderReorderedKeys, T as createColumnHeaderDragController, d as resolveConsumerDropSlot };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/slotDom.cjs"),t=require("../logic/tooltipGeometry.cjs");var n=`data-ssg-tooltip`,r=`[${n}], [data-ssg-tooltip-overflow]`,i=350,a=800,o=0,s=null,c=null,l=0,u=null,d,f;function p(t){f=e.applySlotToElement(t,d,f)}function m(){if(s!==null)return s;let e=document.createElement(`div`);return e.className=`ssg-tooltip`,e.setAttribute(`aria-hidden`,`true`),f=void 0,p(e),document.body.appendChild(e),s=e,e}function h(){c!==null&&(window.clearTimeout(c),c=null)}function g(){h(),u!==null&&(l=Date.now()+a),u=null,s!==null&&s.classList.remove(`ssg-tooltip--visible`)}function _(e){let r=e.getAttribute(n),i=r!==null&&r!==``?r:(e.textContent??``).trim();if(i===``)return;let a=m();a.classList.toggle(`ssg-theme-dark`,e.closest(`.ssg-theme-dark`)!==null),a.classList.toggle(`ssg-motion-off`,e.closest(`.ssg-motion-off`)!==null),a.textContent=i,a.style.left=`0px`,a.style.top=`0px`;let o=t.computeTooltipPlacement({targetRect:e.getBoundingClientRect(),tipWidth:a.offsetWidth,tipHeight:a.offsetHeight,viewportWidth:window.innerWidth});a.style.left=`${o.left}px`,a.style.top=`${o.top}px`,a.classList.add(`ssg-tooltip--visible`),u=e}function v(e){let t=e.target;if(!(t instanceof Element))return;let a=t.closest(r);if(a===null||a===u||!a.hasAttribute(n)&&a.scrollWidth<=a.clientWidth+1)return;let o=u!==null;g(),o||Date.now()<l?_(a):c=window.setTimeout(()=>{c=null,_(a)},i)}function y(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(r);if(n===null)return;let i=e.relatedTarget;i instanceof Node&&n.contains(i)||g()}function b(){g()}function x(e){e.key===`Escape`&&g()}function S(){window.addEventListener(`pointerover`,v,!0),window.addEventListener(`pointerout`,y,!0),window.addEventListener(`focusin`,v,!0),window.addEventListener(`focusout`,y,!0),window.addEventListener(`pointerdown`,b,!0),window.addEventListener(`scroll`,b,!0),window.addEventListener(`keydown`,x,!0)}function C(){window.removeEventListener(`pointerover`,v,!0),window.removeEventListener(`pointerout`,y,!0),window.removeEventListener(`focusin`,v,!0),window.removeEventListener(`focusout`,y,!0),window.removeEventListener(`pointerdown`,b,!0),window.removeEventListener(`scroll`,b,!0),window.removeEventListener(`keydown`,x,!0)}function w(e){o+=1,o===1&&S();let t=!1,n=e=>{d=e,s!==null&&p(s)};return n(e),{setSlot:n,dispose:()=>{t||(t=!0,--o,o===0&&(C(),h(),u=null,s!==null&&(s.remove(),s=null)))}}}exports.acquireTooltipController=w;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/slotDom.cjs"),t=require("../logic/tooltipGeometry.cjs");var n=`data-ssg-tooltip`,r=`[${n}], [data-ssg-tooltip-overflow]`,i=350,a=800,o=0,s=null,c=null,l=0,u=null,d,f;function p(t){f=e.applySlotToElement(t,d,f)}function m(){if(s!==null)return s;let e=document.createElement(`div`);return e.className=`ssg-tooltip`,e.setAttribute(`aria-hidden`,`true`),f=void 0,p(e),document.body.appendChild(e),s=e,e}function h(){c!==null&&(window.clearTimeout(c),c=null)}function g(){h(),u!==null&&(l=Date.now()+a),u=null,s!==null&&s.classList.remove(`ssg-tooltip--visible`)}function _(e){let r=e.getAttribute(n),i=r!==null&&r!==``?r:(e.textContent??``).trim();if(i===``)return;let a=m();a.classList.toggle(`ssg-theme-dark`,e.closest(`.ssg-theme-dark`)!==null),a.classList.toggle(`ssg-motion-off`,e.closest(`.ssg-motion-off`)!==null),a.textContent=i,a.style.left=`0px`,a.style.top=`0px`;let o=t.computeTooltipPlacement({targetRect:e.getBoundingClientRect(),tipWidth:a.offsetWidth,tipHeight:a.offsetHeight,viewportWidth:window.innerWidth});a.style.left=`${o.left}px`,a.style.top=`${o.top}px`,a.classList.add(`ssg-tooltip--visible`),u=e}function v(e){let t=e.target;if(!(t instanceof Element)||typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.buttons!==0)return;let a=t.closest(r);if(a===null||a===u||!a.hasAttribute(n)&&a.scrollWidth<=a.clientWidth+1)return;let o=u!==null;g(),o||Date.now()<l?_(a):c=window.setTimeout(()=>{c=null,_(a)},i)}function y(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(r);if(n===null)return;let i=e.relatedTarget;i instanceof Node&&n.contains(i)||g()}function b(){g()}function x(e){e.key===`Escape`&&g()}function S(){window.addEventListener(`pointerover`,v,!0),window.addEventListener(`pointerout`,y,!0),window.addEventListener(`focusin`,v,!0),window.addEventListener(`focusout`,y,!0),window.addEventListener(`pointerdown`,b,!0),window.addEventListener(`scroll`,b,!0),window.addEventListener(`keydown`,x,!0)}function C(){window.removeEventListener(`pointerover`,v,!0),window.removeEventListener(`pointerout`,y,!0),window.removeEventListener(`focusin`,v,!0),window.removeEventListener(`focusout`,y,!0),window.removeEventListener(`pointerdown`,b,!0),window.removeEventListener(`scroll`,b,!0),window.removeEventListener(`keydown`,x,!0)}function w(e){o+=1,o===1&&S();let t=!1,n=e=>{d=e,s!==null&&p(s)};return n(e),{setSlot:n,dispose:()=>{t||(t=!0,--o,o===0&&(C(),h(),u=null,s!==null&&(s.remove(),s=null)))}}}exports.acquireTooltipController=w;
@@ -31,7 +31,7 @@ function _(e) {
31
31
  }
32
32
  function v(e) {
33
33
  let t = e.target;
34
- if (!(t instanceof Element)) return;
34
+ if (!(t instanceof Element) || typeof PointerEvent < "u" && e instanceof PointerEvent && e.buttons !== 0) return;
35
35
  let a = t.closest(r);
36
36
  if (a === null || a === u || !a.hasAttribute(n) && a.scrollWidth <= a.clientWidth + 1) return;
37
37
  let o = u !== null;
@@ -1644,8 +1644,11 @@ export type SpreadsheetGridProps<T, F extends GridFrameworkTypes = GridFramework
1644
1644
  * 縦線、ドロップ後に新しい位置へスライド)。`'live'` は同じペイン内では掴んだ列(ヘッダー +
1645
1645
  * 描画中のセル)がポインタに追従し、通る先の列がその場で左右へ退避する(ドロップ先が「隙間」
1646
1646
  * として見える。枠外で離しても直前の位置へ確定、`Esc` で元へ戻る)。
1647
- * 固定列のペインをまたいで移す(固定の変更)ときは `'ghost'` と同じ縦線 + ゴーストに切り替わる。
1648
- * `motion` が `'off'` のときは `'ghost'` と同じ。
1647
+ * 固定列のペインをまたいで移す(固定の変更)ときは、掴んだ列の複製(浮かぶ列)
1648
+ * がポインタに付いてきて元のペインは列が抜けた分だけ詰まり、
1649
+ * 移動先は縦線で示す(浮かぶ列の見出しに、固定ペインへはピン / 中央へは移動の矢印のアイコン。
1650
+ * 浮かぶ列は表の枠の内側に収まり、離すと新しい位置へ滑り込む)。`motion` が `'off'` のときは
1651
+ * `'ghost'` と同じ。
1649
1652
  *
1650
1653
  * @defaultValue `'ghost'`
1651
1654
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ishibashi0112/spreadsheet-grid-core",
3
- "version": "0.47.0",
3
+ "version": "0.48.0",
4
4
  "description": "SpreadsheetGrid のフレームワーク非依存コア(状態 / 派生値計算 / コマンド / DOM コントローラ)。React 版 @ishibashi0112/spreadsheet-grid と将来の Solid 版が共有します。",
5
5
  "keywords": [
6
6
  "grid",