@toolbox-web/grid 2.11.1 → 2.13.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/all.js +2 -2
- package/all.js.map +1 -1
- package/custom-elements.json +20 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +24 -2
- package/lib/core/internal/empty.d.ts +73 -0
- package/lib/core/internal/focus-manager.d.ts +17 -0
- package/lib/core/internal/shell.d.ts +1 -1
- package/lib/core/internal/virtualization.d.ts +103 -1
- package/lib/core/styles/index.d.ts +3 -2
- package/lib/core/types.d.ts +103 -7
- package/lib/features/pinned-columns.js.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +1 -1
- package/lib/plugins/editing/index.js +1 -1
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +9 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder-columns/index.js +1 -1
- package/lib/plugins/reorder-columns/index.js.map +1 -1
- package/lib/plugins/reorder-rows/index.js +1 -1
- package/lib/plugins/reorder-rows/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-drag-drop/RowDragDropPlugin.d.ts +1 -1
- package/lib/plugins/row-drag-drop/index.js +1 -1
- package/lib/plugins/row-drag-drop/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +1 -1
- package/lib/plugins/selection/index.d.ts +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/ServerSidePlugin.d.ts +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/sticky-rows/index.js.map +1 -1
- package/lib/plugins/tooltip/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +10 -1
- package/umd/grid.all.umd.js +1 -1
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +1 -1
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/pinned-columns.umd.js +1 -1
- package/umd/plugins/pinned-columns.umd.js.map +1 -1
- package/umd/plugins/reorder-rows.umd.js.map +1 -1
- package/umd/plugins/row-drag-drop.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js.map +1 -1
- package/umd/plugins/server-side.umd.js.map +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("../../core/constants"),require("../../core/internal/utils"),require("../../core/plugin/base-plugin")):"function"==typeof define&&define.amd?define(["exports","../../core/constants","../../core/internal/utils","../../core/plugin/base-plugin"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TbwGridPlugin_pinnedColumns={},e.TbwGrid,e.TbwGrid,e.TbwGrid)}(this,function(e,t,s,i){"use strict";function n(e){return e.pinned??e.meta?.pinned}function l(e,t){return s.resolveInlinePosition(e,t)}function r(e,t){const s=n(e);return!!s&&"left"===l(s,t)}function o(e,t){const s=n(e);return!!s&&"right"===l(s,t)}function d(e){for(let t=0;t<e.length;t++)if(null!=e[t].pinned||null!=e[t].meta?.pinned)return!0;return!1}function a(e,i){const n={groupEndAdjustments:{addGroupEnd:new Set,removeGroupEnd:new Set},leftOffsets:new Map,rightOffsets:new Map,splitGroups:[]},l=Array.from(e.querySelectorAll(".header-row .cell"));if(!l.length)return n;const d=s.getDirection(e),a=new Map,f=new Map;let p=0;for(const s of i)if(r(s,d)){const i=l.find(e=>e.getAttribute("data-field")===s.field);i&&(a.set(s.field,p),i.classList.add(t.GridClasses.STICKY_LEFT),i.style.position="sticky",i.style.left=p+"px",e.querySelectorAll(`.data-grid-row .cell[data-field="${s.field}"]`).forEach(e=>{e.classList.add(t.GridClasses.STICKY_LEFT),e.style.position="sticky",e.style.left=p+"px"}),p+=i.offsetWidth)}let g=0;for(const s of[...i].reverse())if(o(s,d)){const i=l.find(e=>e.getAttribute("data-field")===s.field);i&&(f.set(s.field,g),i.classList.add(t.GridClasses.STICKY_RIGHT),i.style.position="sticky",i.style.right=g+"px",e.querySelectorAll(`.data-grid-row .cell[data-field="${s.field}"]`).forEach(e=>{e.classList.add(t.GridClasses.STICKY_RIGHT),e.style.position="sticky",e.style.right=g+"px"}),g+=i.offsetWidth)}const h=[],m=function(e,s,i,n,l){const d={addGroupEnd:new Set,removeGroupEnd:new Set},a=Array.from(e.querySelectorAll(".header-group-row .header-group-cell"));if(!a.length)return d;for(const f of a){const e=f.style.gridColumn;if(!e)continue;const a=e.match(/^(\d+)\s*\/\s*span\s+(\d+)$/);if(!a)continue;const p=parseInt(a[1],10)-1,g=p+parseInt(a[2],10)-1,h=s.slice(p,g+1);if(!h.length)continue;const m=h.every(e=>r(e,n)),y=h.every(e=>o(e,n));if(m){const e=h[0].field,s=i.find(t=>t.getAttribute("data-field")===e);s&&(f.classList.add(t.GridClasses.STICKY_LEFT),f.style.position="sticky",f.style.left=s.style.left)}else if(y){const e=h[h.length-1].field,s=i.find(t=>t.getAttribute("data-field")===e);s&&(f.classList.add(t.GridClasses.STICKY_RIGHT),f.style.position="sticky",f.style.right=s.style.right)}else if(f.classList.contains("implicit-group"))c(f,h,p,i,n,d);else{const e=h.some(e=>r(e,n)),t=h.some(e=>o(e,n));(e||t)&&u(f,h,p,i,n,d,l)}}return d}(e,i,l,d,h);if(m.addGroupEnd.size>0||m.removeGroupEnd.size>0){for(const t of m.addGroupEnd){const s=l.find(e=>e.getAttribute("data-field")===t);s&&s.classList.add("group-end"),e.querySelectorAll(`.data-grid-row .cell[data-field="${t}"]`).forEach(e=>{e.classList.add("group-end")})}for(const t of m.removeGroupEnd){const s=l.find(e=>e.getAttribute("data-field")===t);s&&s.classList.remove("group-end"),e.querySelectorAll(`.data-grid-row .cell[data-field="${t}"]`).forEach(e=>{e.classList.remove("group-end")})}}return{groupEndAdjustments:m,leftOffsets:a,rightOffsets:f,splitGroups:h}}function f(e,t){return r(e,t)?"left":o(e,t)?"right":"none"}function c(e,s,i,n,l,r){const o=[];for(let t=0;t<s.length;t++){const e=f(s[t],l),n=o[o.length-1];n&&n.state===e?n.cols.push(s[t]):o.push({state:e,cols:[s[t]],colStart:i+t})}if(o.length<=1)return;const d=e.parentElement;if(!d)return;const a=e.nextSibling;d.removeChild(e);for(const f of o){const s=document.createElement("div");if(s.className=e.className,s.setAttribute("data-group",e.getAttribute("data-group")||""),s.style.gridColumn=`${f.colStart+1} / span ${f.cols.length}`,"left"===f.state){const e=f.cols[0].field,i=n.find(t=>t.getAttribute("data-field")===e);i&&(s.classList.add(t.GridClasses.STICKY_LEFT),s.style.position="sticky",s.style.left=i.style.left)}else if("right"===f.state){const e=f.cols[f.cols.length-1].field,i=n.find(t=>t.getAttribute("data-field")===e);i&&(s.classList.add(t.GridClasses.STICKY_RIGHT),s.style.position="sticky",s.style.right=i.style.right)}else if("none"===f.state){f.cols.every(e=>String(e.field||"").startsWith("__tbw_"))&&(s.style.borderRightStyle="none")}a?d.insertBefore(s,a):d.appendChild(s)}for(let t=0;t<o.length;t++){const e=o[t],s=o[t+1];if("none"!==e.state&&s&&"none"===s.state){const t=e.cols[e.cols.length-1].field;t&&r.addGroupEnd.add(t)}if("none"===e.state){if(e.cols.every(e=>String(e.field||"").startsWith("__tbw_"))){const t=e.cols[e.cols.length-1].field;t&&r.removeGroupEnd.add(t)}}}}function u(e,s,i,n,l,r,o){const d=[];for(let t=0;t<s.length;t++){const e=f(s[t],l),n=d[d.length-1];n&&n.state===e?n.cols.push(s[t]):d.push({state:e,cols:[s[t]],colStart:i+t})}if(d.length<=1)return;const a=e.parentElement;if(!a)return;const c=e.textContent||"",u=e.getAttribute("data-group")||"",p=e.nextSibling;a.removeChild(e);const g=d.findIndex(e=>"left"===e.state);let h=-1;for(let t=d.length-1;t>=0;t--)if("right"===d[t].state){h=t;break}const m=g>=0?g:h,y=g>=0&&g+1<d.length?g+1:h>=0&&h-1>=0?h-1:-1;let C,S,G,E="";for(let f=0;f<d.length;f++){const s=d[f],i=document.createElement("div");if(i.className=e.className,i.setAttribute("data-group",u),i.style.gridColumn=`${s.colStart+1} / span ${s.cols.length}`,"left"===s.state){const e=s.cols[0].field,l=n.find(t=>t.getAttribute("data-field")===e);l&&(i.classList.add(t.GridClasses.STICKY_LEFT),i.style.position="sticky",i.style.left=l.style.left,l.style.left),f===m&&(i.style.borderRightStyle="none",C=i,E=s.cols[s.cols.length-1].field)}else if("right"===s.state){const e=s.cols[s.cols.length-1].field,l=n.find(t=>t.getAttribute("data-field")===e);l&&(i.classList.add(t.GridClasses.STICKY_RIGHT),i.style.position="sticky",i.style.right=l.style.right),f===m&&(i.style.borderLeftStyle="none",C=i,E=s.cols[0].field)}if(f===y){i.style.overflow="visible";const e=document.createElement("span");e.textContent=c,e.style.position="relative",e.style.zIndex="36",e.style.display="block",e.style.overflow="hidden",e.style.textOverflow="ellipsis",e.style.whiteSpace="nowrap",i.appendChild(e),S=i,G=e}p?a.insertBefore(i,p):a.appendChild(i)}C&&S&&G&&E&&o.push({groupId:u,label:c,pinnedFragment:C,scrollableFragment:S,floatLabel:G,pinnedField:E,isTransferred:!1,floatOffset:0})}function p(e){e.querySelectorAll(`.${t.GridClasses.STICKY_LEFT}, .${t.GridClasses.STICKY_RIGHT}`).forEach(e=>{e.classList.remove(t.GridClasses.STICKY_LEFT,t.GridClasses.STICKY_RIGHT),e.style.position="",e.style.left="",e.style.right=""})}const g="canMoveColumn";class h extends i.BaseGridPlugin{static manifest={hookPriority:{processColumns:-10},ownedProperties:[{property:"pinned",level:"column",description:'the "pinned" column property',isUsed:e=>"left"===e||"right"===e||"start"===e||"end"===e}],queries:[{type:g,description:"Prevents pinned columns from being moved/reordered"},{type:"getStickyOffsets",description:"Returns the offsets for left/right pinned columns"},{type:"getContextMenuItems",description:"Contributes pin/unpin items to the header context menu"}]};name="pinnedColumns";get defaultConfig(){return{}}isApplied=!1;leftOffsets=new Map;rightOffsets=new Map;#e={addGroupEnd:new Set,removeGroupEnd:new Set};#t=[];#s=[];detach(){this.leftOffsets.clear(),this.rightOffsets.clear(),this.isApplied=!1,this.#e={addGroupEnd:new Set,removeGroupEnd:new Set},this.#t=[],this.#s=[]}static detect(e,t){const s=t?.columns;return!!Array.isArray(s)&&d(s)}processColumns(e){const t=[...e];if(this.isApplied=d(t),!this.isApplied)return t;const i=this.gridElement;return function(e,t="ltr"){const s=[],i=[],r=[];for(const o of e){const e=n(o);e?"left"===l(e,t)?s.push(o):r.push(o):i.push(o)}return[...s,...i,...r]}(t,i?s.getDirection(i):"ltr")}afterRender(){if(!this.isApplied)return;const e=this.gridElement,t=[...this.columns];if(!d(t))return p(e),void(this.isApplied=!1);queueMicrotask(()=>{const s=a(e,t);this.#e=s.groupEndAdjustments,this.leftOffsets=s.leftOffsets,this.rightOffsets=s.rightOffsets,this.#t=s.splitGroups,this.#i()})}afterCellRender(e){if(!this.isApplied)return;const s=e.column.field,i=e.cellElement,n=this.leftOffsets.get(s);if(void 0!==n)i.classList.contains(t.GridClasses.STICKY_LEFT)||i.classList.add(t.GridClasses.STICKY_LEFT),i.style.position="sticky",i.style.left=n+"px";else{const e=this.rightOffsets.get(s);void 0!==e&&(i.classList.contains(t.GridClasses.STICKY_RIGHT)||i.classList.add(t.GridClasses.STICKY_RIGHT),i.style.position="sticky",i.style.right=e+"px")}this.#e.addGroupEnd.has(s)?e.cellElement.classList.add("group-end"):this.#e.removeGroupEnd.has(s)&&e.cellElement.classList.remove("group-end")}onScroll(e){this.#i()}#i(){if(!this.isApplied||0===this.#t.length)return;const e=this.gridElement;for(const t of this.#t){const s=t.pinnedFragment.getBoundingClientRect(),i=t.scrollableFragment.getBoundingClientRect().right<=s.right;if(i&&!t.isTransferred?(t.pinnedFragment.textContent=t.label,t.pinnedFragment.style.overflow="hidden",t.pinnedFragment.style.textOverflow="ellipsis",t.pinnedFragment.style.whiteSpace="nowrap",t.pinnedFragment.style.borderRightStyle="",t.floatLabel.style.visibility="hidden",t.floatLabel.style.transform="",t.floatOffset=0,this.#e.addGroupEnd.add(t.pinnedField),e.querySelectorAll(`.header-row .cell[data-field="${t.pinnedField}"], .data-grid-row .cell[data-field="${t.pinnedField}"]`).forEach(e=>e.classList.add("group-end")),t.isTransferred=!0):!i&&t.isTransferred&&(t.pinnedFragment.textContent="",t.pinnedFragment.style.overflow="",t.pinnedFragment.style.textOverflow="",t.pinnedFragment.style.whiteSpace="",t.pinnedFragment.style.borderRightStyle="none",t.floatLabel.style.visibility="",t.floatLabel.style.transform="",t.floatOffset=0,this.#e.addGroupEnd.delete(t.pinnedField),e.querySelectorAll(`.header-row .cell[data-field="${t.pinnedField}"], .data-grid-row .cell[data-field="${t.pinnedField}"]`).forEach(e=>e.classList.remove("group-end")),t.isTransferred=!1),!t.isTransferred){const e=t.floatLabel.getBoundingClientRect().left-t.floatOffset,i=s.left;e<i?(t.floatOffset=i-e,t.floatLabel.style.transform=`translateX(${t.floatOffset}px)`):(t.floatOffset=0,t.floatLabel.style.transform="")}}}handleQuery(e){switch(e.type){case g:return null==n(e.context)&&void 0;case"getStickyOffsets":return{left:Object.fromEntries(this.leftOffsets),right:Object.fromEntries(this.rightOffsets)};case"getContextMenuItems":{const t=e.context;if(!t.isHeader)return;const s=t.column;if(!s?.field)return;if(s.lockPinning||s.meta?.lockPinning)return;const i=[];return null!=n(s)?i.push({id:"pinned/unpin",label:"Unpin Column",icon:"📌",order:40,action:()=>this.setPinPosition(s.field,void 0)}):(i.push({id:"pinned/pin-left",label:"Pin Left",icon:"⬅",order:40,action:()=>this.setPinPosition(s.field,"left")}),i.push({id:"pinned/pin-right",label:"Pin Right",icon:"➡",order:41,action:()=>this.setPinPosition(s.field,"right")})),i}default:return}}setPinPosition(e,t){const s=this.columns;if(!s?.length)return;const i=s.findIndex(t=>t.field===e);if(-1===i)return;const l=this.gridElement;if(t){0===this.#s.length&&(this.#s=s.map(e=>e.field));const i=s.map(s=>{if(s.field!==e)return s;const i={...s};return i.pinned=t,i});l.columns=i}else{const t={...s[i]};delete t.pinned;const r=[...s];r.splice(i,1);const o=this.#s.indexOf(e);if(o>=0){let e=r.length;for(let t=0;t<r.length;t++){if(n(r[t]))continue;if(this.#s.indexOf(r[t].field)>o){e=t;break}}r.splice(e,0,t)}else r.splice(Math.min(i,r.length),0,t);r.some(e=>null!=n(e))||(this.#s=[]),l.columns=r}}refreshStickyOffsets(){const e=[...this.columns],t=a(this.gridElement,e);this.#e=t.groupEndAdjustments,this.leftOffsets=t.leftOffsets,this.rightOffsets=t.rightOffsets,this.#t=t.splitGroups}getLeftPinnedColumns(){return function(e,t="ltr"){return e.filter(e=>r(e,t))}([...this.columns],s.getDirection(this.gridElement))}getRightPinnedColumns(){return function(e,t="ltr"){return e.filter(e=>o(e,t))}([...this.columns],s.getDirection(this.gridElement))}clearStickyPositions(){p(this.gridElement)}getHorizontalScrollOffsets(e,s){if(!this.isApplied)return;let i=0,n=0;if(e){const s=e.querySelectorAll(`.${t.GridClasses.STICKY_LEFT}`),l=e.querySelectorAll(`.${t.GridClasses.STICKY_RIGHT}`);s.forEach(e=>{i+=e.offsetWidth}),l.forEach(e=>{n+=e.offsetWidth})}else{this.gridElement.querySelectorAll(".header-row .cell").forEach(e=>{e.classList.contains(t.GridClasses.STICKY_LEFT)?i+=e.offsetWidth:e.classList.contains(t.GridClasses.STICKY_RIGHT)&&(n+=e.offsetWidth)})}const l=s?.classList.contains(t.GridClasses.STICKY_LEFT)||s?.classList.contains(t.GridClasses.STICKY_RIGHT);return{left:i,right:n,skipScroll:l}}}e.PinnedColumnsPlugin=h,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("../../core/constants"),require("../../core/internal/utils"),require("../../core/plugin/base-plugin")):"function"==typeof define&&define.amd?define(["exports","../../core/constants","../../core/internal/utils","../../core/plugin/base-plugin"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TbwGridPlugin_pinnedColumns={},e.TbwGrid,e.TbwGrid,e.TbwGrid)}(this,function(e,t,s,i){"use strict";function n(e){return e.pinned??e.meta?.pinned}function l(e,t){return s.resolveInlinePosition(e,t)}function r(e,t){const s=n(e);return!!s&&"left"===l(s,t)}function o(e,t){const s=n(e);return!!s&&"right"===l(s,t)}function d(e){for(let t=0;t<e.length;t++)if(null!=e[t].pinned||null!=e[t].meta?.pinned)return!0;return!1}function a(e,i){const n={groupEndAdjustments:{addGroupEnd:new Set,removeGroupEnd:new Set},leftOffsets:new Map,rightOffsets:new Map,splitGroups:[]},l=Array.from(e.querySelectorAll(".header-row .cell"));if(!l.length)return n;const d=s.getDirection(e),a=new Map,f=new Map;let p=0;for(const s of i)if(r(s,d)){const i=l.find(e=>e.getAttribute("data-field")===s.field);i&&(a.set(s.field,p),i.classList.add(t.GridClasses.STICKY_LEFT),i.style.position="sticky",i.style.left=p+"px",e.querySelectorAll(`.data-grid-row .cell[data-field="${s.field}"]`).forEach(e=>{e.classList.add(t.GridClasses.STICKY_LEFT),e.style.position="sticky",e.style.left=p+"px"}),p+=i.offsetWidth)}let g=0;for(const s of[...i].reverse())if(o(s,d)){const i=l.find(e=>e.getAttribute("data-field")===s.field);i&&(f.set(s.field,g),i.classList.add(t.GridClasses.STICKY_RIGHT),i.style.position="sticky",i.style.right=g+"px",e.querySelectorAll(`.data-grid-row .cell[data-field="${s.field}"]`).forEach(e=>{e.classList.add(t.GridClasses.STICKY_RIGHT),e.style.position="sticky",e.style.right=g+"px"}),g+=i.offsetWidth)}const h=[],m=function(e,s,i,n,l){const d={addGroupEnd:new Set,removeGroupEnd:new Set},a=Array.from(e.querySelectorAll(".header-group-row .header-group-cell"));if(!a.length)return d;for(const f of a){const e=f.style.gridColumn;if(!e)continue;const a=e.match(/^(\d+)\s*\/\s*span\s+(\d+)$/);if(!a)continue;const p=parseInt(a[1],10)-1,g=p+parseInt(a[2],10)-1,h=s.slice(p,g+1);if(!h.length)continue;const m=h.every(e=>r(e,n)),y=h.every(e=>o(e,n));if(m){const e=h[0].field,s=i.find(t=>t.getAttribute("data-field")===e);s&&(f.classList.add(t.GridClasses.STICKY_LEFT),f.style.position="sticky",f.style.left=s.style.left)}else if(y){const e=h[h.length-1].field,s=i.find(t=>t.getAttribute("data-field")===e);s&&(f.classList.add(t.GridClasses.STICKY_RIGHT),f.style.position="sticky",f.style.right=s.style.right)}else if(f.classList.contains("implicit-group"))c(f,h,p,i,n,d);else{const e=h.some(e=>r(e,n)),t=h.some(e=>o(e,n));(e||t)&&u(f,h,p,i,n,d,l)}}return d}(e,i,l,d,h);if(m.addGroupEnd.size>0||m.removeGroupEnd.size>0){for(const t of m.addGroupEnd){const s=l.find(e=>e.getAttribute("data-field")===t);s&&s.classList.add("group-end"),e.querySelectorAll(`.data-grid-row .cell[data-field="${t}"]`).forEach(e=>{e.classList.add("group-end")})}for(const t of m.removeGroupEnd){const s=l.find(e=>e.getAttribute("data-field")===t);s&&s.classList.remove("group-end"),e.querySelectorAll(`.data-grid-row .cell[data-field="${t}"]`).forEach(e=>{e.classList.remove("group-end")})}}return{groupEndAdjustments:m,leftOffsets:a,rightOffsets:f,splitGroups:h}}function f(e,t){return r(e,t)?"left":o(e,t)?"right":"none"}function c(e,s,i,n,l,r){const o=[];for(let t=0;t<s.length;t++){const e=f(s[t],l),n=o[o.length-1];n&&n.state===e?n.cols.push(s[t]):o.push({state:e,cols:[s[t]],colStart:i+t})}if(o.length<=1)return;const d=e.parentElement;if(!d)return;const a=e.nextSibling;d.removeChild(e);for(const f of o){const s=document.createElement("div");if(s.className=e.className,s.setAttribute("data-group",e.getAttribute("data-group")||""),s.style.gridColumn=`${f.colStart+1} / span ${f.cols.length}`,"left"===f.state){const e=f.cols[0].field,i=n.find(t=>t.getAttribute("data-field")===e);i&&(s.classList.add(t.GridClasses.STICKY_LEFT),s.style.position="sticky",s.style.left=i.style.left)}else if("right"===f.state){const e=f.cols[f.cols.length-1].field,i=n.find(t=>t.getAttribute("data-field")===e);i&&(s.classList.add(t.GridClasses.STICKY_RIGHT),s.style.position="sticky",s.style.right=i.style.right)}else if("none"===f.state){f.cols.every(e=>String(e.field||"").startsWith("__tbw_"))&&(s.style.borderRightStyle="none")}a?d.insertBefore(s,a):d.appendChild(s)}for(let t=0;t<o.length;t++){const e=o[t],s=o[t+1];if("none"!==e.state&&s&&"none"===s.state){const t=e.cols[e.cols.length-1].field;t&&r.addGroupEnd.add(t)}if("none"===e.state){if(e.cols.every(e=>String(e.field||"").startsWith("__tbw_"))){const t=e.cols[e.cols.length-1].field;t&&r.removeGroupEnd.add(t)}}}}function u(e,s,i,n,l,r,o){const d=[];for(let t=0;t<s.length;t++){const e=f(s[t],l),n=d[d.length-1];n&&n.state===e?n.cols.push(s[t]):d.push({state:e,cols:[s[t]],colStart:i+t})}if(d.length<=1)return;const a=e.parentElement;if(!a)return;const c=e.textContent||"",u=e.getAttribute("data-group")||"",p=e.nextSibling;a.removeChild(e);const g=d.findIndex(e=>"left"===e.state);let h=-1;for(let t=d.length-1;t>=0;t--)if("right"===d[t].state){h=t;break}const m=g>=0?g:h,y=g>=0&&g+1<d.length?g+1:h>=0&&h-1>=0?h-1:-1;let C,S,G,E="";for(let f=0;f<d.length;f++){const s=d[f],i=document.createElement("div");if(i.className=e.className,i.setAttribute("data-group",u),i.style.gridColumn=`${s.colStart+1} / span ${s.cols.length}`,"left"===s.state){const e=s.cols[0].field,l=n.find(t=>t.getAttribute("data-field")===e);l&&(i.classList.add(t.GridClasses.STICKY_LEFT),i.style.position="sticky",i.style.left=l.style.left),f===m&&(i.style.borderRightStyle="none",C=i,E=s.cols[s.cols.length-1].field)}else if("right"===s.state){const e=s.cols[s.cols.length-1].field,l=n.find(t=>t.getAttribute("data-field")===e);l&&(i.classList.add(t.GridClasses.STICKY_RIGHT),i.style.position="sticky",i.style.right=l.style.right),f===m&&(i.style.borderLeftStyle="none",C=i,E=s.cols[0].field)}if(f===y){i.style.overflow="visible";const e=document.createElement("span");e.textContent=c,e.style.position="relative",e.style.zIndex="36",e.style.display="block",e.style.overflow="hidden",e.style.textOverflow="ellipsis",e.style.whiteSpace="nowrap",i.appendChild(e),S=i,G=e}p?a.insertBefore(i,p):a.appendChild(i)}C&&S&&G&&E&&o.push({groupId:u,label:c,pinnedFragment:C,scrollableFragment:S,floatLabel:G,pinnedField:E,isTransferred:!1,floatOffset:0})}function p(e){e.querySelectorAll(`.${t.GridClasses.STICKY_LEFT}, .${t.GridClasses.STICKY_RIGHT}`).forEach(e=>{e.classList.remove(t.GridClasses.STICKY_LEFT,t.GridClasses.STICKY_RIGHT),e.style.position="",e.style.left="",e.style.right=""})}const g="canMoveColumn";class h extends i.BaseGridPlugin{static manifest={hookPriority:{processColumns:-10},ownedProperties:[{property:"pinned",level:"column",description:'the "pinned" column property',isUsed:e=>"left"===e||"right"===e||"start"===e||"end"===e}],queries:[{type:g,description:"Prevents pinned columns from being moved/reordered"},{type:"getStickyOffsets",description:"Returns the offsets for left/right pinned columns"},{type:"getContextMenuItems",description:"Contributes pin/unpin items to the header context menu"}]};name="pinnedColumns";get defaultConfig(){return{}}isApplied=!1;leftOffsets=new Map;rightOffsets=new Map;#e={addGroupEnd:new Set,removeGroupEnd:new Set};#t=[];#s=[];detach(){this.leftOffsets.clear(),this.rightOffsets.clear(),this.isApplied=!1,this.#e={addGroupEnd:new Set,removeGroupEnd:new Set},this.#t=[],this.#s=[]}static detect(e,t){const s=t?.columns;return!!Array.isArray(s)&&d(s)}processColumns(e){const t=[...e];if(this.isApplied=d(t),!this.isApplied)return t;const i=this.gridElement;return function(e,t="ltr"){const s=[],i=[],r=[];for(const o of e){const e=n(o);e?"left"===l(e,t)?s.push(o):r.push(o):i.push(o)}return[...s,...i,...r]}(t,i?s.getDirection(i):"ltr")}afterRender(){if(!this.isApplied)return;const e=this.gridElement,t=[...this.columns];if(!d(t))return p(e),void(this.isApplied=!1);queueMicrotask(()=>{const s=a(e,t);this.#e=s.groupEndAdjustments,this.leftOffsets=s.leftOffsets,this.rightOffsets=s.rightOffsets,this.#t=s.splitGroups,this.#i()})}afterCellRender(e){if(!this.isApplied)return;const s=e.column.field,i=e.cellElement,n=this.leftOffsets.get(s);if(void 0!==n)i.classList.contains(t.GridClasses.STICKY_LEFT)||i.classList.add(t.GridClasses.STICKY_LEFT),i.style.position="sticky",i.style.left=n+"px";else{const e=this.rightOffsets.get(s);void 0!==e&&(i.classList.contains(t.GridClasses.STICKY_RIGHT)||i.classList.add(t.GridClasses.STICKY_RIGHT),i.style.position="sticky",i.style.right=e+"px")}this.#e.addGroupEnd.has(s)?e.cellElement.classList.add("group-end"):this.#e.removeGroupEnd.has(s)&&e.cellElement.classList.remove("group-end")}onScroll(e){this.#i()}#i(){if(!this.isApplied||0===this.#t.length)return;const e=this.gridElement;for(const t of this.#t){const s=t.pinnedFragment.getBoundingClientRect(),i=t.scrollableFragment.getBoundingClientRect().right<=s.right;if(i&&!t.isTransferred?(t.pinnedFragment.textContent=t.label,t.pinnedFragment.style.overflow="hidden",t.pinnedFragment.style.textOverflow="ellipsis",t.pinnedFragment.style.whiteSpace="nowrap",t.pinnedFragment.style.borderRightStyle="",t.floatLabel.style.visibility="hidden",t.floatLabel.style.transform="",t.floatOffset=0,this.#e.addGroupEnd.add(t.pinnedField),e.querySelectorAll(`.header-row .cell[data-field="${t.pinnedField}"], .data-grid-row .cell[data-field="${t.pinnedField}"]`).forEach(e=>e.classList.add("group-end")),t.isTransferred=!0):!i&&t.isTransferred&&(t.pinnedFragment.textContent="",t.pinnedFragment.style.overflow="",t.pinnedFragment.style.textOverflow="",t.pinnedFragment.style.whiteSpace="",t.pinnedFragment.style.borderRightStyle="none",t.floatLabel.style.visibility="",t.floatLabel.style.transform="",t.floatOffset=0,this.#e.addGroupEnd.delete(t.pinnedField),e.querySelectorAll(`.header-row .cell[data-field="${t.pinnedField}"], .data-grid-row .cell[data-field="${t.pinnedField}"]`).forEach(e=>e.classList.remove("group-end")),t.isTransferred=!1),!t.isTransferred){const e=t.floatLabel.getBoundingClientRect().left-t.floatOffset,i=s.left;e<i?(t.floatOffset=i-e,t.floatLabel.style.transform=`translateX(${t.floatOffset}px)`):(t.floatOffset=0,t.floatLabel.style.transform="")}}}handleQuery(e){switch(e.type){case g:return null==n(e.context)&&void 0;case"getStickyOffsets":return{left:Object.fromEntries(this.leftOffsets),right:Object.fromEntries(this.rightOffsets)};case"getContextMenuItems":{const t=e.context;if(!t.isHeader)return;const s=t.column;if(!s?.field)return;if(s.lockPinning||s.meta?.lockPinning)return;const i=[];return null!=n(s)?i.push({id:"pinned/unpin",label:"Unpin Column",icon:"📌",order:40,action:()=>this.setPinPosition(s.field,void 0)}):(i.push({id:"pinned/pin-left",label:"Pin Left",icon:"⬅",order:40,action:()=>this.setPinPosition(s.field,"left")}),i.push({id:"pinned/pin-right",label:"Pin Right",icon:"➡",order:41,action:()=>this.setPinPosition(s.field,"right")})),i}default:return}}setPinPosition(e,t){const s=this.columns;if(!s?.length)return;const i=s.findIndex(t=>t.field===e);if(-1===i)return;const l=this.gridElement;if(t){0===this.#s.length&&(this.#s=s.map(e=>e.field));const i=s.map(s=>{if(s.field!==e)return s;const i={...s};return i.pinned=t,i});l.columns=i}else{const t={...s[i]};delete t.pinned;const r=[...s];r.splice(i,1);const o=this.#s.indexOf(e);if(o>=0){let e=r.length;for(let t=0;t<r.length;t++){if(n(r[t]))continue;if(this.#s.indexOf(r[t].field)>o){e=t;break}}r.splice(e,0,t)}else r.splice(Math.min(i,r.length),0,t);r.some(e=>null!=n(e))||(this.#s=[]),l.columns=r}}refreshStickyOffsets(){const e=[...this.columns],t=a(this.gridElement,e);this.#e=t.groupEndAdjustments,this.leftOffsets=t.leftOffsets,this.rightOffsets=t.rightOffsets,this.#t=t.splitGroups}getLeftPinnedColumns(){return function(e,t="ltr"){return e.filter(e=>r(e,t))}([...this.columns],s.getDirection(this.gridElement))}getRightPinnedColumns(){return function(e,t="ltr"){return e.filter(e=>o(e,t))}([...this.columns],s.getDirection(this.gridElement))}clearStickyPositions(){p(this.gridElement)}getHorizontalScrollOffsets(e,s){if(!this.isApplied)return;let i=0,n=0;if(e){const s=e.querySelectorAll(`.${t.GridClasses.STICKY_LEFT}`),l=e.querySelectorAll(`.${t.GridClasses.STICKY_RIGHT}`);s.forEach(e=>{i+=e.offsetWidth}),l.forEach(e=>{n+=e.offsetWidth})}else{this.gridElement.querySelectorAll(".header-row .cell").forEach(e=>{e.classList.contains(t.GridClasses.STICKY_LEFT)?i+=e.offsetWidth:e.classList.contains(t.GridClasses.STICKY_RIGHT)&&(n+=e.offsetWidth)})}const l=s?.classList.contains(t.GridClasses.STICKY_LEFT)||s?.classList.contains(t.GridClasses.STICKY_RIGHT);return{left:i,right:n,skipScroll:l}}}e.PinnedColumnsPlugin=h,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=pinned-columns.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pinned-columns.umd.js","sources":["../../../../../libs/grid/src/lib/plugins/pinned-columns/pinned-columns.ts","../../../../../libs/grid/src/lib/plugins/pinned-columns/PinnedColumnsPlugin.ts"],"sourcesContent":["/**\n * Pinned Columns Core Logic\n *\n * Pure functions for applying pinned (sticky) column positioning.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { GridClasses } from '../../core/constants';\nimport { getDirection, resolveInlinePosition, type TextDirection } from '../../core/internal/utils';\nimport type { PinnedPosition, ResolvedPinnedPosition } from './types';\n\n/**\n * Get the effective pinned position from a column.\n *\n * @param col - Column configuration object\n * @returns The pinned position, or undefined if not pinned\n */\nexport function getColumnPinned(col: any): PinnedPosition | undefined {\n return col.pinned ?? col.meta?.pinned;\n}\n\n/**\n * Resolve a pinned position to a physical position based on text direction.\n *\n * - `'left'` / `'right'` → unchanged (physical values)\n * - `'start'` → `'left'` in LTR, `'right'` in RTL\n * - `'end'` → `'right'` in LTR, `'left'` in RTL\n *\n * @param position - The pinned position (logical or physical)\n * @param direction - Text direction ('ltr' or 'rtl')\n * @returns Physical pinned position ('left' or 'right')\n */\nexport function resolveStickyPosition(position: PinnedPosition, direction: TextDirection): ResolvedPinnedPosition {\n return resolveInlinePosition(position, direction);\n}\n\n/**\n * Check if a column is pinned on the left (after resolving logical positions).\n */\nfunction isResolvedLeft(col: any, direction: TextDirection): boolean {\n const pinned = getColumnPinned(col);\n if (!pinned) return false;\n return resolveStickyPosition(pinned, direction) === 'left';\n}\n\n/**\n * Check if a column is pinned on the right (after resolving logical positions).\n */\nfunction isResolvedRight(col: any, direction: TextDirection): boolean {\n const pinned = getColumnPinned(col);\n if (!pinned) return false;\n return resolveStickyPosition(pinned, direction) === 'right';\n}\n\n/**\n * Get columns that should be sticky on the left.\n *\n * @param columns - Array of column configurations\n * @param direction - Text direction (default: 'ltr')\n * @returns Array of columns with sticky='left' or sticky='start' (in LTR)\n */\nexport function getLeftStickyColumns(columns: any[], direction: TextDirection = 'ltr'): any[] {\n return columns.filter((col) => isResolvedLeft(col, direction));\n}\n\n/**\n * Get columns that should be sticky on the right.\n *\n * @param columns - Array of column configurations\n * @param direction - Text direction (default: 'ltr')\n * @returns Array of columns with sticky='right' or sticky='end' (in LTR)\n */\nexport function getRightStickyColumns(columns: any[], direction: TextDirection = 'ltr'): any[] {\n return columns.filter((col) => isResolvedRight(col, direction));\n}\n\n/**\n * Check if any columns have sticky positioning.\n *\n * @param columns - Array of column configurations\n * @returns True if any column has sticky position\n */\nexport function hasStickyColumns(columns: any[]): boolean {\n for (let i = 0; i < columns.length; i++) {\n if (columns[i].pinned != null || columns[i].meta?.pinned != null) return true;\n }\n return false;\n}\n\n/**\n * Get the sticky position of a column.\n *\n * @param column - Column configuration\n * @returns The sticky position or null if not sticky\n */\nexport function getColumnStickyPosition(column: any): PinnedPosition | null {\n return getColumnPinned(column) ?? null;\n}\n\n/**\n * Calculate left offsets for sticky-left columns.\n * Returns a map of field -> offset in pixels.\n *\n * @param columns - Array of column configurations (in order)\n * @param getColumnWidth - Function to get column width by field\n * @param direction - Text direction (default: 'ltr')\n * @returns Map of field to left offset\n */\nexport function calculateLeftStickyOffsets(\n columns: any[],\n getColumnWidth: (field: string) => number,\n direction: TextDirection = 'ltr',\n): Map<string, number> {\n const offsets = new Map<string, number>();\n let currentOffset = 0;\n\n for (const col of columns) {\n if (isResolvedLeft(col, direction)) {\n offsets.set(col.field, currentOffset);\n currentOffset += getColumnWidth(col.field);\n }\n }\n\n return offsets;\n}\n\n/**\n * Calculate right offsets for sticky-right columns.\n * Processes columns in reverse order.\n *\n * @param columns - Array of column configurations (in order)\n * @param getColumnWidth - Function to get column width by field\n * @param direction - Text direction (default: 'ltr')\n * @returns Map of field to right offset\n */\nexport function calculateRightStickyOffsets(\n columns: any[],\n getColumnWidth: (field: string) => number,\n direction: TextDirection = 'ltr',\n): Map<string, number> {\n const offsets = new Map<string, number>();\n let currentOffset = 0;\n\n // Process in reverse for right-sticky columns\n const reversed = [...columns].reverse();\n for (const col of reversed) {\n if (isResolvedRight(col, direction)) {\n offsets.set(col.field, currentOffset);\n currentOffset += getColumnWidth(col.field);\n }\n }\n\n return offsets;\n}\n\n/**\n * Adjustments to `group-end` borders at pin boundaries within implicit groups.\n * - `addGroupEnd`: fields that should gain `group-end` (last pinned column at boundary)\n * - `removeGroupEnd`: fields that should lose `group-end` (lone non-pinned remnant)\n */\nexport interface GroupEndAdjustments {\n addGroupEnd: Set<string>;\n removeGroupEnd: Set<string>;\n}\n\n/**\n * Result of applying sticky offsets — includes both the group-end adjustments\n * and the measured left/right offset maps for use in per-cell rendering hooks.\n */\nexport interface StickyOffsetsResult {\n groupEndAdjustments: GroupEndAdjustments;\n leftOffsets: Map<string, number>;\n rightOffsets: Map<string, number>;\n splitGroups: SplitGroupState[];\n}\n\n/**\n * State for an explicit group header that was split at a pin boundary.\n *\n * The pinned fragment is sticky and initially empty. The non-pinned fragment\n * holds the label in a CSS-sticky span that floats toward the pinned area on\n * horizontal scroll. When the non-pinned fragment scrolls far enough, the\n * plugin's `onScroll` handler transfers the label into the pinned fragment.\n */\nexport interface SplitGroupState {\n /** Group identifier (data-group attribute value). */\n groupId: string;\n /** Original group label text. */\n label: string;\n /** The sticky (pinned) fragment element. */\n pinnedFragment: HTMLElement;\n /** The scrollable (non-pinned) fragment element. */\n scrollableFragment: HTMLElement;\n /** The floating <span> inside the scrollable fragment. */\n floatLabel: HTMLElement;\n /** Field of the last pinned column — used to toggle `.group-end`. */\n pinnedField: string;\n /** Whether the label is currently shown inside the pinned fragment. */\n isTransferred: boolean;\n /** Current translateX offset applied to the floating label (px). */\n floatOffset: number;\n}\n\n/**\n * Apply sticky offsets to header and body cells.\n * This modifies the DOM elements in place.\n *\n * @param host - The grid host element (render root for DOM queries)\n * @param columns - Array of column configurations\n * @returns Sticky offsets result with group-end adjustments and measured offset maps\n */\nexport function applyStickyOffsets(host: HTMLElement, columns: any[]): StickyOffsetsResult {\n const emptyResult: StickyOffsetsResult = {\n groupEndAdjustments: { addGroupEnd: new Set(), removeGroupEnd: new Set() },\n leftOffsets: new Map(),\n rightOffsets: new Map(),\n splitGroups: [],\n };\n\n // With light DOM, query the host element directly\n const headerCells = Array.from(host.querySelectorAll('.header-row .cell')) as HTMLElement[];\n if (!headerCells.length) return emptyResult;\n\n // Detect text direction from the host element\n const direction = getDirection(host);\n\n // Collect measured offsets for caching in the plugin\n const leftOffsets = new Map<string, number>();\n const rightOffsets = new Map<string, number>();\n\n // Apply left sticky (includes 'start' in LTR, 'end' in RTL)\n let left = 0;\n for (const col of columns) {\n if (isResolvedLeft(col, direction)) {\n const cell = headerCells.find((c) => c.getAttribute('data-field') === col.field);\n if (cell) {\n leftOffsets.set(col.field, left);\n cell.classList.add(GridClasses.STICKY_LEFT);\n cell.style.position = 'sticky';\n cell.style.left = left + 'px';\n // Body cells: use data-field for reliable matching (data-col indices may differ\n // between _columns and _visibleColumns due to hidden/utility columns)\n host.querySelectorAll(`.data-grid-row .cell[data-field=\"${col.field}\"]`).forEach((el) => {\n el.classList.add(GridClasses.STICKY_LEFT);\n (el as HTMLElement).style.position = 'sticky';\n (el as HTMLElement).style.left = left + 'px';\n });\n left += cell.offsetWidth;\n }\n }\n }\n\n // Apply right sticky (includes 'end' in LTR, 'start' in RTL) - process in reverse\n let right = 0;\n for (const col of [...columns].reverse()) {\n if (isResolvedRight(col, direction)) {\n const cell = headerCells.find((c) => c.getAttribute('data-field') === col.field);\n if (cell) {\n rightOffsets.set(col.field, right);\n cell.classList.add(GridClasses.STICKY_RIGHT);\n cell.style.position = 'sticky';\n cell.style.right = right + 'px';\n // Body cells: use data-field for reliable matching\n host.querySelectorAll(`.data-grid-row .cell[data-field=\"${col.field}\"]`).forEach((el) => {\n el.classList.add(GridClasses.STICKY_RIGHT);\n (el as HTMLElement).style.position = 'sticky';\n (el as HTMLElement).style.right = right + 'px';\n });\n right += cell.offsetWidth;\n }\n }\n }\n\n // Apply sticky offsets to column group header cells and collect group-end adjustments\n const splitGroups: SplitGroupState[] = [];\n const adjustments = applyGroupHeaderStickyOffsets(host, columns, headerCells, direction, splitGroups);\n\n // Apply group-end adjustments to header cells and visible body cells\n if (adjustments.addGroupEnd.size > 0 || adjustments.removeGroupEnd.size > 0) {\n for (const field of adjustments.addGroupEnd) {\n const hCell = headerCells.find((c) => c.getAttribute('data-field') === field);\n if (hCell) hCell.classList.add('group-end');\n host.querySelectorAll(`.data-grid-row .cell[data-field=\"${field}\"]`).forEach((el) => {\n el.classList.add('group-end');\n });\n }\n for (const field of adjustments.removeGroupEnd) {\n const hCell = headerCells.find((c) => c.getAttribute('data-field') === field);\n if (hCell) hCell.classList.remove('group-end');\n host.querySelectorAll(`.data-grid-row .cell[data-field=\"${field}\"]`).forEach((el) => {\n el.classList.remove('group-end');\n });\n }\n }\n\n return { groupEndAdjustments: adjustments, leftOffsets, rightOffsets, splitGroups };\n}\n\n/**\n * Apply sticky offsets to column group header cells.\n * - If ALL columns in a group are pinned the same direction, the whole cell is pinned.\n * - If an implicit (unlabelled) group mixes pinned and non-pinned columns,\n * the cell is split at pin boundaries so pinned portions can be sticky.\n *\n * @param host - The grid host element\n * @param columns - Array of column configurations\n * @param headerCells - Already-queried header cells (with sticky offsets applied)\n * @param direction - Text direction\n * @returns Group-end adjustments for pin boundaries within implicit groups\n */\nfunction applyGroupHeaderStickyOffsets(\n host: HTMLElement,\n columns: any[],\n headerCells: HTMLElement[],\n direction: TextDirection,\n splitGroups: SplitGroupState[],\n): GroupEndAdjustments {\n const adjustments: GroupEndAdjustments = { addGroupEnd: new Set(), removeGroupEnd: new Set() };\n const groupCells = Array.from(host.querySelectorAll('.header-group-row .header-group-cell')) as HTMLElement[];\n if (!groupCells.length) return adjustments;\n\n for (const groupCell of groupCells) {\n // Parse gridColumn to find which column range this group spans\n // Format: \"startCol / span N\" (1-based)\n const gridCol = groupCell.style.gridColumn;\n if (!gridCol) continue;\n\n const match = gridCol.match(/^(\\d+)\\s*\\/\\s*span\\s+(\\d+)$/);\n if (!match) continue;\n\n const startIdx = parseInt(match[1], 10) - 1; // Convert to 0-based\n const span = parseInt(match[2], 10);\n const endIdx = startIdx + span - 1;\n\n // Get the columns this group spans\n const spannedColumns = columns.slice(startIdx, endIdx + 1);\n if (!spannedColumns.length) continue;\n\n const allLeft = spannedColumns.every((col: any) => isResolvedLeft(col, direction));\n const allRight = spannedColumns.every((col: any) => isResolvedRight(col, direction));\n\n if (allLeft) {\n const firstField = spannedColumns[0].field;\n const firstCell = headerCells.find((c) => c.getAttribute('data-field') === firstField);\n if (firstCell) {\n groupCell.classList.add(GridClasses.STICKY_LEFT);\n groupCell.style.position = 'sticky';\n groupCell.style.left = firstCell.style.left;\n }\n } else if (allRight) {\n const lastField = spannedColumns[spannedColumns.length - 1].field;\n const lastCell = headerCells.find((c) => c.getAttribute('data-field') === lastField);\n if (lastCell) {\n groupCell.classList.add(GridClasses.STICKY_RIGHT);\n groupCell.style.position = 'sticky';\n groupCell.style.right = lastCell.style.right;\n }\n } else if (groupCell.classList.contains('implicit-group')) {\n // Implicit group with mixed pinning: split into separate cells so pinned\n // portions become sticky while non-pinned portions scroll normally.\n splitMixedPinImplicitGroup(groupCell, spannedColumns, startIdx, headerCells, direction, adjustments);\n } else {\n // Explicit (labelled) group with mixed pinning: split the group header so\n // the pinned fragment keeps the label and sticks, while the non-pinned\n // remainder scrolls away. This makes the group header visually shrink to\n // the pinned column width when scrolled horizontally.\n const someLeft = spannedColumns.some((col: any) => isResolvedLeft(col, direction));\n const someRight = spannedColumns.some((col: any) => isResolvedRight(col, direction));\n if (someLeft || someRight) {\n splitMixedPinExplicitGroup(\n groupCell,\n spannedColumns,\n startIdx,\n headerCells,\n direction,\n adjustments,\n splitGroups,\n );\n }\n }\n }\n\n return adjustments;\n}\n\n/** Classify a column's pin state after resolving logical positions. */\ntype PinState = 'left' | 'right' | 'none';\n\nfunction getPinState(col: any, direction: TextDirection): PinState {\n if (isResolvedLeft(col, direction)) return 'left';\n if (isResolvedRight(col, direction)) return 'right';\n return 'none';\n}\n\n/**\n * Split an implicit (unlabelled) group header cell into fragments at pin-state\n * boundaries. Each fragment becomes its own header-group-cell; pinned fragments\n * get sticky positioning.\n *\n * Also populates `adjustments` with group-end border changes:\n * - Last column of a left-pinned run gets `group-end` (visual separator at pin edge)\n * - Last column of a subsequent non-pinned run that contains only utility columns\n * loses `group-end` (it visually merges with the adjacent explicit group)\n */\nfunction splitMixedPinImplicitGroup(\n groupCell: HTMLElement,\n spannedColumns: any[],\n startIdx: number,\n headerCells: HTMLElement[],\n direction: TextDirection,\n adjustments: GroupEndAdjustments,\n): void {\n // Partition columns into contiguous runs of the same pin state\n const runs: { state: PinState; cols: any[]; colStart: number }[] = [];\n for (let i = 0; i < spannedColumns.length; i++) {\n const state = getPinState(spannedColumns[i], direction);\n const prev = runs[runs.length - 1];\n if (prev && prev.state === state) {\n prev.cols.push(spannedColumns[i]);\n } else {\n runs.push({ state, cols: [spannedColumns[i]], colStart: startIdx + i });\n }\n }\n\n if (runs.length <= 1) return; // Nothing to split\n\n const parent = groupCell.parentElement;\n if (!parent) return;\n\n const nextSibling = groupCell.nextSibling;\n parent.removeChild(groupCell);\n\n for (const run of runs) {\n const cell = document.createElement('div');\n cell.className = groupCell.className; // Preserves implicit-group, cell, header-group-cell\n cell.setAttribute('data-group', groupCell.getAttribute('data-group') || '');\n cell.style.gridColumn = `${run.colStart + 1} / span ${run.cols.length}`;\n\n if (run.state === 'left') {\n const firstField = run.cols[0].field;\n const firstCell = headerCells.find((c) => c.getAttribute('data-field') === firstField);\n if (firstCell) {\n cell.classList.add(GridClasses.STICKY_LEFT);\n cell.style.position = 'sticky';\n cell.style.left = firstCell.style.left;\n }\n } else if (run.state === 'right') {\n const lastField = run.cols[run.cols.length - 1].field;\n const lastCell = headerCells.find((c) => c.getAttribute('data-field') === lastField);\n if (lastCell) {\n cell.classList.add(GridClasses.STICKY_RIGHT);\n cell.style.position = 'sticky';\n cell.style.right = lastCell.style.right;\n }\n } else if (run.state === 'none') {\n // Suppress border on utility-only non-pinned remnants — they visually merge\n // with the adjacent explicit group.\n const allUtility = run.cols.every((c: any) => String(c.field || '').startsWith('__tbw_'));\n if (allUtility) {\n cell.style.borderRightStyle = 'none';\n }\n }\n\n if (nextSibling) {\n parent.insertBefore(cell, nextSibling);\n } else {\n parent.appendChild(cell);\n }\n }\n\n // Compute group-end adjustments at pin boundaries.\n // When a pinned run is followed by a non-pinned run, the last column of the\n // pinned run should be the visual group boundary (group-end).\n // The non-pinned remnant's last column should lose group-end if all its\n // columns are utility columns (e.g. __tbw_expander) — they visually merge\n // with the adjacent explicit group.\n for (let ri = 0; ri < runs.length; ri++) {\n const run = runs[ri];\n const nextRun = runs[ri + 1];\n\n if (run.state !== 'none' && nextRun && nextRun.state === 'none') {\n // Last column of pinned run gets group-end\n const lastPinnedField = run.cols[run.cols.length - 1].field;\n if (lastPinnedField) adjustments.addGroupEnd.add(lastPinnedField);\n }\n\n if (run.state === 'none') {\n // Check if all columns in this non-pinned run are utility columns\n const allUtility = run.cols.every((c: any) => String(c.field || '').startsWith('__tbw_'));\n if (allUtility) {\n // Remove group-end from the last column — it visually merges with the next group\n const lastField = run.cols[run.cols.length - 1].field;\n if (lastField) adjustments.removeGroupEnd.add(lastField);\n }\n }\n }\n}\n\n/**\n * Split an explicit (labelled) group header cell at pin boundaries.\n *\n * **Pinned fragment:** sticky, initially empty (no label, no `.group-end`).\n * **Non-pinned fragment:** carries the label inside a CSS-sticky elevated `<span>`.\n * The span floats left over the pinned fragment as the user scrolls horizontally.\n *\n * When the non-pinned fragment's left edge reaches the pinned fragment's right\n * edge (i.e. only the pinned column width remains), the plugin's `onScroll` hook\n * transfers the label into the pinned fragment and adds `.group-end`.\n */\nfunction splitMixedPinExplicitGroup(\n groupCell: HTMLElement,\n spannedColumns: any[],\n startIdx: number,\n headerCells: HTMLElement[],\n direction: TextDirection,\n _adjustments: GroupEndAdjustments,\n splitGroups: SplitGroupState[],\n): void {\n // Partition columns into contiguous runs of the same pin state\n const runs: { state: PinState; cols: any[]; colStart: number }[] = [];\n for (let i = 0; i < spannedColumns.length; i++) {\n const state = getPinState(spannedColumns[i], direction);\n const prev = runs[runs.length - 1];\n if (prev && prev.state === state) {\n prev.cols.push(spannedColumns[i]);\n } else {\n runs.push({ state, cols: [spannedColumns[i]], colStart: startIdx + i });\n }\n }\n\n if (runs.length <= 1) return; // Nothing to split\n\n const parent = groupCell.parentElement;\n if (!parent) return;\n\n const label = groupCell.textContent || '';\n const groupId = groupCell.getAttribute('data-group') || '';\n const nextSibling = groupCell.nextSibling;\n parent.removeChild(groupCell);\n\n // Identify the pinned run and the adjacent non-pinned run.\n const firstLeftRunIdx = runs.findIndex((r) => r.state === 'left');\n let lastRightRunIdx = -1;\n for (let i = runs.length - 1; i >= 0; i--) {\n if (runs[i].state === 'right') {\n lastRightRunIdx = i;\n break;\n }\n }\n const pinnedRunIdx = firstLeftRunIdx >= 0 ? firstLeftRunIdx : lastRightRunIdx;\n const floatRunIdx =\n firstLeftRunIdx >= 0 && firstLeftRunIdx + 1 < runs.length\n ? firstLeftRunIdx + 1\n : lastRightRunIdx >= 0 && lastRightRunIdx - 1 >= 0\n ? lastRightRunIdx - 1\n : -1;\n\n let pinnedStickyOffset = '0px';\n let pinnedFragment: HTMLElement | undefined;\n let scrollableFragment: HTMLElement | undefined;\n let floatLabel: HTMLElement | undefined;\n let pinnedField = '';\n\n for (let ri = 0; ri < runs.length; ri++) {\n const run = runs[ri];\n const cell = document.createElement('div');\n cell.className = groupCell.className;\n cell.setAttribute('data-group', groupId);\n cell.style.gridColumn = `${run.colStart + 1} / span ${run.cols.length}`;\n\n if (run.state === 'left') {\n const firstField = run.cols[0].field;\n const firstCell = headerCells.find((c) => c.getAttribute('data-field') === firstField);\n if (firstCell) {\n cell.classList.add(GridClasses.STICKY_LEFT);\n cell.style.position = 'sticky';\n cell.style.left = firstCell.style.left;\n pinnedStickyOffset = firstCell.style.left;\n }\n\n if (ri === pinnedRunIdx) {\n // Pinned fragment: empty, no group-end, hide border so it merges visually\n cell.style.borderRightStyle = 'none';\n pinnedFragment = cell;\n pinnedField = run.cols[run.cols.length - 1].field;\n }\n } else if (run.state === 'right') {\n const lastField = run.cols[run.cols.length - 1].field;\n const lastCell = headerCells.find((c) => c.getAttribute('data-field') === lastField);\n if (lastCell) {\n cell.classList.add(GridClasses.STICKY_RIGHT);\n cell.style.position = 'sticky';\n cell.style.right = lastCell.style.right;\n }\n\n if (ri === pinnedRunIdx) {\n cell.style.borderLeftStyle = 'none';\n pinnedFragment = cell;\n pinnedField = run.cols[0].field;\n }\n }\n\n // The non-pinned run that carries the floating label.\n // CSS sticky won't work here because .header-group-cell has overflow:hidden\n // (set by grouping-columns.css for text clipping). So the plugin's onScroll\n // handler manually translates the span to simulate sticky behavior.\n if (ri === floatRunIdx) {\n // Allow the span to overflow outside the cell when translated left\n cell.style.overflow = 'visible';\n\n const span = document.createElement('span');\n span.textContent = label;\n span.style.position = 'relative';\n span.style.zIndex = '36';\n span.style.display = 'block';\n span.style.overflow = 'hidden';\n span.style.textOverflow = 'ellipsis';\n span.style.whiteSpace = 'nowrap';\n\n cell.appendChild(span);\n scrollableFragment = cell;\n floatLabel = span;\n }\n\n if (nextSibling) {\n parent.insertBefore(cell, nextSibling);\n } else {\n parent.appendChild(cell);\n }\n }\n\n // Register the split group state so the plugin can manage label transfer on scroll.\n if (pinnedFragment && scrollableFragment && floatLabel && pinnedField) {\n splitGroups.push({\n groupId,\n label,\n pinnedFragment,\n scrollableFragment,\n floatLabel,\n pinnedField,\n isTransferred: false,\n floatOffset: 0,\n });\n }\n}\n\n/**\n * Reorder columns so that pinned-left columns come first and pinned-right columns come last.\n * Maintains the relative order within each group (left-pinned, unpinned, right-pinned).\n *\n * @param columns - Array of column configurations (in their current order)\n * @param direction - Text direction ('ltr' or 'rtl'), used to resolve logical positions\n * @returns New array with pinned columns moved to the edges\n */\nexport function reorderColumnsForPinning(columns: readonly any[], direction: TextDirection = 'ltr'): any[] {\n const left: any[] = [];\n const middle: any[] = [];\n const right: any[] = [];\n\n for (const col of columns) {\n const pinned = getColumnPinned(col);\n if (pinned) {\n const resolved = resolveStickyPosition(pinned, direction);\n if (resolved === 'left') left.push(col);\n else right.push(col);\n } else {\n middle.push(col);\n }\n }\n\n return [...left, ...middle, ...right];\n}\n\n/**\n * Clear sticky positioning from all cells.\n *\n * @param host - The grid host element (render root for DOM queries)\n */\nexport function clearStickyOffsets(host: HTMLElement): void {\n // With light DOM, query the host element directly\n const cells = host.querySelectorAll(`.${GridClasses.STICKY_LEFT}, .${GridClasses.STICKY_RIGHT}`);\n cells.forEach((cell) => {\n cell.classList.remove(GridClasses.STICKY_LEFT, GridClasses.STICKY_RIGHT);\n (cell as HTMLElement).style.position = '';\n (cell as HTMLElement).style.left = '';\n (cell as HTMLElement).style.right = '';\n });\n}\n","/**\n * Pinned Columns Plugin (Class-based)\n *\n * Enables column pinning (sticky left/right positioning).\n */\n\nimport { GridClasses } from '../../core/constants';\nimport { getDirection } from '../../core/internal/utils';\nimport type { AfterCellRenderContext, PluginManifest, PluginQuery, ScrollEvent } from '../../core/plugin/base-plugin';\nimport { BaseGridPlugin } from '../../core/plugin/base-plugin';\nimport type { ColumnConfig } from '../../core/types';\nimport type { ContextMenuParams, HeaderContextMenuItem } from '../context-menu/types';\nimport {\n applyStickyOffsets,\n clearStickyOffsets,\n getColumnPinned,\n getLeftStickyColumns,\n getRightStickyColumns,\n hasStickyColumns,\n reorderColumnsForPinning,\n type GroupEndAdjustments,\n type SplitGroupState,\n} from './pinned-columns';\nimport type { PinnedColumnsConfig, PinnedPosition } from './types';\n\n/** Query type constant for checking if a column can be moved */\nconst QUERY_CAN_MOVE_COLUMN = 'canMoveColumn';\n\n/**\n * Pinned Columns Plugin for tbw-grid\n *\n * Freezes columns to the left or right edge of the grid—essential for keeping key\n * identifiers or action buttons visible while scrolling through wide datasets. Just set\n * `pinned: 'left'` or `pinned: 'right'` on your column definitions.\n *\n * ## Installation\n *\n * ```ts\n * import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';\n * ```\n *\n * ## Column Configuration\n *\n * | Property | Type | Description |\n * |----------|------|-------------|\n * | `pinned` | `'left' \\| 'right' \\| 'start' \\| 'end'` | Pin column to edge (logical or physical) |\n * | `lockPinning` | `boolean` | `false` | Prevent user from pin/unpin via context menu (legacy `meta.lockPinning` is honored) |\n *\n * ### RTL Support\n *\n * Use logical values (`start`/`end`) for grids that work in both LTR and RTL layouts:\n * - `'start'` - Pins to left in LTR, right in RTL\n * - `'end'` - Pins to right in LTR, left in RTL\n *\n * ## CSS Custom Properties\n *\n * | Property | Default | Description |\n * |----------|---------|-------------|\n * | `--tbw-pinned-shadow` | `4px 0 8px rgba(0,0,0,0.1)` | Shadow on pinned column edge |\n * | `--tbw-pinned-border` | `var(--tbw-color-border)` | Border between pinned and scrollable |\n *\n * @example Pin ID Left and Actions Right\n * ```ts\n * import { queryGrid } from '@toolbox-web/grid';\n * import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';\n *\n * const grid = queryGrid('tbw-grid');\n * grid.gridConfig = {\n * columns: [\n * { field: 'id', header: 'ID', pinned: 'left', width: 80 },\n * { field: 'name', header: 'Name' },\n * { field: 'email', header: 'Email' },\n * { field: 'department', header: 'Department' },\n * { field: 'actions', header: 'Actions', pinned: 'right', width: 120 },\n * ],\n * plugins: [new PinnedColumnsPlugin()],\n * };\n * ```\n *\n * @example RTL-Compatible Pinning\n * ```ts\n * // Same config works in LTR and RTL\n * grid.gridConfig = {\n * columns: [\n * { field: 'id', header: 'ID', pinned: 'start' }, // Left in LTR, Right in RTL\n * { field: 'name', header: 'Name' },\n * { field: 'actions', header: 'Actions', pinned: 'end' }, // Right in LTR, Left in RTL\n * ],\n * plugins: [new PinnedColumnsPlugin()],\n * };\n * ```\n *\n * @see {@link PinnedColumnsConfig} for configuration options\n *\n * @internal Extends BaseGridPlugin\n * @since 0.1.1\n */\nexport class PinnedColumnsPlugin extends BaseGridPlugin<PinnedColumnsConfig> {\n /**\n * Plugin manifest - declares owned properties and handled queries.\n * @internal\n */\n static override readonly manifest: PluginManifest = {\n hookPriority: {\n // Reorder columns before other plugins (e.g. TreePlugin) wrap them\n processColumns: -10,\n },\n ownedProperties: [\n {\n property: 'pinned',\n level: 'column',\n description: 'the \"pinned\" column property',\n isUsed: (v) => v === 'left' || v === 'right' || v === 'start' || v === 'end',\n },\n ],\n queries: [\n {\n type: QUERY_CAN_MOVE_COLUMN,\n description: 'Prevents pinned columns from being moved/reordered',\n },\n {\n type: 'getStickyOffsets',\n description: 'Returns the offsets for left/right pinned columns',\n },\n {\n type: 'getContextMenuItems',\n description: 'Contributes pin/unpin items to the header context menu',\n },\n ],\n };\n\n /** @internal */\n readonly name = 'pinnedColumns';\n\n /** @internal */\n protected override get defaultConfig(): Partial<PinnedColumnsConfig> {\n return {};\n }\n\n // #region Internal State\n private isApplied = false;\n private leftOffsets = new Map<string, number>();\n private rightOffsets = new Map<string, number>();\n /** Group-end adjustments for pin boundaries within implicit groups. */\n #groupEndAdjustments: GroupEndAdjustments = { addGroupEnd: new Set(), removeGroupEnd: new Set() };\n /** Split explicit-group state for scroll-driven label transfer. */\n #splitGroups: SplitGroupState[] = [];\n /**\n * Snapshot of the column field order before the first context-menu pin.\n * Used to restore original positions when unpinning.\n */\n #originalColumnOrder: string[] = [];\n // #endregion\n\n // #region Lifecycle\n\n /** @internal */\n override detach(): void {\n this.leftOffsets.clear();\n this.rightOffsets.clear();\n this.isApplied = false;\n this.#groupEndAdjustments = { addGroupEnd: new Set(), removeGroupEnd: new Set() };\n this.#splitGroups = [];\n this.#originalColumnOrder = [];\n }\n // #endregion\n\n // #region Detection\n\n /**\n * Auto-detect sticky columns from column configuration.\n */\n static detect(rows: readonly unknown[], config: { columns?: ColumnConfig[] }): boolean {\n const columns = config?.columns;\n if (!Array.isArray(columns)) return false;\n return hasStickyColumns(columns);\n }\n // #endregion\n\n // #region Hooks\n\n /** @internal */\n override processColumns(columns: readonly ColumnConfig[]): ColumnConfig[] {\n const cols = [...columns];\n this.isApplied = hasStickyColumns(cols);\n if (!this.isApplied) return cols;\n\n const host = this.gridElement;\n const direction = host ? getDirection(host) : 'ltr';\n return reorderColumnsForPinning(cols, direction) as ColumnConfig[];\n }\n\n /** @internal */\n override afterRender(): void {\n if (!this.isApplied) {\n return;\n }\n\n const host = this.gridElement;\n const columns = [...this.columns];\n\n if (!hasStickyColumns(columns)) {\n clearStickyOffsets(host);\n this.isApplied = false;\n return;\n }\n\n // Apply sticky offsets after a microtask to ensure DOM is ready\n queueMicrotask(() => {\n const result = applyStickyOffsets(host, columns);\n this.#groupEndAdjustments = result.groupEndAdjustments;\n this.leftOffsets = result.leftOffsets;\n this.rightOffsets = result.rightOffsets;\n this.#splitGroups = result.splitGroups;\n // Re-apply scroll-driven state (transfer + translateX) to the fresh DOM elements\n this.#updateSplitGroupScroll();\n });\n }\n\n /**\n * Apply sticky positioning and group-end adjustments on cells rendered during scroll.\n * When virtualization recycles row pool elements, newly rendered cells lack the\n * inline sticky styles applied by `applyStickyOffsets` in `afterRender`. This hook\n * ensures every cell gets correct sticky positioning using the cached offset maps.\n * @internal\n */\n override afterCellRender(context: AfterCellRenderContext): void {\n if (!this.isApplied) return;\n const field = context.column.field;\n const cellEl = context.cellElement;\n\n // Apply sticky positioning from cached offset maps\n const leftOffset = this.leftOffsets.get(field);\n if (leftOffset !== undefined) {\n if (!cellEl.classList.contains(GridClasses.STICKY_LEFT)) {\n cellEl.classList.add(GridClasses.STICKY_LEFT);\n }\n cellEl.style.position = 'sticky';\n cellEl.style.left = leftOffset + 'px';\n } else {\n const rightOffset = this.rightOffsets.get(field);\n if (rightOffset !== undefined) {\n if (!cellEl.classList.contains(GridClasses.STICKY_RIGHT)) {\n cellEl.classList.add(GridClasses.STICKY_RIGHT);\n }\n cellEl.style.position = 'sticky';\n cellEl.style.right = rightOffset + 'px';\n }\n }\n\n // Maintain group-end adjustments at pin boundaries\n if (this.#groupEndAdjustments.addGroupEnd.has(field)) {\n context.cellElement.classList.add('group-end');\n } else if (this.#groupEndAdjustments.removeGroupEnd.has(field)) {\n context.cellElement.classList.remove('group-end');\n }\n }\n\n /**\n * Handle horizontal scroll to manage floating group labels.\n *\n * When an explicit column group has a mix of pinned and non-pinned columns,\n * the label starts in the scrollable fragment and floats toward the pinned\n * column via CSS `position: sticky`. Once the scrollable fragment scrolls\n * far enough that the label would be clipped, this hook transfers the label\n * into the sticky pinned fragment and applies `.group-end` to the pinned\n * column cells, creating a visual separator. Scrolling back reverses the\n * transfer.\n * @internal\n */\n override onScroll(_event: ScrollEvent): void {\n this.#updateSplitGroupScroll();\n }\n\n /**\n * Apply scroll-driven state to split group headers.\n *\n * Handles both the manual translateX positioning (simulating sticky) and the\n * transfer of the label into/out of the pinned fragment with `.group-end`.\n * Called from `onScroll` on every scroll event and from `afterRender` after\n * the split group DOM is rebuilt (e.g. after selection click triggers re-render).\n */\n #updateSplitGroupScroll(): void {\n if (!this.isApplied || this.#splitGroups.length === 0) return;\n\n const host = this.gridElement;\n\n for (const sg of this.#splitGroups) {\n const pinnedRect = sg.pinnedFragment.getBoundingClientRect();\n const scrollableRect = sg.scrollableFragment.getBoundingClientRect();\n\n // Transfer when the non-pinned fragment's right edge reaches the pinned\n // fragment's right edge — all non-pinned columns scrolled behind the pin.\n const shouldTransfer = scrollableRect.right <= pinnedRect.right;\n\n if (shouldTransfer && !sg.isTransferred) {\n // Move label into the pinned fragment\n sg.pinnedFragment.textContent = sg.label;\n sg.pinnedFragment.style.overflow = 'hidden';\n sg.pinnedFragment.style.textOverflow = 'ellipsis';\n sg.pinnedFragment.style.whiteSpace = 'nowrap';\n sg.pinnedFragment.style.borderRightStyle = '';\n sg.floatLabel.style.visibility = 'hidden';\n sg.floatLabel.style.transform = '';\n sg.floatOffset = 0;\n\n // Add group-end to pinned column header + body cells\n this.#groupEndAdjustments.addGroupEnd.add(sg.pinnedField);\n host\n .querySelectorAll(\n `.header-row .cell[data-field=\"${sg.pinnedField}\"], .data-grid-row .cell[data-field=\"${sg.pinnedField}\"]`,\n )\n .forEach((el) => el.classList.add('group-end'));\n\n sg.isTransferred = true;\n } else if (!shouldTransfer && sg.isTransferred) {\n // Reverse transfer — label goes back to the floating span\n sg.pinnedFragment.textContent = '';\n sg.pinnedFragment.style.overflow = '';\n sg.pinnedFragment.style.textOverflow = '';\n sg.pinnedFragment.style.whiteSpace = '';\n sg.pinnedFragment.style.borderRightStyle = 'none';\n sg.floatLabel.style.visibility = '';\n sg.floatLabel.style.transform = '';\n sg.floatOffset = 0;\n\n // Remove group-end from pinned column cells\n this.#groupEndAdjustments.addGroupEnd.delete(sg.pinnedField);\n host\n .querySelectorAll(\n `.header-row .cell[data-field=\"${sg.pinnedField}\"], .data-grid-row .cell[data-field=\"${sg.pinnedField}\"]`,\n )\n .forEach((el) => el.classList.remove('group-end'));\n\n sg.isTransferred = false;\n }\n\n // Manually position the floating label to simulate sticky behavior.\n // CSS sticky can't be used because .header-group-cell has overflow:hidden.\n // We track the current translateX offset to correctly compute the span's\n // natural (un-translated) position from its measured rect.\n if (!sg.isTransferred) {\n const spanRect = sg.floatLabel.getBoundingClientRect();\n const spanNaturalLeft = spanRect.left - sg.floatOffset;\n const targetLeft = pinnedRect.left;\n if (spanNaturalLeft < targetLeft) {\n sg.floatOffset = targetLeft - spanNaturalLeft;\n sg.floatLabel.style.transform = `translateX(${sg.floatOffset}px)`;\n } else {\n sg.floatOffset = 0;\n sg.floatLabel.style.transform = '';\n }\n }\n }\n }\n\n /**\n * Handle inter-plugin queries.\n * @internal\n */\n override handleQuery(query: PluginQuery): unknown {\n switch (query.type) {\n case QUERY_CAN_MOVE_COLUMN: {\n // Prevent pinned columns from being moved/reordered.\n // Pinned columns have fixed positions and should not be draggable.\n const column = query.context as ColumnConfig;\n if (getColumnPinned(column) != null) {\n return false;\n }\n return undefined; // Let other plugins or default behavior decide\n }\n case 'getStickyOffsets': {\n // Return the calculated sticky offsets for column virtualization\n return {\n left: Object.fromEntries(this.leftOffsets),\n right: Object.fromEntries(this.rightOffsets),\n };\n }\n case 'getContextMenuItems': {\n const params = query.context as ContextMenuParams;\n if (!params.isHeader) return undefined;\n\n const column = params.column as ColumnConfig;\n if (!column?.field) return undefined;\n\n // Don't offer pin/unpin for locked-pinning columns\n // (top-level `lockPinning` preferred; legacy `meta.lockPinning` honored for back-compat)\n if (column.lockPinning || column.meta?.lockPinning) return undefined;\n\n const pinned = getColumnPinned(column);\n const isPinned = pinned != null;\n const items: HeaderContextMenuItem[] = [];\n\n if (isPinned) {\n items.push({\n id: 'pinned/unpin',\n label: 'Unpin Column',\n icon: '📌',\n order: 40,\n action: () => this.setPinPosition(column.field, undefined),\n });\n } else {\n items.push({\n id: 'pinned/pin-left',\n label: 'Pin Left',\n icon: '⬅',\n order: 40,\n action: () => this.setPinPosition(column.field, 'left'),\n });\n items.push({\n id: 'pinned/pin-right',\n label: 'Pin Right',\n icon: '➡',\n order: 41,\n action: () => this.setPinPosition(column.field, 'right'),\n });\n }\n\n return items;\n }\n default:\n return undefined;\n }\n }\n // #endregion\n\n // #region Public API\n\n /**\n * Set the pin position for a column.\n * Updates the column's `pinned` property and triggers a full re-render.\n *\n * @param field - The field name of the column to pin/unpin\n * @param position - The pin position (`'left'`, `'right'`, `'start'`, `'end'`), or `undefined` to unpin\n */\n setPinPosition(field: string, position: PinnedPosition | undefined): void {\n // Read the currently-visible columns from the plugin accessor.\n // These are the post-processColumns result, which is the authoritative column set.\n const currentColumns = this.columns;\n if (!currentColumns?.length) return;\n\n const currentIndex = currentColumns.findIndex((col) => col.field === field);\n if (currentIndex === -1) return;\n\n const gridEl = this.gridElement as HTMLElement & { columns?: ColumnConfig[] };\n\n if (position) {\n // PINNING: snapshot original column order if this is the first context-menu pin.\n // The snapshot lets us restore columns to their original positions on unpin.\n if (this.#originalColumnOrder.length === 0) {\n this.#originalColumnOrder = currentColumns.map((c) => c.field);\n }\n\n // Set the pinned property; processColumns will reorder on next render\n const updated = currentColumns.map((col) => {\n if (col.field !== field) return col;\n const copy = { ...col };\n (copy as ColumnConfig & { pinned?: PinnedPosition }).pinned = position;\n return copy;\n });\n\n gridEl.columns = updated;\n } else {\n // UNPINNING: restore column to its original position\n const col = currentColumns[currentIndex];\n const copy = { ...col };\n delete (copy as ColumnConfig & { pinned?: PinnedPosition }).pinned;\n\n // Remove from current position\n const remaining = [...currentColumns];\n remaining.splice(currentIndex, 1);\n\n // Find the best insertion point using the original order snapshot\n const originalIndex = this.#originalColumnOrder.indexOf(field);\n if (originalIndex >= 0) {\n // Scan remaining non-pinned columns and find the first whose original\n // position is greater than this column's original position.\n let insertIndex = remaining.length;\n for (let i = 0; i < remaining.length; i++) {\n if (getColumnPinned(remaining[i])) continue; // skip pinned columns\n const otherOriginal = this.#originalColumnOrder.indexOf(remaining[i].field);\n if (otherOriginal > originalIndex) {\n insertIndex = i;\n break;\n }\n }\n remaining.splice(insertIndex, 0, copy);\n } else {\n // Original position unknown — keep at current index\n remaining.splice(Math.min(currentIndex, remaining.length), 0, copy);\n }\n\n // If no more pinned columns remain, clear the snapshot\n if (!remaining.some((c) => getColumnPinned(c) != null)) {\n this.#originalColumnOrder = [];\n }\n\n gridEl.columns = remaining;\n }\n }\n\n /**\n * Re-apply sticky offsets (e.g., after column resize).\n */\n refreshStickyOffsets(): void {\n const columns = [...this.columns];\n const result = applyStickyOffsets(this.gridElement, columns);\n this.#groupEndAdjustments = result.groupEndAdjustments;\n this.leftOffsets = result.leftOffsets;\n this.rightOffsets = result.rightOffsets;\n this.#splitGroups = result.splitGroups;\n }\n\n /**\n * Get columns pinned to the left (after resolving logical positions for current direction).\n */\n getLeftPinnedColumns(): ColumnConfig[] {\n const columns = [...this.columns];\n const direction = getDirection(this.gridElement);\n return getLeftStickyColumns(columns, direction);\n }\n\n /**\n * Get columns pinned to the right (after resolving logical positions for current direction).\n */\n getRightPinnedColumns(): ColumnConfig[] {\n const columns = [...this.columns];\n const direction = getDirection(this.gridElement);\n return getRightStickyColumns(columns, direction);\n }\n\n /**\n * Clear all sticky positioning.\n */\n clearStickyPositions(): void {\n clearStickyOffsets(this.gridElement);\n }\n\n /**\n * Report horizontal scroll boundary offsets for pinned columns.\n * Used by keyboard navigation to ensure focused cells aren't hidden behind sticky columns.\n * @internal\n */\n override getHorizontalScrollOffsets(\n rowEl?: HTMLElement,\n focusedCell?: HTMLElement,\n ): { left: number; right: number; skipScroll?: boolean } | undefined {\n if (!this.isApplied) {\n return undefined;\n }\n\n let left = 0;\n let right = 0;\n\n if (rowEl) {\n // Calculate from rendered cells in the row\n const stickyLeftCells = rowEl.querySelectorAll(`.${GridClasses.STICKY_LEFT}`);\n const stickyRightCells = rowEl.querySelectorAll(`.${GridClasses.STICKY_RIGHT}`);\n stickyLeftCells.forEach((el) => {\n left += (el as HTMLElement).offsetWidth;\n });\n stickyRightCells.forEach((el) => {\n right += (el as HTMLElement).offsetWidth;\n });\n } else {\n // Fall back to header row if no row element provided\n const host = this.gridElement;\n const headerCells = host.querySelectorAll('.header-row .cell');\n headerCells.forEach((cell) => {\n if (cell.classList.contains(GridClasses.STICKY_LEFT)) {\n left += (cell as HTMLElement).offsetWidth;\n } else if (cell.classList.contains(GridClasses.STICKY_RIGHT)) {\n right += (cell as HTMLElement).offsetWidth;\n }\n });\n }\n\n // Skip horizontal scrolling if focused cell is pinned (it's always visible)\n const skipScroll =\n focusedCell?.classList.contains(GridClasses.STICKY_LEFT) ||\n focusedCell?.classList.contains(GridClasses.STICKY_RIGHT);\n\n return { left, right, skipScroll };\n }\n // #endregion\n}\n"],"names":["getColumnPinned","col","pinned","meta","resolveStickyPosition","position","direction","resolveInlinePosition","isResolvedLeft","isResolvedRight","hasStickyColumns","columns","i","length","applyStickyOffsets","host","emptyResult","groupEndAdjustments","addGroupEnd","Set","removeGroupEnd","leftOffsets","Map","rightOffsets","splitGroups","headerCells","Array","from","querySelectorAll","getDirection","left","cell","find","c","getAttribute","field","set","classList","add","GridClasses","STICKY_LEFT","style","forEach","el","offsetWidth","right","reverse","STICKY_RIGHT","adjustments","groupCells","groupCell","gridCol","gridColumn","match","startIdx","parseInt","endIdx","spannedColumns","slice","allLeft","every","allRight","firstField","firstCell","lastField","lastCell","contains","splitMixedPinImplicitGroup","someLeft","some","someRight","splitMixedPinExplicitGroup","applyGroupHeaderStickyOffsets","size","hCell","remove","getPinState","runs","state","prev","cols","push","colStart","parent","parentElement","nextSibling","removeChild","run","document","createElement","className","setAttribute","String","startsWith","borderRightStyle","insertBefore","appendChild","ri","nextRun","lastPinnedField","_adjustments","label","textContent","groupId","firstLeftRunIdx","findIndex","r","lastRightRunIdx","pinnedRunIdx","floatRunIdx","pinnedFragment","scrollableFragment","floatLabel","pinnedField","borderLeftStyle","overflow","span","zIndex","display","textOverflow","whiteSpace","isTransferred","floatOffset","clearStickyOffsets","QUERY_CAN_MOVE_COLUMN","PinnedColumnsPlugin","BaseGridPlugin","static","hookPriority","processColumns","ownedProperties","property","level","description","isUsed","v","queries","type","name","defaultConfig","isApplied","originalColumnOrder","detach","this","clear","detect","rows","config","isArray","gridElement","middle","reorderColumnsForPinning","afterRender","queueMicrotask","result","updateSplitGroupScroll","afterCellRender","context","column","cellEl","cellElement","leftOffset","get","rightOffset","has","onScroll","_event","sg","pinnedRect","getBoundingClientRect","shouldTransfer","visibility","transform","delete","spanNaturalLeft","targetLeft","handleQuery","query","Object","fromEntries","params","isHeader","lockPinning","items","id","icon","order","action","setPinPosition","currentColumns","currentIndex","gridEl","map","updated","copy","remaining","splice","originalIndex","indexOf","insertIndex","Math","min","refreshStickyOffsets","getLeftPinnedColumns","filter","getLeftStickyColumns","getRightPinnedColumns","getRightStickyColumns","clearStickyPositions","getHorizontalScrollOffsets","rowEl","focusedCell","stickyLeftCells","stickyRightCells","skipScroll"],"mappings":"ueAkBO,SAASA,EAAgBC,GAC9B,OAAOA,EAAIC,QAAUD,EAAIE,MAAMD,MACjC,CAaO,SAASE,EAAsBC,EAA0BC,GAC9D,OAAOC,EAAAA,sBAAsBF,EAAUC,EACzC,CAKA,SAASE,EAAeP,EAAUK,GAChC,MAAMJ,EAASF,EAAgBC,GAC/B,QAAKC,GAC+C,SAA7CE,EAAsBF,EAAQI,EACvC,CAKA,SAASG,EAAgBR,EAAUK,GACjC,MAAMJ,EAASF,EAAgBC,GAC/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M,UAAU6B,SAAS3B,EAAAA,YAAYC,aACtCV,GAASC,EAAqBa,YACrBb,EAAKM,UAAU6B,SAAS3B,EAAAA,YAAYQ,gBAC7CF,GAAUd,EAAqBa,cAGrC,CAGA,MAAM0K,EACJH,GAAa9K,UAAU6B,SAAS3B,EAAAA,YAAYC,cAC5C2K,GAAa9K,UAAU6B,SAAS3B,EAAAA,YAAYQ,cAE9C,MAAO,CAAEjB,OAAMe,QAAOyK,aACxB"}
|
|
1
|
+
{"version":3,"file":"pinned-columns.umd.js","sources":["../../../../../libs/grid/src/lib/plugins/pinned-columns/pinned-columns.ts","../../../../../libs/grid/src/lib/plugins/pinned-columns/PinnedColumnsPlugin.ts"],"sourcesContent":["/**\n * Pinned Columns Core Logic\n *\n * Pure functions for applying pinned (sticky) column positioning.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { GridClasses } from '../../core/constants';\nimport { getDirection, resolveInlinePosition, type TextDirection } from '../../core/internal/utils';\nimport type { PinnedPosition, ResolvedPinnedPosition } from './types';\n\n/**\n * Get the effective pinned position from a column.\n *\n * @param col - Column configuration object\n * @returns The pinned position, or undefined if not pinned\n */\nexport function getColumnPinned(col: any): PinnedPosition | undefined {\n return col.pinned ?? col.meta?.pinned;\n}\n\n/**\n * Resolve a pinned position to a physical position based on text direction.\n *\n * - `'left'` / `'right'` → unchanged (physical values)\n * - `'start'` → `'left'` in LTR, `'right'` in RTL\n * - `'end'` → `'right'` in LTR, `'left'` in RTL\n *\n * @param position - The pinned position (logical or physical)\n * @param direction - Text direction ('ltr' or 'rtl')\n * @returns Physical pinned position ('left' or 'right')\n */\nexport function resolveStickyPosition(position: PinnedPosition, direction: TextDirection): ResolvedPinnedPosition {\n return resolveInlinePosition(position, direction);\n}\n\n/**\n * Check if a column is pinned on the left (after resolving logical positions).\n */\nfunction isResolvedLeft(col: any, direction: TextDirection): boolean {\n const pinned = getColumnPinned(col);\n if (!pinned) return false;\n return resolveStickyPosition(pinned, direction) === 'left';\n}\n\n/**\n * Check if a column is pinned on the right (after resolving logical positions).\n */\nfunction isResolvedRight(col: any, direction: TextDirection): boolean {\n const pinned = getColumnPinned(col);\n if (!pinned) return false;\n return resolveStickyPosition(pinned, direction) === 'right';\n}\n\n/**\n * Get columns that should be sticky on the left.\n *\n * @param columns - Array of column configurations\n * @param direction - Text direction (default: 'ltr')\n * @returns Array of columns with sticky='left' or sticky='start' (in LTR)\n */\nexport function getLeftStickyColumns(columns: any[], direction: TextDirection = 'ltr'): any[] {\n return columns.filter((col) => isResolvedLeft(col, direction));\n}\n\n/**\n * Get columns that should be sticky on the right.\n *\n * @param columns - Array of column configurations\n * @param direction - Text direction (default: 'ltr')\n * @returns Array of columns with sticky='right' or sticky='end' (in LTR)\n */\nexport function getRightStickyColumns(columns: any[], direction: TextDirection = 'ltr'): any[] {\n return columns.filter((col) => isResolvedRight(col, direction));\n}\n\n/**\n * Check if any columns have sticky positioning.\n *\n * @param columns - Array of column configurations\n * @returns True if any column has sticky position\n */\nexport function hasStickyColumns(columns: any[]): boolean {\n for (let i = 0; i < columns.length; i++) {\n if (columns[i].pinned != null || columns[i].meta?.pinned != null) return true;\n }\n return false;\n}\n\n/**\n * Get the sticky position of a column.\n *\n * @param column - Column configuration\n * @returns The sticky position or null if not sticky\n */\nexport function getColumnStickyPosition(column: any): PinnedPosition | null {\n return getColumnPinned(column) ?? null;\n}\n\n/**\n * Calculate left offsets for sticky-left columns.\n * Returns a map of field -> offset in pixels.\n *\n * @param columns - Array of column configurations (in order)\n * @param getColumnWidth - Function to get column width by field\n * @param direction - Text direction (default: 'ltr')\n * @returns Map of field to left offset\n */\nexport function calculateLeftStickyOffsets(\n columns: any[],\n getColumnWidth: (field: string) => number,\n direction: TextDirection = 'ltr',\n): Map<string, number> {\n const offsets = new Map<string, number>();\n let currentOffset = 0;\n\n for (const col of columns) {\n if (isResolvedLeft(col, direction)) {\n offsets.set(col.field, currentOffset);\n currentOffset += getColumnWidth(col.field);\n }\n }\n\n return offsets;\n}\n\n/**\n * Calculate right offsets for sticky-right columns.\n * Processes columns in reverse order.\n *\n * @param columns - Array of column configurations (in order)\n * @param getColumnWidth - Function to get column width by field\n * @param direction - Text direction (default: 'ltr')\n * @returns Map of field to right offset\n */\nexport function calculateRightStickyOffsets(\n columns: any[],\n getColumnWidth: (field: string) => number,\n direction: TextDirection = 'ltr',\n): Map<string, number> {\n const offsets = new Map<string, number>();\n let currentOffset = 0;\n\n // Process in reverse for right-sticky columns\n const reversed = [...columns].reverse();\n for (const col of reversed) {\n if (isResolvedRight(col, direction)) {\n offsets.set(col.field, currentOffset);\n currentOffset += getColumnWidth(col.field);\n }\n }\n\n return offsets;\n}\n\n/**\n * Adjustments to `group-end` borders at pin boundaries within implicit groups.\n * - `addGroupEnd`: fields that should gain `group-end` (last pinned column at boundary)\n * - `removeGroupEnd`: fields that should lose `group-end` (lone non-pinned remnant)\n */\nexport interface GroupEndAdjustments {\n addGroupEnd: Set<string>;\n removeGroupEnd: Set<string>;\n}\n\n/**\n * Result of applying sticky offsets — includes both the group-end adjustments\n * and the measured left/right offset maps for use in per-cell rendering hooks.\n */\nexport interface StickyOffsetsResult {\n groupEndAdjustments: GroupEndAdjustments;\n leftOffsets: Map<string, number>;\n rightOffsets: Map<string, number>;\n splitGroups: SplitGroupState[];\n}\n\n/**\n * State for an explicit group header that was split at a pin boundary.\n *\n * The pinned fragment is sticky and initially empty. The non-pinned fragment\n * holds the label in a CSS-sticky span that floats toward the pinned area on\n * horizontal scroll. When the non-pinned fragment scrolls far enough, the\n * plugin's `onScroll` handler transfers the label into the pinned fragment.\n */\nexport interface SplitGroupState {\n /** Group identifier (data-group attribute value). */\n groupId: string;\n /** Original group label text. */\n label: string;\n /** The sticky (pinned) fragment element. */\n pinnedFragment: HTMLElement;\n /** The scrollable (non-pinned) fragment element. */\n scrollableFragment: HTMLElement;\n /** The floating <span> inside the scrollable fragment. */\n floatLabel: HTMLElement;\n /** Field of the last pinned column — used to toggle `.group-end`. */\n pinnedField: string;\n /** Whether the label is currently shown inside the pinned fragment. */\n isTransferred: boolean;\n /** Current translateX offset applied to the floating label (px). */\n floatOffset: number;\n}\n\n/**\n * Apply sticky offsets to header and body cells.\n * This modifies the DOM elements in place.\n *\n * @param host - The grid host element (render root for DOM queries)\n * @param columns - Array of column configurations\n * @returns Sticky offsets result with group-end adjustments and measured offset maps\n */\nexport function applyStickyOffsets(host: HTMLElement, columns: any[]): StickyOffsetsResult {\n const emptyResult: StickyOffsetsResult = {\n groupEndAdjustments: { addGroupEnd: new Set(), removeGroupEnd: new Set() },\n leftOffsets: new Map(),\n rightOffsets: new Map(),\n splitGroups: [],\n };\n\n // With light DOM, query the host element directly\n const headerCells = Array.from(host.querySelectorAll('.header-row .cell')) as HTMLElement[];\n if (!headerCells.length) return emptyResult;\n\n // Detect text direction from the host element\n const direction = getDirection(host);\n\n // Collect measured offsets for caching in the plugin\n const leftOffsets = new Map<string, number>();\n const rightOffsets = new Map<string, number>();\n\n // Apply left sticky (includes 'start' in LTR, 'end' in RTL)\n let left = 0;\n for (const col of columns) {\n if (isResolvedLeft(col, direction)) {\n const cell = headerCells.find((c) => c.getAttribute('data-field') === col.field);\n if (cell) {\n leftOffsets.set(col.field, left);\n cell.classList.add(GridClasses.STICKY_LEFT);\n cell.style.position = 'sticky';\n cell.style.left = left + 'px';\n // Body cells: use data-field for reliable matching (data-col indices may differ\n // between _columns and _visibleColumns due to hidden/utility columns)\n host.querySelectorAll(`.data-grid-row .cell[data-field=\"${col.field}\"]`).forEach((el) => {\n el.classList.add(GridClasses.STICKY_LEFT);\n (el as HTMLElement).style.position = 'sticky';\n (el as HTMLElement).style.left = left + 'px';\n });\n left += cell.offsetWidth;\n }\n }\n }\n\n // Apply right sticky (includes 'end' in LTR, 'start' in RTL) - process in reverse\n let right = 0;\n for (const col of [...columns].reverse()) {\n if (isResolvedRight(col, direction)) {\n const cell = headerCells.find((c) => c.getAttribute('data-field') === col.field);\n if (cell) {\n rightOffsets.set(col.field, right);\n cell.classList.add(GridClasses.STICKY_RIGHT);\n cell.style.position = 'sticky';\n cell.style.right = right + 'px';\n // Body cells: use data-field for reliable matching\n host.querySelectorAll(`.data-grid-row .cell[data-field=\"${col.field}\"]`).forEach((el) => {\n el.classList.add(GridClasses.STICKY_RIGHT);\n (el as HTMLElement).style.position = 'sticky';\n (el as HTMLElement).style.right = right + 'px';\n });\n right += cell.offsetWidth;\n }\n }\n }\n\n // Apply sticky offsets to column group header cells and collect group-end adjustments\n const splitGroups: SplitGroupState[] = [];\n const adjustments = applyGroupHeaderStickyOffsets(host, columns, headerCells, direction, splitGroups);\n\n // Apply group-end adjustments to header cells and visible body cells\n if (adjustments.addGroupEnd.size > 0 || adjustments.removeGroupEnd.size > 0) {\n for (const field of adjustments.addGroupEnd) {\n const hCell = headerCells.find((c) => c.getAttribute('data-field') === field);\n if (hCell) hCell.classList.add('group-end');\n host.querySelectorAll(`.data-grid-row .cell[data-field=\"${field}\"]`).forEach((el) => {\n el.classList.add('group-end');\n });\n }\n for (const field of adjustments.removeGroupEnd) {\n const hCell = headerCells.find((c) => c.getAttribute('data-field') === field);\n if (hCell) hCell.classList.remove('group-end');\n host.querySelectorAll(`.data-grid-row .cell[data-field=\"${field}\"]`).forEach((el) => {\n el.classList.remove('group-end');\n });\n }\n }\n\n return { groupEndAdjustments: adjustments, leftOffsets, rightOffsets, splitGroups };\n}\n\n/**\n * Apply sticky offsets to column group header cells.\n * - If ALL columns in a group are pinned the same direction, the whole cell is pinned.\n * - If an implicit (unlabelled) group mixes pinned and non-pinned columns,\n * the cell is split at pin boundaries so pinned portions can be sticky.\n *\n * @param host - The grid host element\n * @param columns - Array of column configurations\n * @param headerCells - Already-queried header cells (with sticky offsets applied)\n * @param direction - Text direction\n * @returns Group-end adjustments for pin boundaries within implicit groups\n */\nfunction applyGroupHeaderStickyOffsets(\n host: HTMLElement,\n columns: any[],\n headerCells: HTMLElement[],\n direction: TextDirection,\n splitGroups: SplitGroupState[],\n): GroupEndAdjustments {\n const adjustments: GroupEndAdjustments = { addGroupEnd: new Set(), removeGroupEnd: new Set() };\n const groupCells = Array.from(host.querySelectorAll('.header-group-row .header-group-cell')) as HTMLElement[];\n if (!groupCells.length) return adjustments;\n\n for (const groupCell of groupCells) {\n // Parse gridColumn to find which column range this group spans\n // Format: \"startCol / span N\" (1-based)\n const gridCol = groupCell.style.gridColumn;\n if (!gridCol) continue;\n\n const match = gridCol.match(/^(\\d+)\\s*\\/\\s*span\\s+(\\d+)$/);\n if (!match) continue;\n\n const startIdx = parseInt(match[1], 10) - 1; // Convert to 0-based\n const span = parseInt(match[2], 10);\n const endIdx = startIdx + span - 1;\n\n // Get the columns this group spans\n const spannedColumns = columns.slice(startIdx, endIdx + 1);\n if (!spannedColumns.length) continue;\n\n const allLeft = spannedColumns.every((col: any) => isResolvedLeft(col, direction));\n const allRight = spannedColumns.every((col: any) => isResolvedRight(col, direction));\n\n if (allLeft) {\n const firstField = spannedColumns[0].field;\n const firstCell = headerCells.find((c) => c.getAttribute('data-field') === firstField);\n if (firstCell) {\n groupCell.classList.add(GridClasses.STICKY_LEFT);\n groupCell.style.position = 'sticky';\n groupCell.style.left = firstCell.style.left;\n }\n } else if (allRight) {\n const lastField = spannedColumns[spannedColumns.length - 1].field;\n const lastCell = headerCells.find((c) => c.getAttribute('data-field') === lastField);\n if (lastCell) {\n groupCell.classList.add(GridClasses.STICKY_RIGHT);\n groupCell.style.position = 'sticky';\n groupCell.style.right = lastCell.style.right;\n }\n } else if (groupCell.classList.contains('implicit-group')) {\n // Implicit group with mixed pinning: split into separate cells so pinned\n // portions become sticky while non-pinned portions scroll normally.\n splitMixedPinImplicitGroup(groupCell, spannedColumns, startIdx, headerCells, direction, adjustments);\n } else {\n // Explicit (labelled) group with mixed pinning: split the group header so\n // the pinned fragment keeps the label and sticks, while the non-pinned\n // remainder scrolls away. This makes the group header visually shrink to\n // the pinned column width when scrolled horizontally.\n const someLeft = spannedColumns.some((col: any) => isResolvedLeft(col, direction));\n const someRight = spannedColumns.some((col: any) => isResolvedRight(col, direction));\n if (someLeft || someRight) {\n splitMixedPinExplicitGroup(\n groupCell,\n spannedColumns,\n startIdx,\n headerCells,\n direction,\n adjustments,\n splitGroups,\n );\n }\n }\n }\n\n return adjustments;\n}\n\n/** Classify a column's pin state after resolving logical positions. */\ntype PinState = 'left' | 'right' | 'none';\n\nfunction getPinState(col: any, direction: TextDirection): PinState {\n if (isResolvedLeft(col, direction)) return 'left';\n if (isResolvedRight(col, direction)) return 'right';\n return 'none';\n}\n\n/**\n * Split an implicit (unlabelled) group header cell into fragments at pin-state\n * boundaries. Each fragment becomes its own header-group-cell; pinned fragments\n * get sticky positioning.\n *\n * Also populates `adjustments` with group-end border changes:\n * - Last column of a left-pinned run gets `group-end` (visual separator at pin edge)\n * - Last column of a subsequent non-pinned run that contains only utility columns\n * loses `group-end` (it visually merges with the adjacent explicit group)\n */\nfunction splitMixedPinImplicitGroup(\n groupCell: HTMLElement,\n spannedColumns: any[],\n startIdx: number,\n headerCells: HTMLElement[],\n direction: TextDirection,\n adjustments: GroupEndAdjustments,\n): void {\n // Partition columns into contiguous runs of the same pin state\n const runs: { state: PinState; cols: any[]; colStart: number }[] = [];\n for (let i = 0; i < spannedColumns.length; i++) {\n const state = getPinState(spannedColumns[i], direction);\n const prev = runs[runs.length - 1];\n if (prev && prev.state === state) {\n prev.cols.push(spannedColumns[i]);\n } else {\n runs.push({ state, cols: [spannedColumns[i]], colStart: startIdx + i });\n }\n }\n\n if (runs.length <= 1) return; // Nothing to split\n\n const parent = groupCell.parentElement;\n if (!parent) return;\n\n const nextSibling = groupCell.nextSibling;\n parent.removeChild(groupCell);\n\n for (const run of runs) {\n const cell = document.createElement('div');\n cell.className = groupCell.className; // Preserves implicit-group, cell, header-group-cell\n cell.setAttribute('data-group', groupCell.getAttribute('data-group') || '');\n cell.style.gridColumn = `${run.colStart + 1} / span ${run.cols.length}`;\n\n if (run.state === 'left') {\n const firstField = run.cols[0].field;\n const firstCell = headerCells.find((c) => c.getAttribute('data-field') === firstField);\n if (firstCell) {\n cell.classList.add(GridClasses.STICKY_LEFT);\n cell.style.position = 'sticky';\n cell.style.left = firstCell.style.left;\n }\n } else if (run.state === 'right') {\n const lastField = run.cols[run.cols.length - 1].field;\n const lastCell = headerCells.find((c) => c.getAttribute('data-field') === lastField);\n if (lastCell) {\n cell.classList.add(GridClasses.STICKY_RIGHT);\n cell.style.position = 'sticky';\n cell.style.right = lastCell.style.right;\n }\n } else if (run.state === 'none') {\n // Suppress border on utility-only non-pinned remnants — they visually merge\n // with the adjacent explicit group.\n const allUtility = run.cols.every((c: any) => String(c.field || '').startsWith('__tbw_'));\n if (allUtility) {\n cell.style.borderRightStyle = 'none';\n }\n }\n\n if (nextSibling) {\n parent.insertBefore(cell, nextSibling);\n } else {\n parent.appendChild(cell);\n }\n }\n\n // Compute group-end adjustments at pin boundaries.\n // When a pinned run is followed by a non-pinned run, the last column of the\n // pinned run should be the visual group boundary (group-end).\n // The non-pinned remnant's last column should lose group-end if all its\n // columns are utility columns (e.g. __tbw_expander) — they visually merge\n // with the adjacent explicit group.\n for (let ri = 0; ri < runs.length; ri++) {\n const run = runs[ri];\n const nextRun = runs[ri + 1];\n\n if (run.state !== 'none' && nextRun && nextRun.state === 'none') {\n // Last column of pinned run gets group-end\n const lastPinnedField = run.cols[run.cols.length - 1].field;\n if (lastPinnedField) adjustments.addGroupEnd.add(lastPinnedField);\n }\n\n if (run.state === 'none') {\n // Check if all columns in this non-pinned run are utility columns\n const allUtility = run.cols.every((c: any) => String(c.field || '').startsWith('__tbw_'));\n if (allUtility) {\n // Remove group-end from the last column — it visually merges with the next group\n const lastField = run.cols[run.cols.length - 1].field;\n if (lastField) adjustments.removeGroupEnd.add(lastField);\n }\n }\n }\n}\n\n/**\n * Split an explicit (labelled) group header cell at pin boundaries.\n *\n * **Pinned fragment:** sticky, initially empty (no label, no `.group-end`).\n * **Non-pinned fragment:** carries the label inside a CSS-sticky elevated `<span>`.\n * The span floats left over the pinned fragment as the user scrolls horizontally.\n *\n * When the non-pinned fragment's left edge reaches the pinned fragment's right\n * edge (i.e. only the pinned column width remains), the plugin's `onScroll` hook\n * transfers the label into the pinned fragment and adds `.group-end`.\n */\nfunction splitMixedPinExplicitGroup(\n groupCell: HTMLElement,\n spannedColumns: any[],\n startIdx: number,\n headerCells: HTMLElement[],\n direction: TextDirection,\n _adjustments: GroupEndAdjustments,\n splitGroups: SplitGroupState[],\n): void {\n // Partition columns into contiguous runs of the same pin state\n const runs: { state: PinState; cols: any[]; colStart: number }[] = [];\n for (let i = 0; i < spannedColumns.length; i++) {\n const state = getPinState(spannedColumns[i], direction);\n const prev = runs[runs.length - 1];\n if (prev && prev.state === state) {\n prev.cols.push(spannedColumns[i]);\n } else {\n runs.push({ state, cols: [spannedColumns[i]], colStart: startIdx + i });\n }\n }\n\n if (runs.length <= 1) return; // Nothing to split\n\n const parent = groupCell.parentElement;\n if (!parent) return;\n\n const label = groupCell.textContent || '';\n const groupId = groupCell.getAttribute('data-group') || '';\n const nextSibling = groupCell.nextSibling;\n parent.removeChild(groupCell);\n\n // Identify the pinned run and the adjacent non-pinned run.\n const firstLeftRunIdx = runs.findIndex((r) => r.state === 'left');\n let lastRightRunIdx = -1;\n for (let i = runs.length - 1; i >= 0; i--) {\n if (runs[i].state === 'right') {\n lastRightRunIdx = i;\n break;\n }\n }\n const pinnedRunIdx = firstLeftRunIdx >= 0 ? firstLeftRunIdx : lastRightRunIdx;\n const floatRunIdx =\n firstLeftRunIdx >= 0 && firstLeftRunIdx + 1 < runs.length\n ? firstLeftRunIdx + 1\n : lastRightRunIdx >= 0 && lastRightRunIdx - 1 >= 0\n ? lastRightRunIdx - 1\n : -1;\n\n let pinnedFragment: HTMLElement | undefined;\n let scrollableFragment: HTMLElement | undefined;\n let floatLabel: HTMLElement | undefined;\n let pinnedField = '';\n\n for (let ri = 0; ri < runs.length; ri++) {\n const run = runs[ri];\n const cell = document.createElement('div');\n cell.className = groupCell.className;\n cell.setAttribute('data-group', groupId);\n cell.style.gridColumn = `${run.colStart + 1} / span ${run.cols.length}`;\n\n if (run.state === 'left') {\n const firstField = run.cols[0].field;\n const firstCell = headerCells.find((c) => c.getAttribute('data-field') === firstField);\n if (firstCell) {\n cell.classList.add(GridClasses.STICKY_LEFT);\n cell.style.position = 'sticky';\n cell.style.left = firstCell.style.left;\n }\n\n if (ri === pinnedRunIdx) {\n // Pinned fragment: empty, no group-end, hide border so it merges visually\n cell.style.borderRightStyle = 'none';\n pinnedFragment = cell;\n pinnedField = run.cols[run.cols.length - 1].field;\n }\n } else if (run.state === 'right') {\n const lastField = run.cols[run.cols.length - 1].field;\n const lastCell = headerCells.find((c) => c.getAttribute('data-field') === lastField);\n if (lastCell) {\n cell.classList.add(GridClasses.STICKY_RIGHT);\n cell.style.position = 'sticky';\n cell.style.right = lastCell.style.right;\n }\n\n if (ri === pinnedRunIdx) {\n cell.style.borderLeftStyle = 'none';\n pinnedFragment = cell;\n pinnedField = run.cols[0].field;\n }\n }\n\n // The non-pinned run that carries the floating label.\n // CSS sticky won't work here because .header-group-cell has overflow:hidden\n // (set by grouping-columns.css for text clipping). So the plugin's onScroll\n // handler manually translates the span to simulate sticky behavior.\n if (ri === floatRunIdx) {\n // Allow the span to overflow outside the cell when translated left\n cell.style.overflow = 'visible';\n\n const span = document.createElement('span');\n span.textContent = label;\n span.style.position = 'relative';\n span.style.zIndex = '36';\n span.style.display = 'block';\n span.style.overflow = 'hidden';\n span.style.textOverflow = 'ellipsis';\n span.style.whiteSpace = 'nowrap';\n\n cell.appendChild(span);\n scrollableFragment = cell;\n floatLabel = span;\n }\n\n if (nextSibling) {\n parent.insertBefore(cell, nextSibling);\n } else {\n parent.appendChild(cell);\n }\n }\n\n // Register the split group state so the plugin can manage label transfer on scroll.\n if (pinnedFragment && scrollableFragment && floatLabel && pinnedField) {\n splitGroups.push({\n groupId,\n label,\n pinnedFragment,\n scrollableFragment,\n floatLabel,\n pinnedField,\n isTransferred: false,\n floatOffset: 0,\n });\n }\n}\n\n/**\n * Reorder columns so that pinned-left columns come first and pinned-right columns come last.\n * Maintains the relative order within each group (left-pinned, unpinned, right-pinned).\n *\n * @param columns - Array of column configurations (in their current order)\n * @param direction - Text direction ('ltr' or 'rtl'), used to resolve logical positions\n * @returns New array with pinned columns moved to the edges\n */\nexport function reorderColumnsForPinning(columns: readonly any[], direction: TextDirection = 'ltr'): any[] {\n const left: any[] = [];\n const middle: any[] = [];\n const right: any[] = [];\n\n for (const col of columns) {\n const pinned = getColumnPinned(col);\n if (pinned) {\n const resolved = resolveStickyPosition(pinned, direction);\n if (resolved === 'left') left.push(col);\n else right.push(col);\n } else {\n middle.push(col);\n }\n }\n\n return [...left, ...middle, ...right];\n}\n\n/**\n * Clear sticky positioning from all cells.\n *\n * @param host - The grid host element (render root for DOM queries)\n */\nexport function clearStickyOffsets(host: HTMLElement): void {\n // With light DOM, query the host element directly\n const cells = host.querySelectorAll(`.${GridClasses.STICKY_LEFT}, .${GridClasses.STICKY_RIGHT}`);\n cells.forEach((cell) => {\n cell.classList.remove(GridClasses.STICKY_LEFT, GridClasses.STICKY_RIGHT);\n (cell as HTMLElement).style.position = '';\n (cell as HTMLElement).style.left = '';\n (cell as HTMLElement).style.right = '';\n });\n}\n","/**\n * Pinned Columns Plugin (Class-based)\n *\n * Enables column pinning (sticky left/right positioning).\n */\n\nimport { GridClasses } from '../../core/constants';\nimport { getDirection } from '../../core/internal/utils';\nimport type { AfterCellRenderContext, PluginManifest, PluginQuery, ScrollEvent } from '../../core/plugin/base-plugin';\nimport { BaseGridPlugin } from '../../core/plugin/base-plugin';\nimport type { ColumnConfig } from '../../core/types';\nimport type { ContextMenuParams, HeaderContextMenuItem } from '../context-menu/types';\nimport {\n applyStickyOffsets,\n clearStickyOffsets,\n getColumnPinned,\n getLeftStickyColumns,\n getRightStickyColumns,\n hasStickyColumns,\n reorderColumnsForPinning,\n type GroupEndAdjustments,\n type SplitGroupState,\n} from './pinned-columns';\nimport type { PinnedColumnsConfig, PinnedPosition } from './types';\n\n/** Query type constant for checking if a column can be moved */\nconst QUERY_CAN_MOVE_COLUMN = 'canMoveColumn';\n\n/**\n * Pinned Columns Plugin for tbw-grid\n *\n * Freezes columns to the left or right edge of the grid—essential for keeping key\n * identifiers or action buttons visible while scrolling through wide datasets. Just set\n * `pinned: 'left'` or `pinned: 'right'` on your column definitions.\n *\n * ## Installation\n *\n * ```ts\n * import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';\n * ```\n *\n * ## Column Configuration\n *\n * | Property | Type | Description |\n * |----------|------|-------------|\n * | `pinned` | `'left' \\| 'right' \\| 'start' \\| 'end'` | Pin column to edge (logical or physical) |\n * | `lockPinning` | `boolean` | `false` | Prevent user from pin/unpin via context menu (legacy `meta.lockPinning` is honored) |\n *\n * ### RTL Support\n *\n * Use logical values (`start`/`end`) for grids that work in both LTR and RTL layouts:\n * - `'start'` - Pins to left in LTR, right in RTL\n * - `'end'` - Pins to right in LTR, left in RTL\n *\n * ## CSS Custom Properties\n *\n * | Property | Default | Description |\n * |----------|---------|-------------|\n * | `--tbw-pinned-shadow` | `4px 0 8px rgba(0,0,0,0.1)` | Shadow on pinned column edge |\n * | `--tbw-pinned-border` | `var(--tbw-color-border)` | Border between pinned and scrollable |\n *\n * @example Pin ID Left and Actions Right\n * ```ts\n * import { queryGrid } from '@toolbox-web/grid';\n * import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';\n *\n * const grid = queryGrid('tbw-grid');\n * grid.gridConfig = {\n * columns: [\n * { field: 'id', header: 'ID', pinned: 'left', width: 80 },\n * { field: 'name', header: 'Name' },\n * { field: 'email', header: 'Email' },\n * { field: 'department', header: 'Department' },\n * { field: 'actions', header: 'Actions', pinned: 'right', width: 120 },\n * ],\n * plugins: [new PinnedColumnsPlugin()],\n * };\n * ```\n *\n * @example RTL-Compatible Pinning\n * ```ts\n * // Same config works in LTR and RTL\n * grid.gridConfig = {\n * columns: [\n * { field: 'id', header: 'ID', pinned: 'start' }, // Left in LTR, Right in RTL\n * { field: 'name', header: 'Name' },\n * { field: 'actions', header: 'Actions', pinned: 'end' }, // Right in LTR, Left in RTL\n * ],\n * plugins: [new PinnedColumnsPlugin()],\n * };\n * ```\n *\n * @see {@link PinnedColumnsConfig} for configuration options\n *\n * @internal Extends BaseGridPlugin\n * @since 0.1.1\n */\nexport class PinnedColumnsPlugin extends BaseGridPlugin<PinnedColumnsConfig> {\n /**\n * Plugin manifest - declares owned properties and handled queries.\n * @internal\n */\n static override readonly manifest: PluginManifest = {\n hookPriority: {\n // Reorder columns before other plugins (e.g. TreePlugin) wrap them\n processColumns: -10,\n },\n ownedProperties: [\n {\n property: 'pinned',\n level: 'column',\n description: 'the \"pinned\" column property',\n isUsed: (v) => v === 'left' || v === 'right' || v === 'start' || v === 'end',\n },\n ],\n queries: [\n {\n type: QUERY_CAN_MOVE_COLUMN,\n description: 'Prevents pinned columns from being moved/reordered',\n },\n {\n type: 'getStickyOffsets',\n description: 'Returns the offsets for left/right pinned columns',\n },\n {\n type: 'getContextMenuItems',\n description: 'Contributes pin/unpin items to the header context menu',\n },\n ],\n };\n\n /** @internal */\n readonly name = 'pinnedColumns';\n\n /** @internal */\n protected override get defaultConfig(): Partial<PinnedColumnsConfig> {\n return {};\n }\n\n // #region Internal State\n private isApplied = false;\n private leftOffsets = new Map<string, number>();\n private rightOffsets = new Map<string, number>();\n /** Group-end adjustments for pin boundaries within implicit groups. */\n #groupEndAdjustments: GroupEndAdjustments = { addGroupEnd: new Set(), removeGroupEnd: new Set() };\n /** Split explicit-group state for scroll-driven label transfer. */\n #splitGroups: SplitGroupState[] = [];\n /**\n * Snapshot of the column field order before the first context-menu pin.\n * Used to restore original positions when unpinning.\n */\n #originalColumnOrder: string[] = [];\n // #endregion\n\n // #region Lifecycle\n\n /** @internal */\n override detach(): void {\n this.leftOffsets.clear();\n this.rightOffsets.clear();\n this.isApplied = false;\n this.#groupEndAdjustments = { addGroupEnd: new Set(), removeGroupEnd: new Set() };\n this.#splitGroups = [];\n this.#originalColumnOrder = [];\n }\n // #endregion\n\n // #region Detection\n\n /**\n * Auto-detect sticky columns from column configuration.\n */\n static detect(rows: readonly unknown[], config: { columns?: ColumnConfig[] }): boolean {\n const columns = config?.columns;\n if (!Array.isArray(columns)) return false;\n return hasStickyColumns(columns);\n }\n // #endregion\n\n // #region Hooks\n\n /** @internal */\n override processColumns(columns: readonly ColumnConfig[]): ColumnConfig[] {\n const cols = [...columns];\n this.isApplied = hasStickyColumns(cols);\n if (!this.isApplied) return cols;\n\n const host = this.gridElement;\n const direction = host ? getDirection(host) : 'ltr';\n return reorderColumnsForPinning(cols, direction) as ColumnConfig[];\n }\n\n /** @internal */\n override afterRender(): void {\n if (!this.isApplied) {\n return;\n }\n\n const host = this.gridElement;\n const columns = [...this.columns];\n\n if (!hasStickyColumns(columns)) {\n clearStickyOffsets(host);\n this.isApplied = false;\n return;\n }\n\n // Apply sticky offsets after a microtask to ensure DOM is ready\n queueMicrotask(() => {\n const result = applyStickyOffsets(host, columns);\n this.#groupEndAdjustments = result.groupEndAdjustments;\n this.leftOffsets = result.leftOffsets;\n this.rightOffsets = result.rightOffsets;\n this.#splitGroups = result.splitGroups;\n // Re-apply scroll-driven state (transfer + translateX) to the fresh DOM elements\n this.#updateSplitGroupScroll();\n });\n }\n\n /**\n * Apply sticky positioning and group-end adjustments on cells rendered during scroll.\n * When virtualization recycles row pool elements, newly rendered cells lack the\n * inline sticky styles applied by `applyStickyOffsets` in `afterRender`. This hook\n * ensures every cell gets correct sticky positioning using the cached offset maps.\n * @internal\n */\n override afterCellRender(context: AfterCellRenderContext): void {\n if (!this.isApplied) return;\n const field = context.column.field;\n const cellEl = context.cellElement;\n\n // Apply sticky positioning from cached offset maps\n const leftOffset = this.leftOffsets.get(field);\n if (leftOffset !== undefined) {\n if (!cellEl.classList.contains(GridClasses.STICKY_LEFT)) {\n cellEl.classList.add(GridClasses.STICKY_LEFT);\n }\n cellEl.style.position = 'sticky';\n cellEl.style.left = leftOffset + 'px';\n } else {\n const rightOffset = this.rightOffsets.get(field);\n if (rightOffset !== undefined) {\n if (!cellEl.classList.contains(GridClasses.STICKY_RIGHT)) {\n cellEl.classList.add(GridClasses.STICKY_RIGHT);\n }\n cellEl.style.position = 'sticky';\n cellEl.style.right = rightOffset + 'px';\n }\n }\n\n // Maintain group-end adjustments at pin boundaries\n if (this.#groupEndAdjustments.addGroupEnd.has(field)) {\n context.cellElement.classList.add('group-end');\n } else if (this.#groupEndAdjustments.removeGroupEnd.has(field)) {\n context.cellElement.classList.remove('group-end');\n }\n }\n\n /**\n * Handle horizontal scroll to manage floating group labels.\n *\n * When an explicit column group has a mix of pinned and non-pinned columns,\n * the label starts in the scrollable fragment and floats toward the pinned\n * column via CSS `position: sticky`. Once the scrollable fragment scrolls\n * far enough that the label would be clipped, this hook transfers the label\n * into the sticky pinned fragment and applies `.group-end` to the pinned\n * column cells, creating a visual separator. Scrolling back reverses the\n * transfer.\n * @internal\n */\n override onScroll(_event: ScrollEvent): void {\n this.#updateSplitGroupScroll();\n }\n\n /**\n * Apply scroll-driven state to split group headers.\n *\n * Handles both the manual translateX positioning (simulating sticky) and the\n * transfer of the label into/out of the pinned fragment with `.group-end`.\n * Called from `onScroll` on every scroll event and from `afterRender` after\n * the split group DOM is rebuilt (e.g. after selection click triggers re-render).\n */\n #updateSplitGroupScroll(): void {\n if (!this.isApplied || this.#splitGroups.length === 0) return;\n\n const host = this.gridElement;\n\n for (const sg of this.#splitGroups) {\n const pinnedRect = sg.pinnedFragment.getBoundingClientRect();\n const scrollableRect = sg.scrollableFragment.getBoundingClientRect();\n\n // Transfer when the non-pinned fragment's right edge reaches the pinned\n // fragment's right edge — all non-pinned columns scrolled behind the pin.\n const shouldTransfer = scrollableRect.right <= pinnedRect.right;\n\n if (shouldTransfer && !sg.isTransferred) {\n // Move label into the pinned fragment\n sg.pinnedFragment.textContent = sg.label;\n sg.pinnedFragment.style.overflow = 'hidden';\n sg.pinnedFragment.style.textOverflow = 'ellipsis';\n sg.pinnedFragment.style.whiteSpace = 'nowrap';\n sg.pinnedFragment.style.borderRightStyle = '';\n sg.floatLabel.style.visibility = 'hidden';\n sg.floatLabel.style.transform = '';\n sg.floatOffset = 0;\n\n // Add group-end to pinned column header + body cells\n this.#groupEndAdjustments.addGroupEnd.add(sg.pinnedField);\n host\n .querySelectorAll(\n `.header-row .cell[data-field=\"${sg.pinnedField}\"], .data-grid-row .cell[data-field=\"${sg.pinnedField}\"]`,\n )\n .forEach((el) => el.classList.add('group-end'));\n\n sg.isTransferred = true;\n } else if (!shouldTransfer && sg.isTransferred) {\n // Reverse transfer — label goes back to the floating span\n sg.pinnedFragment.textContent = '';\n sg.pinnedFragment.style.overflow = '';\n sg.pinnedFragment.style.textOverflow = '';\n sg.pinnedFragment.style.whiteSpace = '';\n sg.pinnedFragment.style.borderRightStyle = 'none';\n sg.floatLabel.style.visibility = '';\n sg.floatLabel.style.transform = '';\n sg.floatOffset = 0;\n\n // Remove group-end from pinned column cells\n this.#groupEndAdjustments.addGroupEnd.delete(sg.pinnedField);\n host\n .querySelectorAll(\n `.header-row .cell[data-field=\"${sg.pinnedField}\"], .data-grid-row .cell[data-field=\"${sg.pinnedField}\"]`,\n )\n .forEach((el) => el.classList.remove('group-end'));\n\n sg.isTransferred = false;\n }\n\n // Manually position the floating label to simulate sticky behavior.\n // CSS sticky can't be used because .header-group-cell has overflow:hidden.\n // We track the current translateX offset to correctly compute the span's\n // natural (un-translated) position from its measured rect.\n if (!sg.isTransferred) {\n const spanRect = sg.floatLabel.getBoundingClientRect();\n const spanNaturalLeft = spanRect.left - sg.floatOffset;\n const targetLeft = pinnedRect.left;\n if (spanNaturalLeft < targetLeft) {\n sg.floatOffset = targetLeft - spanNaturalLeft;\n sg.floatLabel.style.transform = `translateX(${sg.floatOffset}px)`;\n } else {\n sg.floatOffset = 0;\n sg.floatLabel.style.transform = '';\n }\n }\n }\n }\n\n /**\n * Handle inter-plugin queries.\n * @internal\n */\n override handleQuery(query: PluginQuery): unknown {\n switch (query.type) {\n case QUERY_CAN_MOVE_COLUMN: {\n // Prevent pinned columns from being moved/reordered.\n // Pinned columns have fixed positions and should not be draggable.\n const column = query.context as ColumnConfig;\n if (getColumnPinned(column) != null) {\n return false;\n }\n return undefined; // Let other plugins or default behavior decide\n }\n case 'getStickyOffsets': {\n // Return the calculated sticky offsets for column virtualization\n return {\n left: Object.fromEntries(this.leftOffsets),\n right: Object.fromEntries(this.rightOffsets),\n };\n }\n case 'getContextMenuItems': {\n const params = query.context as ContextMenuParams;\n if (!params.isHeader) return undefined;\n\n const column = params.column as ColumnConfig;\n if (!column?.field) return undefined;\n\n // Don't offer pin/unpin for locked-pinning columns\n // (top-level `lockPinning` preferred; legacy `meta.lockPinning` honored for back-compat)\n if (column.lockPinning || column.meta?.lockPinning) return undefined;\n\n const pinned = getColumnPinned(column);\n const isPinned = pinned != null;\n const items: HeaderContextMenuItem[] = [];\n\n if (isPinned) {\n items.push({\n id: 'pinned/unpin',\n label: 'Unpin Column',\n icon: '📌',\n order: 40,\n action: () => this.setPinPosition(column.field, undefined),\n });\n } else {\n items.push({\n id: 'pinned/pin-left',\n label: 'Pin Left',\n icon: '⬅',\n order: 40,\n action: () => this.setPinPosition(column.field, 'left'),\n });\n items.push({\n id: 'pinned/pin-right',\n label: 'Pin Right',\n icon: '➡',\n order: 41,\n action: () => this.setPinPosition(column.field, 'right'),\n });\n }\n\n return items;\n }\n default:\n return undefined;\n }\n }\n // #endregion\n\n // #region Public API\n\n /**\n * Set the pin position for a column.\n * Updates the column's `pinned` property and triggers a full re-render.\n *\n * @param field - The field name of the column to pin/unpin\n * @param position - The pin position (`'left'`, `'right'`, `'start'`, `'end'`), or `undefined` to unpin\n */\n setPinPosition(field: string, position: PinnedPosition | undefined): void {\n // Read the currently-visible columns from the plugin accessor.\n // These are the post-processColumns result, which is the authoritative column set.\n const currentColumns = this.columns;\n if (!currentColumns?.length) return;\n\n const currentIndex = currentColumns.findIndex((col) => col.field === field);\n if (currentIndex === -1) return;\n\n const gridEl = this.gridElement as HTMLElement & { columns?: ColumnConfig[] };\n\n if (position) {\n // PINNING: snapshot original column order if this is the first context-menu pin.\n // The snapshot lets us restore columns to their original positions on unpin.\n if (this.#originalColumnOrder.length === 0) {\n this.#originalColumnOrder = currentColumns.map((c) => c.field);\n }\n\n // Set the pinned property; processColumns will reorder on next render\n const updated = currentColumns.map((col) => {\n if (col.field !== field) return col;\n const copy = { ...col };\n (copy as ColumnConfig & { pinned?: PinnedPosition }).pinned = position;\n return copy;\n });\n\n gridEl.columns = updated;\n } else {\n // UNPINNING: restore column to its original position\n const col = currentColumns[currentIndex];\n const copy = { ...col };\n delete (copy as ColumnConfig & { pinned?: PinnedPosition }).pinned;\n\n // Remove from current position\n const remaining = [...currentColumns];\n remaining.splice(currentIndex, 1);\n\n // Find the best insertion point using the original order snapshot\n const originalIndex = this.#originalColumnOrder.indexOf(field);\n if (originalIndex >= 0) {\n // Scan remaining non-pinned columns and find the first whose original\n // position is greater than this column's original position.\n let insertIndex = remaining.length;\n for (let i = 0; i < remaining.length; i++) {\n if (getColumnPinned(remaining[i])) continue; // skip pinned columns\n const otherOriginal = this.#originalColumnOrder.indexOf(remaining[i].field);\n if (otherOriginal > originalIndex) {\n insertIndex = i;\n break;\n }\n }\n remaining.splice(insertIndex, 0, copy);\n } else {\n // Original position unknown — keep at current index\n remaining.splice(Math.min(currentIndex, remaining.length), 0, copy);\n }\n\n // If no more pinned columns remain, clear the snapshot\n if (!remaining.some((c) => getColumnPinned(c) != null)) {\n this.#originalColumnOrder = [];\n }\n\n gridEl.columns = remaining;\n }\n }\n\n /**\n * Re-apply sticky offsets (e.g., after column resize).\n */\n refreshStickyOffsets(): void {\n const columns = [...this.columns];\n const result = applyStickyOffsets(this.gridElement, columns);\n this.#groupEndAdjustments = result.groupEndAdjustments;\n this.leftOffsets = result.leftOffsets;\n this.rightOffsets = result.rightOffsets;\n this.#splitGroups = result.splitGroups;\n }\n\n /**\n * Get columns pinned to the left (after resolving logical positions for current direction).\n */\n getLeftPinnedColumns(): ColumnConfig[] {\n const columns = [...this.columns];\n const direction = getDirection(this.gridElement);\n return getLeftStickyColumns(columns, direction);\n }\n\n /**\n * Get columns pinned to the right (after resolving logical positions for current direction).\n */\n getRightPinnedColumns(): ColumnConfig[] {\n const columns = [...this.columns];\n const direction = getDirection(this.gridElement);\n return getRightStickyColumns(columns, direction);\n }\n\n /**\n * Clear all sticky positioning.\n */\n clearStickyPositions(): void {\n clearStickyOffsets(this.gridElement);\n }\n\n /**\n * Report horizontal scroll boundary offsets for pinned columns.\n * Used by keyboard navigation to ensure focused cells aren't hidden behind sticky columns.\n * @internal\n */\n override getHorizontalScrollOffsets(\n rowEl?: HTMLElement,\n focusedCell?: HTMLElement,\n ): { left: number; right: number; skipScroll?: boolean } | undefined {\n if (!this.isApplied) {\n return undefined;\n }\n\n let left = 0;\n let right = 0;\n\n if (rowEl) {\n // Calculate from rendered cells in the row\n const stickyLeftCells = rowEl.querySelectorAll(`.${GridClasses.STICKY_LEFT}`);\n const stickyRightCells = rowEl.querySelectorAll(`.${GridClasses.STICKY_RIGHT}`);\n stickyLeftCells.forEach((el) => {\n left += (el as HTMLElement).offsetWidth;\n });\n stickyRightCells.forEach((el) => {\n right += (el as HTMLElement).offsetWidth;\n });\n } else {\n // Fall back to header row if no row element provided\n const host = this.gridElement;\n const headerCells = host.querySelectorAll('.header-row .cell');\n headerCells.forEach((cell) => {\n if (cell.classList.contains(GridClasses.STICKY_LEFT)) {\n left += (cell as HTMLElement).offsetWidth;\n } else if (cell.classList.contains(GridClasses.STICKY_RIGHT)) {\n right += (cell as HTMLElement).offsetWidth;\n }\n });\n }\n\n // Skip horizontal scrolling if focused cell is pinned (it's always visible)\n const skipScroll =\n focusedCell?.classList.contains(GridClasses.STICKY_LEFT) ||\n focusedCell?.classList.contains(GridClasses.STICKY_RIGHT);\n\n return { left, right, skipScroll };\n }\n // #endregion\n}\n"],"names":["getColumnPinned","col","pinned","meta","resolveStickyPosition","position","direction","resolveInlinePosition","isResolvedLeft","isResolvedRight","hasStickyColumns","columns","i","length","applyStickyOffsets","host","emptyResult","groupEndAdjustments","addGroupEnd","Set","removeGroupEnd","leftOffsets","Map","rightOffsets","splitGroups","headerCells","Array","from","querySelectorAll","getDirection","left","cell","find","c","getAttribute","field","set","classList","add","GridClasses","STICKY_LEFT","style","forEach","el","offsetWidth","right","reverse","STICKY_RIGHT","adjustments","groupCells","groupCell","gridCol","gridColumn","match","startIdx","parseInt","endIdx","spannedColumns","slice","allLeft","every","allRight","firstField","firstCell","lastField","lastCell","contains","splitMixedPinImplicitGroup","someLeft","some","someRight","splitMixedPinExplicitGroup","applyGroupHeaderStickyOffsets","size","hCell","remove","getPinState","runs","state","prev","cols","push","colStart","parent","parentElement","nextSibling","removeChild","run","document","createElement","className","setAttribute","String","startsWith","borderRightStyle","insertBefore","appendChild","ri","nextRun","lastPinnedField","_adjustments","label","textContent","groupId","firstLeftRunIdx","findIndex","r","lastRightRunIdx","pinnedRunIdx","floatRunIdx","pinnedFragment","scrollableFragment","floatLabel","pinnedField","borderLeftStyle","overflow","span","zIndex","display","textOverflow","whiteSpace","isTransferred","floatOffset","clearStickyOffsets","QUERY_CAN_MOVE_COLUMN","PinnedColumnsPlugin","BaseGridPlugin","static","hookPriority","processColumns","ownedProperties","property","level","description","isUsed","v","queries","type","name","defaultConfig","isApplied","originalColumnOrder","detach","this","clear","detect","rows","config","isArray","gridElement","middle","reorderColumnsForPinning","afterRender","queueMicrotask","result","updateSplitGroupScroll","afterCellRender","context","column","cellEl","cellElement","leftOffset","get","rightOffset","has","onScroll","_event","sg","pinnedRect","getBoundingClientRect","shouldTransfer","visibility","transform","delete","spanNaturalLeft","targetLeft","handleQuery","query","Object","fromEntries","params","isHeader","lockPinning","items","id","icon","order","action","setPinPosition","currentColumns","currentIndex","gridEl","map","updated","copy","remaining","splice","originalIndex","indexOf","insertIndex","Math","min","refreshStickyOffsets","getLeftPinnedColumns","filter","getLeftStickyColumns","getRightPinnedColumns","getRightStickyColumns","clearStickyPositions","getHorizontalScrollOffsets","rowEl","focusedCell","stickyLeftCells","stickyRightCells","skipScroll"],"mappings":"ueAkBO,SAASA,EAAgBC,GAC9B,OAAOA,EAAIC,QAAUD,EAAIE,MAAMD,MACjC,CAaO,SAASE,EAAsBC,EAA0BC,GAC9D,OAAOC,EAAAA,sBAAsBF,EAAUC,EACzC,CAKA,SAASE,EAAeP,EAAUK,GAChC,MAAMJ,EAASF,EAAgBC,GAC/B,QAAKC,GAC+C,SAA7CE,EAAsBF,EAAQI,EACvC,CAKA,SAASG,EAAgBR,EAAUK,GACjC,MAAMJ,EAASF,EAAgBC,GAC/B,QAAKC,GAC+C,UAA7CE,EAAsBF,EAAQI,EACvC,CA8BO,SAASI,EAAiBC,GAC/B,IAAA,IAASC,EAAI,EAAGA,EAAID,EAAQE,OAAQD,IAClC,GAAyB,MAArBD,EAAQC,GAAGV,QAA6C,MAA3BS,EAAQC,GAAGT,MAAMD,OAAgB,OAAO,EAE3E,OAAO,CACT,CA4HO,SAASY,EAAmBC,EAAmBJ,GACpD,MAAMK,EAAmC,CACvCC,oBAAqB,CAAEC,YAAa,IAAIC,IAAOC,eAAgB,IAAID,KACnEE,gBAAiBC,IACjBC,iBAAkBD,IAClBE,YAAa,IAITC,EAAcC,MAAMC,KAAKZ,EAAKa,iBAAiB,sBACrD,IAAKH,EAAYZ,OAAQ,OAAOG,EAGhC,MAAMV,EAAYuB,EAAAA,aAAad,GAGzBM,MAAkBC,IAClBC,MAAmBD,IAGzB,IAAIQ,EAAO,EACX,IAAA,MAAW7B,KAAOU,EAChB,GAAIH,EAAeP,EAAKK,GAAY,CAClC,MAAMyB,EAAON,EAAYO,KAAMC,GAAMA,EAAEC,aAAa,gBAAkBjC,EAAIkC,OACtEJ,IACFV,EAAYe,IAAInC,EAAIkC,MAAOL,GAC3BC,EAAKM,UAAUC,IAAIC,EAAAA,YAAYC,aAC/BT,EAAKU,MAAMpC,SA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