@sheetxl/grid-react 0.6.10 → 0.6.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/index.mjs +2 -2
- package/node/esm/index.mjs +2 -2
- package/package.json +3 -3
package/browser/cjs/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._sheetxl-grid_h9wwa_7{position:relative;box-sizing:border-box;user-select:none}._sheetxl-grid_h9wwa_7 *{box-sizing:border-box!important}._sheetxl-grid_h9wwa_7 *:focus{outline:none}._sheetxl-grid_h9wwa_7 .cell-container{position:absolute;overflow:visible;white-space:pre}._sheetxl-grid_h9wwa_7 .cell-container>*{inset:0;position:absolute}._sheetxl-grid_h9wwa_7 .sheetxl-stage{contain:strict}._sheetxl-grid_h9wwa_7 .sheetxl-stage>*{contain:strict}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
2
|
"use strict";/**
|
|
3
|
-
* @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.6.
|
|
3
|
+
* @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.6.12
|
|
4
4
|
*
|
|
5
5
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
6
6
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
7
|
-
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ne=require("react/jsx-runtime"),n=require("@sheetxl/utils-react"),l=require("react"),r=require("@sheetxl/utils"),Jn=require("react-dom"),Yt=({itemType:t,index:o,itemSize:i,instanceProps:c,scale:u=1})=>{let d,a,s;t==="column"?(d=c.columnMetadataMap,a=c.lastMeasuredColumnIndex,s=c.recalcColumnIndices):(d=c.rowMetadataMap,a=c.lastMeasuredRowIndex,s=c.recalcRowIndices);const w=s.length>0;if(o>a){let M=0;if(a>=0){const A=d[a];M=A.offset+A.size}for(let A=a+1;A<=o;A++){let k=w?s.includes(A)?i(A)*u:d[A]?.size||i(A)*u:i(A)*u;d[A]={offset:M,size:k},M+=k}t==="column"?c.lastMeasuredColumnIndex=o:c.lastMeasuredRowIndex=o}return d[o],d[o]},Kn=({itemType:t,itemSize:o,itemCount:i,instanceProps:c,offset:u,scale:d})=>{let a,s;t==="column"?(a=c.columnMetadataMap,s=c.lastMeasuredColumnIndex):(a=c.rowMetadataMap,s=c.lastMeasuredRowIndex);let w=0;return w=(s>0?a[s].offset:0)>=u?Qn({itemType:t,itemSize:o,instanceProps:c,high:s,low:0,offset:u,scale:d}):xo({itemType:t,itemSize:o,itemCount:i,instanceProps:c,index:Math.max(0,s),offset:u,scale:d}),w=Math.min(w,i),w},Qn=({itemType:t,itemSize:o,instanceProps:i,high:c,low:u,offset:d,scale:a})=>{for(;u<=c;){const s=u+Math.floor((c-u)/2),w=Yt({itemType:t,itemSize:o,index:s,instanceProps:i,scale:a}).offset;if(w===d)return s;w<d?u=s+1:w>d&&(c=s-1)}return u>0?u-1:0},xo=({itemType:t,itemSize:o,itemCount:i,instanceProps:c,index:u,offset:d,scale:a})=>{let s=1;for(;u<i&&Yt({itemType:t,itemSize:o,index:u,instanceProps:c,scale:a}).offset<d;)u+=s,s*=2;return Qn({itemType:t,itemSize:o,instanceProps:c,high:Math.min(u,i-1),low:Math.floor(u/2),offset:d,scale:a})},eo=t=>{const{rowCount:o,columnCount:i,defaultRowHeight:c,getRowHeight:u,defaultColumnWidth:d,getColumnWidth:a}=t||{},s=l.useRef({columnMetadataMap:{},rowMetadataMap:{},lastMeasuredColumnIndex:-1,lastMeasuredRowIndex:-1,recalcColumnIndices:[],recalcRowIndices:[]}),w=n.useCallbackRef(D=>Kn({itemType:"row",itemCount:o,itemSize:u??(()=>c??20),instanceProps:s.current,offset:D}),[o,u,c]),M=n.useCallbackRef(D=>D===-1?0:Yt({itemType:"row",index:D,itemSize:u??(()=>c??20),instanceProps:s.current}).offset,[u,c]),A=n.useCallbackRef(D=>Yt({itemType:"row",index:D,itemSize:u??(()=>c??20),instanceProps:s.current}).size,[u,c]),k=n.useCallbackRef(D=>Kn({itemType:"column",itemCount:i,itemSize:a??(()=>d??75),instanceProps:s.current,offset:D}),[i,a,d]),U=n.useCallbackRef(D=>D===-1?0:Yt({itemType:"column",index:D,itemSize:a??(()=>d??75),instanceProps:s.current}).offset,[a,d]),z=n.useCallbackRef(D=>Yt({itemType:"column",index:D,itemSize:a??(()=>d??75),instanceProps:s.current}).size,[a,d]),[q,N]=l.useReducer(D=>D+1,0),J=()=>({getRowOffset:M,getColOffset:U,getRowIndex:w,getColIndex:k}),[Ce,_]=l.useState(()=>t?J():null);return l.useEffect(()=>{_(t?J():null)},[q,o,i,d,c,A,z]),Ce},On="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ~`!@#$%^&*()-_=+[{]};:'\",<.>/?|\\",Fn=t=>{if(!t)return null;if(t.eventType==="start")return{type:t.eventType};if(t.eventType==="submit")return{type:t.eventType};if(t.eventType==="cancel")return{type:t.eventType};if(t.eventType==="keyboard")return{type:t.eventType,key:t.event.key};if(t.eventType==="pointer")return{type:t.eventType};if(t.eventType==="coordsChange"){const o={type:t.eventType};return t.activeCoords&&(o.activeCoords=t.activeCoords),o}return{type:t.eventType??"unknown"}},po=t=>!0,mo=t=>!!t&&!(t.ctrlKey||t.metaKey||t.altKey||t.isComposing)&&(!(t.shiftKey||t.key!=="F2"&&t.key!==" "&&t.key!=="Backspace")||(!t.shiftKey||t.key!==" ")&&On.indexOf(t.key)!==-1),Co=t=>!!t&&t.type==="dblclick"&&{editMode:!0},So=t=>{const{session:o,refLatestCoords:i,handleSubmitEdit:c,handleCancelEdit:u,cellBounds:d,isInBounds:a,getCellEditor:s,propsEditor:w,borderStrokeFill:M="rgb(33, 115, 70)",borderStrokeWidth:A=2,alignment:k=n.HorizontalAlignment.Left,style:U,...z}=t,q=l.useRef(null),N=l.useRef(null),[J,Ce]=l.useState(!1),_=o.coords,D=l.useCallback(async ae=>{if(q.current?.getBoundingClientRect()){if(ae.eventType==="keyboard"){const $=ae.event,C=new KeyboardEvent($.type,{bubbles:!0,cancelable:!0,view:window,key:$.key,code:$.code,location:$.location,repeat:$.repeat,isComposing:$.isComposing,charCode:$.charCode,keyCode:$.keyCode,which:$.which,ctrlKey:$.ctrlKey,shiftKey:$.shiftKey,altKey:$.altKey,metaKey:$.metaKey});C.isSynthetic=!0,C.key,N.current?.dispatchEvent(C)}else ae.eventType==="pointer"||console.warn("unsupported event type",ae);await new Promise($=>requestAnimationFrame($))}},[]);l.useEffect(()=>{const ae=N.current;return Ce(!0),N.current.startEdit?.(o.startEvent),(async()=>{o.editorRefs.push(ae),o.editorRefsDispatchEditorEvent.push(D);const xe=[...o.events];for(let $=0;$<xe.length;$++)await D(xe[$]);o.onMount(ae)})(),()=>{const xe=o.editorRefs.indexOf(ae);xe!==-1&&o.editorRefs.splice(xe,1),o.onUnmount(ae)}},[]);const F=l.useCallback(()=>c(o),[]),se=l.useCallback(()=>{u(o)},[]),P=i.current&&r.CoordUtils.isEqualCells(i.current,_),ie=a&&P&&J,ze=s({autoFocus:!!o.startEvent?.autoFocus,...w,onSubmitEdit:F,onCancelEdit:se,ref:N},_),ve=d.x+n.ReactUtils.boundPixel(-A/2),Ae=n.ReactUtils.boundPixel(d.width+A/2,!0);return ne.jsx("div",{tabIndex:0,ref:q,style:{background:void 0,...U,opacity:ie?U?.opacity??1:0,pointerEvents:"auto",position:"absolute",boxSizing:"border-box",top:`${d.y+n.ReactUtils.boundPixel(-A/2)}px`,height:n.ReactUtils.boundPixel(d.height+A/2,!0),left:`${ve}px`,width:Ae},...z,children:ne.jsx("div",{className:"editor-container",style:{position:"absolute",boxSizing:"border-box",left:`${n.ReactUtils.boundPixel(1)}px`,top:`${n.ReactUtils.boundPixel(1)}px`,width:n.ReactUtils.boundPixel(d.width-2,!0),height:n.ReactUtils.boundPixel(d.height-2,!0),outline:`${A}px ${M} solid`,boxShadow:"rgba(60,64,67,.35) 2px 2px 6px 3px",maxHeight:"100%",overflow:"hidden",display:"flex"},children:ze})})};var bo=function(){},to=typeof window<"u",yo=to?l.useLayoutEffect:l.useEffect,Vn={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const no=to&&window.ResizeObserver!==void 0?function(){var t=l.useState(null),o=t[0],i=t[1],c=l.useState(Vn),u=c[0],d=c[1],a=l.useMemo(function(){return new window.ResizeObserver(function(s){if(s[0]){var w=s[0].contentRect,M=w.x,A=w.y,k=w.width,U=w.height,z=w.top,q=w.left,N=w.bottom,J=w.right;d({x:M,y:A,width:k,height:U,top:z,left:q,bottom:N,right:J})}})},[]);return yo(function(){if(o)return a.observe(o),function(){a.disconnect()}},[o]),[i,u]}:function(){return[bo,Vn]},vo=3,Ro=.1,Eo=50,In=t=>({x:t.x,y:t.y,width:t.width,height:t.height,top:t.top,left:t.left,right:t.right,bottom:t.bottom});function oo(t={}){const{threshold:o=Ro,stillnessThreshold:i=vo,maxHierarchyDepth:c=Eo}=t,[u,d]=no(),a=l.useRef(null),[s,w]=l.useReducer(q=>q+1,0),M=l.useRef(void 0),A=l.useRef({x:0,y:0,width:0,height:0,top:0,left:0,right:0,bottom:0}),k=l.useCallback(q=>{a.current=q,typeof u=="function"&&u(q)},[u]),[U,z]=l.useState(d);return l.useEffect(()=>{d&&!U&&z(d)},[d,U]),l.useEffect(()=>{const q=a.current;if(!q)return;let N=!1,J=0;const Ce=()=>{if(!q)return;const P=q.getBoundingClientRect(),ie=A.current;Math.abs(P.x-ie.x)>o||Math.abs(P.y-ie.y)>o||Math.abs(P.width-ie.width)>o||Math.abs(P.height-ie.height)>o?(N||(N=!0,z(In(P)),w()),J=0):J++,N&&J>=i&&(N=!1,z(In(P)),w()),A.current=In(P),M.current=requestAnimationFrame(Ce)};M.current=requestAnimationFrame(Ce);const _=P=>{N=!0,w()},D=P=>{N=!1,J=i,w()};let F=q;const se=[];for(;F&&F!==document.documentElement&&(F.addEventListener("animationstart",_,!0),F.addEventListener("animationend",D,!0),F.addEventListener("transitionstart",_,!0),F.addEventListener("transitionend",D,!0),se.push(F),F=F.parentElement,!(se.length>c)););return()=>{M.current&&cancelAnimationFrame(M.current),se.forEach(P=>{P.removeEventListener("animationstart",_,!0),P.removeEventListener("animationend",D,!0),P.removeEventListener("transitionstart",_,!0),P.removeEventListener("transitionend",D,!0)})}},[s,d,o,i,c]),[k,U]}const Oe=(t,o,i)=>{if(!t)return o;let c=o;const u=i===r.Direction.Right||i===r.Direction.Down;for(;;){const d=t(c,!u);if(d===0)return c;u?c+=d:c-=d}},un=(t,o,i)=>{const c=[];let u=o;for(;u<=i;){const d=Math.max(0,t(u));d===0?(c.push(u),u++):u+=d}return c},Io=(t,o,i,c,u,d)=>{if(!o)return d;let{rowIndex:a,colIndex:s}=t;switch(c){case r.Direction.Down:{a=Oe(i,Math.min(a+1,d),c);let w=o({rowIndex:a,colIndex:s});for(;!w&&a<d;)a=Oe(i,Math.min(++a,d),c),w=o({rowIndex:a,colIndex:s});return a}case r.Direction.Up:{a=Oe(i,Math.max(a-1,d),c);let w=o({rowIndex:a,colIndex:s});for(;!w&&a>d;)a=Oe(i,Math.max(--a,d),c),w=o({rowIndex:a,colIndex:s});return a}case r.Direction.Right:{s=Oe(i,Math.min(s+1,d),c);let w=o({rowIndex:a,colIndex:s});for(;!w&&s<d;)s=Oe(i,Math.min(++s,d),c),w=o({rowIndex:a,colIndex:s});return s}case r.Direction.Left:{s=Oe(i,Math.max(s-1,d),c);let w=o({rowIndex:a,colIndex:s});for(;!w&&s>d;)s=Oe(i,Math.max(--s,d),c),w=o({rowIndex:a,colIndex:s});return s}default:return d}},ko=(t,o=()=>!0,i,c,u,d)=>{let{rowIndex:a,colIndex:s}=t;switch(c){case r.Direction.Down:{a=Oe(i,Math.min(a+1,d),c);let w=o?.({rowIndex:a,colIndex:s});for(;w&&a<d;)a=Oe(i,Math.min(++a,d),c),w=o?.({rowIndex:a,colIndex:s});return o?.({rowIndex:a,colIndex:s})?a:a-1}case r.Direction.Up:{a=Oe(i,Math.max(a-1,d),c);let w=o?.({rowIndex:a,colIndex:s});for(;w&&a>d;)a=Oe(i,Math.max(--a,d),c),w=o?.({rowIndex:a,colIndex:s});return o?.({rowIndex:a,colIndex:s})?a:a+1}case r.Direction.Right:{s=Oe(i,Math.min(s+1,d),c);let w=o?.({rowIndex:a,colIndex:s});for(;w&&s<d;)s=Oe(i,Math.min(++s,d),c),w=o?.({rowIndex:a,colIndex:s});return o?.({rowIndex:a,colIndex:s})?s:s-1}case r.Direction.Left:{s=Oe(i,Math.max(s-1,d),c);let w=o?.({rowIndex:a,colIndex:s});for(;w&&s>d;)s=Oe(i,Math.max(--s,d),c),w=o?.({rowIndex:a,colIndex:s});return o?.({rowIndex:a,colIndex:s})?s:s+1}default:return null}},Mo=(t,o,i,c,u,d)=>{if(!o)return d;let a,{rowIndex:s,colIndex:w}=t;c===r.Direction.Down?a={rowIndex:s+1,colIndex:w}:c===r.Direction.Up?a={rowIndex:s-1,colIndex:w}:c===r.Direction.Right?a={rowIndex:s,colIndex:w+1}:c===r.Direction.Left&&(a={rowIndex:s,colIndex:w-1});const M=o(t),A=o(a);var k,U;return(U=A,!(k=M)&&!U||!k&&U||k&&!U?Io:ko)(t,o,i,c,!1,d)??d},Wn=(t,o)=>`${t}:${o}`,Hn=(t,o,i,c,u,d)=>{if(i-o>=u-c)return c;let a=c;return t==="nearest"&&(c-o>0?t="start":i-u>0&&(t="end")),t==="start"?a=o:t==="end"?a=i-(u-c):t==="center"&&(a=o+(i-o)/2-(u-c)/2),Math.max(0,Math.min(a,d-(u-c)))},jn=(t,o,i,c)=>(console.log("todo: implement convertToVisibleRanges"),t),Pn=(t,o=r.Direction.Right,i,c,u,d=null)=>{if(d&&r.CoordUtils.isEqualSelectionCoords(d,t))return t;const a=t.ranges[t.rangeIndex];if(!r.CoordUtils.isRangesIntersect({rowStart:t.cell.rowIndex,colStart:t.cell.colIndex,rowEnd:t.cell.rowIndex,colEnd:t.cell.colIndex},a))return t;let s={...t.cell},w=t.rangeIndex;switch(o){case r.Direction.Right:s.colIndex=Oe(u,s.colIndex+1,o);break;case r.Direction.Left:s.colIndex=Oe(u,s.colIndex-1,o);break;case r.Direction.Down:s.rowIndex=Oe(c,s.rowIndex+1,o);break;case r.Direction.Up:s.rowIndex=Oe(c,s.rowIndex-1,o)}const M=U=>{if(U){w=t.rangeIndex>=t.ranges.length-1?0:t.rangeIndex+1;const z=t.ranges[w];s={colIndex:z.colStart,rowIndex:z.rowStart}}else{w=t.rangeIndex<=0?t.ranges.length-1:t.rangeIndex-1;const z=t.ranges[w];s={colIndex:z.colEnd,rowIndex:z.rowEnd}}};if(o===r.Direction.Right&&s.colIndex>a.colEnd&&s.rowIndex===a.rowEnd)M(!0);else if(o===r.Direction.Left&&s.colIndex<a.colStart&&s.rowIndex===a.rowStart)M(!1);else if(o===r.Direction.Down&&s.colIndex===a.colEnd&&s.rowIndex>a.rowEnd)M(!0);else if(o===r.Direction.Up&&s.colIndex===a.colStart&&s.rowIndex<a.rowStart)M(!1);else{let U=s.rowIndex,z=s.colIndex;switch(o){case r.Direction.Right:z>a.colEnd&&(U=Oe(c,U+1,o),z=a.colStart,U>a.rowEnd&&(U=a.rowStart));break;case r.Direction.Left:z<a.colStart&&(U=Oe(c,U-1,o),z=a.colEnd,U<a.rowStart&&(U=a.rowEnd));break;case r.Direction.Down:U>a.rowEnd&&(z=Oe(u,z+1,o),U=a.rowStart,z>a.colEnd&&(z=a.colStart));break;case r.Direction.Up:U<a.rowStart&&(z=Oe(u,z-1,o),U=a.rowEnd,z<a.colStart&&(z=a.colEnd))}s={rowIndex:U,colIndex:z}}let A=i(s);if(!r.CoordUtils.isRangeWithinRange(A,a)){const U=r.CoordUtils.intersectRanges(A,a);U&&(A=U)}let k={rowStart:Oe(c,A.rowStart,r.Direction.Down),colStart:Oe(u,A.colStart,r.Direction.Right),rowEnd:Oe(c,A.rowEnd,r.Direction.Up),colEnd:Oe(u,A.colEnd,r.Direction.Left)};if(k.rowStart!==s.rowIndex||k.colStart!==s.colIndex){switch(o){case r.Direction.Right:t.ranges[w].colStart===k.colStart&&t.ranges[w].colEnd===k.colEnd&&(s.rowIndex=k.rowEnd),s.colIndex=k.colEnd;break;case r.Direction.Left:t.ranges[w].colStart===k.colStart&&t.ranges[w].colEnd===k.colEnd&&(s.rowIndex=k.rowStart),s.rowIndex===k.rowStart?s.colIndex=k.colStart+1:s.colIndex=k.colStart;break;case r.Direction.Down:t.ranges[w].rowStart===k.rowStart&&t.ranges[w].rowEnd===k.rowEnd&&(s.colIndex=k.colEnd),s.rowIndex=k.rowEnd;break;case r.Direction.Up:t.ranges[w].rowStart===k.rowStart&&t.ranges[w].rowEnd===k.rowEnd&&(s.colIndex=k.colStart),s.colIndex===k.colStart?s.rowIndex=k.rowStart+1:s.rowIndex=k.rowStart}return Pn({cell:s,ranges:t.ranges,rangeIndex:w},o,i,c,u,d??t)}return{ranges:t.ranges,cell:s,rangeIndex:w}},Nn=(t,o)=>{let i,c=0,u=0;return o.colStart<t.colStart?(i=r.Direction.Left,c=t.colStart-o.colStart,u=o.colStart):o.colEnd>t.colEnd?(i=r.Direction.Right,c=o.colEnd-t.colEnd,u=o.colEnd):o.rowStart<t.rowStart?(i=r.Direction.Up,c=t.rowStart-o.rowStart,u=o.rowStart):o.rowEnd>t.rowEnd&&(i=r.Direction.Down,c=o.rowEnd-t.rowEnd,u=o.rowEnd),{direction:i,amount:c,index:u}},wn=(t,o=!1,i,c)=>{if(!i)return 0;const u=!o,d=u?1:-1;let a=i(u?t:t+1),s=i(u?t+1:t),w=t+(u?2:-1),M=0;for(;(s-a)*d<=0;){if(u&&w-1>c+1||!u&&w+1<c)return M;a=s,s=i(w),w+=d,M++}return M},qn=(t,o,i,c,u)=>{const d={};let a=null,s=null;for(let w=0;w<=i.length&&i[w]<=u;w++){const M=i[w];if(M<c)continue;const A=a===M?s:o?t.getColOffset(M):t.getRowOffset(M),k=o?t.getColOffset(M+1):t.getRowOffset(M+1);a=M+1,s=k,d[M]=Object.freeze({offset:A,size:k-A,spanIndex:w})}return Object.freeze(d)},Yn=(t,o,i)=>{const c=t.getColOffset(o.colStart)+(i?.left??0),u=t.getRowOffset(o.rowStart)+(i?.top??0);return{x:c,y:u,width:t.getColOffset(o.colEnd+1)+(i?.right??0)-(i?.left??0)-c,height:t.getRowOffset(o.rowEnd+1)+(i?.bottom??0)-(i?.top??0)-u}},Do=(t,o,i)=>!!i&&!(t<i.x||t>i.x+i.width)&&!(o<i.y||o>i.y+i.height),kn=(t,o=!0)=>`M ${n.ReactUtils.boundPixel(t.left)} ${n.ReactUtils.boundPixel(t.top)} L ${n.ReactUtils.boundPixel(t.right,!0)} ${n.ReactUtils.boundPixel(t.top)} L ${n.ReactUtils.boundPixel(t.right,!0)} ${n.ReactUtils.boundPixel(t.bottom,!0)} L ${n.ReactUtils.boundPixel(t.left)} ${n.ReactUtils.boundPixel(t.bottom,!0)} L ${n.ReactUtils.boundPixel(t.left)} ${n.ReactUtils.boundPixel(t.top)} ${o?"Z":""}`,Un=t=>{const{linePoints:o,bounds:i,pathProps:c,style:u,...d}=t;return ne.jsx("svg",{width:`${n.ReactUtils.boundPixel(i.width,!0)}`,height:`${n.ReactUtils.boundPixel(i.height,!0)}`,viewBox:`0 0 ${n.ReactUtils.boundPixel(i.width,!0)} ${n.ReactUtils.boundPixel(i.height,!0)}`,style:{position:"absolute",left:`${n.ReactUtils.boundPixel(i.x)}px`,top:`${n.ReactUtils.boundPixel(i.y)}px`,width:`${n.ReactUtils.boundPixel(i.width,!0)}px`,height:`${n.ReactUtils.boundPixel(i.height,!0)}px`,pointerEvents:"none",transitionTimingFunction:"linear",transitionDelay:"0",transitionProperty:"left, top, width, height",willChange:"left, top, width, height, stroke-dashoffset",...u},...d,children:ne.jsx("path",{d:`M ${n.ReactUtils.boundPixel(o[0])} ${n.ReactUtils.boundPixel(o[1])} L ${n.ReactUtils.boundPixel(o[2])} ${n.ReactUtils.boundPixel(o[3])}`,fill:"none",vectorEffect:"non-scaling-stroke",stroke:"black",...c})})},ro=t=>{const{x:o=0,y:i=0,width:c=0,height:u=0,fill:d,stroke:a,strokeWidth:s=0,strokeDasharray:w,strokeDashoffset:M,clipPath:A,pathBounds:k,pathProps:U,style:z,...q}=t,N=i,J=o,Ce=c,_=u;let D=null;if(d){let F=kn({top:0,left:0,bottom:_,right:Ce});k&&(F=F+" "+kn({top:k.y-N,left:k.x-J,bottom:k.height+k.y-N,right:k.width+k.x-J})),D=[ne.jsx("path",{d:F,fill:d,stroke:"none",fillRule:"evenodd"},"fill")]}return ne.jsxs("svg",{width:`${n.ReactUtils.boundPixel(c,!0)}`,height:`${n.ReactUtils.boundPixel(u,!0)}`,viewBox:`0 0 ${n.ReactUtils.boundPixel(c,!0)} ${n.ReactUtils.boundPixel(u,!0)}`,preserveAspectRatio:"none",style:{position:"absolute",left:`${n.ReactUtils.boundPixel(o)}px`,top:`${n.ReactUtils.boundPixel(i)}px`,pointerEvents:"none",transitionDuration:"0ms",transitionTimingFunction:"linear",transitionDelay:"0",transitionProperty:"left, top, width, height",willChange:"left, top, width, height, stroke-dashoffset",boxShadow:"rgb(60 64 67 / 5%) 0px 1px 4px 2px, rgb(255 255 255 / 15%) 0px 0px 2px 1px",overflow:"visible",...z},...q,children:[D,ne.jsx("path",{d:kn({top:0,left:0,right:Ce,bottom:_}),fill:"none",strokeDasharray:w,strokeDashoffset:M,stroke:a,vectorEffect:"non-scaling-stroke",strokeWidth:s,...U})]})},Xn=t=>{const{key:o,...i}=t;return ne.jsx(zn,{...i},o)},zn=l.memo(t=>{const{stroke:o,fill:i,x:c=0,y:u=0,width:d=0,height:a=0,style:s,isAnimatedStroke:w,animatedStrokeProps:M,range:A,cell:k,...U}=t,z=w||!!M,q={name:"walking-offset",dashGap:2,speed:50,dashLength:8,...M};let N=q.dashGap+q.dashLength;const J=q.speed*N,Ce=n.useId().replaceAll(":",""),_=`${q.name}-${Ce}`;let D;return l.useEffect(()=>{if(!z)return;const F=`@keyframes ${_} {
|
|
7
|
+
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ne=require("react/jsx-runtime"),n=require("@sheetxl/utils-react"),l=require("react"),r=require("@sheetxl/utils"),Jn=require("react-dom"),Yt=({itemType:t,index:o,itemSize:i,instanceProps:c,scale:u=1})=>{let d,a,s;t==="column"?(d=c.columnMetadataMap,a=c.lastMeasuredColumnIndex,s=c.recalcColumnIndices):(d=c.rowMetadataMap,a=c.lastMeasuredRowIndex,s=c.recalcRowIndices);const w=s.length>0;if(o>a){let M=0;if(a>=0){const A=d[a];M=A.offset+A.size}for(let A=a+1;A<=o;A++){let k=w?s.includes(A)?i(A)*u:d[A]?.size||i(A)*u:i(A)*u;d[A]={offset:M,size:k},M+=k}t==="column"?c.lastMeasuredColumnIndex=o:c.lastMeasuredRowIndex=o}return d[o],d[o]},Kn=({itemType:t,itemSize:o,itemCount:i,instanceProps:c,offset:u,scale:d})=>{let a,s;t==="column"?(a=c.columnMetadataMap,s=c.lastMeasuredColumnIndex):(a=c.rowMetadataMap,s=c.lastMeasuredRowIndex);let w=0;return w=(s>0?a[s].offset:0)>=u?Qn({itemType:t,itemSize:o,instanceProps:c,high:s,low:0,offset:u,scale:d}):xo({itemType:t,itemSize:o,itemCount:i,instanceProps:c,index:Math.max(0,s),offset:u,scale:d}),w=Math.min(w,i),w},Qn=({itemType:t,itemSize:o,instanceProps:i,high:c,low:u,offset:d,scale:a})=>{for(;u<=c;){const s=u+Math.floor((c-u)/2),w=Yt({itemType:t,itemSize:o,index:s,instanceProps:i,scale:a}).offset;if(w===d)return s;w<d?u=s+1:w>d&&(c=s-1)}return u>0?u-1:0},xo=({itemType:t,itemSize:o,itemCount:i,instanceProps:c,index:u,offset:d,scale:a})=>{let s=1;for(;u<i&&Yt({itemType:t,itemSize:o,index:u,instanceProps:c,scale:a}).offset<d;)u+=s,s*=2;return Qn({itemType:t,itemSize:o,instanceProps:c,high:Math.min(u,i-1),low:Math.floor(u/2),offset:d,scale:a})},eo=t=>{const{rowCount:o,columnCount:i,defaultRowHeight:c,getRowHeight:u,defaultColumnWidth:d,getColumnWidth:a}=t||{},s=l.useRef({columnMetadataMap:{},rowMetadataMap:{},lastMeasuredColumnIndex:-1,lastMeasuredRowIndex:-1,recalcColumnIndices:[],recalcRowIndices:[]}),w=n.useCallbackRef(D=>Kn({itemType:"row",itemCount:o,itemSize:u??(()=>c??20),instanceProps:s.current,offset:D}),[o,u,c]),M=n.useCallbackRef(D=>D===-1?0:Yt({itemType:"row",index:D,itemSize:u??(()=>c??20),instanceProps:s.current}).offset,[u,c]),A=n.useCallbackRef(D=>Yt({itemType:"row",index:D,itemSize:u??(()=>c??20),instanceProps:s.current}).size,[u,c]),k=n.useCallbackRef(D=>Kn({itemType:"column",itemCount:i,itemSize:a??(()=>d??75),instanceProps:s.current,offset:D}),[i,a,d]),U=n.useCallbackRef(D=>D===-1?0:Yt({itemType:"column",index:D,itemSize:a??(()=>d??75),instanceProps:s.current}).offset,[a,d]),z=n.useCallbackRef(D=>Yt({itemType:"column",index:D,itemSize:a??(()=>d??75),instanceProps:s.current}).size,[a,d]),[q,N]=l.useReducer(D=>D+1,0),J=()=>({getRowOffset:M,getColOffset:U,getRowIndex:w,getColIndex:k}),[Ce,_]=l.useState(()=>t?J():null);return l.useEffect(()=>{_(t?J():null)},[q,o,i,d,c,A,z]),Ce},On="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ~`!@#$%^&*()-_=+[{]};:'\",<.>/?|\\",Fn=t=>{if(!t)return null;if(t.eventType==="start")return{type:t.eventType};if(t.eventType==="submit")return{type:t.eventType};if(t.eventType==="cancel")return{type:t.eventType};if(t.eventType==="keyboard")return{type:t.eventType,key:t.event.key};if(t.eventType==="pointer")return{type:t.eventType};if(t.eventType==="coordsChange"){const o={type:t.eventType};return t.activeCoords&&(o.activeCoords=t.activeCoords),o}return{type:t.eventType??"unknown"}},po=t=>!0,mo=t=>!!t&&!(t.ctrlKey||t.metaKey||t.altKey||t.isComposing)&&(!(t.shiftKey||t.key!=="F2"&&t.key!==" "&&t.key!=="Backspace")||(!t.shiftKey||t.key!==" ")&&On.indexOf(t.key)!==-1),Co=t=>!!t&&t.type==="dblclick"&&{editMode:!0},So=t=>{const{session:o,refLatestCoords:i,handleSubmitEdit:c,handleCancelEdit:u,cellBounds:d,isInBounds:a,getCellEditor:s,propsEditor:w,borderStrokeFill:M="rgb(33, 115, 70)",borderStrokeWidth:A=2,alignment:k=n.HorizontalAlignment.Left,style:U,...z}=t,q=l.useRef(null),N=l.useRef(null),[J,Ce]=l.useState(!1),_=o.coords,D=l.useCallback(async ae=>{if(q.current?.getBoundingClientRect()){if(ae.eventType==="keyboard"){const $=ae.event,C=new KeyboardEvent($.type,{bubbles:!0,cancelable:!0,view:window,key:$.key,code:$.code,location:$.location,repeat:$.repeat,isComposing:$.isComposing,charCode:$.charCode,keyCode:$.keyCode,which:$.which,ctrlKey:$.ctrlKey,shiftKey:$.shiftKey,altKey:$.altKey,metaKey:$.metaKey});C.isSynthetic=!0,C.key,N.current?.dispatchEvent(C)}else ae.eventType==="pointer"||console.warn("unsupported event type",ae);await new Promise($=>requestAnimationFrame($))}},[]);l.useEffect(()=>{const ae=N.current;return Ce(!0),N.current.startEdit?.(o.startEvent),(async()=>{o.editorRefs.push(ae),o.editorRefsDispatchEditorEvent.push(D);const xe=[...o.events];for(let $=0;$<xe.length;$++)await D(xe[$]);o.onMount(ae)})(),()=>{const xe=o.editorRefs.indexOf(ae);xe!==-1&&o.editorRefs.splice(xe,1),o.onUnmount(ae)}},[]);const F=l.useCallback(()=>c(o),[]),se=l.useCallback(()=>{u(o)},[]),P=i.current&&r.CoordUtils.isEqualCells(i.current,_),ie=a&&P&&J,ze=s({autoFocus:!!o.startEvent?.autoFocus,...w,onSubmitEdit:F,onCancelEdit:se,ref:N},_),ve=d.x+n.ReactUtils.boundPixel(-A/2),Ae=n.ReactUtils.boundPixel(d.width+A/2,!0);return ne.jsx("div",{tabIndex:0,ref:q,style:{background:void 0,...U,opacity:ie?U?.opacity??1:0,pointerEvents:"auto",position:"absolute",boxSizing:"border-box",top:`${d.y+n.ReactUtils.boundPixel(-A/2)}px`,height:n.ReactUtils.boundPixel(d.height+A/2,!0),left:`${ve}px`,width:Ae},...z,children:ne.jsx("div",{className:"editor-container",style:{position:"absolute",boxSizing:"border-box",left:`${n.ReactUtils.boundPixel(1)}px`,top:`${n.ReactUtils.boundPixel(1)}px`,width:n.ReactUtils.boundPixel(d.width-2,!0),height:n.ReactUtils.boundPixel(d.height-2,!0),outline:`${A}px ${M} solid`,boxShadow:"rgba(60,64,67,.35) 2px 2px 6px 3px",maxHeight:"100%",overflow:"hidden",display:"flex"},children:ze})})};var bo=function(){},to=typeof window<"u",yo=to?l.useLayoutEffect:l.useEffect,Vn={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const no=to&&window.ResizeObserver!==void 0?function(){var t=l.useState(null),o=t[0],i=t[1],c=l.useState(Vn),u=c[0],d=c[1],a=l.useMemo(function(){return new window.ResizeObserver(function(s){if(s[0]){var w=s[0].contentRect,M=w.x,A=w.y,k=w.width,U=w.height,z=w.top,q=w.left,N=w.bottom,J=w.right;d({x:M,y:A,width:k,height:U,top:z,left:q,bottom:N,right:J})}})},[]);return yo(function(){if(o)return a.observe(o),function(){a.disconnect()}},[o]),[i,u]}:function(){return[bo,Vn]},vo=3,Ro=.5,Eo=50,In=t=>({x:t.x,y:t.y,width:t.width,height:t.height,top:t.top,left:t.left,right:t.right,bottom:t.bottom});function oo(t={}){const{threshold:o=Ro,stillnessThreshold:i=vo,maxHierarchyDepth:c=Eo}=t,[u,d]=no(),a=l.useRef(null),[s,w]=l.useReducer(q=>q+1,0),M=l.useRef(void 0),A=l.useRef({x:0,y:0,width:0,height:0,top:0,left:0,right:0,bottom:0}),k=l.useCallback(q=>{a.current=q,typeof u=="function"&&u(q)},[u]),[U,z]=l.useState(d);return l.useEffect(()=>{d&&!U&&z(d)},[d,U]),l.useEffect(()=>{const q=a.current;if(!q)return;let N=!1,J=0;const Ce=()=>{if(!q)return;const P=q.getBoundingClientRect(),ie=A.current;Math.abs(P.x-ie.x)>o||Math.abs(P.y-ie.y)>o||Math.abs(P.width-ie.width)>o||Math.abs(P.height-ie.height)>o?(N||(N=!0,z(In(P)),w()),J=0):J++,N&&J>=i&&(N=!1,z(In(P)),w()),A.current=In(P),M.current=requestAnimationFrame(Ce)};M.current=requestAnimationFrame(Ce);const _=P=>{N=!0,w()},D=P=>{N=!1,J=i,w()};let F=q;const se=[];for(;F&&F!==document.documentElement&&(F.addEventListener("animationstart",_,!0),F.addEventListener("animationend",D,!0),F.addEventListener("transitionstart",_,!0),F.addEventListener("transitionend",D,!0),se.push(F),F=F.parentElement,!(se.length>c)););return()=>{M.current&&cancelAnimationFrame(M.current),se.forEach(P=>{P.removeEventListener("animationstart",_,!0),P.removeEventListener("animationend",D,!0),P.removeEventListener("transitionstart",_,!0),P.removeEventListener("transitionend",D,!0)})}},[s,d,o,i,c]),[k,U]}const Oe=(t,o,i)=>{if(!t)return o;let c=o;const u=i===r.Direction.Right||i===r.Direction.Down;for(;;){const d=t(c,!u);if(d===0)return c;u?c+=d:c-=d}},un=(t,o,i)=>{const c=[];let u=o;for(;u<=i;){const d=Math.max(0,t(u));d===0?(c.push(u),u++):u+=d}return c},Io=(t,o,i,c,u,d)=>{if(!o)return d;let{rowIndex:a,colIndex:s}=t;switch(c){case r.Direction.Down:{a=Oe(i,Math.min(a+1,d),c);let w=o({rowIndex:a,colIndex:s});for(;!w&&a<d;)a=Oe(i,Math.min(++a,d),c),w=o({rowIndex:a,colIndex:s});return a}case r.Direction.Up:{a=Oe(i,Math.max(a-1,d),c);let w=o({rowIndex:a,colIndex:s});for(;!w&&a>d;)a=Oe(i,Math.max(--a,d),c),w=o({rowIndex:a,colIndex:s});return a}case r.Direction.Right:{s=Oe(i,Math.min(s+1,d),c);let w=o({rowIndex:a,colIndex:s});for(;!w&&s<d;)s=Oe(i,Math.min(++s,d),c),w=o({rowIndex:a,colIndex:s});return s}case r.Direction.Left:{s=Oe(i,Math.max(s-1,d),c);let w=o({rowIndex:a,colIndex:s});for(;!w&&s>d;)s=Oe(i,Math.max(--s,d),c),w=o({rowIndex:a,colIndex:s});return s}default:return d}},ko=(t,o=()=>!0,i,c,u,d)=>{let{rowIndex:a,colIndex:s}=t;switch(c){case r.Direction.Down:{a=Oe(i,Math.min(a+1,d),c);let w=o?.({rowIndex:a,colIndex:s});for(;w&&a<d;)a=Oe(i,Math.min(++a,d),c),w=o?.({rowIndex:a,colIndex:s});return o?.({rowIndex:a,colIndex:s})?a:a-1}case r.Direction.Up:{a=Oe(i,Math.max(a-1,d),c);let w=o?.({rowIndex:a,colIndex:s});for(;w&&a>d;)a=Oe(i,Math.max(--a,d),c),w=o?.({rowIndex:a,colIndex:s});return o?.({rowIndex:a,colIndex:s})?a:a+1}case r.Direction.Right:{s=Oe(i,Math.min(s+1,d),c);let w=o?.({rowIndex:a,colIndex:s});for(;w&&s<d;)s=Oe(i,Math.min(++s,d),c),w=o?.({rowIndex:a,colIndex:s});return o?.({rowIndex:a,colIndex:s})?s:s-1}case r.Direction.Left:{s=Oe(i,Math.max(s-1,d),c);let w=o?.({rowIndex:a,colIndex:s});for(;w&&s>d;)s=Oe(i,Math.max(--s,d),c),w=o?.({rowIndex:a,colIndex:s});return o?.({rowIndex:a,colIndex:s})?s:s+1}default:return null}},Mo=(t,o,i,c,u,d)=>{if(!o)return d;let a,{rowIndex:s,colIndex:w}=t;c===r.Direction.Down?a={rowIndex:s+1,colIndex:w}:c===r.Direction.Up?a={rowIndex:s-1,colIndex:w}:c===r.Direction.Right?a={rowIndex:s,colIndex:w+1}:c===r.Direction.Left&&(a={rowIndex:s,colIndex:w-1});const M=o(t),A=o(a);var k,U;return(U=A,!(k=M)&&!U||!k&&U||k&&!U?Io:ko)(t,o,i,c,!1,d)??d},Wn=(t,o)=>`${t}:${o}`,Hn=(t,o,i,c,u,d)=>{if(i-o>=u-c)return c;let a=c;return t==="nearest"&&(c-o>0?t="start":i-u>0&&(t="end")),t==="start"?a=o:t==="end"?a=i-(u-c):t==="center"&&(a=o+(i-o)/2-(u-c)/2),Math.max(0,Math.min(a,d-(u-c)))},jn=(t,o,i,c)=>(console.log("todo: implement convertToVisibleRanges"),t),Pn=(t,o=r.Direction.Right,i,c,u,d=null)=>{if(d&&r.CoordUtils.isEqualSelectionCoords(d,t))return t;const a=t.ranges[t.rangeIndex];if(!r.CoordUtils.isRangesIntersect({rowStart:t.cell.rowIndex,colStart:t.cell.colIndex,rowEnd:t.cell.rowIndex,colEnd:t.cell.colIndex},a))return t;let s={...t.cell},w=t.rangeIndex;switch(o){case r.Direction.Right:s.colIndex=Oe(u,s.colIndex+1,o);break;case r.Direction.Left:s.colIndex=Oe(u,s.colIndex-1,o);break;case r.Direction.Down:s.rowIndex=Oe(c,s.rowIndex+1,o);break;case r.Direction.Up:s.rowIndex=Oe(c,s.rowIndex-1,o)}const M=U=>{if(U){w=t.rangeIndex>=t.ranges.length-1?0:t.rangeIndex+1;const z=t.ranges[w];s={colIndex:z.colStart,rowIndex:z.rowStart}}else{w=t.rangeIndex<=0?t.ranges.length-1:t.rangeIndex-1;const z=t.ranges[w];s={colIndex:z.colEnd,rowIndex:z.rowEnd}}};if(o===r.Direction.Right&&s.colIndex>a.colEnd&&s.rowIndex===a.rowEnd)M(!0);else if(o===r.Direction.Left&&s.colIndex<a.colStart&&s.rowIndex===a.rowStart)M(!1);else if(o===r.Direction.Down&&s.colIndex===a.colEnd&&s.rowIndex>a.rowEnd)M(!0);else if(o===r.Direction.Up&&s.colIndex===a.colStart&&s.rowIndex<a.rowStart)M(!1);else{let U=s.rowIndex,z=s.colIndex;switch(o){case r.Direction.Right:z>a.colEnd&&(U=Oe(c,U+1,o),z=a.colStart,U>a.rowEnd&&(U=a.rowStart));break;case r.Direction.Left:z<a.colStart&&(U=Oe(c,U-1,o),z=a.colEnd,U<a.rowStart&&(U=a.rowEnd));break;case r.Direction.Down:U>a.rowEnd&&(z=Oe(u,z+1,o),U=a.rowStart,z>a.colEnd&&(z=a.colStart));break;case r.Direction.Up:U<a.rowStart&&(z=Oe(u,z-1,o),U=a.rowEnd,z<a.colStart&&(z=a.colEnd))}s={rowIndex:U,colIndex:z}}let A=i(s);if(!r.CoordUtils.isRangeWithinRange(A,a)){const U=r.CoordUtils.intersectRanges(A,a);U&&(A=U)}let k={rowStart:Oe(c,A.rowStart,r.Direction.Down),colStart:Oe(u,A.colStart,r.Direction.Right),rowEnd:Oe(c,A.rowEnd,r.Direction.Up),colEnd:Oe(u,A.colEnd,r.Direction.Left)};if(k.rowStart!==s.rowIndex||k.colStart!==s.colIndex){switch(o){case r.Direction.Right:t.ranges[w].colStart===k.colStart&&t.ranges[w].colEnd===k.colEnd&&(s.rowIndex=k.rowEnd),s.colIndex=k.colEnd;break;case r.Direction.Left:t.ranges[w].colStart===k.colStart&&t.ranges[w].colEnd===k.colEnd&&(s.rowIndex=k.rowStart),s.rowIndex===k.rowStart?s.colIndex=k.colStart+1:s.colIndex=k.colStart;break;case r.Direction.Down:t.ranges[w].rowStart===k.rowStart&&t.ranges[w].rowEnd===k.rowEnd&&(s.colIndex=k.colEnd),s.rowIndex=k.rowEnd;break;case r.Direction.Up:t.ranges[w].rowStart===k.rowStart&&t.ranges[w].rowEnd===k.rowEnd&&(s.colIndex=k.colStart),s.colIndex===k.colStart?s.rowIndex=k.rowStart+1:s.rowIndex=k.rowStart}return Pn({cell:s,ranges:t.ranges,rangeIndex:w},o,i,c,u,d??t)}return{ranges:t.ranges,cell:s,rangeIndex:w}},Nn=(t,o)=>{let i,c=0,u=0;return o.colStart<t.colStart?(i=r.Direction.Left,c=t.colStart-o.colStart,u=o.colStart):o.colEnd>t.colEnd?(i=r.Direction.Right,c=o.colEnd-t.colEnd,u=o.colEnd):o.rowStart<t.rowStart?(i=r.Direction.Up,c=t.rowStart-o.rowStart,u=o.rowStart):o.rowEnd>t.rowEnd&&(i=r.Direction.Down,c=o.rowEnd-t.rowEnd,u=o.rowEnd),{direction:i,amount:c,index:u}},wn=(t,o=!1,i,c)=>{if(!i)return 0;const u=!o,d=u?1:-1;let a=i(u?t:t+1),s=i(u?t+1:t),w=t+(u?2:-1),M=0;for(;(s-a)*d<=0;){if(u&&w-1>c+1||!u&&w+1<c)return M;a=s,s=i(w),w+=d,M++}return M},qn=(t,o,i,c,u)=>{const d={};let a=null,s=null;for(let w=0;w<=i.length&&i[w]<=u;w++){const M=i[w];if(M<c)continue;const A=a===M?s:o?t.getColOffset(M):t.getRowOffset(M),k=o?t.getColOffset(M+1):t.getRowOffset(M+1);a=M+1,s=k,d[M]=Object.freeze({offset:A,size:k-A,spanIndex:w})}return Object.freeze(d)},Yn=(t,o,i)=>{const c=t.getColOffset(o.colStart)+(i?.left??0),u=t.getRowOffset(o.rowStart)+(i?.top??0);return{x:c,y:u,width:t.getColOffset(o.colEnd+1)+(i?.right??0)-(i?.left??0)-c,height:t.getRowOffset(o.rowEnd+1)+(i?.bottom??0)-(i?.top??0)-u}},Do=(t,o,i)=>!!i&&!(t<i.x||t>i.x+i.width)&&!(o<i.y||o>i.y+i.height),kn=(t,o=!0)=>`M ${n.ReactUtils.boundPixel(t.left)} ${n.ReactUtils.boundPixel(t.top)} L ${n.ReactUtils.boundPixel(t.right,!0)} ${n.ReactUtils.boundPixel(t.top)} L ${n.ReactUtils.boundPixel(t.right,!0)} ${n.ReactUtils.boundPixel(t.bottom,!0)} L ${n.ReactUtils.boundPixel(t.left)} ${n.ReactUtils.boundPixel(t.bottom,!0)} L ${n.ReactUtils.boundPixel(t.left)} ${n.ReactUtils.boundPixel(t.top)} ${o?"Z":""}`,Un=t=>{const{linePoints:o,bounds:i,pathProps:c,style:u,...d}=t;return ne.jsx("svg",{width:`${n.ReactUtils.boundPixel(i.width,!0)}`,height:`${n.ReactUtils.boundPixel(i.height,!0)}`,viewBox:`0 0 ${n.ReactUtils.boundPixel(i.width,!0)} ${n.ReactUtils.boundPixel(i.height,!0)}`,style:{position:"absolute",left:`${n.ReactUtils.boundPixel(i.x)}px`,top:`${n.ReactUtils.boundPixel(i.y)}px`,width:`${n.ReactUtils.boundPixel(i.width,!0)}px`,height:`${n.ReactUtils.boundPixel(i.height,!0)}px`,pointerEvents:"none",transitionTimingFunction:"linear",transitionDelay:"0",transitionProperty:"left, top, width, height",willChange:"left, top, width, height, stroke-dashoffset",...u},...d,children:ne.jsx("path",{d:`M ${n.ReactUtils.boundPixel(o[0])} ${n.ReactUtils.boundPixel(o[1])} L ${n.ReactUtils.boundPixel(o[2])} ${n.ReactUtils.boundPixel(o[3])}`,fill:"none",vectorEffect:"non-scaling-stroke",stroke:"black",...c})})},ro=t=>{const{x:o=0,y:i=0,width:c=0,height:u=0,fill:d,stroke:a,strokeWidth:s=0,strokeDasharray:w,strokeDashoffset:M,clipPath:A,pathBounds:k,pathProps:U,style:z,...q}=t,N=i,J=o,Ce=c,_=u;let D=null;if(d){let F=kn({top:0,left:0,bottom:_,right:Ce});k&&(F=F+" "+kn({top:k.y-N,left:k.x-J,bottom:k.height+k.y-N,right:k.width+k.x-J})),D=[ne.jsx("path",{d:F,fill:d,stroke:"none",fillRule:"evenodd"},"fill")]}return ne.jsxs("svg",{width:`${n.ReactUtils.boundPixel(c,!0)}`,height:`${n.ReactUtils.boundPixel(u,!0)}`,viewBox:`0 0 ${n.ReactUtils.boundPixel(c,!0)} ${n.ReactUtils.boundPixel(u,!0)}`,preserveAspectRatio:"none",style:{position:"absolute",left:`${n.ReactUtils.boundPixel(o)}px`,top:`${n.ReactUtils.boundPixel(i)}px`,pointerEvents:"none",transitionDuration:"0ms",transitionTimingFunction:"linear",transitionDelay:"0",transitionProperty:"left, top, width, height",willChange:"left, top, width, height, stroke-dashoffset",boxShadow:"rgb(60 64 67 / 5%) 0px 1px 4px 2px, rgb(255 255 255 / 15%) 0px 0px 2px 1px",overflow:"visible",...z},...q,children:[D,ne.jsx("path",{d:kn({top:0,left:0,right:Ce,bottom:_}),fill:"none",strokeDasharray:w,strokeDashoffset:M,stroke:a,vectorEffect:"non-scaling-stroke",strokeWidth:s,...U})]})},Xn=t=>{const{key:o,...i}=t;return ne.jsx(zn,{...i},o)},zn=l.memo(t=>{const{stroke:o,fill:i,x:c=0,y:u=0,width:d=0,height:a=0,style:s,isAnimatedStroke:w,animatedStrokeProps:M,range:A,cell:k,...U}=t,z=w||!!M,q={name:"walking-offset",dashGap:2,speed:50,dashLength:8,...M};let N=q.dashGap+q.dashLength;const J=q.speed*N,Ce=n.useId().replaceAll(":",""),_=`${q.name}-${Ce}`;let D;return l.useEffect(()=>{if(!z)return;const F=`@keyframes ${_} {
|
|
8
8
|
to {
|
|
9
9
|
stroke-dashoffset: 0px;
|
|
10
10
|
}
|
package/browser/esm/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { useRef as ie, useReducer as Ln, useState as dt, useEffect as pt, useCal
|
|
|
5
5
|
import { CoordUtils as F, CommonUtils as Nt, RangeOrientation as Ht, Direction as w, AnchorLocation as _e } from "@sheetxl/utils";
|
|
6
6
|
import { createPortal as po } from "react-dom";
|
|
7
7
|
/**
|
|
8
|
-
* @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.6.
|
|
8
|
+
* @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.6.12
|
|
9
9
|
*
|
|
10
10
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
11
11
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
@@ -286,7 +286,7 @@ const yo = So && window.ResizeObserver !== void 0 ? function() {
|
|
|
286
286
|
}, [n]), [o, s];
|
|
287
287
|
} : function() {
|
|
288
288
|
return [Ho, no];
|
|
289
|
-
}, Ko = 3, qo = 0.
|
|
289
|
+
}, Ko = 3, qo = 0.5, jo = 50, Kn = (t) => ({ x: t.x, y: t.y, width: t.width, height: t.height, top: t.top, left: t.left, right: t.right, bottom: t.bottom });
|
|
290
290
|
function Yo(t = {}) {
|
|
291
291
|
const { threshold: n = qo, stillnessThreshold: o = Ko, maxHierarchyDepth: r = jo } = t, [s, c] = yo(), i = ie(null), [l, h] = Ln((Y) => Y + 1, 0), k = ie(void 0), A = ie({ x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 }), E = $((Y) => {
|
|
292
292
|
i.current = Y, typeof s == "function" && s(Y);
|
package/node/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.6.
|
|
2
|
+
* @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.6.12
|
|
3
3
|
*
|
|
4
4
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
@@ -281,7 +281,7 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
|
|
|
281
281
|
}, []), cancelEdit: v(() => {
|
|
282
282
|
Q2({ eventType: "cancel" });
|
|
283
283
|
}, []), onKeyboardEvent: oe2, onPointerEvent: te2, onKeyboardEventNative: ne2, onPointerEventNative: ee2, isEditing: M2 };
|
|
284
|
-
}, Y = 3, G = 0.
|
|
284
|
+
}, Y = 3, G = 0.5, Z = 50, _ = (e2) => ({ x: e2.x, y: e2.y, width: e2.width, height: e2.height, top: e2.top, left: e2.left, right: e2.right, bottom: e2.bottom });
|
|
285
285
|
function J(e2 = {}) {
|
|
286
286
|
const { threshold: t2 = G, stillnessThreshold: n2 = Y, maxHierarchyDepth: o2 = Z } = e2, [r2, l2] = z(), i2 = w(null), [c2, s2] = x((e3) => e3 + 1, 0), a2 = w(void 0), d2 = w({ x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 }), u2 = v((e3) => {
|
|
287
287
|
i2.current = e3, "function" == typeof r2 && r2(e3);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetxl/grid-react",
|
|
3
3
|
"description": "Grid React - Advanced grid component for React",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.12",
|
|
5
5
|
"license": "SEE LICENSE IN <LICENSE>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"table"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@sheetxl/utils": "^0.6.
|
|
34
|
-
"@sheetxl/utils-react": "^0.6.
|
|
33
|
+
"@sheetxl/utils": "^0.6.12",
|
|
34
|
+
"@sheetxl/utils-react": "^0.6.12",
|
|
35
35
|
"clsx": "^2.1.1",
|
|
36
36
|
"react-merge-refs": "^3.0.2",
|
|
37
37
|
"react-use": "^17.6.0",
|