@ishibashi0112/spreadsheet-grid-core 0.60.0 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/controllers/changeHighlightController.cjs +1 -1
- package/dist/controllers/changeHighlightController.js +54 -49
- package/dist/controllers/clipboardController.cjs +2 -2
- package/dist/controllers/clipboardController.js +71 -76
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.js +74 -70
- package/dist/controllers/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.d.ts +2 -0
- package/dist/controllers/columnMenuController.js +72 -60
- package/dist/controllers/contextMenuController.cjs +1 -1
- package/dist/controllers/contextMenuController.js +40 -32
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +90 -84
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.js +71 -71
- package/dist/controllers/imeInputController.cjs +1 -1
- package/dist/controllers/imeInputController.js +68 -65
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +3 -0
- package/dist/controllers/keyboardController.js +184 -91
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.js +11 -2
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.d.ts +1 -0
- package/dist/controllers/popoverSupport.js +14 -2
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +2 -0
- package/dist/controllers/rowDragController.js +222 -138
- package/dist/controllers/rowEnterController.cjs +1 -1
- package/dist/controllers/rowEnterController.js +49 -47
- package/dist/controllers/saveStatusController.cjs +1 -1
- package/dist/controllers/saveStatusController.js +101 -48
- package/dist/controllers/serverSideRowModel.cjs +1 -1
- package/dist/controllers/serverSideRowModel.d.ts +1 -0
- package/dist/controllers/serverSideRowModel.js +199 -130
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.js +38 -21
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +2 -1
- package/dist/controllers/viewportSyncController.js +3 -2
- package/dist/engine/columnLayout.cjs +1 -1
- package/dist/engine/columnLayout.d.ts +1 -0
- package/dist/engine/columnLayout.js +12 -11
- package/dist/engine/exportCommands.cjs +1 -1
- package/dist/engine/exportCommands.js +27 -25
- package/dist/engine/filterPopoverCommands.cjs +1 -1
- package/dist/engine/filterPopoverCommands.js +12 -7
- package/dist/engine/gridApi.cjs +1 -1
- package/dist/engine/gridApi.d.ts +4 -1
- package/dist/engine/gridApi.js +175 -129
- package/dist/engine/notifiers.cjs +1 -1
- package/dist/engine/notifiers.d.ts +1 -0
- package/dist/engine/notifiers.js +10 -5
- package/dist/logic/conditionalFormat.cjs +1 -1
- package/dist/logic/conditionalFormat.js +2 -2
- package/dist/logic/detailRow.cjs +1 -1
- package/dist/logic/detailRow.d.ts +1 -0
- package/dist/logic/detailRow.js +9 -4
- package/dist/logic/domGuards.cjs +1 -1
- package/dist/logic/domGuards.d.ts +4 -0
- package/dist/logic/domGuards.js +2 -2
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.d.ts +2 -0
- package/dist/logic/editorValues.js +19 -9
- package/dist/logic/fillSeries.cjs +1 -1
- package/dist/logic/fillSeries.js +43 -36
- package/dist/logic/filterSummary.cjs +1 -1
- package/dist/logic/filterSummary.d.ts +9 -3
- package/dist/logic/filterSummary.js +39 -13
- package/dist/logic/find.cjs +1 -1
- package/dist/logic/find.d.ts +1 -0
- package/dist/logic/find.js +6 -6
- package/dist/logic/gridAsk.cjs +1 -1
- package/dist/logic/gridAsk.js +106 -106
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +14 -0
- package/dist/logic/gridState.js +114 -62
- package/dist/logic/numberFilterCondition.cjs +1 -1
- package/dist/logic/numberFilterCondition.d.ts +1 -1
- package/dist/logic/numberFilterCondition.js +12 -9
- package/dist/logic/selectionAggregates.cjs +1 -1
- package/dist/logic/selectionAggregates.js +5 -2
- package/dist/logic/serverSideEdits.cjs +1 -1
- package/dist/logic/serverSideEdits.d.ts +16 -2
- package/dist/logic/serverSideEdits.js +60 -14
- package/dist/logic/urgentFilters.cjs +1 -0
- package/dist/logic/urgentFilters.d.ts +3 -0
- package/dist/logic/urgentFilters.js +6 -0
- package/dist/logic/validation.cjs +1 -1
- package/dist/logic/validation.d.ts +1 -1
- package/dist/logic/validation.js +10 -10
- package/dist/logic/valueFormatters.d.ts +2 -1
- package/dist/model/gridStore.cjs +1 -1
- package/dist/model/gridStore.d.ts +1 -0
- package/dist/model/gridStore.js +2 -1
- package/dist/model/gridTypes.core.d.ts +92 -16
- package/dist/utils/clipboard.cjs +5 -5
- package/dist/utils/clipboard.d.ts +3 -0
- package/dist/utils/clipboard.js +58 -65
- package/dist/utils/permissions.cjs +1 -1
- package/dist/utils/permissions.js +5 -3
- package/package.json +1 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/rowReorder.cjs"),t=require("../logic/detailRow.cjs"),n=require("../logic/autoScrollGeometry.cjs"),r=require("../logic/slotDom.cjs");var i=14,a=12,o=`0.5`,s=`<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="8 6 12 2 16 6"/><polyline points="16 18 12 22 8 18"/><line x1="12" y1="2" x2="12" y2="22"/></svg>`,c=`<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>`,l=200,u=`cubic-bezier(0.2, 0.7, 0.3, 1)`,d=`transform 160ms ${u}`,f=`data-ssg-row-dragging`,p=e=>e?.closest(`.ssg-motion-off`)!=null,m=/translateY\((-?[\d.]+)px\)/,h=e=>{let n=[];return e.querySelectorAll(`.ssg-body-row[data-row-index]`).forEach(r=>{t.isInsideDetailCardOf(e,r)||n.push(r)}),n},g=()=>{let g=null,_=null,v=null,y={x:0,y:0},b=null,x=!1,S=null,C=null,w=null,T=null,E=null,D=0,O=()=>g?.motion===`live`,k=null,A=null,j=null,M=()=>[g?.leftIndicatorRef.current??null,g?.centerIndicatorRef.current??null,g?.rightIndicatorRef.current??null],N=()=>{for(let e of M())e&&(e.style.display=`none`)},P=e=>{if(k)return;let t=document.createElement(`div`);t.setAttribute(`data-grid-drag-ghost`,``),g?.scrollContainerRef.current?.closest(`.ssg-theme-dark`)!=null&&t.classList.add(`ssg-theme-dark`),g?.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`,`max-width:280px`,`overflow:hidden`,`text-overflow:ellipsis`,`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,g?.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.style.cssText=`overflow:hidden;text-overflow:ellipsis`,i.textContent=e,t.appendChild(n),t.appendChild(i),document.body.appendChild(t),k=t,A=n,j=null},F=e=>{let t=k;if(!t)return;t.style.transform=`translate(`+(y.x+i)+`px,`+(y.y+a)+`px)`;let n=e?`move`:`out`;if(j===n)return;j=n;let r=A;n===`out`?(t.style.opacity=o,r&&(r.innerHTML=c)):(t.style.opacity=`1`,r&&(r.innerHTML=s))},I=()=>{k&&k.parentNode&&k.parentNode.removeChild(k),k=null,A=null,j=null},L=(e,n)=>{let r=g?.scrollContainerRef.current??null;!r||e===null||r.querySelectorAll(`.ssg-body-row[data-row-index="${e}"]`).forEach(e=>{t.isInsideDetailCardOf(r,e)||(n?e.setAttribute(f,O()?`live`:``):e.removeAttribute(f))})},R=()=>{let e=g?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of h(e)){let e=m.exec(n.style.transform);e&&t.set(n,{index:Number(n.getAttribute(`data-row-index`)),baseY:parseFloat(e[1])})}return t},z=t=>{let n=E,r=_;if(!n||r===null||g===null)return;let i=g.scrollContainerRef.current;if(!i)return;for(let e of h(i)){if(n.has(e))continue;let t=m.exec(e.style.transform);t&&n.set(e,{index:Number(e.getAttribute(`data-row-index`)),baseY:parseFloat(t[1])})}let a=g.rowMetrics.rowsHeight(r,r),o=(i.scrollTop-D)*g.verticalScaleFactor,s=(b?y.y-b.y:0)+o,c=t===null?null:e.resolveMoveTargetIndex(r,t);n.forEach(({index:e,baseY:t},i)=>{if(!i.isConnected){n.delete(i);return}if(e===r){i.style.transition=`none`,i.style.transform=`translateY(${t+s}px)`,i.style.willChange=`transform`;return}let o=0;c!==null&&(r<e&&e<=c?o=-a:c<=e&&e<r&&(o=a)),i.style.transition=d,i.style.transform=`translateY(${t+o}px)`})},B=(t,r)=>{if(g===null)return null;let{scrollContainerRef:i,bodyScrollRef:a,rowMetrics:o,headerHeight:s,verticalScaleFactor:c,windowBaseOffsetPx:l}=g,u=i.current,d=a.current;if(!u||!d)return null;let f=u.getBoundingClientRect();if(t<f.left||t>f.right||r<f.top||r>f.bottom)return null;let p=n.clampClientYAboveFooter(r,f.top+u.clientTop+u.clientHeight,g.footerHeight??0),m=d.getBoundingClientRect(),h=e.resolveRowDropSlot(d.scrollTop+p-m.top-s-u.scrollTop*(1-c),o);return{slot:h,top:s+e.resolveRowDropSlotTop(h,o)-l}},V=()=>{let t=B(y.x,y.y),n=_;if(O()){t&&n!==null&&(v=e.resolveMoveTargetIndex(n,t.slot)===null?null:t.slot),N(),z(v);return}if(F(t),!t||n===null||e.resolveMoveTargetIndex(n,t.slot)===null){v=null,N();return}v=t.slot;for(let e of M())e&&(e.style.top=`${t.top}px`,e.style.display=`block`)},H=()=>{if(_===null){w=null;return}let e=g?.scrollContainerRef.current??null;if(e&&(x||(!b||n.hasPointerLeftActivationRadius(b,y,6))&&(x=!0),x)){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(y.y,r.top,r.bottom-(g?.footerHeight??0),24),a=n.computeNextScrollPosition(e.scrollTop,i,18,e.scrollHeight-e.clientHeight);a!==e.scrollTop&&e.scrollTo({top:a,behavior:`auto`})}V(),w=requestAnimationFrame(H)},U=()=>{let e=g?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of h(e))t.set(n,n.getBoundingClientRect().top);return t},W=t=>{w!==null&&(cancelAnimationFrame(w),w=null),document.body.style.cursor=``,N(),I();let n=_,r=v;L(n,!1),_=null,v=null,b=null,C=null;let i=n===null||r===null?null:e.resolveMoveTargetIndex(n,r),a=t&&n!==null&&i!==null&&g!==null,o=E;if(E=null,o)if(a)o.forEach((e,t)=>{t.style.transition=``,t.style.willChange=``});else{let e=[];o.forEach(({baseY:t},n)=>{n.isConnected&&(n.style.transition=d,n.style.transform=`translateY(${t}px)`,e.push(n))}),window.setTimeout(()=>{for(let t of e)t.style.transition=``,t.style.willChange=``},200)}!a||n===null||i===null||g===null||(T=p(g.scrollContainerRef.current)?null:U(),g.commitRowMove(n,i))};return{update:e=>{g=e},onRowDragHandlePointerDown:(e,t)=>{if(g===null||!g.enabled||t.button!==0)return;if(t.stopPropagation(),t.preventDefault(),_!==null){if(t.pointerId!==C)return;S?.(),W(!1)}_=e,C=t.pointerId,v=null,y={x:t.clientX,y:t.clientY},b={x:t.clientX,y:t.clientY},x=!1,document.body.style.cursor=`grabbing`,O()?(E=R(),D=g.scrollContainerRef.current?.scrollTop??0):P(g.getRowDragLabel(e)),L(e,!0);let n=t.currentTarget,r=t.pointerId;try{n.setPointerCapture(r)}catch{}let i=e=>{e.pointerId===r&&(y={x:e.clientX,y:e.clientY},V())},a=()=>{window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,s),window.removeEventListener(`keydown`,c),window.removeEventListener(`blur`,l),S=null;try{n.releasePointerCapture(r)}catch{}};function o(e){e.pointerId===r&&(a(),W(!0))}function s(e){e.pointerId===r&&(a(),W(!1))}function c(e){e.key===`Escape`&&(a(),W(!1))}function l(){a(),W(!1)}window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,s),window.addEventListener(`keydown`,c),window.addEventListener(`blur`,l),S=a,V(),w=requestAnimationFrame(H)},applyReorderSettle:()=>{let e=T;if(T=null,!e)return;let t=g?.scrollContainerRef.current??null;if(!t)return;let n=[],r=new Map;if(e.forEach((e,t)=>{if(!t.isConnected)return;let i=e-t.getBoundingClientRect().top;if(Math.abs(i)<.5)return;let a=m.exec(t.style.transform);if(!a)return;let o=parseFloat(a[1]);r.set(t,o),t.style.transition=`none`,t.style.transform=`translateY(${o+i}px)`,t.style.willChange=`transform`,n.push(t)}),n.length!==0){t.getBoundingClientRect();for(let e of n)e.style.transition=`transform ${l}ms ${u}`,e.style.transform=`translateY(${r.get(e)??0}px)`;window.setTimeout(()=>{for(let e of n)e.style.transition=``,e.style.willChange=``},280)}},dispose:()=>{S?.(),S=null,w!==null&&(cancelAnimationFrame(w),w=null),document.body.style.cursor=``,I(),L(_,!1),_=null,v=null,E=null}}};exports.createRowDragController=g;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/rowReorder.cjs"),t=require("../logic/detailRow.cjs"),n=require("../logic/autoScrollGeometry.cjs"),r=require("../logic/slotDom.cjs");var i=14,a=12,o=`0.5`,s=`<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="8 6 12 2 16 6"/><polyline points="16 18 12 22 8 18"/><line x1="12" y1="2" x2="12" y2="22"/></svg>`,c=`<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>`,l=200,u=`cubic-bezier(0.2, 0.7, 0.3, 1)`,d=`transform 160ms ${u}`,f=`data-ssg-row-dragging`,p=e=>e?.closest(`.ssg-motion-off`)!=null,m=/translateY\((-?[\d.]+)px\)/,h=e=>{let n=[];return e.querySelectorAll(`.ssg-body-row[data-row-index]`).forEach(r=>{t.isInsideDetailCardOf(e,r)||n.push(r)}),n},g=e=>{let n=[],r=new Map;return e.querySelectorAll(`.ssg-detail-band[data-detail-row-index]`).forEach(i=>{if(t.isInsideDetailCardOf(e,i))return;let a=Number(i.getAttribute(`data-detail-row-index`)),o=r.get(a)??0;r.set(a,o+1),n.push({el:i,index:a,key:`band|${o}|${a}`})}),n},_=e=>{e.style.transition=``,e.style.transform=``,e.style.willChange=``,e.style.zIndex=``},v=()=>{let v=null,y=null,b=null,x={x:0,y:0},S=null,C=!1,w=null,T=null,E=null,D=null,O=null,k=null,A=0,j=null,M=()=>v?.motion===`live`,N=null,P=null,F=null,I=()=>[v?.leftIndicatorRef.current??null,v?.centerIndicatorRef.current??null,v?.rightIndicatorRef.current??null],L=()=>{for(let e of I())e&&(e.style.display=`none`)},R=e=>{if(N)return;let t=document.createElement(`div`);t.setAttribute(`data-grid-drag-ghost`,``),v?.scrollContainerRef.current?.closest(`.ssg-theme-dark`)!=null&&t.classList.add(`ssg-theme-dark`),v?.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`,`max-width:280px`,`overflow:hidden`,`text-overflow:ellipsis`,`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,v?.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.style.cssText=`overflow:hidden;text-overflow:ellipsis`,i.textContent=e,t.appendChild(n),t.appendChild(i),document.body.appendChild(t),N=t,P=n,F=null},z=e=>{let t=N;if(!t)return;t.style.transform=`translate(`+(x.x+i)+`px,`+(x.y+a)+`px)`;let n=e?`move`:`out`;if(F===n)return;F=n;let r=P;n===`out`?(t.style.opacity=o,r&&(r.innerHTML=c)):(t.style.opacity=`1`,r&&(r.innerHTML=s))},B=()=>{N&&N.parentNode&&N.parentNode.removeChild(N),N=null,P=null,F=null},V=(e,n)=>{let r=v?.scrollContainerRef.current??null;!r||n&&e===null||r.querySelectorAll(n?`.ssg-body-row[data-row-index="${e}"]`:`.ssg-body-row[${f}]`).forEach(e=>{t.isInsideDetailCardOf(r,e)||(n?e.setAttribute(f,M()?`live`:``):e.removeAttribute(f))})},H=()=>{let e=v?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of h(e)){let e=m.exec(n.style.transform);e&&t.set(n,{index:Number(n.getAttribute(`data-row-index`)),baseY:parseFloat(e[1])})}return t},U=t=>{let n=k,r=y;if(!n||r===null||v===null)return;let i=v.scrollContainerRef.current;if(!i)return;for(let e of h(i)){if(n.has(e))continue;let t=m.exec(e.style.transform);t&&n.set(e,{index:Number(e.getAttribute(`data-row-index`)),baseY:parseFloat(t[1])})}let a=v.rowMetrics.rowsHeight(r,r),o=(i.scrollTop-A)*v.verticalScaleFactor,s=(S?x.y-S.y:0)+o,c=t===null?null:e.resolveMoveTargetIndex(r,t);n.forEach((e,t)=>{let{index:i,baseY:o}=e;if(!t.isConnected){n.delete(t);return}if(i===r){t.style.transition=`none`,t.style.transform=`translateY(${o+s}px)`,t.style.willChange=`transform`,e.applied=t.style.transform;return}let l=0;c!==null&&(r<i&&i<=c?l=-a:c<=i&&i<r&&(l=a)),t.style.transition=d,t.style.transform=`translateY(${o+l}px)`,e.applied=t.style.transform});let l=j??new Set;j=l;for(let{el:e,index:t}of g(i)){if(l.add(e),t===r){e.style.transition=`none`,e.style.transform=`translateY(${s}px)`,e.style.willChange=`transform`,e.style.zIndex=`10`;continue}let n=0;c!==null&&(r<t&&t<=c?n=-a:c<=t&&t<r&&(n=a)),e.style.transition=d,e.style.transform=`translateY(${n}px)`,e.style.zIndex=``}},W=(t,r)=>{if(v===null)return null;let{scrollContainerRef:i,bodyScrollRef:a,rowMetrics:o,headerHeight:s,verticalScaleFactor:c,windowBaseOffsetPx:l}=v,u=i.current,d=a.current;if(!u||!d)return null;let f=u.getBoundingClientRect();if(t<f.left||t>f.right||r<f.top||r>f.bottom)return null;let p=n.clampClientYAboveFooter(r,f.top+u.clientTop+u.clientHeight,v.footerHeight??0),m=d.getBoundingClientRect(),h=d.scrollTop+p-m.top-s-u.scrollTop*(1-c),g=e.resolveRowDropSlot(h,o),_=y,b=_!==null&&M()?o.detailHeight(_):0;if(_!==null&&b>0){let t=e.resolveRowDropSlot(h+b,o);t>_+1&&(g=t)}let x=e.resolveRowDropSlotTop(g,o);return{slot:g,top:s+x-l}},G=()=>{let t=W(x.x,x.y),n=y;if(M()){t&&n!==null&&(b=e.resolveMoveTargetIndex(n,t.slot)===null?null:t.slot),L(),U(b);return}if(z(t),!t||n===null||e.resolveMoveTargetIndex(n,t.slot)===null){b=null,L();return}b=t.slot;for(let e of I())e&&(e.style.top=`${t.top}px`,e.style.display=`block`)},K=()=>{if(y===null){E=null;return}let e=v?.scrollContainerRef.current??null;if(e&&(C||(!S||n.hasPointerLeftActivationRadius(S,x,6))&&(C=!0),C)){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(x.y,r.top,r.bottom-(v?.footerHeight??0),24),a=n.computeNextScrollPosition(e.scrollTop,i,18,e.scrollHeight-e.clientHeight);a!==e.scrollTop&&e.scrollTo({top:a,behavior:`auto`})}G(),E=requestAnimationFrame(K)},q=(e,t)=>`${e.getAttribute(`data-pane`)??``}|${t}`,J=()=>{let e=v?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of h(e))t.set(q(n,Number(n.getAttribute(`data-row-index`))),n.getBoundingClientRect().top);for(let n of g(e))t.set(n.key,n.el.getBoundingClientRect().top);return t},Y=t=>{E!==null&&(cancelAnimationFrame(E),E=null),document.body.style.cursor=``,L(),B();let n=y,r=b,i=O;V(n,!1),y=null,O=null,b=null,S=null,T=null;let a=n===null||r===null?null:e.resolveMoveTargetIndex(n,r),o=t&&n!==null&&a!==null&&v!==null,s=k;k=null;let c=s&&o&&v!==null&&!p(v.scrollContainerRef.current)?J():null,l=j;if(j=null,l&&(o?l.forEach(_):(l.forEach(e=>{e.isConnected&&(e.style.transition=d,e.style.transform=`translateY(0px)`,e.style.zIndex=``)}),window.setTimeout(()=>{l.forEach(e=>{j?.has(e)||_(e)})},200))),s)if(o)s.forEach(({baseY:e},t)=>{t.style.transition=``,t.style.willChange=``,t.isConnected&&(t.style.transform=`translateY(${e}px)`)});else{let e=[];s.forEach(({baseY:t},n)=>{n.isConnected&&(n.style.transition=d,n.style.transform=`translateY(${t}px)`,e.push(n))}),window.setTimeout(()=>{for(let t of e)t.style.transition=``,t.style.willChange=``},200)}if(!o||n===null||a===null||v===null)return;let u=c??(p(v.scrollContainerRef.current)?null:J()),f=u?{tops:u,from:n,to:a,row:i}:null;D=f,v.commitRowMove(n,a),f&&requestAnimationFrame(()=>{D===f&&(D=null)})},X=()=>{let e=D;if(D=null,!e)return;let t=v?.scrollContainerRef.current??null;if(!t)return;let{tops:n,from:r,to:i}=e;if(v?.locateDragRow&&e.row!==null&&v.locateDragRow(e.row,i)!==i)return;let a=e=>e===i?r:r<i&&e>=r&&e<i?e+1:i<r&&e>i&&e<=r?e-1:e,o=[],s=new Map;h(t).forEach(e=>{let t=n.get(q(e,a(Number(e.getAttribute(`data-row-index`)))));if(t===void 0)return;let r=t-e.getBoundingClientRect().top;if(Math.abs(r)<.5)return;let i=m.exec(e.style.transform);if(!i)return;let c=parseFloat(i[1]);s.set(e,c),e.style.transition=`none`,e.style.transform=`translateY(${c+r}px)`,e.style.willChange=`transform`,o.push(e)});let c=[];if(g(t).forEach(({el:e,index:t,key:r})=>{let i=a(t),o=n.get(r.slice(0,r.lastIndexOf(`|`)+1)+i);if(o===void 0)return;let s=o-e.getBoundingClientRect().top;Math.abs(s)<.5||(e.style.transition=`none`,e.style.transform=`translateY(${s}px)`,e.style.willChange=`transform`,c.push(e))}),!(o.length===0&&c.length===0)){t.getBoundingClientRect();for(let e of o)e.style.transition=`transform ${l}ms ${u}`,e.style.transform=`translateY(${s.get(e)??0}px)`;for(let e of c)e.style.transition=`transform ${l}ms ${u}`,e.style.transform=`translateY(0px)`;window.setTimeout(()=>{for(let e of o)e.style.transition=``,e.style.willChange=``;for(let e of c)j?.has(e)||_(e)},280)}},Z=(e,t)=>{if(v===null||!v.enabled||t.button!==0)return;if(t.stopPropagation(),t.preventDefault(),y!==null){if(t.pointerId!==T)return;w?.(),Y(!1)}y=e,O=v.getDragRow?.(e)??null,T=t.pointerId,b=null,x={x:t.clientX,y:t.clientY},S={x:t.clientX,y:t.clientY},C=!1,document.body.style.cursor=`grabbing`,M()?(k=H(),A=v.scrollContainerRef.current?.scrollTop??0):R(v.getRowDragLabel(e)),V(e,!0);let n=t.currentTarget,r=t.pointerId;try{n.setPointerCapture(r)}catch{}let i=e=>{e.pointerId===r&&(x={x:e.clientX,y:e.clientY},G())},a=()=>{window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,s),window.removeEventListener(`keydown`,c),window.removeEventListener(`blur`,l),w=null;try{n.releasePointerCapture(r)}catch{}};function o(e){e.pointerId===r&&(a(),Y(!0))}function s(e){e.pointerId===r&&(a(),Y(!1))}function c(e){e.key===`Escape`&&(a(),Y(!1))}function l(){a(),Y(!1)}window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,s),window.addEventListener(`keydown`,c),window.addEventListener(`blur`,l),w=a,G(),E=requestAnimationFrame(K)},Q=e=>{if(y===null||O==null||v?.locateDragRow===void 0)return;let t=v.locateDragRow(O,y);if(k&&k.forEach((e,t)=>{if(!t.isConnected){k?.delete(t);return}let n=Number(t.getAttribute(`data-row-index`));if(n===e.index&&(e.applied===void 0||t.style.transform===e.applied))return;let r=m.exec(t.style.transform);if(!r){k?.delete(t);return}e.index=n,e.baseY=parseFloat(r[1]),e.applied=void 0}),t===null){w?.(),Y(!1);return}k&&t!==y&&S!==null&&e!==null&&(S={x:S.x,y:S.y+v.rowMetrics.rowTop(t)-e.rowTop(y)}),t!==y&&(V(null,!1),y=t,V(t,!0)),G()};return{update:e=>{let t=v;v=e,y!==null&&t!==null&&t.locateDragRow!==e.locateDragRow&&Q(t.rowMetrics)},onRowDragHandlePointerDown:Z,applyReorderSettle:X,dispose:()=>{w?.(),w=null,E!==null&&(cancelAnimationFrame(E),E=null),document.body.style.cursor=``,B(),V(y,!1),y=null,O=null,b=null,k=null,j?.forEach(_),j=null,D=null}}};exports.createRowDragController=v;
|
|
@@ -19,6 +19,8 @@ export type RowDragArgs = {
|
|
|
19
19
|
commitRowMove: (fromIndex: number, toIndex: number) => void;
|
|
20
20
|
ghostSlot?: GridResolvedSlot;
|
|
21
21
|
motion?: 'ghost' | 'live';
|
|
22
|
+
getDragRow?: (viewIndex: number) => unknown;
|
|
23
|
+
locateDragRow?: (dragRow: unknown, hint: number) => number | null;
|
|
22
24
|
};
|
|
23
25
|
export type RowDragHandlePointerEvent = {
|
|
24
26
|
button: number;
|
|
@@ -8,20 +8,33 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
8
8
|
return e.querySelectorAll(".ssg-body-row[data-row-index]").forEach((n) => {
|
|
9
9
|
r(e, n) || t.push(n);
|
|
10
10
|
}), t;
|
|
11
|
-
}, S = () => {
|
|
12
|
-
let
|
|
11
|
+
}, S = (e) => {
|
|
12
|
+
let t = [], n = /* @__PURE__ */ new Map();
|
|
13
|
+
return e.querySelectorAll(".ssg-detail-band[data-detail-row-index]").forEach((i) => {
|
|
14
|
+
if (r(e, i)) return;
|
|
15
|
+
let a = Number(i.getAttribute("data-detail-row-index")), o = n.get(a) ?? 0;
|
|
16
|
+
n.set(a, o + 1), t.push({
|
|
17
|
+
el: i,
|
|
18
|
+
index: a,
|
|
19
|
+
key: `band|${o}|${a}`
|
|
20
|
+
});
|
|
21
|
+
}), t;
|
|
22
|
+
}, C = (e) => {
|
|
23
|
+
e.style.transition = "", e.style.transform = "", e.style.willChange = "", e.style.zIndex = "";
|
|
24
|
+
}, w = () => {
|
|
25
|
+
let w = null, T = null, E = null, D = {
|
|
13
26
|
x: 0,
|
|
14
27
|
y: 0
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
],
|
|
20
|
-
for (let e of
|
|
21
|
-
},
|
|
22
|
-
if (
|
|
28
|
+
}, O = null, k = !1, A = null, j = null, M = null, N = null, P = null, F = null, I = 0, L = null, R = () => w?.motion === "live", z = null, B = null, V = null, H = () => [
|
|
29
|
+
w?.leftIndicatorRef.current ?? null,
|
|
30
|
+
w?.centerIndicatorRef.current ?? null,
|
|
31
|
+
w?.rightIndicatorRef.current ?? null
|
|
32
|
+
], U = () => {
|
|
33
|
+
for (let e of H()) e && (e.style.display = "none");
|
|
34
|
+
}, W = (e) => {
|
|
35
|
+
if (z) return;
|
|
23
36
|
let t = document.createElement("div");
|
|
24
|
-
t.setAttribute("data-grid-drag-ghost", ""),
|
|
37
|
+
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 = [
|
|
25
38
|
"position:fixed",
|
|
26
39
|
"top:0",
|
|
27
40
|
"left:0",
|
|
@@ -46,29 +59,29 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
46
59
|
"z-index:9999",
|
|
47
60
|
"will-change:transform",
|
|
48
61
|
"transform:translate(-9999px,-9999px)"
|
|
49
|
-
].join(";"), l(t,
|
|
62
|
+
].join(";"), l(t, w?.ghostSlot);
|
|
50
63
|
let n = document.createElement("span");
|
|
51
64
|
n.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
|
|
52
65
|
let r = document.createElement("span");
|
|
53
|
-
r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t),
|
|
54
|
-
},
|
|
55
|
-
let t =
|
|
66
|
+
r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t), z = t, B = n, V = null;
|
|
67
|
+
}, G = (e) => {
|
|
68
|
+
let t = z;
|
|
56
69
|
if (!t) return;
|
|
57
|
-
t.style.transform = "translate(" + (
|
|
70
|
+
t.style.transform = "translate(" + (D.x + u) + "px," + (D.y + d) + "px)";
|
|
58
71
|
let n = e ? "move" : "out";
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
let r =
|
|
72
|
+
if (V === n) return;
|
|
73
|
+
V = n;
|
|
74
|
+
let r = B;
|
|
62
75
|
n === "out" ? (t.style.opacity = f, r && (r.innerHTML = m)) : (t.style.opacity = "1", r && (r.innerHTML = p));
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
let n =
|
|
67
|
-
!n || e === null || n.querySelectorAll(`.ssg-body-row[data-row-index="${e}"]`).forEach((e) => {
|
|
68
|
-
r(n, e) || (t ? e.setAttribute(v,
|
|
76
|
+
}, K = () => {
|
|
77
|
+
z && z.parentNode && z.parentNode.removeChild(z), z = null, B = null, V = null;
|
|
78
|
+
}, q = (e, t) => {
|
|
79
|
+
let n = w?.scrollContainerRef.current ?? null;
|
|
80
|
+
!n || t && e === null || n.querySelectorAll(t ? `.ssg-body-row[data-row-index="${e}"]` : `.ssg-body-row[${v}]`).forEach((e) => {
|
|
81
|
+
r(n, e) || (t ? e.setAttribute(v, R() ? "live" : "") : e.removeAttribute(v));
|
|
69
82
|
});
|
|
70
|
-
},
|
|
71
|
-
let e =
|
|
83
|
+
}, J = () => {
|
|
84
|
+
let e = w?.scrollContainerRef.current ?? null;
|
|
72
85
|
if (!e) return null;
|
|
73
86
|
let t = /* @__PURE__ */ new Map();
|
|
74
87
|
for (let n of x(e)) {
|
|
@@ -79,10 +92,10 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
79
92
|
});
|
|
80
93
|
}
|
|
81
94
|
return t;
|
|
82
|
-
},
|
|
83
|
-
let n =
|
|
84
|
-
if (!n || r === null ||
|
|
85
|
-
let i =
|
|
95
|
+
}, ee = (t) => {
|
|
96
|
+
let n = F, r = T;
|
|
97
|
+
if (!n || r === null || w === null) return;
|
|
98
|
+
let i = w.scrollContainerRef.current;
|
|
86
99
|
if (!i) return;
|
|
87
100
|
for (let e of x(i)) {
|
|
88
101
|
if (n.has(e)) continue;
|
|
@@ -92,49 +105,65 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
92
105
|
baseY: parseFloat(t[1])
|
|
93
106
|
});
|
|
94
107
|
}
|
|
95
|
-
let a =
|
|
96
|
-
n.forEach((
|
|
97
|
-
|
|
98
|
-
|
|
108
|
+
let a = w.rowMetrics.rowsHeight(r, r), o = (i.scrollTop - I) * w.verticalScaleFactor, s = (O ? D.y - O.y : 0) + o, c = t === null ? null : e(r, t);
|
|
109
|
+
n.forEach((e, t) => {
|
|
110
|
+
let { index: i, baseY: o } = e;
|
|
111
|
+
if (!t.isConnected) {
|
|
112
|
+
n.delete(t);
|
|
99
113
|
return;
|
|
100
114
|
}
|
|
101
|
-
if (
|
|
102
|
-
|
|
115
|
+
if (i === r) {
|
|
116
|
+
t.style.transition = "none", t.style.transform = `translateY(${o + s}px)`, t.style.willChange = "transform", e.applied = t.style.transform;
|
|
103
117
|
return;
|
|
104
118
|
}
|
|
105
|
-
let
|
|
106
|
-
c !== null && (r <
|
|
119
|
+
let l = 0;
|
|
120
|
+
c !== null && (r < i && i <= c ? l = -a : c <= i && i < r && (l = a)), t.style.transition = _, t.style.transform = `translateY(${o + l}px)`, e.applied = t.style.transform;
|
|
107
121
|
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
let {
|
|
122
|
+
let l = L ?? /* @__PURE__ */ new Set();
|
|
123
|
+
L = l;
|
|
124
|
+
for (let { el: e, index: t } of S(i)) {
|
|
125
|
+
if (l.add(e), t === r) {
|
|
126
|
+
e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", e.style.zIndex = "10";
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
let n = 0;
|
|
130
|
+
c !== null && (r < t && t <= c ? n = -a : c <= t && t < r && (n = a)), e.style.transition = _, e.style.transform = `translateY(${n}px)`, e.style.zIndex = "";
|
|
131
|
+
}
|
|
132
|
+
}, te = (e, r) => {
|
|
133
|
+
if (w === null) return null;
|
|
134
|
+
let { scrollContainerRef: a, bodyScrollRef: o, rowMetrics: s, headerHeight: c, verticalScaleFactor: l, windowBaseOffsetPx: u } = w, d = a.current, f = o.current;
|
|
111
135
|
if (!d || !f) return null;
|
|
112
136
|
let p = d.getBoundingClientRect();
|
|
113
137
|
if (e < p.left || e > p.right || r < p.top || r > p.bottom) return null;
|
|
114
|
-
let m = i(r, p.top + d.clientTop + d.clientHeight,
|
|
138
|
+
let m = i(r, p.top + d.clientTop + d.clientHeight, w.footerHeight ?? 0), h = f.getBoundingClientRect(), g = f.scrollTop + m - h.top - c - d.scrollTop * (1 - l), _ = t(g, s), v = T, y = v !== null && R() ? s.detailHeight(v) : 0;
|
|
139
|
+
if (v !== null && y > 0) {
|
|
140
|
+
let e = t(g + y, s);
|
|
141
|
+
e > v + 1 && (_ = e);
|
|
142
|
+
}
|
|
143
|
+
let b = n(_, s);
|
|
115
144
|
return {
|
|
116
|
-
slot:
|
|
117
|
-
top: c +
|
|
145
|
+
slot: _,
|
|
146
|
+
top: c + b - u
|
|
118
147
|
};
|
|
119
|
-
},
|
|
120
|
-
let t =
|
|
121
|
-
if (
|
|
122
|
-
t && n !== null && (
|
|
148
|
+
}, Y = () => {
|
|
149
|
+
let t = te(D.x, D.y), n = T;
|
|
150
|
+
if (R()) {
|
|
151
|
+
t && n !== null && (E = e(n, t.slot) === null ? null : t.slot), U(), ee(E);
|
|
123
152
|
return;
|
|
124
153
|
}
|
|
125
|
-
if (
|
|
126
|
-
|
|
154
|
+
if (G(t), !t || n === null || e(n, t.slot) === null) {
|
|
155
|
+
E = null, U();
|
|
127
156
|
return;
|
|
128
157
|
}
|
|
129
|
-
|
|
130
|
-
for (let e of
|
|
131
|
-
},
|
|
132
|
-
if (
|
|
133
|
-
|
|
158
|
+
E = t.slot;
|
|
159
|
+
for (let e of H()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
|
|
160
|
+
}, X = () => {
|
|
161
|
+
if (T === null) {
|
|
162
|
+
M = null;
|
|
134
163
|
return;
|
|
135
164
|
}
|
|
136
|
-
let e =
|
|
137
|
-
if (e && (
|
|
165
|
+
let e = w?.scrollContainerRef.current ?? null;
|
|
166
|
+
if (e && (k || (!O || o(O, D, 6)) && (k = !0), k)) {
|
|
138
167
|
let t = e.getBoundingClientRect(), n = c({
|
|
139
168
|
rectLeft: t.left,
|
|
140
169
|
rectTop: t.top,
|
|
@@ -142,109 +171,164 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
|
|
|
142
171
|
clientTop: e.clientTop,
|
|
143
172
|
clientWidth: e.clientWidth,
|
|
144
173
|
clientHeight: e.clientHeight
|
|
145
|
-
}), r = s(
|
|
174
|
+
}), r = s(D.y, n.top, n.bottom - (w?.footerHeight ?? 0), 24), i = a(e.scrollTop, r, 18, e.scrollHeight - e.clientHeight);
|
|
146
175
|
i !== e.scrollTop && e.scrollTo({
|
|
147
176
|
top: i,
|
|
148
177
|
behavior: "auto"
|
|
149
178
|
});
|
|
150
179
|
}
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
let e =
|
|
180
|
+
Y(), M = requestAnimationFrame(X);
|
|
181
|
+
}, Z = (e, t) => `${e.getAttribute("data-pane") ?? ""}|${t}`, Q = () => {
|
|
182
|
+
let e = w?.scrollContainerRef.current ?? null;
|
|
154
183
|
if (!e) return null;
|
|
155
184
|
let t = /* @__PURE__ */ new Map();
|
|
156
|
-
for (let n of x(e)) t.set(n, n.getBoundingClientRect().top);
|
|
185
|
+
for (let n of x(e)) t.set(Z(n, Number(n.getAttribute("data-row-index"))), n.getBoundingClientRect().top);
|
|
186
|
+
for (let n of S(e)) t.set(n.key, n.el.getBoundingClientRect().top);
|
|
157
187
|
return t;
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
let n =
|
|
161
|
-
|
|
162
|
-
let
|
|
163
|
-
|
|
164
|
-
|
|
188
|
+
}, $ = (t) => {
|
|
189
|
+
M !== null && (cancelAnimationFrame(M), M = null), document.body.style.cursor = "", U(), K();
|
|
190
|
+
let n = T, r = E, i = P;
|
|
191
|
+
q(n, !1), T = null, P = null, E = null, O = null, j = null;
|
|
192
|
+
let a = n === null || r === null ? null : e(n, r), o = t && n !== null && a !== null && w !== null, s = F;
|
|
193
|
+
F = null;
|
|
194
|
+
let c = s && o && w !== null && !y(w.scrollContainerRef.current) ? Q() : null, l = L;
|
|
195
|
+
if (L = null, l && (o ? l.forEach(C) : (l.forEach((e) => {
|
|
196
|
+
e.isConnected && (e.style.transition = _, e.style.transform = "translateY(0px)", e.style.zIndex = "");
|
|
197
|
+
}), window.setTimeout(() => {
|
|
198
|
+
l.forEach((e) => {
|
|
199
|
+
L?.has(e) || C(e);
|
|
200
|
+
});
|
|
201
|
+
}, 200))), s) if (o) s.forEach(({ baseY: e }, t) => {
|
|
202
|
+
t.style.transition = "", t.style.willChange = "", t.isConnected && (t.style.transform = `translateY(${e}px)`);
|
|
165
203
|
});
|
|
166
204
|
else {
|
|
167
205
|
let e = [];
|
|
168
|
-
|
|
206
|
+
s.forEach(({ baseY: t }, n) => {
|
|
169
207
|
n.isConnected && (n.style.transition = _, n.style.transform = `translateY(${t}px)`, e.push(n));
|
|
170
208
|
}), window.setTimeout(() => {
|
|
171
209
|
for (let t of e) t.style.transition = "", t.style.willChange = "";
|
|
172
210
|
}, 200);
|
|
173
211
|
}
|
|
174
|
-
!
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
let
|
|
212
|
+
if (!o || n === null || a === null || w === null) return;
|
|
213
|
+
let u = c ?? (y(w.scrollContainerRef.current) ? null : Q()), d = u ? {
|
|
214
|
+
tops: u,
|
|
215
|
+
from: n,
|
|
216
|
+
to: a,
|
|
217
|
+
row: i
|
|
218
|
+
} : null;
|
|
219
|
+
N = d, w.commitRowMove(n, a), d && requestAnimationFrame(() => {
|
|
220
|
+
N === d && (N = null);
|
|
221
|
+
});
|
|
222
|
+
}, ne = () => {
|
|
223
|
+
let e = N;
|
|
224
|
+
if (N = null, !e) return;
|
|
225
|
+
let t = w?.scrollContainerRef.current ?? null;
|
|
226
|
+
if (!t) return;
|
|
227
|
+
let { tops: n, from: r, to: i } = e;
|
|
228
|
+
if (w?.locateDragRow && e.row !== null && w.locateDragRow(e.row, i) !== i) return;
|
|
229
|
+
let a = (e) => e === i ? r : r < i && e >= r && e < i ? e + 1 : i < r && e > i && e <= r ? e - 1 : e, o = [], s = /* @__PURE__ */ new Map();
|
|
230
|
+
x(t).forEach((e) => {
|
|
231
|
+
let t = n.get(Z(e, a(Number(e.getAttribute("data-row-index")))));
|
|
232
|
+
if (t === void 0) return;
|
|
233
|
+
let r = t - e.getBoundingClientRect().top;
|
|
234
|
+
if (Math.abs(r) < .5) return;
|
|
235
|
+
let i = b.exec(e.style.transform);
|
|
236
|
+
if (!i) return;
|
|
237
|
+
let c = parseFloat(i[1]);
|
|
238
|
+
s.set(e, c), e.style.transition = "none", e.style.transform = `translateY(${c + r}px)`, e.style.willChange = "transform", o.push(e);
|
|
239
|
+
});
|
|
240
|
+
let c = [];
|
|
241
|
+
if (S(t).forEach(({ el: e, index: t, key: r }) => {
|
|
242
|
+
let i = a(t), o = n.get(r.slice(0, r.lastIndexOf("|") + 1) + i);
|
|
243
|
+
if (o === void 0) return;
|
|
244
|
+
let s = o - e.getBoundingClientRect().top;
|
|
245
|
+
Math.abs(s) < .5 || (e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", c.push(e));
|
|
246
|
+
}), !(o.length === 0 && c.length === 0)) {
|
|
247
|
+
t.getBoundingClientRect();
|
|
248
|
+
for (let e of o) e.style.transition = `transform ${h}ms ${g}`, e.style.transform = `translateY(${s.get(e) ?? 0}px)`;
|
|
249
|
+
for (let e of c) e.style.transition = `transform ${h}ms ${g}`, e.style.transform = "translateY(0px)";
|
|
250
|
+
window.setTimeout(() => {
|
|
251
|
+
for (let e of o) e.style.transition = "", e.style.willChange = "";
|
|
252
|
+
for (let e of c) L?.has(e) || C(e);
|
|
253
|
+
}, 280);
|
|
254
|
+
}
|
|
255
|
+
}, re = (e, t) => {
|
|
256
|
+
if (w === null || !w.enabled || t.button !== 0) return;
|
|
257
|
+
if (t.stopPropagation(), t.preventDefault(), T !== null) {
|
|
258
|
+
if (t.pointerId !== j) return;
|
|
259
|
+
A?.(), $(!1);
|
|
260
|
+
}
|
|
261
|
+
T = e, P = w.getDragRow?.(e) ?? null, j = t.pointerId, E = null, D = {
|
|
262
|
+
x: t.clientX,
|
|
263
|
+
y: t.clientY
|
|
264
|
+
}, O = {
|
|
265
|
+
x: t.clientX,
|
|
266
|
+
y: t.clientY
|
|
267
|
+
}, k = !1, document.body.style.cursor = "grabbing", R() ? (F = J(), I = w.scrollContainerRef.current?.scrollTop ?? 0) : W(w.getRowDragLabel(e)), q(e, !0);
|
|
268
|
+
let n = t.currentTarget, r = t.pointerId;
|
|
269
|
+
try {
|
|
270
|
+
n.setPointerCapture(r);
|
|
271
|
+
} catch {}
|
|
272
|
+
let i = (e) => {
|
|
273
|
+
e.pointerId === r && (D = {
|
|
274
|
+
x: e.clientX,
|
|
275
|
+
y: e.clientY
|
|
276
|
+
}, Y());
|
|
277
|
+
}, a = () => {
|
|
278
|
+
window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), window.removeEventListener("keydown", c), window.removeEventListener("blur", l), A = null;
|
|
194
279
|
try {
|
|
195
|
-
n.
|
|
280
|
+
n.releasePointerCapture(r);
|
|
196
281
|
} catch {}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
a(), X(!1);
|
|
282
|
+
};
|
|
283
|
+
function o(e) {
|
|
284
|
+
e.pointerId === r && (a(), $(!0));
|
|
285
|
+
}
|
|
286
|
+
function s(e) {
|
|
287
|
+
e.pointerId === r && (a(), $(!1));
|
|
288
|
+
}
|
|
289
|
+
function c(e) {
|
|
290
|
+
e.key === "Escape" && (a(), $(!1));
|
|
291
|
+
}
|
|
292
|
+
function l() {
|
|
293
|
+
a(), $(!1);
|
|
294
|
+
}
|
|
295
|
+
window.addEventListener("pointermove", i), window.addEventListener("pointerup", o), window.addEventListener("pointercancel", s), window.addEventListener("keydown", c), window.addEventListener("blur", l), A = a, Y(), M = requestAnimationFrame(X);
|
|
296
|
+
}, ie = (e) => {
|
|
297
|
+
if (T === null || P == null || w?.locateDragRow === void 0) return;
|
|
298
|
+
let t = w.locateDragRow(P, T);
|
|
299
|
+
if (F && F.forEach((e, t) => {
|
|
300
|
+
if (!t.isConnected) {
|
|
301
|
+
F?.delete(t);
|
|
302
|
+
return;
|
|
219
303
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if (!t) return;
|
|
227
|
-
let n = [], r = /* @__PURE__ */ new Map();
|
|
228
|
-
if (e.forEach((e, t) => {
|
|
229
|
-
if (!t.isConnected) return;
|
|
230
|
-
let i = e - t.getBoundingClientRect().top;
|
|
231
|
-
if (Math.abs(i) < .5) return;
|
|
232
|
-
let a = b.exec(t.style.transform);
|
|
233
|
-
if (!a) return;
|
|
234
|
-
let o = parseFloat(a[1]);
|
|
235
|
-
r.set(t, o), t.style.transition = "none", t.style.transform = `translateY(${o + i}px)`, t.style.willChange = "transform", n.push(t);
|
|
236
|
-
}), n.length !== 0) {
|
|
237
|
-
t.getBoundingClientRect();
|
|
238
|
-
for (let e of n) e.style.transition = `transform ${h}ms ${g}`, e.style.transform = `translateY(${r.get(e) ?? 0}px)`;
|
|
239
|
-
window.setTimeout(() => {
|
|
240
|
-
for (let e of n) e.style.transition = "", e.style.willChange = "";
|
|
241
|
-
}, 280);
|
|
304
|
+
let n = Number(t.getAttribute("data-row-index"));
|
|
305
|
+
if (n === e.index && (e.applied === void 0 || t.style.transform === e.applied)) return;
|
|
306
|
+
let r = b.exec(t.style.transform);
|
|
307
|
+
if (!r) {
|
|
308
|
+
F?.delete(t);
|
|
309
|
+
return;
|
|
242
310
|
}
|
|
311
|
+
e.index = n, e.baseY = parseFloat(r[1]), e.applied = void 0;
|
|
312
|
+
}), t === null) {
|
|
313
|
+
A?.(), $(!1);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
F && t !== T && O !== null && e !== null && (O = {
|
|
317
|
+
x: O.x,
|
|
318
|
+
y: O.y + w.rowMetrics.rowTop(t) - e.rowTop(T)
|
|
319
|
+
}), t !== T && (q(null, !1), T = t, q(t, !0)), Y();
|
|
320
|
+
};
|
|
321
|
+
return {
|
|
322
|
+
update: (e) => {
|
|
323
|
+
let t = w;
|
|
324
|
+
w = e, T !== null && t !== null && t.locateDragRow !== e.locateDragRow && ie(t.rowMetrics);
|
|
243
325
|
},
|
|
326
|
+
onRowDragHandlePointerDown: re,
|
|
327
|
+
applyReorderSettle: ne,
|
|
244
328
|
dispose: () => {
|
|
245
|
-
|
|
329
|
+
A?.(), A = null, M !== null && (cancelAnimationFrame(M), M = null), document.body.style.cursor = "", K(), q(T, !1), T = null, P = null, E = null, F = null, L?.forEach(C), L = null, N = null;
|
|
246
330
|
}
|
|
247
331
|
};
|
|
248
332
|
};
|
|
249
333
|
//#endregion
|
|
250
|
-
export {
|
|
334
|
+
export { w as createRowDragController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs");var t=`ssg-body-row--enter`,n=`--ssg-row-enter-index`,r=12,i=1500,a=e=>Number(e.getAttribute(`data-row-index`)),o=/(?:^|;)\s*transform\s*:\s*([^;]+)/,s=e=>{if(!e)return null;let t=o.exec(e);return t?t[1].trim():null},c=e=>e instanceof HTMLElement&&e.classList.contains(`ssg-body-row`),l=`ssg-scroll-container--scrolling`,u=()=>{let r=null,o=null,u=!1,d={skeletonEnter:!1,mountEnter:!1},f=new Map,p=e=>{e.classList.remove(t),e.style.removeProperty(n);let r=f.get(e);r!==void 0&&(clearTimeout(r),f.delete(e))},m=(e,r)=>{e.style.setProperty(n,String(r)),e.classList.add(t);let a=()=>{e.removeEventListener(`animationend`,a),p(e)};e.addEventListener(`animationend`,a),f.set(e,setTimeout(()=>{e.removeEventListener(`animationend`,a),p(e)},i))},h=(e,t)=>{let n=[];for(let r of e){if(r.style.transition)continue;let e=s(t.get(r)??null),i=r.style.transform;!e||!i||e===i||n.push({el:r,from:e,to:i})}if(n.length!==0){for(let{el:e,from:t}of n)e.style.transform=t;o?.getBoundingClientRect();for(let{el:e,to:t}of n)e.style.transform=t}},g=t=>c(t)&&(o===null||!e.isInsideDetailCardOf(o,t)),_=t=>{let n=new Set,r=new Map,i=new Set,s=[];for(let l of t){if(l.type===`attributes`){let e=l.target;g(e)&&!r.has(e)&&r.set(e,l.oldValue);continue}let t=o!==null&&l.target instanceof Element&&e.isInsideDetailCardOf(o,l.target);l.removedNodes.forEach(e=>{t||!c(e)||(e.hasAttribute(`data-skeleton-row`)?n.add(a(e)):i.add(e))}),l.addedNodes.forEach(e=>{g(e)&&!e.hasAttribute(`data-skeleton-row`)&&s.push(e)})}if(s.length===0)return;let u=o?.classList.contains(l)===!0;d.mountEnter&&!u&&h(s.filter(e=>i.has(e)),r);let f=s.filter(e=>d.mountEnter&&!u&&!i.has(e)||d.skeletonEnter&&n.has(a(e)));if(f.length===0)return;let p=Array.from(new Set(f.map(a))).sort((e,t)=>e-t),_=new Map;p.forEach((e,t)=>{_.set(e,Math.min(t,12))});for(let e of f)m(e,_.get(a(e))??0)},v=()=>{r?.disconnect(),r=null,o=null,u=!1;for(let e of Array.from(f.keys()))p(e)};return{update:({scrollContainerRef:e,skeletonEnter:t,mountEnter:n})=>{d={skeletonEnter:t,mountEnter:n};let i=t||n?e.current:null;i===o&&n===u||(v(),!(!i||typeof MutationObserver>`u`)&&(r=new MutationObserver(_),r.observe(i,n?{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`],attributeOldValue:!0}:{childList:!0,subtree:!0}),o=i,u=n))},dispose:v}};exports.ROW_ENTER_CLASS_NAME=t,exports.ROW_ENTER_FALLBACK_MS=i,exports.ROW_ENTER_INDEX_VAR=n,exports.ROW_ENTER_STAGGER_CAP=r,exports.createRowEnterController=u,exports.transformOfStyleText=s;
|