@alaarab/ogrid-core 2.5.6 → 2.5.7
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/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
2
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}function z(t){return t.map(e=>
|
|
3
|
-
`);j(a,r??`export_${new Date().toISOString().slice(0,10)}.csv`);}function j(t,e){let n=new Blob([t],{type:"text/csv;charset=utf-8;"}),r=URL.createObjectURL(n),o=document.createElement("a");try{o.setAttribute("href",r),o.setAttribute("download",e),o.style.visibility="hidden",document.body.appendChild(o),o.click();}finally{try{document.body.removeChild(o);}catch{}URL.revokeObjectURL(r);}}function x(t,e){return e.valueGetter?e.valueGetter(t):t[e.columnId]}function h(t,e){return t.editable===true||typeof t.editable=="function"&&t.editable(e)}function fe(t,e){return {getCellValue:(n,r)=>r<0||r>=t.length||n<0||n>=e.length?null:x(t[r],e[n]),getRowCount:()=>t.length,getColumnCount:()=>e.length}}function k(t){return "children"in t&&Array.isArray(t.children)}function K(t){let e=[];for(let n of t)k(n)?e.push(...K(n.children)):e.push(n);return e}function pe(t,e){function n(m,c){let s=c;for(let d of m)k(d)&&(s=Math.max(s,n(d.children,c+1)));return s}let r=n(t,0);if(r===0){let m=[];for(let c of t)if(!k(c)){if(e&&!e.has(c.columnId))continue;m.push({label:c.name,colSpan:1,isGroup:false,columnDef:c,depth:0});}return [m]}let o=r+1,l=Array.from({length:o},()=>[]),i=new Map;function a(m){let c=i.get(m);if(c!==void 0)return c;let s=0;for(let d of m)k(d)?s+=a(d.children):(!e||e.has(d.columnId))&&s++;return i.set(m,s),s}function u(m,c){for(let s of m)if(k(s)){let d=a(s.children);if(d===0)continue;l[c].push({label:s.headerName,colSpan:d,isGroup:true,depth:c}),u(s.children,c+1);}else {if(e&&!e.has(s.columnId))continue;l[c].push({label:s.name,colSpan:1,isGroup:false,columnDef:s,depth:c});}}return u(t,0),l.filter(m=>m.length>0)}function v(t){return t!=null&&typeof t=="object"&&"type"in t}function w(t){return (v(t.filterable)?t.filterable:null)?.filterField??t.columnId}function ge(t,e,n){if(n===void 0||n.type==="text"&&n.value.trim()===""||n.type==="multiSelect"&&n.value.length===0||n.type==="date"&&!n.value.from&&!n.value.to||n.type==="people"&&!n.value){let{[e]:o,...l}=t;return l}return {...t,[e]:n}}function Ce(t,e){let n=[];for(let l=0;l<e.length;l++){let i=e[l];(v(i.filterable)?i.filterable:null)?.type==="multiSelect"&&n.push({col:i,field:w(i)});}if(n.length===0)return {};let r=new Map;for(let l=0;l<n.length;l++)r.set(n[l].field,new Set);for(let l=0;l<t.length;l++){let i=t[l];for(let a=0;a<n.length;a++){let u=x(i,n[a].col),m=r.get(n[a].field);u!=null&&u!==""&&m&&m.add(String(u));}}let o={};for(let l=0;l<n.length;l++){let i=r.get(n[l].field);o[n[l].field]=i?Array.from(i).sort():[];}return o}function Ie(t){let e=[];for(let n of t)(v(n.filterable)?n.filterable:null)?.type==="multiSelect"&&e.push(w(n));return e}function be(t){let{totalCount:e,filteredCount:n,selectedCount:r,selectedCellCount:o,aggregation:l,suppressRowCount:i}=t,a=[];return i||a.push({key:"total",label:"Rows:",value:e}),n!==void 0&&n!==e&&a.push({key:"filtered",label:"Filtered:",value:n}),r!==void 0&&r>0&&a.push({key:"selected",label:"Selected:",value:r}),o!==void 0&&o>1&&a.push({key:"cells",label:"Cells:",value:o}),l&&(a.push({key:"sum",label:"Sum:",value:l.sum}),a.push({key:"avg",label:"Avg:",value:Math.round(l.avg*100)/100}),a.push({key:"min",label:"Min:",value:l.min}),a.push({key:"max",label:"Max:",value:l.max}),a.push({key:"count",label:"Count:",value:l.count})),a}function xe(t,e,n,r){return t?typeof t=="object"?t:{totalCount:e,selectedCount:n>0?n:void 0,filteredCount:r!==void 0&&r!==e?r:void 0}:null}var Z=[10,25,50,100];function Ot(t,e){return e.includes(t)?e:[...e,t].sort((n,r)=>n-r)}var Q=5;function he(t,e,n,r){if(n<=0)return null;let o=r?.maxPageButtons??Q,l=Math.ceil(n/e),i,a,u;if(l<=o){i=[];for(let s=1;s<=l;s++)i.push(s);a=false,u=false;}else {let s=Math.max(1,t-2),d=Math.min(l,t+2);d-s+1<o&&(s===1?d=Math.min(l,s+o-1):d===l&&(s=Math.max(1,d-o+1))),i=[];for(let f=s;f<=d;f++)i.push(f);a=s>1,u=d<l;}let m=Math.max(1,(t-1)*e+1),c=Math.min(t*e,n);return {totalPages:l,pageNumbers:i,showStartEllipsis:a,showEndEllipsis:u,startItem:m,endItem:c,pageSizeOptions:Ot(e,r?.pageSizeOptions??Z)}}var Re=[{id:"undo",label:"Undo",shortcut:"Ctrl+Z"},{id:"redo",label:"Redo",shortcut:"Ctrl+Y"},{id:"copy",label:"Copy",shortcut:"Ctrl+C",disabledWhenNoSelection:true,dividerBefore:true},{id:"cut",label:"Cut",shortcut:"Ctrl+X",disabledWhenNoSelection:true},{id:"paste",label:"Paste",shortcut:"Ctrl+V"},{id:"selectAll",label:"Select all",shortcut:"Ctrl+A",dividerBefore:true}];function ye(t){return typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?t.replace("Ctrl","\u2318"):t}function Te(t){let{onCopy:e,onCut:n,onPaste:r,onSelectAll:o,onUndo:l,onRedo:i,onClose:a}=t;return {undo:()=>{l(),a();},redo:()=>{i(),a();},copy:()=>{e(),a();},cut:()=>{n(),a();},paste:()=>{r(),a();},selectAll:()=>{o(),a();}}}var Se=[{id:"pinLeft",label:"Pin left"},{id:"pinRight",label:"Pin right"},{id:"unpin",label:"Unpin"}];function we(t){let{canPinLeft:e,canPinRight:n,canUnpin:r,currentSort:o,isSortable:l=true,isResizable:i=true}=t,a=[];if(a.push({id:"pinLeft",label:"Pin left",disabled:!e},{id:"pinRight",label:"Pin right",disabled:!n},{id:"unpin",label:"Unpin",disabled:!r,divider:l||i}),l)if(!o)a.push({id:"sortAsc",label:"Sort ascending"},{id:"sortDesc",label:"Sort descending",divider:i});else {let u=o==="asc"?"desc":"asc",m=o==="asc"?"Sort descending":"Sort ascending";a.push({id:`sort${u==="asc"?"Asc":"Desc"}`,label:m},{id:"clearSort",label:"Clear sort",divider:i});}return i&&a.push({id:"autosizeThis",label:"Autosize this column"},{id:"autosizeAll",label:"Autosize all columns"}),a}function T(t,e,n,r){if(r.valueParser){let l={newValue:t,oldValue:e,data:n,column:r},i=r.valueParser(l);return i===void 0?{valid:false,value:void 0}:{valid:true,value:i}}if(r.cellEditor==="select"&&r.cellEditorParams?.values!=null&&Array.isArray(r.cellEditorParams.values)){let l=r.cellEditorParams.values,i=typeof t=="string"?t:String(t??"");if(i==="")return {valid:true,value:""};let a=l.find(u=>String(u).toLowerCase()===i.toLowerCase());return a!==void 0?{valid:true,value:a}:{valid:false,value:void 0}}let o=r.type;if(o==="date"){let l=ee({newValue:t});return l===void 0?{valid:false,value:void 0}:{valid:true,value:l}}if(o==="boolean"){let l=te({newValue:t});return l===void 0?{valid:false,value:void 0}:{valid:true,value:l}}if(o==="numeric"){let l=J({newValue:t});return l===void 0?{valid:false,value:void 0}:{valid:true,value:l}}return {valid:true,value:t}}function J(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).replace(/[\s,]/g,""),r=Number(n);return Number.isNaN(r)?void 0:r}function De(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).replace(/[$\u20AC\u00A3\u00A5]/g,"").replace(/[\s,]/g,""),r=Number(n);return Number.isNaN(r)?void 0:r}function ee(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).trim(),r=new Date(n);if(!Number.isNaN(r.getTime()))return r.toISOString()}function ve(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).trim();return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?n:void 0}function te(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).trim().toLowerCase();if(["true","yes","1"].includes(n))return true;if(["false","no","0"].includes(n))return false}function Ee(t,e,n){if(!n)return null;let r=R(n),o=0,l=0,i=1/0,a=-1/0,u=0;for(let m=r.startRow;m<=r.endRow;m++)for(let c=r.startCol;c<=r.endCol;c++){if(m>=t.length||c>=e.length)continue;o++;let s=t[m],d=e[c],f=x(s,d),p=typeof f=="number"?f:Number(f);!isNaN(p)&&isFinite(p)&&(l+=p,p<i&&(i=p),p>a&&(a=p),u++);}return o<2||u===0?null:{sum:l,avg:l/u,min:i,max:a,count:u}}var Fe=new WeakMap;function M(t,e,n,r,o){let l=Fe.get(e);if(!l){l=new Map;for(let m=0;m<e.length;m++)l.set(e[m].columnId,e[m]);Fe.set(e,l);}let i=[];for(let m=0;m<e.length;m++){let c=e[m],s=w(c),d=n[s];if(d)switch(d.type){case "multiSelect":if(d.value.length>0){let f=new Set(d.value);i.push(p=>f.has(String(x(p,c))));}break;case "text":{let f=d.value.trim();if(f){let p=f.toLowerCase(),g=new Map;for(let I=0;I<t.length;I++)g.set(t[I],String(x(t[I],c)??"").toLowerCase());i.push(I=>(g.get(I)??"").includes(p));}break}case "people":{let f=d.value.email.toLowerCase(),p=new Map;for(let g=0;g<t.length;g++)p.set(t[g],String(x(t[g],c)??"").toLowerCase());i.push(g=>(p.get(g)??"")===f);break}case "date":{let f=d.value,p=f.from?new Date(f.from+"T00:00:00").getTime():NaN,g=f.to?new Date(f.to+"T23:59:59.999").getTime():NaN,I=new Map;for(let C=0;C<t.length;C++){let b=x(t[C],c);if(b==null)I.set(t[C],NaN);else {let y=new Date(String(b)).getTime();I.set(t[C],Number.isNaN(y)?NaN:y);}}i.push(C=>{let b=I.get(C)??NaN;return !(Number.isNaN(b)||!Number.isNaN(p)&&b<p||!Number.isNaN(g)&&b>g)});break}}}let a=i.length>0,u=a?t.filter(m=>{for(let c=0;c<i.length;c++)if(!i[c](m))return false;return true}):t;if(r){let m=a?u:u.slice(),c=l.get(r),s=c?.compare,d=o==="asc"?1:-1;if(c?.type==="date"&&!s){let p=new Map;for(let g=0;g<m.length;g++){let I=m[g],C=c?x(I,c):I[r];if(C==null)p.set(I,NaN);else {let b=new Date(String(C)).getTime();p.set(I,Number.isNaN(b)?0:b);}}m.sort((g,I)=>{let C=p.get(g)??NaN,b=p.get(I)??NaN;return Number.isNaN(C)&&Number.isNaN(b)?0:Number.isNaN(C)?-1*d:Number.isNaN(b)?1*d:C===b?0:C>b?d:-d});}else if(s)m.sort((p,g)=>s(p,g)*d);else {let p=new Map;for(let g=0;g<m.length;g++){let I=m[g],C=c?x(I,c):I[r];C==null?p.set(I,void 0):typeof C=="number"?p.set(I,C):p.set(I,String(C).toLowerCase());}m.sort((g,I)=>{let C=p.get(g),b=p.get(I);return C===void 0&&b===void 0?0:C===void 0?-1*d:b===void 0?1*d:C===b?0:C>b?d:-d});}return m}return u}function D(t,e){if(!t)return false;let n=Math.min(t.startRow,t.endRow),r=Math.max(t.startRow,t.endRow);return e>=n&&e<=r}function Me(t,e){if(t.item!==e.item||t.isSelected!==e.isSelected||t.hasCheckboxCol!==e.hasCheckboxCol||t.visibleCols!==e.visibleCols||t.columnMeta!==e.columnMeta||t.cellClassMap!==e.cellClassMap||t.columnLayouts!==e.columnLayouts)return false;let n=t.rowIndex;if(t.editingRowId!==e.editingRowId&&(t.editingRowId===t.rowId||e.editingRowId===e.rowId))return false;let r=t.activeCell?.rowIndex===n,o=e.activeCell?.rowIndex===n;if(r!==o||r&&o&&t.activeCell?.columnIndex!==e.activeCell?.columnIndex)return false;let l=D(t.selectionRange,n),i=D(e.selectionRange,n);if(l!==i||l&&i&&(t.selectionRange?.startCol!==e.selectionRange?.startCol||t.selectionRange?.endCol!==e.selectionRange?.endCol))return false;let a=t.selectionRange?.endRow===n,u=e.selectionRange?.endRow===n;return !(a!==u||(a||u)&&t.isDragging!==e.isDragging||t.cutRange!==e.cutRange&&(D(t.cutRange,n)||D(e.cutRange,n))||t.copyRange!==e.copyRange&&(D(t.copyRange,n)||D(e.copyRange,n)))}function ne(t,e){return e?e.left?.includes(t)?"left":e.right?.includes(t)?"right":"unpinned":"unpinned"}function Ne(t,e,n){let r=t.filter(i=>i!==e),o=Math.max(0,Math.min(n,r.length)),l=[...r];return l.splice(o,0,e),l}function Pe(t){let{mouseX:e,columnOrder:n,draggedColumnId:r,draggedPinState:o,tableElement:l,pinnedColumns:i}=t,a=l.querySelectorAll("[data-column-id]");if(a.length===0)return null;let u=[];if(a.forEach(d=>{let f=d.getAttribute("data-column-id");if(!f||ne(f,i)!==o)return;let g=d.getBoundingClientRect(),I=n.indexOf(f);I!==-1&&u.push({columnId:f,left:g.left,right:g.right,midX:g.left+g.width/2,orderIndex:I});}),u.length===0)return null;u.sort((d,f)=>d.left-f.left);let m,c;if(e<=u[0].midX)m=u[0].orderIndex,c=u[0].left;else if(e>=u[u.length-1].midX){let d=u[u.length-1];m=d.orderIndex+1,c=d.right;}else {let d=-1;for(let f=0;f<u.length-1;f++)if(e>=u[f].midX&&e<u[f+1].midX){d=f;break}if(d===-1)return null;m=u[d].orderIndex+1,c=u[d].right;}let s=n.indexOf(r);return s===m||s+1===m?{targetIndex:m,indicatorX:null}:{targetIndex:m,indicatorX:c}}function Ae(t,e,n,r=2){if(e.length===0||n<=0)return {startIndex:0,endIndex:-1,leftOffset:0,rightOffset:0};let o=0,l=e.length,i=-1;for(let s=0;s<e.length;s++){let d=o;o+=e[s],o>t&&l===e.length&&(l=s),d<t+n&&(i=s);}if(l>i)return {startIndex:0,endIndex:-1,leftOffset:0,rightOffset:0};let a=Math.max(0,l-r),u=Math.min(e.length-1,i+r),m=0;for(let s=0;s<a;s++)m+=e[s];let c=0;for(let s=u+1;s<e.length;s++)c+=e[s];return {startIndex:a,endIndex:u,leftOffset:m,rightOffset:c}}function Oe(t,e,n){let r=[],o=[],l=[];for(let a of t){let u=n?.[a.columnId];u==="left"?r.push(a):u==="right"?o.push(a):l.push(a);}if(!e||e.endIndex<0)return {pinnedLeft:r,virtualizedUnpinned:l,pinnedRight:o,leftSpacerWidth:0,rightSpacerWidth:0};let i=l.slice(e.startIndex,e.endIndex+1);return {pinnedLeft:r,virtualizedUnpinned:i,pinnedRight:o,leftSpacerWidth:e.leftOffset,rightSpacerWidth:e.rightOffset}}function _e(t,e,n,r,o=5){if(r<=0||e<=0||n<=0)return {startIndex:0,endIndex:0,offsetTop:0,offsetBottom:0};let l=Math.max(0,Math.floor(t/e)-o),i=Math.min(r-1,Math.ceil((t+n)/e)+o),a=l*e,u=Math.max(0,(r-i-1)*e);return {startIndex:l,endIndex:i,offsetTop:a,offsetBottom:u}}function ke(t,e){return t*e}function Le(t,e,n,r="start"){let o=t*e;switch(r){case "start":return o;case "center":return Math.max(0,o-(n-e)/2);case "end":return Math.max(0,o-n+e)}}function Ve(){let t=self;t.onmessage=e=>{let n=e.data;if(n.type!=="sort-filter")return;let{requestId:r,values:o,filters:l,sort:i}=n,a=o.length,u=[],m=Object.entries(l);if(m.length===0){u=new Array(a);for(let s=0;s<a;s++)u[s]=s;}else for(let s=0;s<a;s++){let d=true;for(let f=0;f<m.length;f++){let p=Number(m[f][0]),g=m[f][1],I=o[s][p];switch(g.type){case "text":{let C=g.value.trim().toLowerCase();C&&!String(I??"").toLowerCase().includes(C)&&(d=false);break}case "multiSelect":{g.value.length>0&&(new Set(g.value).has(String(I??""))||(d=false));break}case "date":{if(I==null){d=false;break}let C=new Date(String(I)).getTime();if(isNaN(C)){d=false;break}if(g.value.from){let b=new Date(g.value.from+"T00:00:00").getTime();if(C<b){d=false;break}}if(g.value.to){let b=new Date(g.value.to+"T23:59:59.999").getTime();if(C>b){d=false;break}}break}}if(!d)break}d&&u.push(s);}if(i){let{columnIndex:s,direction:d}=i,f=d==="asc"?1:-1;u.sort((p,g)=>{let I=o[p][s],C=o[g][s];if(I==null&&C==null)return 0;if(I==null)return -1*f;if(C==null)return 1*f;if(typeof I=="number"&&typeof C=="number")return I===C?0:I>C?f:-f;let b=String(I).toLowerCase(),y=String(C).toLowerCase();return b===y?0:b>y?f:-f});}let c={type:"sort-filter-result",requestId:r,indices:u};t.postMessage(c);};}var S=null,_t=0,E=new Map;function re(){if(S)return S;if(typeof Worker>"u"||typeof Blob>"u"||typeof URL>"u")return null;try{let t=Ve.toString(),e=new Blob([`(${t})()`],{type:"application/javascript"}),n=URL.createObjectURL(e);return S=new Worker(n),URL.revokeObjectURL(n),S.onmessage=r=>{let{requestId:o,indices:l}=r.data,i=E.get(o);i&&(E.delete(o),i.resolve(l));},S.onerror=r=>{for(let[o,l]of E)l.reject(new Error(r.message||"Worker error")),E.delete(o);},S}catch{return null}}function Ue(){S&&(S.terminate(),S=null);for(let[t,e]of E)e.reject(new Error("Worker terminated")),E.delete(t);}function oe(t,e){let n=new Array(t.length);for(let r=0;r<t.length;r++){let o=new Array(e.length);for(let l=0;l<e.length;l++){let i=x(t[r],e[l]);i==null?o[l]=null:typeof i=="string"||typeof i=="number"||typeof i=="boolean"?o[l]=i:o[l]=String(i);}n[r]=o;}return n}function He(t,e,n,r,o){if(r&&e.find(f=>f.columnId===r)?.compare)return Promise.resolve(M(t,e,n,r,o));let l=re();if(!l)return Promise.resolve(M(t,e,n,r,o));let i=new Map;for(let d=0;d<e.length;d++)i.set(e[d].columnId,d);let a=oe(t,e),u=e.map((d,f)=>({type:d.type??"text",index:f})),m={};for(let d of e){let f=w(d),p=n[f];if(!p)continue;let g=i.get(d.columnId);if(g!==void 0)switch(p.type){case "text":m[g]={type:"text",value:p.value};break;case "multiSelect":m[g]={type:"multiSelect",value:p.value};break;case "date":m[g]={type:"date",value:{from:p.value.from,to:p.value.to}};break;case "people":return Promise.resolve(M(t,e,n,r,o))}}let c;if(r){let d=i.get(r);d!==void 0&&(c={columnIndex:d,direction:o??"asc"});}let s=++_t;return new Promise((d,f)=>{E.set(s,{resolve:g=>{let I=new Array(g.length);for(let C=0;C<g.length;C++)I[C]=t[g[C]];d(I);},reject:f});let p={type:"sort-filter",requestId:s,values:a,columnMeta:u,filters:m,sort:c};l.postMessage(p);})}var H="YYYY-MM-DD";function B(t,e,n="UTC"){if(t==null)return null;let r=t instanceof Date?t:new Date(String(t));if(Number.isNaN(r.getTime()))return null;let o,l,i;if(n==="UTC")o=r.getUTCFullYear(),l=r.getUTCMonth()+1,i=r.getUTCDate();else {let s=new Intl.DateTimeFormat("en-CA",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(r);o=parseInt(s.find(d=>d.type==="year")?.value??"0",10),l=parseInt(s.find(d=>d.type==="month")?.value??"0",10),i=parseInt(s.find(d=>d.type==="day")?.value??"0",10);}let a=String(o).padStart(4,"0"),u=String(l).padStart(2,"0"),m=String(i).padStart(2,"0");return e.replace("YYYY",a).replace("MM",u).replace("DD",m)}function Be(t,e){if(!t||!t.trim())return null;let r=t.trim().split(/[/\-.\s]+/).filter(Boolean);if(r.length===0)return null;let o=new Date().getUTCFullYear(),l=kt(e),i,a,u;if(r.length===3){let[c,s,d]=r.map(Number);l==="YMD"?(i=c,a=s,u=d):l==="DMY"?(u=c,a=s,i=d):(a=c,u=s,i=d),i!==void 0&&i<100&&(i=i<50?2e3+i:1900+i);}else if(r.length===2){let[c,s]=r.map(Number);l==="DMY"?(u=c,a=s):(a=c,u=s),i=o;}else if(r.length===1){let c=r[0];if(/^\d+$/.test(c))if(c.length===8)i=parseInt(c.slice(0,4),10),a=parseInt(c.slice(4,6),10),u=parseInt(c.slice(6,8),10);else if(c.length===4)a=parseInt(c.slice(0,2),10),u=parseInt(c.slice(2,4),10),i=o;else return null;else return null}else return null;if(!Lt(i,a,u))return null;let m=new Date(Date.UTC(i,a-1,u));return m.getUTCFullYear()!==i||m.getUTCMonth()+1!==a||m.getUTCDate()!==u?null:m}function Ge(t){return t}function kt(t){let e=t.indexOf("Y"),n=t.indexOf("M"),r=t.indexOf("D");return e===-1||n===-1||r===-1?"MDY":e<n&&n<r?"YMD":r<n&&n<e?"DMY":"MDY"}function Lt(t,e,n){return !(t==null||e==null||n==null||!Number.isFinite(t)||!Number.isFinite(e)||!Number.isFinite(n)||e<1||e>12||n<1||n>31)}var L=class{constructor(e,n){this.type=e;this.message=n;}toString(){return this.type}};function $e(t,e){let n=v(t.filterable)?t.filterable:null,r=n?.type??"none",o=n?.filterField??t.columnId,l=t.sortable!==false,i=e.filters[o],a={columnKey:t.columnId,columnName:t.name,filterType:r,isSorted:e.sortBy===t.columnId,isSortedDescending:e.sortBy===t.columnId&&e.sortDirection==="desc",onSort:l?()=>e.onColumnSort(t.columnId):void 0};return r==="text"?{...a,textValue:i?.type==="text"?i.value:"",onTextChange:u=>e.onFilterChange(o,u.trim()?{type:"text",value:u}:void 0)}:r==="people"?{...a,selectedUser:i?.type==="people"?i.value:void 0,onUserChange:u=>e.onFilterChange(o,u?{type:"people",value:u}:void 0),peopleSearch:e.peopleSearch}:r==="multiSelect"?{...a,options:e.filterOptions[o]??[],isLoadingOptions:e.loadingFilterOptions[o]??false,selectedValues:i?.type==="multiSelect"?i.value:[],onFilterChange:u=>e.onFilterChange(o,u.length?{type:"multiSelect",value:u}:void 0)}:r==="date"?{...a,dateValue:i?.type==="date"?i.value:void 0,onDateChange:u=>e.onFilterChange(o,u?{type:"date",value:u}:void 0)}:a}var W=class W{constructor(){this.cache=new Map;this.lastVersion="";}static computeVersion(e){let n=e.editingCell,r=e.activeCell,o=e.selectionRange,l=e.cutRange,i=e.copyRange;return (n?`${String(n.rowId)}\0${n.columnId}`:"")+""+(r?`${r.rowIndex}\0${r.columnIndex}`:"")+""+(o?`${o.startRow}\0${o.startCol}\0${o.endRow}\0${o.endCol}`:"")+""+(l?`${l.startRow}\0${l.startCol}\0${l.endRow}\0${l.endCol}`:"")+""+(i?`${i.startRow}\0${i.startCol}\0${i.endRow}\0${i.endCol}`:"")+""+(e.isDragging?"1":"0")+""+(e.editable!==false?"1":"0")+""+(e.onCellValueChanged?"1":"0")+""+(e.formulaVersion??0)}get(e,n,r,o){let l=e*W.MAX_COL_STRIDE+n,i=this.cache.get(l);if(i!==void 0&&i.version===r)return i.descriptor;let a=o();return this.cache.set(l,{version:r,descriptor:a}),a}updateVersion(e){this.lastVersion=e;}get currentVersion(){return this.lastVersion}clear(){this.cache.clear();}};W.MAX_COL_STRIDE=1024;var G=W;function Xe(t,e,n,r,o,l){return l!==void 0?l.get(n,r,l.currentVersion,()=>We(t,e,n,r,o)):We(t,e,n,r,o)}function We(t,e,n,r,o){let l=o.getRowId(t),i=r+o.colOffset,a=h(e,t),u=o.editable!==false&&a&&!!o.onCellValueChanged&&typeof e.cellEditor!="function",m=o.editable!==false&&a&&!!o.onCellValueChanged&&typeof e.cellEditor=="function"&&e.cellEditorPopup!==false,c=u||m,s=o.editingCell?.rowId===l&&o.editingCell?.columnId===e.columnId,d=!o.isDragging&&o.activeCell?.rowIndex===n&&o.activeCell?.columnIndex===i,f=o.selectionRange!=null&&o.selectionRange.startRow===o.selectionRange.endRow&&o.selectionRange.startCol===o.selectionRange.endCol,p=o.selectionRange!=null&&!f&&F(o.selectionRange,n,r),g=o.cutRange!=null&&F(o.cutRange,n,r),I=o.copyRange!=null&&F(o.copyRange,n,r),C=!o.isDragging&&o.copyRange==null&&o.cutRange==null&&o.selectionRange!=null&&n===o.selectionRange.endRow&&r===o.selectionRange.endCol,b=e.pinned!=null,y=e.pinned??void 0,P=x(t,e),A=o.hasFormula?.(r,n)??false,U=A?o.getFormulaValue?.(r,n):void 0,q="display",O;s&&u?(q="editing-inline",e.cellEditor==="text"||e.cellEditor==="select"||e.cellEditor==="checkbox"||e.cellEditor==="richSelect"||e.cellEditor==="date"?O=e.cellEditor:e.type==="date"?O="date":e.type==="boolean"?O="checkbox":O="text"):s&&m&&typeof e.cellEditor=="function"&&(q="editing-popover");let At=s&&A?o.getFormula?.(r,n)??P:P;return {mode:q,editorType:O,value:At,isActive:d,isInRange:p,isInCutRange:g,isInCopyRange:I,isSelectionEndCell:C,canEditAny:c,isPinned:b,pinnedSide:y,globalColIndex:i,rowId:l,rowIndex:n,displayValue:U!==void 0?U:P,columnType:e.type}}function qe(t,e,n){if(n instanceof L)return n.toString();let r=t;if(r.renderCell&&typeof r.renderCell=="function")return r.renderCell(e);if(t.valueFormatter)return t.valueFormatter(n,e);if(n==null)return null;if(t.type==="date"){let o=t.dateFormat??H,l=B(n,o);if(l!==null)return l}return t.type==="boolean"?n?"True":"False":String(n)}function ze(t,e,n){let r=t,o=n instanceof L,l=r.cellStyle?typeof r.cellStyle=="function"?r.cellStyle(e):r.cellStyle:void 0;return o?{...l,color:"var(--ogrid-formula-error-color, #d32f2f)"}:l}function Ye(t,e,n,r){return {value:n.value,item:t,column:e,rowIndex:n.rowIndex,editorType:n.editorType??"text",onCommit:o=>r.commitCellEdit(t,e.columnId,n.value,o,n.rowIndex,n.globalColIndex),onCancel:()=>r.setEditingCell(null)}}function je(t,e,n,r,o){let l=n.value,i=r!==void 0?r:l,a=r;return {value:i,onValueChange:u=>{a=u,o.setPendingEditorValue(u);},onCommit:()=>{let u=a!==void 0?a:l;o.commitCellEdit(t,e.columnId,l,u,n.rowIndex,n.globalColIndex);},onCancel:o.cancelPopoverEdit,item:t,column:e,cellEditorParams:e.cellEditorParams}}function Ke(t,e){let n=null,r=((...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{t(...o),n=null;},e);});return r.cancel=()=>{n!==null&&(clearTimeout(n),n=null);},r}function Ze(t,e,n){let r=e.startCol+n,o=e.endCol+n,l=t.querySelector(`[data-row-index="${e.startRow}"][data-col-index="${r}"]`),i=t.querySelector(`[data-row-index="${e.endRow}"][data-col-index="${o}"]`);if(!l||!i)return null;let a=t.getBoundingClientRect(),u=l.getBoundingClientRect(),m=i.getBoundingClientRect();return {top:u.top-a.top,left:u.left-a.left,width:m.right-u.left,height:m.bottom-u.top}}function Qe(t){let e=new Map;if(!t)return e;let n=t.querySelectorAll("[data-row-index][data-col-index]");for(let r=0;r<n.length;r++){let o=n[r],l=o.getAttribute("data-row-index")??"",i=o.getAttribute("data-col-index")??"";e.set(`${l},${i}`,o);}return e}function Je(t,e){if(typeof document>"u"||document.getElementById(t))return;let n=document.createElement("style");n.id=t,n.textContent=e,document.head.appendChild(n);}function et(t,e,n){return n===null?{field:"",direction:"asc"}:n?{field:e,direction:n}:{field:e,direction:t.field===e&&t.direction==="asc"?"desc":"asc"}}var tt=48,nt=50,le=80,rt=16,ot=30,lt="__row_number__",it=6;var ie=16,ae=520;function Vt(t){let e=getComputedStyle(t),n=(parseFloat(e.paddingLeft)||0)+(parseFloat(e.paddingRight)||0),r=(parseFloat(e.borderLeftWidth)||0)+(parseFloat(e.borderRightWidth)||0),o=0;for(let s=0;s<t.children.length;s++){let d=t.children[s],f=d.className||"";if(f.includes("resizeHandle")||f.includes("resize-handle")||f.includes("ogrid-resize-handle")){o=d.offsetWidth;break}}let l=t.firstElementChild;if(!l)return t.offsetWidth;let i=[],a=s=>{for(let d=0;d<s.children.length;d++){let f=s.children[d],p=getComputedStyle(f);(p.overflow==="hidden"||p.flexShrink!=="0")&&(i.push({el:f,overflow:f.style.overflow,flexShrink:f.style.flexShrink,width:f.style.width,minWidth:f.style.minWidth,maxWidth:f.style.maxWidth}),f.style.overflow="visible",f.style.flexShrink="0",f.style.width="max-content",f.style.minWidth="max-content",f.style.maxWidth="none"),a(f);}},u=l.style.position,m=l.style.width;l.style.position="absolute",l.style.width="max-content",a(l);let c=l.offsetWidth;l.style.position=u,l.style.width=m;for(let s of i)s.el.style.overflow=s.overflow,s.el.style.flexShrink=s.flexShrink,s.el.style.width=s.width,s.el.style.minWidth=s.minWidth,s.el.style.maxWidth=s.maxWidth;return c+o+n+r}function at(t,e,n){let r=e??80,l=(n??document).querySelectorAll(`[data-column-id="${t}"]`);if(l.length===0)return r;let i=r,a=[],u=[],m=[];if(l.forEach(c=>{let s=c;if(!!s.querySelector?.("[data-header-label]"))i=Math.max(i,Vt(s));else {let f=s.firstElementChild??s;a.push(f);}}),a.length>0){for(let c=0;c<a.length;c++){let s=a[c];u.push(s.style.position),m.push(s.style.width),s.style.position="absolute",s.style.width="max-content";}for(let c=0;c<a.length;c++)i=Math.max(i,a[c].offsetWidth+ie);for(let c=0;c<a.length;c++)a[c].style.position=u[c],a[c].style.width=m[c];}return Math.min(ae,Math.max(r,Math.ceil(i)))}function N(t,e,n,r){if(t===e)return t;let o=t+n;if(!r(t)&&!r(o)){let i=o;for(;i!==e;){if(r(i+n))return i;i+=n;}return e}let l=o;for(;l!==e;){if(!r(l))return l;l+=n;}return e}function st(t,e,n,r,o,l){let i=t,a=e;return l?e>o?a=e-1:t>0&&(i=t-1,a=r):e<r?a=e+1:t<n&&(i=t+1,a=o),{rowIndex:i,columnIndex:a}}function ut(t){let{direction:e,rowIndex:n,columnIndex:r,dataColIndex:o,colOffset:l,maxRowIndex:i,maxColIndex:a,visibleColCount:u,isCtrl:m,isShift:c,selectionRange:s,isEmptyAt:d}=t,f=n,p=r;e==="ArrowDown"?f=m?N(n,i,1,b=>d(b,Math.max(0,o))):Math.min(n+1,i):e==="ArrowUp"?f=m?N(n,0,-1,b=>d(b,Math.max(0,o))):Math.max(n-1,0):e==="ArrowRight"?m&&o>=0?p=N(o,u-1,1,b=>d(n,b))+l:p=Math.min(r+1,a):m&&o>=0?p=N(o,0,-1,b=>d(n,b))+l:p=Math.max(r-1,l);let g=p-l,I=e==="ArrowDown"||e==="ArrowUp",C;return c?I?C=R({startRow:s?.startRow??n,startCol:s?.startCol??o,endRow:f,endCol:s?.endCol??o}):C=R({startRow:s?.startRow??n,startCol:s?.startCol??o,endRow:s?.endRow??n,endCol:g}):C={startRow:f,startCol:g,endRow:f,endCol:g},{newRowIndex:f,newColumnIndex:p,newDataColIndex:g,newRange:C}}function dt(t,e,n){let r=R(t),o=[];for(let l=r.startRow;l<=r.endRow;l++)for(let i=r.startCol;i<=r.endCol;i++){if(l>=e.length||i>=n.length)continue;let a=e[l],u=n[i];if(!h(u,a))continue;let m=x(a,u),c=T("",m,a,u);c.valid&&o.push({item:a,columnId:u.columnId,oldValue:m,newValue:c.value,rowIndex:l});}return o}function ct(t,e){return t===e?true:!t||!e?false:t.startRow===e.startRow&&t.endRow===e.endRow&&t.startCol===e.startCol&&t.endCol===e.endCol}function mt(t,e,n){return e<0||n<0?null:{startRow:Math.max(0,Math.min(t.startRow,e)),endRow:Math.max(0,Math.min(t.endRow,e)),startCol:Math.max(0,Math.min(t.startCol,n)),endCol:Math.max(0,Math.min(t.endCol,n))}}function ft(t,e=40,n=2,r=20){let o=Math.min(t/e,1);return n+o*(r-n)}function pt(t,e,n,r,o,l){let i=new Set(l),a=Math.min(t,e),u=Math.max(t,e);for(let m=a;m<=u;m++)if(m<r.length){let c=o(r[m]);n?i.add(c):i.delete(c);}return i}function gt(t,e,n){if(t.size===0||e.length===0)return {allSelected:false,someSelected:false};let r=t.size>=e.length&&e.every(l=>t.has(n(l))),o=!r&&t.size>0;return {allSelected:r,someSelected:o}}function se(t,e){let n=e!=null&&e!==""?e:t;if(n==null||n==="")return "";try{return String(n).replace(/[\t\n]/g," ")}catch{return "[Object]"}}function Ct(t,e,n,r){let o=R(n),l=[];for(let i=o.startRow;i<=o.endRow;i++){let a=[];for(let u=o.startCol;u<=o.endCol&&!(i>=t.length||u>=e.length);u++){let m=t[i],c=e[u];if(r?.hasFormula&&r?.getFormula){let p=r.flatColumns.findIndex(g=>g.columnId===c.columnId);if(p>=0&&r.hasFormula(p,i)){let g=r.getFormula(p,i);if(g){a.push(g);continue}}}let s=x(m,c),f=(c.clipboardFormatter?c.clipboardFormatter(s,m):null)??(c.valueFormatter?c.valueFormatter(s,m):s);a.push(se(s,f));}l.push(a.join(" "));}return l.join(`\r
|
|
4
|
-
`)}function
|
|
1
|
+
function me(t){if(t)return {id:t.id,displayName:t.displayName,email:"email"in t&&t.email?t.email:t.mail||t.userPrincipalName||"",photo:t.photo}}function F(t,e,n){let r=Math.min(t.startRow,t.endRow),o=Math.max(t.startRow,t.endRow),l=Math.min(t.startCol,t.endCol),i=Math.max(t.startCol,t.endCol);return e>=r&&e<=o&&n>=l&&n<=i}function R(t){return {startRow:Math.min(t.startRow,t.endRow),endRow:Math.max(t.startRow,t.endRow),startCol:Math.min(t.startCol,t.endCol),endCol:Math.max(t.startCol,t.endCol)}}function k(t){if(t==null)return "";let e=String(t);return e.includes(",")||e.includes('"')||e.includes(`
|
|
2
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}function z(t){return t.map(e=>k(e.name)).join(",")}function Y(t,e,n,r){return t.map((o,l)=>e.map(i=>{if(r?.exportMode==="formulas"&&r.hasFormula&&r.getFormula&&r.columnIdToIndex){let a=r.columnIdToIndex.get(i.columnId);if(a!==void 0&&r.hasFormula(a,l)){let u=r.getFormula(a,l);if(u)return k(u)}}return k(n(o,i.columnId))}).join(","))}function fe(t,e,n,r,o){let l=z(e),i=Y(t,e,n,o),a=[l,...i].join(`
|
|
3
|
+
`);j(a,r??`export_${new Date().toISOString().slice(0,10)}.csv`);}function j(t,e){let n=new Blob([t],{type:"text/csv;charset=utf-8;"}),r=URL.createObjectURL(n),o=document.createElement("a");try{o.setAttribute("href",r),o.setAttribute("download",e),o.style.visibility="hidden",document.body.appendChild(o),o.click();}finally{try{document.body.removeChild(o);}catch{}URL.revokeObjectURL(r);}}function x(t,e){return e.valueGetter?e.valueGetter(t):t[e.columnId]}function h(t,e){return t.editable===true||typeof t.editable=="function"&&t.editable(e)}function pe(t,e){return {getCellValue:(n,r)=>r<0||r>=t.length||n<0||n>=e.length?null:x(t[r],e[n]),getRowCount:()=>t.length,getColumnCount:()=>e.length}}function _(t){return "children"in t&&Array.isArray(t.children)}function K(t){let e=[];for(let n of t)_(n)?e.push(...K(n.children)):e.push(n);return e}function ge(t,e){function n(m,c){let s=c;for(let d of m)_(d)&&(s=Math.max(s,n(d.children,c+1)));return s}let r=n(t,0);if(r===0){let m=[];for(let c of t)if(!_(c)){if(e&&!e.has(c.columnId))continue;m.push({label:c.name,colSpan:1,isGroup:false,columnDef:c,depth:0});}return [m]}let o=r+1,l=Array.from({length:o},()=>[]),i=new Map;function a(m){let c=i.get(m);if(c!==void 0)return c;let s=0;for(let d of m)_(d)?s+=a(d.children):(!e||e.has(d.columnId))&&s++;return i.set(m,s),s}function u(m,c){for(let s of m)if(_(s)){let d=a(s.children);if(d===0)continue;l[c].push({label:s.headerName,colSpan:d,isGroup:true,depth:c}),u(s.children,c+1);}else {if(e&&!e.has(s.columnId))continue;l[c].push({label:s.name,colSpan:1,isGroup:false,columnDef:s,depth:c});}}return u(t,0),l.filter(m=>m.length>0)}function v(t){return t!=null&&typeof t=="object"&&"type"in t}function w(t){return (v(t.filterable)?t.filterable:null)?.filterField??t.columnId}function Ce(t,e,n){if(n===void 0||n.type==="text"&&n.value.trim()===""||n.type==="multiSelect"&&n.value.length===0||n.type==="date"&&!n.value.from&&!n.value.to||n.type==="people"&&!n.value){let{[e]:o,...l}=t;return l}return {...t,[e]:n}}function Ie(t,e){let n=[];for(let l=0;l<e.length;l++){let i=e[l];(v(i.filterable)?i.filterable:null)?.type==="multiSelect"&&n.push({col:i,field:w(i)});}if(n.length===0)return {};let r=new Map;for(let l=0;l<n.length;l++)r.set(n[l].field,new Set);for(let l=0;l<t.length;l++){let i=t[l];for(let a=0;a<n.length;a++){let u=x(i,n[a].col),m=r.get(n[a].field);u!=null&&u!==""&&m&&m.add(String(u));}}let o={};for(let l=0;l<n.length;l++){let i=r.get(n[l].field);o[n[l].field]=i?Array.from(i).sort():[];}return o}function be(t){let e=[];for(let n of t)(v(n.filterable)?n.filterable:null)?.type==="multiSelect"&&e.push(w(n));return e}function xe(t){let{totalCount:e,filteredCount:n,selectedCount:r,selectedCellCount:o,aggregation:l,suppressRowCount:i}=t,a=[];return i||a.push({key:"total",label:"Rows:",value:e}),n!==void 0&&n!==e&&a.push({key:"filtered",label:"Filtered:",value:n}),r!==void 0&&r>0&&a.push({key:"selected",label:"Selected:",value:r}),o!==void 0&&o>1&&a.push({key:"cells",label:"Cells:",value:o}),l&&(a.push({key:"sum",label:"Sum:",value:l.sum}),a.push({key:"avg",label:"Avg:",value:Math.round(l.avg*100)/100}),a.push({key:"min",label:"Min:",value:l.min}),a.push({key:"max",label:"Max:",value:l.max}),a.push({key:"count",label:"Count:",value:l.count})),a}function he(t,e,n,r){return t?typeof t=="object"?t:{totalCount:e,selectedCount:n>0?n:void 0,filteredCount:r!==void 0&&r!==e?r:void 0}:null}var Z=[10,25,50,100];function kt(t,e){return e.includes(t)?e:[...e,t].sort((n,r)=>n-r)}var Q=5;function Re(t,e,n,r){if(n<=0)return null;let o=r?.maxPageButtons??Q,l=Math.ceil(n/e),i,a,u;if(l<=o){i=[];for(let s=1;s<=l;s++)i.push(s);a=false,u=false;}else {let s=Math.max(1,t-2),d=Math.min(l,t+2);d-s+1<o&&(s===1?d=Math.min(l,s+o-1):d===l&&(s=Math.max(1,d-o+1))),i=[];for(let f=s;f<=d;f++)i.push(f);a=s>1,u=d<l;}let m=Math.max(1,(t-1)*e+1),c=Math.min(t*e,n);return {totalPages:l,pageNumbers:i,showStartEllipsis:a,showEndEllipsis:u,startItem:m,endItem:c,pageSizeOptions:kt(e,r?.pageSizeOptions??Z)}}var ye=[{id:"undo",label:"Undo",shortcut:"Ctrl+Z"},{id:"redo",label:"Redo",shortcut:"Ctrl+Y"},{id:"copy",label:"Copy",shortcut:"Ctrl+C",disabledWhenNoSelection:true,dividerBefore:true},{id:"cut",label:"Cut",shortcut:"Ctrl+X",disabledWhenNoSelection:true},{id:"paste",label:"Paste",shortcut:"Ctrl+V"},{id:"selectAll",label:"Select all",shortcut:"Ctrl+A",dividerBefore:true}];function Te(t){return typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?t.replace("Ctrl","\u2318"):t}function Se(t){let{onCopy:e,onCut:n,onPaste:r,onSelectAll:o,onUndo:l,onRedo:i,onClose:a}=t;return {undo:()=>{l(),a();},redo:()=>{i(),a();},copy:()=>{e(),a();},cut:()=>{n(),a();},paste:()=>{r(),a();},selectAll:()=>{o(),a();}}}var we=[{id:"pinLeft",label:"Pin left"},{id:"pinRight",label:"Pin right"},{id:"unpin",label:"Unpin"}];function De(t){let{canPinLeft:e,canPinRight:n,canUnpin:r,currentSort:o,isSortable:l=true,isResizable:i=true}=t,a=[];if(a.push({id:"pinLeft",label:"Pin left",disabled:!e},{id:"pinRight",label:"Pin right",disabled:!n},{id:"unpin",label:"Unpin",disabled:!r,divider:l||i}),l)if(!o)a.push({id:"sortAsc",label:"Sort ascending"},{id:"sortDesc",label:"Sort descending",divider:i});else {let u=o==="asc"?"desc":"asc",m=o==="asc"?"Sort descending":"Sort ascending";a.push({id:`sort${u==="asc"?"Asc":"Desc"}`,label:m},{id:"clearSort",label:"Clear sort",divider:i});}return i&&a.push({id:"autosizeThis",label:"Autosize this column"},{id:"autosizeAll",label:"Autosize all columns"}),a}function T(t,e,n,r){if(r.valueParser){let l={newValue:t,oldValue:e,data:n,column:r},i=r.valueParser(l);return i===void 0?{valid:false,value:void 0}:{valid:true,value:i}}if(r.cellEditor==="select"&&r.cellEditorParams?.values!=null&&Array.isArray(r.cellEditorParams.values)){let l=r.cellEditorParams.values,i=typeof t=="string"?t:String(t??"");if(i==="")return {valid:true,value:""};let a=l.find(u=>String(u).toLowerCase()===i.toLowerCase());return a!==void 0?{valid:true,value:a}:{valid:false,value:void 0}}let o=r.type;if(o==="date"){let l=ee({newValue:t});return l===void 0?{valid:false,value:void 0}:{valid:true,value:l}}if(o==="boolean"){let l=te({newValue:t});return l===void 0?{valid:false,value:void 0}:{valid:true,value:l}}if(o==="numeric"){let l=J({newValue:t});return l===void 0?{valid:false,value:void 0}:{valid:true,value:l}}return {valid:true,value:t}}function J(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).replace(/[\s,]/g,""),r=Number(n);return Number.isNaN(r)?void 0:r}function ve(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).replace(/[$\u20AC\u00A3\u00A5]/g,"").replace(/[\s,]/g,""),r=Number(n);return Number.isNaN(r)?void 0:r}function ee(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).trim(),r=new Date(n);if(!Number.isNaN(r.getTime()))return r.toISOString()}function Ee(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).trim();return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?n:void 0}function te(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).trim().toLowerCase();if(["true","yes","1"].includes(n))return true;if(["false","no","0"].includes(n))return false}function Fe(t,e,n){if(!n)return null;let r=R(n),o=0,l=0,i=1/0,a=-1/0,u=0;for(let m=r.startRow;m<=r.endRow;m++)for(let c=r.startCol;c<=r.endCol;c++){if(m>=t.length||c>=e.length)continue;o++;let s=t[m],d=e[c],f=x(s,d),p=typeof f=="number"?f:Number(f);!isNaN(p)&&isFinite(p)&&(l+=p,p<i&&(i=p),p>a&&(a=p),u++);}return o<2||u===0?null:{sum:l,avg:l/u,min:i,max:a,count:u}}var Me=new WeakMap;function M(t,e,n,r,o){let l=Me.get(e);if(!l){l=new Map;for(let m=0;m<e.length;m++)l.set(e[m].columnId,e[m]);Me.set(e,l);}let i=[];for(let m=0;m<e.length;m++){let c=e[m],s=w(c),d=n[s];if(d)switch(d.type){case "multiSelect":if(d.value.length>0){let f=new Set(d.value);i.push(p=>f.has(String(x(p,c))));}break;case "text":{let f=d.value.trim();if(f){let p=f.toLowerCase(),g=new Map;for(let I=0;I<t.length;I++)g.set(t[I],String(x(t[I],c)??"").toLowerCase());i.push(I=>(g.get(I)??"").includes(p));}break}case "people":{let f=d.value.email.toLowerCase(),p=new Map;for(let g=0;g<t.length;g++)p.set(t[g],String(x(t[g],c)??"").toLowerCase());i.push(g=>(p.get(g)??"")===f);break}case "date":{let f=d.value,p=f.from?new Date(f.from+"T00:00:00").getTime():NaN,g=f.to?new Date(f.to+"T23:59:59.999").getTime():NaN,I=new Map;for(let C=0;C<t.length;C++){let b=x(t[C],c);if(b==null)I.set(t[C],NaN);else {let y=new Date(String(b)).getTime();I.set(t[C],Number.isNaN(y)?NaN:y);}}i.push(C=>{let b=I.get(C)??NaN;return !(Number.isNaN(b)||!Number.isNaN(p)&&b<p||!Number.isNaN(g)&&b>g)});break}}}let a=i.length>0,u=a?t.filter(m=>{for(let c=0;c<i.length;c++)if(!i[c](m))return false;return true}):t;if(r){let m=a?u:u.slice(),c=l.get(r),s=c?.compare,d=o==="asc"?1:-1;if(c?.type==="date"&&!s){let p=new Map;for(let g=0;g<m.length;g++){let I=m[g],C=c?x(I,c):I[r];if(C==null)p.set(I,NaN);else {let b=new Date(String(C)).getTime();p.set(I,Number.isNaN(b)?0:b);}}m.sort((g,I)=>{let C=p.get(g)??NaN,b=p.get(I)??NaN;return Number.isNaN(C)&&Number.isNaN(b)?0:Number.isNaN(C)?-1*d:Number.isNaN(b)?1*d:C===b?0:C>b?d:-d});}else if(s)m.sort((p,g)=>s(p,g)*d);else {let p=new Map;for(let g=0;g<m.length;g++){let I=m[g],C=c?x(I,c):I[r];C==null?p.set(I,void 0):typeof C=="number"?p.set(I,C):p.set(I,String(C).toLowerCase());}m.sort((g,I)=>{let C=p.get(g),b=p.get(I);return C===void 0&&b===void 0?0:C===void 0?-1*d:b===void 0?1*d:C===b?0:C>b?d:-d});}return m}return u}function D(t,e){if(!t)return false;let n=Math.min(t.startRow,t.endRow),r=Math.max(t.startRow,t.endRow);return e>=n&&e<=r}function Ne(t,e){if(t.item!==e.item||t.isSelected!==e.isSelected||t.hasCheckboxCol!==e.hasCheckboxCol||t.visibleCols!==e.visibleCols||t.columnMeta!==e.columnMeta||t.cellClassMap!==e.cellClassMap||t.columnLayouts!==e.columnLayouts)return false;let n=t.rowIndex;if(t.editingRowId!==e.editingRowId&&(t.editingRowId===t.rowId||e.editingRowId===e.rowId))return false;let r=t.activeCell?.rowIndex===n,o=e.activeCell?.rowIndex===n;if(r!==o||r&&o&&t.activeCell?.columnIndex!==e.activeCell?.columnIndex)return false;let l=D(t.selectionRange,n),i=D(e.selectionRange,n);if(l!==i||l&&i&&(t.selectionRange?.startCol!==e.selectionRange?.startCol||t.selectionRange?.endCol!==e.selectionRange?.endCol))return false;let a=t.selectionRange?.endRow===n,u=e.selectionRange?.endRow===n;return !(a!==u||(a||u)&&t.isDragging!==e.isDragging||t.cutRange!==e.cutRange&&(D(t.cutRange,n)||D(e.cutRange,n))||t.copyRange!==e.copyRange&&(D(t.copyRange,n)||D(e.copyRange,n)))}function ne(t,e){return e?e.left?.includes(t)?"left":e.right?.includes(t)?"right":"unpinned":"unpinned"}function Pe(t,e,n){let r=t.filter(i=>i!==e),o=Math.max(0,Math.min(n,r.length)),l=[...r];return l.splice(o,0,e),l}function Ae(t){let{mouseX:e,columnOrder:n,draggedColumnId:r,draggedPinState:o,tableElement:l,pinnedColumns:i}=t,a=l.querySelectorAll("[data-column-id]");if(a.length===0)return null;let u=[];if(a.forEach(d=>{let f=d.getAttribute("data-column-id");if(!f||ne(f,i)!==o)return;let g=d.getBoundingClientRect(),I=n.indexOf(f);I!==-1&&u.push({columnId:f,left:g.left,right:g.right,midX:g.left+g.width/2,orderIndex:I});}),u.length===0)return null;u.sort((d,f)=>d.left-f.left);let m,c;if(e<=u[0].midX)m=u[0].orderIndex,c=u[0].left;else if(e>=u[u.length-1].midX){let d=u[u.length-1];m=d.orderIndex+1,c=d.right;}else {let d=-1;for(let f=0;f<u.length-1;f++)if(e>=u[f].midX&&e<u[f+1].midX){d=f;break}if(d===-1)return null;m=u[d].orderIndex+1,c=u[d].right;}let s=n.indexOf(r);return s===m||s+1===m?{targetIndex:m,indicatorX:null}:{targetIndex:m,indicatorX:c}}function Oe(t,e,n,r=2){if(e.length===0||n<=0)return {startIndex:0,endIndex:-1,leftOffset:0,rightOffset:0};let o=0,l=e.length,i=-1;for(let s=0;s<e.length;s++){let d=o;o+=e[s],o>t&&l===e.length&&(l=s),d<t+n&&(i=s);}if(l>i)return {startIndex:0,endIndex:-1,leftOffset:0,rightOffset:0};let a=Math.max(0,l-r),u=Math.min(e.length-1,i+r),m=0;for(let s=0;s<a;s++)m+=e[s];let c=0;for(let s=u+1;s<e.length;s++)c+=e[s];return {startIndex:a,endIndex:u,leftOffset:m,rightOffset:c}}function ke(t,e,n){let r=[],o=[],l=[];for(let a of t){let u=n?.[a.columnId];u==="left"?r.push(a):u==="right"?o.push(a):l.push(a);}if(!e||e.endIndex<0)return {pinnedLeft:r,virtualizedUnpinned:l,pinnedRight:o,leftSpacerWidth:0,rightSpacerWidth:0};let i=l.slice(e.startIndex,e.endIndex+1);return {pinnedLeft:r,virtualizedUnpinned:i,pinnedRight:o,leftSpacerWidth:e.leftOffset,rightSpacerWidth:e.rightOffset}}function _e(t,e,n,r,o=5){if(r<=0||e<=0||n<=0)return {startIndex:0,endIndex:0,offsetTop:0,offsetBottom:0};let l=Math.max(0,Math.floor(t/e)-o),i=Math.min(r-1,Math.ceil((t+n)/e)+o),a=l*e,u=Math.max(0,(r-i-1)*e);return {startIndex:l,endIndex:i,offsetTop:a,offsetBottom:u}}function Le(t,e){return t*e}function Ve(t,e,n,r="start"){let o=t*e;switch(r){case "start":return o;case "center":return Math.max(0,o-(n-e)/2);case "end":return Math.max(0,o-n+e)}}function Ue(){let t=self;t.onmessage=e=>{let n=e.data;if(n.type!=="sort-filter")return;let{requestId:r,values:o,filters:l,sort:i}=n,a=o.length,u=[],m=Object.entries(l);if(m.length===0){u=new Array(a);for(let s=0;s<a;s++)u[s]=s;}else for(let s=0;s<a;s++){let d=true;for(let f=0;f<m.length;f++){let p=Number(m[f][0]),g=m[f][1],I=o[s][p];switch(g.type){case "text":{let C=g.value.trim().toLowerCase();C&&!String(I??"").toLowerCase().includes(C)&&(d=false);break}case "multiSelect":{g.value.length>0&&(new Set(g.value).has(String(I??""))||(d=false));break}case "date":{if(I==null){d=false;break}let C=new Date(String(I)).getTime();if(isNaN(C)){d=false;break}if(g.value.from){let b=new Date(g.value.from+"T00:00:00").getTime();if(C<b){d=false;break}}if(g.value.to){let b=new Date(g.value.to+"T23:59:59.999").getTime();if(C>b){d=false;break}}break}}if(!d)break}d&&u.push(s);}if(i){let{columnIndex:s,direction:d}=i,f=d==="asc"?1:-1;u.sort((p,g)=>{let I=o[p][s],C=o[g][s];if(I==null&&C==null)return 0;if(I==null)return -1*f;if(C==null)return 1*f;if(typeof I=="number"&&typeof C=="number")return I===C?0:I>C?f:-f;let b=String(I).toLowerCase(),y=String(C).toLowerCase();return b===y?0:b>y?f:-f});}let c={type:"sort-filter-result",requestId:r,indices:u};t.postMessage(c);};}var S=null,_t=0,E=new Map;function re(){if(S)return S;if(typeof Worker>"u"||typeof Blob>"u"||typeof URL>"u")return null;try{let t=Ue.toString(),e=new Blob([`(${t})()`],{type:"application/javascript"}),n=URL.createObjectURL(e);return S=new Worker(n),URL.revokeObjectURL(n),S.onmessage=r=>{let{requestId:o,indices:l}=r.data,i=E.get(o);i&&(E.delete(o),i.resolve(l));},S.onerror=r=>{for(let[o,l]of E)l.reject(new Error(r.message||"Worker error")),E.delete(o);},S}catch{return null}}function He(){S&&(S.terminate(),S=null);for(let[t,e]of E)e.reject(new Error("Worker terminated")),E.delete(t);}function oe(t,e){let n=new Array(t.length);for(let r=0;r<t.length;r++){let o=new Array(e.length);for(let l=0;l<e.length;l++){let i=x(t[r],e[l]);i==null?o[l]=null:typeof i=="string"||typeof i=="number"||typeof i=="boolean"?o[l]=i:o[l]=String(i);}n[r]=o;}return n}function Be(t,e,n,r,o){if(r&&e.find(f=>f.columnId===r)?.compare)return Promise.resolve(M(t,e,n,r,o));let l=re();if(!l)return Promise.resolve(M(t,e,n,r,o));let i=new Map;for(let d=0;d<e.length;d++)i.set(e[d].columnId,d);let a=oe(t,e),u=e.map((d,f)=>({type:d.type??"text",index:f})),m={};for(let d of e){let f=w(d),p=n[f];if(!p)continue;let g=i.get(d.columnId);if(g!==void 0)switch(p.type){case "text":m[g]={type:"text",value:p.value};break;case "multiSelect":m[g]={type:"multiSelect",value:p.value};break;case "date":m[g]={type:"date",value:{from:p.value.from,to:p.value.to}};break;case "people":return Promise.resolve(M(t,e,n,r,o))}}let c;if(r){let d=i.get(r);d!==void 0&&(c={columnIndex:d,direction:o??"asc"});}let s=++_t;return new Promise((d,f)=>{E.set(s,{resolve:g=>{let I=new Array(g.length);for(let C=0;C<g.length;C++)I[C]=t[g[C]];d(I);},reject:f});let p={type:"sort-filter",requestId:s,values:a,columnMeta:u,filters:m,sort:c};l.postMessage(p);})}var H="YYYY-MM-DD";function B(t,e,n="UTC"){if(t==null)return null;let r=t instanceof Date?t:new Date(String(t));if(Number.isNaN(r.getTime()))return null;let o,l,i;if(n==="UTC")o=r.getUTCFullYear(),l=r.getUTCMonth()+1,i=r.getUTCDate();else {let s=new Intl.DateTimeFormat("en-CA",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(r);o=parseInt(s.find(d=>d.type==="year")?.value??"0",10),l=parseInt(s.find(d=>d.type==="month")?.value??"0",10),i=parseInt(s.find(d=>d.type==="day")?.value??"0",10);}let a=String(o).padStart(4,"0"),u=String(l).padStart(2,"0"),m=String(i).padStart(2,"0");return e.replace("YYYY",a).replace("MM",u).replace("DD",m)}function Ge(t,e){if(!t||!t.trim())return null;let r=t.trim().split(/[/\-.\s]+/).filter(Boolean);if(r.length===0)return null;let o=new Date().getUTCFullYear(),l=Lt(e),i,a,u;if(r.length===3){let[c,s,d]=r.map(Number);l==="YMD"?(i=c,a=s,u=d):l==="DMY"?(u=c,a=s,i=d):(a=c,u=s,i=d),i!==void 0&&i<100&&(i=i<50?2e3+i:1900+i);}else if(r.length===2){let[c,s]=r.map(Number);l==="DMY"?(u=c,a=s):(a=c,u=s),i=o;}else if(r.length===1){let c=r[0];if(/^\d+$/.test(c))if(c.length===8)i=parseInt(c.slice(0,4),10),a=parseInt(c.slice(4,6),10),u=parseInt(c.slice(6,8),10);else if(c.length===4)a=parseInt(c.slice(0,2),10),u=parseInt(c.slice(2,4),10),i=o;else return null;else return null}else return null;if(!Vt(i,a,u))return null;let m=new Date(Date.UTC(i,a-1,u));return m.getUTCFullYear()!==i||m.getUTCMonth()+1!==a||m.getUTCDate()!==u?null:m}function We(t){return t}function Lt(t){let e=t.indexOf("Y"),n=t.indexOf("M"),r=t.indexOf("D");return e===-1||n===-1||r===-1?"MDY":e<n&&n<r?"YMD":r<n&&n<e?"DMY":"MDY"}function Vt(t,e,n){return !(t==null||e==null||n==null||!Number.isFinite(t)||!Number.isFinite(e)||!Number.isFinite(n)||e<1||e>12||n<1||n>31)}var L=class{constructor(e,n){this.type=e;this.message=n;}toString(){return this.type}};function Xe(t,e){let n=v(t.filterable)?t.filterable:null,r=n?.type??"none",o=n?.filterField??t.columnId,l=t.sortable!==false,i=e.filters[o],a={columnKey:t.columnId,columnName:t.name,filterType:r,isSorted:e.sortBy===t.columnId,isSortedDescending:e.sortBy===t.columnId&&e.sortDirection==="desc",onSort:l?()=>e.onColumnSort(t.columnId):void 0};return r==="text"?{...a,textValue:i?.type==="text"?i.value:"",onTextChange:u=>e.onFilterChange(o,u.trim()?{type:"text",value:u}:void 0)}:r==="people"?{...a,selectedUser:i?.type==="people"?i.value:void 0,onUserChange:u=>e.onFilterChange(o,u?{type:"people",value:u}:void 0),peopleSearch:e.peopleSearch}:r==="multiSelect"?{...a,options:e.filterOptions[o]??[],isLoadingOptions:e.loadingFilterOptions[o]??false,selectedValues:i?.type==="multiSelect"?i.value:[],onFilterChange:u=>e.onFilterChange(o,u.length?{type:"multiSelect",value:u}:void 0)}:r==="date"?{...a,dateValue:i?.type==="date"?i.value:void 0,onDateChange:u=>e.onFilterChange(o,u?{type:"date",value:u}:void 0)}:a}var W=class W{constructor(){this.cache=new Map;this.lastVersion="";}static computeVersion(e){let n=e.editingCell,r=e.activeCell,o=e.selectionRange,l=e.cutRange,i=e.copyRange;return (n?`${String(n.rowId)}\0${n.columnId}`:"")+""+(r?`${r.rowIndex}\0${r.columnIndex}`:"")+""+(o?`${o.startRow}\0${o.startCol}\0${o.endRow}\0${o.endCol}`:"")+""+(l?`${l.startRow}\0${l.startCol}\0${l.endRow}\0${l.endCol}`:"")+""+(i?`${i.startRow}\0${i.startCol}\0${i.endRow}\0${i.endCol}`:"")+""+(e.isDragging?"1":"0")+""+(e.editable!==false?"1":"0")+""+(e.onCellValueChanged?"1":"0")+""+(e.formulaVersion??0)}get(e,n,r,o){let l=e*W.MAX_COL_STRIDE+n,i=this.cache.get(l);if(i!==void 0&&i.version===r)return i.descriptor;let a=o();return this.cache.set(l,{version:r,descriptor:a}),a}updateVersion(e){this.lastVersion=e;}get currentVersion(){return this.lastVersion}clear(){this.cache.clear();}};W.MAX_COL_STRIDE=1024;var G=W;function qe(t,e,n,r,o,l){return l!==void 0?l.get(n,r,l.currentVersion,()=>$e(t,e,n,r,o)):$e(t,e,n,r,o)}function $e(t,e,n,r,o){let l=o.getRowId(t),i=r+o.colOffset,a=h(e,t),u=o.editable!==false&&a&&!!o.onCellValueChanged&&typeof e.cellEditor!="function",m=o.editable!==false&&a&&!!o.onCellValueChanged&&typeof e.cellEditor=="function"&&e.cellEditorPopup!==false,c=u||m,s=o.editingCell?.rowId===l&&o.editingCell?.columnId===e.columnId,d=!o.isDragging&&o.activeCell?.rowIndex===n&&o.activeCell?.columnIndex===i,f=o.selectionRange!=null&&o.selectionRange.startRow===o.selectionRange.endRow&&o.selectionRange.startCol===o.selectionRange.endCol,p=o.selectionRange!=null&&!f&&F(o.selectionRange,n,r),g=o.cutRange!=null&&F(o.cutRange,n,r),I=o.copyRange!=null&&F(o.copyRange,n,r),C=!o.isDragging&&o.copyRange==null&&o.cutRange==null&&o.selectionRange!=null&&n===o.selectionRange.endRow&&r===o.selectionRange.endCol,b=e.pinned!=null,y=e.pinned??void 0,P=x(t,e),A=o.hasFormula?.(r,n)??false,U=A?o.getFormulaValue?.(r,n):void 0,q="display",O;s&&u?(q="editing-inline",e.cellEditor==="text"||e.cellEditor==="select"||e.cellEditor==="checkbox"||e.cellEditor==="richSelect"||e.cellEditor==="date"?O=e.cellEditor:e.type==="date"?O="date":e.type==="boolean"?O="checkbox":O="text"):s&&m&&typeof e.cellEditor=="function"&&(q="editing-popover");let Ot=s&&A?o.getFormula?.(r,n)??P:P;return {mode:q,editorType:O,value:Ot,isActive:d,isInRange:p,isInCutRange:g,isInCopyRange:I,isSelectionEndCell:C,canEditAny:c,isPinned:b,pinnedSide:y,globalColIndex:i,rowId:l,rowIndex:n,displayValue:U!==void 0?U:P,columnType:e.type}}function ze(t,e,n){if(n instanceof L)return n.toString();let r=t;if(r.renderCell&&typeof r.renderCell=="function")return r.renderCell(e);if(t.valueFormatter)return t.valueFormatter(n,e);if(n==null)return null;if(t.type==="date"){let o=t.dateFormat??H,l=B(n,o);if(l!==null)return l}return t.type==="boolean"?n?"True":"False":String(n)}function Ye(t,e,n){let r=t,o=n instanceof L,l=r.cellStyle?typeof r.cellStyle=="function"?r.cellStyle(e):r.cellStyle:void 0;return o?{...l,color:"var(--ogrid-formula-error-color, #d32f2f)"}:l}function je(t,e,n,r){let o=n.editorType??"text";return {value:n.value,item:t,column:e,rowIndex:n.rowIndex,editorType:o,onCommit:l=>r.commitCellEdit(t,e.columnId,n.value,l,n.rowIndex,n.globalColIndex,o==="checkbox"?{skipAdvance:true}:void 0),onCancel:()=>r.setEditingCell(null)}}function Ke(t,e,n,r,o){let l=n.value,i=r!==void 0?r:l,a=r;return {value:i,onValueChange:u=>{a=u,o.setPendingEditorValue(u);},onCommit:()=>{let u=a!==void 0?a:l;o.commitCellEdit(t,e.columnId,l,u,n.rowIndex,n.globalColIndex);},onCancel:o.cancelPopoverEdit,item:t,column:e,cellEditorParams:e.cellEditorParams}}function Ze(t,e){let n=null,r=((...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{t(...o),n=null;},e);});return r.cancel=()=>{n!==null&&(clearTimeout(n),n=null);},r}function Qe(t,e,n){let r=e.startCol+n,o=e.endCol+n,l=t.querySelector(`[data-row-index="${e.startRow}"][data-col-index="${r}"]`),i=t.querySelector(`[data-row-index="${e.endRow}"][data-col-index="${o}"]`);if(!l||!i)return null;let a=t.getBoundingClientRect(),u=l.getBoundingClientRect(),m=i.getBoundingClientRect();return {top:u.top-a.top,left:u.left-a.left,width:m.right-u.left,height:m.bottom-u.top}}function Je(t){let e=new Map;if(!t)return e;let n=t.querySelectorAll("[data-row-index][data-col-index]");for(let r=0;r<n.length;r++){let o=n[r],l=o.getAttribute("data-row-index")??"",i=o.getAttribute("data-col-index")??"";e.set(`${l},${i}`,o);}return e}function et(t,e){if(typeof document>"u"||document.getElementById(t))return;let n=document.createElement("style");n.id=t,n.textContent=e,document.head.appendChild(n);}function tt(t,e,n){return n===null?{field:"",direction:"asc"}:n?{field:e,direction:n}:{field:e,direction:t.field===e&&t.direction==="asc"?"desc":"asc"}}var nt=48,rt=50,le=80,ot=16,lt=30,it="__row_number__",at=6;var ie=16,ae=520;function Ut(t){let e=getComputedStyle(t),n=(parseFloat(e.paddingLeft)||0)+(parseFloat(e.paddingRight)||0),r=(parseFloat(e.borderLeftWidth)||0)+(parseFloat(e.borderRightWidth)||0),o=0;for(let s=0;s<t.children.length;s++){let d=t.children[s],f=d.className||"";if(f.includes("resizeHandle")||f.includes("resize-handle")||f.includes("ogrid-resize-handle")){o=d.offsetWidth;break}}let l=t.firstElementChild;if(!l)return t.offsetWidth;let i=[],a=s=>{for(let d=0;d<s.children.length;d++){let f=s.children[d],p=getComputedStyle(f);(p.overflow==="hidden"||p.flexShrink!=="0")&&(i.push({el:f,overflow:f.style.overflow,flexShrink:f.style.flexShrink,width:f.style.width,minWidth:f.style.minWidth,maxWidth:f.style.maxWidth}),f.style.overflow="visible",f.style.flexShrink="0",f.style.width="max-content",f.style.minWidth="max-content",f.style.maxWidth="none"),a(f);}},u=l.style.position,m=l.style.width;l.style.position="absolute",l.style.width="max-content",a(l);let c=l.offsetWidth;l.style.position=u,l.style.width=m;for(let s of i)s.el.style.overflow=s.overflow,s.el.style.flexShrink=s.flexShrink,s.el.style.width=s.width,s.el.style.minWidth=s.minWidth,s.el.style.maxWidth=s.maxWidth;return c+o+n+r}function st(t,e,n){let r=e??80,l=(n??document).querySelectorAll(`[data-column-id="${t}"]`);if(l.length===0)return r;let i=r,a=[],u=[],m=[];if(l.forEach(c=>{let s=c;if(!!s.querySelector?.("[data-header-label]"))i=Math.max(i,Ut(s));else {let f=s.firstElementChild??s;a.push(f);}}),a.length>0){for(let c=0;c<a.length;c++){let s=a[c];u.push(s.style.position),m.push(s.style.width),s.style.position="absolute",s.style.width="max-content";}for(let c=0;c<a.length;c++)i=Math.max(i,a[c].offsetWidth+ie);for(let c=0;c<a.length;c++)a[c].style.position=u[c],a[c].style.width=m[c];}return Math.min(ae,Math.max(r,Math.ceil(i)))}function N(t,e,n,r){if(t===e)return t;let o=t+n;if(!r(t)&&!r(o)){let i=o;for(;i!==e;){if(r(i+n))return i;i+=n;}return e}let l=o;for(;l!==e;){if(!r(l))return l;l+=n;}return e}function ut(t,e,n,r,o,l){let i=t,a=e;return l?e>o?a=e-1:t>0&&(i=t-1,a=r):e<r?a=e+1:t<n&&(i=t+1,a=o),{rowIndex:i,columnIndex:a}}function dt(t){let{direction:e,rowIndex:n,columnIndex:r,dataColIndex:o,colOffset:l,maxRowIndex:i,maxColIndex:a,visibleColCount:u,isCtrl:m,isShift:c,selectionRange:s,isEmptyAt:d}=t,f=n,p=r;e==="ArrowDown"?f=m?N(n,i,1,b=>d(b,Math.max(0,o))):Math.min(n+1,i):e==="ArrowUp"?f=m?N(n,0,-1,b=>d(b,Math.max(0,o))):Math.max(n-1,0):e==="ArrowRight"?m&&o>=0?p=N(o,u-1,1,b=>d(n,b))+l:p=Math.min(r+1,a):m&&o>=0?p=N(o,0,-1,b=>d(n,b))+l:p=Math.max(r-1,l);let g=p-l,I=e==="ArrowDown"||e==="ArrowUp",C;return c?I?C=R({startRow:s?.startRow??n,startCol:s?.startCol??o,endRow:f,endCol:s?.endCol??o}):C=R({startRow:s?.startRow??n,startCol:s?.startCol??o,endRow:s?.endRow??n,endCol:g}):C={startRow:f,startCol:g,endRow:f,endCol:g},{newRowIndex:f,newColumnIndex:p,newDataColIndex:g,newRange:C}}function ct(t,e,n){let r=R(t),o=[];for(let l=r.startRow;l<=r.endRow;l++)for(let i=r.startCol;i<=r.endCol;i++){if(l>=e.length||i>=n.length)continue;let a=e[l],u=n[i];if(!h(u,a))continue;let m=x(a,u),c=T("",m,a,u);c.valid&&o.push({item:a,columnId:u.columnId,oldValue:m,newValue:c.value,rowIndex:l});}return o}function mt(t,e){return t===e?true:!t||!e?false:t.startRow===e.startRow&&t.endRow===e.endRow&&t.startCol===e.startCol&&t.endCol===e.endCol}function ft(t,e,n){return e<0||n<0?null:{startRow:Math.max(0,Math.min(t.startRow,e)),endRow:Math.max(0,Math.min(t.endRow,e)),startCol:Math.max(0,Math.min(t.startCol,n)),endCol:Math.max(0,Math.min(t.endCol,n))}}function pt(t,e=40,n=2,r=20){let o=Math.min(t/e,1);return n+o*(r-n)}function gt(t,e,n,r,o,l){let i=new Set(l),a=Math.min(t,e),u=Math.max(t,e);for(let m=a;m<=u;m++)if(m<r.length){let c=o(r[m]);n?i.add(c):i.delete(c);}return i}function Ct(t,e,n){if(t.size===0||e.length===0)return {allSelected:false,someSelected:false};let r=t.size>=e.length&&e.every(l=>t.has(n(l))),o=!r&&t.size>0;return {allSelected:r,someSelected:o}}function se(t,e){let n=e!=null&&e!==""?e:t;if(n==null||n==="")return "";try{return String(n).replace(/[\t\n]/g," ")}catch{return "[Object]"}}function It(t,e,n,r){let o=R(n),l=[];for(let i=o.startRow;i<=o.endRow;i++){let a=[];for(let u=o.startCol;u<=o.endCol&&!(i>=t.length||u>=e.length);u++){let m=t[i],c=e[u];if(r?.hasFormula&&r?.getFormula){let p=r.flatColumns.findIndex(g=>g.columnId===c.columnId);if(p>=0&&r.hasFormula(p,i)){let g=r.getFormula(p,i);if(g){a.push(g);continue}}}let s=x(m,c),f=(c.clipboardFormatter?c.clipboardFormatter(s,m):null)??(c.valueFormatter?c.valueFormatter(s,m):s);a.push(se(s,f));}l.push(a.join(" "));}return l.join(`\r
|
|
4
|
+
`)}function bt(t){return t.trim()?t.split(/\r?\n/).filter(n=>n.length>0).map(n=>n.split(" ")):[]}function xt(t,e,n,r,o,l){let i=[];for(let a=0;a<t.length;a++){let u=t[a];for(let m=0;m<u.length;m++){let c=e+a,s=n+m;if(c>=r.length||s>=o.length)continue;let d=r[c],f=o[s];if(!h(f,d))continue;let p=u[m]??"";if(p.startsWith("=")&&l?.setFormula){let C=l.flatColumns.findIndex(b=>b.columnId===f.columnId);if(C>=0){l.setFormula(C,c,p);continue}}let g=x(d,f),I=T(p,g,d,f);I.valid&&i.push({item:d,columnId:f.columnId,oldValue:g,newValue:I.value,rowIndex:c});}}return i}function ht(t,e,n){let r=[];for(let o=t.startRow;o<=t.endRow;o++)for(let l=t.startCol;l<=t.endCol;l++){if(o>=e.length||l>=n.length)continue;let i=e[o],a=n[l];if(!h(a,i))continue;let u=x(i,a),m=T("",u,i,a);m.valid&&r.push({item:i,columnId:a.columnId,oldValue:u,newValue:m.value,rowIndex:o});}return r}function V(t){let e="",n=t;for(;n>=0;)e=String.fromCharCode(n%26+65)+e,n=Math.floor(n/26)-1;return e}function $(t){let e=0,n=t.toUpperCase();for(let r=0;r<n.length;r++)e=e*26+(n.charCodeAt(r)-64);return e-1}function Rt(t,e){return `${V(t)}${e}`}var yt=/(?:'[^']*'!|[A-Za-z_]\w*!)?(\$?)([A-Z]+)(\$?)(\d+)/g;function Tt(t,e,n){return yt.lastIndex=0,t.replace(yt,(r,o,l,i,a)=>{let u=r.indexOf(o+l),m=u>0?r.substring(0,u):"",c=l,s=a;if(o!=="$"){let d=$(l)+e;if(d<0)return "#REF!";c=V(d);}if(i!=="$"){let d=parseInt(a,10)+n;if(d<1)return "#REF!";s=String(d);}return `${m}${o}${c}${i}${s}`})}function ue(t,e){if(t.columnId===e.columnId)return true;let n=t.type??"text",r=e.type??"text";return !(n!==r||t.cellEditor!==e.cellEditor)}function St(t,e,n,r,o,l){let i=[],a=r[t.startRow],u=o[t.startCol];if(!a||!u)return i;let m=x(a,u),c=l?l.flatColumns.findIndex(s=>s.columnId===u.columnId):-1;for(let s=t.startRow;s<=t.endRow;s++)for(let d=t.startCol;d<=t.endCol;d++){if(s===e&&d===n||s>=r.length||d>=o.length)continue;let f=r[s],p=o[d];if(!h(p,f)||!ue(u,p))continue;if(l&&l.hasFormula&&l.getFormula&&l.setFormula&&c>=0&&l.hasFormula(c,e)){let C=l.getFormula(c,e);if(C){let b=s-e,y=d-n,P=Tt(C,y,b),A=l.flatColumns.findIndex(U=>U.columnId===p.columnId);if(A>=0){l.setFormula(A,s,P);continue}}}let g=x(f,p),I=T(m,g,f,p);I.valid&&i.push({item:f,columnId:p.columnId,oldValue:g,newValue:I.value,rowIndex:s});}return i}var X=class{constructor(e=100){this.history=[];this.redoStack=[];this.batch=null;this.maxDepth=e;}get canUndo(){return this.history.length>0}get canRedo(){return this.redoStack.length>0}get historyLength(){return this.history.length}get redoLength(){return this.redoStack.length}get isBatching(){return this.batch!==null}push(e){e.length!==0&&(this.batch!==null?this.batch.push(...e):(this.history.push(e),this.history.length>this.maxDepth&&this.history.splice(0,this.history.length-this.maxDepth),this.redoStack.length=0));}record(e){this.push([e]);}beginBatch(){this.batch===null&&(this.batch=[]);}endBatch(){let e=this.batch;this.batch=null,!(!e||e.length===0)&&(this.history.push(e),this.history.length>this.maxDepth&&this.history.splice(0,this.history.length-this.maxDepth),this.redoStack.length=0);}undo(){let e=this.history.pop();return e?(this.redoStack.push(e),e):null}redo(){let e=this.redoStack.pop();return e?(this.history.push(e),e):null}clear(){this.history=[],this.redoStack=[];}};function wt(t){if(!Array.isArray(t)||t.length===0){console.warn("[OGrid] columns prop is empty or not an array");return}let e=typeof process<"u"&&process.env?.NODE_ENV!=="production",n=new Set;for(let r of t)r.columnId||console.warn("[OGrid] Column missing columnId:",r),n.has(r.columnId)&&console.warn(`[OGrid] Duplicate columnId: "${r.columnId}"`),n.add(r.columnId),e&&r.editable===true&&r.cellEditor==null&&console.warn(`[OGrid] Column "${r.columnId}" has editable=true but no cellEditor defined. Cells will not open an editor on double-click. Set cellEditor to 'text', 'select', 'checkbox', 'date', or a custom component.`);}function Dt(t){typeof process<"u"&&process.env?.NODE_ENV==="production"||t.enabled===true&&(!t.rowHeight||t.rowHeight<=0)&&console.warn("[OGrid] virtualScroll.enabled is true but rowHeight is missing or <= 0. Set a positive rowHeight (e.g. virtualScroll: { enabled: true, rowHeight: 36 }) for correct virtual scrolling behavior.");}function vt(t,e){if(typeof process<"u"&&process.env.NODE_ENV==="production"||!e)return;let n=new Set,r=Math.min(t.length,100);for(let o=0;o<r;o++){let l=e(t[o]);if(l==null){console.warn(`[OGrid] getRowId returned null/undefined for row ${o}`);return}if(n.has(l)){console.warn(`[OGrid] Duplicate row ID "${l}" at index ${o}. getRowId must return unique values.`);return}n.add(l);}}var de=[{minWidth:0,maxPriority:0},{minWidth:576,maxPriority:1},{minWidth:768,maxPriority:2},{minWidth:992,maxPriority:3},{minWidth:1200,maxPriority:1/0}];function ce(t,e,n){let r=n?.breakpoints??de,o=new Set;if(t<=0||e.length===0)return o;let l=1/0;for(let i=r.length-1;i>=0;i--)if(t>=r[i].minWidth){l=r[i].maxPriority;break}if(l===1/0)return o;for(let i of e)i.responsivePriority!=null&&(i.required||i.responsivePriority>l&&o.add(i.columnId));return o}function Et(t){return t===true?{}:t||void 0}function Ft(t,e,n){if(!n||e<=0)return t;let r=ce(e,t,n);return r.size===0?t:t.filter(o=>!r.has(o.columnId))}var Mt=300,Nt=300,Pt=300;var At={RESIZE_HANDLE:1,ACTIVE_CELL:2,FILL_HANDLE:3,SELECTION_OVERLAY:4,ROW_NUMBER:5,CLIPBOARD_OVERLAY:5,PINNED:6,SELECTION_CELL:7,THEAD:8,PINNED_HEADER:10,HEADER_FOCUS:11,SELECTION_HEADER_PINNED:12,LOADING:2,DROP_INDICATOR:100,DROPDOWN:1e3,FILTER_POPOVER:1e3,MODAL:2e3,FULLSCREEN:9999,CONTEXT_MENU:1e4};export{ie as AUTOSIZE_EXTRA_PX,ae as AUTOSIZE_MAX_PX,ot as CELL_PADDING,nt as CHECKBOX_COLUMN_WIDTH,we as COLUMN_HEADER_MENU_ITEMS,G as CellDescriptorCache,H as DEFAULT_DATE_FORMAT,Mt as DEFAULT_DEBOUNCE_MS,le as DEFAULT_MIN_COLUMN_WIDTH,at as GRID_BORDER_RADIUS,ye as GRID_CONTEXT_MENU_ITEMS,Q as MAX_PAGE_BUTTONS,Z as PAGE_SIZE_OPTIONS,Nt as PEOPLE_SEARCH_DEBOUNCE_MS,de as RESPONSIVE_BREAKPOINTS,it as ROW_NUMBER_COLUMN_ID,lt as ROW_NUMBER_COLUMN_MIN_WIDTH,rt as ROW_NUMBER_COLUMN_WIDTH,Pt as SIDEBAR_TRANSITION_MS,X as UndoRedoStack,At as Z_INDEX,ct as applyCellDeletion,ht as applyCutClear,St as applyFillValues,xt as applyPastedValues,gt as applyRangeRowSelection,Ft as applyResponsiveHiding,ue as areFillCompatible,Ne as areGridRowPropsEqual,te as booleanParser,Je as buildCellIndex,z as buildCsvHeader,Y as buildCsvRows,ge as buildHeaderRows,je as buildInlineEditorProps,Ke as buildPopoverEditorProps,Ae as calculateDropTarget,ft as clampSelectionToBounds,$ as columnLetterToIndex,Fe as computeAggregations,dt as computeArrowNavigation,pt as computeAutoScrollSpeed,tt as computeNextSortState,Ct as computeRowSelectionState,ut as computeTabNavigation,Le as computeTotalHeight,Oe as computeVisibleColumnRange,_e as computeVisibleRange,pe as createGridDataAccessor,re as createSortFilterWorker,ve as currencyParser,ee as dateParser,Ze as debounce,Ie as deriveFilterOptionsFromData,Ee as emailParser,k as escapeCsvValue,fe as exportToCsv,oe as extractValueMatrix,N as findCtrlArrowTarget,K as flattenColumns,Rt as formatCellReference,se as formatCellValueForTsv,B as formatDateForDisplay,It as formatSelectionAsTsv,Te as formatShortcut,qe as getCellRenderDescriptor,x as getCellValue,De as getColumnHeaderMenuItems,Se as getContextMenuHandlers,he as getDataGridStatusBarConfig,We as getDateInputPlaceholder,w as getFilterField,Xe as getHeaderFilterConfig,be as getMultiSelectFilterFields,Re as getPaginationViewModel,ne as getPinStateForColumn,ce as getResponsiveHiddenColumns,Ve as getScrollTopForRow,xe as getStatusBarParts,V as indexToColumnLetter,et as injectGlobalStyles,h as isColumnEditable,v as isFilterConfig,F as isInSelectionRange,D as isRowInRange,st as measureColumnContentWidth,Qe as measureRange,Ce as mergeFilter,R as normalizeSelectionRange,J as numberParser,bt as parseTsvClipboard,Ge as parseUserInputDate,T as parseValue,ke as partitionColumnsForVirtualization,M as processClientSideData,Be as processClientSideDataAsync,mt as rangesEqual,Pe as reorderColumnArray,ze as resolveCellDisplayContent,Ye as resolveCellStyle,Et as resolveResponsiveConfig,He as terminateSortFilterWorker,me as toUserLike,j as triggerCsvDownload,wt as validateColumns,vt as validateRowIds,Dt as validateVirtualScrollConfig};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export { findCtrlArrowTarget, computeTabNavigation, computeArrowNavigation, appl
|
|
|
38
38
|
export type { ArrowNavigationContext, ArrowNavigationResult } from './utils';
|
|
39
39
|
export { rangesEqual, clampSelectionToBounds, computeAutoScrollSpeed, applyRangeRowSelection, computeRowSelectionState } from './utils';
|
|
40
40
|
export { formatCellValueForTsv, formatSelectionAsTsv, parseTsvClipboard, applyPastedValues, applyCutClear, } from './utils';
|
|
41
|
-
export { applyFillValues } from './utils';
|
|
41
|
+
export { applyFillValues, areFillCompatible } from './utils';
|
|
42
42
|
export type { IFillFormulaOptions } from './utils';
|
|
43
43
|
export { UndoRedoStack } from './utils';
|
|
44
44
|
export { validateColumns, validateRowIds, validateVirtualScrollConfig } from './utils';
|
|
@@ -198,14 +198,16 @@ export declare function resolveCellStyle<T>(col: IColumnDef<T>, item: T, display
|
|
|
198
198
|
* Builds props for InlineCellEditor. Shared across all UI packages.
|
|
199
199
|
*/
|
|
200
200
|
export declare function buildInlineEditorProps<T>(item: T, col: IColumnDef<T>, descriptor: CellRenderDescriptor, callbacks: {
|
|
201
|
-
commitCellEdit: (item: T, columnId: string, oldValue: unknown, newValue: unknown, rowIndex: number, globalColIndex: number
|
|
201
|
+
commitCellEdit: (item: T, columnId: string, oldValue: unknown, newValue: unknown, rowIndex: number, globalColIndex: number, options?: {
|
|
202
|
+
skipAdvance?: boolean;
|
|
203
|
+
}) => void;
|
|
202
204
|
setEditingCell: (cell: null) => void;
|
|
203
205
|
}): {
|
|
204
206
|
value: unknown;
|
|
205
207
|
item: T;
|
|
206
208
|
column: IColumnDef<T>;
|
|
207
209
|
rowIndex: number;
|
|
208
|
-
editorType: "
|
|
210
|
+
editorType: "select" | "text" | "date" | "checkbox" | "richSelect";
|
|
209
211
|
onCommit: (newValue: unknown) => void;
|
|
210
212
|
onCancel: () => void;
|
|
211
213
|
};
|
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { IColumnDef, ICellValueChangedEvent } from '../types/columnTypes';
|
|
6
6
|
import type { ISelectionRange } from '../types/dataGridTypes';
|
|
7
|
+
/**
|
|
8
|
+
* Check whether two columns are type-compatible for fill operations.
|
|
9
|
+
* Returns true if a value from the source column can be filled into the target column.
|
|
10
|
+
*
|
|
11
|
+
* Columns are compatible when they share the same built-in type AND the same cellEditor.
|
|
12
|
+
* This prevents dragging a text value onto a color picker, or a rating onto a date field.
|
|
13
|
+
* Same-column fills (different rows) always pass because both sides are identical.
|
|
14
|
+
*/
|
|
15
|
+
export declare function areFillCompatible<T>(source: IColumnDef<T>, target: IColumnDef<T>): boolean;
|
|
7
16
|
/**
|
|
8
17
|
* Options for formula-aware fill. When provided, source cells with formulas will
|
|
9
18
|
* have their relative references adjusted instead of copying raw values.
|
|
@@ -35,7 +35,7 @@ export { findCtrlArrowTarget, computeTabNavigation, computeArrowNavigation, appl
|
|
|
35
35
|
export type { ArrowNavigationContext, ArrowNavigationResult } from './keyboardNavigation';
|
|
36
36
|
export { rangesEqual, clampSelectionToBounds, computeAutoScrollSpeed, applyRangeRowSelection, computeRowSelectionState } from './selectionHelpers';
|
|
37
37
|
export { formatCellValueForTsv, formatSelectionAsTsv, parseTsvClipboard, applyPastedValues, applyCutClear, } from './clipboardHelpers';
|
|
38
|
-
export { applyFillValues } from './fillHelpers';
|
|
38
|
+
export { applyFillValues, areFillCompatible } from './fillHelpers';
|
|
39
39
|
export type { IFillFormulaOptions } from './fillHelpers';
|
|
40
40
|
export { UndoRedoStack } from './undoRedoStack';
|
|
41
41
|
export { validateColumns, validateRowIds, validateVirtualScrollConfig } from './validation';
|
package/package.json
CHANGED