@keenmate/web-grid 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/dist/grid.d.ts +86 -1
- package/dist/index.d.ts +1 -1
- package/dist/modules/rendering/tree-render.d.ts +10 -0
- package/dist/types.d.ts +35 -0
- package/dist/web-component.d.ts +28 -0
- package/dist/web-grid.js +3621 -3225
- package/dist/web-grid.umd.js +119 -119
- package/package.json +1 -1
- package/src/css/_table.css +7 -1
- package/src/css/_tree.css +73 -0
- package/src/css/main.css +1 -0
package/dist/web-grid.umd.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
(function(oe,U){typeof exports=="object"&&typeof module<"u"?U(exports):typeof define=="function"&&define.amd?define(["exports"],U):(oe=typeof globalThis<"u"?globalThis:oe||self,U(oe.WebGrid={}))})(this,function(oe){"use strict";var Ca=Object.defineProperty;var Sa=(oe,U,Q)=>U in oe?Ca(oe,U,{enumerable:!0,configurable:!0,writable:!0,value:Q}):oe[U]=Q;var b=(oe,U,Q)=>Sa(oe,typeof U!="symbol"?U+"":U,Q);const U=Math.min,Q=Math.max,bt=Math.round,_t=Math.floor,ve=e=>({x:e,y:e}),lr={left:"right",right:"left",bottom:"top",top:"bottom"},ar={start:"end",end:"start"};function Bt(e,t,o){return Q(e,U(t,o))}function Ue(e,t){return typeof e=="function"?e(t):e}function Me(e){return e.split("-")[0]}function Ke(e){return e.split("-")[1]}function ko(e){return e==="x"?"y":"x"}function Wt(e){return e==="y"?"height":"width"}const dr=new Set(["top","bottom"]);function xe(e){return dr.has(Me(e))?"y":"x"}function Yt(e){return ko(xe(e))}function cr(e,t,o){o===void 0&&(o=!1);const i=Ke(e),r=Yt(e),s=Wt(r);let n=r==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(n=vt(n)),[n,vt(n)]}function gr(e){const t=vt(e);return[Ut(e),t,Ut(t)]}function Ut(e){return e.replace(/start|end/g,t=>ar[t])}const Ro=["left","right"],Eo=["right","left"],ur=["top","bottom"],hr=["bottom","top"];function fr(e,t,o){switch(e){case"top":case"bottom":return o?t?Eo:Ro:t?Ro:Eo;case"left":case"right":return t?ur:hr;default:return[]}}function wr(e,t,o,i){const r=Ke(e);let s=fr(Me(e),o==="start",i);return r&&(s=s.map(n=>n+"-"+r),t&&(s=s.concat(s.map(Ut)))),s}function vt(e){return e.replace(/left|right|bottom|top/g,t=>lr[t])}function pr(e){return{top:0,right:0,bottom:0,left:0,...e}}function Io(e){return typeof e!="number"?pr(e):{top:e,right:e,bottom:e,left:e}}function yt(e){const{x:t,y:o,width:i,height:r}=e;return{width:i,height:r,top:o,left:t,right:t+i,bottom:o+r,x:t,y:o}}function Do(e,t,o){let{reference:i,floating:r}=e;const s=xe(t),n=Yt(t),l=Wt(n),a=Me(t),d=s==="y",c=i.x+i.width/2-r.width/2,u=i.y+i.height/2-r.height/2,g=i[l]/2-r[l]/2;let h;switch(a){case"top":h={x:c,y:i.y-r.height};break;case"bottom":h={x:c,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:u};break;case"left":h={x:i.x-r.width,y:u};break;default:h={x:i.x,y:i.y}}switch(Ke(t)){case"start":h[n]-=g*(o&&d?-1:1);break;case"end":h[n]+=g*(o&&d?-1:1);break}return h}const mr=async(e,t,o)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:n}=o,l=s.filter(Boolean),a=await(n.isRTL==null?void 0:n.isRTL(t));let d=await n.getElementRects({reference:e,floating:t,strategy:r}),{x:c,y:u}=Do(d,i,a),g=i,h={},f=0;for(let w=0;w<l.length;w++){const{name:p,fn:m}=l[w],{x:v,y,data:x,reset:C}=await m({x:c,y:u,initialPlacement:i,placement:g,strategy:r,middlewareData:h,rects:d,platform:n,elements:{reference:e,floating:t}});c=v??c,u=y??u,h={...h,[p]:{...h[p],...x}},C&&f<=50&&(f++,typeof C=="object"&&(C.placement&&(g=C.placement),C.rects&&(d=C.rects===!0?await n.getElementRects({reference:e,floating:t,strategy:r}):C.rects),{x:c,y:u}=Do(d,g,a)),w=-1)}return{x:c,y:u,placement:g,strategy:r,middlewareData:h}};async function Kt(e,t){var o;t===void 0&&(t={});const{x:i,y:r,platform:s,rects:n,elements:l,strategy:a}=e,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:u="floating",altBoundary:g=!1,padding:h=0}=Ue(t,e),f=Io(h),p=l[g?u==="floating"?"reference":"floating":u],m=yt(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(p)))==null||o?p:p.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:c,strategy:a})),v=u==="floating"?{x:i,y:r,width:n.floating.width,height:n.floating.height}:n.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),x=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},C=yt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:y,strategy:a}):v);return{top:(m.top-C.top+f.top)/x.y,bottom:(C.bottom-m.bottom+f.bottom)/x.y,left:(m.left-C.left+f.left)/x.x,right:(C.right-m.right+f.right)/x.x}}const br=e=>({name:"arrow",options:e,async fn(t){const{x:o,y:i,placement:r,rects:s,platform:n,elements:l,middlewareData:a}=t,{element:d,padding:c=0}=Ue(e,t)||{};if(d==null)return{};const u=Io(c),g={x:o,y:i},h=Yt(r),f=Wt(h),w=await n.getDimensions(d),p=h==="y",m=p?"top":"left",v=p?"bottom":"right",y=p?"clientHeight":"clientWidth",x=s.reference[f]+s.reference[h]-g[h]-s.floating[f],C=g[h]-s.reference[h],_=await(n.getOffsetParent==null?void 0:n.getOffsetParent(d));let S=_?_[y]:0;(!S||!await(n.isElement==null?void 0:n.isElement(_)))&&(S=l.floating[y]||s.floating[f]);const k=x/2-C/2,E=S/2-w[f]/2-1,R=U(u[m],E),I=U(u[v],E),M=R,z=S-w[f]-I,D=S/2-w[f]/2+k,P=Bt(M,D,z),j=!a.arrow&&Ke(r)!=null&&D!==P&&s.reference[f]/2-(D<M?R:I)-w[f]/2<0,T=j?D<M?D-M:D-z:0;return{[h]:g[h]+T,data:{[h]:P,centerOffset:D-P-T,...j&&{alignmentOffset:T}},reset:j}}}),_r=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,i;const{placement:r,middlewareData:s,rects:n,initialPlacement:l,platform:a,elements:d}=t,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:w=!0,...p}=Ue(e,t);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const m=Me(r),v=xe(l),y=Me(l)===l,x=await(a.isRTL==null?void 0:a.isRTL(d.floating)),C=g||(y||!w?[vt(l)]:gr(l)),_=f!=="none";!g&&_&&C.push(...wr(l,w,f,x));const S=[l,...C],k=await Kt(t,p),E=[];let R=((i=s.flip)==null?void 0:i.overflows)||[];if(c&&E.push(k[m]),u){const D=cr(r,n,x);E.push(k[D[0]],k[D[1]])}if(R=[...R,{placement:r,overflows:E}],!E.every(D=>D<=0)){var I,M;const D=(((I=s.flip)==null?void 0:I.index)||0)+1,P=S[D];if(P&&(!(u==="alignment"?v!==xe(P):!1)||R.every(A=>xe(A.placement)===v?A.overflows[0]>0:!0)))return{data:{index:D,overflows:R},reset:{placement:P}};let j=(M=R.filter(T=>T.overflows[0]<=0).sort((T,A)=>T.overflows[1]-A.overflows[1])[0])==null?void 0:M.placement;if(!j)switch(h){case"bestFit":{var z;const T=(z=R.filter(A=>{if(_){const W=xe(A.placement);return W===v||W==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(W=>W>0).reduce((W,B)=>W+B,0)]).sort((A,W)=>A[1]-W[1])[0])==null?void 0:z[0];T&&(j=T);break}case"initialPlacement":j=l;break}if(r!==j)return{reset:{placement:j}}}return{}}}},vr=new Set(["left","top"]);async function yr(e,t){const{placement:o,platform:i,elements:r}=e,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),n=Me(o),l=Ke(o),a=xe(o)==="y",d=vr.has(n)?-1:1,c=s&&a?-1:1,u=Ue(t,e);let{mainAxis:g,crossAxis:h,alignmentAxis:f}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof f=="number"&&(h=l==="end"?f*-1:f),a?{x:h*c,y:g*d}:{x:g*d,y:h*c}}const Cr=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,i;const{x:r,y:s,placement:n,middlewareData:l}=t,a=await yr(t,e);return n===((o=l.offset)==null?void 0:o.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:r+a.x,y:s+a.y,data:{...a,placement:n}}}}},Sr=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:i,placement:r}=t,{mainAxis:s=!0,crossAxis:n=!1,limiter:l={fn:p=>{let{x:m,y:v}=p;return{x:m,y:v}}},...a}=Ue(e,t),d={x:o,y:i},c=await Kt(t,a),u=xe(Me(r)),g=ko(u);let h=d[g],f=d[u];if(s){const p=g==="y"?"top":"left",m=g==="y"?"bottom":"right",v=h+c[p],y=h-c[m];h=Bt(v,h,y)}if(n){const p=u==="y"?"top":"left",m=u==="y"?"bottom":"right",v=f+c[p],y=f-c[m];f=Bt(v,f,y)}const w=l.fn({...t,[g]:h,[u]:f});return{...w,data:{x:w.x-o,y:w.y-i,enabled:{[g]:s,[u]:n}}}}}},xr=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var o,i;const{placement:r,rects:s,platform:n,elements:l}=t,{apply:a=()=>{},...d}=Ue(e,t),c=await Kt(t,d),u=Me(r),g=Ke(r),h=xe(r)==="y",{width:f,height:w}=s.floating;let p,m;u==="top"||u==="bottom"?(p=u,m=g===(await(n.isRTL==null?void 0:n.isRTL(l.floating))?"start":"end")?"left":"right"):(m=u,p=g==="end"?"top":"bottom");const v=w-c.top-c.bottom,y=f-c.left-c.right,x=U(w-c[p],v),C=U(f-c[m],y),_=!t.middlewareData.shift;let S=x,k=C;if((o=t.middlewareData.shift)!=null&&o.enabled.x&&(k=y),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(S=v),_&&!g){const R=Q(c.left,0),I=Q(c.right,0),M=Q(c.top,0),z=Q(c.bottom,0);h?k=f-2*(R!==0||I!==0?R+I:Q(c.left,c.right)):S=w-2*(M!==0||z!==0?M+z:Q(c.top,c.bottom))}await a({...t,availableWidth:k,availableHeight:S});const E=await n.getDimensions(l.floating);return f!==E.width||w!==E.height?{reset:{rects:!0}}:{}}}};function Ct(){return typeof window<"u"}function je(e){return To(e)?(e.nodeName||"").toLowerCase():"#document"}function re(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ye(e){var t;return(t=(To(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function To(e){return Ct()?e instanceof Node||e instanceof re(e).Node:!1}function ge(e){return Ct()?e instanceof Element||e instanceof re(e).Element:!1}function Ce(e){return Ct()?e instanceof HTMLElement||e instanceof re(e).HTMLElement:!1}function Mo(e){return!Ct()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof re(e).ShadowRoot}const kr=new Set(["inline","contents"]);function ot(e){const{overflow:t,overflowX:o,overflowY:i,display:r}=ue(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+o)&&!kr.has(r)}const Rr=new Set(["table","td","th"]);function Er(e){return Rr.has(je(e))}const Ir=[":popover-open",":modal"];function St(e){return Ir.some(t=>{try{return e.matches(t)}catch{return!1}})}const Dr=["transform","translate","scale","rotate","perspective"],Tr=["transform","translate","scale","rotate","perspective","filter"],Mr=["paint","layout","strict","content"];function jt(e){const t=Xt(),o=ge(e)?ue(e):e;return Dr.some(i=>o[i]?o[i]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!t&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!t&&(o.filter?o.filter!=="none":!1)||Tr.some(i=>(o.willChange||"").includes(i))||Mr.some(i=>(o.contain||"").includes(i))}function $r(e){let t=$e(e);for(;Ce(t)&&!Xe(t);){if(jt(t))return t;if(St(t))return null;t=$e(t)}return null}function Xt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ar=new Set(["html","body","#document"]);function Xe(e){return Ar.has(je(e))}function ue(e){return re(e).getComputedStyle(e)}function xt(e){return ge(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function $e(e){if(je(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Mo(e)&&e.host||ye(e);return Mo(t)?t.host:t}function $o(e){const t=$e(e);return Xe(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ce(t)&&ot(t)?t:$o(t)}function it(e,t,o){var i;t===void 0&&(t=[]),o===void 0&&(o=!0);const r=$o(e),s=r===((i=e.ownerDocument)==null?void 0:i.body),n=re(r);if(s){const l=Gt(n);return t.concat(n,n.visualViewport||[],ot(r)?r:[],l&&o?it(l):[])}return t.concat(r,it(r,[],o))}function Gt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ao(e){const t=ue(e);let o=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const r=Ce(e),s=r?e.offsetWidth:o,n=r?e.offsetHeight:i,l=bt(o)!==s||bt(i)!==n;return l&&(o=s,i=n),{width:o,height:i,$:l}}function Qt(e){return ge(e)?e:e.contextElement}function Ge(e){const t=Qt(e);if(!Ce(t))return ve(1);const o=t.getBoundingClientRect(),{width:i,height:r,$:s}=Ao(t);let n=(s?bt(o.width):o.width)/i,l=(s?bt(o.height):o.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!l||!Number.isFinite(l))&&(l=1),{x:n,y:l}}const Lr=ve(0);function Lo(e){const t=re(e);return!Xt()||!t.visualViewport?Lr:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zr(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==re(e)?!1:t}function Fe(e,t,o,i){t===void 0&&(t=!1),o===void 0&&(o=!1);const r=e.getBoundingClientRect(),s=Qt(e);let n=ve(1);t&&(i?ge(i)&&(n=Ge(i)):n=Ge(e));const l=zr(s,o,i)?Lo(s):ve(0);let a=(r.left+l.x)/n.x,d=(r.top+l.y)/n.y,c=r.width/n.x,u=r.height/n.y;if(s){const g=re(s),h=i&&ge(i)?re(i):i;let f=g,w=Gt(f);for(;w&&i&&h!==f;){const p=Ge(w),m=w.getBoundingClientRect(),v=ue(w),y=m.left+(w.clientLeft+parseFloat(v.paddingLeft))*p.x,x=m.top+(w.clientTop+parseFloat(v.paddingTop))*p.y;a*=p.x,d*=p.y,c*=p.x,u*=p.y,a+=y,d+=x,f=re(w),w=Gt(f)}}return yt({width:c,height:u,x:a,y:d})}function kt(e,t){const o=xt(e).scrollLeft;return t?t.left+o:Fe(ye(e)).left+o}function zo(e,t){const o=e.getBoundingClientRect(),i=o.left+t.scrollLeft-kt(e,o),r=o.top+t.scrollTop;return{x:i,y:r}}function Pr(e){let{elements:t,rect:o,offsetParent:i,strategy:r}=e;const s=r==="fixed",n=ye(i),l=t?St(t.floating):!1;if(i===n||l&&s)return o;let a={scrollLeft:0,scrollTop:0},d=ve(1);const c=ve(0),u=Ce(i);if((u||!u&&!s)&&((je(i)!=="body"||ot(n))&&(a=xt(i)),Ce(i))){const h=Fe(i);d=Ge(i),c.x=h.x+i.clientLeft,c.y=h.y+i.clientTop}const g=n&&!u&&!s?zo(n,a):ve(0);return{width:o.width*d.x,height:o.height*d.y,x:o.x*d.x-a.scrollLeft*d.x+c.x+g.x,y:o.y*d.y-a.scrollTop*d.y+c.y+g.y}}function Or(e){return Array.from(e.getClientRects())}function Hr(e){const t=ye(e),o=xt(e),i=e.ownerDocument.body,r=Q(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=Q(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let n=-o.scrollLeft+kt(e);const l=-o.scrollTop;return ue(i).direction==="rtl"&&(n+=Q(t.clientWidth,i.clientWidth)-r),{width:r,height:s,x:n,y:l}}const Po=25;function Fr(e,t){const o=re(e),i=ye(e),r=o.visualViewport;let s=i.clientWidth,n=i.clientHeight,l=0,a=0;if(r){s=r.width,n=r.height;const c=Xt();(!c||c&&t==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}const d=kt(i);if(d<=0){const c=i.ownerDocument,u=c.body,g=getComputedStyle(u),h=c.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,f=Math.abs(i.clientWidth-u.clientWidth-h);f<=Po&&(s-=f)}else d<=Po&&(s+=d);return{width:s,height:n,x:l,y:a}}const Vr=new Set(["absolute","fixed"]);function qr(e,t){const o=Fe(e,!0,t==="fixed"),i=o.top+e.clientTop,r=o.left+e.clientLeft,s=Ce(e)?Ge(e):ve(1),n=e.clientWidth*s.x,l=e.clientHeight*s.y,a=r*s.x,d=i*s.y;return{width:n,height:l,x:a,y:d}}function Oo(e,t,o){let i;if(t==="viewport")i=Fr(e,o);else if(t==="document")i=Hr(ye(e));else if(ge(t))i=qr(t,o);else{const r=Lo(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return yt(i)}function Ho(e,t){const o=$e(e);return o===t||!ge(o)||Xe(o)?!1:ue(o).position==="fixed"||Ho(o,t)}function Nr(e,t){const o=t.get(e);if(o)return o;let i=it(e,[],!1).filter(l=>ge(l)&&je(l)!=="body"),r=null;const s=ue(e).position==="fixed";let n=s?$e(e):e;for(;ge(n)&&!Xe(n);){const l=ue(n),a=jt(n);!a&&l.position==="fixed"&&(r=null),(s?!a&&!r:!a&&l.position==="static"&&!!r&&Vr.has(r.position)||ot(n)&&!a&&Ho(e,n))?i=i.filter(c=>c!==n):r=l,n=$e(n)}return t.set(e,i),i}function Br(e){let{element:t,boundary:o,rootBoundary:i,strategy:r}=e;const n=[...o==="clippingAncestors"?St(t)?[]:Nr(t,this._c):[].concat(o),i],l=n[0],a=n.reduce((d,c)=>{const u=Oo(t,c,r);return d.top=Q(u.top,d.top),d.right=U(u.right,d.right),d.bottom=U(u.bottom,d.bottom),d.left=Q(u.left,d.left),d},Oo(t,l,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Wr(e){const{width:t,height:o}=Ao(e);return{width:t,height:o}}function Yr(e,t,o){const i=Ce(t),r=ye(t),s=o==="fixed",n=Fe(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const a=ve(0);function d(){a.x=kt(r)}if(i||!i&&!s)if((je(t)!=="body"||ot(r))&&(l=xt(t)),i){const h=Fe(t,!0,s,t);a.x=h.x+t.clientLeft,a.y=h.y+t.clientTop}else r&&d();s&&!i&&r&&d();const c=r&&!i&&!s?zo(r,l):ve(0),u=n.left+l.scrollLeft-a.x-c.x,g=n.top+l.scrollTop-a.y-c.y;return{x:u,y:g,width:n.width,height:n.height}}function Jt(e){return ue(e).position==="static"}function Fo(e,t){if(!Ce(e)||ue(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return ye(e)===o&&(o=o.ownerDocument.body),o}function Vo(e,t){const o=re(e);if(St(e))return o;if(!Ce(e)){let r=$e(e);for(;r&&!Xe(r);){if(ge(r)&&!Jt(r))return r;r=$e(r)}return o}let i=Fo(e,t);for(;i&&Er(i)&&Jt(i);)i=Fo(i,t);return i&&Xe(i)&&Jt(i)&&!jt(i)?o:i||$r(e)||o}const Ur=async function(e){const t=this.getOffsetParent||Vo,o=this.getDimensions,i=await o(e.floating);return{reference:Yr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Kr(e){return ue(e).direction==="rtl"}const jr={convertOffsetParentRelativeRectToViewportRelativeRect:Pr,getDocumentElement:ye,getClippingRect:Br,getOffsetParent:Vo,getElementRects:Ur,getClientRects:Or,getDimensions:Wr,getScale:Ge,isElement:ge,isRTL:Kr};function qo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xr(e,t){let o=null,i;const r=ye(e);function s(){var l;clearTimeout(i),(l=o)==null||l.disconnect(),o=null}function n(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),s();const d=e.getBoundingClientRect(),{left:c,top:u,width:g,height:h}=d;if(l||t(),!g||!h)return;const f=_t(u),w=_t(r.clientWidth-(c+g)),p=_t(r.clientHeight-(u+h)),m=_t(c),y={rootMargin:-f+"px "+-w+"px "+-p+"px "+-m+"px",threshold:Q(0,U(1,a))||1};let x=!0;function C(_){const S=_[0].intersectionRatio;if(S!==a){if(!x)return n();S?n(!1,S):i=setTimeout(()=>{n(!1,1e-7)},1e3)}S===1&&!qo(d,e.getBoundingClientRect())&&n(),x=!1}try{o=new IntersectionObserver(C,{...y,root:r.ownerDocument})}catch{o=new IntersectionObserver(C,y)}o.observe(e)}return n(!0),s}function Gr(e,t,o,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=i,d=Qt(e),c=r||s?[...d?it(d):[],...it(t)]:[];c.forEach(m=>{r&&m.addEventListener("scroll",o,{passive:!0}),s&&m.addEventListener("resize",o)});const u=d&&l?Xr(d,o):null;let g=-1,h=null;n&&(h=new ResizeObserver(m=>{let[v]=m;v&&v.target===d&&h&&(h.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var y;(y=h)==null||y.observe(t)})),o()}),d&&!a&&h.observe(d),h.observe(t));let f,w=a?Fe(e):null;a&&p();function p(){const m=Fe(e);w&&!qo(w,m)&&o(),w=m,f=requestAnimationFrame(p)}return o(),()=>{var m;c.forEach(v=>{r&&v.removeEventListener("scroll",o),s&&v.removeEventListener("resize",o)}),u==null||u(),(m=h)==null||m.disconnect(),h=null,a&&cancelAnimationFrame(f)}}const Rt=Cr,rt=Sr,Ve=_r,Qr=xr,Jr=br,qe=(e,t,o)=>{const i=new Map,r={platform:jr,...o},s={...r.platform,_c:i};return mr(e,t,{...r,platform:s})},No={today:"Today",clear:"Clear",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdayNamesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]};function Et(e){const t={};let o="";return e.includes("-")?o="-":e.includes("/")?o="/":e.includes(".")&&(o="."),e.split(o).forEach((r,s)=>{r==="YYYY"||r==="YY"?t.year={index:s,length:r.length}:r==="MM"||r==="M"?t.month={index:s,length:2}:(r==="DD"||r==="D")&&(t.day={index:s,length:2})}),{format:e,separator:o,parts:t,maxLength:e.length}}function Zt(e,t){if(!e||isNaN(e.getTime()))return"";const o=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),{separator:s,parts:n}=t,l=[];for(let a=0;a<3;a++)n.year&&n.year.index===a?l.push(n.year.length===2?String(o).slice(-2):o):n.month&&n.month.index===a?l.push(i):n.day&&n.day.index===a&&l.push(r);return l.join(s)}function Zr(e,t){if(!e)return null;const{separator:o,parts:i}=t,r=e.split(o);let s=null,n=null,l=null;if(r.forEach((d,c)=>{if(d){if(i.year&&i.year.index===c){const u=parseInt(d,10);i.year.length===4&&d.length===4?s=u:i.year.length===2&&d.length===2&&(s=u<100?u+2e3:u)}else if(i.month&&i.month.index===c){const u=parseInt(d,10);d.length===2&&u>=1&&u<=12&&(n=u)}else if(i.day&&i.day.index===c){const u=parseInt(d,10);d.length===2&&u>=1&&u<=31&&(l=u)}}}),s===null||n===null||l===null)return null;const a=new Date(s,n-1,l);return a.getMonth()!==n-1||a.getDate()!==l?null:a}function ne(e){if(!e)return null;let t;if(typeof e=="string"){const[o,i,r]=e.split("-").map(Number);!o||!i||!r?t=new Date(e):t=new Date(o,i-1,r)}else t=new Date(e);return t.setHours(0,0,0,0),isNaN(t.getTime())?null:t}function It(e){const t=e.getFullYear(),o=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${t}-${o}-${i}`}function nt(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function en(e){return nt(e,new Date)}function Qe(e,t){return new Date(e,t+1,0).getDate()}function tn(e,t){return new Date(e,t,1).getDay()}function on(e,t){if(!e)return{min:t-10,max:t+10};if(e.includes("-")){const[i,r]=e.split("-");return{min:parseInt(i,10),max:parseInt(r,10)}}const o=parseInt(e,10);return{min:o,max:o}}function rn(e,t,o=No){const i=nn(e,o),r=sn(e,t,o),s=ln(e,t,o),n=t.showTodayButton!==!1?cn(o):"";return`
|
|
1
|
+
(function(oe,K){typeof exports=="object"&&typeof module<"u"?K(exports):typeof define=="function"&&define.amd?define(["exports"],K):(oe=typeof globalThis<"u"?globalThis:oe||self,K(oe.WebGrid={}))})(this,function(oe){"use strict";var xa=Object.defineProperty;var ka=(oe,K,J)=>K in oe?xa(oe,K,{enumerable:!0,configurable:!0,writable:!0,value:J}):oe[K]=J;var b=(oe,K,J)=>ka(oe,typeof K!="symbol"?K+"":K,J);const K=Math.min,J=Math.max,_t=Math.round,vt=Math.floor,_e=t=>({x:t,y:t}),ar={left:"right",right:"left",bottom:"top",top:"bottom"},dr={start:"end",end:"start"};function Wt(t,e,o){return J(t,K(e,o))}function Ke(t,e){return typeof t=="function"?t(e):t}function Me(t){return t.split("-")[0]}function je(t){return t.split("-")[1]}function Do(t){return t==="x"?"y":"x"}function Yt(t){return t==="y"?"height":"width"}const cr=new Set(["top","bottom"]);function Se(t){return cr.has(Me(t))?"y":"x"}function Ut(t){return Do(Se(t))}function gr(t,e,o){o===void 0&&(o=!1);const i=je(t),r=Ut(t),s=Yt(r);let n=r==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(n=yt(n)),[n,yt(n)]}function ur(t){const e=yt(t);return[Kt(t),e,Kt(e)]}function Kt(t){return t.replace(/start|end/g,e=>dr[e])}const To=["left","right"],Mo=["right","left"],hr=["top","bottom"],fr=["bottom","top"];function wr(t,e,o){switch(t){case"top":case"bottom":return o?e?Mo:To:e?To:Mo;case"left":case"right":return e?hr:fr;default:return[]}}function pr(t,e,o,i){const r=je(t);let s=wr(Me(t),o==="start",i);return r&&(s=s.map(n=>n+"-"+r),e&&(s=s.concat(s.map(Kt)))),s}function yt(t){return t.replace(/left|right|bottom|top/g,e=>ar[e])}function mr(t){return{top:0,right:0,bottom:0,left:0,...t}}function $o(t){return typeof t!="number"?mr(t):{top:t,right:t,bottom:t,left:t}}function Ct(t){const{x:e,y:o,width:i,height:r}=t;return{width:i,height:r,top:o,left:e,right:e+i,bottom:o+r,x:e,y:o}}function Po(t,e,o){let{reference:i,floating:r}=t;const s=Se(e),n=Ut(e),l=Yt(n),a=Me(e),d=s==="y",c=i.x+i.width/2-r.width/2,u=i.y+i.height/2-r.height/2,g=i[l]/2-r[l]/2;let h;switch(a){case"top":h={x:c,y:i.y-r.height};break;case"bottom":h={x:c,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:u};break;case"left":h={x:i.x-r.width,y:u};break;default:h={x:i.x,y:i.y}}switch(je(e)){case"start":h[n]-=g*(o&&d?-1:1);break;case"end":h[n]+=g*(o&&d?-1:1);break}return h}const br=async(t,e,o)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:n}=o,l=s.filter(Boolean),a=await(n.isRTL==null?void 0:n.isRTL(e));let d=await n.getElementRects({reference:t,floating:e,strategy:r}),{x:c,y:u}=Po(d,i,a),g=i,h={},f=0;for(let w=0;w<l.length;w++){const{name:p,fn:m}=l[w],{x:v,y,data:C,reset:S}=await m({x:c,y:u,initialPlacement:i,placement:g,strategy:r,middlewareData:h,rects:d,platform:n,elements:{reference:t,floating:e}});c=v??c,u=y??u,h={...h,[p]:{...h[p],...C}},S&&f<=50&&(f++,typeof S=="object"&&(S.placement&&(g=S.placement),S.rects&&(d=S.rects===!0?await n.getElementRects({reference:t,floating:e,strategy:r}):S.rects),{x:c,y:u}=Po(d,g,a)),w=-1)}return{x:c,y:u,placement:g,strategy:r,middlewareData:h}};async function jt(t,e){var o;e===void 0&&(e={});const{x:i,y:r,platform:s,rects:n,elements:l,strategy:a}=t,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:u="floating",altBoundary:g=!1,padding:h=0}=Ke(e,t),f=$o(h),p=l[g?u==="floating"?"reference":"floating":u],m=Ct(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(p)))==null||o?p:p.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:c,strategy:a})),v=u==="floating"?{x:i,y:r,width:n.floating.width,height:n.floating.height}:n.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),C=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},S=Ct(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:y,strategy:a}):v);return{top:(m.top-S.top+f.top)/C.y,bottom:(S.bottom-m.bottom+f.bottom)/C.y,left:(m.left-S.left+f.left)/C.x,right:(S.right-m.right+f.right)/C.x}}const _r=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:i,placement:r,rects:s,platform:n,elements:l,middlewareData:a}=e,{element:d,padding:c=0}=Ke(t,e)||{};if(d==null)return{};const u=$o(c),g={x:o,y:i},h=Ut(r),f=Yt(h),w=await n.getDimensions(d),p=h==="y",m=p?"top":"left",v=p?"bottom":"right",y=p?"clientHeight":"clientWidth",C=s.reference[f]+s.reference[h]-g[h]-s.floating[f],S=g[h]-s.reference[h],_=await(n.getOffsetParent==null?void 0:n.getOffsetParent(d));let x=_?_[y]:0;(!x||!await(n.isElement==null?void 0:n.isElement(_)))&&(x=l.floating[y]||s.floating[f]);const k=C/2-S/2,I=x/2-w[f]/2-1,E=K(u[m],I),R=K(u[v],I),D=E,L=x-w[f]-R,M=x/2-w[f]/2+k,z=Wt(D,M,L),X=!a.arrow&&je(r)!=null&&M!==z&&s.reference[f]/2-(M<D?E:R)-w[f]/2<0,T=X?M<D?M-D:M-L:0;return{[h]:g[h]+T,data:{[h]:z,centerOffset:M-z-T,...X&&{alignmentOffset:T}},reset:X}}}),vr=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,i;const{placement:r,middlewareData:s,rects:n,initialPlacement:l,platform:a,elements:d}=e,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:w=!0,...p}=Ke(t,e);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const m=Me(r),v=Se(l),y=Me(l)===l,C=await(a.isRTL==null?void 0:a.isRTL(d.floating)),S=g||(y||!w?[yt(l)]:ur(l)),_=f!=="none";!g&&_&&S.push(...pr(l,w,f,C));const x=[l,...S],k=await jt(e,p),I=[];let E=((i=s.flip)==null?void 0:i.overflows)||[];if(c&&I.push(k[m]),u){const M=gr(r,n,C);I.push(k[M[0]],k[M[1]])}if(E=[...E,{placement:r,overflows:I}],!I.every(M=>M<=0)){var R,D;const M=(((R=s.flip)==null?void 0:R.index)||0)+1,z=x[M];if(z&&(!(u==="alignment"?v!==Se(z):!1)||E.every(P=>Se(P.placement)===v?P.overflows[0]>0:!0)))return{data:{index:M,overflows:E},reset:{placement:z}};let X=(D=E.filter(T=>T.overflows[0]<=0).sort((T,P)=>T.overflows[1]-P.overflows[1])[0])==null?void 0:D.placement;if(!X)switch(h){case"bestFit":{var L;const T=(L=E.filter(P=>{if(_){const Y=Se(P.placement);return Y===v||Y==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(Y=>Y>0).reduce((Y,B)=>Y+B,0)]).sort((P,Y)=>P[1]-Y[1])[0])==null?void 0:L[0];T&&(X=T);break}case"initialPlacement":X=l;break}if(r!==X)return{reset:{placement:X}}}return{}}}},yr=new Set(["left","top"]);async function Cr(t,e){const{placement:o,platform:i,elements:r}=t,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),n=Me(o),l=je(o),a=Se(o)==="y",d=yr.has(n)?-1:1,c=s&&a?-1:1,u=Ke(e,t);let{mainAxis:g,crossAxis:h,alignmentAxis:f}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof f=="number"&&(h=l==="end"?f*-1:f),a?{x:h*c,y:g*d}:{x:g*d,y:h*c}}const Sr=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,i;const{x:r,y:s,placement:n,middlewareData:l}=e,a=await Cr(e,t);return n===((o=l.offset)==null?void 0:o.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:r+a.x,y:s+a.y,data:{...a,placement:n}}}}},xr=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:i,placement:r}=e,{mainAxis:s=!0,crossAxis:n=!1,limiter:l={fn:p=>{let{x:m,y:v}=p;return{x:m,y:v}}},...a}=Ke(t,e),d={x:o,y:i},c=await jt(e,a),u=Se(Me(r)),g=Do(u);let h=d[g],f=d[u];if(s){const p=g==="y"?"top":"left",m=g==="y"?"bottom":"right",v=h+c[p],y=h-c[m];h=Wt(v,h,y)}if(n){const p=u==="y"?"top":"left",m=u==="y"?"bottom":"right",v=f+c[p],y=f-c[m];f=Wt(v,f,y)}const w=l.fn({...e,[g]:h,[u]:f});return{...w,data:{x:w.x-o,y:w.y-i,enabled:{[g]:s,[u]:n}}}}}},kr=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var o,i;const{placement:r,rects:s,platform:n,elements:l}=e,{apply:a=()=>{},...d}=Ke(t,e),c=await jt(e,d),u=Me(r),g=je(r),h=Se(r)==="y",{width:f,height:w}=s.floating;let p,m;u==="top"||u==="bottom"?(p=u,m=g===(await(n.isRTL==null?void 0:n.isRTL(l.floating))?"start":"end")?"left":"right"):(m=u,p=g==="end"?"top":"bottom");const v=w-c.top-c.bottom,y=f-c.left-c.right,C=K(w-c[p],v),S=K(f-c[m],y),_=!e.middlewareData.shift;let x=C,k=S;if((o=e.middlewareData.shift)!=null&&o.enabled.x&&(k=y),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(x=v),_&&!g){const E=J(c.left,0),R=J(c.right,0),D=J(c.top,0),L=J(c.bottom,0);h?k=f-2*(E!==0||R!==0?E+R:J(c.left,c.right)):x=w-2*(D!==0||L!==0?D+L:J(c.top,c.bottom))}await a({...e,availableWidth:k,availableHeight:x});const I=await n.getDimensions(l.floating);return f!==I.width||w!==I.height?{reset:{rects:!0}}:{}}}};function St(){return typeof window<"u"}function Xe(t){return Ao(t)?(t.nodeName||"").toLowerCase():"#document"}function ne(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function ve(t){var e;return(e=(Ao(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Ao(t){return St()?t instanceof Node||t instanceof ne(t).Node:!1}function ce(t){return St()?t instanceof Element||t instanceof ne(t).Element:!1}function ye(t){return St()?t instanceof HTMLElement||t instanceof ne(t).HTMLElement:!1}function Lo(t){return!St()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ne(t).ShadowRoot}const Er=new Set(["inline","contents"]);function rt(t){const{overflow:e,overflowX:o,overflowY:i,display:r}=ge(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+o)&&!Er.has(r)}const Ir=new Set(["table","td","th"]);function Rr(t){return Ir.has(Xe(t))}const Dr=[":popover-open",":modal"];function xt(t){return Dr.some(e=>{try{return t.matches(e)}catch{return!1}})}const Tr=["transform","translate","scale","rotate","perspective"],Mr=["transform","translate","scale","rotate","perspective","filter"],$r=["paint","layout","strict","content"];function Xt(t){const e=Gt(),o=ce(t)?ge(t):t;return Tr.some(i=>o[i]?o[i]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||Mr.some(i=>(o.willChange||"").includes(i))||$r.some(i=>(o.contain||"").includes(i))}function Pr(t){let e=$e(t);for(;ye(e)&&!Ge(e);){if(Xt(e))return e;if(xt(e))return null;e=$e(e)}return null}function Gt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ar=new Set(["html","body","#document"]);function Ge(t){return Ar.has(Xe(t))}function ge(t){return ne(t).getComputedStyle(t)}function kt(t){return ce(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $e(t){if(Xe(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Lo(t)&&t.host||ve(t);return Lo(e)?e.host:e}function zo(t){const e=$e(t);return Ge(e)?t.ownerDocument?t.ownerDocument.body:t.body:ye(e)&&rt(e)?e:zo(e)}function nt(t,e,o){var i;e===void 0&&(e=[]),o===void 0&&(o=!0);const r=zo(t),s=r===((i=t.ownerDocument)==null?void 0:i.body),n=ne(r);if(s){const l=Qt(n);return e.concat(n,n.visualViewport||[],rt(r)?r:[],l&&o?nt(l):[])}return e.concat(r,nt(r,[],o))}function Qt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Oo(t){const e=ge(t);let o=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=ye(t),s=r?t.offsetWidth:o,n=r?t.offsetHeight:i,l=_t(o)!==s||_t(i)!==n;return l&&(o=s,i=n),{width:o,height:i,$:l}}function Jt(t){return ce(t)?t:t.contextElement}function Qe(t){const e=Jt(t);if(!ye(e))return _e(1);const o=e.getBoundingClientRect(),{width:i,height:r,$:s}=Oo(e);let n=(s?_t(o.width):o.width)/i,l=(s?_t(o.height):o.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!l||!Number.isFinite(l))&&(l=1),{x:n,y:l}}const Lr=_e(0);function Ho(t){const e=ne(t);return!Gt()||!e.visualViewport?Lr:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function zr(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==ne(t)?!1:e}function qe(t,e,o,i){e===void 0&&(e=!1),o===void 0&&(o=!1);const r=t.getBoundingClientRect(),s=Jt(t);let n=_e(1);e&&(i?ce(i)&&(n=Qe(i)):n=Qe(t));const l=zr(s,o,i)?Ho(s):_e(0);let a=(r.left+l.x)/n.x,d=(r.top+l.y)/n.y,c=r.width/n.x,u=r.height/n.y;if(s){const g=ne(s),h=i&&ce(i)?ne(i):i;let f=g,w=Qt(f);for(;w&&i&&h!==f;){const p=Qe(w),m=w.getBoundingClientRect(),v=ge(w),y=m.left+(w.clientLeft+parseFloat(v.paddingLeft))*p.x,C=m.top+(w.clientTop+parseFloat(v.paddingTop))*p.y;a*=p.x,d*=p.y,c*=p.x,u*=p.y,a+=y,d+=C,f=ne(w),w=Qt(f)}}return Ct({width:c,height:u,x:a,y:d})}function Et(t,e){const o=kt(t).scrollLeft;return e?e.left+o:qe(ve(t)).left+o}function Fo(t,e){const o=t.getBoundingClientRect(),i=o.left+e.scrollLeft-Et(t,o),r=o.top+e.scrollTop;return{x:i,y:r}}function Or(t){let{elements:e,rect:o,offsetParent:i,strategy:r}=t;const s=r==="fixed",n=ve(i),l=e?xt(e.floating):!1;if(i===n||l&&s)return o;let a={scrollLeft:0,scrollTop:0},d=_e(1);const c=_e(0),u=ye(i);if((u||!u&&!s)&&((Xe(i)!=="body"||rt(n))&&(a=kt(i)),ye(i))){const h=qe(i);d=Qe(i),c.x=h.x+i.clientLeft,c.y=h.y+i.clientTop}const g=n&&!u&&!s?Fo(n,a):_e(0);return{width:o.width*d.x,height:o.height*d.y,x:o.x*d.x-a.scrollLeft*d.x+c.x+g.x,y:o.y*d.y-a.scrollTop*d.y+c.y+g.y}}function Hr(t){return Array.from(t.getClientRects())}function Fr(t){const e=ve(t),o=kt(t),i=t.ownerDocument.body,r=J(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=J(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-o.scrollLeft+Et(t);const l=-o.scrollTop;return ge(i).direction==="rtl"&&(n+=J(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:n,y:l}}const qo=25;function qr(t,e){const o=ne(t),i=ve(t),r=o.visualViewport;let s=i.clientWidth,n=i.clientHeight,l=0,a=0;if(r){s=r.width,n=r.height;const c=Gt();(!c||c&&e==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}const d=Et(i);if(d<=0){const c=i.ownerDocument,u=c.body,g=getComputedStyle(u),h=c.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,f=Math.abs(i.clientWidth-u.clientWidth-h);f<=qo&&(s-=f)}else d<=qo&&(s+=d);return{width:s,height:n,x:l,y:a}}const Vr=new Set(["absolute","fixed"]);function Nr(t,e){const o=qe(t,!0,e==="fixed"),i=o.top+t.clientTop,r=o.left+t.clientLeft,s=ye(t)?Qe(t):_e(1),n=t.clientWidth*s.x,l=t.clientHeight*s.y,a=r*s.x,d=i*s.y;return{width:n,height:l,x:a,y:d}}function Vo(t,e,o){let i;if(e==="viewport")i=qr(t,o);else if(e==="document")i=Fr(ve(t));else if(ce(e))i=Nr(e,o);else{const r=Ho(t);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Ct(i)}function No(t,e){const o=$e(t);return o===e||!ce(o)||Ge(o)?!1:ge(o).position==="fixed"||No(o,e)}function Br(t,e){const o=e.get(t);if(o)return o;let i=nt(t,[],!1).filter(l=>ce(l)&&Xe(l)!=="body"),r=null;const s=ge(t).position==="fixed";let n=s?$e(t):t;for(;ce(n)&&!Ge(n);){const l=ge(n),a=Xt(n);!a&&l.position==="fixed"&&(r=null),(s?!a&&!r:!a&&l.position==="static"&&!!r&&Vr.has(r.position)||rt(n)&&!a&&No(t,n))?i=i.filter(c=>c!==n):r=l,n=$e(n)}return e.set(t,i),i}function Wr(t){let{element:e,boundary:o,rootBoundary:i,strategy:r}=t;const n=[...o==="clippingAncestors"?xt(e)?[]:Br(e,this._c):[].concat(o),i],l=n[0],a=n.reduce((d,c)=>{const u=Vo(e,c,r);return d.top=J(u.top,d.top),d.right=K(u.right,d.right),d.bottom=K(u.bottom,d.bottom),d.left=J(u.left,d.left),d},Vo(e,l,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Yr(t){const{width:e,height:o}=Oo(t);return{width:e,height:o}}function Ur(t,e,o){const i=ye(e),r=ve(e),s=o==="fixed",n=qe(t,!0,s,e);let l={scrollLeft:0,scrollTop:0};const a=_e(0);function d(){a.x=Et(r)}if(i||!i&&!s)if((Xe(e)!=="body"||rt(r))&&(l=kt(e)),i){const h=qe(e,!0,s,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else r&&d();s&&!i&&r&&d();const c=r&&!i&&!s?Fo(r,l):_e(0),u=n.left+l.scrollLeft-a.x-c.x,g=n.top+l.scrollTop-a.y-c.y;return{x:u,y:g,width:n.width,height:n.height}}function Zt(t){return ge(t).position==="static"}function Bo(t,e){if(!ye(t)||ge(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return ve(t)===o&&(o=o.ownerDocument.body),o}function Wo(t,e){const o=ne(t);if(xt(t))return o;if(!ye(t)){let r=$e(t);for(;r&&!Ge(r);){if(ce(r)&&!Zt(r))return r;r=$e(r)}return o}let i=Bo(t,e);for(;i&&Rr(i)&&Zt(i);)i=Bo(i,e);return i&&Ge(i)&&Zt(i)&&!Xt(i)?o:i||Pr(t)||o}const Kr=async function(t){const e=this.getOffsetParent||Wo,o=this.getDimensions,i=await o(t.floating);return{reference:Ur(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function jr(t){return ge(t).direction==="rtl"}const Xr={convertOffsetParentRelativeRectToViewportRelativeRect:Or,getDocumentElement:ve,getClippingRect:Wr,getOffsetParent:Wo,getElementRects:Kr,getClientRects:Hr,getDimensions:Yr,getScale:Qe,isElement:ce,isRTL:jr};function Yo(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Gr(t,e){let o=null,i;const r=ve(t);function s(){var l;clearTimeout(i),(l=o)==null||l.disconnect(),o=null}function n(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),s();const d=t.getBoundingClientRect(),{left:c,top:u,width:g,height:h}=d;if(l||e(),!g||!h)return;const f=vt(u),w=vt(r.clientWidth-(c+g)),p=vt(r.clientHeight-(u+h)),m=vt(c),y={rootMargin:-f+"px "+-w+"px "+-p+"px "+-m+"px",threshold:J(0,K(1,a))||1};let C=!0;function S(_){const x=_[0].intersectionRatio;if(x!==a){if(!C)return n();x?n(!1,x):i=setTimeout(()=>{n(!1,1e-7)},1e3)}x===1&&!Yo(d,t.getBoundingClientRect())&&n(),C=!1}try{o=new IntersectionObserver(S,{...y,root:r.ownerDocument})}catch{o=new IntersectionObserver(S,y)}o.observe(t)}return n(!0),s}function Qr(t,e,o,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=i,d=Jt(t),c=r||s?[...d?nt(d):[],...nt(e)]:[];c.forEach(m=>{r&&m.addEventListener("scroll",o,{passive:!0}),s&&m.addEventListener("resize",o)});const u=d&&l?Gr(d,o):null;let g=-1,h=null;n&&(h=new ResizeObserver(m=>{let[v]=m;v&&v.target===d&&h&&(h.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var y;(y=h)==null||y.observe(e)})),o()}),d&&!a&&h.observe(d),h.observe(e));let f,w=a?qe(t):null;a&&p();function p(){const m=qe(t);w&&!Yo(w,m)&&o(),w=m,f=requestAnimationFrame(p)}return o(),()=>{var m;c.forEach(v=>{r&&v.removeEventListener("scroll",o),s&&v.removeEventListener("resize",o)}),u==null||u(),(m=h)==null||m.disconnect(),h=null,a&&cancelAnimationFrame(f)}}const It=Sr,st=xr,Ve=vr,Jr=kr,Zr=_r,Ne=(t,e,o)=>{const i=new Map,r={platform:Xr,...o},s={...r.platform,_c:i};return br(t,e,{...r,platform:s})},Uo={today:"Today",clear:"Clear",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdayNamesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]};function Rt(t){const e={};let o="";return t.includes("-")?o="-":t.includes("/")?o="/":t.includes(".")&&(o="."),t.split(o).forEach((r,s)=>{r==="YYYY"||r==="YY"?e.year={index:s,length:r.length}:r==="MM"||r==="M"?e.month={index:s,length:2}:(r==="DD"||r==="D")&&(e.day={index:s,length:2})}),{format:t,separator:o,parts:e,maxLength:t.length}}function eo(t,e){if(!t||isNaN(t.getTime()))return"";const o=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),{separator:s,parts:n}=e,l=[];for(let a=0;a<3;a++)n.year&&n.year.index===a?l.push(n.year.length===2?String(o).slice(-2):o):n.month&&n.month.index===a?l.push(i):n.day&&n.day.index===a&&l.push(r);return l.join(s)}function en(t,e){if(!t)return null;const{separator:o,parts:i}=e,r=t.split(o);let s=null,n=null,l=null;if(r.forEach((d,c)=>{if(d){if(i.year&&i.year.index===c){const u=parseInt(d,10);i.year.length===4&&d.length===4?s=u:i.year.length===2&&d.length===2&&(s=u<100?u+2e3:u)}else if(i.month&&i.month.index===c){const u=parseInt(d,10);d.length===2&&u>=1&&u<=12&&(n=u)}else if(i.day&&i.day.index===c){const u=parseInt(d,10);d.length===2&&u>=1&&u<=31&&(l=u)}}}),s===null||n===null||l===null)return null;const a=new Date(s,n-1,l);return a.getMonth()!==n-1||a.getDate()!==l?null:a}function se(t){if(!t)return null;let e;if(typeof t=="string"){const[o,i,r]=t.split("-").map(Number);!o||!i||!r?e=new Date(t):e=new Date(o,i-1,r)}else e=new Date(t);return e.setHours(0,0,0,0),isNaN(e.getTime())?null:e}function Dt(t){const e=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");return`${e}-${o}-${i}`}function lt(t,e){return!t||!e?!1:t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function tn(t){return lt(t,new Date)}function Je(t,e){return new Date(t,e+1,0).getDate()}function on(t,e){return new Date(t,e,1).getDay()}function rn(t,e){if(!t)return{min:e-10,max:e+10};if(t.includes("-")){const[i,r]=t.split("-");return{min:parseInt(i,10),max:parseInt(r,10)}}const o=parseInt(t,10);return{min:o,max:o}}function nn(t,e,o=Uo){const i=sn(t,o),r=ln(t,e,o),s=an(t,e,o),n=e.showTodayButton!==!1?gn(o):"";return`
|
|
2
2
|
<div class="wg-datepicker">
|
|
3
3
|
<div class="wg-datepicker__header">
|
|
4
4
|
${i}
|
|
5
5
|
</div>
|
|
6
|
-
<div class="wg-datepicker__rolling-selector${
|
|
6
|
+
<div class="wg-datepicker__rolling-selector${t.rollingSelectorOpen?" wg-datepicker__rolling-selector--visible":""}">
|
|
7
7
|
${r}
|
|
8
8
|
</div>
|
|
9
|
-
<div class="wg-datepicker__calendar${
|
|
9
|
+
<div class="wg-datepicker__calendar${t.rollingSelectorOpen?" wg-datepicker__calendar--hidden":""}">
|
|
10
10
|
${s}
|
|
11
11
|
</div>
|
|
12
12
|
${n}
|
|
13
13
|
</div>
|
|
14
|
-
`}function
|
|
14
|
+
`}function sn(t,e){return`
|
|
15
15
|
<button type="button" class="wg-datepicker__nav wg-datepicker__nav--prev" data-action="prev-month">
|
|
16
16
|
<svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>
|
|
17
17
|
</button>
|
|
18
18
|
<button type="button" class="wg-datepicker__month-year" data-action="toggle-rolling">
|
|
19
|
-
${
|
|
19
|
+
${e.monthNames[t.viewMonth]} ${t.viewYear}
|
|
20
20
|
</button>
|
|
21
21
|
<button type="button" class="wg-datepicker__nav wg-datepicker__nav--next" data-action="next-month">
|
|
22
22
|
<svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"/></svg>
|
|
23
23
|
</button>
|
|
24
|
-
`}function
|
|
24
|
+
`}function ln(t,e,o){const i=rn(e.rollingYearRange,new Date().getFullYear());let r="";for(let n=i.min;n<=i.max;n++){const l=n===t.viewYear?" wg-datepicker__rolling-item--selected":"";r+=`<div class="wg-datepicker__rolling-item${l}" data-year="${n}">${n}</div>`}let s="";for(let n=0;n<12;n++){const l=n===t.viewMonth?" wg-datepicker__rolling-item--selected":"";s+=`<div class="wg-datepicker__rolling-item${l}" data-month="${n}">${o.monthNamesShort[n]}</div>`}return`
|
|
25
25
|
<div class="wg-datepicker__rolling-lists">
|
|
26
26
|
<div class="wg-datepicker__rolling-list" data-list="months">
|
|
27
27
|
${s}
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
${r}
|
|
31
31
|
</div>
|
|
32
32
|
</div>
|
|
33
|
-
`}function
|
|
33
|
+
`}function an(t,e,o){const i=dn(o),r=Ko(t,e);return`
|
|
34
34
|
<div class="wg-datepicker__weekdays">
|
|
35
35
|
${i}
|
|
36
36
|
</div>
|
|
37
37
|
<div class="wg-datepicker__days">
|
|
38
38
|
${r}
|
|
39
39
|
</div>
|
|
40
|
-
`}function
|
|
40
|
+
`}function dn(t){return t.weekdayNamesShort.map(e=>`<div class="wg-datepicker__weekday">${e}</div>`).join("")}function Ko(t,e){const{viewYear:o,viewMonth:i,selectedDate:r,focusedDate:s}=t,n=e.minDate?se(e.minDate):null,l=e.maxDate?se(e.maxDate):null,a=on(o,i),d=Je(o,i),c=Je(o,i-1),u=new Date(o,i-1,1),g=u.getFullYear(),h=u.getMonth(),f=new Date(o,i+1,1),w=f.getFullYear(),p=f.getMonth(),m=[];for(let S=a-1;S>=0;S--){const _=c-S;m.push({date:new Date(g,h,_),day:_,isOtherMonth:!0})}for(let S=1;S<=d;S++)m.push({date:new Date(o,i,S),day:S,isOtherMonth:!1});const y=Math.ceil((a+d)/7)*7-m.length;for(let S=1;S<=y;S++)m.push({date:new Date(w,p,S),day:S,isOtherMonth:!0});let C="";for(const S of m){const _=["wg-datepicker__day"];S.isOtherMonth&&_.push("wg-datepicker__day--other-month"),cn(S.date,n,l)&&_.push("wg-datepicker__day--disabled"),tn(S.date)&&_.push("wg-datepicker__day--today"),lt(S.date,r)&&_.push("wg-datepicker__day--selected"),lt(S.date,s)&&_.push("wg-datepicker__day--focused");const k=Dt(S.date);C+=`<div class="${_.join(" ")}" data-date="${k}">${S.day}</div>`}return C}function cn(t,e,o){return!!(e&&t<e||o&&t>o)}function gn(t){return`
|
|
41
41
|
<div class="wg-datepicker__footer">
|
|
42
42
|
<button type="button" class="wg-datepicker__today-btn" data-action="today">
|
|
43
|
-
${
|
|
43
|
+
${t.today}
|
|
44
44
|
</button>
|
|
45
45
|
</div>
|
|
46
|
-
`}function
|
|
46
|
+
`}function un(t,e,o){const i=t.querySelector(".wg-datepicker__days");i&&(i.innerHTML=Ko(e,o))}function hn(t,e,o){const i=t.querySelector(".wg-datepicker__month-year");if(i){const r=o.monthNames[e.viewMonth];i.textContent=`${r} ${e.viewYear}`}}function fn(t,e){const o=t.querySelector(".wg-datepicker__rolling-selector"),i=t.querySelector(".wg-datepicker__calendar");o&&o.classList.toggle("wg-datepicker__rolling-selector--visible",e),i&&i.classList.toggle("wg-datepicker__calendar--hidden",e)}function wn(t,e){t.querySelectorAll("[data-year]").forEach(r=>{const s=parseInt(r.dataset.year||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",s===e.viewYear)}),t.querySelectorAll("[data-month]").forEach(r=>{const s=parseInt(r.dataset.month||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",s===e.viewMonth)})}function jo(t){const e=t.querySelector("[data-year].wg-datepicker__rolling-item--selected"),o=t.querySelector("[data-month].wg-datepicker__rolling-item--selected");if(e){const i=e.parentElement;if(i){const r=e.offsetTop-i.clientHeight/2+e.clientHeight/2;i.scrollTop=r}}if(o){const i=o.parentElement;if(i){const r=o.offsetTop-i.clientHeight/2+o.clientHeight/2;i.scrollTop=r}}}function to(t){t.viewMonth===0?(t.viewMonth=11,t.viewYear--):t.viewMonth--}function oo(t){t.viewMonth===11?(t.viewMonth=0,t.viewYear++):t.viewMonth++}function pn(t,e,o,i){var s,n,l,a;const{key:r}=t;if(r==="Escape")return(s=i.onClose)==null||s.call(i),!0;if(e.rollingSelectorOpen)return bn(t,e);if((r==="ArrowLeft"||r==="ArrowRight")&&(t.ctrlKey||t.metaKey)){if(t.preventDefault(),r==="ArrowLeft"?to(e):oo(e),e.focusedDate){const d=Math.min(e.focusedDate.getDate(),Je(e.viewYear,e.viewMonth));e.focusedDate=new Date(e.viewYear,e.viewMonth,d)}return!0}if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(r))return t.preventDefault(),mn(e,r,o),!0;if(r==="Enter")return t.preventDefault(),t.stopPropagation(),e.focusedDate&&((n=i.onSelect)==null||n.call(i,e.focusedDate,"down")),!0;if(r==="Tab")return t.preventDefault(),e.focusedDate?(l=i.onSelect)==null||l.call(i,e.focusedDate,"next"):(a=i.onClose)==null||a.call(i),!0;if(r==="Home"){if(t.preventDefault(),t.ctrlKey||t.metaKey){let d=e.viewYear;const c=new Date(d,0,1);if(e.focusedDate&<(e.focusedDate,c)&&d--,o.minDate){const u=se(o.minDate);u&&d<u.getFullYear()&&(d=u.getFullYear())}e.viewMonth=0,e.viewYear=d,e.focusedDate=new Date(d,0,1)}else e.focusedDate=new Date(e.viewYear,e.viewMonth,1);return!0}if(r==="End"){if(t.preventDefault(),t.ctrlKey||t.metaKey){let d=e.viewYear;const c=new Date(d,11,31);if(e.focusedDate&<(e.focusedDate,c)&&d++,o.maxDate){const u=se(o.maxDate);u&&d>u.getFullYear()&&(d=u.getFullYear())}e.viewMonth=11,e.viewYear=d,e.focusedDate=new Date(d,11,31)}else{const d=Je(e.viewYear,e.viewMonth);e.focusedDate=new Date(e.viewYear,e.viewMonth,d)}return!0}if(r==="PageUp"){if(t.preventDefault(),to(e),e.focusedDate){const d=Math.min(e.focusedDate.getDate(),Je(e.viewYear,e.viewMonth));e.focusedDate=new Date(e.viewYear,e.viewMonth,d)}return!0}if(r==="PageDown"){if(t.preventDefault(),oo(e),e.focusedDate){const d=Math.min(e.focusedDate.getDate(),Je(e.viewYear,e.viewMonth));e.focusedDate=new Date(e.viewYear,e.viewMonth,d)}return!0}return!1}function mn(t,e,o){if(!t.focusedDate){t.focusedDate=t.selectedDate?new Date(t.selectedDate):new Date(t.viewYear,t.viewMonth,1);return}const i=new Date(t.focusedDate),r=o.minDate?se(o.minDate):null,s=o.maxDate?se(o.maxDate):null;switch(e){case"ArrowLeft":i.setDate(i.getDate()-1);break;case"ArrowRight":i.setDate(i.getDate()+1);break;case"ArrowUp":i.setDate(i.getDate()-7);break;case"ArrowDown":i.setDate(i.getDate()+7);break}r&&i<r||s&&i>s||(t.focusedDate=i,(i.getMonth()!==t.viewMonth||i.getFullYear()!==t.viewYear)&&(t.viewMonth=i.getMonth(),t.viewYear=i.getFullYear()))}function bn(t,e){const{key:o}=t;if(o==="ArrowUp"||o==="ArrowDown"){t.preventDefault();const i=o==="ArrowUp"?-1:1;if(e.rollingSelectorMode==="month"){const r=e.viewMonth+i;r>=0&&r<=11&&(e.viewMonth=r)}else e.viewYear+=i;return!0}return o==="ArrowLeft"||o==="ArrowRight"?(t.preventDefault(),e.rollingSelectorMode=e.rollingSelectorMode==="month"?"year":"month",!0):o==="Enter"||o==="Escape"?(t.preventDefault(),e.rollingSelectorOpen=!1,!0):!1}function _n(t){if(t.selectedDate)t.focusedDate=new Date(t.selectedDate),t.viewYear=t.selectedDate.getFullYear(),t.viewMonth=t.selectedDate.getMonth();else{const e=new Date;t.focusedDate=new Date(t.viewYear,t.viewMonth,e.getDate())}}function vn(t,e,o){const i=t.dataset.date;if(!i||t.classList.contains("wg-datepicker__day--disabled"))return null;const[r,s,n]=i.split("-").map(Number),l=new Date(r,s-1,n),a=o.minDate?se(o.minDate):null,d=o.maxDate?se(o.maxDate):null;return a&&l<a||d&&l>d?null:(e.selectedDate=l,e.focusedDate=l,l)}function yn(t,e){const o=new Date;o.setHours(0,0,0,0);const i=e.minDate?se(e.minDate):null,r=e.maxDate?se(e.maxDate):null;return i&&o<i||r&&o>r?null:(t.selectedDate=o,t.focusedDate=o,t.viewYear=o.getFullYear(),t.viewMonth=o.getMonth(),o)}function Cn(t,e){const o=t.dataset.month;o!==void 0&&(e.viewMonth=parseInt(o,10))}function Sn(t,e){const o=t.dataset.year;o!==void 0&&(e.viewYear=parseInt(o,10))}function io(t,e){var u,g,h,f;const{separator:o,parts:i,maxLength:r}=e,s=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=t.replace(new RegExp(s,"g"),""),l=((u=i.year)==null?void 0:u.length)??4,a=[{type:"year",pos:((g=i.year)==null?void 0:g.index)??0,length:l},{type:"month",pos:((h=i.month)==null?void 0:h.index)??1,length:2},{type:"day",pos:((f=i.day)==null?void 0:f.index)??2,length:2}].sort((w,p)=>w.pos-p.pos);let d="",c=0;for(let w=0;w<a.length;w++){const p=a[w],m=n.substring(c,c+p.length);if(!m)break;d+=m,c+=m.length,w<a.length-1&&m.length===p.length&&(d+=o)}return d.substring(0,r)}function xn(t,e,o){const i=t.value,r=t.selectionStart||0,s=i.length<o.length,{separator:n}=e,l=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=i.replace(new RegExp(`[^0-9${l}]`,"g"),""),d=io(a,e);if(d!==i){t.value=d;let c=r;if(s)c=r;else if(d.length>i.length&&d[r]===n)c=r+1;else if(d.length>i.length){const u=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),g=(i.substring(0,r).match(new RegExp(u,"g"))||[]).length,f=(d.substring(0,r).match(new RegExp(u,"g"))||[]).length-g;c=r+f}t.setSelectionRange(c,c)}return d}function kn(t,e){const{key:o,ctrlKey:i,metaKey:r}=t,{separator:s}=e;if(["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(o)||i||r)return!1;if(o===s){const l=t.target,a=l.selectionStart||0,d=l.value;let c=0;for(let g=a-1;g>=0;g--)if(d[g]===s){c=g+1;break}const u=d.substring(c,a);if(/^\d$/.test(u)){t.preventDefault();const g=d.substring(0,c)+"0"+u+s+d.substring(a);l.value=g;const h=c+2+s.length;return l.setSelectionRange(h,h),!0}}return!/^\d$/.test(o)&&o!==s?(t.preventDefault(),!0):!1}function En(t,e,o){var h;t.preventDefault();const i=((h=t.clipboardData)==null?void 0:h.getData("text"))||"",{separator:r}=o,s=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=i.replace(new RegExp(`[^0-9${s}]`,"g"),""),l=io(n,o),a=e.selectionStart||0,d=e.selectionEnd||0,c=e.value,u=c.substring(0,a)+l+c.substring(d);e.value=io(u,o);const g=a+l.length;e.setSelectionRange(g,g)}function In(t,e,o,i){if(!t||t.length<e.maxLength)return!1;const r=en(t,e);if(!r)return!1;const s=i.minDate?se(i.minDate):null,n=i.maxDate?se(i.maxDate):null;return s&&r<s||n&&r>n?!1:(o.selectedDate=r,o.focusedDate=r,o.viewYear=r.getFullYear(),o.viewMonth=r.getMonth(),!0)}const Rn=`
|
|
47
47
|
.wg-datepicker-container {
|
|
48
48
|
position: fixed;
|
|
49
49
|
z-index: var(--wg-dp-z-index, 9999);
|
|
@@ -293,106 +293,106 @@
|
|
|
293
293
|
.wg-datepicker__today-btn:hover {
|
|
294
294
|
background-color: color-mix(in srgb, var(--wg-dp-accent-color) 10%, transparent);
|
|
295
295
|
}
|
|
296
|
-
`;let Yo=!1;class Dt{constructor(t={}){b(this,"options");b(this,"state");b(this,"localeStrings");b(this,"formatInfo");b(this,"element",null);b(this,"anchor",null);b(this,"input",null);b(this,"cleanupAutoUpdate",null);b(this,"previousInputValue","");b(this,"boundHandleClickOutside");b(this,"boundHandleKeyDown");this.options={dateFormat:"YYYY-MM-DD",showTodayButton:!0,...t};const o=new Date;this.state={viewMonth:o.getMonth(),viewYear:o.getFullYear(),selectedDate:null,isOpen:!1,rollingSelectorOpen:!1,rollingSelectorMode:"month",focusedDate:null},this.localeStrings=this.initLocaleStrings(t.locale),this.formatInfo=Et(this.options.dateFormat||"YYYY-MM-DD"),this.boundHandleClickOutside=this.handleClickOutside.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}initLocaleStrings(t){const o=t||navigator.language||"en";try{const i=new Intl.DateTimeFormat(o,{month:"long"}),r=new Intl.DateTimeFormat(o,{month:"short"}),s=new Intl.DateTimeFormat(o,{weekday:"long"}),n=new Intl.DateTimeFormat(o,{weekday:"short"}),l=[],a=[];for(let u=0;u<12;u++){const g=new Date(2024,u,1);l.push(i.format(g)),a.push(r.format(g))}const d=[],c=[];for(let u=0;u<7;u++){const g=new Date(2024,0,7+u);d.push(s.format(g));const h=n.format(g);c.push(h.substring(0,2))}return{today:"Today",clear:"Clear",monthNames:l,monthNamesShort:a,weekdayNames:d,weekdayNamesShort:c}}catch{return No}}static injectStyles(){if(Yo)return;const t=document.createElement("style");t.id="wg-datepicker-styles",t.textContent=En,document.head.appendChild(t),Yo=!0}open(t,o=null){Dt.injectStyles(),this.state.isOpen&&this.close(),this.anchor=t;const i=ne(o);if(i)this.state.selectedDate=i,this.state.viewYear=i.getFullYear(),this.state.viewMonth=i.getMonth();else{const r=new Date;this.state.viewYear=r.getFullYear(),this.state.viewMonth=r.getMonth()}bn(this.state),this.element=document.createElement("div"),this.element.className="wg-datepicker-container",this.element.innerHTML=rn(this.state,this.options,this.localeStrings),document.body.appendChild(this.element),this.position(),this.attachListeners(),this.state.isOpen=!0,this.state.rollingSelectorOpen&&Wo(this.element)}close(t=!1){var o,i;this.state.isOpen&&(this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),document.removeEventListener("mousedown",this.boundHandleClickOutside),document.removeEventListener("keydown",this.boundHandleKeyDown),this.element&&(this.element.remove(),this.element=null),this.state.isOpen=!1,this.state.rollingSelectorOpen=!1,t||(i=(o=this.options).onClose)==null||i.call(o))}destroy(){this.close(),this.anchor=null,this.input=null}getSelectedDate(){return this.state.selectedDate}getFormattedValue(){return Zt(this.state.selectedDate,this.formatInfo)}position(){if(!this.element||!this.anchor)return;const t=this.element.querySelector(".wg-datepicker");t&&(this.cleanupAutoUpdate=Gr(this.anchor,t,()=>{if(!this.anchor.isConnected){this.close(!0);return}qe(this.anchor,t,{placement:"bottom-start",middleware:[Rt(4),Ve({fallbackPlacements:["top-start","bottom-end","top-end"]}),rt({padding:8})]}).then(({x:o,y:i})=>{Object.assign(t.style,{left:`${o}px`,top:`${i}px`})})}))}attachListeners(){this.element&&(this.element.addEventListener("click",t=>this.handleClick(t)),setTimeout(()=>{document.addEventListener("mousedown",this.boundHandleClickOutside)},0),document.addEventListener("keydown",this.boundHandleKeyDown))}handleClick(t){var l;const o=t.target,i=(l=o.closest("[data-action]"))==null?void 0:l.getAttribute("data-action");if(i==="prev-month"){t.preventDefault(),eo(this.state),this.render();return}if(i==="next-month"){t.preventDefault(),to(this.state),this.render();return}if(i==="toggle-rolling"){t.preventDefault(),this.state.rollingSelectorOpen=!this.state.rollingSelectorOpen,this.render(),this.state.rollingSelectorOpen&&this.element&&Wo(this.element);return}if(i==="today"){t.preventDefault();const a=vn(this.state,this.options);a&&this.selectDate(a);return}const r=o.closest(".wg-datepicker__day");if(r){t.preventDefault();const a=_n(r,this.state,this.options);a&&this.selectDate(a);return}const s=o.closest("[data-month]");if(s&&this.state.rollingSelectorOpen){t.preventDefault(),yn(s,this.state),this.render();return}const n=o.closest("[data-year]");if(n&&this.state.rollingSelectorOpen){t.preventDefault(),Cn(n,this.state),this.render();return}}handleClickOutside(t){if(!this.element||!this.anchor)return;const o=t.composedPath();!o.includes(this.element)&&!o.includes(this.anchor)&&this.close()}handleKeyDown(t){wn(t,this.state,this.options,{onSelect:(i,r)=>this.selectDate(i,r),onClose:()=>this.close()})&&this.render()}selectDate(t,o){var i,r;this.state.selectedDate=t,(r=(i=this.options).onSelect)==null||r.call(i,t,o),this.close(!0)}render(){if(!this.element)return;const t=this.element.querySelector(".wg-datepicker");t&&(un(t,this.state,this.localeStrings),hn(t,this.state.rollingSelectorOpen),this.state.rollingSelectorOpen?fn(t,this.state):gn(t,this.state,this.options))}connectInput(t){this.input=t,this.previousInputValue=t.value,t.addEventListener("input",()=>{this.previousInputValue=Sn(t,this.formatInfo,this.previousInputValue),Rn(t.value,this.formatInfo,this.state,this.options)}),t.addEventListener("keydown",o=>{xn(o,this.formatInfo)}),t.addEventListener("paste",o=>{kn(o,t,this.formatInfo)}),t.addEventListener("focus",()=>{!this.state.isOpen&&this.anchor&&this.open(this.anchor,t.value)})}}var Uo=function(){},he="undefined",In=typeof window!==he&&typeof window.navigator!==he&&/Trident\/|MSIE /.test(window.navigator.userAgent),io=["trace","debug","info","warn","error"],st={},N=null;function Ko(e,t){var o=e[t];if(typeof o.bind=="function")return o.bind(e);try{return Function.prototype.bind.call(o,e)}catch{return function(){return Function.prototype.apply.apply(o,[e,arguments])}}}function Dn(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function Tn(e){return e==="debug"&&(e="log"),typeof console===he?!1:e==="trace"&&In?Dn:console[e]!==void 0?Ko(console,e):console.log!==void 0?Ko(console,"log"):Uo}function lt(){for(var e=this.getLevel(),t=0;t<io.length;t++){var o=io[t];this[o]=t<e?Uo:this.methodFactory(o,e,this.name)}if(this.log=this.debug,typeof console===he&&e<this.levels.SILENT)return"No console available for logging"}function Mn(e){return function(){typeof console!==he&&(lt.call(this),this[e].apply(this,arguments))}}function $n(e,t,o){return Tn(e)||Mn.apply(this,arguments)}function jo(e,t){var o=this,i,r,s,n="loglevel";typeof e=="string"?n+=":"+e:typeof e=="symbol"&&(n=void 0);function l(g){var h=(io[g]||"silent").toUpperCase();if(!(typeof window===he||!n)){try{window.localStorage[n]=h;return}catch{}try{window.document.cookie=encodeURIComponent(n)+"="+h+";"}catch{}}}function a(){var g;if(!(typeof window===he||!n)){try{g=window.localStorage[n]}catch{}if(typeof g===he)try{var h=window.document.cookie,f=encodeURIComponent(n),w=h.indexOf(f+"=");w!==-1&&(g=/^([^;]+)/.exec(h.slice(w+f.length+1))[1])}catch{}return o.levels[g]===void 0&&(g=void 0),g}}function d(){if(!(typeof window===he||!n)){try{window.localStorage.removeItem(n)}catch{}try{window.document.cookie=encodeURIComponent(n)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function c(g){var h=g;if(typeof h=="string"&&o.levels[h.toUpperCase()]!==void 0&&(h=o.levels[h.toUpperCase()]),typeof h=="number"&&h>=0&&h<=o.levels.SILENT)return h;throw new TypeError("log.setLevel() called with invalid level: "+g)}o.name=e,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=t||$n,o.getLevel=function(){return s??r??i},o.setLevel=function(g,h){return s=c(g),h!==!1&&l(s),lt.call(o)},o.setDefaultLevel=function(g){r=c(g),a()||o.setLevel(g,!1)},o.resetLevel=function(){s=null,d(),lt.call(o)},o.enableAll=function(g){o.setLevel(o.levels.TRACE,g)},o.disableAll=function(g){o.setLevel(o.levels.SILENT,g)},o.rebuild=function(){if(N!==o&&(i=c(N.getLevel())),lt.call(o),N===o)for(var g in st)st[g].rebuild()},i=c(N?N.getLevel():"WARN");var u=a();u!=null&&(s=c(u)),lt.call(o)}N=new jo,N.getLogger=function(t){if(typeof t!="symbol"&&typeof t!="string"||t==="")throw new TypeError("You must supply a name when creating a logger.");var o=st[t];return o||(o=st[t]=new jo(t,N.methodFactory)),o};var An=typeof window!==he?window.log:void 0;N.noConflict=function(){return typeof window!==he&&window.log===N&&(window.log=An),N},N.getLoggers=function(){return st},N.default=N;var Ln=function(e){for(var t=1,o=arguments.length,i;t<o;t++)for(i in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],i)&&(e[i]=arguments[t][i]);return e},zn={template:"[%t] %l:",levelFormatter:function(e){return e.toUpperCase()},nameFormatter:function(e){return e||"root"},timestampFormatter:function(e){return e.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")},format:void 0},Xo,Ne={},Pn=function(e){if(!e||!e.getLogger)throw new TypeError("Argument is not a root logger");Xo=e},On=function(e,t){if(!e||!e.setLevel)throw new TypeError("Argument is not a logger");var o=e.methodFactory,i=e.name||"",r=Ne[i]||Ne[""]||zn;function s(n,l,a){var d=o(n,l,a),c=Ne[a]||Ne[""],u=c.template.indexOf("%t")!==-1,g=c.template.indexOf("%l")!==-1,h=c.template.indexOf("%n")!==-1;return function(){for(var f="",w=arguments.length,p=Array(w),m=0;m<w;m++)p[m]=arguments[m];if(i||!Ne[a]){var v=c.timestampFormatter(new Date),y=c.levelFormatter(n),x=c.nameFormatter(a);c.format?f+=c.format(y,x,v):(f+=c.template,u&&(f=f.replace(/%t/,v)),g&&(f=f.replace(/%l/,y)),h&&(f=f.replace(/%n/,x))),p.length&&typeof p[0]=="string"?p[0]=f+" "+p[0]:p.unshift(f)}d.apply(void 0,p)}}return Ne[i]||(e.methodFactory=s),t=t||{},t.template&&(t.format=void 0),Ne[i]=Ln({},r,t),e.setLevel(e.getLevel()),Xo||e.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"),e},Go={reg:Pn,apply:On};const Qo={debug:"#0ea5e9",info:"#10b981",warn:"#f59e0b",error:"#ef4444"};Go.reg(N),Go.apply(N,{format(e,t,o){return Qo[e.toLowerCase()],`%c[${o}]%c %c[${e}]%c ${t?`%c[${t}]%c `:""}`},timestampFormatter(e){return e.toTimeString().split(" ")[0]+"."+e.getMilliseconds().toString().padStart(3,"0")}});const Hn=N.methodFactory;N.methodFactory=function(e,t,o){const i=Hn(e,t,o);return function(...r){if(r.length>0&&typeof r[0]=="string"&&r[0].includes("%c")){const s=Qo[e]||"#666",n=[r[0],`color: ${s}; font-weight: bold;`,"color: inherit;",`color: ${s}; font-weight: bold;`,"color: inherit;",...o?[`color: ${s}; font-weight: bold;`,"color: inherit;"]:[],...r.slice(1)];i(...n)}else i(...r)}},N.setLevel("silent");const ro=N.getLogger("GRID:INIT"),at=N.getLogger("GRID:DATA"),Jo=N.getLogger("GRID:UI"),dt=N.getLogger("GRID:INTERACTION"),Fn=["GRID:INIT","GRID:DATA","GRID:UI","GRID:INTERACTION"];function Vn(){N.setLevel("debug")}function qn(){N.setLevel("silent")}function Nn(e){N.setLevel(e)}function Bn(e,t){N.getLogger(e).setLevel(t)}const Zo={rowActions:"Row actions",inlineActionsHeader:"Actions",keyboardShortcuts:"Keyboard shortcuts",paginationFirst:"⏮",paginationPrevious:"◀",paginationNext:"▶",paginationLast:"⏭",paginationPageInfo:"Page {current} of {total}",paginationItemCount:"{count} items",paginationPerPage:"per page",dropdownNoOptions:"No options",dropdownSearching:"Searching...",contextMenu:{sortAsc:"Sort Ascending",sortDesc:"Sort Descending",clearSort:"Clear Sort",hideColumn:"Hide Column",freezeColumn:"Freeze Column",unfreezeColumn:"Unfreeze Column",columnVisibility:"Column Visibility",showAll:"Show all"}};class ei{constructor(){b(this,"_items",[]);b(this,"_columns",[]);b(this,"_sortMode","none");b(this,"_isFilterable",!1);b(this,"_isPageable",!1);b(this,"_pageSize",10);b(this,"_pageSizes",[10,25,50,100]);b(this,"_paginationMode","client");b(this,"_isStriped",!0);b(this,"_isHoverable",!0);b(this,"_isEditable",!1);b(this,"_editTrigger","dblclick");b(this,"_editStartSelection","mousePosition");b(this,"_mode","excel");b(this,"_dropdownToggleVisibility","always");b(this,"_shouldShowDropdownOnFocus",!0);b(this,"_shouldOpenDropdownOnEnter",!1);b(this,"_isCheckboxAlwaysEditable",!1);b(this,"_isRowNumbersVisible",!1);b(this,"_isStickyRowNumbers",!1);b(this,"_freezeColumns",0);b(this,"_invalidCells",[]);b(this,"_isDirtyIndicatorVisible",!0);b(this,"_isRowToolbarVisible",!1);b(this,"_rowToolbar",["add","delete","duplicate"]);b(this,"_toolbarVerticalAlign","bottom");b(this,"_toolbarHorizontalAlign","center");b(this,"_toolbarTrigger","hover");b(this,"_toolbarPosition","auto");b(this,"_toolbarColumn");b(this,"_toolbarFollowsCursor",!1);b(this,"_cellToolbar");b(this,"_cellToolbarOffset",.2);b(this,"_toolbarBtnMinWidth");b(this,"_inlineActionsTitle","");b(this,"_contextMenu");b(this,"_contextMenuXOffset",8);b(this,"_contextMenuYOffset",0);b(this,"_headerContextMenu");b(this,"_rowShortcuts");b(this,"_isShortcutsHelpVisible",!1);b(this,"_shortcutsHelpPosition","top-right");b(this,"_shortcutsHelpContentCallback");b(this,"_idValueMember");b(this,"_idValueCallback");b(this,"_rowLocking");b(this,"_externalLocks",new Map);b(this,"_onrowlockchange");b(this,"_gridName",null);b(this,"_shouldPersistColumnWidths",!1);b(this,"_columnWidths",new Map);b(this,"_oncolumnresize");b(this,"_isColumnReorderAllowed",!1);b(this,"_shouldPersistColumnOrder",!1);b(this,"_columnOrder",new Map);b(this,"_oncolumnreorder");b(this,"_fillDirection","vertical");b(this,"_fillDragCallback");b(this,"_onrowchange");b(this,"_onroweditstart");b(this,"_onroweditcancel");b(this,"_onvalidationerror");b(this,"_validationTooltipCallback");b(this,"_ontoolbarclick");b(this,"_onrowaction");b(this,"_oncontextmenuopen");b(this,"_onheadercontextmenuopen");b(this,"_ondatarequest");b(this,"_onrowdelete");b(this,"_sort",[]);b(this,"_filters",{});b(this,"_currentPage",1);b(this,"_totalItems",null);b(this,"_showPagination",!0);b(this,"_paginationPosition","bottom-center");b(this,"_paginationLabelsCallback");b(this,"_paginationLayout","pageSize|previous|pageInfo|next");b(this,"_summaryPosition");b(this,"_summaryContentCallback");b(this,"_summaryMetadata");b(this,"_isSummaryInline",!0);b(this,"_customStylesCallback");b(this,"_rowClassCallback");b(this,"_labels",{...Zo});b(this,"_isScrollable",!1);b(this,"_scrollMaxHeight","100vh");b(this,"_tableBorderOnly",!1);b(this,"_isVirtualScrollEnabled",!1);b(this,"_virtualScrollThreshold",100);b(this,"_virtualScrollRowHeight",38);b(this,"_virtualScrollBuffer",10);b(this,"_isInfiniteScrollEnabled",!1);b(this,"_infiniteScrollThreshold",100);b(this,"_hasMoreItems",!0);b(this,"_isLoadingMore",!1);b(this,"_editingCell",null);b(this,"_currentCellError",null);b(this,"_isValidating",!1);b(this,"_draftRows",new Map);b(this,"_focusedCell",null);b(this,"_isCommittingFromKeyboard",!1);b(this,"_skipNextDropdownAutoEdit",!1);b(this,"_tabTraversalStartColIndex",null);b(this,"_hoveredRowIndex",null);b(this,"_focusedRowIndex",null);b(this,"_onrowfocus");b(this,"_onInteractionChange",null);b(this,"_selectedRows",new Set);b(this,"_lastSelectedRowIndex",null);b(this,"_rangeShortcuts",[]);b(this,"_cellSelectionMode","click");b(this,"_selectedCellRange",null);b(this,"_lastClickedCell",null);b(this,"_shouldCopyWithHeaders",!1);b(this,"_oncellselectionchange",null);b(this,"_selectedColumns",new Set);b(this,"_lastSelectedColumnIndex",-1);b(this,"_pasteMode","skip-non-editable");b(this,"_shouldValidateOnPaste",!0);b(this,"_createRowCallback");b(this,"_onbeforepaste");b(this,"_onpaste");b(this,"_isNewRowEnabled",!1);b(this,"_newRowPosition","bottom");b(this,"_newRowIndicator","+");b(this,"_createEmptyRowCallback");b(this,"_emptyRowDraft",null)}get items(){return this._items}set items(t){at.debug("items set:",t.length,"rows"),this._items=t,this.requestUpdate()}get columns(){return this._columns}set columns(t){ro.debug("columns set:",t.length,"columns",t.map(o=>String(o.field))),this._columns=t,this.requestUpdate()}get sortMode(){return this._sortMode}set sortMode(t){this._sortMode=t,this.requestUpdate()}get isFilterable(){return this._isFilterable}set isFilterable(t){this._isFilterable=t,this.requestUpdate()}get isPageable(){return this._isPageable}set isPageable(t){this._isPageable=t,this.requestUpdate()}get pageSize(){return this._pageSize}set pageSize(t){this._pageSize=t,this.requestUpdate()}get pageSizes(){return this._pageSizes}set pageSizes(t){this._pageSizes=t,this.requestUpdate()}get paginationMode(){return this._paginationMode}set paginationMode(t){this._paginationMode=t,this.requestUpdate()}get isStriped(){return this._isStriped}set isStriped(t){this._isStriped=t,this.requestUpdate()}get isHoverable(){return this._isHoverable}set isHoverable(t){this._isHoverable=t,this.requestUpdate()}get isEditable(){return this._isEditable}set isEditable(t){this._isEditable=t,this.checkEditTriggerConflicts(),this.requestUpdate()}get editTrigger(){return this._editTrigger}set editTrigger(t){this._editTrigger=t,this.checkSelectionConflicts(),this.checkEditTriggerConflicts(),this.requestUpdate()}get editStartSelection(){return this._editStartSelection}set editStartSelection(t){this._editStartSelection=t}get mode(){return this._mode}set mode(t){this._mode=t,this.applyModeDefaults(),this.checkEditTriggerConflicts(),this.requestUpdate()}get dropdownToggleVisibility(){return this._dropdownToggleVisibility}set dropdownToggleVisibility(t){this._dropdownToggleVisibility=t,this.requestUpdate()}getEffectiveToggleVisibility(t){return t.dropdownToggleVisibility??this._dropdownToggleVisibility}get shouldShowDropdownOnFocus(){return this._shouldShowDropdownOnFocus}set shouldShowDropdownOnFocus(t){this._shouldShowDropdownOnFocus=t}get shouldOpenDropdownOnEnter(){return this._shouldOpenDropdownOnEnter}set shouldOpenDropdownOnEnter(t){this._shouldOpenDropdownOnEnter=t}getEffectiveShouldOpenDropdownOnEnter(t){return t.shouldOpenDropdownOnEnter??this._shouldOpenDropdownOnEnter}get isCheckboxAlwaysEditable(){return this._isCheckboxAlwaysEditable}set isCheckboxAlwaysEditable(t){this._isCheckboxAlwaysEditable=t,this.requestUpdate()}get isRowNumbersVisible(){return this._isRowNumbersVisible}set isRowNumbersVisible(t){this._isRowNumbersVisible=t,this.requestUpdate()}get isDirtyIndicatorVisible(){return this._isDirtyIndicatorVisible}set isDirtyIndicatorVisible(t){this._isDirtyIndicatorVisible=t,this.requestUpdate()}get isStickyRowNumbers(){return this._isStickyRowNumbers}set isStickyRowNumbers(t){this._isStickyRowNumbers=t,this.requestUpdate()}get freezeColumns(){return this._freezeColumns}set freezeColumns(t){this._freezeColumns=Math.max(0,Math.floor(t)),this.requestUpdate()}get visualColumns(){const t=[],o=[];this._columns.filter(s=>s.isFrozen&&!s.isHidden).length,this._columns.forEach((s,n)=>{if(s.isHidden)return;const l={column:s,originalIndex:n};s.isFrozen?t.push(l):o.push(l)});const i=[],r=[];return o.forEach((s,n)=>{n<this._freezeColumns?i.push(s):r.push(s)}),this._columnOrder.size>0&&r.sort((s,n)=>{const l=String(s.column.field),a=String(n.column.field),d=this._columnOrder.get(l)??s.originalIndex,c=this._columnOrder.get(a)??n.originalIndex;return d-c}),[...t,...i,...r]}get totalFrozenColumns(){return this._columns.filter(o=>o.isFrozen).length+this._freezeColumns}isColumnFrozen(t){return t<this.totalFrozenColumns}get invalidCells(){return this._invalidCells}set invalidCells(t){this._invalidCells=t,this.requestUpdate()}get editingCell(){return this._editingCell}get isValidating(){return this._isValidating}get currentCellError(){return this._currentCellError}get hoveredRowIndex(){return this._hoveredRowIndex}get isRowToolbarVisible(){return this._isRowToolbarVisible}set isRowToolbarVisible(t){this._isRowToolbarVisible=t,this.requestUpdate()}get rowToolbar(){return this._rowToolbar}set rowToolbar(t){this._rowToolbar=t,this.requestUpdate()}get toolbarVerticalAlign(){return this._toolbarVerticalAlign}set toolbarVerticalAlign(t){this._toolbarVerticalAlign=t,this.checkToolbarConflicts(),this.requestUpdate()}get toolbarHorizontalAlign(){return this._toolbarHorizontalAlign}set toolbarHorizontalAlign(t){this._toolbarHorizontalAlign=t,this.checkToolbarConflicts(),this.requestUpdate()}get toolbarAlign(){return this._toolbarVerticalAlign}set toolbarAlign(t){this.toolbarVerticalAlign=t}get toolbarTopPosition(){return this._toolbarHorizontalAlign}set toolbarTopPosition(t){this.toolbarHorizontalAlign=t}get toolbarTrigger(){return this._toolbarTrigger}set toolbarTrigger(t){this._toolbarTrigger=t,this.requestUpdate()}get toolbarPosition(){return this._toolbarPosition}set toolbarPosition(t){this._toolbarPosition=t,this.checkToolbarConflicts(),this.requestUpdate()}get toolbarColumn(){return this._toolbarColumn}set toolbarColumn(t){this._toolbarColumn=t,this.checkToolbarConflicts()}get toolbarFollowsCursor(){return this._toolbarFollowsCursor}set toolbarFollowsCursor(t){this._toolbarFollowsCursor=t,this.checkToolbarConflicts()}get cellToolbar(){return this._cellToolbar}set cellToolbar(t){this._cellToolbar=t,this.checkToolbarConflicts()}get cellToolbarOffset(){return this._cellToolbarOffset}set cellToolbarOffset(t){typeof t=="number"?this._cellToolbarOffset=Math.max(0,Math.min(1,t)):this._cellToolbarOffset=t}get toolbarBtnMinWidth(){return this._toolbarBtnMinWidth}set toolbarBtnMinWidth(t){this._toolbarBtnMinWidth=t}get inlineActionsTitle(){return this._inlineActionsTitle}set inlineActionsTitle(t){this._inlineActionsTitle=t,this.requestUpdate()}get contextMenu(){return this._contextMenu}set contextMenu(t){this._contextMenu=t,this.requestUpdate()}get contextMenuXOffset(){return this._contextMenuXOffset}set contextMenuXOffset(t){this._contextMenuXOffset=t}get contextMenuYOffset(){return this._contextMenuYOffset}set contextMenuYOffset(t){this._contextMenuYOffset=t}get headerContextMenu(){return this._headerContextMenu}set headerContextMenu(t){this._headerContextMenu=t}get rowShortcuts(){return this._rowShortcuts}set rowShortcuts(t){this._rowShortcuts=t,this.requestUpdate()}get isShortcutsHelpVisible(){return this._isShortcutsHelpVisible}set isShortcutsHelpVisible(t){this._isShortcutsHelpVisible=t,this.requestUpdate()}get shortcutsHelpPosition(){return this._shortcutsHelpPosition}set shortcutsHelpPosition(t){this._shortcutsHelpPosition=t,this.requestUpdate()}get shortcutsHelpContentCallback(){return this._shortcutsHelpContentCallback}set shortcutsHelpContentCallback(t){this._shortcutsHelpContentCallback=t,this.requestUpdate()}get sort(){return this._sort}set sort(t){at.debug("sort changed:",t.map(o=>`${o.column} ${o.direction}`).join(", ")||"none"),this._sort=t,this.requestUpdate()}get currentPage(){return this._currentPage}set currentPage(t){at.debug("page changed:",t),this._currentPage=t,this.requestUpdate()}get totalItems(){return this._totalItems}set totalItems(t){this._totalItems=t,this.requestUpdate()}get showPagination(){return this._showPagination}set showPagination(t){this._showPagination=t,this.requestUpdate()}get paginationPosition(){return this._paginationPosition}set paginationPosition(t){this._paginationPosition=t,this.requestUpdate()}get paginationLabelsCallback(){return this._paginationLabelsCallback}set paginationLabelsCallback(t){this._paginationLabelsCallback=t,this.requestUpdate()}get paginationLayout(){return this._paginationLayout}set paginationLayout(t){this._paginationLayout=t,this.requestUpdate()}get summaryPosition(){return this._summaryPosition}set summaryPosition(t){this._summaryPosition=t,this.requestUpdate()}get summaryContentCallback(){return this._summaryContentCallback}set summaryContentCallback(t){this._summaryContentCallback=t,this.requestUpdate()}get summaryMetadata(){return this._summaryMetadata}set summaryMetadata(t){this._summaryMetadata=t,this.requestUpdate()}get isSummaryInline(){return this._isSummaryInline}set isSummaryInline(t){this._isSummaryInline=t,this.requestUpdate()}get customStylesCallback(){return this._customStylesCallback}set customStylesCallback(t){this._customStylesCallback=t}get rowClassCallback(){return this._rowClassCallback}set rowClassCallback(t){this._rowClassCallback=t,this.requestUpdate()}get labels(){return this._labels}set labels(t){this._labels={...Zo,...t},this.requestUpdate()}get isScrollable(){return this._isScrollable}set isScrollable(t){this._isScrollable=t,this.requestUpdate()}get scrollMaxHeight(){return this._scrollMaxHeight}set scrollMaxHeight(t){this._scrollMaxHeight=t,this.requestUpdate()}get tableBorderOnly(){return this._tableBorderOnly}set tableBorderOnly(t){this._tableBorderOnly=t,this.requestUpdate()}get isVirtualScrollEnabled(){return this._isVirtualScrollEnabled}set isVirtualScrollEnabled(t){this._isVirtualScrollEnabled=t,this.requestUpdate()}get virtualScrollThreshold(){return this._virtualScrollThreshold}set virtualScrollThreshold(t){this._virtualScrollThreshold=t,this.requestUpdate()}get virtualScrollRowHeight(){return this._virtualScrollRowHeight}set virtualScrollRowHeight(t){this._virtualScrollRowHeight=t,this.requestUpdate()}get virtualScrollBuffer(){return this._virtualScrollBuffer}set virtualScrollBuffer(t){this._virtualScrollBuffer=t,this.requestUpdate()}get isInfiniteScrollEnabled(){return this._isInfiniteScrollEnabled}set isInfiniteScrollEnabled(t){this._isInfiniteScrollEnabled=t,this.requestUpdate()}get infiniteScrollThreshold(){return this._infiniteScrollThreshold}set infiniteScrollThreshold(t){this._infiniteScrollThreshold=t}get hasMoreItems(){return this._hasMoreItems}set hasMoreItems(t){this._hasMoreItems=t}get isLoadingMore(){return this._isLoadingMore}set isLoadingMore(t){this._isLoadingMore=t}shouldUseVirtualScroll(){return this._isVirtualScrollEnabled===!1?!1:this._isVirtualScrollEnabled===!0?!0:this.displayItems.length>=this._virtualScrollThreshold}set onrowchange(t){this._onrowchange=t}set onroweditstart(t){this._onroweditstart=t}set onroweditcancel(t){this._onroweditcancel=t}set onvalidationerror(t){this._onvalidationerror=t}get validationTooltipCallback(){return this._validationTooltipCallback}set validationTooltipCallback(t){this._validationTooltipCallback=t}get ontoolbarclick(){return this._ontoolbarclick}set ontoolbarclick(t){this._ontoolbarclick=t}set onrowaction(t){this._onrowaction=t}set oncontextmenuopen(t){this._oncontextmenuopen=t}get onheadercontextmenuopen(){return this._onheadercontextmenuopen}set onheadercontextmenuopen(t){this._onheadercontextmenuopen=t}get ondatarequest(){return this._ondatarequest}set ondatarequest(t){this._ondatarequest=t}get onrowdelete(){return this._onrowdelete}set onrowdelete(t){this._onrowdelete=t}get idValueMember(){return this._idValueMember}set idValueMember(t){this._idValueMember=t}get idValueCallback(){return this._idValueCallback}set idValueCallback(t){this._idValueCallback=t}get rowLocking(){return this._rowLocking}set rowLocking(t){this._rowLocking=t,this.requestUpdate()}get onrowlockchange(){return this._onrowlockchange}set onrowlockchange(t){this._onrowlockchange=t}get gridName(){return this._gridName}set gridName(t){this._gridName=t}get shouldPersistColumnWidths(){return this._shouldPersistColumnWidths}set shouldPersistColumnWidths(t){this._shouldPersistColumnWidths=t}get oncolumnresize(){return this._oncolumnresize}set oncolumnresize(t){this._oncolumnresize=t}get isColumnReorderAllowed(){return this._isColumnReorderAllowed}set isColumnReorderAllowed(t){this._isColumnReorderAllowed=t}get shouldPersistColumnOrder(){return this._shouldPersistColumnOrder}set shouldPersistColumnOrder(t){this._shouldPersistColumnOrder=t}get oncolumnreorder(){return this._oncolumnreorder}set oncolumnreorder(t){this._oncolumnreorder=t}get fillDirection(){return this._fillDirection}set fillDirection(t){this._fillDirection=t}get fillDragCallback(){return this._fillDragCallback}set fillDragCallback(t){this._fillDragCallback=t}get selectedRows(){return Array.from(this._selectedRows).sort((t,o)=>t-o)}get rangeShortcuts(){return this._rangeShortcuts}set rangeShortcuts(t){this._rangeShortcuts=t}isRowSelected(t){return this._selectedRows.has(t)}selectRow(t,o="replace"){switch(dt.debug("selectRow:",{rowIndex:t,mode:o}),this._selectedCellRange&&(this._selectedCellRange=null),this._selectedColumns.clear(),o){case"replace":this._selectedRows.clear(),this._selectedRows.add(t),this._lastSelectedRowIndex=t;break;case"toggle":this._selectedRows.has(t)?this._selectedRows.delete(t):this._selectedRows.add(t),this._lastSelectedRowIndex=t;break;case"range":if(this._lastSelectedRowIndex!==null){const i=Math.min(this._lastSelectedRowIndex,t),r=Math.max(this._lastSelectedRowIndex,t);for(let s=i;s<=r;s++)this._selectedRows.add(s)}else this._selectedRows.add(t),this._lastSelectedRowIndex=t;break}this.requestUpdate()}selectRowRange(t,o){this._selectedColumns.clear(),this._selectedCellRange=null,this._selectedRows.clear();const i=Math.min(t,o),r=Math.max(t,o);for(let s=i;s<=r;s++)this._selectedRows.add(s);this._lastSelectedRowIndex=o,this.requestUpdate()}clearSelection(){this._selectedRows.size>0&&(this._selectedRows.clear(),this._lastSelectedRowIndex=null,this.requestUpdate())}clearSelection_noRender(){this._selectedRows.clear(),this._lastSelectedRowIndex=null}getSelectedRowsData(){return this.selectedRows.map(t=>this.displayItems[t]).filter(Boolean)}async copySelectedRowsToClipboard(){const t=this.selectedRows;if(t.length===0)return!1;const o=[];if(this._shouldCopyWithHeaders){const r=[];for(const s of this.visualColumns){const n=s.column.title??s.column.field??"";r.push(String(n))}o.push(r.join(" "))}for(const r of t){const s=this.displayItems[r];if(!s)continue;const n=[];for(const l of this.visualColumns){const a=String(l.column.field),d=s[a],c=d==null?"":String(d);n.push(c)}o.push(n.join(" "))}const i=o.join(`
|
|
297
|
-
`);try{return await navigator.clipboard.writeText(i),!0}catch{return!1}}async copySelectedColumnsToClipboard(){const
|
|
298
|
-
`);try{return await navigator.clipboard.writeText(i),!0}catch{return!1}}get cellSelectionMode(){return this._cellSelectionMode}set cellSelectionMode(t){this._cellSelectionMode=t,this.checkSelectionConflicts(),this.requestUpdate()}get shouldCopyWithHeaders(){return this._shouldCopyWithHeaders}set shouldCopyWithHeaders(t){this._shouldCopyWithHeaders=t}get selectedCellRange(){return this._selectedCellRange}get lastClickedCell(){return this._lastClickedCell}set lastClickedCell(t){this._lastClickedCell=t}get oncellselectionchange(){return this._oncellselectionchange}set oncellselectionchange(t){this._oncellselectionchange=t}get pasteMode(){return this._pasteMode}set pasteMode(t){this._pasteMode=t}get shouldValidateOnPaste(){return this._shouldValidateOnPaste}set shouldValidateOnPaste(t){this._shouldValidateOnPaste=t}get createRowCallback(){return this._createRowCallback}set createRowCallback(t){this._createRowCallback=t}get onbeforepaste(){return this._onbeforepaste}set onbeforepaste(t){this._onbeforepaste=t}get onpaste(){return this._onpaste}set onpaste(t){this._onpaste=t}get isNewRowEnabled(){return this._isNewRowEnabled}set isNewRowEnabled(t){t&&!this.isNavigateMode&&console.warn('[WebGrid] Empty row requires navigate mode (editTrigger: "navigate"). Tab navigation will not work correctly without it.'),this._isNewRowEnabled=t,this._emptyRowDraft=null,this.requestUpdate()}get newRowPosition(){return this._newRowPosition}set newRowPosition(t){this._newRowPosition=t,this.requestUpdate()}get newRowIndicator(){return this._newRowIndicator}set newRowIndicator(t){this._newRowIndicator=t,this.requestUpdate()}get createEmptyRowCallback(){return this._createEmptyRowCallback}set createEmptyRowCallback(t){this._createEmptyRowCallback=t}selectCellRange(t){if(dt.debug("selectCellRange:",{startRow:t.startRowIndex,startCol:t.startColIndex,endRow:t.endRowIndex,endCol:t.endColIndex}),this._selectedRows.size>0&&(this._selectedRows.clear(),this._lastSelectedRowIndex=null),this._selectedColumns.clear(),this._selectedCellRange=t,this.requestUpdate(),this._oncellselectionchange){const o=this.getSelectedCells();this._oncellselectionchange({range:t,cellCount:o.length})}}clearCellSelection(){this._selectedCellRange&&(this._selectedCellRange=null,this.requestUpdate(),this._oncellselectionchange&&this._oncellselectionchange({range:null,cellCount:0}))}clearCellSelection_noRender(){this._selectedCellRange&&(this._selectedCellRange=null,this._oncellselectionchange&&this._oncellselectionchange({range:null,cellCount:0}))}selectAll(){const t=this.displayItems.length,o=this.visualColumns.length;if(t===0||o===0)return;const i=this.visualColumns[0],r=this.visualColumns[o-1],s={startRowIndex:0,startColIndex:0,endRowIndex:t-1,endColIndex:o-1,startField:String(i.column.field),endField:String(r.column.field)};this.selectCellRange(s)}selectColumn(t,o="replace"){const i=this.visualColumns.length;if(!(t<0||t>=i)){if(this._selectedRows.clear(),this._selectedCellRange=null,o==="replace")this._selectedColumns.clear(),this._selectedColumns.add(t),this._lastSelectedColumnIndex=t;else if(o==="toggle")this._selectedColumns.has(t)?this._selectedColumns.delete(t):this._selectedColumns.add(t),this._lastSelectedColumnIndex=t;else if(o==="range"){const r=this._lastSelectedColumnIndex>=0?this._lastSelectedColumnIndex:t,s=Math.min(r,t),n=Math.max(r,t);for(let l=s;l<=n;l++)this._selectedColumns.add(l)}this.requestUpdate()}}clearColumnSelection(){this._selectedColumns.clear(),this._lastSelectedColumnIndex=-1,this.requestUpdate()}clearColumnSelection_noRender(){this._selectedColumns.clear(),this._lastSelectedColumnIndex=-1}selectColumnRange(t,o){this._selectedRows.clear(),this._selectedCellRange=null,this._selectedColumns.clear();const i=Math.min(t,o),r=Math.max(t,o);for(let s=i;s<=r;s++)this._selectedColumns.add(s);this._lastSelectedColumnIndex=o,this.requestUpdate()}get selectedColumns(){return Array.from(this._selectedColumns).sort((t,o)=>t-o)}isColumnSelected(t){return this._selectedColumns.has(t)}getSelectedCells(){var c;if(!this._selectedCellRange)return[];const{startRowIndex:t,endRowIndex:o,startColIndex:i,endColIndex:r}=this._selectedCellRange,s=Math.min(t,o),n=Math.max(t,o),l=Math.min(i,r),a=Math.max(i,r),d=[];for(let u=s;u<=n;u++)for(let g=l;g<=a;g++){const h=(c=this.visualColumns[g])==null?void 0:c.column;if(!h)continue;const f=this.displayItems[u];if(!f)continue;const w=String(h.field),p=f[w];d.push({row:f,rowIndex:u,colIndex:g,field:w,value:p})}return d}isCellInSelectedRange(t,o){if(!this._selectedCellRange)return!1;const{startRowIndex:i,endRowIndex:r,startColIndex:s,endColIndex:n}=this._selectedCellRange,l=Math.min(i,r),a=Math.max(i,r),d=Math.min(s,n),c=Math.max(s,n);return t>=l&&t<=a&&o>=d&&o<=c}async copyCellSelectionToClipboard(){var u,g;if(!this._selectedCellRange)return!1;const{startRowIndex:t,endRowIndex:o,startColIndex:i,endColIndex:r}=this._selectedCellRange,s=Math.min(t,o),n=Math.max(t,o),l=Math.min(i,r),a=Math.max(i,r),d=[];if(this._shouldCopyWithHeaders){const h=[];for(let f=l;f<=a;f++){const w=(u=this.visualColumns[f])==null?void 0:u.column,p=(w==null?void 0:w.title)??(w==null?void 0:w.field)??"";h.push(String(p))}d.push(h.join(" "))}for(let h=s;h<=n;h++){const f=this.displayItems[h];if(!f)continue;const w=[];for(let p=l;p<=a;p++){const m=(g=this.visualColumns[p])==null?void 0:g.column;if(!m){w.push("");continue}const v=String(m.field),y=f[v],x=y==null?"":String(y);w.push(x)}d.push(w.join(" "))}const c=d.join(`
|
|
299
|
-
`);try{return await navigator.clipboard.writeText(c),!0}catch{return!1}}get isNavigateMode(){return this._editTrigger==="navigate"||this._columns.some(
|
|
296
|
+
`;let Xo=!1;class Tt{constructor(e={}){b(this,"options");b(this,"state");b(this,"localeStrings");b(this,"formatInfo");b(this,"element",null);b(this,"anchor",null);b(this,"input",null);b(this,"cleanupAutoUpdate",null);b(this,"previousInputValue","");b(this,"boundHandleClickOutside");b(this,"boundHandleKeyDown");this.options={dateFormat:"YYYY-MM-DD",showTodayButton:!0,...e};const o=new Date;this.state={viewMonth:o.getMonth(),viewYear:o.getFullYear(),selectedDate:null,isOpen:!1,rollingSelectorOpen:!1,rollingSelectorMode:"month",focusedDate:null},this.localeStrings=this.initLocaleStrings(e.locale),this.formatInfo=Rt(this.options.dateFormat||"YYYY-MM-DD"),this.boundHandleClickOutside=this.handleClickOutside.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}initLocaleStrings(e){const o=e||navigator.language||"en";try{const i=new Intl.DateTimeFormat(o,{month:"long"}),r=new Intl.DateTimeFormat(o,{month:"short"}),s=new Intl.DateTimeFormat(o,{weekday:"long"}),n=new Intl.DateTimeFormat(o,{weekday:"short"}),l=[],a=[];for(let u=0;u<12;u++){const g=new Date(2024,u,1);l.push(i.format(g)),a.push(r.format(g))}const d=[],c=[];for(let u=0;u<7;u++){const g=new Date(2024,0,7+u);d.push(s.format(g));const h=n.format(g);c.push(h.substring(0,2))}return{today:"Today",clear:"Clear",monthNames:l,monthNamesShort:a,weekdayNames:d,weekdayNamesShort:c}}catch{return Uo}}static injectStyles(){if(Xo)return;const e=document.createElement("style");e.id="wg-datepicker-styles",e.textContent=Rn,document.head.appendChild(e),Xo=!0}open(e,o=null){Tt.injectStyles(),this.state.isOpen&&this.close(),this.anchor=e;const i=se(o);if(i)this.state.selectedDate=i,this.state.viewYear=i.getFullYear(),this.state.viewMonth=i.getMonth();else{const r=new Date;this.state.viewYear=r.getFullYear(),this.state.viewMonth=r.getMonth()}_n(this.state),this.element=document.createElement("div"),this.element.className="wg-datepicker-container",this.element.innerHTML=nn(this.state,this.options,this.localeStrings),document.body.appendChild(this.element),this.position(),this.attachListeners(),this.state.isOpen=!0,this.state.rollingSelectorOpen&&jo(this.element)}close(e=!1){var o,i;this.state.isOpen&&(this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),document.removeEventListener("mousedown",this.boundHandleClickOutside),document.removeEventListener("keydown",this.boundHandleKeyDown),this.element&&(this.element.remove(),this.element=null),this.state.isOpen=!1,this.state.rollingSelectorOpen=!1,e||(i=(o=this.options).onClose)==null||i.call(o))}destroy(){this.close(),this.anchor=null,this.input=null}getSelectedDate(){return this.state.selectedDate}getFormattedValue(){return eo(this.state.selectedDate,this.formatInfo)}position(){if(!this.element||!this.anchor)return;const e=this.element.querySelector(".wg-datepicker");e&&(this.cleanupAutoUpdate=Qr(this.anchor,e,()=>{if(!this.anchor.isConnected){this.close(!0);return}Ne(this.anchor,e,{placement:"bottom-start",middleware:[It(4),Ve({fallbackPlacements:["top-start","bottom-end","top-end"]}),st({padding:8})]}).then(({x:o,y:i})=>{Object.assign(e.style,{left:`${o}px`,top:`${i}px`})})}))}attachListeners(){this.element&&(this.element.addEventListener("click",e=>this.handleClick(e)),setTimeout(()=>{document.addEventListener("mousedown",this.boundHandleClickOutside)},0),document.addEventListener("keydown",this.boundHandleKeyDown))}handleClick(e){var l;const o=e.target,i=(l=o.closest("[data-action]"))==null?void 0:l.getAttribute("data-action");if(i==="prev-month"){e.preventDefault(),to(this.state),this.render();return}if(i==="next-month"){e.preventDefault(),oo(this.state),this.render();return}if(i==="toggle-rolling"){e.preventDefault(),this.state.rollingSelectorOpen=!this.state.rollingSelectorOpen,this.render(),this.state.rollingSelectorOpen&&this.element&&jo(this.element);return}if(i==="today"){e.preventDefault();const a=yn(this.state,this.options);a&&this.selectDate(a);return}const r=o.closest(".wg-datepicker__day");if(r){e.preventDefault();const a=vn(r,this.state,this.options);a&&this.selectDate(a);return}const s=o.closest("[data-month]");if(s&&this.state.rollingSelectorOpen){e.preventDefault(),Cn(s,this.state),this.render();return}const n=o.closest("[data-year]");if(n&&this.state.rollingSelectorOpen){e.preventDefault(),Sn(n,this.state),this.render();return}}handleClickOutside(e){if(!this.element||!this.anchor)return;const o=e.composedPath();!o.includes(this.element)&&!o.includes(this.anchor)&&this.close()}handleKeyDown(e){pn(e,this.state,this.options,{onSelect:(i,r)=>this.selectDate(i,r),onClose:()=>this.close()})&&this.render()}selectDate(e,o){var i,r;this.state.selectedDate=e,(r=(i=this.options).onSelect)==null||r.call(i,e,o),this.close(!0)}render(){if(!this.element)return;const e=this.element.querySelector(".wg-datepicker");e&&(hn(e,this.state,this.localeStrings),fn(e,this.state.rollingSelectorOpen),this.state.rollingSelectorOpen?wn(e,this.state):un(e,this.state,this.options))}connectInput(e){this.input=e,this.previousInputValue=e.value,e.addEventListener("input",()=>{this.previousInputValue=xn(e,this.formatInfo,this.previousInputValue),In(e.value,this.formatInfo,this.state,this.options)}),e.addEventListener("keydown",o=>{kn(o,this.formatInfo)}),e.addEventListener("paste",o=>{En(o,e,this.formatInfo)}),e.addEventListener("focus",()=>{!this.state.isOpen&&this.anchor&&this.open(this.anchor,e.value)})}}var Go=function(){},ue="undefined",Dn=typeof window!==ue&&typeof window.navigator!==ue&&/Trident\/|MSIE /.test(window.navigator.userAgent),ro=["trace","debug","info","warn","error"],at={},W=null;function Qo(t,e){var o=t[e];if(typeof o.bind=="function")return o.bind(t);try{return Function.prototype.bind.call(o,t)}catch{return function(){return Function.prototype.apply.apply(o,[t,arguments])}}}function Tn(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function Mn(t){return t==="debug"&&(t="log"),typeof console===ue?!1:t==="trace"&&Dn?Tn:console[t]!==void 0?Qo(console,t):console.log!==void 0?Qo(console,"log"):Go}function dt(){for(var t=this.getLevel(),e=0;e<ro.length;e++){var o=ro[e];this[o]=e<t?Go:this.methodFactory(o,t,this.name)}if(this.log=this.debug,typeof console===ue&&t<this.levels.SILENT)return"No console available for logging"}function $n(t){return function(){typeof console!==ue&&(dt.call(this),this[t].apply(this,arguments))}}function Pn(t,e,o){return Mn(t)||$n.apply(this,arguments)}function Jo(t,e){var o=this,i,r,s,n="loglevel";typeof t=="string"?n+=":"+t:typeof t=="symbol"&&(n=void 0);function l(g){var h=(ro[g]||"silent").toUpperCase();if(!(typeof window===ue||!n)){try{window.localStorage[n]=h;return}catch{}try{window.document.cookie=encodeURIComponent(n)+"="+h+";"}catch{}}}function a(){var g;if(!(typeof window===ue||!n)){try{g=window.localStorage[n]}catch{}if(typeof g===ue)try{var h=window.document.cookie,f=encodeURIComponent(n),w=h.indexOf(f+"=");w!==-1&&(g=/^([^;]+)/.exec(h.slice(w+f.length+1))[1])}catch{}return o.levels[g]===void 0&&(g=void 0),g}}function d(){if(!(typeof window===ue||!n)){try{window.localStorage.removeItem(n)}catch{}try{window.document.cookie=encodeURIComponent(n)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function c(g){var h=g;if(typeof h=="string"&&o.levels[h.toUpperCase()]!==void 0&&(h=o.levels[h.toUpperCase()]),typeof h=="number"&&h>=0&&h<=o.levels.SILENT)return h;throw new TypeError("log.setLevel() called with invalid level: "+g)}o.name=t,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=e||Pn,o.getLevel=function(){return s??r??i},o.setLevel=function(g,h){return s=c(g),h!==!1&&l(s),dt.call(o)},o.setDefaultLevel=function(g){r=c(g),a()||o.setLevel(g,!1)},o.resetLevel=function(){s=null,d(),dt.call(o)},o.enableAll=function(g){o.setLevel(o.levels.TRACE,g)},o.disableAll=function(g){o.setLevel(o.levels.SILENT,g)},o.rebuild=function(){if(W!==o&&(i=c(W.getLevel())),dt.call(o),W===o)for(var g in at)at[g].rebuild()},i=c(W?W.getLevel():"WARN");var u=a();u!=null&&(s=c(u)),dt.call(o)}W=new Jo,W.getLogger=function(e){if(typeof e!="symbol"&&typeof e!="string"||e==="")throw new TypeError("You must supply a name when creating a logger.");var o=at[e];return o||(o=at[e]=new Jo(e,W.methodFactory)),o};var An=typeof window!==ue?window.log:void 0;W.noConflict=function(){return typeof window!==ue&&window.log===W&&(window.log=An),W},W.getLoggers=function(){return at},W.default=W;var Ln=function(t){for(var e=1,o=arguments.length,i;e<o;e++)for(i in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],i)&&(t[i]=arguments[e][i]);return t},zn={template:"[%t] %l:",levelFormatter:function(t){return t.toUpperCase()},nameFormatter:function(t){return t||"root"},timestampFormatter:function(t){return t.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")},format:void 0},Zo,Be={},On=function(t){if(!t||!t.getLogger)throw new TypeError("Argument is not a root logger");Zo=t},Hn=function(t,e){if(!t||!t.setLevel)throw new TypeError("Argument is not a logger");var o=t.methodFactory,i=t.name||"",r=Be[i]||Be[""]||zn;function s(n,l,a){var d=o(n,l,a),c=Be[a]||Be[""],u=c.template.indexOf("%t")!==-1,g=c.template.indexOf("%l")!==-1,h=c.template.indexOf("%n")!==-1;return function(){for(var f="",w=arguments.length,p=Array(w),m=0;m<w;m++)p[m]=arguments[m];if(i||!Be[a]){var v=c.timestampFormatter(new Date),y=c.levelFormatter(n),C=c.nameFormatter(a);c.format?f+=c.format(y,C,v):(f+=c.template,u&&(f=f.replace(/%t/,v)),g&&(f=f.replace(/%l/,y)),h&&(f=f.replace(/%n/,C))),p.length&&typeof p[0]=="string"?p[0]=f+" "+p[0]:p.unshift(f)}d.apply(void 0,p)}}return Be[i]||(t.methodFactory=s),e=e||{},e.template&&(e.format=void 0),Be[i]=Ln({},r,e),t.setLevel(t.getLevel()),Zo||t.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"),t},ei={reg:On,apply:Hn};ei.reg(W),ei.apply(W,{format(t,e,o){return`[${o}] [${t}]${e?` [${e}]`:""}`},timestampFormatter(t){return t.toTimeString().split(" ")[0]+"."+t.getMilliseconds().toString().padStart(3,"0")}}),W.setLevel("silent");const no=W.getLogger("GRID:INIT"),ct=W.getLogger("GRID:DATA"),xe=W.getLogger("GRID:UI"),Pe=W.getLogger("GRID:INTERACTION"),Fn=["GRID:INIT","GRID:DATA","GRID:UI","GRID:INTERACTION"];function qn(){W.setLevel("debug")}function Vn(){W.setLevel("silent")}function Nn(t){W.setLevel(t)}function Bn(t,e){W.getLogger(t).setLevel(e)}const ti={rowActions:"Row actions",inlineActionsHeader:"Actions",keyboardShortcuts:"Keyboard shortcuts",paginationFirst:"⏮",paginationPrevious:"◀",paginationNext:"▶",paginationLast:"⏭",paginationPageInfo:"Page {current} of {total}",paginationItemCount:"{count} items",paginationPerPage:"per page",dropdownNoOptions:"No options",dropdownSearching:"Searching...",contextMenu:{sortAsc:"Sort Ascending",sortDesc:"Sort Descending",clearSort:"Clear Sort",hideColumn:"Hide Column",freezeColumn:"Freeze Column",unfreezeColumn:"Unfreeze Column",columnVisibility:"Column Visibility",showAll:"Show all"}};class oi{constructor(){b(this,"_items",[]);b(this,"_columns",[]);b(this,"_sortMode","none");b(this,"_isFilterable",!1);b(this,"_isPageable",!1);b(this,"_pageSize",10);b(this,"_pageSizes",[10,25,50,100]);b(this,"_paginationMode","client");b(this,"_isStriped",!0);b(this,"_isHoverable",!0);b(this,"_isEditable",!1);b(this,"_editTrigger","dblclick");b(this,"_editStartSelection","mousePosition");b(this,"_mode","excel");b(this,"_dropdownToggleVisibility","always");b(this,"_shouldShowDropdownOnFocus",!0);b(this,"_shouldOpenDropdownOnEnter",!1);b(this,"_isCheckboxAlwaysEditable",!1);b(this,"_isRowNumbersVisible",!1);b(this,"_isStickyRowNumbers",!1);b(this,"_freezeColumns",0);b(this,"_invalidCells",[]);b(this,"_isDirtyIndicatorVisible",!0);b(this,"_isRowToolbarVisible",!1);b(this,"_rowToolbar",["add","delete","duplicate"]);b(this,"_toolbarVerticalAlign","bottom");b(this,"_toolbarHorizontalAlign","center");b(this,"_toolbarTrigger","hover");b(this,"_toolbarPosition","auto");b(this,"_toolbarColumn");b(this,"_toolbarFollowsCursor",!1);b(this,"_cellToolbar");b(this,"_cellToolbarOffset",.2);b(this,"_toolbarBtnMinWidth");b(this,"_inlineActionsTitle","");b(this,"_contextMenu");b(this,"_contextMenuXOffset",8);b(this,"_contextMenuYOffset",0);b(this,"_headerContextMenu");b(this,"_rowShortcuts");b(this,"_isShortcutsHelpVisible",!1);b(this,"_shortcutsHelpPosition","top-right");b(this,"_shortcutsHelpContentCallback");b(this,"_idValueMember");b(this,"_idValueCallback");b(this,"_rowLocking");b(this,"_externalLocks",new Map);b(this,"_onrowlockchange");b(this,"_gridName",null);b(this,"_shouldPersistColumnWidths",!1);b(this,"_columnWidths",new Map);b(this,"_oncolumnresize");b(this,"_isColumnReorderAllowed",!1);b(this,"_shouldPersistColumnOrder",!1);b(this,"_columnOrder",new Map);b(this,"_oncolumnreorder");b(this,"_fillDirection","vertical");b(this,"_fillDragCallback");b(this,"_onrowchange");b(this,"_onroweditstart");b(this,"_onroweditcancel");b(this,"_onvalidationerror");b(this,"_validationTooltipCallback");b(this,"_ontoolbarclick");b(this,"_onrowaction");b(this,"_oncontextmenuopen");b(this,"_onheadercontextmenuopen");b(this,"_ondatarequest");b(this,"_onrowdelete");b(this,"_sort",[]);b(this,"_filters",{});b(this,"_currentPage",1);b(this,"_totalItems",null);b(this,"_showPagination",!0);b(this,"_paginationPosition","bottom-center");b(this,"_paginationLabelsCallback");b(this,"_paginationLayout","pageSize|previous|pageInfo|next");b(this,"_summaryPosition");b(this,"_summaryContentCallback");b(this,"_summaryMetadata");b(this,"_isSummaryInline",!0);b(this,"_customStylesCallback");b(this,"_rowClassCallback");b(this,"_labels",{...ti});b(this,"_isScrollable",!1);b(this,"_scrollMaxHeight","100vh");b(this,"_tableBorderOnly",!1);b(this,"_isVirtualScrollEnabled",!1);b(this,"_virtualScrollThreshold",100);b(this,"_virtualScrollRowHeight",38);b(this,"_virtualScrollBuffer",10);b(this,"_isInfiniteScrollEnabled",!1);b(this,"_infiniteScrollThreshold",100);b(this,"_hasMoreItems",!0);b(this,"_isLoadingMore",!1);b(this,"_editingCell",null);b(this,"_currentCellError",null);b(this,"_isValidating",!1);b(this,"_draftRows",new Map);b(this,"_focusedCell",null);b(this,"_isCommittingFromKeyboard",!1);b(this,"_skipNextDropdownAutoEdit",!1);b(this,"_tabTraversalStartColIndex",null);b(this,"_hoveredRowIndex",null);b(this,"_focusedRowIndex",null);b(this,"_onrowfocus");b(this,"_onInteractionChange",null);b(this,"_selectedRows",new Set);b(this,"_lastSelectedRowIndex",null);b(this,"_rangeShortcuts",[]);b(this,"_cellSelectionMode","click");b(this,"_selectedCellRange",null);b(this,"_lastClickedCell",null);b(this,"_shouldCopyWithHeaders",!1);b(this,"_oncellselectionchange",null);b(this,"_selectedColumns",new Set);b(this,"_lastSelectedColumnIndex",-1);b(this,"_pasteMode","skip-non-editable");b(this,"_shouldValidateOnPaste",!0);b(this,"_createRowCallback");b(this,"_onbeforepaste");b(this,"_onpaste");b(this,"_isNewRowEnabled",!1);b(this,"_newRowPosition","bottom");b(this,"_newRowIndicator","+");b(this,"_createEmptyRowCallback");b(this,"_emptyRowDraft",null);b(this,"_treePathMember",null);b(this,"_treeLevelMember",null);b(this,"_treeParentMember",null);b(this,"_treeSeparator",null);b(this,"_treeDataSorted",!1);b(this,"_expandedPaths",new Set);b(this,"_expandedPathsExternal",null);b(this,"_defaultExpandDepth",null);b(this,"_treeIndex",null);b(this,"_onexpandedpathschange");b(this,"_treeDoubleClickBehavior","none");b(this,"_treeExpandedGlyph","▼");b(this,"_treeCollapsedGlyph","▶");b(this,"_treeChevronCallback");b(this,"_treeChevronCache",new WeakMap)}get items(){return this._items}set items(e){ct.debug("items set:",e.length,"rows"),this._items=e,this._treeChevronCache=new WeakMap,this.rebuildTreeState(),this.requestUpdate()}get columns(){return this._columns}set columns(e){no.debug("columns set:",e.length,"columns",e.map(o=>String(o.field))),this._columns=e,this.requestUpdate()}get sortMode(){return this._sortMode}set sortMode(e){this._sortMode=e,this.requestUpdate()}get isFilterable(){return this._isFilterable}set isFilterable(e){this._isFilterable=e,this.requestUpdate()}get isPageable(){return this._isPageable}set isPageable(e){this._isPageable=e,this.requestUpdate()}get pageSize(){return this._pageSize}set pageSize(e){this._pageSize=e,this.requestUpdate()}get pageSizes(){return this._pageSizes}set pageSizes(e){this._pageSizes=e,this.requestUpdate()}get paginationMode(){return this._paginationMode}set paginationMode(e){this._paginationMode=e,this.requestUpdate()}get isStriped(){return this._isStriped}set isStriped(e){this._isStriped=e,this.requestUpdate()}get isHoverable(){return this._isHoverable}set isHoverable(e){this._isHoverable=e,this.requestUpdate()}get isEditable(){return this._isEditable}set isEditable(e){this._isEditable=e,this.checkEditTriggerConflicts(),this.requestUpdate()}get editTrigger(){return this._editTrigger}set editTrigger(e){this._editTrigger=e,this.checkSelectionConflicts(),this.checkEditTriggerConflicts(),this.requestUpdate()}get editStartSelection(){return this._editStartSelection}set editStartSelection(e){this._editStartSelection=e}get mode(){return this._mode}set mode(e){this._mode=e,this.applyModeDefaults(),this.checkEditTriggerConflicts(),this.requestUpdate()}get dropdownToggleVisibility(){return this._dropdownToggleVisibility}set dropdownToggleVisibility(e){this._dropdownToggleVisibility=e,this.requestUpdate()}getEffectiveToggleVisibility(e){return e.dropdownToggleVisibility??this._dropdownToggleVisibility}get shouldShowDropdownOnFocus(){return this._shouldShowDropdownOnFocus}set shouldShowDropdownOnFocus(e){this._shouldShowDropdownOnFocus=e}get shouldOpenDropdownOnEnter(){return this._shouldOpenDropdownOnEnter}set shouldOpenDropdownOnEnter(e){this._shouldOpenDropdownOnEnter=e}getEffectiveShouldOpenDropdownOnEnter(e){return e.shouldOpenDropdownOnEnter??this._shouldOpenDropdownOnEnter}get isCheckboxAlwaysEditable(){return this._isCheckboxAlwaysEditable}set isCheckboxAlwaysEditable(e){this._isCheckboxAlwaysEditable=e,this.requestUpdate()}get isRowNumbersVisible(){return this._isRowNumbersVisible}set isRowNumbersVisible(e){this._isRowNumbersVisible=e,this.requestUpdate()}get isDirtyIndicatorVisible(){return this._isDirtyIndicatorVisible}set isDirtyIndicatorVisible(e){this._isDirtyIndicatorVisible=e,this.requestUpdate()}get isStickyRowNumbers(){return this._isStickyRowNumbers}set isStickyRowNumbers(e){this._isStickyRowNumbers=e,this.requestUpdate()}get freezeColumns(){return this._freezeColumns}set freezeColumns(e){this._freezeColumns=Math.max(0,Math.floor(e)),this.requestUpdate()}get visualColumns(){const e=[],o=[];this._columns.filter(s=>s.isFrozen&&!s.isHidden).length,this._columns.forEach((s,n)=>{if(s.isHidden)return;const l={column:s,originalIndex:n};s.isFrozen?e.push(l):o.push(l)});const i=[],r=[];return o.forEach((s,n)=>{n<this._freezeColumns?i.push(s):r.push(s)}),this._columnOrder.size>0&&r.sort((s,n)=>{const l=String(s.column.field),a=String(n.column.field),d=this._columnOrder.get(l)??s.originalIndex,c=this._columnOrder.get(a)??n.originalIndex;return d-c}),[...e,...i,...r]}get totalFrozenColumns(){return this._columns.filter(o=>o.isFrozen).length+this._freezeColumns}isColumnFrozen(e){return e<this.totalFrozenColumns}get invalidCells(){return this._invalidCells}set invalidCells(e){this._invalidCells=e,this.requestUpdate()}get editingCell(){return this._editingCell}get isValidating(){return this._isValidating}get currentCellError(){return this._currentCellError}get hoveredRowIndex(){return this._hoveredRowIndex}get isRowToolbarVisible(){return this._isRowToolbarVisible}set isRowToolbarVisible(e){this._isRowToolbarVisible=e,this.requestUpdate()}get rowToolbar(){return this._rowToolbar}set rowToolbar(e){this._rowToolbar=e,this.requestUpdate()}get toolbarVerticalAlign(){return this._toolbarVerticalAlign}set toolbarVerticalAlign(e){this._toolbarVerticalAlign=e,this.checkToolbarConflicts(),this.requestUpdate()}get toolbarHorizontalAlign(){return this._toolbarHorizontalAlign}set toolbarHorizontalAlign(e){this._toolbarHorizontalAlign=e,this.checkToolbarConflicts(),this.requestUpdate()}get toolbarAlign(){return this._toolbarVerticalAlign}set toolbarAlign(e){this.toolbarVerticalAlign=e}get toolbarTopPosition(){return this._toolbarHorizontalAlign}set toolbarTopPosition(e){this.toolbarHorizontalAlign=e}get toolbarTrigger(){return this._toolbarTrigger}set toolbarTrigger(e){this._toolbarTrigger=e,this.requestUpdate()}get toolbarPosition(){return this._toolbarPosition}set toolbarPosition(e){this._toolbarPosition=e,this.checkToolbarConflicts(),this.requestUpdate()}get toolbarColumn(){return this._toolbarColumn}set toolbarColumn(e){this._toolbarColumn=e,this.checkToolbarConflicts()}get toolbarFollowsCursor(){return this._toolbarFollowsCursor}set toolbarFollowsCursor(e){this._toolbarFollowsCursor=e,this.checkToolbarConflicts()}get cellToolbar(){return this._cellToolbar}set cellToolbar(e){this._cellToolbar=e,this.checkToolbarConflicts()}get cellToolbarOffset(){return this._cellToolbarOffset}set cellToolbarOffset(e){typeof e=="number"?this._cellToolbarOffset=Math.max(0,Math.min(1,e)):this._cellToolbarOffset=e}get toolbarBtnMinWidth(){return this._toolbarBtnMinWidth}set toolbarBtnMinWidth(e){this._toolbarBtnMinWidth=e}get inlineActionsTitle(){return this._inlineActionsTitle}set inlineActionsTitle(e){this._inlineActionsTitle=e,this.requestUpdate()}get contextMenu(){return this._contextMenu}set contextMenu(e){this._contextMenu=e,this.requestUpdate()}get contextMenuXOffset(){return this._contextMenuXOffset}set contextMenuXOffset(e){this._contextMenuXOffset=e}get contextMenuYOffset(){return this._contextMenuYOffset}set contextMenuYOffset(e){this._contextMenuYOffset=e}get headerContextMenu(){return this._headerContextMenu}set headerContextMenu(e){this._headerContextMenu=e}get rowShortcuts(){return this._rowShortcuts}set rowShortcuts(e){this._rowShortcuts=e,this.requestUpdate()}get isShortcutsHelpVisible(){return this._isShortcutsHelpVisible}set isShortcutsHelpVisible(e){this._isShortcutsHelpVisible=e,this.requestUpdate()}get shortcutsHelpPosition(){return this._shortcutsHelpPosition}set shortcutsHelpPosition(e){this._shortcutsHelpPosition=e,this.requestUpdate()}get shortcutsHelpContentCallback(){return this._shortcutsHelpContentCallback}set shortcutsHelpContentCallback(e){this._shortcutsHelpContentCallback=e,this.requestUpdate()}get sort(){return this._sort}set sort(e){ct.debug("sort changed:",e.map(o=>`${o.column} ${o.direction}`).join(", ")||"none"),this._sort=e,this.requestUpdate()}get currentPage(){return this._currentPage}set currentPage(e){ct.debug("page changed:",e),this._currentPage=e,this.requestUpdate()}get totalItems(){return this._totalItems}set totalItems(e){this._totalItems=e,this.requestUpdate()}get showPagination(){return this._showPagination}set showPagination(e){this._showPagination=e,this.requestUpdate()}get paginationPosition(){return this._paginationPosition}set paginationPosition(e){this._paginationPosition=e,this.requestUpdate()}get paginationLabelsCallback(){return this._paginationLabelsCallback}set paginationLabelsCallback(e){this._paginationLabelsCallback=e,this.requestUpdate()}get paginationLayout(){return this._paginationLayout}set paginationLayout(e){this._paginationLayout=e,this.requestUpdate()}get summaryPosition(){return this._summaryPosition}set summaryPosition(e){this._summaryPosition=e,this.requestUpdate()}get summaryContentCallback(){return this._summaryContentCallback}set summaryContentCallback(e){this._summaryContentCallback=e,this.requestUpdate()}get summaryMetadata(){return this._summaryMetadata}set summaryMetadata(e){this._summaryMetadata=e,this.requestUpdate()}get isSummaryInline(){return this._isSummaryInline}set isSummaryInline(e){this._isSummaryInline=e,this.requestUpdate()}get customStylesCallback(){return this._customStylesCallback}set customStylesCallback(e){this._customStylesCallback=e}get rowClassCallback(){return this._rowClassCallback}set rowClassCallback(e){this._rowClassCallback=e,this.requestUpdate()}get labels(){return this._labels}set labels(e){this._labels={...ti,...e},this.requestUpdate()}get isScrollable(){return this._isScrollable}set isScrollable(e){this._isScrollable=e,this.requestUpdate()}get scrollMaxHeight(){return this._scrollMaxHeight}set scrollMaxHeight(e){this._scrollMaxHeight=e,this.requestUpdate()}get tableBorderOnly(){return this._tableBorderOnly}set tableBorderOnly(e){this._tableBorderOnly=e,this.requestUpdate()}get isVirtualScrollEnabled(){return this._isVirtualScrollEnabled}set isVirtualScrollEnabled(e){this._isVirtualScrollEnabled=e,this.requestUpdate()}get virtualScrollThreshold(){return this._virtualScrollThreshold}set virtualScrollThreshold(e){this._virtualScrollThreshold=e,this.requestUpdate()}get virtualScrollRowHeight(){return this._virtualScrollRowHeight}set virtualScrollRowHeight(e){this._virtualScrollRowHeight=e,this.requestUpdate()}get virtualScrollBuffer(){return this._virtualScrollBuffer}set virtualScrollBuffer(e){this._virtualScrollBuffer=e,this.requestUpdate()}get isInfiniteScrollEnabled(){return this._isInfiniteScrollEnabled}set isInfiniteScrollEnabled(e){this._isInfiniteScrollEnabled=e,this.requestUpdate()}get infiniteScrollThreshold(){return this._infiniteScrollThreshold}set infiniteScrollThreshold(e){this._infiniteScrollThreshold=e}get hasMoreItems(){return this._hasMoreItems}set hasMoreItems(e){this._hasMoreItems=e}get isLoadingMore(){return this._isLoadingMore}set isLoadingMore(e){this._isLoadingMore=e}shouldUseVirtualScroll(){return this._isVirtualScrollEnabled===!1?!1:this._isVirtualScrollEnabled===!0?!0:this.displayItems.length>=this._virtualScrollThreshold}set onrowchange(e){this._onrowchange=e}set onroweditstart(e){this._onroweditstart=e}set onroweditcancel(e){this._onroweditcancel=e}set onvalidationerror(e){this._onvalidationerror=e}get validationTooltipCallback(){return this._validationTooltipCallback}set validationTooltipCallback(e){this._validationTooltipCallback=e}get ontoolbarclick(){return this._ontoolbarclick}set ontoolbarclick(e){this._ontoolbarclick=e}set onrowaction(e){this._onrowaction=e}set oncontextmenuopen(e){this._oncontextmenuopen=e}get onheadercontextmenuopen(){return this._onheadercontextmenuopen}set onheadercontextmenuopen(e){this._onheadercontextmenuopen=e}get ondatarequest(){return this._ondatarequest}set ondatarequest(e){this._ondatarequest=e}get onrowdelete(){return this._onrowdelete}set onrowdelete(e){this._onrowdelete=e}get idValueMember(){return this._idValueMember}set idValueMember(e){this._idValueMember=e}get idValueCallback(){return this._idValueCallback}set idValueCallback(e){this._idValueCallback=e}get rowLocking(){return this._rowLocking}set rowLocking(e){this._rowLocking=e,this.requestUpdate()}get onrowlockchange(){return this._onrowlockchange}set onrowlockchange(e){this._onrowlockchange=e}get gridName(){return this._gridName}set gridName(e){this._gridName=e}get shouldPersistColumnWidths(){return this._shouldPersistColumnWidths}set shouldPersistColumnWidths(e){this._shouldPersistColumnWidths=e}get oncolumnresize(){return this._oncolumnresize}set oncolumnresize(e){this._oncolumnresize=e}get isColumnReorderAllowed(){return this._isColumnReorderAllowed}set isColumnReorderAllowed(e){this._isColumnReorderAllowed=e}get shouldPersistColumnOrder(){return this._shouldPersistColumnOrder}set shouldPersistColumnOrder(e){this._shouldPersistColumnOrder=e}get oncolumnreorder(){return this._oncolumnreorder}set oncolumnreorder(e){this._oncolumnreorder=e}get fillDirection(){return this._fillDirection}set fillDirection(e){this._fillDirection=e}get fillDragCallback(){return this._fillDragCallback}set fillDragCallback(e){this._fillDragCallback=e}get selectedRows(){return Array.from(this._selectedRows).sort((e,o)=>e-o)}get rangeShortcuts(){return this._rangeShortcuts}set rangeShortcuts(e){this._rangeShortcuts=e}isRowSelected(e){return this._selectedRows.has(e)}selectRow(e,o="replace"){switch(Pe.debug("selectRow:",{rowIndex:e,mode:o}),this._selectedCellRange&&(this._selectedCellRange=null),this._selectedColumns.clear(),o){case"replace":this._selectedRows.clear(),this._selectedRows.add(e),this._lastSelectedRowIndex=e;break;case"toggle":this._selectedRows.has(e)?this._selectedRows.delete(e):this._selectedRows.add(e),this._lastSelectedRowIndex=e;break;case"range":if(this._lastSelectedRowIndex!==null){const i=Math.min(this._lastSelectedRowIndex,e),r=Math.max(this._lastSelectedRowIndex,e);for(let s=i;s<=r;s++)this._selectedRows.add(s)}else this._selectedRows.add(e),this._lastSelectedRowIndex=e;break}this.requestUpdate()}selectRowRange(e,o){this._selectedColumns.clear(),this._selectedCellRange=null,this._selectedRows.clear();const i=Math.min(e,o),r=Math.max(e,o);for(let s=i;s<=r;s++)this._selectedRows.add(s);this._lastSelectedRowIndex=o,this.requestUpdate()}clearSelection(){this._selectedRows.size>0&&(this._selectedRows.clear(),this._lastSelectedRowIndex=null,this.requestUpdate())}clearSelection_noRender(){this._selectedRows.clear(),this._lastSelectedRowIndex=null}getSelectedRowsData(){return this.selectedRows.map(e=>this.displayItems[e]).filter(Boolean)}async copySelectedRowsToClipboard(){const e=this.selectedRows;if(e.length===0)return!1;const o=[];if(this._shouldCopyWithHeaders){const r=[];for(const s of this.visualColumns){const n=s.column.title??s.column.field??"";r.push(String(n))}o.push(r.join(" "))}for(const r of e){const s=this.displayItems[r];if(!s)continue;const n=[];for(const l of this.visualColumns){const a=String(l.column.field),d=s[a],c=d==null?"":String(d);n.push(c)}o.push(n.join(" "))}const i=o.join(`
|
|
297
|
+
`);try{return await navigator.clipboard.writeText(i),!0}catch{return!1}}async copySelectedColumnsToClipboard(){const e=this.selectedColumns;if(e.length===0)return!1;const o=[];if(this._shouldCopyWithHeaders){const r=[];for(const s of e){const n=this.visualColumns[s];if(!n)continue;const l=n.column.title??n.column.field??"";r.push(String(l))}o.push(r.join(" "))}for(let r=0;r<this.displayItems.length;r++){const s=this.displayItems[r];if(!s)continue;const n=[];for(const l of e){const a=this.visualColumns[l];if(!a)continue;const d=String(a.column.field),c=s[d],u=c==null?"":String(c);n.push(u)}o.push(n.join(" "))}const i=o.join(`
|
|
298
|
+
`);try{return await navigator.clipboard.writeText(i),!0}catch{return!1}}get cellSelectionMode(){return this._cellSelectionMode}set cellSelectionMode(e){this._cellSelectionMode=e,this.checkSelectionConflicts(),this.requestUpdate()}get shouldCopyWithHeaders(){return this._shouldCopyWithHeaders}set shouldCopyWithHeaders(e){this._shouldCopyWithHeaders=e}get selectedCellRange(){return this._selectedCellRange}get lastClickedCell(){return this._lastClickedCell}set lastClickedCell(e){this._lastClickedCell=e}get oncellselectionchange(){return this._oncellselectionchange}set oncellselectionchange(e){this._oncellselectionchange=e}get pasteMode(){return this._pasteMode}set pasteMode(e){this._pasteMode=e}get shouldValidateOnPaste(){return this._shouldValidateOnPaste}set shouldValidateOnPaste(e){this._shouldValidateOnPaste=e}get createRowCallback(){return this._createRowCallback}set createRowCallback(e){this._createRowCallback=e}get onbeforepaste(){return this._onbeforepaste}set onbeforepaste(e){this._onbeforepaste=e}get onpaste(){return this._onpaste}set onpaste(e){this._onpaste=e}get isNewRowEnabled(){return this._isNewRowEnabled}set isNewRowEnabled(e){e&&!this.isNavigateMode&&console.warn('[WebGrid] Empty row requires navigate mode (editTrigger: "navigate"). Tab navigation will not work correctly without it.'),this._isNewRowEnabled=e,this._emptyRowDraft=null,this.requestUpdate()}get newRowPosition(){return this._newRowPosition}set newRowPosition(e){this._newRowPosition=e,this.requestUpdate()}get newRowIndicator(){return this._newRowIndicator}set newRowIndicator(e){this._newRowIndicator=e,this.requestUpdate()}get createEmptyRowCallback(){return this._createEmptyRowCallback}set createEmptyRowCallback(e){this._createEmptyRowCallback=e}get treePathMember(){return this._treePathMember}set treePathMember(e){this._treePathMember=e||null,this.rebuildTreeState(),this.requestUpdate()}get treeLevelMember(){return this._treeLevelMember}set treeLevelMember(e){this._treeLevelMember=e||null,this.rebuildTreeState(),this.requestUpdate()}get treeParentMember(){return this._treeParentMember}set treeParentMember(e){this._treeParentMember=e||null,this.rebuildTreeState(),this.requestUpdate()}get treeSeparator(){return this._treeSeparator}set treeSeparator(e){this._treeSeparator=e||null,this.rebuildTreeState(),this.requestUpdate()}get treeDataSorted(){return this._treeDataSorted}set treeDataSorted(e){this._treeDataSorted=e,this.requestUpdate()}get expandedPaths(){return this._expandedPaths}set expandedPaths(e){this._expandedPathsExternal=e instanceof Set?e:null,this.rebuildExpandedPaths(),this.requestUpdate()}get defaultExpandDepth(){return this._defaultExpandDepth}set defaultExpandDepth(e){this._defaultExpandDepth=typeof e=="number"&&e>=0?e:null,this._expandedPathsExternal||(this.rebuildExpandedPaths(),this.requestUpdate())}get onexpandedpathschange(){return this._onexpandedpathschange}set onexpandedpathschange(e){this._onexpandedpathschange=e}get isTreeMode(){return!!this._treePathMember&&!!this._treeIndex}isPathExpanded(e){return this._expandedPaths.has(e)}toggleExpandedPath(e){var i;const o=this._expandedPaths.has(e);o?this._expandedPaths.delete(e):this._expandedPaths.add(e),Pe.debug("tree toggle:",e,o?"expanded → collapsed":"collapsed → expanded","| set size now:",this._expandedPaths.size),(i=this._onexpandedpathschange)==null||i.call(this,{path:e,expanded:!o,expandedPaths:this._expandedPaths}),this.requestUpdate()}expandAll(){if(this._treeIndex){this._expandedPaths.clear();for(const e of this._treeIndex.nodes.keys())this._expandedPaths.add(e);Pe.debug("tree expandAll: size =",this._expandedPaths.size),this.requestUpdate()}}collapseAll(){this._expandedPaths.clear(),Pe.debug("tree collapseAll"),this.requestUpdate()}getRowTreeInfo(e){if(!this.isTreeMode)return null;const o=this.getRowTreePath(e);if(!o)return null;const i=this._treeIndex.nodes.get(o);return i?{path:o,level:i.level,hasChildren:i.childPaths.length>0}:null}get treeDoubleClickBehavior(){return this._treeDoubleClickBehavior}set treeDoubleClickBehavior(e){this._treeDoubleClickBehavior=e||"none"}get treeExpandedGlyph(){return this._treeExpandedGlyph}set treeExpandedGlyph(e){this._treeExpandedGlyph=e??"▼",this.requestUpdate()}get treeCollapsedGlyph(){return this._treeCollapsedGlyph}set treeCollapsedGlyph(e){this._treeCollapsedGlyph=e??"▶",this.requestUpdate()}get treeChevronCallback(){return this._treeChevronCallback}set treeChevronCallback(e){this._treeChevronCallback=e,this._treeChevronCache=new WeakMap,this.requestUpdate()}getTreeChevronHtml(e,o,i,r,s){const n=this._treeChevronCallback;if(!n)return i?o?this._treeExpandedGlyph:this._treeCollapsedGlyph:"";const l=e;let a=this._treeChevronCache.get(l);a||(a=new Map,this._treeChevronCache.set(l,a));const d=`${o?"e":"c"}|${i?"1":"0"}`;let c=a.get(d);return c===void 0&&(c=n({expanded:o,hasChildren:i,row:e,level:r,path:s}),a.set(d,c)),c}getRowTreePath(e){if(!this._treePathMember)return null;const o=e[this._treePathMember];if(o==null)return null;const i=String(o);return i===""?null:i}detectTreeSeparator(e){return e.includes("/")?"/":e.includes("\\")?"\\":(e.includes("."),".")}rebuildTreeState(){if(!this._treePathMember||this._items.length===0){this._treeIndex=null,this.rebuildExpandedPaths();return}let e=this._treeSeparator;if(!e){for(const r of this._items){const s=this.getRowTreePath(r);if(s){e=this.detectTreeSeparator(s);break}}e=e||"."}const o=new Map;for(let r=0;r<this._items.length;r++){const s=this._items[r],n=this.getRowTreePath(s);if(!n)continue;let l=0;if(this._treeLevelMember){const d=s[this._treeLevelMember];typeof d=="number"&&(l=d)}else l=Math.max(0,n.split(e).filter(Boolean).length-1);let a=null;if(this._treeParentMember){const d=s[this._treeParentMember];a=d==null||d===""?null:String(d)}else{const d=n.endsWith(e)?n.slice(0,-e.length):n,c=d.lastIndexOf(e);a=c<0?null:d.slice(0,c)||null}o.set(n,{path:n,parent:a,level:l,rowIndex:r,childPaths:[]})}const i=[];for(const r of o.values())r.parent&&o.has(r.parent)?o.get(r.parent).childPaths.push(r.path):i.push(r.path);this._treeIndex={separator:e,nodes:o,rootPaths:i},this.rebuildExpandedPaths()}rebuildExpandedPaths(){if(this._expandedPathsExternal){this._expandedPaths=this._expandedPathsExternal;return}const e=new Set;if(this._treeIndex)if(this._defaultExpandDepth!==null)for(const o of this._treeIndex.nodes.values())o.level<this._defaultExpandDepth&&e.add(o.path);else for(const o of this._treeIndex.nodes.keys())e.add(o);this._expandedPaths=e}compareTreeNodes(e,o){const i=this._items[e.rowIndex],r=this._items[o.rowIndex];for(const s of this._sort){const n=i[s.column],l=r[s.column];if(n===l)continue;let a=0;return typeof n=="string"&&typeof l=="string"?a=n.localeCompare(l):typeof n=="number"&&typeof l=="number"?a=n-l:a=String(n??"").localeCompare(String(l??"")),s.direction==="asc"?a:-a}return e.path.localeCompare(o.path)}getTreeFilterAllowedPaths(){var r,s;if(!this._treeIndex||!this._isFilterable)return null;const e=Object.entries(this._filters).filter(([,n])=>!!n);if(e.length===0)return null;const o=new Set;for(const n of this._treeIndex.nodes.values()){const l=this._items[n.rowIndex];let a=!0;for(const[d,c]of e)if(!String(l[d]??"").toLowerCase().includes(c.toLowerCase())){a=!1;break}a&&o.add(n.path)}const i=new Set(o);for(const n of o){let l=((r=this._treeIndex.nodes.get(n))==null?void 0:r.parent)??null;for(;l&&!i.has(l);)i.add(l),l=((s=this._treeIndex.nodes.get(l))==null?void 0:s.parent)??null}return i}getTreeSortedItems(){if(!this._treeIndex)return this._items;const e=this.getTreeFilterAllowedPaths();if(this._treeDataSorted){const s=[];for(let n=0;n<this._items.length;n++){const l=this._items[n],a=this.getRowTreePath(l);a&&(e&&!e.has(a)||s.push(l))}return s}const o=this._treeIndex,i=[],r=s=>{const n=e?s.filter(l=>e.has(l)):[...s];n.sort((l,a)=>this.compareTreeNodes(o.nodes.get(l),o.nodes.get(a)));for(const l of n){const a=o.nodes.get(l);i.push(this._items[a.rowIndex]),a.childPaths.length>0&&r(a.childPaths)}};return r(o.rootPaths),i}getTreeVisibleItems(){if(!this._treeIndex)return this._items;const e=this.getTreeSortedItems(),o=this._treeIndex,i=this.getTreeFilterAllowedPaths()!==null,r=[];for(const s of e){const n=this.getRowTreePath(s);if(!n){r.push(s);continue}const l=o.nodes.get(n);if(!l){r.push(s);continue}let a=!0,d=l.parent;for(;d;){if(!this.isPathExpanded(d)&&!i){a=!1;break}const c=o.nodes.get(d);d=c?c.parent:null}a&&r.push(s)}return r}selectCellRange(e){if(Pe.debug("selectCellRange:",{startRow:e.startRowIndex,startCol:e.startColIndex,endRow:e.endRowIndex,endCol:e.endColIndex}),this._selectedRows.size>0&&(this._selectedRows.clear(),this._lastSelectedRowIndex=null),this._selectedColumns.clear(),this._selectedCellRange=e,this.requestUpdate(),this._oncellselectionchange){const o=this.getSelectedCells();this._oncellselectionchange({range:e,cellCount:o.length})}}clearCellSelection(){this._selectedCellRange&&(this._selectedCellRange=null,this.requestUpdate(),this._oncellselectionchange&&this._oncellselectionchange({range:null,cellCount:0}))}clearCellSelection_noRender(){this._selectedCellRange&&(this._selectedCellRange=null,this._oncellselectionchange&&this._oncellselectionchange({range:null,cellCount:0}))}selectAll(){const e=this.displayItems.length,o=this.visualColumns.length;if(e===0||o===0)return;const i=this.visualColumns[0],r=this.visualColumns[o-1],s={startRowIndex:0,startColIndex:0,endRowIndex:e-1,endColIndex:o-1,startField:String(i.column.field),endField:String(r.column.field)};this.selectCellRange(s)}selectColumn(e,o="replace"){const i=this.visualColumns.length;if(!(e<0||e>=i)){if(this._selectedRows.clear(),this._selectedCellRange=null,o==="replace")this._selectedColumns.clear(),this._selectedColumns.add(e),this._lastSelectedColumnIndex=e;else if(o==="toggle")this._selectedColumns.has(e)?this._selectedColumns.delete(e):this._selectedColumns.add(e),this._lastSelectedColumnIndex=e;else if(o==="range"){const r=this._lastSelectedColumnIndex>=0?this._lastSelectedColumnIndex:e,s=Math.min(r,e),n=Math.max(r,e);for(let l=s;l<=n;l++)this._selectedColumns.add(l)}this.requestUpdate()}}clearColumnSelection(){this._selectedColumns.clear(),this._lastSelectedColumnIndex=-1,this.requestUpdate()}clearColumnSelection_noRender(){this._selectedColumns.clear(),this._lastSelectedColumnIndex=-1}selectColumnRange(e,o){this._selectedRows.clear(),this._selectedCellRange=null,this._selectedColumns.clear();const i=Math.min(e,o),r=Math.max(e,o);for(let s=i;s<=r;s++)this._selectedColumns.add(s);this._lastSelectedColumnIndex=o,this.requestUpdate()}get selectedColumns(){return Array.from(this._selectedColumns).sort((e,o)=>e-o)}isColumnSelected(e){return this._selectedColumns.has(e)}getSelectedCells(){var c;if(!this._selectedCellRange)return[];const{startRowIndex:e,endRowIndex:o,startColIndex:i,endColIndex:r}=this._selectedCellRange,s=Math.min(e,o),n=Math.max(e,o),l=Math.min(i,r),a=Math.max(i,r),d=[];for(let u=s;u<=n;u++)for(let g=l;g<=a;g++){const h=(c=this.visualColumns[g])==null?void 0:c.column;if(!h)continue;const f=this.displayItems[u];if(!f)continue;const w=String(h.field),p=f[w];d.push({row:f,rowIndex:u,colIndex:g,field:w,value:p})}return d}isCellInSelectedRange(e,o){if(!this._selectedCellRange)return!1;const{startRowIndex:i,endRowIndex:r,startColIndex:s,endColIndex:n}=this._selectedCellRange,l=Math.min(i,r),a=Math.max(i,r),d=Math.min(s,n),c=Math.max(s,n);return e>=l&&e<=a&&o>=d&&o<=c}async copyCellSelectionToClipboard(){var u,g;if(!this._selectedCellRange)return!1;const{startRowIndex:e,endRowIndex:o,startColIndex:i,endColIndex:r}=this._selectedCellRange,s=Math.min(e,o),n=Math.max(e,o),l=Math.min(i,r),a=Math.max(i,r),d=[];if(this._shouldCopyWithHeaders){const h=[];for(let f=l;f<=a;f++){const w=(u=this.visualColumns[f])==null?void 0:u.column,p=(w==null?void 0:w.title)??(w==null?void 0:w.field)??"";h.push(String(p))}d.push(h.join(" "))}for(let h=s;h<=n;h++){const f=this.displayItems[h];if(!f)continue;const w=[];for(let p=l;p<=a;p++){const m=(g=this.visualColumns[p])==null?void 0:g.column;if(!m){w.push("");continue}const v=String(m.field),y=f[v],C=y==null?"":String(y);w.push(C)}d.push(w.join(" "))}const c=d.join(`
|
|
299
|
+
`);try{return await navigator.clipboard.writeText(c),!0}catch{return!1}}get isNavigateMode(){return this._editTrigger==="navigate"||this._columns.some(e=>e.editTrigger==="navigate")}get filteredItems(){return!this._isFilterable||Object.keys(this._filters).length===0?this._items:this._items.filter(e=>Object.entries(this._filters).every(([o,i])=>i?String(e[o]??"").toLowerCase().includes(i.toLowerCase()):!0))}get sortedItems(){return this.isTreeMode?this.getTreeSortedItems():this._sort.length===0?this.filteredItems:[...this.filteredItems].sort((e,o)=>{for(const i of this._sort){const r=e[i.column],s=o[i.column];if(r===s)continue;let n=0;return typeof r=="string"&&typeof s=="string"?n=r.localeCompare(s):typeof r=="number"&&typeof s=="number"?n=r-s:n=String(r??"").localeCompare(String(s??"")),i.direction==="asc"?n:-n}return 0})}get paginatedItems(){const e=this.isTreeMode?this.getTreeVisibleItems():this.sortedItems;if(!this._isPageable||this._paginationMode==="server")return e;const o=(this._currentPage-1)*this._pageSize,i=o+this._pageSize;return e.slice(o,i)}get totalPages(){let e;return this._totalItems!==null?e=this._totalItems:this.isTreeMode?e=this.getTreeVisibleItems().length:e=this.sortedItems.length,Math.max(1,Math.ceil(e/this._pageSize))}get displayItems(){const e=this.paginatedItems;if(!this._isNewRowEnabled)return e;const o=this.getEmptyRow();return this._newRowPosition==="top"?[o,...e]:[...e,o]}getEmptyRow(){if(this._emptyRowDraft)return this._emptyRowDraft;const e=this.createNewEmptyRow();return this._emptyRowDraft=e,e}createNewEmptyRow(){if(this._createEmptyRowCallback){const o=this._createEmptyRowCallback();return o instanceof Promise?(o.then(i=>{this._emptyRowDraft=i,this.requestUpdate()}).catch(i=>{console.warn("WebGrid: createEmptyRowCallback failed",i)}),{}):o}const e={};for(const o of this._columns)e[String(o.field)]=null;return e}isEmptyRowIndex(e){return this._isNewRowEnabled?this._newRowPosition==="top"?e===0:e===this.paginatedItems.length:!1}getDataIndexFromDisplayIndex(e){return this._isNewRowEnabled&&this._newRowPosition==="top"?e-1:e}emptyRowHasData(e){for(const o of this._columns){const i=e[String(o.field)];if(i!=null&&i!=="")return!0}return!1}fireDataRequest(e){if(this._ondatarequest){const o=e==="loadMore"?this._items.length:(this._currentPage-1)*this._pageSize,i={sort:[...this._sort],page:this._currentPage,pageSize:this._pageSize,trigger:e,mode:e==="loadMore"?"append":"replace",skip:o};ct.debug("fireDataRequest:",e,i),this._ondatarequest(i)}}getColumnSortState(e){return this._sort.find(o=>o.column===e)}getColumnSortPriority(e){const o=this._sort.findIndex(i=>i.column===e);return o>=0?o+1:0}applyModeDefaults(){switch(this._mode){case"read-only":this._isEditable=!1,this._dropdownToggleVisibility="on-focus",this._cellSelectionMode="click";break;case"excel":this._isEditable=!0,this._editTrigger="navigate",this._dropdownToggleVisibility="always",this._shouldShowDropdownOnFocus=!1,this._cellSelectionMode="click";break;case"input-matrix":this._isEditable=!0,this._editTrigger="always",this._dropdownToggleVisibility="always",this._shouldShowDropdownOnFocus=!0,this._cellSelectionMode="shift";break}}checkSelectionConflicts(){this._cellSelectionMode==="click"&&this._editTrigger==="click"&&console.warn('WebGrid: cellSelectionMode="click" conflicts with editTrigger="click". Cell range selection takes priority. Use Shift+click to enter edit mode, or change to cellSelectionMode="shift" to avoid confusion.')}checkEditTriggerConflicts(){!this._isEditable&&this._editTrigger==="always"&&console.warn(`%cWebGrid: editTrigger="always" is not supported in read-only mode (isEditable=false).
|
|
300
300
|
Supported editTrigger values in read-only mode: "navigate", "click", "dblclick".
|
|
301
|
-
The grid may behave unexpectedly.`,"font-size: 14px; font-weight: bold;")}checkToolbarConflicts(){const
|
|
302
|
-
verticalAlign only applies to side positions: "left", "right", or "auto".`,r),this._toolbarHorizontalAlign!=="center"&&!i&&console.warn(`%cWebGrid: toolbarHorizontalAlign="${this._toolbarHorizontalAlign}" has no effect with toolbarPosition="${
|
|
303
|
-
horizontalAlign only applies to toolbarPosition="top".`,r),this._toolbarColumn!==void 0&&!i&&console.warn(`%cWebGrid: toolbarColumn has no effect with toolbarPosition="${
|
|
304
|
-
toolbarColumn only applies to toolbarPosition="top".`,r),this._toolbarFollowsCursor&&!i&&console.warn(`%cWebGrid: toolbarFollowsCursor has no effect with toolbarPosition="${
|
|
305
|
-
toolbarFollowsCursor only applies to toolbarPosition="top".`,r),this._cellToolbar!==void 0&&!i&&console.warn(`%cWebGrid: cellToolbar has no effect with toolbarPosition="${
|
|
301
|
+
The grid may behave unexpectedly.`,"font-size: 14px; font-weight: bold;")}checkToolbarConflicts(){const e=this._toolbarPosition,o=e==="top"||e==="inline",i=e==="top",r="font-size: 14px; font-weight: bold;";this._toolbarVerticalAlign!=="bottom"&&o&&console.warn(`%cWebGrid: toolbarVerticalAlign="${this._toolbarVerticalAlign}" has no effect with toolbarPosition="${e}".
|
|
302
|
+
verticalAlign only applies to side positions: "left", "right", or "auto".`,r),this._toolbarHorizontalAlign!=="center"&&!i&&console.warn(`%cWebGrid: toolbarHorizontalAlign="${this._toolbarHorizontalAlign}" has no effect with toolbarPosition="${e}".
|
|
303
|
+
horizontalAlign only applies to toolbarPosition="top".`,r),this._toolbarColumn!==void 0&&!i&&console.warn(`%cWebGrid: toolbarColumn has no effect with toolbarPosition="${e}".
|
|
304
|
+
toolbarColumn only applies to toolbarPosition="top".`,r),this._toolbarFollowsCursor&&!i&&console.warn(`%cWebGrid: toolbarFollowsCursor has no effect with toolbarPosition="${e}".
|
|
305
|
+
toolbarFollowsCursor only applies to toolbarPosition="top".`,r),this._cellToolbar!==void 0&&!i&&console.warn(`%cWebGrid: cellToolbar has no effect with toolbarPosition="${e}".
|
|
306
306
|
cellToolbar requires toolbarPosition="top".`,r),this._toolbarFollowsCursor&&this._toolbarColumn!==void 0&&console.warn(`%cWebGrid: toolbarColumn and toolbarFollowsCursor are both set.
|
|
307
|
-
toolbarColumn takes priority — cursor following is disabled.`,r)}requestUpdate(){}getRowDraft(t){return this._draftRows.get(t)}hasRowDraft(t){return this._draftRows.has(t)}isCellDirty(t,o){const i=this._draftRows.get(t);if(!i)return!1;const r=this.displayItems[t];if(!r)return!1;const s=i[o],n=r[o];return s!==n}isRowDirty(t){return this._draftRows.has(t)}discardRowDraft(t){this._draftRows.delete(t),this._invalidCells=this._invalidCells.filter(o=>o.rowIndex!==t),this.requestUpdate()}discardCellDraft(t,o){const i=this._draftRows.get(t);if(!i)return;const r=this.displayItems[t];if(!r)return;const s=r[o];i[o]=s;const n=Object.keys(i);let l=!1;for(const a of n){const d=i[a],c=r[a];if(d!==c){l=!0;break}}l||this._draftRows.delete(t),this._invalidCells=this._invalidCells.filter(a=>!(a.rowIndex===t&&a.field===o))}getDraftRowIndices(){return Array.from(this._draftRows.keys())}discardAllDrafts(){this._draftRows.clear(),this._invalidCells=[],this.requestUpdate()}getCellRawValue(t,o,i){if(!this.isEmptyRowIndex(o)){const r=this._draftRows.get(o);if(r)return r[i]}return t[i]}getCellValue(t,o,i){var s;if(o.templateCallback)return o.templateCallback(t);const r=i!==void 0?this.getCellRawValue(t,i,String(o.field)):t[String(o.field)];if(o.formatCallback)return o.formatCallback(r,t);if(o.editor==="date"&&((s=o.editorOptions)!=null&&s.dateFormat)&&r)try{const n=r instanceof Date?r:new Date(r);if(!isNaN(n.getTime())){const l=Et(o.editorOptions.dateFormat);return Zt(n,l)}}catch{}return String(r??"")}isCellInvalid(t,o){return this._invalidCells.some(i=>i.rowIndex===t&&i.field===o)}getCellValidationError(t,o){const i=this._invalidCells.find(r=>r.rowIndex===t&&r.field===o);return(i==null?void 0:i.error)||null}addInvalidCell(t,o,i){const r=this._invalidCells.findIndex(s=>s.rowIndex===t&&s.field===o);r>=0?this._invalidCells[r]={rowIndex:t,field:o,error:i}:this._invalidCells=[...this._invalidCells,{rowIndex:t,field:o,error:i}]}removeInvalidCell(t,o){this._invalidCells=this._invalidCells.filter(i=>!(i.rowIndex===t&&i.field===o))}isEditing(t,o){var i,r;return((i=this._editingCell)==null?void 0:i.rowIndex)===t&&((r=this._editingCell)==null?void 0:r.field)===o}shouldShowEditor(t,o){const i=this._columns[o];if(!i)return!1;const r=String(i.field);return!!(this.isEditing(t,r)||(i.editTrigger??this._editTrigger)==="always"&&this.isCellEditable(i))}startEdit(t,o,i){var n,l;if(!this.canEditCell(t,o)){dt.debug("startEdit blocked (locked):",{rowIndex:t,field:o});return}dt.debug("startEdit:",{rowIndex:t,field:o,options:i});const r=this.displayItems[t];if(!r)return;this._draftRows.has(t)||this._draftRows.set(t,{...r});const s=this._editingCell;this._editingCell={rowIndex:t,field:o,initialSearchQuery:i==null?void 0:i.initialSearchQuery,cursorPosition:i==null?void 0:i.cursorPosition},(n=this._onInteractionChange)==null||n.call(this,"editingCell",{prev:s,current:this._editingCell}),this._currentCellError=null,(l=this._onroweditstart)==null||l.call(this,{row:r,rowIndex:t,field:o})}cancelEdit(){var t,o;if(this._editingCell){const i=this._editingCell,{rowIndex:r,field:s}=i,n=this.displayItems[r];n&&((t=this._onroweditcancel)==null||t.call(this,{row:n,rowIndex:r,field:s})),this._editingCell=null,(o=this._onInteractionChange)==null||o.call(this,"editingCell",{prev:i,current:null}),this._currentCellError=null}}normalizeValidationResult(t,o){return t==null||t===!0?{valid:!0,finalValue:o}:t===!1?{valid:!1,message:"Validation failed",finalValue:o}:typeof t=="string"?{valid:!1,message:t,finalValue:o}:{valid:t.valid,message:t.message,finalValue:t.transformedValue!==void 0?t.transformedValue:o}}async commitEdit(t,o,i,r=!1){var f,w,p,m,v,y,x;at.debug("commitEdit:",{rowIndex:t,field:o,newValue:i});const s=this._columns.find(C=>String(C.field)===o);if(!s)return;const n=this.displayItems[t];if(!n)return;const l=this.isEmptyRowIndex(t),a=n[o];let d=i,c=null,u=!0;this._isValidating=!0;try{if(s.beforeCommitCallback){const C={value:i,oldValue:a,row:n,rowIndex:t,field:o},_=await Promise.resolve(s.beforeCommitCallback(C)),S=this.normalizeValidationResult(_,i);u=S.valid,c=S.message||null,d=S.finalValue}else if(s.validateCallback){const C=await Promise.resolve(s.validateCallback(i,n));C&&(u=!1,c=C)}}catch(C){u=!1,c=C instanceof Error?C.message:"Validation failed"}if(this._isValidating=!1,l){if(this._emptyRowDraft||(this._emptyRowDraft={...n}),this._emptyRowDraft[o]=d,u?(this.removeInvalidCell(t,o),this._currentCellError=null):(this.addInvalidCell(t,o,c||"Invalid value"),this._currentCellError=c,(f=this._onvalidationerror)==null||f.call(this,{row:n,rowIndex:t,field:o,error:c||"Invalid value"})),r&&this.emptyRowHasData(this._emptyRowDraft)){const S={...this._emptyRowDraft},k=this._newRowPosition==="top"?0:this._items.length;this._invalidCells=this._invalidCells.map(I=>I.rowIndex===t?{...I,rowIndex:k}:this._newRowPosition==="top"?{...I,rowIndex:I.rowIndex+1}:I),this._newRowPosition==="top"?this._items=[S,...this._items]:this._items=[...this._items,S];const E=this._invalidCells.some(I=>I.rowIndex===k);(w=this._onrowchange)==null||w.call(this,{row:S,draftRow:S,rowIndex:k,field:o,oldValue:null,newValue:d,isValid:!E,validationError:E?"Row has invalid cells":null}),this._emptyRowDraft=null;const R=this._editingCell;this._editingCell=null,(p=this._onInteractionChange)==null||p.call(this,"editingCell",{prev:R,current:null}),this.requestUpdate();return}const C=this._editingCell;this._editingCell=null,(m=this._onInteractionChange)==null||m.call(this,"editingCell",{prev:C,current:null});return}let g=this._draftRows.get(t);g||(g={...n},this._draftRows.set(t,g)),g[o]=d,u?(this.removeInvalidCell(t,o),this._currentCellError=null):(this.addInvalidCell(t,o,c||"Invalid value"),this._currentCellError=c,(v=this._onvalidationerror)==null||v.call(this,{row:n,rowIndex:t,field:o,error:c||"Invalid value"})),(y=this._onrowchange)==null||y.call(this,{row:n,draftRow:g,rowIndex:t,field:o,oldValue:a,newValue:d,isValid:u,validationError:c});const h=this._editingCell;this._editingCell=null,(x=this._onInteractionChange)==null||x.call(this,"editingCell",{prev:h,current:null})}updateDraftValue(t,o,i){var a;if(!this._columns.find(d=>String(d.field)===o))return;const s=this.displayItems[t];if(!s)return;const n=this.getCellRawValue(s,t,o);if(this.isEmptyRowIndex(t))this._emptyRowDraft||(this._emptyRowDraft={...s}),this._emptyRowDraft[o]=i;else{let d=this._draftRows.get(t);d||(d={...s},this._draftRows.set(t,d)),d[o]=i}const l=this._draftRows.get(t)||this._emptyRowDraft||s;(a=this._onrowchange)==null||a.call(this,{row:s,draftRow:l,rowIndex:t,field:o,oldValue:n,newValue:i,isValid:!0,validationError:null})}isCellEditable(t){return t.isEditable===!1?!1:t.isEditable===!0?!0:this._isEditable}getEditableColumns(){return this._columns.map((t,o)=>({index:o,column:t})).filter(({column:t})=>this.isCellEditable(t))}isCellFocused(t,o){var i,r;return((i=this._focusedCell)==null?void 0:i.rowIndex)===t&&((r=this._focusedCell)==null?void 0:r.colIndex)===o}get focusedCell(){return this._focusedCell}setFocusedCell(t,o){var s;const i=this._focusedCell,r={rowIndex:t,colIndex:o};(i==null?void 0:i.rowIndex)===r.rowIndex&&(i==null?void 0:i.colIndex)===r.colIndex||(this._focusedCell=r,(s=this._onInteractionChange)==null||s.call(this,"focusedCell",{prev:i,current:r}))}clearFocusedCell(){var o;const t=this._focusedCell;t!==null&&(this._focusedCell=null,(o=this._onInteractionChange)==null||o.call(this,"focusedCell",{prev:t,current:null}))}get tabTraversalStartColIndex(){return this._tabTraversalStartColIndex}set tabTraversalStartColIndex(t){this._tabTraversalStartColIndex=t}setHoveredRow(t){var i;if(this._hoveredRowIndex===t)return;const o=this._hoveredRowIndex;this._hoveredRowIndex=t,(i=this._onInteractionChange)==null||i.call(this,"hoveredRow",{prev:o,current:t})}get focusedRowIndex(){return this._focusedRowIndex}set focusedRowIndex(t){t===null?this.clearRowFocus():this.setFocusedRow(t),this.requestUpdate()}get onrowfocus(){return this._onrowfocus}set onrowfocus(t){this._onrowfocus=t}isRowFocused(t){return this._focusedRowIndex===t}clearRowFocus(){var o;if(this._focusedRowIndex===null)return;const t=this._focusedRowIndex;this._focusedRowIndex=null,(o=this._onInteractionChange)==null||o.call(this,"focusedRow",{prev:t,current:null})}setFocusedRow(t){var r;if(this._focusedRowIndex===t)return;dt.debug("setFocusedRow:",t,"(prev:",this._focusedRowIndex,")");const o=this._focusedRowIndex;this._focusedRowIndex=t,(r=this._onInteractionChange)==null||r.call(this,"focusedRow",{prev:o,current:t});const i=this.displayItems[t];i&&this._onrowfocus&&this._onrowfocus({rowIndex:t,row:i,previousRowIndex:o})}getRowId(t){if(this._idValueCallback)return this._idValueCallback(t);if(this._idValueMember)return t[String(this._idValueMember)]}findRowById(t){const o=this._items.findIndex(i=>this.getRowId(i)===t);return o===-1?null:{row:this._items[o],index:o}}getRowLockInfo(t){let o,i,r=-1;if(typeof t=="object"&&t!==null)o=t,i=this.getRowId(o),r=this._items.indexOf(o),r===-1&&(r=this.displayItems.indexOf(o));else{i=t;const n=this.findRowById(i);n&&(o=n.row,r=n.index)}if(i!==void 0&&this._externalLocks.has(i))return this._externalLocks.get(i);if(!o)return null;const s=this._rowLocking;if(!s)return null;if(s.getLockInfoCallback){const n=s.getLockInfoCallback(o,r);if(n!=null&&n.isLocked)return n}if(s.isLockedCallback&&s.isLockedCallback(o,r))return{isLocked:!0};if(s.lockInfoMember){const n=o[String(s.lockInfoMember)];if(n!=null&&n.isLocked)return n}return s.lockedMember&&o[String(s.lockedMember)]?{isLocked:!0}:null}isRowLocked(t){const o=this.getRowLockInfo(t);return(o==null?void 0:o.isLocked)===!0}lockRowById(t,o){var s;const i={isLocked:!0,lockedBy:o==null?void 0:o.lockedBy,lockedAt:(o==null?void 0:o.lockedAt)??new Date,reason:o==null?void 0:o.reason,...o};this._externalLocks.set(t,i);const r=this.findRowById(t);return r&&this._editingCell&&this._editingCell.rowIndex===r.index&&this.cancelEdit(),this.requestUpdate(),(s=this._onrowlockchange)==null||s.call(this,{rowId:t,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:i,source:"external"}),!0}unlockRowById(t){var i;const o=this._externalLocks.has(t);if(this._externalLocks.delete(t),o){this.requestUpdate();const r=this.findRowById(t);(i=this._onrowlockchange)==null||i.call(this,{rowId:t,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:null,source:"external"})}return o}getExternalLocks(){return new Map(this._externalLocks)}clearExternalLocks(){this._externalLocks.clear(),this.requestUpdate()}updateRowById(t,o){const i=this.findRowById(t);if(!i)return!1;Object.assign(this._items[i.index],o);const r=this._draftRows.get(i.index);return r&&Object.assign(r,o),this.requestUpdate(),!0}replaceRowById(t,o){const i=this.findRowById(t);return i?(this._items[i.index]=o,this._draftRows.delete(i.index),this.requestUpdate(),!0):!1}canEditCell(t,o){var a;const i=this._columns.find(d=>String(d.field)===o);if(!i||!this.isCellEditable(i))return!1;const r=this.displayItems[t];if(!r)return!1;const s=this.getRowLockInfo(r);if(!(s!=null&&s.isLocked))return!0;const n=this._rowLocking;switch((n==null?void 0:n.lockedEditBehavior)??"block"){case"allow":return!0;case"callback":return((a=n==null?void 0:n.canEditLockedCallback)==null?void 0:a.call(n,r,s))??!1;case"block":default:return!1}}getColumnWidth(t){return this._columnWidths.get(t)}setColumnWidth(t,o,i=!1){this._columnWidths.set(t,o),i||this.requestUpdate()}setColumnWidths(t){for(const{field:o,width:i}of t)o&&i&&this._columnWidths.set(o,i);this.requestUpdate()}getColumnWidthsState(){return this._columns.map(t=>{const o=String(t.field),i=this._columnWidths.get(o)||t.width||"";return{field:o,width:i}}).filter(t=>t.width)}loadPersistedWidths(){this.loadPersistedState()}savePersistedWidths(){this.savePersistedState()}loadPersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const t=`wg-${this._gridName}-state`,o=localStorage.getItem(t);if(!o)return;const i=JSON.parse(o),r=new Set(this._columns.map(n=>String(n.field)));let s=!1;if(i.columnWidths){this._columnWidths.clear();for(const n of i.columnWidths)r.has(n.field)?this._columnWidths.set(n.field,n.width):s=!0}if(i.columnOrder){this._columnOrder.clear();for(const n of i.columnOrder)r.has(n.field)?this._columnOrder.set(n.field,n.order):s=!0}s&&this.savePersistedState()}catch(t){console.warn("WebGrid: Failed to load persisted state",t)}}savePersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const t=`wg-${this._gridName}-state`,o={};this._shouldPersistColumnWidths&&(o.columnWidths=this.getColumnWidthsState()),this._shouldPersistColumnOrder&&(o.columnOrder=this.getColumnOrderState()),localStorage.setItem(t,JSON.stringify(o))}catch(t){console.warn("WebGrid: Failed to save persisted state",t)}}getColumnOrder(t){return this._columnOrder.get(t)}setColumnOrder(t){this._columnOrder.clear();for(const{field:o,order:i}of t)o!==void 0&&i!==void 0&&this._columnOrder.set(o,i);this.requestUpdate()}getColumnOrderState(){const t=this.visualColumns,o=this.totalFrozenColumns;return t.slice(o).map((i,r)=>({field:String(i.column.field),order:r}))}moveColumn(t,o){const i=this.visualColumns,r=this.totalFrozenColumns,s=i.slice(r),n=s.findIndex(d=>String(d.column.field)===t);if(n===-1||n===o)return;this._columnOrder.clear();const l=[...s],[a]=l.splice(n,1);l.splice(o,0,a),l.forEach((d,c)=>{this._columnOrder.set(String(d.column.field),c)}),this.requestUpdate()}}const Wn=':host{--wg-rem: 10px;font-family:var(--wg-font-family);display:block;position:relative;--wg-accent-color: var(--base-accent-color, #0078d4);--wg-accent-color-hover: var(--base-accent-color-hover, #106ebe);--wg-accent-color-active: var(--base-accent-color-active, #005a9e);--wg-accent-color-light: var(--base-accent-color-light, color-mix(in srgb, var(--wg-accent-color) 15%, transparent));--wg-text-color-1: var(--base-text-color-1, #242424);--wg-text-color-2: var(--base-text-color-2, #424242);--wg-text-color-3: var(--base-text-color-3, #707070);--wg-text-on-accent: var(--base-text-color-on-accent, #ffffff);--wg-surface-1: var(--base-main-bg, #ffffff);--wg-surface-2: var(--base-elevated-bg, #f5f5f5);--wg-surface-3: var(--base-hover-bg, #ebebeb);--wg-surface-floating: var(--base-dropdown-bg, var(--base-main-bg, #ffffff));--wg-border-color: var(--base-border-color, #e0e0e0);--wg-border-color-hover: var(--base-border-color, #d1d1d1);--wg-input-bg: var(--base-input-bg, #ffffff);--wg-input-color: var(--base-input-color, var(--wg-text-color-1));--wg-input-border: var(--base-input-border, 1px solid #d1d1d1);--wg-input-border-hover: var(--base-input-border-hover, 1px solid #0078d4);--wg-input-border-focus: var(--base-input-border-focus, 1px solid #0078d4);--wg-input-placeholder-color: var(--base-input-placeholder-color, #707070);--wg-danger-color: var(--base-danger-color, #d13438);--wg-danger-bg-light: var(--base-danger-bg-light, #fde7e9);--wg-hover-bg: var(--base-hover-bg, #f0f0f0);--wg-active-bg: var(--base-hover-bg, #e0e0e0);--wg-font-size-base: calc(var(--base-font-size-sm, 1.4) * var(--wg-rem));--wg-font-size-sm: calc(var(--base-font-size-xs, 1.2) * var(--wg-rem));--wg-font-size-xs: calc(var(--base-font-size-2xs, 1.1) * var(--wg-rem));--wg-font-size-lg: calc(var(--base-font-size-base, 1.6) * var(--wg-rem));--wg-font-family: var(--base-font-family, inherit);--wg-line-height-base: var(--base-line-height-normal, 1.5);--wg-font-weight-normal: var(--base-font-weight-normal, 400);--wg-font-weight-semibold: var(--base-font-weight-semibold, 600);--wg-font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--wg-border-radius-sm: calc(var(--base-border-radius-sm, .4) * var(--wg-rem));--wg-border-radius-md: calc(var(--base-border-radius-md, .6) * var(--wg-rem));--wg-border-radius-lg: calc(var(--base-border-radius-lg, .8) * var(--wg-rem));--wg-spacing-xs: calc(.4 * var(--wg-rem));--wg-spacing-sm: calc(.8 * var(--wg-rem));--wg-spacing-md: calc(1.2 * var(--wg-rem));--wg-spacing-lg: calc(1.6 * var(--wg-rem));--wg-spacing-xl: calc(2.4 * var(--wg-rem));--wg-table-bg: var(--wg-surface-1);--wg-table-border: 1px solid var(--wg-border-color);--wg-row-number-width: calc(4 * var(--wg-rem));--wg-actions-column-width: calc(3.2 * var(--wg-rem));--wg-header-bg: var(--wg-surface-2);--wg-header-bg-hover: var(--wg-surface-3);--wg-header-bg-sorted: var(--wg-surface-3);--wg-header-color: var(--wg-text-color-1);--wg-header-border: 2px solid var(--wg-border-color);--wg-header-separator: 1px solid var(--wg-border-color);--wg-header-padding: var(--wg-spacing-sm);--wg-header-font-weight: var(--wg-font-weight-semibold);--wg-header-min-height: auto;--wg-cell-padding: var(--wg-spacing-sm);--wg-cell-padding-block: var(--wg-spacing-sm);--wg-cell-padding-inline: var(--wg-spacing-sm);--wg-row-min-height: auto;--wg-cell-color: var(--wg-text-color-1);--wg-cell-border: 1px solid var(--wg-border-color);--wg-cell-splitter-color: var(--wg-border-color);--wg-cell-splitter-width: 1px;--wg-cell-bg-hover: var(--wg-hover-bg);--wg-cell-bg-editing: var(--wg-surface-1);--wg-cell-readonly-bg: var(--base-disabled-bg, var(--wg-surface-2));--wg-row-border: 1px solid var(--wg-border-color);--wg-row-bg-even: var(--wg-surface-2);--wg-row-bg-hover: var(--wg-surface-3);--wg-filter-bg: var(--wg-surface-1);--wg-filter-border: 1px solid var(--wg-border-color);--wg-filter-padding: var(--wg-spacing-xs) var(--wg-spacing-sm);--wg-filter-input-padding: calc(.4 * var(--wg-rem)) calc(.8 * var(--wg-rem));--wg-filter-input-bg: var(--wg-input-bg);--wg-filter-input-border: var(--wg-input-border);--wg-filter-input-border-focus: var(--wg-input-border-focus);--wg-filter-input-border-radius: var(--wg-border-radius-sm);--wg-filter-input-font-size: var(--wg-font-size-sm);--wg-sort-indicator-size: calc(1.4 * var(--wg-rem));--wg-sort-indicator-opacity: .9;--wg-sort-placeholder-opacity: .3;--wg-sort-priority-size: calc(1.1 * var(--wg-rem));--wg-pagination-padding: var(--wg-spacing-md);--wg-pagination-gap: calc(1.6 * var(--wg-rem));--wg-pagination-bg: var(--wg-surface-1);--wg-pagination-border: 1px solid var(--wg-border-color);--wg-pagination-btn-padding: calc(.6 * var(--wg-rem)) calc(1.6 * var(--wg-rem));--wg-pagination-btn-bg: var(--wg-surface-1);--wg-pagination-btn-bg-hover: var(--wg-surface-2);--wg-pagination-btn-bg-active: var(--wg-surface-3);--wg-pagination-btn-border: 1px solid var(--wg-border-color);--wg-pagination-btn-border-hover: 1px solid var(--wg-border-color-hover);--wg-pagination-btn-border-radius: var(--wg-border-radius-sm);--wg-pagination-btn-disabled-opacity: .4;--wg-empty-padding: var(--wg-spacing-xl);--wg-empty-color: var(--wg-text-color-3);--wg-error-cell-bg: var(--wg-danger-bg-light);--wg-error-cell-border: 1px solid var(--wg-danger-color);--wg-error-message-color: var(--wg-danger-color);--wg-error-message-font-size: var(--wg-font-size-xs);--wg-error-indicator-color: var(--wg-danger-color);--wg-dirty-indicator-color: #ed8b00;--wg-dirty-indicator-size: 6px;--wg-dirty-cell-bg: rgba(237, 139, 0, .08);--wg-dirty-row-number-border-color: #ed8b00;--wg-editor-bg: var(--wg-surface-1);--wg-editor-outline: 2px solid var(--wg-accent-color);--wg-editor-outline-offset: -2px;--wg-editor-validating-opacity: .7;--wg-dropdown-toggle-right: var(--wg-spacing-sm);--wg-dropdown-toggle-size: calc(1.2 * var(--wg-rem));--wg-dropdown-toggle-hitbox: calc(2.4 * var(--wg-rem));--wg-date-trigger-size: calc(2.8 * var(--wg-rem));--wg-editor-hitbox-height: calc(4.8 * var(--wg-rem));--wg-checkbox-scale: 1.2;--wg-toolbar-bg: var(--wg-surface-floating);--wg-toolbar-border: 1px solid var(--wg-border-color);--wg-toolbar-border-radius: var(--wg-border-radius-sm);--wg-toolbar-shadow: var(--base-dropdown-box-shadow, 0 2px 8px rgba(0, 0, 0, .15));--wg-toolbar-divider-color: var(--wg-border-color);--wg-toolbar-divider-height: calc(1.6 * var(--wg-rem));--wg-toolbar-row-height: calc(3.7 * var(--wg-rem));--wg-toolbar-icon-size: calc(1.6 * var(--wg-rem));--wg-toolbar-btn-min-width: calc(2.4 * var(--wg-rem));--wg-toolbar-btn-padding: 0 calc(.4 * var(--wg-rem));--wg-toolbar-btn-border-radius: var(--wg-border-radius-sm);--wg-toolbar-btn-bg-hover: var(--wg-hover-bg);--wg-toolbar-btn-bg-active: var(--wg-active-bg);--wg-toolbar-btn-color: var(--wg-text-color-1);--wg-toolbar-trigger-color: var(--wg-text-color-3);--wg-toolbar-trigger-color-hover: var(--wg-text-color-1);--wg-toolbar-trigger-bg-hover: var(--wg-hover-bg);--wg-overlay-bg: rgba(0, 0, 0, .4);--wg-dialog-shadow: 0 4px 20px rgba(0, 0, 0, .15);--wg-tooltip-bg: var(--base-tooltip-bg, #333);--wg-tooltip-color: var(--base-tooltip-color, #fff);--wg-tooltip-max-width: 300px;--wg-tooltip-arrow-size: 8px;--wg-context-menu-z-index: var(--wg-z-context-menu);--wg-context-menu-min-width: calc(16 * var(--wg-rem));--wg-focus-outline: 2px solid var(--wg-accent-color);--wg-focus-outline-offset: -2px;--wg-focus-border-width: 2px;--wg-focus-border-color: var(--wg-accent-color);--wg-focus-bg: var(--wg-hover-bg);--wg-transition-fast: .1s ease;--wg-transition-normal: .15s ease;--wg-z-cell-highlight: 1;--wg-z-selection-border: 1;--wg-z-frozen: 2;--wg-z-header: 3;--wg-z-frozen-header: 4;--wg-z-fill-handle: 5;--wg-z-fill-handle-area: 4;--wg-z-resize-handle: 6;--wg-z-shortcuts-help: 10;--wg-z-reorder-indicator: 100;--wg-z-toolbar: 1000;--wg-z-context-menu: 1001;--wg-z-dropdown: 9999;--wg-z-reorder-ghost: 10000;--wg-z-tooltip: 10000;--wg-row-locked-bg: var(--base-disabled-bg, var(--wg-surface-2));--wg-row-locked-opacity: .7;--wg-frozen-column-bg: var(--wg-surface-1);--wg-frozen-header-bg: color-mix(in srgb, var(--wg-accent-color) 8%, var(--wg-header-bg));--wg-frozen-column-shadow: 2px 0 4px rgba(0, 0, 0, .1);--wg-frozen-column-shadow-active: 6px 0 12px rgba(0, 0, 0, .25);--wg-frozen-column-border: 2px solid var(--wg-border-color);--wg-frozen-column-shadow-gradient: linear-gradient(to right, rgba(0, 0, 0, .15), transparent);--wg-frozen-column-shadow-width: 8px;--wg-resize-handle-width: 12px;--wg-resize-handle-offset: -6px;--wg-resize-handle-line-width: 2px;--wg-resize-handle-color: var(--wg-border-color);--wg-resize-handle-active-color: var(--wg-accent-color);--wg-fill-handle-size: 8px;--wg-fill-handle-bg: var(--wg-surface-1);--wg-fill-handle-border-color: var(--wg-accent-color);--wg-fill-handle-border-width: 2px;--wg-fill-range-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-fill-range-border-color: var(--wg-accent-color);--wg-selection-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-selection-row-number-bg: var(--wg-accent-color);--wg-selection-row-number-color: var(--base-text-inverted, #fff);--wg-selection-border-width: 2px;--wg-selection-border-color: var(--wg-accent-color);--wg-row-focus-bg: color-mix(in srgb, var(--wg-accent-color) 10%, transparent);--wg-row-focus-row-number-bg: color-mix(in srgb, var(--wg-accent-color) 30%, transparent);--wg-cell-selection-bg: color-mix(in srgb, var(--wg-accent-color) 10%, transparent);--wg-cell-selection-border: var(--wg-accent-color);--wg-cell-selection-border-width: 2px;--wg-dropdown-max-height: 200px;--wg-dropdown-option-gap: var(--wg-spacing-sm);--wg-dropdown-option-padding: calc(.6 * var(--wg-rem)) var(--wg-spacing-sm) calc(.6 * var(--wg-rem)) calc(var(--wg-spacing-sm) - 1px);--wg-dropdown-empty-padding: calc(.8 * var(--wg-rem)) var(--wg-spacing-sm) calc(.8 * var(--wg-rem)) calc(var(--wg-spacing-sm) - 1px);--wg-inline-actions-padding: var(--wg-spacing-xs) var(--wg-spacing-sm);--wg-inline-actions-gap: calc(.2 * var(--wg-rem));--wg-toolbar-row-gap: calc(.2 * var(--wg-rem));--wg-toolbar-row-padding: 0 calc(.4 * var(--wg-rem));--wg-toolbar-label-font-size: var(--wg-font-size-sm);--wg-toolbar-btn-gap: calc(.4 * var(--wg-rem));--wg-tooltip-padding: calc(.6 * var(--wg-rem)) calc(1 * var(--wg-rem));--wg-tooltip-shadow: 0 2px 8px rgba(0, 0, 0, .2)}web-grid:not(:defined){display:block;min-height:calc(10 * var(--wg-rem));color:transparent!important;background:transparent}.wg{position:relative;width:100%;max-height:inherit;overflow:auto;overscroll-behavior:contain;border:var(--wg-table-border)}.wg--scrollable{max-height:var(--wg-scroll-max-height, 100vh)}.wg--table-border-only{border:none;overflow:visible;display:flex;flex-direction:column}.wg--table-border-only .wg__table-container{border:var(--wg-table-border);overflow:auto;max-height:inherit;flex:1;min-height:0}.wg--table-border-only .wg__table-container .wg__header{position:sticky;top:0;z-index:var(--wg-z-header)}.wg__table{width:100%;min-width:max-content;border-collapse:collapse;table-layout:fixed;background:var(--wg-table-bg);font-size:var(--wg-font-size-base);line-height:var(--wg-line-height-base)}.wg__filler{width:auto;min-width:0;padding:0!important;border:none!important;box-shadow:none!important}th.wg__filler{position:sticky;top:0;z-index:var(--wg-z-header);background:var(--wg-header-bg);box-shadow:inset 0 -2px 0 var(--wg-border-color)!important}td.wg__filler{background:transparent}.wg__table tbody tr{border-bottom:var(--wg-row-border)}.wg__row-number-header,.wg__row-number{width:var(--wg-row-number-width);min-width:var(--wg-row-number-width);max-width:var(--wg-row-number-width);box-sizing:border-box;text-align:center;color:var(--wg-text-color-2);background:var(--wg-header-bg);-webkit-user-select:none;user-select:none;font-size:var(--wg-font-size-sm)}.wg__row-number-header{cursor:pointer}.wg__row-number-header:hover{background:var(--wg-hover-bg)}.wg__row-number{box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__actions-column{width:var(--wg-actions-column-width);min-width:var(--wg-actions-column-width);max-width:var(--wg-actions-column-width);padding:0!important;text-align:center}thead .wg__actions-column{background:var(--wg-header-bg);box-shadow:inset 0 -2px 0 var(--wg-border-color)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__header{position:sticky;top:0;z-index:var(--wg-z-header);background:var(--wg-header-bg);color:var(--wg-header-color);font-weight:var(--wg-header-font-weight);padding:var(--wg-header-padding);height:var(--wg-header-min-height);box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color),inset 0 -2px 0 var(--wg-border-color);box-sizing:border-box;-webkit-user-select:none;user-select:none;overflow:hidden}.wg__header:last-child{box-shadow:inset 0 -2px 0 var(--wg-border-color)}.wg__header--sortable{cursor:pointer}.wg__header--sortable:hover{background:var(--wg-header-bg-hover)}.wg__header--sorted{background:var(--wg-header-bg-sorted)}.wg__header--selected,.wg__header--selected:hover{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__header-container{display:flex;align-items:stretch;gap:var(--wg-spacing-xs);height:100%}.wg__header-content{flex:1;min-width:0;display:flex;align-items:center;justify-content:flex-start}.wg__header-content--align-left{justify-content:flex-start}.wg__header-content--align-center{justify-content:center}.wg__header-content--align-right{justify-content:flex-end}.wg__header-content--align-justify{justify-content:flex-start}.wg__header-content--valign-top{align-items:flex-start}.wg__header-content--valign-middle{align-items:center}.wg__header-content--valign-bottom{align-items:flex-end}.wg__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__header-controls{flex-shrink:0;display:flex;align-items:center}.wg__sort-indicator{font-size:var(--wg-sort-indicator-size);opacity:var(--wg-sort-indicator-opacity);min-width:16px;text-align:center}.wg__sort-placeholder{opacity:var(--wg-sort-placeholder-opacity)}.wg__sort-priority{font-size:var(--wg-sort-priority-size);font-weight:var(--wg-font-weight-semibold);margin-left:2px;vertical-align:super;line-height:1}.wg__header-info{display:inline-flex;align-items:center;color:var(--wg-accent-color);cursor:help;opacity:.7;margin-left:var(--wg-spacing-xs);vertical-align:middle}.wg__header-info:hover{opacity:1}.wg__filter-row th{padding:var(--wg-filter-padding);background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__filter-input{width:100%;padding:var(--wg-filter-input-padding);border:var(--wg-filter-input-border);border-radius:var(--wg-filter-input-border-radius);background:var(--wg-surface-1);color:var(--wg-text-color-1);font-family:inherit;font-size:var(--wg-filter-input-font-size);box-sizing:border-box}.wg__filter-input:focus{outline:none;border:var(--wg-filter-input-border-focus);box-shadow:0 0 0 1px var(--wg-accent-color)}.wg__resize-handle{position:absolute;top:0;right:var(--wg-resize-handle-offset);bottom:0;width:var(--wg-resize-handle-width);cursor:col-resize;z-index:var(--wg-z-resize-handle);opacity:0;transition:opacity .1s ease}.wg__header:hover .wg__resize-handle{opacity:1}.wg__resize-handle:after{content:"";position:absolute;top:25%;bottom:25%;left:50%;width:var(--wg-resize-handle-line-width);background:var(--wg-resize-handle-color);transform:translate(-50%);border-radius:1px}.wg__resize-handle:hover:after{background:var(--wg-resize-handle-active-color);top:15%;bottom:15%}.wg__resize-handle--active:after{background:var(--wg-resize-handle-active-color);top:0;bottom:0}.wg__resize-handle--disabled{cursor:not-allowed}.wg__resize-handle--disabled:after{display:none}.wg--resizing .wg__resize-handle{opacity:1}.wg--resizing{-webkit-user-select:none;user-select:none;cursor:col-resize}.wg--resizing .wg__cell,.wg--resizing .wg__header{cursor:col-resize}.wg--resizing .wg__table{min-width:0!important}.wg__header--dragging{opacity:1;background:var(--wg-header-bg)!important;outline:2px dashed var(--wg-accent-color);outline-offset:-2px}.wg__reorder-ghost{position:fixed;z-index:var(--wg-z-reorder-ghost);background:var(--wg-header-bg);border:2px solid var(--wg-accent-color);border-radius:var(--wg-border-radius-sm);padding:.4em .8em;font-size:var(--wg-font-size-sm);font-weight:var(--wg-header-font-weight);color:var(--wg-header-color);box-shadow:var(--wg-dialog-shadow);opacity:.95;pointer-events:none;white-space:nowrap}.wg__drop-indicator{position:absolute;width:3px;background:var(--wg-accent-color);z-index:var(--wg-z-reorder-indicator);pointer-events:none;display:none}.wg__drop-indicator:before{content:"";position:absolute;top:0;left:50%;transform:translate(-50%);border-left:6px solid transparent;border-right:6px solid transparent;border-top:8px solid var(--wg-accent-color)}.wg--reordering{cursor:grabbing;-webkit-user-select:none;user-select:none}.wg--reordering .wg__cell,.wg--reordering .wg__header{cursor:grabbing}.wg--reorderable .wg__header:not(.wg__header--frozen):hover{cursor:grab}.wg__header--frozen{cursor:default}.wg__fill-handle{position:absolute;width:var(--wg-fill-handle-size);height:var(--wg-fill-handle-size);background:var(--wg-fill-handle-bg);border:var(--wg-fill-handle-border-width) solid var(--wg-fill-handle-border-color);cursor:crosshair;z-index:var(--wg-z-fill-handle);pointer-events:auto;box-sizing:border-box}.wg__fill-handle:hover{transform:scale(1.2)}.wg__fill-range{position:absolute;background:var(--wg-fill-range-bg);border:1px dashed var(--wg-fill-range-border-color);pointer-events:none;z-index:var(--wg-z-fill-handle-area);box-sizing:border-box}.wg--filling{cursor:crosshair;-webkit-user-select:none;user-select:none}.wg--filling .wg__cell,.wg--filling .wg__header{cursor:crosshair}.wg__cell--editing .wg__fill-handle{display:none}.wg__row--selected>.wg__cell{background:var(--wg-selection-bg)}.wg__row--selected>.wg__cell.wg__row-number,.wg--editable.wg--navigate-mode .wg__row--selected>.wg__cell.wg__row-number{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__row-number[data-row-number]{cursor:pointer;-webkit-user-select:none;user-select:none}.wg__row-number[data-row-number]:hover{background:var(--wg-hover-bg)}.wg__row--selected>.wg__cell.wg__row-number:hover,.wg--editable.wg--navigate-mode .wg__row--selected>.wg__cell.wg__row-number:hover{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__cell--column-selected{background:var(--wg-selection-bg)}.wg--selecting{cursor:default;-webkit-user-select:none;user-select:none}.wg--selecting *{-webkit-user-select:none;user-select:none}.wg:focus{outline:none}.wg__cell--in-range{background:var(--wg-cell-selection-bg)!important;position:relative;z-index:var(--wg-z-cell-highlight)}.wg__cell--editing.wg__cell--in-range{background:var(--wg-input-bg)!important}.wg__cell--editable.wg__cell--in-range:hover{background:var(--wg-cell-selection-bg)!important}.wg__cell--editable.wg__cell--in-range:hover:after{display:none}.wg__cell-range-border{position:absolute;border:var(--wg-cell-selection-border-width) solid var(--wg-cell-selection-border);pointer-events:none;z-index:var(--wg-z-selection-border);box-sizing:border-box;border-radius:1px}.wg--selecting-cells,.wg--selecting-cells *{cursor:crosshair!important;-webkit-user-select:none;user-select:none}.wg--selecting-cells .wg__cell{cursor:crosshair!important}.wg:has(.wg__cell-range-border) .wg__fill-handle{display:none}.wg__row-selection-border,.wg__column-selection-border{position:absolute;border:var(--wg-selection-border-width) solid var(--wg-selection-border-color);pointer-events:none;z-index:var(--wg-z-selection-border);box-sizing:border-box;border-radius:1px}.wg--selecting-columns,.wg--selecting-columns *{cursor:col-resize!important;-webkit-user-select:none;user-select:none}.wg--selecting-columns .wg__header{cursor:col-resize!important}.wg__header--frozen{background:var(--wg-frozen-header-bg, var(--wg-header-bg));z-index:var(--wg-z-frozen-header)!important}.wg__header--frozen.wg__header--selected,.wg__header--frozen.wg__header--selected:hover{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__row-number-header.wg__header--frozen{z-index:var(--wg-z-frozen-header)!important}.wg__cell--frozen{background:var(--wg-frozen-column-bg, var(--wg-surface-1))}.wg__cell--frozen-last{box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__row-number.wg__cell--frozen{background:var(--wg-header-bg);z-index:var(--wg-z-frozen)!important}.wg--striped tbody tr:nth-child(2n) .wg__cell--frozen{background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover .wg__cell--frozen{background:var(--wg-row-bg-hover)}.wg__row--focused>.wg__cell--frozen{background:color-mix(in srgb,var(--wg-accent-color) 10%,var(--wg-frozen-column-bg, var(--wg-surface-1)))!important}.wg__row--selected>.wg__cell--frozen{background:color-mix(in srgb,var(--wg-accent-color) 15%,var(--wg-frozen-column-bg, var(--wg-surface-1)))!important}.wg__row--selected>.wg__row-number.wg__cell--frozen{background:var(--wg-selection-row-number-bg)!important;color:var(--wg-selection-row-number-color)}.wg__cell--frozen.wg__cell--column-selected{background:color-mix(in srgb,var(--wg-accent-color) 15%,var(--wg-frozen-column-bg, var(--wg-surface-1)))!important}.wg__cell--frozen.wg__cell--in-range{background:color-mix(in srgb,var(--wg-accent-color) 10%,var(--wg-frozen-column-bg, var(--wg-surface-1)))!important}.wg__header.wg__header--frozen-last,.wg__cell.wg__cell--frozen-last{overflow:visible}.wg--scrolled-horizontal .wg__header--frozen-last:after,.wg--scrolled-horizontal .wg__cell--frozen-last:after{content:"";position:absolute;top:0;right:calc(-1 * var(--wg-frozen-column-shadow-width));bottom:0;width:var(--wg-frozen-column-shadow-width);background:var(--wg-frozen-column-shadow-gradient);pointer-events:none}.wg__cell{padding:var(--wg-cell-padding);color:var(--wg-cell-color);height:var(--wg-row-min-height);box-sizing:border-box;position:relative;scroll-margin-top:calc(3 * var(--wg-rem));scroll-margin-bottom:calc(.5 * var(--wg-rem));-webkit-user-select:none;user-select:none;overflow:hidden;box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__cell-text{-webkit-user-select:none;user-select:none;pointer-events:none}.wg__cell--ellipsis .wg__cell-text{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__cell--line-clamp .wg__cell-text{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden}.wg__cell--editable{cursor:pointer}.wg__cell--editable:hover{background:var(--wg-cell-bg-hover)}.wg__cell--editable:hover:after{content:"";position:absolute;top:2px;right:2px;bottom:2px;left:2px;border:1px dashed var(--wg-border-color);border-radius:2px;pointer-events:none}.wg__cell--editing{position:relative;background:var(--wg-surface-1);outline:2px solid var(--wg-accent-color);outline-offset:-2px;z-index:var(--wg-z-cell-highlight)}.wg__cell--editing:after{display:none}.wg__cell--invalid{background:var(--wg-danger-bg-light);box-shadow:inset 0 0 0 2px var(--wg-danger-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg--editable.wg--navigate-mode .wg__cell:not(.wg__cell--editable){background:var(--wg-cell-readonly-bg)}.wg__row--locked{background:var(--wg-row-locked-bg)!important}.wg__row--locked .wg__cell{opacity:var(--wg-row-locked-opacity)}.wg__row--locked .wg__cell--editable{cursor:not-allowed}.wg__row--locked .wg__cell--editable:hover{background:inherit}.wg__row--locked .wg__cell--editable:hover:after{display:none}.wg__row-number--locked{opacity:1!important;cursor:help}.wg__cell--dirty{background:var(--wg-dirty-cell-bg)!important}.wg__cell--dirty:before{content:"";position:absolute;top:0;left:0;width:0;height:0;border-style:solid;border-width:var(--wg-dirty-indicator-size) var(--wg-dirty-indicator-size) 0 0;border-color:var(--wg-dirty-indicator-color) transparent transparent transparent;pointer-events:none}.wg__cell--dirty.wg__cell--editing:before{display:none}.wg__row-number--dirty{box-shadow:inset 3px 0 0 var(--wg-dirty-row-number-border-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__editor{position:absolute;top:0;left:0;right:0;width:100%;padding:var(--wg-cell-padding);border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:inherit;box-sizing:border-box}.wg__editor:focus,.wg__editor:focus-visible{outline:none;box-shadow:none}.wg__editor--text{text-align:inherit}.wg__editor--number{text-align:right}.wg__editor--valign-top{top:0;bottom:auto}.wg__editor--valign-middle{top:0;bottom:0}.wg__editor--valign-bottom{top:auto;bottom:0}.wg__editor--date{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:transparent;padding:var(--wg-cell-padding)}.wg__date-input{flex:1;min-width:0;height:100%;border:none;background:transparent;font:inherit;padding:0;outline:none;color:inherit}.wg__date-trigger{width:var(--wg-date-trigger-size);height:100%;display:flex;align-items:center;justify-content:center;border:none;background:transparent;color:var(--wg-text-color-3);cursor:pointer;padding:0;flex-shrink:0}.wg__date-trigger:hover{color:var(--wg-accent-color);background:var(--wg-hover-bg)}.wg__editor--checkbox{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(var(--wg-checkbox-scale));width:auto;height:auto;margin:0;padding:0;cursor:pointer}.wg__checkbox-display{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(var(--wg-checkbox-scale));width:auto;height:auto;margin:0;padding:0;cursor:pointer;pointer-events:none}.wg__checkbox-display--readonly{cursor:default;opacity:.5}.wg__editor--custom{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg);padding:var(--wg-cell-padding-block) var(--wg-cell-padding-inline);cursor:pointer}.wg__editor--custom:focus{outline:none}.wg__custom-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;cursor:pointer}.wg__editor--combobox,.wg__editor--autocomplete{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;padding:var(--wg-cell-padding);padding-right:0;background:transparent;box-sizing:border-box}.wg__combobox-input,.wg__autocomplete-input{flex:1;width:100%;height:100%;padding:0;padding-right:var(--wg-dropdown-toggle-hitbox);border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base);outline:none;box-sizing:border-box;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.wg__combobox-input:focus,.wg__autocomplete-input:focus{outline:none}.wg__combobox-toggle{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:var(--wg-dropdown-toggle-size);color:var(--wg-text-color-2);pointer-events:auto;cursor:pointer}.wg__combobox-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__loading-indicator{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:var(--wg-font-size-sm);animation:wg-pulse 1s infinite}@keyframes wg-pulse{0%,to{opacity:1}50%{opacity:.4}}.wg__select-trigger{display:flex;align-items:center;justify-content:space-between;cursor:pointer;background:transparent}.wg__select-trigger:focus,.wg__select-trigger:focus-visible{outline:none;box-shadow:none}.wg__select-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__select-toggle{position:relative;font-size:var(--wg-dropdown-toggle-size);opacity:.6;margin-left:var(--wg-spacing-xs);flex-shrink:0;pointer-events:auto;cursor:pointer}.wg__select-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__cell-dropdown-display{display:flex;align-items:center;justify-content:space-between;width:100%;pointer-events:none}.wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:0}.wg__cell:hover .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle,.wg__cell--focused .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:.6}.wg__cell-date-display{display:flex;align-items:center;justify-content:space-between;width:100%;pointer-events:none}.wg__cell-date-display .wg__date-trigger{position:relative;background:none;border:none;padding:0;margin:0;cursor:pointer;opacity:.6;display:flex;align-items:center;justify-content:center;color:inherit;pointer-events:auto}.wg__cell-date-display .wg__date-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:0}.wg__cell:hover .wg__cell-date-display--toggle-on-focus .wg__date-trigger,.wg__cell--focused .wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:.6}.wg__dropdown{background:var(--wg-surface-floating);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);box-shadow:var(--wg-toolbar-shadow);max-height:var(--wg-dropdown-max-height);overflow-y:auto;font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base)}.wg__dropdown-option{display:flex;align-items:center;gap:var(--wg-dropdown-option-gap);padding:var(--wg-dropdown-option-padding);cursor:pointer;color:var(--wg-text-color-1)}.wg__dropdown-option:hover,.wg__dropdown-option--highlighted{background:var(--wg-hover-bg);box-shadow:inset 0 0 0 2px var(--wg-accent-color)}.wg__dropdown-option--selected{background:var(--wg-accent-color-light)}.wg__dropdown-option--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.wg__dropdown-option-icon{flex-shrink:0;width:1.5em;text-align:center}.wg__dropdown-option-content{flex:1;min-width:0;overflow:hidden}.wg__dropdown-option-label{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-option-subtitle{display:block;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-empty{padding:var(--wg-dropdown-empty-padding);color:var(--wg-text-color-2);font-style:italic;text-align:center}.wg__dropdown-option--align-left{justify-content:flex-start}.wg__dropdown-option--align-left .wg__dropdown-option-content{text-align:left}.wg__dropdown-option--align-center{justify-content:center}.wg__dropdown-option--align-center .wg__dropdown-option-content{text-align:center}.wg__dropdown-option--align-right{justify-content:flex-end}.wg__dropdown-option--align-right .wg__dropdown-option-content{text-align:right}.wg__dropdown-option--align-justify{justify-content:flex-start}.wg__dropdown-option--align-justify .wg__dropdown-option-content{text-align:justify}.wg--navigate-mode .wg__cell{cursor:cell}.wg__cell:focus{outline:none;box-shadow:inset 0 0 0 var(--wg-focus-border-width) var(--wg-focus-border-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg--editable .wg__cell.wg__cell--focused,.wg__cell.wg__cell--always-edit-focused{box-shadow:inset 0 0 0 var(--wg-focus-border-width) var(--wg-focus-border-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__cell--focused:after,.wg__cell--always-edit-focused:after{display:none}.wg__row--focused>.wg__cell{background:var(--wg-row-focus-bg)}.wg__row--focused>.wg__cell.wg__row-number{background:var(--wg-row-focus-row-number-bg)}.wg--editable.wg--navigate-mode .wg__row--focused>.wg__cell{background:var(--wg-row-focus-bg)}.wg--editable.wg--navigate-mode .wg__row--focused>.wg__cell.wg__row-number{background:var(--wg-row-focus-row-number-bg)}.wg__pagination{display:flex;align-items:center;justify-content:center;gap:var(--wg-pagination-gap);padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__pagination-btn{padding:var(--wg-pagination-btn-padding);background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer;transition:all var(--wg-transition-fast)}.wg__pagination-btn:hover:not(:disabled){background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-btn:active:not(:disabled){background:var(--wg-pagination-btn-bg-active)}.wg__pagination-btn:disabled{opacity:var(--wg-pagination-btn-disabled-opacity);cursor:not-allowed}.wg__pagination-info{font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__pagination-count{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3);margin-left:var(--wg-spacing-xs)}.wg__pagination-pagesize{display:flex;align-items:center;gap:calc(.6 * var(--wg-rem))}.wg__pagination-select{padding:var(--wg-spacing-xs) var(--wg-spacing-sm);background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer}.wg__pagination-select:hover{background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-select:focus{outline:2px solid var(--wg-accent-color);outline-offset:-2px}.wg__pagination-label{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3)}.wg__pagination--left{justify-content:flex-start}.wg__pagination--right{justify-content:flex-end}.wg__pagination--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__summary{display:flex;align-items:center;padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg);font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__summary--left{justify-content:flex-start}.wg__summary--right{justify-content:flex-end}.wg__summary--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer{display:flex;align-items:center;justify-content:space-between;border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__footer--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer .wg__summary,.wg__footer .wg__pagination{border:none}.wg__footer .wg__summary{flex:0 0 auto}.wg__footer .wg__pagination{flex:0 0 auto;margin-left:auto}.wg__toolbar-container{position:fixed;z-index:var(--wg-z-toolbar)}.wg__toolbar{display:flex;flex-direction:column-reverse;gap:0;padding:0;background:var(--wg-toolbar-bg);border:var(--wg-toolbar-border);border-radius:var(--wg-toolbar-border-radius);box-shadow:var(--wg-toolbar-shadow)}.wg__toolbar-row{display:flex;gap:var(--wg-toolbar-row-gap);align-items:center;height:var(--wg-toolbar-row-height);padding:var(--wg-toolbar-row-padding)}.wg__toolbar-row+.wg__toolbar-row{border-top:1px solid var(--wg-toolbar-divider-color)}.wg__toolbar-divider{width:1px;height:var(--wg-toolbar-divider-height);background:var(--wg-toolbar-divider-color);margin:0 var(--wg-spacing-xs);flex-shrink:0}.wg__toolbar-btn{min-width:var(--wg-toolbar-btn-min-width);height:100%;border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:var(--wg-toolbar-btn-gap);font-family:inherit;font-size:var(--wg-font-size-base);font-weight:var(--wg-font-weight-normal);padding:var(--wg-toolbar-btn-padding);transition:background .1s ease}.wg__toolbar-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__toolbar-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__toolbar-btn:disabled{opacity:.5;cursor:not-allowed}.wg__toolbar-btn:disabled:hover{background:transparent}.wg__toolbar-btn svg{width:var(--wg-toolbar-icon-size);height:var(--wg-toolbar-icon-size);flex-shrink:0}.wg__toolbar-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__toolbar-label{font-size:var(--wg-toolbar-label-font-size);white-space:nowrap}.wg__actions-column{width:var(--wg-toolbar-btn-min-width);min-width:var(--wg-toolbar-btn-min-width);max-width:var(--wg-toolbar-btn-min-width);padding:0!important;text-align:center}.wg__header .wg__actions-column{background:var(--wg-header-bg)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg)}.wg__toolbar-trigger{position:relative;padding:0;background:transparent;border:none;border-radius:var(--wg-border-radius-sm);cursor:pointer;font-size:var(--wg-font-size-base);line-height:1;color:var(--wg-toolbar-trigger-color)}.wg__toolbar-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__toolbar-trigger:hover,.wg__toolbar-trigger--active{color:var(--wg-toolbar-trigger-color-hover);background:var(--wg-toolbar-trigger-bg-hover)}.wg__inline-actions-header,.wg__inline-actions-cell{white-space:nowrap;text-align:start;padding:var(--wg-inline-actions-padding);overflow:visible}.wg__inline-actions-header{background:var(--wg-header-bg)}.wg__inline-actions-wrap{display:flex;flex-direction:column;gap:var(--wg-inline-actions-gap);align-items:flex-start}.wg__inline-actions-row{display:flex;gap:var(--wg-inline-actions-gap);align-items:center;justify-content:flex-start}.wg__inline-action-btn{width:var(--wg-toolbar-btn-min-width);max-width:var(--wg-toolbar-btn-min-width);height:calc(2.4 * var(--wg-rem));border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;box-sizing:border-box;font-family:inherit;font-size:var(--wg-font-size-base);transition:background var(--wg-transition-fast)}.wg__inline-action-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__inline-action-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__inline-action-btn:disabled,.wg__inline-action-btn--disabled{opacity:.5;cursor:not-allowed}.wg__inline-action-btn:disabled:hover,.wg__inline-action-btn--disabled:hover{background:transparent}.wg__inline-action-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__inline-action-btn svg{width:var(--wg-toolbar-icon-size);height:var(--wg-toolbar-icon-size);flex-shrink:0}.wg__shortcuts-help{position:absolute;top:var(--wg-spacing-xs);right:var(--wg-spacing-sm);z-index:var(--wg-z-shortcuts-help)}.wg__shortcuts-help--left{right:auto;left:var(--wg-spacing-sm)}.wg__shortcuts-help-icon{display:flex;align-items:center;justify-content:center;width:var(--wg-spacing-xl);height:var(--wg-spacing-xl);padding:0;border:none;border-radius:50%;background:var(--wg-surface-1);color:var(--wg-text-color-2);cursor:pointer;opacity:.7}.wg__shortcuts-help-icon:hover{opacity:1;background:var(--wg-surface-2)}.wg__shortcuts-help-icon svg{width:var(--wg-toolbar-icon-size);height:var(--wg-toolbar-icon-size)}.wg__shortcuts-help-overlay{display:none;position:absolute;top:100%;right:0;margin-top:var(--wg-spacing-xs);padding:var(--wg-spacing-md);background:var(--wg-surface-1);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-md);box-shadow:var(--wg-dialog-shadow);min-width:200px;max-width:var(--wg-tooltip-max-width);z-index:100}.wg__shortcuts-help--left .wg__shortcuts-help-overlay{right:auto;left:0}.wg__shortcuts-help:hover .wg__shortcuts-help-overlay,.wg__shortcuts-help:focus-within .wg__shortcuts-help-overlay{display:block}.wg__shortcuts-help-title{font-weight:var(--wg-font-weight-semibold);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1);margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-xs);border-bottom:1px solid var(--wg-border-color)}.wg__shortcuts-help-custom{margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-sm);border-bottom:1px solid var(--wg-border-color);font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg__shortcuts-help-list{display:flex;flex-direction:column;gap:var(--wg-spacing-xs)}.wg__shortcuts-help-item{display:flex;align-items:center;gap:var(--wg-spacing-md)}.wg__shortcuts-help-key{display:inline-flex;align-items:center;justify-content:center;min-width:28px;padding:2px calc(.6 * var(--wg-rem));font-family:var(--wg-font-family-mono);font-size:var(--wg-font-size-xs);font-weight:var(--wg-font-weight-semibold);color:var(--wg-text-color-1);background:var(--wg-surface-2);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm)}.wg__shortcuts-help-label{flex:1;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg--striped tbody tr:nth-child(2n){background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover{background:var(--wg-row-bg-hover)}.wg__empty{text-align:center;padding:var(--wg-empty-padding);color:var(--wg-empty-color);font-style:italic}.wg__loading-more{text-align:center;padding:var(--wg-cell-padding);color:var(--wg-text-color-2);font-size:var(--wg-font-size-sm)}.wg__tooltip{position:absolute;z-index:var(--wg-z-tooltip);max-width:var(--wg-tooltip-max-width);padding:var(--wg-tooltip-padding);background:var(--wg-tooltip-bg);color:var(--wg-tooltip-color);font-size:var(--wg-font-size-sm);line-height:1.4;border-radius:var(--wg-border-radius-sm);box-shadow:var(--wg-tooltip-shadow);pointer-events:none;opacity:0;transition:opacity var(--wg-transition-fast)}.wg__tooltip--visible{opacity:1}.wg__tooltip-arrow{position:absolute;width:var(--wg-tooltip-arrow-size);height:var(--wg-tooltip-arrow-size);background:var(--wg-tooltip-bg);transform:rotate(45deg)}.wg__tooltip[data-placement^=top] .wg__tooltip-arrow{bottom:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip[data-placement^=bottom] .wg__tooltip-arrow{top:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip[data-placement^=left] .wg__tooltip-arrow{right:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip[data-placement^=right] .wg__tooltip-arrow{left:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip-title{font-weight:600}.wg__tooltip-desc{opacity:.85;margin-top:2px}.wg__tooltip-shortcut{margin-top:4px;opacity:.7;font-size:.9em}.wg__goto-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:var(--wg-overlay-bg);display:flex;align-items:center;justify-content:center;z-index:1000}.wg__goto-dialog{background:var(--wg-surface-1);border-radius:var(--wg-border-radius-md);padding:var(--wg-spacing-lg);box-shadow:var(--wg-dialog-shadow);min-width:250px}.wg__goto-label{display:block;margin-bottom:var(--wg-spacing-sm);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1)}.wg__goto-input{width:100%;padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-base);margin-bottom:var(--wg-spacing-md);box-sizing:border-box}.wg__goto-input:focus{outline:none;border-color:var(--wg-accent-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--wg-accent-color) 20%,transparent)}.wg__goto-buttons{display:flex;gap:var(--wg-spacing-sm);justify-content:flex-end}.wg__goto-btn{padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-sm);cursor:pointer;background:var(--wg-surface-1);color:var(--wg-text-color-1)}.wg__goto-btn:hover{background:var(--wg-surface-2)}.wg__goto-btn--go{background:var(--wg-accent-color);border-color:var(--wg-accent-color);color:var(--wg-text-on-accent)}.wg__goto-btn--go:hover{background:var(--wg-accent-color-hover)}.wg__spacer-top td,.wg__spacer-bottom td{padding:0;border:none;background:transparent;height:inherit;line-height:0}@media (prefers-color-scheme: dark){:host{--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86;--wg-dirty-indicator-color: #ffa940;--wg-dirty-cell-bg: rgba(255, 169, 64, .12);--wg-dirty-row-number-border-color: #ffa940}}:host([data-theme="dark"]),:host-context([data-theme="dark"]),:host([data-bs-theme="dark"]),:host-context([data-bs-theme="dark"]),:host-context(.dark){--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86;--wg-dirty-indicator-color: #ffa940;--wg-dirty-row-number-border-color: #ffa940}:host([data-theme="light"]),:host-context([data-theme="light"]),:host([data-bs-theme="light"]),:host-context([data-bs-theme="light"]),:host-context(.light){--wg-surface-1: var(--base-main-bg, #ffffff);--wg-surface-2: var(--base-elevated-bg, #f5f5f5);--wg-surface-3: var(--base-hover-bg, #ebebeb);--wg-surface-floating: var(--base-dropdown-bg, var(--base-main-bg, #ffffff));--wg-text-color-1: var(--base-text-color-1, #242424);--wg-text-color-2: var(--base-text-color-2, #424242);--wg-text-color-3: var(--base-text-color-3, #707070);--wg-border-color: var(--base-border-color, #e0e0e0);--wg-border-color-hover: var(--base-border-color, #d1d1d1);--wg-input-bg: var(--base-input-bg, #ffffff);--wg-input-border: var(--base-input-border, 1px solid #d1d1d1);--wg-hover-bg: var(--base-hover-bg, #f0f0f0);--wg-active-bg: var(--base-hover-bg, #e0e0e0);--wg-danger-bg-light: var(--base-danger-bg-light, #fde7e9);--wg-danger-color: var(--base-danger-color, #d13438)}';function ct(e,t,o){const i=o.valueMember||"value",r=t.find(s=>s[i]===e);return r?Be(r,o):e!=null?String(e):""}function Be(e,t){if(t.getDisplayCallback)return t.getDisplayCallback(e);const o=t.displayMember||"label";return String(e[o]??e.label??"")}function Ae(e,t){if(t.getValueCallback)return t.getValueCallback(e);const o=t.valueMember||"value";return e[o]??e.value}function Yn(e,t){return t.getIconCallback?t.getIconCallback(e):t.iconMember&&e[t.iconMember]||null}function Un(e,t){return t.getSubtitleCallback?t.getSubtitleCallback(e):t.subtitleMember&&e[t.subtitleMember]||null}function de(e,t){return t.getDisabledCallback?t.getDisabledCallback(e):t.disabledMember?!!e[t.disabledMember]:!1}function no(e,t,o,i,r,s,n=!0){const l=i.editor==="select"||i.editor==="combobox"||i.editor==="autocomplete",a=i.editor==="date",d=i.editor==="checkbox",c=String(i.field);if(d){if(i.formatCallback)return`<span class="wg__cell-text">${e.escapeHtml(r)}</span>`;const g=e.grid.displayItems[t],h=g?e.grid.getCellRawValue(g,t,c):!1,f=i.editorOptions||{},w=f.trueValue!==void 0?f.trueValue:!0;return`
|
|
307
|
+
toolbarColumn takes priority — cursor following is disabled.`,r)}requestUpdate(){}getRowDraft(e){return this._draftRows.get(e)}hasRowDraft(e){return this._draftRows.has(e)}isCellDirty(e,o){const i=this._draftRows.get(e);if(!i)return!1;const r=this.displayItems[e];if(!r)return!1;const s=i[o],n=r[o];return s!==n}isRowDirty(e){return this._draftRows.has(e)}discardRowDraft(e){this._draftRows.delete(e),this._invalidCells=this._invalidCells.filter(o=>o.rowIndex!==e),this.requestUpdate()}discardCellDraft(e,o){const i=this._draftRows.get(e);if(!i)return;const r=this.displayItems[e];if(!r)return;const s=r[o];i[o]=s;const n=Object.keys(i);let l=!1;for(const a of n){const d=i[a],c=r[a];if(d!==c){l=!0;break}}l||this._draftRows.delete(e),this._invalidCells=this._invalidCells.filter(a=>!(a.rowIndex===e&&a.field===o))}getDraftRowIndices(){return Array.from(this._draftRows.keys())}discardAllDrafts(){this._draftRows.clear(),this._invalidCells=[],this.requestUpdate()}getCellRawValue(e,o,i){if(!this.isEmptyRowIndex(o)){const r=this._draftRows.get(o);if(r)return r[i]}return e[i]}getCellValue(e,o,i){var s;if(o.templateCallback)return o.templateCallback(e);const r=i!==void 0?this.getCellRawValue(e,i,String(o.field)):e[String(o.field)];if(o.formatCallback)return o.formatCallback(r,e);if(o.editor==="date"&&((s=o.editorOptions)!=null&&s.dateFormat)&&r)try{const n=r instanceof Date?r:new Date(r);if(!isNaN(n.getTime())){const l=Rt(o.editorOptions.dateFormat);return eo(n,l)}}catch{}return String(r??"")}isCellInvalid(e,o){return this._invalidCells.some(i=>i.rowIndex===e&&i.field===o)}getCellValidationError(e,o){const i=this._invalidCells.find(r=>r.rowIndex===e&&r.field===o);return(i==null?void 0:i.error)||null}addInvalidCell(e,o,i){const r=this._invalidCells.findIndex(s=>s.rowIndex===e&&s.field===o);r>=0?this._invalidCells[r]={rowIndex:e,field:o,error:i}:this._invalidCells=[...this._invalidCells,{rowIndex:e,field:o,error:i}]}removeInvalidCell(e,o){this._invalidCells=this._invalidCells.filter(i=>!(i.rowIndex===e&&i.field===o))}isEditing(e,o){var i,r;return((i=this._editingCell)==null?void 0:i.rowIndex)===e&&((r=this._editingCell)==null?void 0:r.field)===o}shouldShowEditor(e,o){const i=this._columns[o];if(!i)return!1;const r=String(i.field);return!!(this.isEditing(e,r)||(i.editTrigger??this._editTrigger)==="always"&&this.isCellEditable(i))}startEdit(e,o,i){var n,l;if(!this.canEditCell(e,o)){Pe.debug("startEdit blocked (locked):",{rowIndex:e,field:o});return}Pe.debug("startEdit:",{rowIndex:e,field:o,options:i});const r=this.displayItems[e];if(!r)return;this._draftRows.has(e)||this._draftRows.set(e,{...r});const s=this._editingCell;this._editingCell={rowIndex:e,field:o,initialSearchQuery:i==null?void 0:i.initialSearchQuery,cursorPosition:i==null?void 0:i.cursorPosition},(n=this._onInteractionChange)==null||n.call(this,"editingCell",{prev:s,current:this._editingCell}),this._currentCellError=null,(l=this._onroweditstart)==null||l.call(this,{row:r,rowIndex:e,field:o})}cancelEdit(){var e,o;if(this._editingCell){const i=this._editingCell,{rowIndex:r,field:s}=i,n=this.displayItems[r];n&&((e=this._onroweditcancel)==null||e.call(this,{row:n,rowIndex:r,field:s})),this._editingCell=null,(o=this._onInteractionChange)==null||o.call(this,"editingCell",{prev:i,current:null}),this._currentCellError=null}}normalizeValidationResult(e,o){return e==null||e===!0?{valid:!0,finalValue:o}:e===!1?{valid:!1,message:"Validation failed",finalValue:o}:typeof e=="string"?{valid:!1,message:e,finalValue:o}:{valid:e.valid,message:e.message,finalValue:e.transformedValue!==void 0?e.transformedValue:o}}async commitEdit(e,o,i,r=!1){var w,p,m,v,y,C,S;ct.debug("commitEdit:",{rowIndex:e,field:o,newValue:i});const s=this._columns.find(_=>String(_.field)===o);if(!s)return;const n=this.displayItems[e];if(!n)return;const l=this.isEmptyRowIndex(e),a=n[o];let d=i,c=null,u=!0;this._isValidating=!0;try{if(s.beforeCommitCallback){const _={value:i,oldValue:a,row:n,rowIndex:e,field:o},x=await Promise.resolve(s.beforeCommitCallback(_)),k=this.normalizeValidationResult(x,i);u=k.valid,c=k.message||null,d=k.finalValue}else if(s.validateCallback){const _=await Promise.resolve(s.validateCallback(i,n));_&&(u=!1,c=_)}}catch(_){u=!1,c=_ instanceof Error?_.message:"Validation failed"}if(this._isValidating=!1,l){if(this._emptyRowDraft||(this._emptyRowDraft={...n}),this._emptyRowDraft[o]=d,u?(this.removeInvalidCell(e,o),this._currentCellError=null):(this.addInvalidCell(e,o,c||"Invalid value"),this._currentCellError=c,(w=this._onvalidationerror)==null||w.call(this,{row:n,rowIndex:e,field:o,error:c||"Invalid value"})),r&&this.emptyRowHasData(this._emptyRowDraft)){const k={...this._emptyRowDraft},I=this._newRowPosition==="top"?0:this._items.length;this._invalidCells=this._invalidCells.map(D=>D.rowIndex===e?{...D,rowIndex:I}:this._newRowPosition==="top"?{...D,rowIndex:D.rowIndex+1}:D),this._newRowPosition==="top"?this._items=[k,...this._items]:this._items=[...this._items,k];const E=this._invalidCells.some(D=>D.rowIndex===I);(p=this._onrowchange)==null||p.call(this,{row:k,draftRow:k,rowIndex:I,field:o,oldValue:null,newValue:d,isValid:!E,validationError:E?"Row has invalid cells":null}),this._emptyRowDraft=null;const R=this._editingCell;this._editingCell=null,(m=this._onInteractionChange)==null||m.call(this,"editingCell",{prev:R,current:null}),this.requestUpdate();return}const _=this._editingCell;this._editingCell=null,(v=this._onInteractionChange)==null||v.call(this,"editingCell",{prev:_,current:null});return}let g=this._draftRows.get(e);g||(g={...n},this._draftRows.set(e,g)),g[o]=d,u?(this.removeInvalidCell(e,o),this._currentCellError=null):(this.addInvalidCell(e,o,c||"Invalid value"),this._currentCellError=c,(y=this._onvalidationerror)==null||y.call(this,{row:n,rowIndex:e,field:o,error:c||"Invalid value"})),(d!==a||!u)&&((C=this._onrowchange)==null||C.call(this,{row:n,draftRow:g,rowIndex:e,field:o,oldValue:a,newValue:d,isValid:u,validationError:c}));const f=this._editingCell;this._editingCell=null,(S=this._onInteractionChange)==null||S.call(this,"editingCell",{prev:f,current:null})}updateDraftValue(e,o,i){var l;if(!this._columns.find(a=>String(a.field)===o))return;const s=this.displayItems[e];if(!s)return;const n=this.getCellRawValue(s,e,o);if(this.isEmptyRowIndex(e))this._emptyRowDraft||(this._emptyRowDraft={...s}),this._emptyRowDraft[o]=i;else{let a=this._draftRows.get(e);a||(a={...s},this._draftRows.set(e,a)),a[o]=i}if(i!==n){const a=this._draftRows.get(e)||this._emptyRowDraft||s;(l=this._onrowchange)==null||l.call(this,{row:s,draftRow:a,rowIndex:e,field:o,oldValue:n,newValue:i,isValid:!0,validationError:null})}}isCellEditable(e){return e.isEditable===!1?!1:e.isEditable===!0?!0:this._isEditable}getEditableColumns(){return this._columns.map((e,o)=>({index:o,column:e})).filter(({column:e})=>this.isCellEditable(e))}isCellFocused(e,o){var i,r;return((i=this._focusedCell)==null?void 0:i.rowIndex)===e&&((r=this._focusedCell)==null?void 0:r.colIndex)===o}get focusedCell(){return this._focusedCell}setFocusedCell(e,o){var s;const i=this._focusedCell,r={rowIndex:e,colIndex:o};(i==null?void 0:i.rowIndex)===r.rowIndex&&(i==null?void 0:i.colIndex)===r.colIndex||(this._focusedCell=r,(s=this._onInteractionChange)==null||s.call(this,"focusedCell",{prev:i,current:r}))}clearFocusedCell(){var o;const e=this._focusedCell;e!==null&&(this._focusedCell=null,(o=this._onInteractionChange)==null||o.call(this,"focusedCell",{prev:e,current:null}))}get tabTraversalStartColIndex(){return this._tabTraversalStartColIndex}set tabTraversalStartColIndex(e){this._tabTraversalStartColIndex=e}setHoveredRow(e){var i;if(this._hoveredRowIndex===e)return;const o=this._hoveredRowIndex;this._hoveredRowIndex=e,(i=this._onInteractionChange)==null||i.call(this,"hoveredRow",{prev:o,current:e})}get focusedRowIndex(){return this._focusedRowIndex}set focusedRowIndex(e){e===null?this.clearRowFocus():this.setFocusedRow(e),this.requestUpdate()}get onrowfocus(){return this._onrowfocus}set onrowfocus(e){this._onrowfocus=e}isRowFocused(e){return this._focusedRowIndex===e}clearRowFocus(){var o;if(this._focusedRowIndex===null)return;const e=this._focusedRowIndex;this._focusedRowIndex=null,(o=this._onInteractionChange)==null||o.call(this,"focusedRow",{prev:e,current:null})}setFocusedRow(e){var r;if(this._focusedRowIndex===e)return;Pe.debug("setFocusedRow:",e,"(prev:",this._focusedRowIndex,")");const o=this._focusedRowIndex;this._focusedRowIndex=e,(r=this._onInteractionChange)==null||r.call(this,"focusedRow",{prev:o,current:e});const i=this.displayItems[e];i&&this._onrowfocus&&this._onrowfocus({rowIndex:e,row:i,previousRowIndex:o})}getRowId(e){if(this._idValueCallback)return this._idValueCallback(e);if(this._idValueMember)return e[String(this._idValueMember)]}findRowById(e){const o=this._items.findIndex(i=>this.getRowId(i)===e);return o===-1?null:{row:this._items[o],index:o}}getRowLockInfo(e){let o,i,r=-1;if(typeof e=="object"&&e!==null)o=e,i=this.getRowId(o),r=this._items.indexOf(o),r===-1&&(r=this.displayItems.indexOf(o));else{i=e;const n=this.findRowById(i);n&&(o=n.row,r=n.index)}if(i!==void 0&&this._externalLocks.has(i))return this._externalLocks.get(i);if(!o)return null;const s=this._rowLocking;if(!s)return null;if(s.getLockInfoCallback){const n=s.getLockInfoCallback(o,r);if(n!=null&&n.isLocked)return n}if(s.isLockedCallback&&s.isLockedCallback(o,r))return{isLocked:!0};if(s.lockInfoMember){const n=o[String(s.lockInfoMember)];if(n!=null&&n.isLocked)return n}return s.lockedMember&&o[String(s.lockedMember)]?{isLocked:!0}:null}isRowLocked(e){const o=this.getRowLockInfo(e);return(o==null?void 0:o.isLocked)===!0}lockRowById(e,o){var s;const i={isLocked:!0,lockedBy:o==null?void 0:o.lockedBy,lockedAt:(o==null?void 0:o.lockedAt)??new Date,reason:o==null?void 0:o.reason,...o};this._externalLocks.set(e,i);const r=this.findRowById(e);return r&&this._editingCell&&this._editingCell.rowIndex===r.index&&this.cancelEdit(),this.requestUpdate(),(s=this._onrowlockchange)==null||s.call(this,{rowId:e,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:i,source:"external"}),!0}unlockRowById(e){var i;const o=this._externalLocks.has(e);if(this._externalLocks.delete(e),o){this.requestUpdate();const r=this.findRowById(e);(i=this._onrowlockchange)==null||i.call(this,{rowId:e,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:null,source:"external"})}return o}getExternalLocks(){return new Map(this._externalLocks)}clearExternalLocks(){this._externalLocks.clear(),this.requestUpdate()}updateRowById(e,o){const i=this.findRowById(e);if(!i)return!1;Object.assign(this._items[i.index],o);const r=this._draftRows.get(i.index);return r&&Object.assign(r,o),this.requestUpdate(),!0}replaceRowById(e,o){const i=this.findRowById(e);return i?(this._items[i.index]=o,this._draftRows.delete(i.index),this.requestUpdate(),!0):!1}canEditCell(e,o){var a;const i=this._columns.find(d=>String(d.field)===o);if(!i||!this.isCellEditable(i))return!1;const r=this.displayItems[e];if(!r)return!1;const s=this.getRowLockInfo(r);if(!(s!=null&&s.isLocked))return!0;const n=this._rowLocking;switch((n==null?void 0:n.lockedEditBehavior)??"block"){case"allow":return!0;case"callback":return((a=n==null?void 0:n.canEditLockedCallback)==null?void 0:a.call(n,r,s))??!1;case"block":default:return!1}}getColumnWidth(e){return this._columnWidths.get(e)}setColumnWidth(e,o,i=!1){this._columnWidths.set(e,o),i||this.requestUpdate()}setColumnWidths(e){for(const{field:o,width:i}of e)o&&i&&this._columnWidths.set(o,i);this.requestUpdate()}getColumnWidthsState(){return this._columns.map(e=>{const o=String(e.field),i=this._columnWidths.get(o)||e.width||"";return{field:o,width:i}}).filter(e=>e.width)}loadPersistedWidths(){this.loadPersistedState()}savePersistedWidths(){this.savePersistedState()}loadPersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const e=`wg-${this._gridName}-state`,o=localStorage.getItem(e);if(!o)return;const i=JSON.parse(o),r=new Set(this._columns.map(n=>String(n.field)));let s=!1;if(i.columnWidths){this._columnWidths.clear();for(const n of i.columnWidths)r.has(n.field)?this._columnWidths.set(n.field,n.width):s=!0}if(i.columnOrder){this._columnOrder.clear();for(const n of i.columnOrder)r.has(n.field)?this._columnOrder.set(n.field,n.order):s=!0}s&&this.savePersistedState()}catch(e){console.warn("WebGrid: Failed to load persisted state",e)}}savePersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const e=`wg-${this._gridName}-state`,o={};this._shouldPersistColumnWidths&&(o.columnWidths=this.getColumnWidthsState()),this._shouldPersistColumnOrder&&(o.columnOrder=this.getColumnOrderState()),localStorage.setItem(e,JSON.stringify(o))}catch(e){console.warn("WebGrid: Failed to save persisted state",e)}}getColumnOrder(e){return this._columnOrder.get(e)}setColumnOrder(e){this._columnOrder.clear();for(const{field:o,order:i}of e)o!==void 0&&i!==void 0&&this._columnOrder.set(o,i);this.requestUpdate()}getColumnOrderState(){const e=this.visualColumns,o=this.totalFrozenColumns;return e.slice(o).map((i,r)=>({field:String(i.column.field),order:r}))}moveColumn(e,o){const i=this.visualColumns,r=this.totalFrozenColumns,s=i.slice(r),n=s.findIndex(d=>String(d.column.field)===e);if(n===-1||n===o)return;this._columnOrder.clear();const l=[...s],[a]=l.splice(n,1);l.splice(o,0,a),l.forEach((d,c)=>{this._columnOrder.set(String(d.column.field),c)}),this.requestUpdate()}}const Wn=':host{--wg-rem: 10px;font-family:var(--wg-font-family);display:block;position:relative;--wg-accent-color: var(--base-accent-color, #0078d4);--wg-accent-color-hover: var(--base-accent-color-hover, #106ebe);--wg-accent-color-active: var(--base-accent-color-active, #005a9e);--wg-accent-color-light: var(--base-accent-color-light, color-mix(in srgb, var(--wg-accent-color) 15%, transparent));--wg-text-color-1: var(--base-text-color-1, #242424);--wg-text-color-2: var(--base-text-color-2, #424242);--wg-text-color-3: var(--base-text-color-3, #707070);--wg-text-on-accent: var(--base-text-color-on-accent, #ffffff);--wg-surface-1: var(--base-main-bg, #ffffff);--wg-surface-2: var(--base-elevated-bg, #f5f5f5);--wg-surface-3: var(--base-hover-bg, #ebebeb);--wg-surface-floating: var(--base-dropdown-bg, var(--base-main-bg, #ffffff));--wg-border-color: var(--base-border-color, #e0e0e0);--wg-border-color-hover: var(--base-border-color, #d1d1d1);--wg-input-bg: var(--base-input-bg, #ffffff);--wg-input-color: var(--base-input-color, var(--wg-text-color-1));--wg-input-border: var(--base-input-border, 1px solid #d1d1d1);--wg-input-border-hover: var(--base-input-border-hover, 1px solid #0078d4);--wg-input-border-focus: var(--base-input-border-focus, 1px solid #0078d4);--wg-input-placeholder-color: var(--base-input-placeholder-color, #707070);--wg-danger-color: var(--base-danger-color, #d13438);--wg-danger-bg-light: var(--base-danger-bg-light, #fde7e9);--wg-hover-bg: var(--base-hover-bg, #f0f0f0);--wg-active-bg: var(--base-hover-bg, #e0e0e0);--wg-font-size-base: calc(var(--base-font-size-sm, 1.4) * var(--wg-rem));--wg-font-size-sm: calc(var(--base-font-size-xs, 1.2) * var(--wg-rem));--wg-font-size-xs: calc(var(--base-font-size-2xs, 1.1) * var(--wg-rem));--wg-font-size-lg: calc(var(--base-font-size-base, 1.6) * var(--wg-rem));--wg-font-family: var(--base-font-family, inherit);--wg-line-height-base: var(--base-line-height-normal, 1.5);--wg-font-weight-normal: var(--base-font-weight-normal, 400);--wg-font-weight-semibold: var(--base-font-weight-semibold, 600);--wg-font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--wg-border-radius-sm: calc(var(--base-border-radius-sm, .4) * var(--wg-rem));--wg-border-radius-md: calc(var(--base-border-radius-md, .6) * var(--wg-rem));--wg-border-radius-lg: calc(var(--base-border-radius-lg, .8) * var(--wg-rem));--wg-spacing-xs: calc(.4 * var(--wg-rem));--wg-spacing-sm: calc(.8 * var(--wg-rem));--wg-spacing-md: calc(1.2 * var(--wg-rem));--wg-spacing-lg: calc(1.6 * var(--wg-rem));--wg-spacing-xl: calc(2.4 * var(--wg-rem));--wg-table-bg: var(--wg-surface-1);--wg-table-border: 1px solid var(--wg-border-color);--wg-row-number-width: calc(4 * var(--wg-rem));--wg-actions-column-width: calc(3.2 * var(--wg-rem));--wg-header-bg: var(--wg-surface-2);--wg-header-bg-hover: var(--wg-surface-3);--wg-header-bg-sorted: var(--wg-surface-3);--wg-header-color: var(--wg-text-color-1);--wg-header-border: 2px solid var(--wg-border-color);--wg-header-separator: 1px solid var(--wg-border-color);--wg-header-padding: var(--wg-spacing-sm);--wg-header-font-weight: var(--wg-font-weight-semibold);--wg-header-min-height: auto;--wg-cell-padding: var(--wg-spacing-sm);--wg-cell-padding-block: var(--wg-spacing-sm);--wg-cell-padding-inline: var(--wg-spacing-sm);--wg-row-min-height: auto;--wg-cell-color: var(--wg-text-color-1);--wg-cell-border: 1px solid var(--wg-border-color);--wg-cell-splitter-color: var(--wg-border-color);--wg-cell-splitter-width: 1px;--wg-cell-bg-hover: var(--wg-hover-bg);--wg-cell-bg-editing: var(--wg-surface-1);--wg-cell-readonly-bg: var(--base-disabled-bg, var(--wg-surface-2));--wg-row-border: 1px solid var(--wg-border-color);--wg-row-bg-even: var(--wg-surface-2);--wg-row-bg-hover: var(--wg-surface-3);--wg-filter-bg: var(--wg-surface-1);--wg-filter-border: 1px solid var(--wg-border-color);--wg-filter-padding: var(--wg-spacing-xs) var(--wg-spacing-sm);--wg-filter-input-padding: calc(.4 * var(--wg-rem)) calc(.8 * var(--wg-rem));--wg-filter-input-bg: var(--wg-input-bg);--wg-filter-input-border: var(--wg-input-border);--wg-filter-input-border-focus: var(--wg-input-border-focus);--wg-filter-input-border-radius: var(--wg-border-radius-sm);--wg-filter-input-font-size: var(--wg-font-size-sm);--wg-sort-indicator-size: calc(1.4 * var(--wg-rem));--wg-sort-indicator-opacity: .9;--wg-sort-placeholder-opacity: .3;--wg-sort-priority-size: calc(1.1 * var(--wg-rem));--wg-pagination-padding: var(--wg-spacing-md);--wg-pagination-gap: calc(1.6 * var(--wg-rem));--wg-pagination-bg: var(--wg-surface-1);--wg-pagination-border: 1px solid var(--wg-border-color);--wg-pagination-btn-padding: calc(.6 * var(--wg-rem)) calc(1.6 * var(--wg-rem));--wg-pagination-btn-bg: var(--wg-surface-1);--wg-pagination-btn-bg-hover: var(--wg-surface-2);--wg-pagination-btn-bg-active: var(--wg-surface-3);--wg-pagination-btn-border: 1px solid var(--wg-border-color);--wg-pagination-btn-border-hover: 1px solid var(--wg-border-color-hover);--wg-pagination-btn-border-radius: var(--wg-border-radius-sm);--wg-pagination-btn-disabled-opacity: .4;--wg-empty-padding: var(--wg-spacing-xl);--wg-empty-color: var(--wg-text-color-3);--wg-error-cell-bg: var(--wg-danger-bg-light);--wg-error-cell-border: 1px solid var(--wg-danger-color);--wg-error-message-color: var(--wg-danger-color);--wg-error-message-font-size: var(--wg-font-size-xs);--wg-error-indicator-color: var(--wg-danger-color);--wg-dirty-indicator-color: #ed8b00;--wg-dirty-indicator-size: 6px;--wg-dirty-cell-bg: rgba(237, 139, 0, .08);--wg-dirty-row-number-border-color: #ed8b00;--wg-editor-bg: var(--wg-surface-1);--wg-editor-outline: 2px solid var(--wg-accent-color);--wg-editor-outline-offset: -2px;--wg-editor-validating-opacity: .7;--wg-dropdown-toggle-right: var(--wg-spacing-sm);--wg-dropdown-toggle-size: calc(1.2 * var(--wg-rem));--wg-dropdown-toggle-hitbox: calc(2.4 * var(--wg-rem));--wg-date-trigger-size: calc(2.8 * var(--wg-rem));--wg-editor-hitbox-height: calc(4.8 * var(--wg-rem));--wg-checkbox-scale: 1.2;--wg-toolbar-bg: var(--wg-surface-floating);--wg-toolbar-border: 1px solid var(--wg-border-color);--wg-toolbar-border-radius: var(--wg-border-radius-sm);--wg-toolbar-shadow: var(--base-dropdown-box-shadow, 0 2px 8px rgba(0, 0, 0, .15));--wg-toolbar-divider-color: var(--wg-border-color);--wg-toolbar-divider-height: calc(1.6 * var(--wg-rem));--wg-toolbar-row-height: calc(3.7 * var(--wg-rem));--wg-toolbar-icon-size: calc(1.6 * var(--wg-rem));--wg-toolbar-btn-min-width: calc(2.4 * var(--wg-rem));--wg-toolbar-btn-padding: 0 calc(.4 * var(--wg-rem));--wg-toolbar-btn-border-radius: var(--wg-border-radius-sm);--wg-toolbar-btn-bg-hover: var(--wg-hover-bg);--wg-toolbar-btn-bg-active: var(--wg-active-bg);--wg-toolbar-btn-color: var(--wg-text-color-1);--wg-toolbar-trigger-color: var(--wg-text-color-3);--wg-toolbar-trigger-color-hover: var(--wg-text-color-1);--wg-toolbar-trigger-bg-hover: var(--wg-hover-bg);--wg-overlay-bg: rgba(0, 0, 0, .4);--wg-dialog-shadow: 0 4px 20px rgba(0, 0, 0, .15);--wg-tooltip-bg: var(--base-tooltip-bg, #333);--wg-tooltip-color: var(--base-tooltip-color, #fff);--wg-tooltip-max-width: 300px;--wg-tooltip-arrow-size: 8px;--wg-context-menu-z-index: var(--wg-z-context-menu);--wg-context-menu-min-width: calc(16 * var(--wg-rem));--wg-focus-outline: 2px solid var(--wg-accent-color);--wg-focus-outline-offset: -2px;--wg-focus-border-width: 2px;--wg-focus-border-color: var(--wg-accent-color);--wg-focus-bg: var(--wg-hover-bg);--wg-transition-fast: .1s ease;--wg-transition-normal: .15s ease;--wg-z-cell-highlight: 1;--wg-z-selection-border: 1;--wg-z-frozen: 2;--wg-z-header: 3;--wg-z-frozen-header: 4;--wg-z-fill-handle: 5;--wg-z-fill-handle-area: 4;--wg-z-resize-handle: 6;--wg-z-shortcuts-help: 10;--wg-z-reorder-indicator: 100;--wg-z-toolbar: 1000;--wg-z-context-menu: 1001;--wg-z-dropdown: 9999;--wg-z-reorder-ghost: 10000;--wg-z-tooltip: 10000;--wg-row-locked-bg: var(--base-disabled-bg, var(--wg-surface-2));--wg-row-locked-opacity: .7;--wg-frozen-column-bg: var(--wg-surface-1);--wg-frozen-header-bg: color-mix(in srgb, var(--wg-accent-color) 8%, var(--wg-header-bg));--wg-frozen-column-shadow: 2px 0 4px rgba(0, 0, 0, .1);--wg-frozen-column-shadow-active: 6px 0 12px rgba(0, 0, 0, .25);--wg-frozen-column-border: 2px solid var(--wg-border-color);--wg-frozen-column-shadow-gradient: linear-gradient(to right, rgba(0, 0, 0, .15), transparent);--wg-frozen-column-shadow-width: 8px;--wg-resize-handle-width: 12px;--wg-resize-handle-offset: -6px;--wg-resize-handle-line-width: 2px;--wg-resize-handle-color: var(--wg-border-color);--wg-resize-handle-active-color: var(--wg-accent-color);--wg-fill-handle-size: 8px;--wg-fill-handle-bg: var(--wg-surface-1);--wg-fill-handle-border-color: var(--wg-accent-color);--wg-fill-handle-border-width: 2px;--wg-fill-range-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-fill-range-border-color: var(--wg-accent-color);--wg-selection-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-selection-row-number-bg: var(--wg-accent-color);--wg-selection-row-number-color: var(--base-text-inverted, #fff);--wg-selection-border-width: 2px;--wg-selection-border-color: var(--wg-accent-color);--wg-row-focus-bg: color-mix(in srgb, var(--wg-accent-color) 10%, transparent);--wg-row-focus-row-number-bg: color-mix(in srgb, var(--wg-accent-color) 30%, transparent);--wg-cell-selection-bg: color-mix(in srgb, var(--wg-accent-color) 10%, transparent);--wg-cell-selection-border: var(--wg-accent-color);--wg-cell-selection-border-width: 2px;--wg-dropdown-max-height: 200px;--wg-dropdown-option-gap: var(--wg-spacing-sm);--wg-dropdown-option-padding: calc(.6 * var(--wg-rem)) var(--wg-spacing-sm) calc(.6 * var(--wg-rem)) calc(var(--wg-spacing-sm) - 1px);--wg-dropdown-empty-padding: calc(.8 * var(--wg-rem)) var(--wg-spacing-sm) calc(.8 * var(--wg-rem)) calc(var(--wg-spacing-sm) - 1px);--wg-inline-actions-padding: var(--wg-spacing-xs) var(--wg-spacing-sm);--wg-inline-actions-gap: calc(.2 * var(--wg-rem));--wg-toolbar-row-gap: calc(.2 * var(--wg-rem));--wg-toolbar-row-padding: 0 calc(.4 * var(--wg-rem));--wg-toolbar-label-font-size: var(--wg-font-size-sm);--wg-toolbar-btn-gap: calc(.4 * var(--wg-rem));--wg-tooltip-padding: calc(.6 * var(--wg-rem)) calc(1 * var(--wg-rem));--wg-tooltip-shadow: 0 2px 8px rgba(0, 0, 0, .2)}web-grid:not(:defined){display:block;min-height:calc(10 * var(--wg-rem));color:transparent!important;background:transparent}.wg{position:relative;width:100%;max-height:inherit;overflow:auto;overscroll-behavior:contain;border:var(--wg-table-border)}.wg--scrollable{max-height:var(--wg-scroll-max-height, 100vh)}.wg--table-border-only{border:none;overflow:visible;display:flex;flex-direction:column}.wg--table-border-only .wg__table-container{border:var(--wg-table-border);overflow:auto;max-height:inherit;flex:1;min-height:0}.wg--table-border-only .wg__table-container .wg__header{position:sticky;top:0;z-index:var(--wg-z-header)}.wg__table{width:100%;border-collapse:collapse;table-layout:fixed;background:var(--wg-table-bg);font-size:var(--wg-font-size-base);line-height:var(--wg-line-height-base)}.wg__filler{width:auto;min-width:0;padding:0!important;border:none!important;box-shadow:none!important}th.wg__filler{position:sticky;top:0;z-index:var(--wg-z-header);background:var(--wg-header-bg);box-shadow:inset 0 -2px 0 var(--wg-border-color)!important}td.wg__filler{background:transparent}.wg__table tbody tr{border-bottom:var(--wg-row-border)}.wg__row-number-header,.wg__row-number{width:var(--wg-row-number-width);min-width:var(--wg-row-number-width);max-width:var(--wg-row-number-width);box-sizing:border-box;text-align:center;color:var(--wg-text-color-2);background:var(--wg-header-bg);-webkit-user-select:none;user-select:none;font-size:var(--wg-font-size-sm)}.wg__row-number-header{cursor:pointer}.wg__row-number-header:hover{background:var(--wg-hover-bg)}.wg__row-number{box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__actions-column{width:var(--wg-actions-column-width);min-width:var(--wg-actions-column-width);max-width:var(--wg-actions-column-width);padding:0!important;text-align:center}thead .wg__actions-column{background:var(--wg-header-bg);box-shadow:inset 0 -2px 0 var(--wg-border-color)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__header{position:sticky;top:0;z-index:var(--wg-z-header);background:var(--wg-header-bg);color:var(--wg-header-color);font-weight:var(--wg-header-font-weight);padding:var(--wg-header-padding);height:var(--wg-header-min-height);box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color),inset 0 -2px 0 var(--wg-border-color);box-sizing:border-box;-webkit-user-select:none;user-select:none;overflow:hidden}.wg__header:last-child{box-shadow:inset 0 -2px 0 var(--wg-border-color)}.wg__header--sortable{cursor:pointer}.wg__header--sortable:hover{background:var(--wg-header-bg-hover)}.wg__header--sorted{background:var(--wg-header-bg-sorted)}.wg__header--selected,.wg__header--selected:hover{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__header-container{display:flex;align-items:stretch;gap:var(--wg-spacing-xs);height:100%}.wg__header-content{flex:1;min-width:0;display:flex;align-items:center;justify-content:flex-start}.wg__header-content--align-left{justify-content:flex-start}.wg__header-content--align-center{justify-content:center}.wg__header-content--align-right{justify-content:flex-end}.wg__header-content--align-justify{justify-content:flex-start}.wg__header-content--valign-top{align-items:flex-start}.wg__header-content--valign-middle{align-items:center}.wg__header-content--valign-bottom{align-items:flex-end}.wg__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__header-controls{flex-shrink:0;display:flex;align-items:center}.wg__sort-indicator{font-size:var(--wg-sort-indicator-size);opacity:var(--wg-sort-indicator-opacity);min-width:16px;text-align:center}.wg__sort-placeholder{opacity:var(--wg-sort-placeholder-opacity)}.wg__sort-priority{font-size:var(--wg-sort-priority-size);font-weight:var(--wg-font-weight-semibold);margin-left:2px;vertical-align:super;line-height:1}.wg__header-info{display:inline-flex;align-items:center;color:var(--wg-accent-color);cursor:help;opacity:.7;margin-left:var(--wg-spacing-xs);vertical-align:middle}.wg__header-info:hover{opacity:1}.wg__filter-row th{padding:var(--wg-filter-padding);background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__filter-input{width:100%;padding:var(--wg-filter-input-padding);border:var(--wg-filter-input-border);border-radius:var(--wg-filter-input-border-radius);background:var(--wg-surface-1);color:var(--wg-text-color-1);font-family:inherit;font-size:var(--wg-filter-input-font-size);box-sizing:border-box}.wg__filter-input:focus{outline:none;border:var(--wg-filter-input-border-focus);box-shadow:0 0 0 1px var(--wg-accent-color)}.wg__resize-handle{position:absolute;top:0;right:var(--wg-resize-handle-offset);bottom:0;width:var(--wg-resize-handle-width);cursor:col-resize;z-index:var(--wg-z-resize-handle);opacity:0;transition:opacity .1s ease}.wg__header:hover .wg__resize-handle{opacity:1}.wg__resize-handle:after{content:"";position:absolute;top:25%;bottom:25%;left:50%;width:var(--wg-resize-handle-line-width);background:var(--wg-resize-handle-color);transform:translate(-50%);border-radius:1px}.wg__resize-handle:hover:after{background:var(--wg-resize-handle-active-color);top:15%;bottom:15%}.wg__resize-handle--active:after{background:var(--wg-resize-handle-active-color);top:0;bottom:0}.wg__resize-handle--disabled{cursor:not-allowed}.wg__resize-handle--disabled:after{display:none}.wg--resizing .wg__resize-handle{opacity:1}.wg--resizing{-webkit-user-select:none;user-select:none;cursor:col-resize}.wg--resizing .wg__cell,.wg--resizing .wg__header{cursor:col-resize}.wg--resizing .wg__table{min-width:0!important}.wg__header--dragging{opacity:1;background:var(--wg-header-bg)!important;outline:2px dashed var(--wg-accent-color);outline-offset:-2px}.wg__reorder-ghost{position:fixed;z-index:var(--wg-z-reorder-ghost);background:var(--wg-header-bg);border:2px solid var(--wg-accent-color);border-radius:var(--wg-border-radius-sm);padding:.4em .8em;font-size:var(--wg-font-size-sm);font-weight:var(--wg-header-font-weight);color:var(--wg-header-color);box-shadow:var(--wg-dialog-shadow);opacity:.95;pointer-events:none;white-space:nowrap}.wg__drop-indicator{position:absolute;width:3px;background:var(--wg-accent-color);z-index:var(--wg-z-reorder-indicator);pointer-events:none;display:none}.wg__drop-indicator:before{content:"";position:absolute;top:0;left:50%;transform:translate(-50%);border-left:6px solid transparent;border-right:6px solid transparent;border-top:8px solid var(--wg-accent-color)}.wg--reordering{cursor:grabbing;-webkit-user-select:none;user-select:none}.wg--reordering .wg__cell,.wg--reordering .wg__header{cursor:grabbing}.wg--reorderable .wg__header:not(.wg__header--frozen):hover{cursor:grab}.wg__header--frozen{cursor:default}.wg__fill-handle{position:absolute;width:var(--wg-fill-handle-size);height:var(--wg-fill-handle-size);background:var(--wg-fill-handle-bg);border:var(--wg-fill-handle-border-width) solid var(--wg-fill-handle-border-color);cursor:crosshair;z-index:var(--wg-z-fill-handle);pointer-events:auto;box-sizing:border-box}.wg__fill-handle:hover{transform:scale(1.2)}.wg__fill-range{position:absolute;background:var(--wg-fill-range-bg);border:1px dashed var(--wg-fill-range-border-color);pointer-events:none;z-index:var(--wg-z-fill-handle-area);box-sizing:border-box}.wg--filling{cursor:crosshair;-webkit-user-select:none;user-select:none}.wg--filling .wg__cell,.wg--filling .wg__header{cursor:crosshair}.wg__cell--editing .wg__fill-handle{display:none}.wg__row--selected>.wg__cell{background:var(--wg-selection-bg)}.wg__row--selected>.wg__cell.wg__row-number,.wg--editable.wg--navigate-mode .wg__row--selected>.wg__cell.wg__row-number{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__row-number[data-row-number]{cursor:pointer;-webkit-user-select:none;user-select:none}.wg__row-number[data-row-number]:hover{background:var(--wg-hover-bg)}.wg__row--selected>.wg__cell.wg__row-number:hover,.wg--editable.wg--navigate-mode .wg__row--selected>.wg__cell.wg__row-number:hover{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__cell--column-selected{background:var(--wg-selection-bg)}.wg--selecting{cursor:default;-webkit-user-select:none;user-select:none}.wg--selecting *{-webkit-user-select:none;user-select:none}.wg:focus{outline:none}.wg__cell--in-range{background:var(--wg-cell-selection-bg)!important;position:relative;z-index:var(--wg-z-cell-highlight)}.wg__cell--editing.wg__cell--in-range{background:var(--wg-input-bg)!important}.wg__cell--editable.wg__cell--in-range:hover{background:var(--wg-cell-selection-bg)!important}.wg__cell--editable.wg__cell--in-range:hover:after{display:none}.wg__cell-range-border{position:absolute;border:var(--wg-cell-selection-border-width) solid var(--wg-cell-selection-border);pointer-events:none;z-index:var(--wg-z-selection-border);box-sizing:border-box;border-radius:1px}.wg--selecting-cells,.wg--selecting-cells *{cursor:crosshair!important;-webkit-user-select:none;user-select:none}.wg--selecting-cells .wg__cell{cursor:crosshair!important}.wg:has(.wg__cell-range-border) .wg__fill-handle{display:none}.wg__row-selection-border,.wg__column-selection-border{position:absolute;border:var(--wg-selection-border-width) solid var(--wg-selection-border-color);pointer-events:none;z-index:var(--wg-z-selection-border);box-sizing:border-box;border-radius:1px}.wg--selecting-columns,.wg--selecting-columns *{cursor:col-resize!important;-webkit-user-select:none;user-select:none}.wg--selecting-columns .wg__header{cursor:col-resize!important}.wg__header--frozen{background:var(--wg-frozen-header-bg, var(--wg-header-bg));z-index:var(--wg-z-frozen-header)!important}.wg__header--frozen.wg__header--selected,.wg__header--frozen.wg__header--selected:hover{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__row-number-header.wg__header--frozen{z-index:var(--wg-z-frozen-header)!important}.wg__cell--frozen{background:var(--wg-frozen-column-bg, var(--wg-surface-1))}.wg__cell--frozen-last{box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__row-number.wg__cell--frozen{background:var(--wg-header-bg);z-index:var(--wg-z-frozen)!important}.wg--striped tbody tr:nth-child(2n) .wg__cell--frozen{background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover .wg__cell--frozen{background:var(--wg-row-bg-hover)}.wg__row--focused>.wg__cell--frozen{background:color-mix(in srgb,var(--wg-accent-color) 10%,var(--wg-frozen-column-bg, var(--wg-surface-1)))!important}.wg__row--selected>.wg__cell--frozen{background:color-mix(in srgb,var(--wg-accent-color) 15%,var(--wg-frozen-column-bg, var(--wg-surface-1)))!important}.wg__row--selected>.wg__row-number.wg__cell--frozen{background:var(--wg-selection-row-number-bg)!important;color:var(--wg-selection-row-number-color)}.wg__cell--frozen.wg__cell--column-selected{background:color-mix(in srgb,var(--wg-accent-color) 15%,var(--wg-frozen-column-bg, var(--wg-surface-1)))!important}.wg__cell--frozen.wg__cell--in-range{background:color-mix(in srgb,var(--wg-accent-color) 10%,var(--wg-frozen-column-bg, var(--wg-surface-1)))!important}.wg__header.wg__header--frozen-last,.wg__cell.wg__cell--frozen-last{overflow:visible}.wg--scrolled-horizontal .wg__header--frozen-last:after,.wg--scrolled-horizontal .wg__cell--frozen-last:after{content:"";position:absolute;top:0;right:calc(-1 * var(--wg-frozen-column-shadow-width));bottom:0;width:var(--wg-frozen-column-shadow-width);background:var(--wg-frozen-column-shadow-gradient);pointer-events:none}.wg__cell{padding:var(--wg-cell-padding);color:var(--wg-cell-color);height:var(--wg-row-min-height);box-sizing:border-box;position:relative;scroll-margin-top:calc(3 * var(--wg-rem));scroll-margin-bottom:calc(.5 * var(--wg-rem));-webkit-user-select:none;user-select:none;overflow:hidden;box-shadow:inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__cell-text{-webkit-user-select:none;user-select:none;pointer-events:none}.wg__cell--ellipsis .wg__cell-text{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__cell--line-clamp .wg__cell-text{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden}.wg__cell--editable{cursor:pointer}.wg__cell--editable:hover{background:var(--wg-cell-bg-hover)}.wg__cell--editable:hover:after{content:"";position:absolute;top:2px;right:2px;bottom:2px;left:2px;border:1px dashed var(--wg-border-color);border-radius:2px;pointer-events:none}.wg__cell--editing{position:relative;background:var(--wg-surface-1);outline:2px solid var(--wg-accent-color);outline-offset:-2px;z-index:var(--wg-z-cell-highlight)}.wg__cell--editing:after{display:none}.wg__cell--invalid{background:var(--wg-danger-bg-light);box-shadow:inset 0 0 0 2px var(--wg-danger-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg--editable.wg--navigate-mode .wg__cell:not(.wg__cell--editable){background:var(--wg-cell-readonly-bg)}.wg__row--locked{background:var(--wg-row-locked-bg)!important}.wg__row--locked .wg__cell{opacity:var(--wg-row-locked-opacity)}.wg__row--locked .wg__cell--editable{cursor:not-allowed}.wg__row--locked .wg__cell--editable:hover{background:inherit}.wg__row--locked .wg__cell--editable:hover:after{display:none}.wg__row-number--locked{opacity:1!important;cursor:help}.wg__cell--dirty{background:var(--wg-dirty-cell-bg)!important}.wg__cell--dirty:before{content:"";position:absolute;top:0;left:0;width:0;height:0;border-style:solid;border-width:var(--wg-dirty-indicator-size) var(--wg-dirty-indicator-size) 0 0;border-color:var(--wg-dirty-indicator-color) transparent transparent transparent;pointer-events:none}.wg__cell--dirty.wg__cell--editing:before{display:none}.wg__row-number--dirty{box-shadow:inset 3px 0 0 var(--wg-dirty-row-number-border-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__editor{position:absolute;top:0;left:0;right:0;width:100%;padding:var(--wg-cell-padding);border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:inherit;box-sizing:border-box}.wg__editor:focus,.wg__editor:focus-visible{outline:none;box-shadow:none}.wg__editor--text{text-align:inherit}.wg__editor--number{text-align:right}.wg__editor--valign-top{top:0;bottom:auto}.wg__editor--valign-middle{top:0;bottom:0}.wg__editor--valign-bottom{top:auto;bottom:0}.wg__editor--date{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:transparent;padding:var(--wg-cell-padding)}.wg__date-input{flex:1;min-width:0;height:100%;border:none;background:transparent;font:inherit;padding:0;outline:none;color:inherit}.wg__date-trigger{width:var(--wg-date-trigger-size);height:100%;display:flex;align-items:center;justify-content:center;border:none;background:transparent;color:var(--wg-text-color-3);cursor:pointer;padding:0;flex-shrink:0}.wg__date-trigger:hover{color:var(--wg-accent-color);background:var(--wg-hover-bg)}.wg__editor--checkbox{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(var(--wg-checkbox-scale));width:auto;height:auto;margin:0;padding:0;cursor:pointer}.wg__checkbox-display{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(var(--wg-checkbox-scale));width:auto;height:auto;margin:0;padding:0;cursor:pointer;pointer-events:none}.wg__checkbox-display--readonly{cursor:default;opacity:.5}.wg__editor--custom{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg);padding:var(--wg-cell-padding-block) var(--wg-cell-padding-inline);cursor:pointer}.wg__editor--custom:focus{outline:none}.wg__custom-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;cursor:pointer}.wg__editor--combobox,.wg__editor--autocomplete{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;padding:var(--wg-cell-padding);padding-right:0;background:transparent;box-sizing:border-box}.wg__combobox-input,.wg__autocomplete-input{flex:1;width:100%;height:100%;padding:0;padding-right:var(--wg-dropdown-toggle-hitbox);border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base);outline:none;box-sizing:border-box;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.wg__combobox-input:focus,.wg__autocomplete-input:focus{outline:none}.wg__combobox-toggle{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:var(--wg-dropdown-toggle-size);color:var(--wg-text-color-2);pointer-events:auto;cursor:pointer}.wg__combobox-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__loading-indicator{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:var(--wg-font-size-sm);animation:wg-pulse 1s infinite}@keyframes wg-pulse{0%,to{opacity:1}50%{opacity:.4}}.wg__select-trigger{display:flex;align-items:center;justify-content:space-between;cursor:pointer;background:transparent}.wg__select-trigger:focus,.wg__select-trigger:focus-visible{outline:none;box-shadow:none}.wg__select-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__select-toggle{position:relative;font-size:var(--wg-dropdown-toggle-size);opacity:.6;margin-left:var(--wg-spacing-xs);flex-shrink:0;pointer-events:auto;cursor:pointer}.wg__select-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__cell-dropdown-display{display:flex;align-items:center;justify-content:space-between;width:100%;pointer-events:none}.wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:0}.wg__cell:hover .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle,.wg__cell--focused .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:.6}.wg__cell-date-display{display:flex;align-items:center;justify-content:space-between;width:100%;pointer-events:none}.wg__cell-date-display .wg__date-trigger{position:relative;background:none;border:none;padding:0;margin:0;cursor:pointer;opacity:.6;display:flex;align-items:center;justify-content:center;color:inherit;pointer-events:auto}.wg__cell-date-display .wg__date-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:0}.wg__cell:hover .wg__cell-date-display--toggle-on-focus .wg__date-trigger,.wg__cell--focused .wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:.6}.wg__dropdown{background:var(--wg-surface-floating);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);box-shadow:var(--wg-toolbar-shadow);max-height:var(--wg-dropdown-max-height);overflow-y:auto;font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base)}.wg__dropdown-option{display:flex;align-items:center;gap:var(--wg-dropdown-option-gap);padding:var(--wg-dropdown-option-padding);cursor:pointer;color:var(--wg-text-color-1)}.wg__dropdown-option:hover,.wg__dropdown-option--highlighted{background:var(--wg-hover-bg);box-shadow:inset 0 0 0 2px var(--wg-accent-color)}.wg__dropdown-option--selected{background:var(--wg-accent-color-light)}.wg__dropdown-option--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.wg__dropdown-option-icon{flex-shrink:0;width:1.5em;text-align:center}.wg__dropdown-option-content{flex:1;min-width:0;overflow:hidden}.wg__dropdown-option-label{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-option-subtitle{display:block;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-empty{padding:var(--wg-dropdown-empty-padding);color:var(--wg-text-color-2);font-style:italic;text-align:center}.wg__dropdown-option--align-left{justify-content:flex-start}.wg__dropdown-option--align-left .wg__dropdown-option-content{text-align:left}.wg__dropdown-option--align-center{justify-content:center}.wg__dropdown-option--align-center .wg__dropdown-option-content{text-align:center}.wg__dropdown-option--align-right{justify-content:flex-end}.wg__dropdown-option--align-right .wg__dropdown-option-content{text-align:right}.wg__dropdown-option--align-justify{justify-content:flex-start}.wg__dropdown-option--align-justify .wg__dropdown-option-content{text-align:justify}.wg--navigate-mode .wg__cell{cursor:cell}.wg__cell:focus{outline:none;box-shadow:inset 0 0 0 var(--wg-focus-border-width) var(--wg-focus-border-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg--editable .wg__cell.wg__cell--focused,.wg__cell.wg__cell--always-edit-focused{box-shadow:inset 0 0 0 var(--wg-focus-border-width) var(--wg-focus-border-color),inset calc(-1 * var(--wg-cell-splitter-width)) 0 0 var(--wg-cell-splitter-color)}.wg__cell--focused:after,.wg__cell--always-edit-focused:after{display:none}.wg__row--focused>.wg__cell{background:var(--wg-row-focus-bg)}.wg__row--focused>.wg__cell.wg__row-number{background:var(--wg-row-focus-row-number-bg)}.wg--editable.wg--navigate-mode .wg__row--focused>.wg__cell{background:var(--wg-row-focus-bg)}.wg--editable.wg--navigate-mode .wg__row--focused>.wg__cell.wg__row-number{background:var(--wg-row-focus-row-number-bg)}.wg__pagination{display:flex;align-items:center;justify-content:center;gap:var(--wg-pagination-gap);padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__pagination-btn{padding:var(--wg-pagination-btn-padding);background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer;transition:all var(--wg-transition-fast)}.wg__pagination-btn:hover:not(:disabled){background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-btn:active:not(:disabled){background:var(--wg-pagination-btn-bg-active)}.wg__pagination-btn:disabled{opacity:var(--wg-pagination-btn-disabled-opacity);cursor:not-allowed}.wg__pagination-info{font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__pagination-count{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3);margin-left:var(--wg-spacing-xs)}.wg__pagination-pagesize{display:flex;align-items:center;gap:calc(.6 * var(--wg-rem))}.wg__pagination-select{padding:var(--wg-spacing-xs) var(--wg-spacing-sm);background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer}.wg__pagination-select:hover{background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-select:focus{outline:2px solid var(--wg-accent-color);outline-offset:-2px}.wg__pagination-label{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3)}.wg__pagination--left{justify-content:flex-start}.wg__pagination--right{justify-content:flex-end}.wg__pagination--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__summary{display:flex;align-items:center;padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg);font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__summary--left{justify-content:flex-start}.wg__summary--right{justify-content:flex-end}.wg__summary--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer{display:flex;align-items:center;justify-content:space-between;border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__footer--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer .wg__summary,.wg__footer .wg__pagination{border:none}.wg__footer .wg__summary{flex:0 0 auto}.wg__footer .wg__pagination{flex:0 0 auto;margin-left:auto}.wg__toolbar-container{position:fixed;z-index:var(--wg-z-toolbar)}.wg__toolbar{display:flex;flex-direction:column-reverse;gap:0;padding:0;background:var(--wg-toolbar-bg);border:var(--wg-toolbar-border);border-radius:var(--wg-toolbar-border-radius);box-shadow:var(--wg-toolbar-shadow)}.wg__toolbar-row{display:flex;gap:var(--wg-toolbar-row-gap);align-items:center;height:var(--wg-toolbar-row-height);padding:var(--wg-toolbar-row-padding)}.wg__toolbar-row+.wg__toolbar-row{border-top:1px solid var(--wg-toolbar-divider-color)}.wg__toolbar-divider{width:1px;height:var(--wg-toolbar-divider-height);background:var(--wg-toolbar-divider-color);margin:0 var(--wg-spacing-xs);flex-shrink:0}.wg__toolbar-btn{min-width:var(--wg-toolbar-btn-min-width);height:100%;border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:var(--wg-toolbar-btn-gap);font-family:inherit;font-size:var(--wg-font-size-base);font-weight:var(--wg-font-weight-normal);padding:var(--wg-toolbar-btn-padding);transition:background .1s ease}.wg__toolbar-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__toolbar-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__toolbar-btn:disabled{opacity:.5;cursor:not-allowed}.wg__toolbar-btn:disabled:hover{background:transparent}.wg__toolbar-btn svg{width:var(--wg-toolbar-icon-size);height:var(--wg-toolbar-icon-size);flex-shrink:0}.wg__toolbar-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__toolbar-label{font-size:var(--wg-toolbar-label-font-size);white-space:nowrap}.wg__actions-column{width:var(--wg-toolbar-btn-min-width);min-width:var(--wg-toolbar-btn-min-width);max-width:var(--wg-toolbar-btn-min-width);padding:0!important;text-align:center}.wg__header .wg__actions-column{background:var(--wg-header-bg)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg)}.wg__toolbar-trigger{position:relative;padding:0;background:transparent;border:none;border-radius:var(--wg-border-radius-sm);cursor:pointer;font-size:var(--wg-font-size-base);line-height:1;color:var(--wg-toolbar-trigger-color)}.wg__toolbar-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:var(--wg-editor-hitbox-height)}.wg__toolbar-trigger:hover,.wg__toolbar-trigger--active{color:var(--wg-toolbar-trigger-color-hover);background:var(--wg-toolbar-trigger-bg-hover)}.wg__inline-actions-header,.wg__inline-actions-cell{white-space:nowrap;text-align:start;padding:var(--wg-inline-actions-padding);overflow:visible}.wg__inline-actions-header{background:var(--wg-header-bg)}.wg__inline-actions-wrap{display:flex;flex-direction:column;gap:var(--wg-inline-actions-gap);align-items:flex-start}.wg__inline-actions-row{display:flex;gap:var(--wg-inline-actions-gap);align-items:center;justify-content:flex-start}.wg__inline-action-btn{width:var(--wg-toolbar-btn-min-width);max-width:var(--wg-toolbar-btn-min-width);height:calc(2.4 * var(--wg-rem));border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;box-sizing:border-box;font-family:inherit;font-size:var(--wg-font-size-base);transition:background var(--wg-transition-fast)}.wg__inline-action-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__inline-action-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__inline-action-btn:disabled,.wg__inline-action-btn--disabled{opacity:.5;cursor:not-allowed}.wg__inline-action-btn:disabled:hover,.wg__inline-action-btn--disabled:hover{background:transparent}.wg__inline-action-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__inline-action-btn svg{width:var(--wg-toolbar-icon-size);height:var(--wg-toolbar-icon-size);flex-shrink:0}.wg__shortcuts-help{position:absolute;top:var(--wg-spacing-xs);right:var(--wg-spacing-sm);z-index:var(--wg-z-shortcuts-help)}.wg__shortcuts-help--left{right:auto;left:var(--wg-spacing-sm)}.wg__shortcuts-help-icon{display:flex;align-items:center;justify-content:center;width:var(--wg-spacing-xl);height:var(--wg-spacing-xl);padding:0;border:none;border-radius:50%;background:var(--wg-surface-1);color:var(--wg-text-color-2);cursor:pointer;opacity:.7}.wg__shortcuts-help-icon:hover{opacity:1;background:var(--wg-surface-2)}.wg__shortcuts-help-icon svg{width:var(--wg-toolbar-icon-size);height:var(--wg-toolbar-icon-size)}.wg__shortcuts-help-overlay{display:none;position:absolute;top:100%;right:0;margin-top:var(--wg-spacing-xs);padding:var(--wg-spacing-md);background:var(--wg-surface-1);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-md);box-shadow:var(--wg-dialog-shadow);min-width:200px;max-width:var(--wg-tooltip-max-width);z-index:100}.wg__shortcuts-help--left .wg__shortcuts-help-overlay{right:auto;left:0}.wg__shortcuts-help:hover .wg__shortcuts-help-overlay,.wg__shortcuts-help:focus-within .wg__shortcuts-help-overlay{display:block}.wg__shortcuts-help-title{font-weight:var(--wg-font-weight-semibold);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1);margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-xs);border-bottom:1px solid var(--wg-border-color)}.wg__shortcuts-help-custom{margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-sm);border-bottom:1px solid var(--wg-border-color);font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg__shortcuts-help-list{display:flex;flex-direction:column;gap:var(--wg-spacing-xs)}.wg__shortcuts-help-item{display:flex;align-items:center;gap:var(--wg-spacing-md)}.wg__shortcuts-help-key{display:inline-flex;align-items:center;justify-content:center;min-width:28px;padding:2px calc(.6 * var(--wg-rem));font-family:var(--wg-font-family-mono);font-size:var(--wg-font-size-xs);font-weight:var(--wg-font-weight-semibold);color:var(--wg-text-color-1);background:var(--wg-surface-2);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm)}.wg__shortcuts-help-label{flex:1;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg--striped tbody tr:nth-child(2n){background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover{background:var(--wg-row-bg-hover)}.wg__empty{text-align:center;padding:var(--wg-empty-padding);color:var(--wg-empty-color);font-style:italic}.wg__loading-more{text-align:center;padding:var(--wg-cell-padding);color:var(--wg-text-color-2);font-size:var(--wg-font-size-sm)}.wg__tooltip{position:absolute;z-index:var(--wg-z-tooltip);max-width:var(--wg-tooltip-max-width);padding:var(--wg-tooltip-padding);background:var(--wg-tooltip-bg);color:var(--wg-tooltip-color);font-size:var(--wg-font-size-sm);line-height:1.4;border-radius:var(--wg-border-radius-sm);box-shadow:var(--wg-tooltip-shadow);pointer-events:none;opacity:0;transition:opacity var(--wg-transition-fast)}.wg__tooltip--visible{opacity:1}.wg__tooltip-arrow{position:absolute;width:var(--wg-tooltip-arrow-size);height:var(--wg-tooltip-arrow-size);background:var(--wg-tooltip-bg);transform:rotate(45deg)}.wg__tooltip[data-placement^=top] .wg__tooltip-arrow{bottom:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip[data-placement^=bottom] .wg__tooltip-arrow{top:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip[data-placement^=left] .wg__tooltip-arrow{right:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip[data-placement^=right] .wg__tooltip-arrow{left:calc(-.5 * var(--wg-tooltip-arrow-size))}.wg__tooltip-title{font-weight:600}.wg__tooltip-desc{opacity:.85;margin-top:2px}.wg__tooltip-shortcut{margin-top:4px;opacity:.7;font-size:.9em}.wg__goto-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:var(--wg-overlay-bg);display:flex;align-items:center;justify-content:center;z-index:1000}.wg__goto-dialog{background:var(--wg-surface-1);border-radius:var(--wg-border-radius-md);padding:var(--wg-spacing-lg);box-shadow:var(--wg-dialog-shadow);min-width:250px}.wg__goto-label{display:block;margin-bottom:var(--wg-spacing-sm);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1)}.wg__goto-input{width:100%;padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-base);margin-bottom:var(--wg-spacing-md);box-sizing:border-box}.wg__goto-input:focus{outline:none;border-color:var(--wg-accent-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--wg-accent-color) 20%,transparent)}.wg__goto-buttons{display:flex;gap:var(--wg-spacing-sm);justify-content:flex-end}.wg__goto-btn{padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-sm);cursor:pointer;background:var(--wg-surface-1);color:var(--wg-text-color-1)}.wg__goto-btn:hover{background:var(--wg-surface-2)}.wg__goto-btn--go{background:var(--wg-accent-color);border-color:var(--wg-accent-color);color:var(--wg-text-on-accent)}.wg__goto-btn--go:hover{background:var(--wg-accent-color-hover)}.wg__spacer-top td,.wg__spacer-bottom td{padding:0;border:none;background:transparent;height:inherit;line-height:0}:host{--wg-tree-indent: 1.6rem;--wg-tree-chevron-size: 1.6rem;--wg-tree-chevron-color: var(--wg-text-color-2);--wg-tree-chevron-gap: var(--wg-spacing-xs)}.wg__tree-cell{position:relative;width:100%;min-width:0;box-sizing:border-box;min-height:100%}.wg__tree-cell-content{overflow:hidden;text-overflow:inherit;white-space:inherit}.wg__tree-chevron{position:absolute;top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:var(--wg-tree-chevron-size);height:var(--wg-tree-chevron-size);padding:0;border:0;background:transparent;color:var(--wg-tree-chevron-color);font-size:.9em;line-height:1;cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:3px}.wg__tree-chevron:hover:not(.wg__tree-chevron--leaf){background:var(--wg-hover-bg)}.wg__tree-chevron--leaf{cursor:default;pointer-events:none;background:transparent}.wg__cell--editing .wg__tree-chevron{display:none}.wg__cell--editing .wg__tree-cell{display:contents}@media (prefers-color-scheme: dark){:host{--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86;--wg-dirty-indicator-color: #ffa940;--wg-dirty-cell-bg: rgba(255, 169, 64, .12);--wg-dirty-row-number-border-color: #ffa940}}:host([data-theme="dark"]),:host-context([data-theme="dark"]),:host([data-bs-theme="dark"]),:host-context([data-bs-theme="dark"]),:host-context(.dark){--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86;--wg-dirty-indicator-color: #ffa940;--wg-dirty-row-number-border-color: #ffa940}:host([data-theme="light"]),:host-context([data-theme="light"]),:host([data-bs-theme="light"]),:host-context([data-bs-theme="light"]),:host-context(.light){--wg-surface-1: var(--base-main-bg, #ffffff);--wg-surface-2: var(--base-elevated-bg, #f5f5f5);--wg-surface-3: var(--base-hover-bg, #ebebeb);--wg-surface-floating: var(--base-dropdown-bg, var(--base-main-bg, #ffffff));--wg-text-color-1: var(--base-text-color-1, #242424);--wg-text-color-2: var(--base-text-color-2, #424242);--wg-text-color-3: var(--base-text-color-3, #707070);--wg-border-color: var(--base-border-color, #e0e0e0);--wg-border-color-hover: var(--base-border-color, #d1d1d1);--wg-input-bg: var(--base-input-bg, #ffffff);--wg-input-border: var(--base-input-border, 1px solid #d1d1d1);--wg-hover-bg: var(--base-hover-bg, #f0f0f0);--wg-active-bg: var(--base-hover-bg, #e0e0e0);--wg-danger-bg-light: var(--base-danger-bg-light, #fde7e9);--wg-danger-color: var(--base-danger-color, #d13438)}';function gt(t,e,o){const i=o.valueMember||"value",r=e.find(s=>s[i]===t);return r?We(r,o):t!=null?String(t):""}function We(t,e){if(e.getDisplayCallback)return e.getDisplayCallback(t);const o=e.displayMember||"label";return String(t[o]??t.label??"")}function Ae(t,e){if(e.getValueCallback)return e.getValueCallback(t);const o=e.valueMember||"value";return t[o]??t.value}function Yn(t,e){return e.getIconCallback?e.getIconCallback(t):e.iconMember&&t[e.iconMember]||null}function Un(t,e){return e.getSubtitleCallback?e.getSubtitleCallback(t):e.subtitleMember&&t[e.subtitleMember]||null}function ae(t,e){return e.getDisabledCallback?e.getDisabledCallback(t):e.disabledMember?!!t[e.disabledMember]:!1}function so(t,e,o,i,r,s,n=!0){const l=i.editor==="select"||i.editor==="combobox"||i.editor==="autocomplete",a=i.editor==="date",d=i.editor==="checkbox",c=String(i.field);if(d){if(i.formatCallback)return`<span class="wg__cell-text">${t.escapeHtml(r)}</span>`;const g=t.grid.displayItems[e],h=g?t.grid.getCellRawValue(g,e,c):!1,f=i.editorOptions||{},w=f.trueValue!==void 0?f.trueValue:!0;return`
|
|
308
308
|
<input
|
|
309
309
|
type="checkbox"
|
|
310
310
|
class="wg__checkbox-display${n?"":" wg__checkbox-display--readonly"}"
|
|
311
311
|
${h===w?"checked":""}
|
|
312
312
|
disabled
|
|
313
313
|
tabindex="-1"
|
|
314
|
-
data-row="${
|
|
314
|
+
data-row="${e}"
|
|
315
315
|
data-field="${c}"
|
|
316
316
|
/>
|
|
317
|
-
`}if(l){const g=
|
|
318
|
-
<div class="wg__cell-dropdown-display ${v}" data-row="${
|
|
319
|
-
<span class="wg__select-value">${
|
|
317
|
+
`}if(l){const g=t.grid.displayItems[e],h=g?t.grid.getCellRawValue(g,e,c):void 0,f=i.editorOptions||{},w=f.initialOptions||f.options||[],p=gt(h,w,f),v=t.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-dropdown-display--toggle-on-focus":"",y=n?'<span class="wg__select-toggle">▼</span>':"";return`
|
|
318
|
+
<div class="wg__cell-dropdown-display ${v}" data-row="${e}" data-field="${c}">
|
|
319
|
+
<span class="wg__select-value">${t.escapeHtml(p)}</span>
|
|
320
320
|
${y}
|
|
321
321
|
</div>
|
|
322
|
-
`}if(a){const h=
|
|
322
|
+
`}if(a){const h=t.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-date-display--toggle-on-focus":"",f=n?`<button type="button" class="wg__date-trigger" tabindex="-1">
|
|
323
323
|
<svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM9 10H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm-8 4H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2z"/></svg>
|
|
324
324
|
</button>`:"";return`
|
|
325
|
-
<div class="wg__cell-date-display ${h}" data-row="${
|
|
326
|
-
<span class="wg__date-value">${
|
|
325
|
+
<div class="wg__cell-date-display ${h}" data-row="${e}" data-field="${c}">
|
|
326
|
+
<span class="wg__date-value">${t.escapeHtml(r)}</span>
|
|
327
327
|
${f}
|
|
328
328
|
</div>
|
|
329
|
-
`}const u=i.maxLines?`style="-webkit-line-clamp: ${i.maxLines}"`:"";return i.templateCallback?`<span class="wg__cell-text" ${u}>${r}</span>`:`<span class="wg__cell-text" ${u}>${
|
|
329
|
+
`}const u=i.maxLines?`style="-webkit-line-clamp: ${i.maxLines}"`:"";return i.templateCallback?`<span class="wg__cell-text" ${u}>${r}</span>`:`<span class="wg__cell-text" ${u}>${t.escapeHtml(r)}</span>`}function Mt(t,e,o,i){if(!e.isTree||!t.grid.isTreeMode)return i;const r=t.grid.getRowTreeInfo(o);if(!r)return i;const s=t.grid.isPathExpanded(r.path),n=`calc(${r.level} * var(--wg-tree-indent))`,l=`calc(${n} + var(--wg-tree-chevron-size) + var(--wg-tree-chevron-gap))`,a=t.grid.getTreeChevronHtml(o,s,r.hasChildren,r.level,r.path);let d;return r.hasChildren?d=`<button type="button" class="wg__tree-chevron" style="left: ${n}" data-tree-toggle="${t.escapeHtml(r.path)}" tabindex="-1" aria-label="${s?"Collapse":"Expand"}">${a}</button>`:d=`<span class="wg__tree-chevron wg__tree-chevron--leaf" style="left: ${n}" aria-hidden="true">${a}</span>`,`<div class="wg__tree-cell" style="padding-left: ${l}">${d}<div class="wg__tree-cell-content">${i}</div></div>`}function lo(t,e){if(typeof e=="number")return t.left+t.width*e;const o=document.createElement("div");o.style.cssText=`position:fixed;left:0;top:0;width:${e};height:0;visibility:hidden;pointer-events:none`,document.body.appendChild(o);const i=o.getBoundingClientRect().width;return o.remove(),t.left+i}let ee={path:null,arrowPos:null,arrowDir:"right"};const ut={add:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M8 3v10M3 8h10"/></svg>',delete:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M3 3l10 10M13 3L3 13"/></svg>',duplicate:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="5" width="8" height="8" rx="1"/><path d="M3 11V4a1 1 0 011-1h7"/></svg>',moveUp:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 13V3M4 7l4-4 4 4"/></svg>',moveDown:'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3v10M4 9l4 4 4-4"/></svg>'},Kn={add:{icon:ut.add,title:"Add row"},delete:{icon:ut.delete,title:"Delete row",danger:!0},duplicate:{icon:ut.duplicate,title:"Duplicate row"},moveUp:{icon:ut.moveUp,title:"Move up"},moveDown:{icon:ut.moveDown,title:"Move down"}};function Ze(t){return t.map((e,o)=>{if(typeof e=="string"){const i=Kn[e];return i?{id:e,icon:i.icon,title:i.title,row:1,group:1,type:e,danger:i.danger}:(console.warn(`Unknown predefined toolbar action: ${e}`),null)}return{id:e.id||`toolbar-item-${o}`,icon:e.icon,title:e.title,label:e.label,row:e.row??1,group:e.group??1,type:e.type,danger:e.danger,disabled:e.disabled,hidden:e.hidden,onclick:e.onclick,tooltip:e.tooltip,tooltipCallback:e.tooltipCallback}}).filter(e=>e!==null)}function jn(t){const e=new Map;for(const r of t){const s=r.row;e.has(s)||e.set(s,[]),e.get(s).push(r)}const o=[],i=[...e.keys()].sort((r,s)=>r-s);for(const r of i){const s=e.get(r),n=new Map;for(const a of s){const d=a.group;n.has(d)||n.set(d,[]),n.get(d).push(a)}const l=[...n.keys()].sort((a,d)=>a-d);o.push({rowNum:r,groups:l.map(a=>({groupNum:a,items:n.get(a)}))})}return o}function Xn(t){return t.replace(/\+/g," + ")}function Gn(t,e){var r,s;const o=[];o.push(`<span class="wg__tooltip-title">${t.title}</span>`),(r=t.tooltip)!=null&&r.description&&o.push(`<div class="wg__tooltip-desc">${t.tooltip.description}</div>`);const i=((s=t.tooltip)==null?void 0:s.shortcut)||e;return i&&o.push(`<div class="wg__tooltip-shortcut">${Xn(i)}</div>`),o.join("")}function ii(t,e,o,i=!1){let r=jn(t);return i&&(r=r.reverse()),`<div class="wg__toolbar">${r.map(({groups:n})=>`<div class="wg__toolbar-row">${n.map(({items:a},d)=>{const c=d>0?'<div class="wg__toolbar-divider"></div>':"",u=a.map(g=>{const h=typeof g.disabled=="function"?g.disabled(e,o):g.disabled,f=["wg__toolbar-btn",g.danger?"wg__toolbar-btn--danger":""].filter(Boolean).join(" "),w=g.label?`<span class="wg__toolbar-label">${g.label}</span>`:"",p=g.minWidth?` style="min-width: ${g.minWidth}"`:"";return`<button
|
|
330
330
|
class="${f}"
|
|
331
331
|
data-toolbar-item="${g.id}"
|
|
332
332
|
title="${g.title}"
|
|
333
333
|
${h?"disabled":""}${p}
|
|
334
|
-
>${g.icon}${w}</button>`}).join("");return c+u}).join("")}</div>`).join("")}</div>`}let F=null;function Qn(e,
|
|
335
|
-
class="wg__toolbar-trigger ${
|
|
336
|
-
data-toolbar-trigger="${
|
|
334
|
+
>${g.icon}${w}</button>`}).join("");return c+u}).join("")}</div>`).join("")}</div>`}let F=null;function Qn(t,e,o,i,r,s,n){$t();const l=t.grid.toolbarVerticalAlign!=="top",a=ii(i,r,o,l),d=document.createElement("div");d.className="wg__toolbar-container",t.grid.toolbarBtnMinWidth&&d.style.setProperty("--wg-toolbar-btn-min-width",t.grid.toolbarBtnMinWidth),d.innerHTML=a,t.shadow.appendChild(d);const c=d.querySelector(".wg__toolbar"),u=t.grid.toolbarPosition;let g=u==="top"?"top":u==="right"?"right":"left";c.style.position="fixed",c.style.visibility="hidden",requestAnimationFrame(()=>{const f=t.shadow.querySelector(`tr[data-row-index="${o}"]`);if(!f){$t();return}const w=t.grid.toolbarPosition,p=t.grid.toolbarVerticalAlign,m=t.grid.toolbarHorizontalAlign;let v,y,C="";p==="top"?C="-end":p==="bottom"&&(C="-start");const S=()=>m==="start"?"top-start":m==="end"?"top-end":"top";w==="left"?(v=`left${C}`,y=[`right${C}`,S()]):w==="right"?(v=`right${C}`,y=[`left${C}`,S()]):w==="top"?(v=S(),y=[`left${C}`,`right${C}`]):(v=`left${C}`,y=[`right${C}`,S()]);let _=f;const x=t.grid.toolbarColumn;if(w==="top"){if(x!==void 0){const k=f.querySelectorAll(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");let I=null;if(typeof x=="number")I=k[x]||null;else for(let E=0;E<k.length;E++){const R=k[E];if(R.dataset.field===x){I=R;break}}if(I){const E=I.getBoundingClientRect();_={getBoundingClientRect:()=>({x:E.left+E.width/2,y:E.top,top:E.top,left:E.left+E.width/2,bottom:E.bottom,right:E.left+E.width/2,width:0,height:E.height,toJSON:()=>({})})}}}else if(m==="cursor"&&n!==void 0){const k=f.getBoundingClientRect();_={getBoundingClientRect:()=>({x:n,y:k.top,top:k.top,left:n,bottom:k.bottom,right:n,width:0,height:k.height,toJSON:()=>({})})}}}Ne(_,c,{strategy:"fixed",placement:v,middleware:[Ve({fallbackPlacements:y}),st({padding:8})]}).then(({x:k,y:I,placement:E})=>{let R=k;if((t.grid.toolbarFollowsCursor||t.grid.cellToolbar)&&E.startsWith("top")&&n!==void 0&&t.grid.toolbarColumn===void 0){const D=f.querySelectorAll(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");for(const L of D){const M=L.getBoundingClientRect();if(n>=M.left&&n<=M.right){R=lo(M,t.grid.cellToolbarOffset);break}}}Object.assign(c.style,{left:`${R}px`,top:`${I}px`,visibility:"visible"}),g=E.split("-")[0],F&&(F.position=g)}).catch(()=>{c.style.visibility="visible"})});const h=f=>{const w=f.target.closest(".wg__toolbar-btn");if(w&&!w.disabled){const p=w.dataset.toolbarItem||"",m=i.find(v=>v.id===p);m&&s(m,f,w)}};d.addEventListener("click",h),F={container:d,toolbar:c,rowIndex:o,rowItem:r,position:g,hasRowMoved:!1,cursorX:n,cleanup:()=>{d.removeEventListener("click",h),d.remove()}},ee={path:null,arrowPos:null,arrowDir:"right"}}function $t(){F&&(F.cleanup(),F=null),ee={path:null,arrowPos:null,arrowDir:"right"}}function Ye(){return(F==null?void 0:F.rowIndex)??null}function ri(t){return(F==null?void 0:F.container.getRootNode())===t}function ao(t){return(F==null?void 0:F.rowIndex)===t}function Jn(){return ee}function Zn(){return F?{toolbar:F.toolbar,container:F.container}:null}function co(t,e,o="center"){if(!F||F.position!=="top")return;const i=F.toolbar,r=i.getBoundingClientRect();let s;o==="start"?s=t:s=t-r.width/2;const n=8,l=window.innerWidth-r.width-8;s=Math.max(n,Math.min(l,s)),i.style.left=`${s}px`,F.cursorX=t}function ni(t,e){if(!F){ee={path:null,arrowPos:null,arrowDir:"right"};return}const{toolbar:o,rowItem:i,position:r}=F,s=e.findIndex(S=>S===i);if(s===-1){ee={path:null,arrowPos:null,arrowDir:"right"};return}const n=t.shadow.querySelector(`tr[data-row-index="${s}"]`);if(!n){ee={path:null,arrowPos:null,arrowDir:"right"};return}if(s===F.rowIndex||(F.hasRowMoved=!0),!F.hasRowMoved){ee={path:null,arrowPos:null,arrowDir:"right"};return}const a=o.getBoundingClientRect(),d=n.getBoundingClientRect(),c=t.shadow.querySelector(".wg__table"),u=c==null?void 0:c.getBoundingClientRect(),g=t.shadow.querySelector(".wg"),h=g==null?void 0:g.getBoundingClientRect();if(!u||!h){ee={path:null,arrowPos:null,arrowDir:"right"};return}const f=document.dir==="rtl"||document.documentElement.dir==="rtl",w=d.top+d.height/2,p=d.bottom<=h.top,m=d.top>=h.bottom,v=!p&&!m;let y,C="right";if(p?(y=h.top+8,C="up"):m?(y=h.bottom-8,C="down"):y=w,r==="left"){const S=a.right,_=a.top+a.height/2,x=f?h.right+15:h.left-15;if(!v){ee={path:`M ${S} ${_} H ${x} V ${y}`,arrowPos:{x,y},arrowDir:C};return}const k=f?h.right-8:h.left+8;C=f?"left":"right",ee={path:`M ${S} ${_} H ${x} V ${y} H ${k}`,arrowPos:{x:k,y},arrowDir:C};return}else if(r==="right"){const S=a.left,_=a.top+a.height/2,x=f?h.left-15:h.right+15;if(!v){ee={path:`M ${S} ${_} H ${x} V ${y}`,arrowPos:{x,y},arrowDir:C};return}const k=f?h.left+8:h.right-8;C=f?"right":"left",ee={path:`M ${S} ${_} H ${x} V ${y} H ${k}`,arrowPos:{x:k,y},arrowDir:C};return}else{const _=a.right,x=a.top+a.height/2,k=_+48,I=s-F.rowIndex,E=8;if(I===0){let R=d.top-E;m&&(R=h.bottom-E),ee={path:`M ${_} ${x} H ${k} V ${R}`,arrowPos:{x:k,y:R},arrowDir:"down"};return}else if(I===-1){const D=a.top+a.height*.25,L=a.top+a.height*.75,M=a.right+24,z=a.right+E;ee={path:`M ${a.right} ${D} H ${M} V ${L} H ${z}`,arrowPos:{x:z,y:L},arrowDir:"left"};return}else if(I<0){let R=d.bottom+E;p&&(R=h.top+E),ee={path:`M ${_} ${x} H ${k} V ${R}`,arrowPos:{x:k,y:R},arrowDir:"up"};return}else{let R=d.top-E;m&&(R=h.bottom-E),ee={path:`M ${_} ${x} H ${k} V ${R}`,arrowPos:{x:k,y:R},arrowDir:"down"};return}}}function si(t,e,o="Row actions"){return`<button
|
|
335
|
+
class="wg__toolbar-trigger ${e?"wg__toolbar-trigger--active":""}"
|
|
336
|
+
data-toolbar-trigger="${t}"
|
|
337
337
|
title="${o}"
|
|
338
|
-
>⋮</button>`}const
|
|
339
|
-
<th class="${
|
|
338
|
+
>⋮</button>`}const go=40;function uo(t){if(!t||t==="auto")return 150;const e=t.match(/^([\d.]+)(px|em|rem|%)?$/);if(!e)return 150;const o=parseFloat(e[1]);switch(e[2]||"px"){case"px":return o;case"em":return o*16;case"rem":return o*10;case"%":return 150;default:return o}}function es(t){const e=["wg"];return t.grid.isStriped&&e.push("wg--striped"),t.grid.isHoverable&&e.push("wg--hoverable"),t.grid.isEditable&&e.push("wg--editable"),t.grid.isNavigateMode&&e.push("wg--navigate-mode"),t.grid.isColumnReorderAllowed&&e.push("wg--reorderable"),t.grid.isScrollable&&e.push("wg--scrollable"),t.grid.tableBorderOnly&&e.push("wg--table-border-only"),e.join(" ")}function ts(t){const e=t.grid.visualColumns;if(e.length===0)return"";let o=0,i="";if(t.grid.isRowNumbersVisible){const d=t.grid.isStickyRowNumbers;i=`<th class="wg__header wg__row-number-header${d?" wg__header--frozen":""}" style="${d?"position: sticky; left: 0; z-index: 4;":""}">#</th>`,o+=go}const r=t.grid.isRowToolbarVisible&&t.grid.toolbarPosition==="inline";let s="";if(r){const d=Ze(t.grid.rowToolbar),c=new Map;for(const h of d){const f=h.row??1;c.set(f,(c.get(f)||0)+1)}const u=Math.max(1,...c.values());s=`<th class="wg__header wg__inline-actions-header" style="width: ${`calc(${u} * var(--wg-toolbar-btn-min-width) + ${Math.max(0,u-1)} * var(--wg-inline-actions-gap) + 2 * var(--wg-spacing-sm))`}">${t.escapeHtml(t.grid.inlineActionsTitle??t.grid.labels.inlineActionsHeader)}</th>`}const l=t.grid.isRowToolbarVisible&&t.grid.toolbarTrigger==="button"&&t.grid.toolbarPosition!=="inline"?'<th class="wg__header wg__actions-column"></th>':"",a=e.map(({column:d,originalIndex:c},u)=>{const g=String(d.field),h=d.isSortable!==!1&&t.grid.sortMode!=="none",f=t.grid.getColumnSortState(g),w=t.grid.getColumnSortPriority(g),p=f!==void 0,m=t.grid.isColumnFrozen(u),v=m&&u===t.grid.totalFrozenColumns-1,y=t.grid.isColumnSelected(u),C=["wg__header"];h&&C.push("wg__header--sortable"),p&&C.push("wg__header--sorted"),m&&C.push("wg__header--frozen"),v&&C.push("wg__header--frozen-last"),y&&C.push("wg__header--selected");const _=t.grid.getColumnWidth(g)||d.width||d.maxWidth,x=uo(_),k=d.minWidth,I=d.headerHorizontalAlign||d.horizontalAlign||"left",E=d.headerVerticalAlign||d.verticalAlign||"middle",D=`style="${[m?"position: sticky":"",m?`left: ${o}px`:"",m?"z-index: 2":"",_?`width: ${_}`:"",_?`max-width: ${_}`:"",k?`min-width: ${k}`:"",`text-align: ${I}`,`vertical-align: ${E}`].filter(Boolean).join("; ")}"`;m&&(o+=x);let L="";if(h)if(p){const T=f.direction==="asc"?"▲":"▼",P=t.grid.sort.length>1?`<sup class="wg__sort-priority">${w}</sup>`:"";L=`<span class="wg__sort-indicator">${T}${P}</span>`}else L='<span class="wg__sort-indicator wg__sort-placeholder">⬍</span>';let M="";d.headerInfo&&(M=`<span class="wg__header-info" data-tooltip="${t.escapeHtml(d.headerInfo)}"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg></span>`);const X=`<div class="wg__resize-handle${d.isResizable!==!1?"":" wg__resize-handle--disabled"}" data-field="${g}"></div>`;return`
|
|
339
|
+
<th class="${C.join(" ")}" ${D} data-field="${g}">
|
|
340
340
|
<div class="wg__header-container">
|
|
341
|
-
<div class="wg__header-content wg__header-content--align-${
|
|
342
|
-
<span class="wg__header-title">${
|
|
343
|
-
${
|
|
341
|
+
<div class="wg__header-content wg__header-content--align-${I} wg__header-content--valign-${E}">
|
|
342
|
+
<span class="wg__header-title">${t.escapeHtml(d.title)}</span>
|
|
343
|
+
${M}
|
|
344
344
|
</div>
|
|
345
345
|
<div class="wg__header-controls">
|
|
346
|
-
${
|
|
346
|
+
${L}
|
|
347
347
|
</div>
|
|
348
348
|
</div>
|
|
349
|
-
${
|
|
349
|
+
${X}
|
|
350
350
|
</th>
|
|
351
|
-
`}).join("");return`<tr>${i}${s}${l}${a}<th class="wg__filler"> </th></tr>`}function os(
|
|
351
|
+
`}).join("");return`<tr>${i}${s}${l}${a}<th class="wg__filler"> </th></tr>`}function os(t){const e=t.grid.displayItems,o=t.grid.visualColumns,i=t.grid.isRowNumbersVisible,r=t.grid.isStickyRowNumbers,s=t.grid.isRowToolbarVisible&&t.grid.toolbarPosition==="inline",n=t.grid.isRowToolbarVisible&&t.grid.toolbarTrigger==="button"&&t.grid.toolbarPosition!=="inline",l=o.length+(n?1:0)+(i?1:0)+(s?1:0);if(e.length===0)return`
|
|
352
352
|
<tr>
|
|
353
353
|
<td class="wg__empty" colspan="${l}">
|
|
354
354
|
No items to display
|
|
355
355
|
</td>
|
|
356
356
|
</tr>
|
|
357
|
-
`;const a=
|
|
357
|
+
`;const a=Ye(),d=o.map(({column:c})=>uo(c.width||c.maxWidth));return e.map((c,u)=>{const g=t.grid.getRowLockInfo(c),h=(g==null?void 0:g.isLocked)===!0,f=t.grid.isEmptyRowIndex(u);let w=0,p="";if(i){const _=r?"position: sticky; left: 0; z-index: 2;":"",x=r?" wg__cell--frozen":"";if(h){const k=g!=null&&g.lockedBy?`Locked by ${g.lockedBy}`:"This row is locked";p=`<td class="wg__cell wg__row-number wg__row-number--locked${x}" style="${_}" data-tooltip="${t.escapeHtml(k)}" data-row-number="${u}">🔒</td>`}else f?p=`<td class="wg__cell wg__row-number wg__empty-row-indicator${x}" style="${_}" data-row-number="${u}">${t.grid.newRowIndicator}</td>`:p=`<td class="wg__cell wg__row-number${t.grid.isDirtyIndicatorVisible&&t.grid.isRowDirty(u)?" wg__row-number--dirty":""}${x}" style="${_}" data-row-number="${u}">${u+1}</td>`;w+=go}const m=s?li(t,c,u):"";let v="";n&&(v=`
|
|
358
358
|
<td class="wg__cell wg__actions-column">
|
|
359
|
-
${
|
|
359
|
+
${si(u,a===u,t.grid.labels.rowActions)}
|
|
360
360
|
</td>
|
|
361
|
-
`);const y=o.map(({column:_,originalIndex:
|
|
361
|
+
`);const y=o.map(({column:_,originalIndex:x},k)=>{const I=String(_.field),E=t.grid.getCellValue(c,_,u),R=_.horizontalAlign||"left",D=_.verticalAlign||"middle",L=t.grid.canEditCell(u,I),M=t.grid.isCellFocused(u,x),z=t.grid.isColumnFrozen(k),X=z&&k===t.grid.totalFrozenColumns-1,T=_.editTrigger??t.grid.editTrigger,P=["wg__cell"],Y=t.grid.shouldShowEditor(u,x),B=t.grid.isEditing(u,I);if(L&&P.push("wg__cell--editable"),M&&!B&&P.push("wg__cell--focused"),M&&T==="always"&&P.push("wg__cell--always-edit-focused"),_.textOverflow!=="wrap"&&P.push("wg__cell--ellipsis"),_.maxLines&&P.push("wg__cell--line-clamp"),B&&P.push("wg__cell--editing"),t.grid.isCellInvalid(u,I)&&P.push("wg__cell--invalid"),t.grid.isDirtyIndicatorVisible&&t.grid.isCellDirty(u,I)&&P.push("wg__cell--dirty"),t.grid.isCellInSelectedRange(u,k)&&P.push("wg__cell--in-range"),t.grid.isColumnSelected(k)&&P.push("wg__cell--column-selected"),z&&P.push("wg__cell--frozen"),X&&P.push("wg__cell--frozen-last"),_.cellClass&&P.push(_.cellClass),_.cellClassCallback){const N=t.grid.getCellRawValue(c,u,I),me=_.cellClassCallback(N,c);me&&P.push(me)}const Re=t.grid.getColumnWidth(I)||_.width,te=_.minWidth,Fe=[z?"position: sticky":"",z?`left: ${w}px`:"",z?"z-index: 1":"",`text-align: ${R}`,`vertical-align: ${D}`,Re?`width: ${Re}`:"",te?`min-width: ${te}`:"",_.maxWidth?`max-width: ${_.maxWidth}`:""].filter(Boolean).join("; ");z&&(w+=d[k]);const De=t.grid.isNavigateMode?'tabindex="0"':"";let re="";if(_.tooltipCallback){const N=t.grid.getCellRawValue(c,u,I),me=_.tooltipCallback(N,c);me&&(re=`${_.isTooltipHtml?"data-tooltip-html":"data-tooltip"}="${t.escapeHtml(me)}"`)}else if(_.tooltipMember){const N=c[_.tooltipMember];N&&typeof N=="string"&&(re=`${_.isTooltipHtml?"data-tooltip-html":"data-tooltip"}="${t.escapeHtml(N)}"`)}if(!re&&t.grid.isCellInvalid(u,I)){const N=t.grid.getCellValidationError(u,I);if(N){const me=_.validationTooltipCallback||t.grid.validationTooltipCallback;if(me){const bt=t.grid.getCellRawValue(c,u,I),Ro=me({field:I,error:N,value:bt,row:c,rowIndex:u});Ro&&(re=`data-tooltip-html="${t.escapeHtml(Ro)}"`)}re||(re=`data-tooltip="${t.escapeHtml(N)}"`)}}const Eo=Y?Lt(t,u,x,_):so(t,u,x,_,E,M,L),Io=Mt(t,_,c,Eo);return`
|
|
362
362
|
<td
|
|
363
|
-
class="${
|
|
364
|
-
style="${
|
|
363
|
+
class="${P.join(" ")}"
|
|
364
|
+
style="${Fe}"
|
|
365
365
|
data-row="${u}"
|
|
366
|
-
data-col="${
|
|
367
|
-
data-field="${
|
|
366
|
+
data-col="${x}"
|
|
367
|
+
data-field="${I}"
|
|
368
368
|
${De}
|
|
369
|
-
${
|
|
369
|
+
${re}
|
|
370
370
|
>
|
|
371
|
-
${
|
|
371
|
+
${Io}
|
|
372
372
|
</td>
|
|
373
|
-
`}).join(""),
|
|
373
|
+
`}).join(""),C=["wg__row"];if(h&&C.push("wg__row--locked"),f&&C.push("wg__row--empty-row"),t.grid.isRowSelected(u)&&C.push("wg__row--selected"),t.grid.isRowFocused(u)&&C.push("wg__row--focused"),t.grid.rowClassCallback){const _=t.grid.rowClassCallback(c,u);_&&C.push(_)}const S=h&&!i?`data-tooltip="${t.escapeHtml(g!=null&&g.lockedBy?`Locked by ${g.lockedBy}`:"This row is locked")}"`:"";return`<tr class="${C.join(" ")}" data-row-index="${u}" ${S}>${p}${m}${v}${y}<td class="wg__cell wg__filler" data-row="${u}"></td></tr>`}).join("")}function li(t,e,o){const r=Ze(t.grid.rowToolbar).filter(a=>typeof a.hidden=="function"?!a.hidden(e,o):!a.hidden),s=new Map;for(const a of r){const d=a.row??1;s.has(d)||s.set(d,[]),s.get(d).push(a)}return`<td class="wg__cell wg__inline-actions-cell"><div class="wg__inline-actions-wrap">${[...s.keys()].sort((a,d)=>a-d).map(a=>`<div class="wg__inline-actions-row">${s.get(a).map(u=>{const g=typeof u.disabled=="function"?u.disabled(e,o):u.disabled,h=["wg__inline-action-btn",u.danger?"wg__inline-action-btn--danger":"",g?"wg__inline-action-btn--disabled":""].filter(Boolean).join(" "),f=g?"disabled":"";return`<button class="${h}" data-action-id="${u.id}" data-row="${o}" title="${t.escapeHtml(u.title)}" ${f}>${u.icon}</button>`}).join("")}</div>`).join("")}</div></td>`}function ai(t,e){const o=t.grid.displayItems,i=t.grid.visualColumns,{startIndex:r,endIndex:s,rowHeight:n,totalItems:l}=e,a=t.grid.isRowNumbersVisible,d=t.grid.isStickyRowNumbers,c=t.grid.isRowToolbarVisible&&t.grid.toolbarPosition==="inline",u=t.grid.isRowToolbarVisible&&t.grid.toolbarTrigger==="button"&&t.grid.toolbarPosition!=="inline",g=i.length+(u?1:0)+(a?1:0)+(c?1:0);if(o.length===0)return`
|
|
374
374
|
<tr>
|
|
375
375
|
<td class="wg__empty" colspan="${g}">
|
|
376
376
|
No items to display
|
|
377
377
|
</td>
|
|
378
378
|
</tr>
|
|
379
|
-
`;const h=
|
|
379
|
+
`;const h=Ye(),f=i.map(({column:C})=>uo(C.width||C.maxWidth)),w=r*n,p=(l-s)*n,m=w>0?`<tr class="wg__spacer-top"><td colspan="${g}" style="height: ${w}px"></td></tr>`:"",v=[];for(let C=r;C<s&&C<o.length;C++){const S=o[C],_=C,x=t.grid.getRowLockInfo(S),k=(x==null?void 0:x.isLocked)===!0,I=t.grid.isEmptyRowIndex(_);let E=0,R="";if(a){const T=d?"position: sticky; left: 0; z-index: 2;":"",P=d?" wg__cell--frozen":"";if(k){const Y=x!=null&&x.lockedBy?`Locked by ${x.lockedBy}`:"This row is locked";R=`<td class="wg__cell wg__row-number wg__row-number--locked${P}" style="${T}" data-tooltip="${t.escapeHtml(Y)}" data-row-number="${_}">🔒</td>`}else I?R=`<td class="wg__cell wg__row-number wg__empty-row-indicator${P}" style="${T}" data-row-number="${_}">${t.grid.newRowIndicator}</td>`:R=`<td class="wg__cell wg__row-number${t.grid.isDirtyIndicatorVisible&&t.grid.isRowDirty(_)?" wg__row-number--dirty":""}${P}" style="${T}" data-row-number="${_}">${_+1}</td>`;E+=go}const D=c?li(t,S,_):"";let L="";u&&(L=`
|
|
380
380
|
<td class="wg__cell wg__actions-column">
|
|
381
|
-
${
|
|
381
|
+
${si(_,h===_,t.grid.labels.rowActions)}
|
|
382
382
|
</td>
|
|
383
|
-
`);const
|
|
383
|
+
`);const M=i.map(({column:T,originalIndex:P},Y)=>{const B=String(T.field),G=t.grid.getCellValue(S,T,_),Re=T.horizontalAlign||"left",te=T.verticalAlign||"middle",Fe=t.grid.canEditCell(_,B),De=t.grid.isCellFocused(_,P),re=t.grid.isColumnFrozen(Y),Eo=re&&Y===t.grid.totalFrozenColumns-1,Io=T.editTrigger??t.grid.editTrigger,N=["wg__cell"],me=t.grid.shouldShowEditor(_,P),bt=t.grid.isEditing(_,B);if(Fe&&N.push("wg__cell--editable"),De&&!bt&&N.push("wg__cell--focused"),De&&Io==="always"&&N.push("wg__cell--always-edit-focused"),T.textOverflow!=="wrap"&&N.push("wg__cell--ellipsis"),T.maxLines&&N.push("wg__cell--line-clamp"),bt&&N.push("wg__cell--editing"),t.grid.isCellInvalid(_,B)&&N.push("wg__cell--invalid"),t.grid.isDirtyIndicatorVisible&&t.grid.isCellDirty(_,B)&&N.push("wg__cell--dirty"),t.grid.isCellInSelectedRange(_,Y)&&N.push("wg__cell--in-range"),t.grid.isColumnSelected(Y)&&N.push("wg__cell--column-selected"),re&&N.push("wg__cell--frozen"),Eo&&N.push("wg__cell--frozen-last"),T.cellClass&&N.push(T.cellClass),T.cellClassCallback){const be=t.grid.getCellRawValue(S,_,B),Te=T.cellClassCallback(be,S);Te&&N.push(Te)}const rr=t.grid.getColumnWidth(B)||T.width,nr=T.minWidth,va=[re?"position: sticky":"",re?`left: ${E}px`:"",re?"z-index: 1":"",`text-align: ${Re}`,`vertical-align: ${te}`,rr?`width: ${rr}`:"",nr?`min-width: ${nr}`:"",T.maxWidth?`max-width: ${T.maxWidth}`:""].filter(Boolean).join("; ");re&&(E+=f[Y]);const ya=t.grid.isNavigateMode?'tabindex="0"':"";let Ue="";if(T.tooltipCallback){const be=t.grid.getCellRawValue(S,_,B),Te=T.tooltipCallback(be,S);Te&&(Ue=`${T.isTooltipHtml?"data-tooltip-html":"data-tooltip"}="${t.escapeHtml(Te)}"`)}else if(T.tooltipMember){const be=S[T.tooltipMember];be&&typeof be=="string"&&(Ue=`${T.isTooltipHtml?"data-tooltip-html":"data-tooltip"}="${t.escapeHtml(be)}"`)}if(!Ue&&t.grid.isCellInvalid(_,B)){const be=t.grid.getCellValidationError(_,B);if(be){const Te=T.validationTooltipCallback||t.grid.validationTooltipCallback;if(Te){const sr=t.grid.getCellRawValue(S,_,B),lr=Te({field:B,error:be,value:sr,row:S,rowIndex:_});lr&&(Ue=`data-tooltip-html="${t.escapeHtml(lr)}"`)}Ue||(Ue=`data-tooltip="${t.escapeHtml(be)}"`)}}const Ca=me?Lt(t,_,P,T):so(t,_,P,T,G,De,Fe),Sa=Mt(t,T,S,Ca);return`
|
|
384
384
|
<td
|
|
385
|
-
class="${
|
|
385
|
+
class="${N.join(" ")}"
|
|
386
386
|
style="${va}"
|
|
387
387
|
data-row="${_}"
|
|
388
|
-
data-col="${
|
|
388
|
+
data-col="${P}"
|
|
389
389
|
data-field="${B}"
|
|
390
390
|
${ya}
|
|
391
|
-
${
|
|
391
|
+
${Ue}
|
|
392
392
|
>
|
|
393
|
-
${
|
|
393
|
+
${Sa}
|
|
394
394
|
</td>
|
|
395
|
-
`}).join(""),
|
|
395
|
+
`}).join(""),z=["wg__row"];if(k&&z.push("wg__row--locked"),I&&z.push("wg__row--empty-row"),t.grid.isRowSelected(_)&&z.push("wg__row--selected"),t.grid.isRowFocused(_)&&z.push("wg__row--focused"),t.grid.rowClassCallback){const T=t.grid.rowClassCallback(S,_);T&&z.push(T)}const X=k&&!a?`data-tooltip="${t.escapeHtml(x!=null&&x.lockedBy?`Locked by ${x.lockedBy}`:"This row is locked")}"`:"";v.push(`<tr class="${z.join(" ")}" data-row-index="${_}" ${X}>${R}${D}${L}${M}<td class="wg__cell wg__filler" data-row="${_}"></td></tr>`)}const y=p>0?`<tr class="wg__spacer-bottom"><td colspan="${g}" style="height: ${p}px"></td></tr>`:"";return m+v.join("")+y}function ho(t,e="bottom-center"){const o=t.grid.showPagination;if(!t.grid.isPageable||o===!1||o==="auto"&&t.grid.totalPages<=1)return"";const i=t.grid.currentPage,r=t.grid.totalPages,s=t.grid.pageSize,n=t.grid.pageSizes,l=t.grid.totalItems!==null?t.grid.totalItems:t.grid.sortedItems.length,a=t.grid.labels,d={first:a.paginationFirst,previous:a.paginationPrevious,next:a.paginationNext,last:a.paginationLast,pageInfo:a.paginationPageInfo.replace("{current}",String(i)).replace("{total}",String(r)),itemCount:a.paginationItemCount.replace("{count}",String(l)),perPage:a.paginationPerPage},c=t.grid.paginationLabelsCallback,u=c?c({currentPage:i,totalPages:r,totalItems:l,pageSize:s}):{},g={...d,...u},h=e.startsWith("top-"),f=e.replace("top-","").replace("bottom-",""),w=["wg__pagination"];f==="left"?w.push("wg__pagination--left"):f==="right"&&w.push("wg__pagination--right"),h&&w.push("wg__pagination--top");const p={first:`
|
|
396
396
|
<button class="wg__pagination-btn" data-action="first" ${i===1?"disabled":""}>
|
|
397
397
|
${g.first}
|
|
398
398
|
</button>
|
|
@@ -420,118 +420,118 @@ toolbarColumn takes priority — cursor following is disabled.`,r)}requestUpdate
|
|
|
420
420
|
</select>
|
|
421
421
|
<span class="wg__pagination-label">${g.perPage}</span>
|
|
422
422
|
</div>
|
|
423
|
-
`:""},v=
|
|
423
|
+
`:""},v=t.grid.paginationLayout.split("|").map(y=>y.trim()).map(y=>p[y]||"").join("");return`<div class="${w.join(" ")}">${v}</div>`}function fo(t,e){const o=t.grid.summaryContentCallback;if(!o)return"";const i=t.grid.currentPage,r=t.grid.pageSize,s=t.grid.sortedItems,n=t.grid.displayItems,l=t.grid.totalItems!==null?t.grid.totalItems:s.length,a=o({items:n,allItems:s,totalItems:l,currentPage:i,pageSize:r,metadata:t.grid.summaryMetadata}),d=e.startsWith("top-"),c=e.replace("top-","").replace("bottom-",""),u=["wg__summary"];return c==="left"?u.push("wg__summary--left"):c==="right"&&u.push("wg__summary--right"),d&&u.push("wg__summary--top"),`<div class="${u.join(" ")}">${a}</div>`}function di(t,e){if(e){let o=t.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger");if(o||(o=t.querySelector(".wg__editor")),o){o.focus({preventScroll:!0}),o instanceof HTMLInputElement&&o.type==="text"&&o.select();return}}t.focus({preventScroll:!0})}function ht(t,e,o){const i=t.grid.columns[o],s=((i==null?void 0:i.editTrigger)??t.grid.editTrigger)==="always";if(t.grid.shouldUseVirtualScroll()){is(t,e);const d=t.shadow.querySelector(`[data-row="${e}"][data-col="${o}"]`);d&&(di(d,s),wo(t,d,e));return}const n=t.shadow.querySelector(`[data-row="${e}"][data-col="${o}"]`);if(!n)return;di(n,s),n.scrollIntoView({block:"nearest",inline:"nearest"});const l=t.shadow.querySelector(".wg__header"),a=t.shadow.querySelector(".wg");if(l&&a){const d=n.getBoundingClientRect(),c=l.getBoundingClientRect();if(d.top<c.bottom){const u=d.top-c.bottom-4;a.scrollBy({top:u,behavior:"instant"})}wo(t,n,e)}}function wo(t,e,o){const i=t.shadow.querySelector(".wg");if(!i)return;const r=t.shadow.querySelector(`tr[data-row-index="${o}"] .wg__cell--frozen-last`);if(!r)return;const s=r.getBoundingClientRect().right,n=e.getBoundingClientRect();n.left<s&&i.scrollBy({left:n.left-s,behavior:"instant"})}function is(t,e){const o=t.shadow.querySelector(".wg");if(!o)return;const i=t.grid.virtualScrollRowHeight,r=o.scrollTop,s=o.clientHeight,n=t.shadow.querySelector(".wg__header"),l=(n==null?void 0:n.offsetHeight)||0,a=e*i,d=a+i,c=r+l,u=r+s;a<c?o.scrollTop=a-l:d>u&&(o.scrollTop=d-s)}let ci=0;const rs=100;function Z(t,e,o){const i=e&&o&&e.rowIndex===o.rowIndex&&e.colIndex===o.colIndex,r=Date.now();if(i&&r-ci<rs)return;ci=r;const s=t.grid.editingCell;if(e){const n=s&&s.rowIndex===e.rowIndex&&t.grid.columns.findIndex(c=>String(c.field)===s.field)===e.colIndex,l=t.grid.columns[e.colIndex],d=((l==null?void 0:l.editTrigger)??t.grid.editTrigger)==="always";if(!n&&!d)H(t,e.rowIndex,e.colIndex);else{const c=t.shadow.querySelector(`td[data-row="${e.rowIndex}"][data-col="${e.colIndex}"]`);c&&c.classList.remove("wg__cell--focused","wg__cell--always-edit-focused")}}if(o){const n=t.grid.columns[o.colIndex],l=(n==null?void 0:n.editTrigger)??t.grid.editTrigger,a=l==="always",d=l==="click"||l==="dblclick";if(!(s&&s.rowIndex===o.rowIndex&&t.grid.columns.findIndex(u=>String(u.field)===s.field)===o.colIndex)&&!a&&!d)H(t,o.rowIndex,o.colIndex);else if(a||d){const u=t.shadow.querySelector(`td[data-row="${o.rowIndex}"][data-col="${o.colIndex}"]`);u&&(u.classList.add("wg__cell--focused"),a&&u.classList.add("wg__cell--always-edit-focused"))}}}function j(t){const e=t.grid.editingCell;if(e){const o=t.grid.columns.findIndex(r=>String(r.field)===e.field),i=t.shadow.querySelector(`[data-row="${e.rowIndex}"][data-col="${o}"]`);i&&i.classList.remove("wg__cell--editing")}}function ns(t,e,o){H(t,e,o)}function ss(t,e,o){if(!t.grid.isNavigateMode)return;const i=t.grid.focusedCell,r={rowIndex:e,colIndex:o};(i==null?void 0:i.rowIndex)===e&&(i==null?void 0:i.colIndex)===o||(t.grid.setFocusedCell(e,o),Z(t,i,r))}function q(t,e,o){const i=t.grid.focusedCell,r={rowIndex:e,colIndex:o};t.grid.setFocusedCell(e,o),Z(t,i,r),ht(t,e,o)}function ie(t,e,o,i){const r=t.grid.columns[o];if(!r)return;const s=String(r.field);if(!t.grid.canEditCell(e,s))return;t.dropdownOpen&&V(t);const n=t.grid.editingCell;if(n){const l=t.grid.columns.findIndex(a=>String(a.field)===n.field);(n.rowIndex!==e||l!==o)&&(t.isTransitioningCells=!0,t.grid.cancelEdit(),H(t,n.rowIndex,l))}t.grid.startEdit(e,s,i),H(t,e,o,{focusEditor:!0,cursorPosition:i==null?void 0:i.cursorPosition,initialSearchQuery:i==null?void 0:i.initialSearchQuery}),t.isTransitioningCells&&requestAnimationFrame(()=>{t.isTransitioningCells=!1})}function et(t,e){const o=e.querySelector(".wg__cell-text, .wg__select-value, .wg__date-value");if(!o)return null;const i=o.textContent||"";if(!i.length)return 0;const r=t.clientX,s=o.getBoundingClientRect();if(r<=s.left)return 0;if(r>=s.right)return i.length;const n=o.firstChild;if(!n||n.nodeType!==Node.TEXT_NODE)return null;const l=document.createRange();let a=0,d=i.length;try{for(;a<d;){const c=Math.floor((a+d)/2);l.setStart(n,0),l.setEnd(n,c),l.getBoundingClientRect().right<r?a=c+1:d=c}if(a>0&&a<i.length){l.setStart(n,a-1),l.setEnd(n,a);const c=l.getBoundingClientRect(),u=c.left+c.width/2;r<u&&a--}}catch{return i.length}return a}function gi(t){if(t.dropdownOpen&&V(t),t.grid.editingCell){const e=t.grid.editingCell,o=t.grid.columns.findIndex(i=>String(i.field)===e.field);j(t),t.grid.cancelEdit(),o>=0&&H(t,e.rowIndex,o)}if(t.grid.focusedCell){const e=t.grid.focusedCell;t.grid.clearFocusedCell(),Z(t,e,null),ke(t.shadow.host)}}function ls(t,e){if(t.isTransitioningCells)return;const o=e.relatedTarget,i=t.shadow.querySelector(".wg__table");o&&(i!=null&&i.contains(o))||requestAnimationFrame(()=>{if(t.isTransitioningCells)return;const r=t.shadow.activeElement;if(r&&(i==null?void 0:i.contains(r)))return;const n=t.shadow.host;if(document.activeElement===n||n.contains(document.activeElement))return;const a=t.grid.focusedCell;t.grid.clearFocusedCell(),Z(t,a,null),ke(n)})}function as(t,e){if(!t)return null;const[o,i,r]=t.split("-").map(Number),s=new Date(o,i-1,r);if(isNaN(s.getTime()))return null;switch(e){case"date":return s;case"timestamp":return s.getTime();case"iso":default:return t}}function Pt(t,e,o){H(t,e,o)}async function At(t,e,o=!1){const i=parseInt(e.dataset.row||"0",10),r=e.dataset.field||"";let s;if(e instanceof HTMLInputElement)if(e.type==="checkbox"){const n=JSON.parse(e.dataset.trueValue||"true"),l=JSON.parse(e.dataset.falseValue||"false");s=e.checked?n:l}else e.classList.contains("wg__editor--number")?s=e.value===""?null:parseFloat(e.value):e.type==="date"?s=as(e.value,e.dataset.outputFormat||"iso"):s=e.value;else e instanceof HTMLSelectElement&&(s=e.value);await t.grid.commitEdit(i,r,s,o)}function ds(t,e){At(t,e)}function cs(t,e,o){console.trace("[LEGACY] toggleCheckboxAndMove");const i=t.grid.columns[o];if(!i)return;const r=String(i.field),s=t.grid.displayItems[e];if(!s)return;const n=i.editorOptions||{},l=n.trueValue??!0,a=n.falseValue??!1,c=s[r]===l?a:l;t.grid.commitEdit(e,r,c),H(t,e,o);const u=t.grid.displayItems;e<u.length-1&&requestAnimationFrame(()=>{q(t,e+1,o)})}async function gs(t,e){if(!t.isCommittingFromKeyboard&&t.grid.editingCell){const o=parseInt(e.dataset.row||"0",10),i=e.dataset.field||"",r=t.grid.columns.findIndex(s=>String(s.field)===i);await At(t,e),r>=0&&Pt(t,o,r)}}function po(t,e,o,i){const s=t.grid.columns.findIndex(d=>String(d.field)===o),n=t.grid.displayItems;let l=e,a=s;if(i==="down"){const d=t.grid.tabTraversalStartColIndex;d!==null&&(a=d,t.grid.tabTraversalStartColIndex=null),l=Math.min(e+1,n.length-1)}else if(i==="up")l=Math.max(e-1,0);else{t.grid.tabTraversalStartColIndex===null&&(t.grid.tabTraversalStartColIndex=s);const d=t.grid.getEditableColumns(),c=d.findIndex(u=>u.index===s);i==="next"?c>=0&&c<d.length-1?a=d[c+1].index:e<n.length-1&&(l=e+1,a=d[0].index):c>0?a=d[c-1].index:e>0&&(l=e-1,a=d[d.length-1].index)}Pt(t,e,s),q(t,l,a),t.isCommittingFromKeyboard=!1}function us(t,e,o){const r=t.grid.columns.findIndex(s=>String(s.field)===o);r>=0&&(Pt(t,e,r),q(t,e,r),t.isCommittingFromKeyboard=!1)}function Lt(t,e,o,i){const r=String(i.field),s=t.grid.displayItems[e],n=t.grid.getCellRawValue(s,e,r);switch(i.editor||"text"){case"checkbox":return ms(t,e,r,n,i);case"number":return fs(t,e,r,n,i);case"date":return ws(t,e,r,n,i);case"select":return bs(t,e,r,n,i);case"combobox":return _s(t,e,r,n,i);case"autocomplete":return vs(t,e,r,n,i);case"custom":return ys(t,e,r,n,i);case"text":default:return hs(t,e,r,n,i)}}function ui(t){return`wg__editor--valign-${t.verticalAlign||"middle"}`}function hs(t,e,o,i,r){var d;const s=r.editorOptions||{},n=(d=t.grid.editingCell)==null?void 0:d.initialSearchQuery,l=n!==void 0?n:i!=null?String(i):"";return`
|
|
424
424
|
<input
|
|
425
425
|
type="text"
|
|
426
|
-
class="wg__editor wg__editor--text ${
|
|
427
|
-
value="${
|
|
428
|
-
data-row="${
|
|
426
|
+
class="wg__editor wg__editor--text ${ui(r)}"
|
|
427
|
+
value="${t.escapeHtml(l)}"
|
|
428
|
+
data-row="${e}"
|
|
429
429
|
data-field="${o}"
|
|
430
430
|
${s.maxLength?`maxlength="${s.maxLength}"`:""}
|
|
431
|
-
${s.placeholder?`placeholder="${
|
|
432
|
-
${s.pattern?`pattern="${
|
|
431
|
+
${s.placeholder?`placeholder="${t.escapeHtml(s.placeholder)}"`:""}
|
|
432
|
+
${s.pattern?`pattern="${t.escapeHtml(s.pattern)}"`:""}
|
|
433
433
|
/>
|
|
434
|
-
`}function fs(e,
|
|
434
|
+
`}function fs(t,e,o,i,r){var a;r.editorOptions;const s=(a=t.grid.editingCell)==null?void 0:a.initialSearchQuery,n=s!==void 0?s:i!=null?String(i):"";return`
|
|
435
435
|
<input
|
|
436
436
|
type="text"
|
|
437
437
|
inputmode="numeric"
|
|
438
|
-
class="wg__editor wg__editor--number ${
|
|
438
|
+
class="wg__editor wg__editor--number ${ui(r)}"
|
|
439
439
|
value="${n}"
|
|
440
|
-
data-row="${
|
|
440
|
+
data-row="${e}"
|
|
441
441
|
data-field="${o}"
|
|
442
442
|
/>
|
|
443
|
-
`}function ws(e,
|
|
444
|
-
<div class="wg__editor wg__editor--date" data-row="${
|
|
443
|
+
`}function ws(t,e,o,i,r){var d;const s=r.editorOptions||{},n=(d=t.grid.editingCell)==null?void 0:d.initialSearchQuery,l=mo(i),a=n!==void 0?n:ps(i,s.dateFormat);return`
|
|
444
|
+
<div class="wg__editor wg__editor--date" data-row="${e}" data-field="${o}">
|
|
445
445
|
<input
|
|
446
446
|
type="text"
|
|
447
447
|
class="wg__date-input"
|
|
448
|
-
value="${
|
|
449
|
-
data-row="${
|
|
448
|
+
value="${t.escapeHtml(a)}"
|
|
449
|
+
data-row="${e}"
|
|
450
450
|
data-field="${o}"
|
|
451
451
|
data-date-value="${l}"
|
|
452
452
|
data-output-format="${s.outputFormat||"iso"}"
|
|
453
453
|
data-date-format="${s.dateFormat||"YYYY-MM-DD"}"
|
|
454
|
-
${s.minDate?`data-min-date="${
|
|
455
|
-
${s.maxDate?`data-max-date="${
|
|
456
|
-
placeholder="${
|
|
454
|
+
${s.minDate?`data-min-date="${mo(s.minDate)}"`:""}
|
|
455
|
+
${s.maxDate?`data-max-date="${mo(s.maxDate)}"`:""}
|
|
456
|
+
placeholder="${t.escapeHtml(s.dateFormat||"YYYY-MM-DD")}"
|
|
457
457
|
/>
|
|
458
458
|
<button type="button" class="wg__date-trigger" tabindex="-1">
|
|
459
459
|
<svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM9 10H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm-8 4H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2z"/></svg>
|
|
460
460
|
</button>
|
|
461
461
|
</div>
|
|
462
|
-
`}function ps(e
|
|
462
|
+
`}function ps(t,e){if(!t)return"";let o=null;if(t instanceof Date?o=t:typeof t=="number"?o=new Date(t):typeof t=="string"&&(o=new Date(t)),!o||isNaN(o.getTime()))return"";const i=e||"YYYY-MM-DD",r=o.getFullYear(),s=String(o.getMonth()+1).padStart(2,"0"),n=String(o.getDate()).padStart(2,"0");return i.replace("YYYY",String(r)).replace("YY",String(r).slice(-2)).replace("MM",s).replace("DD",n)}function mo(t){if(!t)return"";let e=null;if(t instanceof Date?e=t:typeof t=="number"?e=new Date(t):typeof t=="string"&&(e=new Date(t)),!e||isNaN(e.getTime()))return"";const o=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${o}-${i}-${r}`}function ms(t,e,o,i,r){const s=r.editorOptions||{};return`
|
|
463
463
|
<input
|
|
464
464
|
type="checkbox"
|
|
465
465
|
class="wg__editor wg__editor--checkbox"
|
|
466
466
|
${(s.trueValue!==void 0?i===s.trueValue:!!i)?"checked":""}
|
|
467
|
-
data-row="${
|
|
467
|
+
data-row="${e}"
|
|
468
468
|
data-field="${o}"
|
|
469
|
-
data-true-value="${
|
|
470
|
-
data-false-value="${
|
|
469
|
+
data-true-value="${t.escapeHtml(JSON.stringify(s.trueValue??!0))}"
|
|
470
|
+
data-false-value="${t.escapeHtml(JSON.stringify(s.falseValue??!1))}"
|
|
471
471
|
/>
|
|
472
|
-
`}function bs(e,
|
|
472
|
+
`}function bs(t,e,o,i,r){var d;const s=r.editorOptions||{},n=s.options||[],l=gt(i,n,s),a=(d=t.grid.editingCell)==null?void 0:d.initialSearchQuery;return t.dropdownOptions=n,t.filterText=a||"",t.highlightedIndex=n.findIndex(c=>Ae(c,s)===i),t.highlightedIndex<0&&n.length>0&&(t.highlightedIndex=0),`
|
|
473
473
|
<div
|
|
474
474
|
class="wg__editor wg__editor--select wg__select-trigger"
|
|
475
475
|
tabindex="0"
|
|
476
476
|
role="combobox"
|
|
477
477
|
aria-haspopup="listbox"
|
|
478
|
-
data-row="${
|
|
478
|
+
data-row="${e}"
|
|
479
479
|
data-field="${o}"
|
|
480
|
-
data-value="${
|
|
480
|
+
data-value="${t.escapeHtml(String(i??""))}"
|
|
481
481
|
>
|
|
482
|
-
<span class="wg__select-value">${
|
|
482
|
+
<span class="wg__select-value">${t.escapeHtml(l)}</span>
|
|
483
483
|
<span class="wg__select-toggle">▼</span>
|
|
484
484
|
</div>
|
|
485
|
-
`}function _s(e,
|
|
486
|
-
<div class="wg__editor wg__editor--combobox" data-row="${
|
|
485
|
+
`}function _s(t,e,o,i,r){var c;const s=r.editorOptions||{},n=s.options||[],l=gt(i,n,s),a=(c=t.grid.editingCell)==null?void 0:c.initialSearchQuery,d=a!==void 0?a:l;return t.dropdownOptions=n,t.filterText=d,t.highlightedIndex=n.length>0?0:-1,`
|
|
486
|
+
<div class="wg__editor wg__editor--combobox" data-row="${e}" data-field="${o}">
|
|
487
487
|
<input
|
|
488
488
|
type="text"
|
|
489
489
|
class="wg__combobox-input"
|
|
490
|
-
value="${
|
|
491
|
-
data-row="${
|
|
490
|
+
value="${t.escapeHtml(d)}"
|
|
491
|
+
data-row="${e}"
|
|
492
492
|
data-field="${o}"
|
|
493
493
|
/>
|
|
494
494
|
<span class="wg__combobox-toggle">▼</span>
|
|
495
495
|
</div>
|
|
496
|
-
`}function vs(e,
|
|
497
|
-
<div class="wg__editor wg__editor--autocomplete" data-row="${
|
|
496
|
+
`}function vs(t,e,o,i,r){var c;const s=r.editorOptions||{},n=s.initialOptions||s.options||[],l=gt(i,n,s),a=(c=t.grid.editingCell)==null?void 0:c.initialSearchQuery,d=a!==void 0?a:l;return t.dropdownOptions=n,t.filterText=d,t.highlightedIndex=n.length>0?0:-1,`
|
|
497
|
+
<div class="wg__editor wg__editor--autocomplete" data-row="${e}" data-field="${o}">
|
|
498
498
|
<input
|
|
499
499
|
type="text"
|
|
500
500
|
class="wg__autocomplete-input"
|
|
501
|
-
value="${
|
|
502
|
-
placeholder="${
|
|
503
|
-
data-row="${
|
|
501
|
+
value="${t.escapeHtml(d)}"
|
|
502
|
+
placeholder="${t.escapeHtml(s.placeholder||"")}"
|
|
503
|
+
data-row="${e}"
|
|
504
504
|
data-field="${o}"
|
|
505
505
|
/>
|
|
506
506
|
<span class="wg__combobox-toggle">▼</span>
|
|
507
507
|
<span class="wg__loading-indicator" style="display: none;">⏳</span>
|
|
508
508
|
</div>
|
|
509
|
-
`}function ys(e,
|
|
509
|
+
`}function ys(t,e,o,i,r){const s=r.formatCallback?r.formatCallback(i,t.grid.displayItems[e]):i!=null?String(i):"";return`
|
|
510
510
|
<div
|
|
511
511
|
class="wg__editor wg__editor--custom"
|
|
512
512
|
tabindex="0"
|
|
513
|
-
data-row="${
|
|
513
|
+
data-row="${e}"
|
|
514
514
|
data-field="${o}"
|
|
515
515
|
>
|
|
516
|
-
<span class="wg__custom-value">${
|
|
516
|
+
<span class="wg__custom-value">${t.escapeHtml(s)}</span>
|
|
517
517
|
</div>
|
|
518
|
-
`}function H(e,
|
|
518
|
+
`}function H(t,e,o,i={}){const r=t.grid.columns[o];if(!r)return;const s=t.shadow.querySelector(`td[data-row="${e}"][data-col="${o}"]`);if(!s)return;const n=String(r.field),l=t.grid.displayItems[e];if(!l)return;const a=t.grid.shouldShowEditor(e,o),d=t.grid.isEditing(e,n),c=t.grid.isCellFocused(e,o),u=t.grid.canEditCell(e,n),g=t.grid.isCellInvalid(e,n),h=t.grid.visualColumns.findIndex(v=>v.originalIndex===o),f=h>=0&&t.grid.isColumnFrozen(h),w=f&&h===t.grid.totalFrozenColumns-1,p=r.editTrigger??t.grid.editTrigger,m=["wg__cell"];if(u&&m.push("wg__cell--editable"),c&&!d&&m.push("wg__cell--focused"),c&&p==="always"&&m.push("wg__cell--always-edit-focused"),r.textOverflow!=="wrap"&&m.push("wg__cell--ellipsis"),r.maxLines&&m.push("wg__cell--line-clamp"),d&&m.push("wg__cell--editing"),g&&m.push("wg__cell--invalid"),t.grid.isDirtyIndicatorVisible&&t.grid.isCellDirty(e,n)&&m.push("wg__cell--dirty"),h>=0&&t.grid.isCellInSelectedRange(e,h)&&m.push("wg__cell--in-range"),h>=0&&t.grid.isColumnSelected(h)&&m.push("wg__cell--column-selected"),f&&m.push("wg__cell--frozen"),w&&m.push("wg__cell--frozen-last"),r.cellClass&&m.push(r.cellClass),r.cellClassCallback){const v=t.grid.getCellRawValue(l,e,n),y=r.cellClassCallback(v,l);y&&m.push(y)}if(s.className=m.join(" "),a)s.innerHTML=Mt(t,r,l,Lt(t,e,o,r)),i.focusEditor&&Cs(t,s,r,i);else{const v=t.grid.getCellValue(l,r,e);s.innerHTML=Mt(t,r,l,so(t,e,o,r,v,c,u))}}function Cs(t,e,o,i){var s;let r=e.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__select-trigger, .wg__date-input");if(r||(r=e.querySelector(".wg__editor")),!!r&&(r.focus(),r instanceof HTMLInputElement&&r.type==="text")){const n=i.cursorPosition,a=r.classList.contains("wg__combobox-input")||r.classList.contains("wg__autocomplete-input")?"selectAll":void 0,d=((s=o.editorOptions)==null?void 0:s.editStartSelection)||a||t.grid.editStartSelection;if(i.initialSearchQuery!==void 0){const c=r.value.length;r.setSelectionRange(c,c)}else switch(d){case"mousePosition":if(n!==void 0){const c=Math.min(n,r.value.length);r.setSelectionRange(c,c)}else r.setSelectionRange(r.value.length,r.value.length);break;case"cursorAtStart":r.setSelectionRange(0,0);break;case"cursorAtEnd":r.setSelectionRange(r.value.length,r.value.length);break;case"selectAll":default:r.select();break}}}const Ss=5;function xs(t,e){var i,r;switch(e.editor||"text"){case"number":return typeof t=="number"&&!isNaN(t);case"select":case"combobox":{const s=(i=e.editorOptions)==null?void 0:i.options;if(!s||s.length===0)return!0;const n=((r=e.editorOptions)==null?void 0:r.valueMember)||"value";return s.some(l=>l[n]===t)}case"date":{if(t==null||t==="")return!0;if(t instanceof Date)return!isNaN(t.getTime());if(typeof t=="string"){if(!/\d{4}[-/]\d{1,2}[-/]\d{1,2}/.test(t)&&!/\d{1,2}[-/.]\d{1,2}[-/.]\d{2,4}/.test(t))return!1;const s=new Date(t);return!isNaN(s.getTime())}if(typeof t=="number"){const s=new Date("2000-01-01").getTime(),n=new Date("2100-01-01").getTime();if(t<s||t>n)return!1;const l=new Date(t);return!isNaN(l.getTime())}return!1}case"text":case"autocomplete":case"checkbox":case"custom":default:return!0}}let A={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startField:"",startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,handleElement:null,rangeElement:null},Ce=null,ft=null;function zt(t){var p;const e=t.grid.focusedCell,o=t.shadow.host;if(!e||t.grid.editingCell||t.dropdownOpen){ke(o);return}const{rowIndex:i,colIndex:r}=e,s=(p=t.grid.visualColumns[r])==null?void 0:p.column;if(!s||!t.grid.isCellEditable(s)){ke(o);return}const n=t.shadow.querySelector(`[data-row="${i}"][data-col="${r}"]`);if(!n){ke(o);return}const l=t.shadow.querySelector(".wg");if(!l)return;const a=l.getBoundingClientRect(),d=n.getBoundingClientRect(),c=l.scrollLeft,u=l.scrollTop,g=8,h=i===t.grid.displayItems.length-1,f=d.right-a.left+c-g/2,w=h?d.top-a.top+u-g/2:d.bottom-a.top+u-g/2;if(A.handleElement&&A.handleElement.parentElement!==l&&(A.handleElement.remove(),A.handleElement=null,ft=null),!A.handleElement){const m=document.createElement("div");m.className="wg__fill-handle",l.appendChild(m),A.handleElement=m,ft=o,m.addEventListener("mousedown",v=>ks(t,v))}A.handleElement.style.left=`${f}px`,A.handleElement.style.top=`${w}px`}function ke(t){if(A.handleElement){if(t&&ft&&t!==ft)return;A.handleElement.remove(),A.handleElement=null,ft=null}}function ks(t,e){var l;e.preventDefault(),e.stopPropagation();const o=t.grid.focusedCell;if(!o)return;const{rowIndex:i,colIndex:r}=o,n=(l=t.grid.visualColumns[r])==null?void 0:l.column;n&&(A={...A,isPending:!0,isDragging:!1,startRowIndex:i,startColIndex:r,startField:String(n.field),startX:e.clientX,startY:e.clientY,currentRowIndex:i,currentColIndex:r},Ce=t,document.addEventListener("mousemove",hi),document.addEventListener("mouseup",wi),document.addEventListener("keydown",pi))}function hi(t){if(!Ce)return;if(A.isPending){const o=t.clientX-A.startX,i=t.clientY-A.startY;Math.sqrt(o*o+i*i)>=Ss&&Es(Ce);return}if(!A.isDragging)return;const e=Rs(Ce,t.clientX,t.clientY);e&&(e.rowIndex!==A.currentRowIndex||e.colIndex!==A.currentColIndex)&&(A.currentRowIndex=e.rowIndex,A.currentColIndex=e.colIndex,fi(Ce))}function Es(t){A.isPending=!1,A.isDragging=!0;const e=t.shadow.querySelector(".wg");e==null||e.classList.add("wg--filling"),Is(t)}function Is(t){const e=t.shadow.querySelector(".wg");if(!e)return;const o=document.createElement("div");o.className="wg__fill-range",e.appendChild(o),A.rangeElement=o,fi(t)}function fi(t){if(!A.rangeElement)return;const e=t.shadow.querySelector(".wg");if(!e)return;const{startRowIndex:o,startColIndex:i,currentRowIndex:r,currentColIndex:s}=A,n=Math.min(o,r),l=Math.max(o,r),a=Math.min(i,s),d=Math.max(i,s),c=t.shadow.querySelector(`[data-row="${n}"][data-col="${a}"]`),u=t.shadow.querySelector(`[data-row="${l}"][data-col="${d}"]`);if(!c||!u)return;const g=e.getBoundingClientRect(),h=c.getBoundingClientRect(),f=u.getBoundingClientRect(),w=e.scrollLeft,p=e.scrollTop,m=h.left-g.left+w,v=h.top-g.top+p,y=f.right-h.left,C=f.bottom-h.top;A.rangeElement.style.left=`${m}px`,A.rangeElement.style.top=`${v}px`,A.rangeElement.style.width=`${y}px`,A.rangeElement.style.height=`${C}px`}function wi(t){if(!Ce)return;const e=Ce;if(A.isPending){bo(e);return}A.isDragging&&(Ts(e),bo(e))}function pi(t){t.key==="Escape"&&Ce&&(t.preventDefault(),bo(Ce))}function Rs(t,e,o){if(!t.shadow.querySelector(".wg"))return null;const r=t.shadow.querySelectorAll(".wg__cell[data-row][data-col]");for(const s of r){const n=s.getBoundingClientRect();if(e>=n.left&&e<=n.right&&o>=n.top&&o<=n.bottom){const l=parseInt(s.dataset.row||"-1",10),a=parseInt(s.dataset.col||"-1",10);if(l>=0&&a>=0)return{rowIndex:l,colIndex:a}}}return null}function Ds(t,e,o,i){const r=o-t,s=i-e;return r===0&&s===0?"down":Math.abs(r)>=Math.abs(s)?r>0?"down":"up":s>0?"right":"left"}async function Ts(t){var v,y;const{startRowIndex:e,startColIndex:o,currentRowIndex:i,currentColIndex:r,startField:s}=A,n=t.grid.visualColumns,l=(v=n[o])==null?void 0:v.column;if(!l)return;const a=t.grid.getRowDraft(e)??t.grid.displayItems[e];if(!a)return;const d=a[s],c=Ds(e,o,i,r),u=l.fillDirection??t.grid.fillDirection,g=[],h=Math.min(e,i),f=Math.max(e,i),w=u==="vertical"?o:Math.min(o,r),p=u==="vertical"?o:Math.max(o,r);for(let C=h;C<=f;C++)for(let S=w;S<=p;S++){if(C===e&&S===o)continue;const _=(y=n[S])==null?void 0:y.column;if(!_)continue;const x=String(_.field);t.grid.canEditCell(C,x)&&xs(d,_)&&g.push({rowIndex:C,colIndex:S,field:x})}if(g.length===0)return;const m={sourceCell:{rowIndex:e,colIndex:o,field:s,value:d},targetCells:g,direction:c};if(!(t.grid.fillDragCallback&&t.grid.fillDragCallback(m)===!1))for(const C of g)await t.grid.commitEdit(C.rowIndex,C.field,d),H(t,C.rowIndex,C.colIndex)}function bo(t){A.rangeElement&&(A.rangeElement.remove(),A.rangeElement=null);const e=t.shadow.querySelector(".wg");e==null||e.classList.remove("wg--filling"),document.removeEventListener("mousemove",hi),document.removeEventListener("mouseup",wi),document.removeEventListener("keydown",pi),A={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startField:"",startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,handleElement:A.handleElement,rangeElement:null},Ce=null}function Le(t,e,o,i){var s;V(t);const r=document.createElement("div");if(r.className="wg__dropdown",r.style.cssText=`
|
|
519
519
|
position: absolute;
|
|
520
520
|
top: 0;
|
|
521
521
|
left: 0;
|
|
522
522
|
max-height: 200px;
|
|
523
523
|
overflow-y: auto;
|
|
524
524
|
z-index: var(--wg-z-dropdown);
|
|
525
|
-
`,o.length===0){const n=
|
|
525
|
+
`,o.length===0){const n=t.isSearching?i.searchingText||t.grid.labels.dropdownSearching:i.noOptionsText||t.grid.labels.dropdownNoOptions;r.innerHTML=`<div class="wg__dropdown-empty">${t.escapeHtml(n)}</div>`}else{const n=t.grid.editingCell,l=n?(s=t.grid.displayItems[n.rowIndex])==null?void 0:s[n.field]:void 0,a=t.getCurrentEditingColumn(),d=(a==null?void 0:a.horizontalAlign)||"left";r.innerHTML=o.map((c,u)=>{const g=u===t.highlightedIndex,h=Ae(c,i)===l,f=ae(c,i);if(i.renderOptionCallback){const S={index:u,isHighlighted:g,isSelected:h,isDisabled:f};return i.renderOptionCallback(c,S)}const w=We(c,i),p=Yn(c,i),m=Un(c,i),v=["wg__dropdown-option",`wg__dropdown-option--align-${d}`];g&&v.push("wg__dropdown-option--highlighted"),h&&v.push("wg__dropdown-option--selected"),f&&v.push("wg__dropdown-option--disabled");const y=p?`<span class="wg__dropdown-option-icon">${t.escapeHtml(p)}</span>`:"",C=m?`<span class="wg__dropdown-option-subtitle">${t.escapeHtml(m)}</span>`:"";return`<div class="${v.join(" ")}" data-index="${u}" ${f?'data-disabled="true"':""}>
|
|
526
526
|
${y}
|
|
527
527
|
<div class="wg__dropdown-option-content">
|
|
528
|
-
<span class="wg__dropdown-option-label">${
|
|
529
|
-
${
|
|
528
|
+
<span class="wg__dropdown-option-label">${t.escapeHtml(w)}</span>
|
|
529
|
+
${C}
|
|
530
530
|
</div>
|
|
531
|
-
</div>`}).join("")}return
|
|
531
|
+
</div>`}).join("")}return t.shadow.appendChild(r),t.dropdownOpen=!0,ke(),Ne(e,r,{strategy:"absolute",placement:"bottom-start",middleware:[It(1),Ve({fallbackPlacements:["top-start"]}),Jr({apply({rects:n}){Object.assign(r.style,{minWidth:i.dropdownMinWidth||`${n.reference.width}px`})}})]}).then(({x:n,y:l})=>{Object.assign(r.style,{left:`${n}px`,top:`${l}px`})}),r}function V(t){const e=t.shadow.querySelector(".wg__dropdown");e==null||e.remove(),t.dropdownOpen=!1,t.highlightedIndex=-1,t.filterText="",t.dropdownUserInteracted=!1}function mi(t,e,o=!0,i=!1){var w;const r=t.dropdownOptions[e];if(!r)return;const s=t.grid.editingCell,n=t.grid.focusedCell,l=s?{rowIndex:s.rowIndex,field:s.field,colIndex:t.grid.columns.findIndex(p=>String(p.field)===s.field)}:n?{rowIndex:n.rowIndex,field:String((w=t.grid.columns[n.colIndex])==null?void 0:w.field),colIndex:n.colIndex}:null;if(!l)return;const{rowIndex:a,field:d,colIndex:c}=l,u=t.grid.columns[c],g=(u==null?void 0:u.editorOptions)||{};if(ae(r,g))return;const h=Ae(r,g),f=t.grid.displayItems[a];g.onselect&&f&&g.onselect(r,f),t.justSelected=!0,t.isCommittingFromKeyboard=!0,V(t),t.grid.commitEdit(a,d,h,i),o?t.moveFocusAfterCommit(a,d,"down"):H(t,a,c),requestAnimationFrame(()=>{t.justSelected=!1})}function he(t){const e=t.shadow.querySelector(".wg__dropdown");if(!e)return;e.querySelectorAll(".wg__dropdown-option").forEach((i,r)=>{i.classList.toggle("wg__dropdown-option--highlighted",r===t.highlightedIndex)})}function _o(t){const e=t.shadow.querySelector(".wg__dropdown-option--highlighted");e==null||e.scrollIntoView({block:"nearest"})}function vo(t,e){const o=t.shadow.querySelector(".wg__loading-indicator");o&&(o.style.display=e?"inline":"none");const i=t.shadow.querySelector(".wg__editor--autocomplete .wg__combobox-toggle");i&&(i.style.display=e?"none":"inline")}function fe(t){var u;if(t.justSelected)return;t.dropdownUserInteracted=!1;const e=t.grid.editingCell,o=t.grid.focusedCell,i=e?{rowIndex:e.rowIndex,field:e.field}:o?{rowIndex:o.rowIndex,field:String((u=t.grid.columns[o.colIndex])==null?void 0:u.field)}:null;if(!i)return;const{rowIndex:r,field:s}=i;let n=t.getCurrentEditingColumn();if(n||(n=t.grid.columns.find(g=>String(g.field)===s)||null),!n)return;const l=n.editorOptions||{},a=n.editor;let d=0;if(a==="select"){const g=l.options||[];if(t.filterText){const h=t.filterText.toLowerCase();t.dropdownOptions=g.filter(f=>We(f,l).toLowerCase().includes(h)),d=t.dropdownOptions.length>0?0:-1}else{t.dropdownOptions=g;const h=t.grid.displayItems[r],f=h?h[s]:void 0,w=t.dropdownOptions.findIndex(p=>Ae(p,l)===f);d=w>=0?w:0}}else if(a==="combobox"||a==="autocomplete"){const g=a==="autocomplete"?l.initialOptions||l.options||[]:l.options||[],h=t.grid.displayItems[r],f=h?h[s]:void 0,w=g.findIndex(p=>Ae(p,l)===f);if(w>=0)t.dropdownOptions=g,d=w;else if(f!=null&&f!==""){const p=l.valueMember||"value",m=l.displayMember||"label",v=String(f),y={value:f,label:v,[p]:f,[m]:v};t.dropdownOptions=[y,...g],d=0}else t.dropdownOptions=g,d=g.length>0?0:-1}const c=t.shadow.querySelector(`.wg__editor--select[data-row="${r}"][data-field="${s}"],
|
|
532
532
|
.wg__editor--combobox[data-row="${r}"][data-field="${s}"],
|
|
533
|
-
.wg__editor--autocomplete[data-row="${r}"][data-field="${s}"]`);if(c&&
|
|
534
|
-
.wg__autocomplete-input[data-row="${r}"][data-field="${s}"]`),p=f||w;p&&p!==
|
|
533
|
+
.wg__editor--autocomplete[data-row="${r}"][data-field="${s}"]`);if(c&&t.dropdownOptions.length>0){const g=t.filterText;t.isOpeningDropdown=!0;const h=Le(t,c,t.dropdownOptions,l);ze(t,h),t.filterText=g,t.highlightedIndex=d,he(t);const f=t.shadow.querySelector(`.wg__select-trigger[data-row="${r}"][data-field="${s}"]`),w=t.shadow.querySelector(`.wg__combobox-input[data-row="${r}"][data-field="${s}"],
|
|
534
|
+
.wg__autocomplete-input[data-row="${r}"][data-field="${s}"]`),p=f||w;p&&p!==t.shadow.activeElement&&p.focus(),requestAnimationFrame(()=>{t.isOpeningDropdown=!1})}}function Ms(t){t.dropdownOpen?V(t):fe(t)}function ze(t,e){e.addEventListener("mousedown",o=>{o.preventDefault();const i=o.target.closest(".wg__dropdown-option");if(i&&!i.hasAttribute("data-disabled")){const r=parseInt(i.getAttribute("data-index")||"0",10);mi(t,r,!1)}}),e.addEventListener("mouseover",o=>{const i=o.target.closest(".wg__dropdown-option");i&&!i.hasAttribute("data-disabled")&&(t.highlightedIndex=parseInt(i.getAttribute("data-index")||"0",10),t.dropdownUserInteracted=!0,he(t))})}function bi(t,e){const o=e.options||[],i=t.filterText.toLowerCase(),r=t.filterText;t.dropdownOptions=o.filter(n=>We(n,e).toLowerCase().includes(i)),t.highlightedIndex=t.dropdownOptions.length>0?0:-1;const s=t.shadow.querySelector(".wg__editor--select");if(s){const n=Le(t,s,t.dropdownOptions,e);ze(t,n),t.filterText=r,t.dropdownOptions.length>0&&(t.highlightedIndex=0,he(t))}}function $s(t,e){const o=e.target;t.filterText=o.value,t.isUserFiltering=!0;let i=t.getCurrentEditingColumn();if(!i){const l=o.dataset.field;l&&(i=t.grid.columns.find(a=>String(a.field)===l)||null)}if(!i)return;const r=i.editorOptions||{},s=r.options||[];if(t.filterText.trim()){const l=t.filterText.toLowerCase();t.dropdownOptions=s.filter(a=>We(a,r).toLowerCase().includes(l))}else t.dropdownOptions=s;t.highlightedIndex=t.dropdownOptions.length>0?0:-1;const n=o.closest(".wg__editor--combobox");if(n){const l=Le(t,n,t.dropdownOptions,r);ze(t,l),t.highlightedIndex=t.dropdownOptions.length>0?0:-1,he(t)}}function Ps(t,e){const o=e.target;t.filterText=o.value;let i=t.getCurrentEditingColumn();if(!i){const a=o.dataset.field;a&&(i=t.grid.columns.find(d=>String(d.field)===a)||null)}if(!i)return;const r=i.editorOptions||{},s=r.debounceMs??300,n=r.minSearchLength??1;t.searchDebounceTimer&&clearTimeout(t.searchDebounceTimer);const l=o.closest(".wg__editor--autocomplete");if(!t.dropdownOpen&&l){t.dropdownOptions=r.initialOptions||[];const a=Le(t,l,t.dropdownOptions,r);ze(t,a),t.highlightedIndex=t.dropdownOptions.length>0?0:-1,he(t)}if(t.filterText.length<n){if(t.dropdownOptions=r.initialOptions||[],l){const a=Le(t,l,t.dropdownOptions,r);ze(t,a),t.highlightedIndex=t.dropdownOptions.length>0?0:-1,he(t)}return}t.searchDebounceTimer=setTimeout(()=>{As(t,t.filterText,i)},s)}async function As(t,e,o){const i=o.editorOptions||{};if(!i.searchCallback){const s=i.initialOptions||i.options||[],n=e.toLowerCase();t.dropdownOptions=s.filter(a=>We(a,i).toLowerCase().includes(n)),t.highlightedIndex=t.dropdownOptions.length>0?0:-1;const l=t.grid.editingCell;if(l){const{rowIndex:a,field:d}=l,c=t.shadow.querySelector(`.wg__editor--autocomplete[data-row="${a}"][data-field="${d}"]`);if(c){const u=Le(t,c,t.dropdownOptions,i);ze(t,u),he(t)}}return}t.searchAbortController&&t.searchAbortController.abort(),t.searchAbortController=new AbortController;const r=t.searchAbortController.signal;t.isSearching=!0,vo(t,!0);try{const s=t.grid.editingCell;if(!s)return;const n=t.grid.displayItems[s.rowIndex],l=await i.searchCallback(e,n,r);if(!r.aborted){t.isSearching=!1,vo(t,!1),t.dropdownOptions=l;const{rowIndex:a,field:d}=s,c=t.shadow.querySelector(`.wg__editor--autocomplete[data-row="${a}"][data-field="${d}"]`);if(c){const u=Le(t,c,t.dropdownOptions,i);ze(t,u),t.highlightedIndex=l.length>0?0:-1,he(t)}}}catch(s){if(s instanceof Error&&s.name==="AbortError")return;console.error("Autocomplete search failed:",s),t.isSearching=!1,vo(t,!1),t.dropdownOptions=[];const n=t.grid.editingCell;if(n){const{rowIndex:l,field:a}=n,d=t.shadow.querySelector(`.wg__editor--autocomplete[data-row="${l}"][data-field="${a}"]`);if(d){const c=Le(t,d,t.dropdownOptions,i);ze(t,c)}}}}function yo(t,e,o,i,r){const s=i??t.tooltipShowDelay;t.tooltipHideTimer&&(clearTimeout(t.tooltipHideTimer),t.tooltipHideTimer=null),!(t.tooltipElement&&t.tooltipAnchor===e)&&(t.tooltipShowTimer&&clearTimeout(t.tooltipShowTimer),t.tooltipShowTimer=setTimeout(()=>{Ls(t,e,o,r)},s))}function Ot(t,e){const o=e??t.tooltipHideDelay;t.tooltipShowTimer&&(clearTimeout(t.tooltipShowTimer),t.tooltipShowTimer=null),t.tooltipElement&&(t.tooltipHideTimer=setTimeout(()=>{t.tooltipElement&&(t.tooltipElement.classList.remove("wg__tooltip--visible"),setTimeout(()=>{var i;(i=t.tooltipElement)==null||i.remove(),t.tooltipElement=null,t.tooltipArrowElement=null,t.tooltipAnchor=null},100))},o))}function Ls(t,e,o,i){var l;(l=t.tooltipElement)==null||l.remove();const r=document.createElement("div");r.className="wg__tooltip";const s=document.createElement("div");s.className="wg__tooltip-content",i?s.innerHTML=o:s.textContent=o,r.appendChild(s);const n=document.createElement("div");n.className="wg__tooltip-arrow",r.appendChild(n),t.shadow.appendChild(r),t.tooltipElement=r,t.tooltipArrowElement=n,t.tooltipAnchor=e,Ne(e,r,{strategy:"absolute",placement:"top",middleware:[It(8),Ve({fallbackPlacements:["bottom","left","right"]}),Zr({element:n})]}).then(({x:a,y:d,placement:c,middlewareData:u})=>{if(r.style.left=`${a}px`,r.style.top=`${d}px`,r.setAttribute("data-placement",c),u.arrow){const{x:g,y:h}=u.arrow;g!=null&&(n.style.left=`${g}px`),h!=null&&(n.style.top=`${h}px`)}requestAnimationFrame(()=>{r.classList.add("wg__tooltip--visible")})})}const zs=`
|
|
535
535
|
.wg-context-menu-container {
|
|
536
536
|
position: fixed;
|
|
537
537
|
z-index: var(--wg-cm-z-index, 10000);
|
|
@@ -653,14 +653,14 @@ toolbarColumn takes priority — cursor following is disabled.`,r)}requestUpdate
|
|
|
653
653
|
.wg-context-menu__item--toggle.wg-context-menu__item--checked .wg-context-menu__icon {
|
|
654
654
|
opacity: 1;
|
|
655
655
|
}
|
|
656
|
-
`;let mi=!1;function bi(){if(mi)return;const e=document.createElement("style");e.id="wg-context-menu-styles",e.textContent=Ps,document.head.appendChild(e),mi=!0}function Os(e,t){const o=e.filter(r=>r.visible===void 0?!0:typeof r.visible=="function"?r.visible(t):r.visible);return o.length===0?"":`<div class="wg-context-menu">${o.map((r,s)=>{const n=typeof r.label=="function"?r.label(t):r.label,l=typeof r.icon=="function"?r.icon(t):r.icon,a=r.shortcut,d=typeof r.disabled=="function"?r.disabled(t):r.disabled,c=r.danger===!0,u=["wg-context-menu__item",d?"wg-context-menu__item--disabled":"",c?"wg-context-menu__item--danger":""].filter(Boolean).join(" "),g=r.dividerBefore&&s>0?'<div class="wg-context-menu__divider"></div>':"",h=l?`<span class="wg-context-menu__icon">${l}</span>`:"",f=a?`<span class="wg-context-menu__shortcut">${a}</span>`:"";return`${g}<div class="${u}" data-item-id="${r.id}" data-disabled="${d?"true":"false"}" data-shortcut="${a||""}">${h}<span class="wg-context-menu__label">${n}</span>${f}</div>`}).join("")}</div>`}function Hs(e,t,o,i,r,s,n,l,a){bi();const d=Os(s,n);if(!d)return null;const c=document.createElement("div");c.className="wg-context-menu-container",c.innerHTML=d,document.body.appendChild(c);const u=c.querySelector(".wg-context-menu");qe({getBoundingClientRect:()=>({width:0,height:0,x:t,y:o,top:o,left:t,right:t,bottom:o})},u,{placement:"bottom-start",strategy:"fixed",middleware:[Rt({mainAxis:r,alignmentAxis:i}),Ve({fallbackPlacements:["top-start","bottom-end","top-end"]}),rt({padding:8})]}).then(({x:v,y})=>{Object.assign(u.style,{left:`${v}px`,top:`${y}px`})}),c.addEventListener("click",v=>{const y=v.target.closest(".wg-context-menu__item");if(y&&y.dataset.disabled!=="true"){const x=y.dataset.itemId||"";l(x)}});const h=e.scrollEvents.subscribe("window",()=>{w(),a()}),f=e.scrollEvents.subscribe("container",()=>{w(),a()}),w=()=>{h.unsubscribe(),f.unsubscribe(),document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m),c.remove()},p=v=>{c.contains(v.target)||(w(),a())},m=v=>{if(v.key==="Escape"){v.preventDefault(),w(),a();return}const y=v.key.toLowerCase(),x=c.querySelectorAll(".wg-context-menu__item");for(const C of x){const _=C.dataset.shortcut;if(C.dataset.disabled==="true"||!_)continue;if(_.toLowerCase()===y||_===v.key){v.preventDefault();const E=C.dataset.itemId||"";l(E),w(),a();return}}};return setTimeout(()=>{document.addEventListener("mousedown",p),document.addEventListener("keydown",m)},0),c._cleanup=w,c}function ce(e,t,o){const i=e._cleanup;if(typeof i=="function"){i();return}e.remove()}const Fs={sortAsc:{icon:"↑",labelKey:"sortAsc"},sortDesc:{icon:"↓",labelKey:"sortDesc"},clearSort:{icon:"✕",labelKey:"clearSort"},hideColumn:{icon:"👁",labelKey:"hideColumn"},freezeColumn:{icon:"❄",labelKey:"freezeColumn"},unfreezeColumn:{icon:"☀",labelKey:"unfreezeColumn"},columnVisibility:{icon:"👁",labelKey:"columnVisibility",hasSubmenu:!0}};function _i(e,t){const o=[];let i=!1;for(let r=0;r<e.length;r++){const s=e[r];if(typeof s=="string"){const n=Fs[s];if(!n){console.warn(`Unknown predefined header menu action: ${s}`);continue}let l=!0;s==="sortAsc"||s==="sortDesc"?l=d=>d.column.isSortable!==!1:s==="clearSort"?l=d=>d.sortDirection!==null:s==="freezeColumn"?l=d=>!d.isFrozen:s==="unfreezeColumn"&&(l=d=>d.isFrozen);let a;s==="columnVisibility"&&(a=d=>{const u=[{id:"show-all-columns",icon:d.allColumns.every(g=>!g.isHidden)?"☑":"☐",label:d.labels.contextMenu.showAll,onclick:()=>{d.allColumns.forEach(g=>{g.isHidden=!1})}}];return d.allColumns.forEach(g=>{u.push({id:`toggle-col-${String(g.field)}`,icon:g.isHidden?"☐":"☑",label:g.title||String(g.field),onclick:()=>{g.isHidden=!g.isHidden}})}),u}),o.push({id:s,icon:n.icon,label:t.labels.contextMenu[n.labelKey],danger:n.danger,visible:l,dividerBefore:i,submenu:a}),i=!1}else s.dividerBefore&&!s.id&&!s.label?i=!0:(o.push({id:s.id||`header-menu-item-${r}`,...s,dividerBefore:i||s.dividerBefore}),i=!1)}return o}function vi(e,t,o,i=!1){var v,y;const r=typeof e.label=="function"?e.label(t):e.label,s=typeof e.icon=="function"?e.icon(t):e.icon,n=e.shortcut,l=typeof e.disabled=="function"?e.disabled(t):e.disabled,a=e.danger===!0,d=((v=e.children)==null?void 0:v.length)||e.submenu,c=e.children||(e.submenu?e.submenu(t):[]);let u="";d&&c.length>0&&(u=`<div class="wg-context-menu wg-context-menu--submenu">${c.map((C,_)=>vi(C,t,_,!0)).join("")}</div>`);const g=i&&((y=e.id)==null?void 0:y.startsWith("toggle-col-")),f=["wg-context-menu__item",l?"wg-context-menu__item--disabled":"",a?"wg-context-menu__item--danger":"",d?"wg-context-menu__item--has-submenu":"",g?"wg-context-menu__item--toggle":"",g&&s==="☑"?"wg-context-menu__item--checked":""].filter(Boolean).join(" "),w=e.dividerBefore&&o>0?'<div class="wg-context-menu__divider"></div>':"",p=s?`<span class="wg-context-menu__icon">${s}</span>`:"",m=n?`<span class="wg-context-menu__shortcut">${n}</span>`:"";return`${w}<div class="${f}" data-item-id="${e.id}" data-disabled="${l?"true":"false"}" data-shortcut="${n||""}">${p}<span class="wg-context-menu__label">${r}</span>${m}${u}</div>`}function yi(e,t){const o=e.filter(r=>r.visible===void 0?!0:typeof r.visible=="function"?r.visible(t):r.visible);return o.length===0?"":`<div class="wg-context-menu">${o.map((r,s)=>vi(r,t,s)).join("")}</div>`}function Vs(e,t,o,i=!1){const{field:r,columnIndex:s}=o;switch(t){case"sortAsc":case"sortDesc":{const n=t==="sortAsc"?"asc":"desc",l=[...e.grid.sort];if(i&&e.grid.sortMode==="multi"){const a=l.findIndex(d=>d.column===r);a>=0?l[a]={column:r,direction:n}:l.push({column:r,direction:n}),e.grid.sort=l}else e.grid.sort=[{column:r,direction:n}];break}case"clearSort":e.grid.sort=e.grid.sort.filter(n=>n.column!==r);break;case"hideColumn":{const n=e.grid.columns.find(l=>String(l.field)===r);n&&(n.isHidden=!0,e.grid.columns=[...e.grid.columns]);break}case"freezeColumn":e.grid.freezeColumns=s+1;break;case"unfreezeColumn":e.grid.freezeColumns=Math.max(0,s);break}}function Ci(e,t){t.style.display="block",qe(e,t,{placement:"right-start",strategy:"fixed",middleware:[Ve({fallbackPlacements:["left-start","right-end","left-end"]}),rt({padding:8})]}).then(({x:o,y:i})=>{t.style.left=`${o}px`,t.style.top=`${i}px`})}function Si(e){e.querySelectorAll(".wg-context-menu__item--has-submenu").forEach(o=>{const i=o,r=i.querySelector(":scope > .wg-context-menu--submenu");if(!r)return;let s=null;const n=()=>{s!==null&&(clearTimeout(s),s=null)},l=()=>{s=window.setTimeout(()=>{r.style.display="none",s=null},150)};i.addEventListener("mouseenter",()=>{n(),Ci(i,r)}),i.addEventListener("mouseleave",l),r.addEventListener("mouseenter",n),r.addEventListener("mouseleave",l)})}function xi(e,t,o,i,r,s,n){bi();const l=yi(i,r);if(!l)return null;const a=document.createElement("div");a.className="wg-context-menu-container",a.innerHTML=l,document.body.appendChild(a);let d=a.querySelector(".wg-context-menu");Si(d),qe({getBoundingClientRect:()=>({width:0,height:0,x:t,y:o,top:o,left:t,right:t,bottom:o})},d,{placement:"bottom-start",strategy:"fixed",middleware:[Ve({fallbackPlacements:["top-start","bottom-end","top-end"]}),rt({padding:8})]}).then(({x:p,y:m})=>{Object.assign(d.style,{left:`${p}px`,top:`${m}px`})}),a.addEventListener("click",p=>{const m=p.target.closest(".wg-context-menu__item");if(!m||m.dataset.disabled==="true")return;const v=m.dataset.itemId||"",y=p.ctrlKey;if(!m.classList.contains("wg-context-menu__item--has-submenu")){if(v.startsWith("toggle-col-")||v==="show-all-columns"){s(v,!0,y);const x=yi(i,r),C=document.createElement("div");C.innerHTML=x;const _=C.querySelector(".wg-context-menu");if(_&&d.parentNode){_.style.left=d.style.left,_.style.top=d.style.top,d.parentNode.replaceChild(_,d),d=_,Si(_);const S=_.querySelector(".wg-context-menu__item--has-submenu"),k=S==null?void 0:S.querySelector(":scope > .wg-context-menu--submenu");S&&k&&Ci(S,k)}return}s(v,!1,y)}});const u=e.scrollEvents.subscribe("window",()=>{h(),n()}),g=e.scrollEvents.subscribe("container",()=>{h(),n()}),h=()=>{u.unsubscribe(),g.unsubscribe(),document.removeEventListener("mousedown",f),document.removeEventListener("keydown",w),a.remove()},f=p=>{a.contains(p.target)||(h(),n())},w=p=>{if(p.key==="Escape"){p.preventDefault(),h(),n();return}const m=p.key.toLowerCase(),v=a.querySelectorAll(".wg-context-menu__item");for(const y of v){const x=y.dataset.shortcut;if(y.dataset.disabled==="true"||!x)continue;if(x.toLowerCase()===m||x===p.key){p.preventDefault();const S=y.dataset.itemId||"";s(S),h(),n();return}}};return setTimeout(()=>{document.addEventListener("mousedown",f),document.addEventListener("keydown",w)},0),a._cleanup=h,a}function wt(e){const t=e.split("+").map(i=>i.trim()),o={key:"",ctrl:!1,shift:!1,alt:!1,meta:!1};for(const i of t){const r=i.toLowerCase();r==="ctrl"||r==="control"?o.ctrl=!0:r==="shift"?o.shift=!0:r==="alt"?o.alt=!0:r==="meta"||r==="cmd"||r==="command"?o.meta=!0:o.key=i}return o}function pt(e,t){if(t.ctrl!==e.ctrlKey||t.shift!==e.shiftKey||t.alt!==e.altKey||t.meta!==e.metaKey)return!1;const o=e.key.toLowerCase(),i=t.key.toLowerCase();return o===i}function qs(e){return e.split("+").map(t=>{const o=t.trim();return["ctrl","control","shift","alt","meta","cmd","command"].includes(o.toLowerCase())?o.charAt(0).toUpperCase()+o.slice(1).toLowerCase():o}).join("+")}function Ns(e){const{scrollTop:t,viewportHeight:o,rowHeight:i,buffer:r,totalItems:s,editingRowIndex:n}=e;let l=Math.max(0,Math.floor(t/i)-r);const a=Math.ceil(o/i)+r*2;let d=Math.min(s,l+a);return n!==void 0&&(n<l&&(l=n),n>=d&&(d=n+1)),{startIndex:l,endIndex:d}}function Bs(e){const{targetRow:t,rowHeight:o,buffer:i,totalItems:r,viewportHeight:s,scrollHeight:n,clientHeight:l}=e,a=Math.max(0,(t-1)*o),d=Math.max(0,n-l),c=Math.min(a,d);let u=Math.max(0,Math.floor(c/o)-i);const g=Math.ceil(s/o)+i*2;let h=Math.min(r,u+g);return t<u&&(u=t),t>=h&&(h=t+1),{scrollTop:c,startIndex:u,endIndex:h}}function Ws(e,t,o,i){return t-(e+o)<=i}function Ys(e,t,o){if(!o){const l=t.target.closest(".wg__header--sortable");if(!l||(o=l.dataset.field,!o))return}const i=[...e.grid.sort],r=i.findIndex(n=>n.column===o);(t.ctrlKey||t.metaKey)&&e.grid.sortMode==="multi"?r>=0?i[r].direction==="asc"?i[r]={column:o,direction:"desc"}:i.splice(r,1):i.push({column:o,direction:"asc"}):r>=0&&i.length===1?i[0].direction==="asc"?i[0]={column:o,direction:"desc"}:i.length=0:(i.length=0,i.push({column:o,direction:"asc"})),e.grid.sort=i,e.grid.isPageable&&(e.grid.currentPage=1),e.grid.fireDataRequest("sort")}function Us(e,t){const i=t.target.closest(".wg__pagination-btn");if(!i||i.hasAttribute("disabled"))return!1;const r=i.dataset.action;let s=!1;return r==="first"&&e.grid.currentPage!==1?(e.grid.currentPage=1,s=!0):r==="prev"&&e.grid.currentPage>1?(e.grid.currentPage--,s=!0):r==="next"&&e.grid.currentPage<e.grid.totalPages?(e.grid.currentPage++,s=!0):r==="last"&&e.grid.currentPage!==e.grid.totalPages&&(e.grid.currentPage=e.grid.totalPages,s=!0),s&&e.grid.fireDataRequest("page"),s}function Ks(e,t){const o=parseInt(t.value,10);return o!==e.grid.pageSize?(e.grid.pageSize=o,e.grid.currentPage=1,e.grid.fireDataRequest("pageSize"),!0):!1}let Y={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},Re=null;function ki(e,t){if(!e)return t;const o=parseFloat(e);return isNaN(o)?t:o}function js(e,t,o){const i=t.target,r=i.closest(".wg__header");if(!r)return;const s=e.grid.columns.find(a=>String(a.field)===o);if(!s||s.isResizable===!1)return;const n=r.getBoundingClientRect().width;Y={isResizing:!0,startX:t.clientX,startWidth:n,field:o,headerCell:r,minWidth:ki(s.minWidth,30),maxWidth:s.maxWidth?ki(s.maxWidth,1/0):null},Re=e,s.minWidth?r.style.minWidth=s.minWidth:r.style.minWidth=`${Y.minWidth}px`;const l=e.shadow.querySelector(".wg");l==null||l.classList.add("wg--resizing"),i.classList.add("wg__resize-handle--active"),document.addEventListener("mousemove",Ri),document.addEventListener("mouseup",Ei),t.preventDefault()}function Ri(e){if(!Y.isResizing||!Re)return;const t=e.clientX-Y.startX;let o=Y.startWidth+t;o=Math.max(o,Y.minWidth),Y.maxWidth!==null&&(o=Math.min(o,Y.maxWidth)),Y.headerCell&&(Y.headerCell.style.width=`${o}px`,Y.headerCell.style.maxWidth=`${o}px`),Xs(Re,Y.field,`${o}px`),(Re.grid.freezeColumns>0||Re.grid.isStickyRowNumbers)&&Qs(Re)}function Ei(e){if(!Y.isResizing||!Re)return;const t=Re,o=Y.field,i=`${Y.startWidth}px`,r=e.clientX-Y.startX;let s=Y.startWidth+r;s=Math.max(s,Y.minWidth),Y.maxWidth!==null&&(s=Math.min(s,Y.maxWidth));const n=`${s}px`;t.grid.setColumnWidth(o,n,!0);const l=t.shadow.querySelector(`col[data-field="${o}"]`);l&&(l.style.width=n);const a=t.shadow.querySelector(".wg");a==null||a.classList.remove("wg--resizing");const d=t.shadow.querySelector(".wg__resize-handle--active");d==null||d.classList.remove("wg__resize-handle--active"),t.grid.oncolumnresize&&t.grid.oncolumnresize({field:o,oldWidth:i,newWidth:n,allWidths:t.grid.getColumnWidthsState()}),t.grid.shouldPersistColumnWidths&&t.grid.gridName&&t.grid.savePersistedWidths(),document.removeEventListener("mousemove",Ri),document.removeEventListener("mouseup",Ei),Y={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},Re=null}function Xs(e,t,o){e.shadow.querySelectorAll(`td[data-field="${t}"]`).forEach(r=>{r.style.width=o,r.style.maxWidth=o})}const Gs=40;function Qs(e){const t=e.grid.freezeColumns;let i=e.grid.isRowNumbersVisible&&e.grid.isStickyRowNumbers?Gs:0;const r=e.grid.visualColumns;for(let s=0;s<t&&s<r.length;s++){const{column:n}=r[s],l=String(n.field),a=e.shadow.querySelector(`th[data-field="${l}"]`);a&&(a.style.left=`${i}px`,e.shadow.querySelectorAll(`td[data-field="${l}"]`).forEach(c=>{c.style.left=`${i}px`}),i+=a.getBoundingClientRect().width)}}const Js=5;let O={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},Ee=null,Pt=!1;function Ii(){return Pt?(Pt=!1,!0):O.isReordering}function Zs(e,t,o){var c;const i=t.target,r=i.closest(".wg__header");if(!r||i.classList.contains("wg__resize-handle"))return;const s=e.grid.visualColumns,n=e.grid.totalFrozenColumns,l=s.findIndex(u=>String(u.column.field)===o);if(l<n)return;const a=(c=s[l])==null?void 0:c.column;if((a==null?void 0:a.isMovable)===!1)return;const d=l-n;O={isPending:!0,isReordering:!1,field:o,startX:t.clientX,startY:t.clientY,headerCell:r,ghost:null,dropIndicator:null,fromIndex:d,currentDropIndex:d},Ee=e,document.addEventListener("mousemove",Di),document.addEventListener("mouseup",Ti),t.preventDefault()}function el(e,t,o){var r;const i=document.createElement("div");i.className="wg__reorder-ghost",i.textContent=((r=t.querySelector(".wg__header-title"))==null?void 0:r.textContent)||"",i.style.left=`${o.clientX+10}px`,i.style.top=`${o.clientY-10}px`,e.shadow.appendChild(i),O.ghost=i}function tl(e){var o;const t=document.createElement("div");t.className="wg__drop-indicator",(o=e.shadow.querySelector(".wg"))==null||o.appendChild(t),O.dropIndicator=t}function ol(e,t){O.isPending=!1,O.isReordering=!0;const o=e.shadow.querySelector(".wg");o==null||o.classList.add("wg--reordering"),O.headerCell&&O.headerCell.classList.add("wg__header--dragging"),O.headerCell&&el(e,O.headerCell,t),tl(e)}function Di(e){if(!Ee)return;if(O.isPending){const i=e.clientX-O.startX,r=e.clientY-O.startY;Math.sqrt(i*i+r*r)>=Js&&ol(Ee,e);return}if(!O.isReordering||!Ee.shadow.querySelector(".wg"))return;O.ghost&&(O.ghost.style.left=`${e.clientX+10}px`,O.ghost.style.top=`${e.clientY-10}px`);const o=rl(Ee,e.clientX);o!==O.currentDropIndex&&(O.currentDropIndex=o,nl(Ee,o))}function il(e){const t=e.grid.visualColumns,o=e.grid.totalFrozenColumns,i=t.slice(o);let r=0;for(let s=0;s<i.length;s++)i[s].column.isMovable===!1&&(r=s+1);return r}function rl(e,t){const o=e.grid.visualColumns,i=e.grid.totalFrozenColumns,r=o.slice(i);if(r.length===0)return 0;const s=il(e),n=String(r[0].column.field),l=e.shadow.querySelector(`th[data-field="${n}"]`);if(l){const a=l.getBoundingClientRect();if(t<a.left)return s}for(let a=0;a<r.length;a++){const d=String(r[a].column.field),c=e.shadow.querySelector(`th[data-field="${d}"]`);if(c){const u=c.getBoundingClientRect(),g=u.left+u.width/2;if(t<g)return Math.max(a,s)}}return r.length}function nl(e,t){const o=O.dropIndicator;if(!o)return;const i=e.grid.visualColumns,r=e.grid.totalFrozenColumns,s=i.slice(r),n=e.shadow.querySelector(".wg"),l=n==null?void 0:n.getBoundingClientRect();if(!l||!n)return;let a;if(t>=s.length){const u=String(s[s.length-1].column.field),g=e.shadow.querySelector(`th[data-field="${u}"]`);if(g)a=g.getBoundingClientRect().right-l.left+n.scrollLeft;else return}else{const u=String(s[t].column.field),g=e.shadow.querySelector(`th[data-field="${u}"]`);if(g)a=g.getBoundingClientRect().left-l.left+n.scrollLeft;else return}const d=n.scrollTop,c=n.clientHeight;o.style.left=`${a}px`,o.style.top=`${d}px`,o.style.height=`${c}px`,o.style.display="block"}function Ti(e){if(!Ee)return;const t=Ee;if(O.isPending){Mi(t);return}if(!O.isReordering)return;const o=O.field,i=O.fromIndex,r=O.currentDropIndex;if(i!==r&&r!==i+1){const s=r>i?r-1:r;t.grid.moveColumn(o,s),t.grid.oncolumnreorder&&t.grid.oncolumnreorder({field:o,fromIndex:i,toIndex:s,allOrder:t.grid.getColumnOrderState()}),t.grid.shouldPersistColumnOrder&&t.grid.gridName&&t.grid.savePersistedState()}Pt=!0,requestAnimationFrame(()=>{Pt=!1}),Mi(t)}function Mi(e){O.ghost&&O.ghost.remove(),O.dropIndicator&&O.dropIndicator.remove();const t=e.shadow.querySelector(".wg");t==null||t.classList.remove("wg--reordering"),O.headerCell&&O.headerCell.classList.remove("wg__header--dragging"),document.removeEventListener("mousemove",Di),document.removeEventListener("mouseup",Ti),O={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},Ee=null}function sl(){const e=new Set,t=new Set;let o=null,i=!1;const r=()=>{e.forEach(n=>n())},s=()=>{t.forEach(n=>n())};return{subscribe(n,l){const a=n==="container"?e:t;return a.add(l),{unsubscribe:()=>{a.delete(l)}}},init(n){o=n,n.addEventListener("scroll",r),i||(window.addEventListener("scroll",s,{capture:!0,passive:!0}),i=!0)},destroy(){o&&(o.removeEventListener("scroll",r),o=null),i&&(window.removeEventListener("scroll",s,!0),i=!1),e.clear(),t.clear()}}}function ll(e,t){const o=new Set,i=new Set;let r=null;const s=l=>{const a=l.target,d=l.relatedTarget;o.forEach(c=>c(a,d))},n=l=>{const a=l.target,d=l.relatedTarget;i.forEach(c=>c(a,d))};return{subscribe(l,a){const d=l==="blur"?o:i;return d.add(a),{unsubscribe:()=>{d.delete(a)}}},shouldSkipBlur(){const l=e();return l.isClosingViaToggle?(t(),!0):l.isCommittingFromKeyboard||l.isTransitioningCells||l.isOpeningDropdown},init(l){r=l,l.addEventListener("blur",s,!0),l.addEventListener("focusout",n)},destroy(){r&&(r.removeEventListener("blur",s,!0),r.removeEventListener("focusout",n),r=null),o.clear(),i.clear()}}}function al(){const e={outsideClick:new Set,cellClick:new Set,rowNumberClick:new Set,headerClick:new Set,sortClick:new Set,emptyAreaClick:new Set};let t=null,o=!1,i=!1;const r=(a,d)=>{for(const c of e[a])if(c(d)===!0)return!0;return!1},s=()=>{setTimeout(()=>{i&&(i=!1)},10)},n=a=>{i=!0;const d=a,u=d.composedPath()[0]||d.target,g={target:u,event:d},h=u.closest(".wg__cell"),f=u.closest(".wg__row-number[data-row-number]"),w=u.closest(".wg__header:not(.wg__row-number-header)"),p=u.closest(".wg__sort-indicator");if(p){const m=p.closest(".wg__header--sortable");if(m){g.field=m.dataset.field,g.colIndex=parseInt(m.dataset.colIndex||"-1",10),r("sortClick",g);return}}f?(g.rowIndex=parseInt(f.dataset.rowNumber||"-1",10),r("rowNumberClick",g)):w&&!u.closest(".wg__resize-handle")?(g.field=w.dataset.field,g.colIndex=parseInt(w.dataset.colIndex||"-1",10),r("headerClick",g)):h&&!h.classList.contains("wg__row-number")?(g.rowIndex=parseInt(h.dataset.row||"-1",10),g.colIndex=parseInt(h.dataset.col||"-1",10),r("cellClick",g)):u.closest(".wg__toolbar, button, input, select, textarea")||r("emptyAreaClick",g)},l=a=>{if(!t)return;if(i){i=!1;return}const d=a,c=d.target;(d.composedPath?d.composedPath():[]).includes(t)||r("outsideClick",{target:c,event:d})};return{subscribe(a,d){return e[a].add(d),{unsubscribe:()=>{e[a].delete(d)}}},init(a,d){t=d,d.addEventListener("mousedown",n),d.addEventListener("mouseup",s),o||(document.addEventListener("click",l,!0),o=!0)},destroy(){t&&(t.removeEventListener("mousedown",n),t.removeEventListener("mouseup",s)),o&&(document.removeEventListener("click",l,!0),o=!1),t=null,i=!1,Object.values(e).forEach(a=>a.clear())}}}const dl=5;let $={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,rangeBorder:null},le=null,mt=null,Ze=null;function $i(){return $.isDragging}function yo(){return $.isPending}function Ai(e,t,o,i){var l;const r=i.shiftKey&&e.grid.cellSelectionMode==="shift";e.grid.selectedCellRange&&!r&&(e.grid.clearCellSelection(),G()),(l=e.grid.visualColumns[o])!=null&&l.column&&($={...$,isPending:!0,isDragging:!1,startRowIndex:t,startColIndex:o,startX:i.clientX,startY:i.clientY,currentRowIndex:t,currentColIndex:o},le=e,document.addEventListener("mousemove",Li),document.addEventListener("mouseup",Pi),document.addEventListener("keydown",Oi))}function cl(e,t,o){var i,r;if(G(),e.grid.lastClickedCell){const{rowIndex:s,colIndex:n}=e.grid.lastClickedCell,l=e.grid.visualColumns,a=(i=l[n])==null?void 0:i.column,d=(r=l[o])==null?void 0:r.column;if(a&&d){const c={startRowIndex:s,startColIndex:n,endRowIndex:t,endColIndex:o,startField:String(a.field),endField:String(d.field)};e.grid.clearFocusedCell(),e.grid.selectCellRange(c),Ot(e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const u=e.shadow.querySelector(".wg");u==null||u.focus({preventScroll:!0})})})}}else e.grid.lastClickedCell={rowIndex:t,colIndex:o}}function Li(e){if(le){if($.isPending){const t=e.clientX-$.startX,o=e.clientY-$.startY;Math.sqrt(t*t+o*o)>=dl&&ul(le);return}$.isDragging&&(mt=e,Ze||(Ze=requestAnimationFrame(gl)))}}function gl(){if(Ze=null,!mt||!le)return;const e=mt;mt=null;const t=hl(le,e.clientX,e.clientY);if(t&&(t.rowIndex!==$.currentRowIndex||t.colIndex!==$.currentColIndex)){$.currentRowIndex=t.rowIndex,$.currentColIndex=t.colIndex;const o=Hi(le);zi(le),Fi(le,o)}}function ul(e){$.isPending=!1,$.isDragging=!0;const t=e.shadow.querySelector(".wg");t==null||t.classList.add("wg--selecting-cells");const o=e.grid.focusedCell;e.grid.clearFocusedCell(),J(e,o,null);const i=e.shadow.querySelector(".wg__cell:focus");i==null||i.blur();const r=e.grid.focusedRowIndex;if(r!==null){const s=e.shadow.querySelector(`tr[data-row-index="${r}"]`);s==null||s.classList.remove("wg__row--focused"),e.grid.clearRowFocus()}zi(e),Vi(e)}function zi(e){const{startRowIndex:t,startColIndex:o,currentRowIndex:i,currentColIndex:r}=$,s=Math.min(t,i),n=Math.max(t,i),l=Math.min(o,r),a=Math.max(o,r);e.shadow.querySelectorAll(".wg__cell--in-range").forEach(c=>c.classList.remove("wg__cell--in-range"));for(let c=s;c<=n;c++)for(let u=l;u<=a;u++){const g=e.shadow.querySelector(`[data-row="${c}"][data-col="${u}"]`);g&&g.classList.add("wg__cell--in-range")}}function Pi(e){if(!le)return;const t=le;if($.isPending){e.shiftKey&&t.grid.cellSelectionMode==="shift"&&t.grid.lastClickedCell?cl(t,$.startRowIndex,$.startColIndex):t.grid.lastClickedCell={rowIndex:$.startRowIndex,colIndex:$.startColIndex},Ht(t);return}if(!$.isDragging)return;if($.startRowIndex===$.currentRowIndex&&$.startColIndex===$.currentColIndex){t.shadow.querySelectorAll(".wg__cell--in-range").forEach(n=>n.classList.remove("wg__cell--in-range")),G();const{startRowIndex:r,startColIndex:s}=$;t.grid.setFocusedCell(r,s),J(t,null,{rowIndex:r,colIndex:s}),ut(t,r,s),Ht(t)}else fl(t),Ht(t),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=t.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})})}function Oi(e){if(e.key==="Escape"&&le){e.preventDefault();const t=le;if($.isDragging){t.shadow.querySelectorAll(".wg__cell--in-range").forEach(s=>s.classList.remove("wg__cell--in-range")),G();const{startRowIndex:i,startColIndex:r}=$;t.grid.setFocusedCell(i,r),J(t,null,{rowIndex:i,colIndex:r}),ut(t,i,r)}Ht(t)}}function hl(e,t,o){const i=e.shadow.elementFromPoint(t,o);if(!i)return null;const r=i.closest(".wg__cell[data-row][data-col]");if(!r)return null;const s=parseInt(r.dataset.row||"-1",10),n=parseInt(r.dataset.col||"-1",10);return s>=0&&n>=0?{rowIndex:s,colIndex:n}:null}function fl(e){var d,c;const{startRowIndex:t,startColIndex:o,currentRowIndex:i,currentColIndex:r}=$,s=e.grid.visualColumns,n=(d=s[o])==null?void 0:d.column,l=(c=s[r])==null?void 0:c.column;if(!n||!l)return;const a={startRowIndex:t,startColIndex:o,endRowIndex:i,endColIndex:r,startField:String(n.field),endField:String(l.field)};e.grid.clearFocusedCell(),e.grid.selectCellRange(a),Ot(e)}function Hi(e){const{startRowIndex:t,startColIndex:o,currentRowIndex:i,currentColIndex:r}=$,s=e.shadow.querySelector(".wg");if(!s)return null;const n=Math.min(t,i),l=Math.max(t,i),a=Math.min(o,r),d=Math.max(o,r),c=e.shadow.querySelector(`[data-row="${n}"][data-col="${a}"]`),u=e.shadow.querySelector(`[data-row="${l}"][data-col="${d}"]`);if(!c||!u)return null;const g=s.getBoundingClientRect(),h=c.getBoundingClientRect(),f=u.getBoundingClientRect(),w=s.scrollLeft,p=s.scrollTop;return{container:s,left:h.left-g.left+w-s.clientLeft,top:h.top-g.top+p-s.clientTop,width:f.right-h.left,height:f.bottom-h.top}}function Fi(e,t){if(!t){G();return}let o=$.rangeBorder;o||(o=document.createElement("div"),o.className="wg__cell-range-border",t.container.appendChild(o),$.rangeBorder=o),o.style.left=`${t.left}px`,o.style.top=`${t.top}px`,o.style.width=`${t.width}px`,o.style.height=`${t.height}px`}function Vi(e){const t=Hi(e);Fi(e,t)}function Ot(e){G();const t=e.grid.selectedCellRange;if(!t)return;const o=e.shadow.querySelector(".wg");if(!o)return;const{startRowIndex:i,endRowIndex:r,startColIndex:s,endColIndex:n}=t,l=Math.min(i,r),a=Math.max(i,r),d=Math.min(s,n),c=Math.max(s,n),u=e.shadow.querySelector(`[data-row="${l}"][data-col="${d}"]`),g=e.shadow.querySelector(`[data-row="${a}"][data-col="${c}"]`);if(!u||!g)return;const h=o.getBoundingClientRect(),f=u.getBoundingClientRect(),w=g.getBoundingClientRect(),p=o.scrollLeft,m=o.scrollTop,v=f.left-h.left+p-o.clientLeft,y=f.top-h.top+m-o.clientTop,x=w.right-f.left,C=w.bottom-f.top,_=document.createElement("div");_.className="wg__cell-range-border",_.style.left=`${v}px`,_.style.top=`${y}px`,_.style.width=`${x}px`,_.style.height=`${C}px`,o.appendChild(_),$.rangeBorder=_}function qi(e){$.rangeBorder&&(G(),$.isDragging?Vi(e):Ot(e))}function G(){$.rangeBorder&&($.rangeBorder.remove(),$.rangeBorder=null)}function Ht(e){const t=e.shadow.querySelector(".wg");t==null||t.classList.remove("wg--selecting-cells"),Ze&&(cancelAnimationFrame(Ze),Ze=null),mt=null,document.removeEventListener("mousemove",Li),document.removeEventListener("mouseup",Pi),document.removeEventListener("keydown",Oi),$={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,rangeBorder:$.rangeBorder},le=null}const wl=5;let pe={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},Pe=null;function pl(e,t,o){if(o.preventDefault(),o.stopPropagation(),di(e),e.grid.selectedCellRange&&(e.grid.clearCellSelection(),G()),e.grid.focusedCell){const{rowIndex:i,colIndex:r}=e.grid.focusedCell,s=e.shadow.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`);s==null||s.classList.remove("wg__cell--focused"),e.grid.clearFocusedCell()}if(o.ctrlKey||o.metaKey){e.grid.selectRow(t,"toggle"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=e.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})});return}if(o.shiftKey){e.grid.selectRow(t,"range"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=e.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})});return}pe={isPending:!0,isDragging:!1,startRowIndex:t,startX:o.clientX,startY:o.clientY,currentRowIndex:t},Pe=e,e.grid.selectRow(t,"replace"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=e.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})}),document.addEventListener("mousemove",Ni),document.addEventListener("mouseup",Bi)}function Ni(e){if(!Pe)return;if(pe.isPending){const o=e.clientX-pe.startX,i=e.clientY-pe.startY;Math.sqrt(o*o+i*i)>=wl&&ml(Pe);return}if(!pe.isDragging)return;const t=bl(Pe,e.clientY);t!==null&&t!==pe.currentRowIndex&&(pe.currentRowIndex=t,Pe.grid.selectRowRange(pe.startRowIndex,t))}function ml(e){pe.isPending=!1,pe.isDragging=!0;const t=e.shadow.querySelector(".wg");t==null||t.classList.add("wg--selecting")}function Bi(){if(!Pe)return;const e=Pe,t=e.shadow.querySelector(".wg");t==null||t.classList.remove("wg--selecting"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const o=e.shadow.querySelector(".wg");o==null||o.focus({preventScroll:!0})})}),document.removeEventListener("mousemove",Ni),document.removeEventListener("mouseup",Bi),pe={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},Pe=null}function bl(e,t){const o=e.shadow.querySelectorAll(".wg__row[data-row-index]");for(const i of o){const r=i.getBoundingClientRect();if(t>=r.top&&t<=r.bottom){const s=parseInt(i.dataset.rowIndex||"-1",10);if(s>=0)return s}}if(o.length>0){const i=o[0],r=o[o.length-1],s=i.getBoundingClientRect(),n=r.getBoundingClientRect();if(t<s.top)return parseInt(i.dataset.rowIndex||"0",10);if(t>n.bottom)return parseInt(r.dataset.rowIndex||"0",10)}return null}let Ft=[],Vt=[];function Wi(e){if(e.length===0)return[];const t=[...e].sort((s,n)=>s-n),o=[];let i=t[0],r=t[0];for(let s=1;s<t.length;s++)t[s]===r+1||(o.push({start:i,end:r}),i=t[s]),r=t[s];return o.push({start:i,end:r}),o}function Yi(e,t,o,i,r,s){const n=document.createElement("div");return n.className=s,n.style.left=`${t}px`,n.style.top=`${o}px`,n.style.width=`${i}px`,n.style.height=`${r}px`,e.appendChild(n),n}function Ui(e){et();const t=e.grid.selectedRows;if(t.length===0)return;const o=e.shadow.querySelector(".wg");if(!o)return;const i=Wi(t),r=e.grid.visualColumns;if(r.length===0)return;const s=o.getBoundingClientRect(),n=o.scrollLeft,l=o.scrollTop;for(const a of i){const d=e.shadow.querySelector(`.wg__cell[data-row="${a.start}"][data-col="0"]`),c=r.length-1,u=e.shadow.querySelector(`.wg__cell[data-row="${a.end}"][data-col="${c}"]`);if(!d||!u)continue;const g=d.getBoundingClientRect(),h=u.getBoundingClientRect(),f=g.left-s.left+n-o.clientLeft,w=g.top-s.top+l-o.clientTop,p=h.right-g.left,m=h.bottom-g.top,v=Yi(o,f,w,p,m,"wg__row-selection-border");Ft.push(v)}}function Ki(e){tt();const t=e.grid.selectedColumns;if(t.length===0)return;const o=e.shadow.querySelector(".wg");if(!o)return;const i=Wi(t),r=e.grid.displayItems,s=e.grid.visualColumns;if(r.length===0||s.length===0)return;const n=o.getBoundingClientRect(),l=o.scrollLeft,a=o.scrollTop;for(const d of i){const c=s[d.start],u=s[d.end];if(!c||!u)continue;const g=String(c.column.field),h=String(u.column.field),f=e.shadow.querySelector(`.wg__header[data-field="${g}"]`),w=r.length-1,p=e.shadow.querySelector(`.wg__cell[data-row="${w}"][data-col="${u.originalIndex}"]`);if(!f||!p)continue;const m=e.shadow.querySelector(`.wg__header[data-field="${h}"]`);if(!m)continue;const v=f.getBoundingClientRect(),y=m.getBoundingClientRect(),x=p.getBoundingClientRect(),C=v.left-n.left+l-o.clientLeft,_=v.top-n.top+a-o.clientTop,S=y.right-v.left,k=x.bottom-v.top,E=Yi(o,C,_,S,k,"wg__column-selection-border");Vt.push(E)}}function _l(e){Ft.length>0&&Ui(e),Vt.length>0&&Ki(e)}function et(){for(const e of Ft)e.remove();Ft=[]}function tt(){for(const e of Vt)e.remove();Vt=[]}function vl(){et(),tt()}const yl=5;let me={isPending:!1,isDragging:!1,startColIndex:-1,startX:0,startY:0,currentColIndex:-1},Oe=null;function Cl(e,t,o){if(o.preventDefault(),o.stopPropagation(),di(e),e.grid.selectedCellRange&&(e.grid.clearCellSelection(),G()),o.ctrlKey||o.metaKey){e.grid.selectColumn(t,"toggle"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=e.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})});return}me={isPending:!0,isDragging:!1,startColIndex:t,startX:o.clientX,startY:o.clientY,currentColIndex:t},Oe=e,o.shiftKey?e.grid.selectColumn(t,"range"):e.grid.selectColumn(t,"replace"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=e.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})}),document.addEventListener("mousemove",ji),document.addEventListener("mouseup",Xi)}function ji(e){if(!Oe)return;if(me.isPending){const o=e.clientX-me.startX,i=e.clientY-me.startY;Math.sqrt(o*o+i*i)>=yl&&Sl(Oe);return}if(!me.isDragging)return;const t=xl(Oe,e.clientX);t!==null&&t!==me.currentColIndex&&(me.currentColIndex=t,Oe.grid.selectColumnRange(me.startColIndex,t))}function Sl(e){me.isPending=!1,me.isDragging=!0;const t=e.shadow.querySelector(".wg");t==null||t.classList.add("wg--selecting-columns")}function Xi(){if(!Oe)return;const e=Oe,t=e.shadow.querySelector(".wg");t==null||t.classList.remove("wg--selecting-columns"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const o=e.shadow.querySelector(".wg");o==null||o.focus({preventScroll:!0})})}),document.removeEventListener("mousemove",ji),document.removeEventListener("mouseup",Xi),me={isPending:!1,isDragging:!1,startColIndex:-1,startX:0,startY:0,currentColIndex:-1},Oe=null}function xl(e,t){const o=e.shadow.querySelectorAll(".wg__header:not(.wg__row-number-header):not(.wg__inline-actions-header):not(.wg__actions-column):not(.wg__filler)"),i=e.grid.visualColumns;for(const r of o){const s=r.getBoundingClientRect();if(t>=s.left&&t<=s.right){const n=r.dataset.field;if(n){const l=i.findIndex(a=>String(a.column.field)===n);if(l>=0)return l}}}if(o.length>0){const r=o[0],s=o[o.length-1],n=r.getBoundingClientRect(),l=s.getBoundingClientRect();if(t<n.left){const a=r.dataset.field;if(a){const d=i.findIndex(c=>String(c.column.field)===a);if(d>=0)return d}return 0}if(t>l.right){const a=s.dataset.field;if(a){const d=i.findIndex(c=>String(c.column.field)===a);if(d>=0)return d}return i.length-1}}return null}function kl(e){const t=[];let o=[],i="",r=!1;for(let s=0;s<e.length;s++){const n=e[s],l=e[s+1];r?n==='"'?l==='"'?(i+='"',s++):r=!1:i+=n:n==='"'?r=!0:n===" "?(o.push(i),i=""):n===`
|
|
656
|
+
`;let _i=!1;function vi(){if(_i)return;const t=document.createElement("style");t.id="wg-context-menu-styles",t.textContent=zs,document.head.appendChild(t),_i=!0}function Os(t,e){const o=t.filter(r=>r.visible===void 0?!0:typeof r.visible=="function"?r.visible(e):r.visible);return o.length===0?"":`<div class="wg-context-menu">${o.map((r,s)=>{const n=typeof r.label=="function"?r.label(e):r.label,l=typeof r.icon=="function"?r.icon(e):r.icon,a=r.shortcut,d=typeof r.disabled=="function"?r.disabled(e):r.disabled,c=r.danger===!0,u=["wg-context-menu__item",d?"wg-context-menu__item--disabled":"",c?"wg-context-menu__item--danger":""].filter(Boolean).join(" "),g=r.dividerBefore&&s>0?'<div class="wg-context-menu__divider"></div>':"",h=l?`<span class="wg-context-menu__icon">${l}</span>`:"",f=a?`<span class="wg-context-menu__shortcut">${a}</span>`:"";return`${g}<div class="${u}" data-item-id="${r.id}" data-disabled="${d?"true":"false"}" data-shortcut="${a||""}">${h}<span class="wg-context-menu__label">${n}</span>${f}</div>`}).join("")}</div>`}function Hs(t,e,o,i,r,s,n,l,a){vi();const d=Os(s,n);if(!d)return null;const c=document.createElement("div");c.className="wg-context-menu-container",c.innerHTML=d,document.body.appendChild(c);const u=c.querySelector(".wg-context-menu");Ne({getBoundingClientRect:()=>({width:0,height:0,x:e,y:o,top:o,left:e,right:e,bottom:o})},u,{placement:"bottom-start",strategy:"fixed",middleware:[It({mainAxis:r,alignmentAxis:i}),Ve({fallbackPlacements:["top-start","bottom-end","top-end"]}),st({padding:8})]}).then(({x:v,y})=>{Object.assign(u.style,{left:`${v}px`,top:`${y}px`})}),c.addEventListener("click",v=>{const y=v.target.closest(".wg-context-menu__item");if(y&&y.dataset.disabled!=="true"){const C=y.dataset.itemId||"";l(C)}});const h=t.scrollEvents.subscribe("window",()=>{w(),a()}),f=t.scrollEvents.subscribe("container",()=>{w(),a()}),w=()=>{h.unsubscribe(),f.unsubscribe(),document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m),c.remove()},p=v=>{c.contains(v.target)||(w(),a())},m=v=>{if(v.key==="Escape"){v.preventDefault(),w(),a();return}const y=v.key.toLowerCase(),C=c.querySelectorAll(".wg-context-menu__item");for(const S of C){const _=S.dataset.shortcut;if(S.dataset.disabled==="true"||!_)continue;if(_.toLowerCase()===y||_===v.key){v.preventDefault();const I=S.dataset.itemId||"";l(I),w(),a();return}}};return setTimeout(()=>{document.addEventListener("mousedown",p),document.addEventListener("keydown",m)},0),c._cleanup=w,c}function de(t,e,o){const i=t._cleanup;if(typeof i=="function"){i();return}t.remove()}const Fs={sortAsc:{icon:"↑",labelKey:"sortAsc"},sortDesc:{icon:"↓",labelKey:"sortDesc"},clearSort:{icon:"✕",labelKey:"clearSort"},hideColumn:{icon:"👁",labelKey:"hideColumn"},freezeColumn:{icon:"❄",labelKey:"freezeColumn"},unfreezeColumn:{icon:"☀",labelKey:"unfreezeColumn"},columnVisibility:{icon:"👁",labelKey:"columnVisibility",hasSubmenu:!0}};function yi(t,e){const o=[];let i=!1;for(let r=0;r<t.length;r++){const s=t[r];if(typeof s=="string"){const n=Fs[s];if(!n){console.warn(`Unknown predefined header menu action: ${s}`);continue}let l=!0;s==="sortAsc"||s==="sortDesc"?l=d=>d.column.isSortable!==!1:s==="clearSort"?l=d=>d.sortDirection!==null:s==="freezeColumn"?l=d=>!d.isFrozen:s==="unfreezeColumn"&&(l=d=>d.isFrozen);let a;s==="columnVisibility"&&(a=d=>{const u=[{id:"show-all-columns",icon:d.allColumns.every(g=>!g.isHidden)?"☑":"☐",label:d.labels.contextMenu.showAll,onclick:()=>{d.allColumns.forEach(g=>{g.isHidden=!1})}}];return d.allColumns.forEach(g=>{u.push({id:`toggle-col-${String(g.field)}`,icon:g.isHidden?"☐":"☑",label:g.title||String(g.field),onclick:()=>{g.isHidden=!g.isHidden}})}),u}),o.push({id:s,icon:n.icon,label:e.labels.contextMenu[n.labelKey],danger:n.danger,visible:l,dividerBefore:i,submenu:a}),i=!1}else s.dividerBefore&&!s.id&&!s.label?i=!0:(o.push({id:s.id||`header-menu-item-${r}`,...s,dividerBefore:i||s.dividerBefore}),i=!1)}return o}function Ci(t,e,o,i=!1){var v,y;const r=typeof t.label=="function"?t.label(e):t.label,s=typeof t.icon=="function"?t.icon(e):t.icon,n=t.shortcut,l=typeof t.disabled=="function"?t.disabled(e):t.disabled,a=t.danger===!0,d=((v=t.children)==null?void 0:v.length)||t.submenu,c=t.children||(t.submenu?t.submenu(e):[]);let u="";d&&c.length>0&&(u=`<div class="wg-context-menu wg-context-menu--submenu">${c.map((S,_)=>Ci(S,e,_,!0)).join("")}</div>`);const g=i&&((y=t.id)==null?void 0:y.startsWith("toggle-col-")),f=["wg-context-menu__item",l?"wg-context-menu__item--disabled":"",a?"wg-context-menu__item--danger":"",d?"wg-context-menu__item--has-submenu":"",g?"wg-context-menu__item--toggle":"",g&&s==="☑"?"wg-context-menu__item--checked":""].filter(Boolean).join(" "),w=t.dividerBefore&&o>0?'<div class="wg-context-menu__divider"></div>':"",p=s?`<span class="wg-context-menu__icon">${s}</span>`:"",m=n?`<span class="wg-context-menu__shortcut">${n}</span>`:"";return`${w}<div class="${f}" data-item-id="${t.id}" data-disabled="${l?"true":"false"}" data-shortcut="${n||""}">${p}<span class="wg-context-menu__label">${r}</span>${m}${u}</div>`}function Si(t,e){const o=t.filter(r=>r.visible===void 0?!0:typeof r.visible=="function"?r.visible(e):r.visible);return o.length===0?"":`<div class="wg-context-menu">${o.map((r,s)=>Ci(r,e,s)).join("")}</div>`}function qs(t,e,o,i=!1){const{field:r,columnIndex:s}=o;switch(e){case"sortAsc":case"sortDesc":{const n=e==="sortAsc"?"asc":"desc",l=[...t.grid.sort];if(i&&t.grid.sortMode==="multi"){const a=l.findIndex(d=>d.column===r);a>=0?l[a]={column:r,direction:n}:l.push({column:r,direction:n}),t.grid.sort=l}else t.grid.sort=[{column:r,direction:n}];break}case"clearSort":t.grid.sort=t.grid.sort.filter(n=>n.column!==r);break;case"hideColumn":{const n=t.grid.columns.find(l=>String(l.field)===r);n&&(n.isHidden=!0,t.grid.columns=[...t.grid.columns]);break}case"freezeColumn":t.grid.freezeColumns=s+1;break;case"unfreezeColumn":t.grid.freezeColumns=Math.max(0,s);break}}function xi(t,e){e.style.display="block",Ne(t,e,{placement:"right-start",strategy:"fixed",middleware:[Ve({fallbackPlacements:["left-start","right-end","left-end"]}),st({padding:8})]}).then(({x:o,y:i})=>{e.style.left=`${o}px`,e.style.top=`${i}px`})}function ki(t){t.querySelectorAll(".wg-context-menu__item--has-submenu").forEach(o=>{const i=o,r=i.querySelector(":scope > .wg-context-menu--submenu");if(!r)return;let s=null;const n=()=>{s!==null&&(clearTimeout(s),s=null)},l=()=>{s=window.setTimeout(()=>{r.style.display="none",s=null},150)};i.addEventListener("mouseenter",()=>{n(),xi(i,r)}),i.addEventListener("mouseleave",l),r.addEventListener("mouseenter",n),r.addEventListener("mouseleave",l)})}function Ei(t,e,o,i,r,s,n){vi();const l=Si(i,r);if(!l)return null;const a=document.createElement("div");a.className="wg-context-menu-container",a.innerHTML=l,document.body.appendChild(a);let d=a.querySelector(".wg-context-menu");ki(d),Ne({getBoundingClientRect:()=>({width:0,height:0,x:e,y:o,top:o,left:e,right:e,bottom:o})},d,{placement:"bottom-start",strategy:"fixed",middleware:[Ve({fallbackPlacements:["top-start","bottom-end","top-end"]}),st({padding:8})]}).then(({x:p,y:m})=>{Object.assign(d.style,{left:`${p}px`,top:`${m}px`})}),a.addEventListener("click",p=>{const m=p.target.closest(".wg-context-menu__item");if(!m||m.dataset.disabled==="true")return;const v=m.dataset.itemId||"",y=p.ctrlKey;if(!m.classList.contains("wg-context-menu__item--has-submenu")){if(v.startsWith("toggle-col-")||v==="show-all-columns"){s(v,!0,y);const C=Si(i,r),S=document.createElement("div");S.innerHTML=C;const _=S.querySelector(".wg-context-menu");if(_&&d.parentNode){_.style.left=d.style.left,_.style.top=d.style.top,d.parentNode.replaceChild(_,d),d=_,ki(_);const x=_.querySelector(".wg-context-menu__item--has-submenu"),k=x==null?void 0:x.querySelector(":scope > .wg-context-menu--submenu");x&&k&&xi(x,k)}return}s(v,!1,y)}});const u=t.scrollEvents.subscribe("window",()=>{h(),n()}),g=t.scrollEvents.subscribe("container",()=>{h(),n()}),h=()=>{u.unsubscribe(),g.unsubscribe(),document.removeEventListener("mousedown",f),document.removeEventListener("keydown",w),a.remove()},f=p=>{a.contains(p.target)||(h(),n())},w=p=>{if(p.key==="Escape"){p.preventDefault(),h(),n();return}const m=p.key.toLowerCase(),v=a.querySelectorAll(".wg-context-menu__item");for(const y of v){const C=y.dataset.shortcut;if(y.dataset.disabled==="true"||!C)continue;if(C.toLowerCase()===m||C===p.key){p.preventDefault();const x=y.dataset.itemId||"";s(x),h(),n();return}}};return setTimeout(()=>{document.addEventListener("mousedown",f),document.addEventListener("keydown",w)},0),a._cleanup=h,a}function wt(t){const e=t.split("+").map(i=>i.trim()),o={key:"",ctrl:!1,shift:!1,alt:!1,meta:!1};for(const i of e){const r=i.toLowerCase();r==="ctrl"||r==="control"?o.ctrl=!0:r==="shift"?o.shift=!0:r==="alt"?o.alt=!0:r==="meta"||r==="cmd"||r==="command"?o.meta=!0:o.key=i}return o}function pt(t,e){if(e.ctrl!==t.ctrlKey||e.shift!==t.shiftKey||e.alt!==t.altKey||e.meta!==t.metaKey)return!1;const o=t.key.toLowerCase(),i=e.key.toLowerCase();return o===i}function Vs(t){return t.split("+").map(e=>{const o=e.trim();return["ctrl","control","shift","alt","meta","cmd","command"].includes(o.toLowerCase())?o.charAt(0).toUpperCase()+o.slice(1).toLowerCase():o}).join("+")}function Ns(t){const{scrollTop:e,viewportHeight:o,rowHeight:i,buffer:r,totalItems:s,editingRowIndex:n}=t;let l=Math.max(0,Math.floor(e/i)-r);const a=Math.ceil(o/i)+r*2;let d=Math.min(s,l+a);return n!==void 0&&(n<l&&(l=n),n>=d&&(d=n+1)),{startIndex:l,endIndex:d}}function Bs(t){const{targetRow:e,rowHeight:o,buffer:i,totalItems:r,viewportHeight:s,scrollHeight:n,clientHeight:l}=t,a=Math.max(0,(e-1)*o),d=Math.max(0,n-l),c=Math.min(a,d);let u=Math.max(0,Math.floor(c/o)-i);const g=Math.ceil(s/o)+i*2;let h=Math.min(r,u+g);return e<u&&(u=e),e>=h&&(h=e+1),{scrollTop:c,startIndex:u,endIndex:h}}function Ws(t,e,o,i){return e-(t+o)<=i}function Ys(t,e,o){if(!o){const l=e.target.closest(".wg__header--sortable");if(!l||(o=l.dataset.field,!o))return}const i=[...t.grid.sort],r=i.findIndex(n=>n.column===o);(e.ctrlKey||e.metaKey)&&t.grid.sortMode==="multi"?r>=0?i[r].direction==="asc"?i[r]={column:o,direction:"desc"}:i.splice(r,1):i.push({column:o,direction:"asc"}):r>=0&&i.length===1?i[0].direction==="asc"?i[0]={column:o,direction:"desc"}:i.length=0:(i.length=0,i.push({column:o,direction:"asc"})),t.grid.sort=i,t.grid.isPageable&&(t.grid.currentPage=1),t.grid.fireDataRequest("sort")}function Us(t,e){const i=e.target.closest(".wg__pagination-btn");if(!i||i.hasAttribute("disabled"))return!1;const r=i.dataset.action;let s=!1;return r==="first"&&t.grid.currentPage!==1?(t.grid.currentPage=1,s=!0):r==="prev"&&t.grid.currentPage>1?(t.grid.currentPage--,s=!0):r==="next"&&t.grid.currentPage<t.grid.totalPages?(t.grid.currentPage++,s=!0):r==="last"&&t.grid.currentPage!==t.grid.totalPages&&(t.grid.currentPage=t.grid.totalPages,s=!0),s&&t.grid.fireDataRequest("page"),s}function Ks(t,e){const o=parseInt(e.value,10);return o!==t.grid.pageSize?(t.grid.pageSize=o,t.grid.currentPage=1,t.grid.fireDataRequest("pageSize"),!0):!1}let U={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},Ee=null;function Ii(t,e){if(!t)return e;const o=parseFloat(t);return isNaN(o)?e:o}function js(t,e,o){const i=e.target,r=i.closest(".wg__header");if(!r)return;const s=t.grid.columns.find(a=>String(a.field)===o);if(!s||s.isResizable===!1)return;const n=r.getBoundingClientRect().width;U={isResizing:!0,startX:e.clientX,startWidth:n,field:o,headerCell:r,minWidth:Ii(s.minWidth,30),maxWidth:s.maxWidth?Ii(s.maxWidth,1/0):null},Ee=t,s.minWidth?r.style.minWidth=s.minWidth:r.style.minWidth=`${U.minWidth}px`;const l=t.shadow.querySelector(".wg");l==null||l.classList.add("wg--resizing"),i.classList.add("wg__resize-handle--active"),document.addEventListener("mousemove",Ri),document.addEventListener("mouseup",Di),e.preventDefault()}function Ri(t){if(!U.isResizing||!Ee)return;const e=t.clientX-U.startX;let o=U.startWidth+e;o=Math.max(o,U.minWidth),U.maxWidth!==null&&(o=Math.min(o,U.maxWidth)),U.headerCell&&(U.headerCell.style.width=`${o}px`,U.headerCell.style.maxWidth=`${o}px`),Xs(Ee,U.field,`${o}px`),(Ee.grid.freezeColumns>0||Ee.grid.isStickyRowNumbers)&&Qs(Ee)}function Di(t){if(!U.isResizing||!Ee)return;const e=Ee,o=U.field,i=`${U.startWidth}px`,r=t.clientX-U.startX;let s=U.startWidth+r;s=Math.max(s,U.minWidth),U.maxWidth!==null&&(s=Math.min(s,U.maxWidth));const n=`${s}px`;e.grid.setColumnWidth(o,n,!0);const l=e.shadow.querySelector(`col[data-field="${o}"]`);l&&(l.style.width=n);const a=e.shadow.querySelector(".wg");a==null||a.classList.remove("wg--resizing");const d=e.shadow.querySelector(".wg__resize-handle--active");d==null||d.classList.remove("wg__resize-handle--active"),e.grid.oncolumnresize&&e.grid.oncolumnresize({field:o,oldWidth:i,newWidth:n,allWidths:e.grid.getColumnWidthsState()}),e.grid.shouldPersistColumnWidths&&e.grid.gridName&&e.grid.savePersistedWidths(),document.removeEventListener("mousemove",Ri),document.removeEventListener("mouseup",Di),U={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},Ee=null}function Xs(t,e,o){t.shadow.querySelectorAll(`td[data-field="${e}"]`).forEach(r=>{r.style.width=o,r.style.maxWidth=o})}const Gs=40;function Qs(t){const e=t.grid.freezeColumns;let i=t.grid.isRowNumbersVisible&&t.grid.isStickyRowNumbers?Gs:0;const r=t.grid.visualColumns;for(let s=0;s<e&&s<r.length;s++){const{column:n}=r[s],l=String(n.field),a=t.shadow.querySelector(`th[data-field="${l}"]`);a&&(a.style.left=`${i}px`,t.shadow.querySelectorAll(`td[data-field="${l}"]`).forEach(c=>{c.style.left=`${i}px`}),i+=a.getBoundingClientRect().width)}}const Js=5;let O={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},Ie=null,Ht=!1;function Ti(){return Ht?(Ht=!1,!0):O.isReordering}function Zs(t,e,o){var c;const i=e.target,r=i.closest(".wg__header");if(!r||i.classList.contains("wg__resize-handle"))return;const s=t.grid.visualColumns,n=t.grid.totalFrozenColumns,l=s.findIndex(u=>String(u.column.field)===o);if(l<n)return;const a=(c=s[l])==null?void 0:c.column;if((a==null?void 0:a.isMovable)===!1)return;const d=l-n;O={isPending:!0,isReordering:!1,field:o,startX:e.clientX,startY:e.clientY,headerCell:r,ghost:null,dropIndicator:null,fromIndex:d,currentDropIndex:d},Ie=t,document.addEventListener("mousemove",Mi),document.addEventListener("mouseup",$i),e.preventDefault()}function el(t,e,o){var r;const i=document.createElement("div");i.className="wg__reorder-ghost",i.textContent=((r=e.querySelector(".wg__header-title"))==null?void 0:r.textContent)||"",i.style.left=`${o.clientX+10}px`,i.style.top=`${o.clientY-10}px`,t.shadow.appendChild(i),O.ghost=i}function tl(t){var o;const e=document.createElement("div");e.className="wg__drop-indicator",(o=t.shadow.querySelector(".wg"))==null||o.appendChild(e),O.dropIndicator=e}function ol(t,e){O.isPending=!1,O.isReordering=!0;const o=t.shadow.querySelector(".wg");o==null||o.classList.add("wg--reordering"),O.headerCell&&O.headerCell.classList.add("wg__header--dragging"),O.headerCell&&el(t,O.headerCell,e),tl(t)}function Mi(t){if(!Ie)return;if(O.isPending){const i=t.clientX-O.startX,r=t.clientY-O.startY;Math.sqrt(i*i+r*r)>=Js&&ol(Ie,t);return}if(!O.isReordering||!Ie.shadow.querySelector(".wg"))return;O.ghost&&(O.ghost.style.left=`${t.clientX+10}px`,O.ghost.style.top=`${t.clientY-10}px`);const o=rl(Ie,t.clientX);o!==O.currentDropIndex&&(O.currentDropIndex=o,nl(Ie,o))}function il(t){const e=t.grid.visualColumns,o=t.grid.totalFrozenColumns,i=e.slice(o);let r=0;for(let s=0;s<i.length;s++)i[s].column.isMovable===!1&&(r=s+1);return r}function rl(t,e){const o=t.grid.visualColumns,i=t.grid.totalFrozenColumns,r=o.slice(i);if(r.length===0)return 0;const s=il(t),n=String(r[0].column.field),l=t.shadow.querySelector(`th[data-field="${n}"]`);if(l){const a=l.getBoundingClientRect();if(e<a.left)return s}for(let a=0;a<r.length;a++){const d=String(r[a].column.field),c=t.shadow.querySelector(`th[data-field="${d}"]`);if(c){const u=c.getBoundingClientRect(),g=u.left+u.width/2;if(e<g)return Math.max(a,s)}}return r.length}function nl(t,e){const o=O.dropIndicator;if(!o)return;const i=t.grid.visualColumns,r=t.grid.totalFrozenColumns,s=i.slice(r),n=t.shadow.querySelector(".wg"),l=n==null?void 0:n.getBoundingClientRect();if(!l||!n)return;let a;if(e>=s.length){const u=String(s[s.length-1].column.field),g=t.shadow.querySelector(`th[data-field="${u}"]`);if(g)a=g.getBoundingClientRect().right-l.left+n.scrollLeft;else return}else{const u=String(s[e].column.field),g=t.shadow.querySelector(`th[data-field="${u}"]`);if(g)a=g.getBoundingClientRect().left-l.left+n.scrollLeft;else return}const d=n.scrollTop,c=n.clientHeight;o.style.left=`${a}px`,o.style.top=`${d}px`,o.style.height=`${c}px`,o.style.display="block"}function $i(t){if(!Ie)return;const e=Ie;if(O.isPending){Pi(e);return}if(!O.isReordering)return;const o=O.field,i=O.fromIndex,r=O.currentDropIndex;if(i!==r&&r!==i+1){const s=r>i?r-1:r;e.grid.moveColumn(o,s),e.grid.oncolumnreorder&&e.grid.oncolumnreorder({field:o,fromIndex:i,toIndex:s,allOrder:e.grid.getColumnOrderState()}),e.grid.shouldPersistColumnOrder&&e.grid.gridName&&e.grid.savePersistedState()}Ht=!0,requestAnimationFrame(()=>{Ht=!1}),Pi(e)}function Pi(t){O.ghost&&O.ghost.remove(),O.dropIndicator&&O.dropIndicator.remove();const e=t.shadow.querySelector(".wg");e==null||e.classList.remove("wg--reordering"),O.headerCell&&O.headerCell.classList.remove("wg__header--dragging"),document.removeEventListener("mousemove",Mi),document.removeEventListener("mouseup",$i),O={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},Ie=null}function sl(){const t=new Set,e=new Set;let o=null,i=!1;const r=()=>{t.forEach(n=>n())},s=()=>{e.forEach(n=>n())};return{subscribe(n,l){const a=n==="container"?t:e;return a.add(l),{unsubscribe:()=>{a.delete(l)}}},init(n){o=n,n.addEventListener("scroll",r),i||(window.addEventListener("scroll",s,{capture:!0,passive:!0}),i=!0)},destroy(){o&&(o.removeEventListener("scroll",r),o=null),i&&(window.removeEventListener("scroll",s,!0),i=!1),t.clear(),e.clear()}}}function ll(t,e){const o=new Set,i=new Set;let r=null;const s=l=>{const a=l.target,d=l.relatedTarget;o.forEach(c=>c(a,d))},n=l=>{const a=l.target,d=l.relatedTarget;i.forEach(c=>c(a,d))};return{subscribe(l,a){const d=l==="blur"?o:i;return d.add(a),{unsubscribe:()=>{d.delete(a)}}},shouldSkipBlur(){const l=t();return l.isClosingViaToggle?(e(),!0):l.isCommittingFromKeyboard||l.isTransitioningCells||l.isOpeningDropdown},init(l){r=l,l.addEventListener("blur",s,!0),l.addEventListener("focusout",n)},destroy(){r&&(r.removeEventListener("blur",s,!0),r.removeEventListener("focusout",n),r=null),o.clear(),i.clear()}}}function al(){const t={outsideClick:new Set,cellClick:new Set,rowNumberClick:new Set,headerClick:new Set,sortClick:new Set,emptyAreaClick:new Set};let e=null,o=!1,i=!1;const r=(a,d)=>{for(const c of t[a])if(c(d)===!0)return!0;return!1},s=()=>{setTimeout(()=>{i&&(i=!1)},10)},n=a=>{i=!0;const d=a,u=d.composedPath()[0]||d.target,g={target:u,event:d},h=u.closest(".wg__cell"),f=u.closest(".wg__row-number[data-row-number]"),w=u.closest(".wg__header:not(.wg__row-number-header)"),p=u.closest(".wg__sort-indicator");if(p){const m=p.closest(".wg__header--sortable");if(m){g.field=m.dataset.field,g.colIndex=parseInt(m.dataset.colIndex||"-1",10),r("sortClick",g);return}}f?(g.rowIndex=parseInt(f.dataset.rowNumber||"-1",10),r("rowNumberClick",g)):w&&!u.closest(".wg__resize-handle")?(g.field=w.dataset.field,g.colIndex=parseInt(w.dataset.colIndex||"-1",10),r("headerClick",g)):h&&!h.classList.contains("wg__row-number")?(g.rowIndex=parseInt(h.dataset.row||"-1",10),g.colIndex=parseInt(h.dataset.col||"-1",10),r("cellClick",g)):u.closest(".wg__toolbar, button, input, select, textarea")||r("emptyAreaClick",g)},l=a=>{if(!e)return;if(i){i=!1;return}const d=a,c=d.target;(d.composedPath?d.composedPath():[]).includes(e)||r("outsideClick",{target:c,event:d})};return{subscribe(a,d){return t[a].add(d),{unsubscribe:()=>{t[a].delete(d)}}},init(a,d){e=d,d.addEventListener("mousedown",n),d.addEventListener("mouseup",s),o||(document.addEventListener("click",l,!0),o=!0)},destroy(){e&&(e.removeEventListener("mousedown",n),e.removeEventListener("mouseup",s)),o&&(document.removeEventListener("click",l,!0),o=!1),e=null,i=!1,Object.values(t).forEach(a=>a.clear())}}}const dl=5;let $={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,rangeBorder:null},le=null,mt=null,tt=null;function Ai(){return $.isDragging}function Co(){return $.isPending}function Li(t,e,o,i){var l;const r=i.shiftKey&&t.grid.cellSelectionMode==="shift";t.grid.selectedCellRange&&!r&&(t.grid.clearCellSelection(),Q()),(l=t.grid.visualColumns[o])!=null&&l.column&&($={...$,isPending:!0,isDragging:!1,startRowIndex:e,startColIndex:o,startX:i.clientX,startY:i.clientY,currentRowIndex:e,currentColIndex:o},le=t,document.addEventListener("mousemove",zi),document.addEventListener("mouseup",Hi),document.addEventListener("keydown",Fi))}function cl(t,e,o){var i,r;if(Q(),t.grid.lastClickedCell){const{rowIndex:s,colIndex:n}=t.grid.lastClickedCell,l=t.grid.visualColumns,a=(i=l[n])==null?void 0:i.column,d=(r=l[o])==null?void 0:r.column;if(a&&d){const c={startRowIndex:s,startColIndex:n,endRowIndex:e,endColIndex:o,startField:String(a.field),endField:String(d.field)};t.grid.clearFocusedCell(),t.grid.selectCellRange(c),Ft(t),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const u=t.shadow.querySelector(".wg");u==null||u.focus({preventScroll:!0})})})}}else t.grid.lastClickedCell={rowIndex:e,colIndex:o}}function zi(t){if(le){if($.isPending){const e=t.clientX-$.startX,o=t.clientY-$.startY;Math.sqrt(e*e+o*o)>=dl&&ul(le);return}$.isDragging&&(mt=t,tt||(tt=requestAnimationFrame(gl)))}}function gl(){if(tt=null,!mt||!le)return;const t=mt;mt=null;const e=hl(le,t.clientX,t.clientY);if(e&&(e.rowIndex!==$.currentRowIndex||e.colIndex!==$.currentColIndex)){$.currentRowIndex=e.rowIndex,$.currentColIndex=e.colIndex;const o=qi(le);Oi(le),Vi(le,o)}}function ul(t){$.isPending=!1,$.isDragging=!0;const e=t.shadow.querySelector(".wg");e==null||e.classList.add("wg--selecting-cells");const o=t.grid.focusedCell;t.grid.clearFocusedCell(),Z(t,o,null);const i=t.shadow.querySelector(".wg__cell:focus");i==null||i.blur();const r=t.grid.focusedRowIndex;if(r!==null){const s=t.shadow.querySelector(`tr[data-row-index="${r}"]`);s==null||s.classList.remove("wg__row--focused"),t.grid.clearRowFocus()}Oi(t),Ni(t)}function Oi(t){const{startRowIndex:e,startColIndex:o,currentRowIndex:i,currentColIndex:r}=$,s=Math.min(e,i),n=Math.max(e,i),l=Math.min(o,r),a=Math.max(o,r);t.shadow.querySelectorAll(".wg__cell--in-range").forEach(c=>c.classList.remove("wg__cell--in-range"));for(let c=s;c<=n;c++)for(let u=l;u<=a;u++){const g=t.shadow.querySelector(`[data-row="${c}"][data-col="${u}"]`);g&&g.classList.add("wg__cell--in-range")}}function Hi(t){if(!le)return;const e=le;if($.isPending){t.shiftKey&&e.grid.cellSelectionMode==="shift"&&e.grid.lastClickedCell?cl(e,$.startRowIndex,$.startColIndex):e.grid.lastClickedCell={rowIndex:$.startRowIndex,colIndex:$.startColIndex},qt(e);return}if(!$.isDragging)return;if($.startRowIndex===$.currentRowIndex&&$.startColIndex===$.currentColIndex){e.shadow.querySelectorAll(".wg__cell--in-range").forEach(n=>n.classList.remove("wg__cell--in-range")),Q();const{startRowIndex:r,startColIndex:s}=$;e.grid.setFocusedCell(r,s),Z(e,null,{rowIndex:r,colIndex:s}),ht(e,r,s),qt(e)}else fl(e),qt(e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=e.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})})}function Fi(t){if(t.key==="Escape"&&le){t.preventDefault();const e=le;if($.isDragging){e.shadow.querySelectorAll(".wg__cell--in-range").forEach(s=>s.classList.remove("wg__cell--in-range")),Q();const{startRowIndex:i,startColIndex:r}=$;e.grid.setFocusedCell(i,r),Z(e,null,{rowIndex:i,colIndex:r}),ht(e,i,r)}qt(e)}}function hl(t,e,o){const i=t.shadow.elementFromPoint(e,o);if(!i)return null;const r=i.closest(".wg__cell[data-row][data-col]");if(!r)return null;const s=parseInt(r.dataset.row||"-1",10),n=parseInt(r.dataset.col||"-1",10);return s>=0&&n>=0?{rowIndex:s,colIndex:n}:null}function fl(t){var d,c;const{startRowIndex:e,startColIndex:o,currentRowIndex:i,currentColIndex:r}=$,s=t.grid.visualColumns,n=(d=s[o])==null?void 0:d.column,l=(c=s[r])==null?void 0:c.column;if(!n||!l)return;const a={startRowIndex:e,startColIndex:o,endRowIndex:i,endColIndex:r,startField:String(n.field),endField:String(l.field)};t.grid.clearFocusedCell(),t.grid.selectCellRange(a),Ft(t)}function qi(t){const{startRowIndex:e,startColIndex:o,currentRowIndex:i,currentColIndex:r}=$,s=t.shadow.querySelector(".wg");if(!s)return null;const n=Math.min(e,i),l=Math.max(e,i),a=Math.min(o,r),d=Math.max(o,r),c=t.shadow.querySelector(`[data-row="${n}"][data-col="${a}"]`),u=t.shadow.querySelector(`[data-row="${l}"][data-col="${d}"]`);if(!c||!u)return null;const g=s.getBoundingClientRect(),h=c.getBoundingClientRect(),f=u.getBoundingClientRect(),w=s.scrollLeft,p=s.scrollTop;return{container:s,left:h.left-g.left+w-s.clientLeft,top:h.top-g.top+p-s.clientTop,width:f.right-h.left,height:f.bottom-h.top}}function Vi(t,e){if(!e){Q();return}let o=$.rangeBorder;o||(o=document.createElement("div"),o.className="wg__cell-range-border",e.container.appendChild(o),$.rangeBorder=o),o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.width}px`,o.style.height=`${e.height}px`}function Ni(t){const e=qi(t);Vi(t,e)}function Ft(t){Q();const e=t.grid.selectedCellRange;if(!e)return;const o=t.shadow.querySelector(".wg");if(!o)return;const{startRowIndex:i,endRowIndex:r,startColIndex:s,endColIndex:n}=e,l=Math.min(i,r),a=Math.max(i,r),d=Math.min(s,n),c=Math.max(s,n),u=t.shadow.querySelector(`[data-row="${l}"][data-col="${d}"]`),g=t.shadow.querySelector(`[data-row="${a}"][data-col="${c}"]`);if(!u||!g)return;const h=o.getBoundingClientRect(),f=u.getBoundingClientRect(),w=g.getBoundingClientRect(),p=o.scrollLeft,m=o.scrollTop,v=f.left-h.left+p-o.clientLeft,y=f.top-h.top+m-o.clientTop,C=w.right-f.left,S=w.bottom-f.top,_=document.createElement("div");_.className="wg__cell-range-border",_.style.left=`${v}px`,_.style.top=`${y}px`,_.style.width=`${C}px`,_.style.height=`${S}px`,o.appendChild(_),$.rangeBorder=_}function Bi(t){$.rangeBorder&&(Q(),$.isDragging?Ni(t):Ft(t))}function Q(){$.rangeBorder&&($.rangeBorder.remove(),$.rangeBorder=null)}function qt(t){const e=t.shadow.querySelector(".wg");e==null||e.classList.remove("wg--selecting-cells"),tt&&(cancelAnimationFrame(tt),tt=null),mt=null,document.removeEventListener("mousemove",zi),document.removeEventListener("mouseup",Hi),document.removeEventListener("keydown",Fi),$={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,rangeBorder:$.rangeBorder},le=null}const wl=5;let we={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},Oe=null;function pl(t,e,o){if(o.preventDefault(),o.stopPropagation(),gi(t),t.grid.selectedCellRange&&(t.grid.clearCellSelection(),Q()),t.grid.focusedCell){const{rowIndex:i,colIndex:r}=t.grid.focusedCell,s=t.shadow.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`);s==null||s.classList.remove("wg__cell--focused"),t.grid.clearFocusedCell()}if(o.ctrlKey||o.metaKey){t.grid.selectRow(e,"toggle"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=t.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})});return}if(o.shiftKey){t.grid.selectRow(e,"range"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=t.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})});return}we={isPending:!0,isDragging:!1,startRowIndex:e,startX:o.clientX,startY:o.clientY,currentRowIndex:e},Oe=t,t.grid.selectRow(e,"replace"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=t.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})}),document.addEventListener("mousemove",Wi),document.addEventListener("mouseup",Yi)}function Wi(t){if(!Oe)return;if(we.isPending){const o=t.clientX-we.startX,i=t.clientY-we.startY;Math.sqrt(o*o+i*i)>=wl&&ml(Oe);return}if(!we.isDragging)return;const e=bl(Oe,t.clientY);e!==null&&e!==we.currentRowIndex&&(we.currentRowIndex=e,Oe.grid.selectRowRange(we.startRowIndex,e))}function ml(t){we.isPending=!1,we.isDragging=!0;const e=t.shadow.querySelector(".wg");e==null||e.classList.add("wg--selecting")}function Yi(){if(!Oe)return;const t=Oe,e=t.shadow.querySelector(".wg");e==null||e.classList.remove("wg--selecting"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const o=t.shadow.querySelector(".wg");o==null||o.focus({preventScroll:!0})})}),document.removeEventListener("mousemove",Wi),document.removeEventListener("mouseup",Yi),we={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},Oe=null}function bl(t,e){const o=t.shadow.querySelectorAll(".wg__row[data-row-index]");for(const i of o){const r=i.getBoundingClientRect();if(e>=r.top&&e<=r.bottom){const s=parseInt(i.dataset.rowIndex||"-1",10);if(s>=0)return s}}if(o.length>0){const i=o[0],r=o[o.length-1],s=i.getBoundingClientRect(),n=r.getBoundingClientRect();if(e<s.top)return parseInt(i.dataset.rowIndex||"0",10);if(e>n.bottom)return parseInt(r.dataset.rowIndex||"0",10)}return null}let Vt=[],Nt=[];function Ui(t){if(t.length===0)return[];const e=[...t].sort((s,n)=>s-n),o=[];let i=e[0],r=e[0];for(let s=1;s<e.length;s++)e[s]===r+1||(o.push({start:i,end:r}),i=e[s]),r=e[s];return o.push({start:i,end:r}),o}function Ki(t,e,o,i,r,s){const n=document.createElement("div");return n.className=s,n.style.left=`${e}px`,n.style.top=`${o}px`,n.style.width=`${i}px`,n.style.height=`${r}px`,t.appendChild(n),n}function ji(t){ot();const e=t.grid.selectedRows;if(e.length===0)return;const o=t.shadow.querySelector(".wg");if(!o)return;const i=Ui(e),r=t.grid.visualColumns;if(r.length===0)return;const s=o.getBoundingClientRect(),n=o.scrollLeft,l=o.scrollTop;for(const a of i){const d=t.shadow.querySelector(`.wg__cell[data-row="${a.start}"][data-col="0"]`),c=r.length-1,u=t.shadow.querySelector(`.wg__cell[data-row="${a.end}"][data-col="${c}"]`);if(!d||!u)continue;const g=d.getBoundingClientRect(),h=u.getBoundingClientRect(),f=g.left-s.left+n-o.clientLeft,w=g.top-s.top+l-o.clientTop,p=h.right-g.left,m=h.bottom-g.top,v=Ki(o,f,w,p,m,"wg__row-selection-border");Vt.push(v)}}function Xi(t){it();const e=t.grid.selectedColumns;if(e.length===0)return;const o=t.shadow.querySelector(".wg");if(!o)return;const i=Ui(e),r=t.grid.displayItems,s=t.grid.visualColumns;if(r.length===0||s.length===0)return;const n=o.getBoundingClientRect(),l=o.scrollLeft,a=o.scrollTop;for(const d of i){const c=s[d.start],u=s[d.end];if(!c||!u)continue;const g=String(c.column.field),h=String(u.column.field),f=t.shadow.querySelector(`.wg__header[data-field="${g}"]`),w=r.length-1,p=t.shadow.querySelector(`.wg__cell[data-row="${w}"][data-col="${u.originalIndex}"]`);if(!f||!p)continue;const m=t.shadow.querySelector(`.wg__header[data-field="${h}"]`);if(!m)continue;const v=f.getBoundingClientRect(),y=m.getBoundingClientRect(),C=p.getBoundingClientRect(),S=v.left-n.left+l-o.clientLeft,_=v.top-n.top+a-o.clientTop,x=y.right-v.left,k=C.bottom-v.top,I=Ki(o,S,_,x,k,"wg__column-selection-border");Nt.push(I)}}function _l(t){Vt.length>0&&ji(t),Nt.length>0&&Xi(t)}function ot(){for(const t of Vt)t.remove();Vt=[]}function it(){for(const t of Nt)t.remove();Nt=[]}function vl(){ot(),it()}const yl=5;let pe={isPending:!1,isDragging:!1,startColIndex:-1,startX:0,startY:0,currentColIndex:-1},He=null;function Cl(t,e,o){if(o.preventDefault(),o.stopPropagation(),gi(t),t.grid.selectedCellRange&&(t.grid.clearCellSelection(),Q()),o.ctrlKey||o.metaKey){t.grid.selectColumn(e,"toggle"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=t.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})});return}pe={isPending:!0,isDragging:!1,startColIndex:e,startX:o.clientX,startY:o.clientY,currentColIndex:e},He=t,o.shiftKey?t.grid.selectColumn(e,"range"):t.grid.selectColumn(e,"replace"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=t.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})}),document.addEventListener("mousemove",Gi),document.addEventListener("mouseup",Qi)}function Gi(t){if(!He)return;if(pe.isPending){const o=t.clientX-pe.startX,i=t.clientY-pe.startY;Math.sqrt(o*o+i*i)>=yl&&Sl(He);return}if(!pe.isDragging)return;const e=xl(He,t.clientX);e!==null&&e!==pe.currentColIndex&&(pe.currentColIndex=e,He.grid.selectColumnRange(pe.startColIndex,e))}function Sl(t){pe.isPending=!1,pe.isDragging=!0;const e=t.shadow.querySelector(".wg");e==null||e.classList.add("wg--selecting-columns")}function Qi(){if(!He)return;const t=He,e=t.shadow.querySelector(".wg");e==null||e.classList.remove("wg--selecting-columns"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const o=t.shadow.querySelector(".wg");o==null||o.focus({preventScroll:!0})})}),document.removeEventListener("mousemove",Gi),document.removeEventListener("mouseup",Qi),pe={isPending:!1,isDragging:!1,startColIndex:-1,startX:0,startY:0,currentColIndex:-1},He=null}function xl(t,e){const o=t.shadow.querySelectorAll(".wg__header:not(.wg__row-number-header):not(.wg__inline-actions-header):not(.wg__actions-column):not(.wg__filler)"),i=t.grid.visualColumns;for(const r of o){const s=r.getBoundingClientRect();if(e>=s.left&&e<=s.right){const n=r.dataset.field;if(n){const l=i.findIndex(a=>String(a.column.field)===n);if(l>=0)return l}}}if(o.length>0){const r=o[0],s=o[o.length-1],n=r.getBoundingClientRect(),l=s.getBoundingClientRect();if(e<n.left){const a=r.dataset.field;if(a){const d=i.findIndex(c=>String(c.column.field)===a);if(d>=0)return d}return 0}if(e>l.right){const a=s.dataset.field;if(a){const d=i.findIndex(c=>String(c.column.field)===a);if(d>=0)return d}return i.length-1}}return null}function kl(t){const e=[];let o=[],i="",r=!1;for(let s=0;s<t.length;s++){const n=t[s],l=t[s+1];r?n==='"'?l==='"'?(i+='"',s++):r=!1:i+=n:n==='"'?r=!0:n===" "?(o.push(i),i=""):n===`
|
|
657
657
|
`||n==="\r"&&l===`
|
|
658
|
-
`?(o.push(i),o.some(a=>a!=="")&&t.push(o),o=[],i="",n==="\r"&&s++):n!=="\r"&&(i+=n)}return(i!==""||o.length>0)&&(o.push(i),o.some(s=>s!=="")&&t.push(o)),t}function Rl(e,t){const o=new Map,i=new Map;t.forEach((a,d)=>{var g;if(a.isHidden)return;const c=String(a.field),u=((g=a.title)==null?void 0:g.toLowerCase().trim())||"";u&&o.set(u,{field:c,colIndex:d}),i.set(c.toLowerCase(),{field:c,colIndex:d})});const r=[];let s=0;for(const a of e){const d=a.trim().toLowerCase();if(!d)continue;const c=o.get(d)||i.get(d);c&&(s++,r.push({pastedHeader:a,gridField:c.field,colIndex:c.colIndex}))}const n=e.filter(a=>a.trim()!=="").length,l=Math.max(2,Math.floor(n*.5));return s>=l?r:null}async function El(e,t,o,i){var _;const r=e.grid,s=kl(t);if(s.length===0)return{totalCells:0,successfulCells:0,failedCells:0,skippedCells:0,newRowsCreated:0,cellResults:[],hadHeaders:!1};const n=Rl(s[0],r.columns),l=n!==null,a=l?s.slice(1):s;if(a.length===0)return{totalCells:0,successfulCells:0,failedCells:0,skippedCells:0,newRowsCreated:0,cellResults:[],hadHeaders:l};const d=r.visualColumns,c=r.isEmptyRowIndex(o),u=r.items.length;let g;if(c)g=a.length;else{const S=o+a.length-1;g=Math.max(0,S-u+1)}const h={rawText:t,parsedRows:s,hasHeaders:l,headerMapping:n,targetRowIndex:o,targetColIndex:i,newRowsCount:g,cancel:!1,skipCells:new Set};if(r.onbeforepaste&&(r.onbeforepaste(h),h.cancel))return{totalCells:a.reduce((S,k)=>S+k.length,0),successfulCells:0,failedCells:0,skippedCells:a.reduce((S,k)=>S+k.length,0),newRowsCreated:0,cellResults:[],hadHeaders:l};let f=0,w=u;if(g>0){const S=[];for(let k=0;k<g;k++){const E=c?k:u+k-o,R=a[E],I={};l&&n?R==null||R.forEach((z,D)=>{const P=n[D];P&&(I[P.gridField]=z)}):R==null||R.forEach((z,D)=>{const P=i+D;if(P<d.length){const j=String(d[P].column.field);I[j]=z}});let M;r.createRowCallback?M=r.createRowCallback(I,u+k):M=I,S.push(M),f++}c&&r.newRowPosition==="top"?(r.items=[...S,...r.items],w=0):(r.items=[...r.items,...S],w=u)}const p=[],m=r.pasteMode;for(let S=0;S<a.length;S++){const k=a[S],E=c?w+S:o+S,R=c?r.newRowPosition==="top"?1+S:r.items.length-a.length+S:o+S,I=E;for(let M=0;M<k.length;M++){const z=k[M];let D,P;if(l&&n){const X=n[M];if(!X)continue;D=X.gridField,P=X.colIndex}else{if(P=i+M,P>=d.length){p.push({rowIndex:R,field:"",value:z,isValid:!1,wasSkipped:!0,skipReason:"out-of-bounds"});continue}D=String(d[P].column.field)}const j=`${S}-${M}`;if(h.skipCells.has(j)){p.push({rowIndex:R,field:D,value:z,isValid:!0,wasSkipped:!0,skipReason:"user-canceled"});continue}const T=r.columns.find(X=>String(X.field)===D);if(!T)continue;if(!r.isCellEditable(T)){if(m==="editable-only"){p.push({rowIndex:R,field:D,value:z,isValid:!1,wasSkipped:!0,skipReason:"non-editable"});continue}else if(m==="skip-non-editable"){p.push({rowIndex:R,field:D,value:z,isValid:!0,wasSkipped:!0,skipReason:"non-editable"});continue}}const W=c?r.items[I]:r.displayItems[I];if(W&&r.isRowLocked(W)){p.push({rowIndex:R,field:D,value:z,isValid:!0,wasSkipped:!0,skipReason:"locked"});continue}let B=z;if(T.beforePasteCallback&&W&&(B=T.beforePasteCallback(z,W)),c){const X=r.items[I];if(X&&r.shouldValidateOnPaste&&T.beforeCommitCallback){const Ie={value:B,oldValue:void 0,row:X,rowIndex:I,field:D},te=await Promise.resolve(T.beforeCommitCallback(Ie)),He=te===!0||te===void 0||typeof te=="object"&&te!==null&&te.valid!==!1,De=typeof te=="object"&&te!==null?te.error||te.message:typeof te=="string"?te:void 0;He||(r.addInvalidCell(R,D,De||"Invalid value"),(_=r.onvalidationerror)==null||_.call(r,{row:X,rowIndex:R,field:D,error:De||"Invalid value"})),p.push({rowIndex:R,field:D,value:B,isValid:He,validationError:He?void 0:De,wasSkipped:!1})}else p.push({rowIndex:R,field:D,value:B,isValid:!0,wasSkipped:!1})}else if(r.shouldValidateOnPaste){await r.commitEdit(R,D,B);const X=r.invalidCells.find(Ie=>Ie.rowIndex===R&&Ie.field===D);p.push({rowIndex:R,field:D,value:B,isValid:!X,validationError:X==null?void 0:X.error,wasSkipped:!1})}else{const X=r.items[I];X&&(X[D]=B),p.push({rowIndex:R,field:D,value:B,isValid:!0,wasSkipped:!1})}}}const v=p.filter(S=>!S.wasSkipped&&S.isValid).length,y=p.filter(S=>!S.wasSkipped&&!S.isValid).length,x=p.filter(S=>S.wasSkipped).length,C={totalCells:p.length,successfulCells:v,failedCells:y,skippedCells:x,newRowsCreated:f,cellResults:p,hadHeaders:l};return r.onpaste&&r.onpaste(C),C}class Il{constructor(t){b(this,"executors",new Map);b(this,"ctx");this.ctx=t}registerExecutor(t){for(const o of t.handles)this.executors.set(o,t)}dispatch(t){const o=[t];for(;o.length>0;){const i=o.shift(),r=this.executors.get(i.type);if(!r){console.warn(`[ActionPipeline] No executor for action type: ${i.type}`);continue}const s=new Proxy(this.ctx,{get:(l,a)=>a==="dispatch"?d=>this.dispatch(d):l[a],set:(l,a,d)=>(l[a]=d,!0)}),n=r.execute(s,i);n&&n.length>0&&o.unshift(...n)}}}function Dl(e){return new Il(e)}const Tl={handles:["focusCell","blurCell"],execute(e,t){switch(t.type){case"focusCell":return Ml(e,t);case"blurCell":return $l(e)}}};function Ml(e,t){const{rowIndex:o,colIndex:i}=t.target,r=e.grid.columns[i];if(!r)return;const s=r.editTrigger??e.grid.editTrigger,n=s==="always",l=e.grid.focusedCell;(!l||l.rowIndex!==o||l.colIndex!==i)&&(e.filterText="",e.searchDebounceTimer&&(clearTimeout(e.searchDebounceTimer),e.searchDebounceTimer=null),e.searchAbortController&&(e.searchAbortController.abort(),e.searchAbortController=null)),e.grid.setFocusedCell(o,i),J(e,l,{rowIndex:o,colIndex:i});const d=e.shadow.querySelector(`td[data-row="${o}"][data-col="${i}"]`);if(!d)return;if(n){let h=d.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger");h||(h=d.querySelector(".wg__editor")),h&&(h.focus({preventScroll:!0}),t.selectText!==!1&&h instanceof HTMLInputElement&&h.type==="text"&&h.select())}else d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1"),d.focus({preventScroll:!0});d.scrollIntoView({block:"nearest",inline:"nearest"}),Lt(e);const c=r.editor,u=c==="select"||c==="combobox"||c==="autocomplete",g=s==="navigate";if(n&&e.grid.shouldShowDropdownOnFocus&&!e.justSelected&&u)return[{type:"openDropdown"}];if(g&&e.grid.shouldShowDropdownOnFocus&&u)return[{type:"startEdit",target:{rowIndex:o,colIndex:i}},{type:"openDropdown"}]}function $l(e,t){const o=e.grid.focusedCell;e.grid.clearFocusedCell(),J(e,o,null)}const Al={handles:["navigate"],execute(e,t){if(t.type==="navigate")return Ll(e,t)}};function Ll(e,t){const o=t.from??e.grid.focusedCell;if(!o)return;const i=zl(e,o,t),r=e.grid.columns[o.colIndex],s=r?String(r.field):"",n=e.grid.editingCell&&e.grid.editingCell.rowIndex===o.rowIndex&&e.grid.editingCell.field===s;return i?i.rowIndex===o.rowIndex&&i.colIndex===o.colIndex?void 0:[{type:"transitionCell",from:o,to:i,selectText:!0}]:n?[{type:"commitEdit"},{type:"renderCell",target:o},{type:"focusCell",target:o,selectText:!1}]:void 0}function zl(e,t,o){const{direction:i,ctrlKey:r}=o,{rowIndex:s,colIndex:n}=t,l=e.grid.columns,d=e.grid.displayItems.length-1,c=l.length-1,u=e.grid.getEditableColumns();switch(i!=="tab"&&i!=="tab-back"&&i!=="enter"&&(e.grid.tabTraversalStartColIndex=null),i){case"up":if(s>0)return{rowIndex:s-1,colIndex:n};break;case"down":if(s<d)return{rowIndex:s+1,colIndex:n};break;case"left":if(n>0)return{rowIndex:s,colIndex:n-1};break;case"right":if(n<c)return{rowIndex:s,colIndex:n+1};break;case"tab":{if(u.length===0){if(n<c)return{rowIndex:s,colIndex:n+1};if(s<d)return{rowIndex:s+1,colIndex:0};break}e.grid.tabTraversalStartColIndex===null&&(e.grid.tabTraversalStartColIndex=n);const g=u.findIndex(h=>h.index===n);if(g>=0&&g<u.length-1)return{rowIndex:s,colIndex:u[g+1].index};if(g===-1&&u.length>0)return{rowIndex:s,colIndex:u[0].index};if(s<d)return{rowIndex:s+1,colIndex:u[0].index};if(e.grid.isEmptyRowIndex(s))return{rowIndex:s,colIndex:u[0].index};break}case"tab-back":{if(u.length===0){if(n>0)return{rowIndex:s,colIndex:n-1};if(s>0)return{rowIndex:s-1,colIndex:c};break}e.grid.tabTraversalStartColIndex===null&&(e.grid.tabTraversalStartColIndex=n);const g=u.findIndex(h=>h.index===n);if(g>0)return{rowIndex:s,colIndex:u[g-1].index};if(s>0)return{rowIndex:s-1,colIndex:u[u.length-1].index};break}case"enter":{const g=e.grid.tabTraversalStartColIndex??n;if(e.grid.tabTraversalStartColIndex=null,s<d)return{rowIndex:s+1,colIndex:g};break}case"home":return r?{rowIndex:0,colIndex:0}:{rowIndex:s,colIndex:0};case"end":return r?{rowIndex:d,colIndex:c}:{rowIndex:s,colIndex:c};case"page-up":return r?{rowIndex:0,colIndex:n}:{rowIndex:Math.max(0,s-10),colIndex:n};case"page-down":return r?{rowIndex:d,colIndex:n}:{rowIndex:Math.min(d,s+10),colIndex:n}}return null}const Pl={handles:["transitionCell"],execute(e,t){if(t.type==="transitionCell")return Ol(e,t)}};function Ol(e,t){const{from:o,to:i,selectText:r}=t,s=[],n=e.grid.editingCell,l=n&&n.rowIndex===o.rowIndex&&e.grid.columns.findIndex(g=>String(g.field)===n.field)===o.colIndex,a=e.grid.columns[o.colIndex],c=((a==null?void 0:a.editTrigger)??e.grid.editTrigger)==="always";if(o.rowIndex!==i.rowIndex||o.colIndex!==i.colIndex)if(l)s.push({type:"commitEdit"});else if(c)s.push({type:"commitEdit",target:o});else{const g={type:"renderCell",target:o};s.push(g)}const u={type:"focusCell",target:i,selectText:r};return s.push(u),s}const Hl={handles:["renderCell"],execute(e,t){t.type==="renderCell"&&Fl(e,t)}};function Fl(e,t){const{target:o,focusEditor:i,cursorPosition:r,initialSearchQuery:s}=t;H(e,o.rowIndex,o.colIndex,{focusEditor:i,cursorPosition:r,initialSearchQuery:s})}const Vl={handles:["openDropdown","closeDropdown","toggleDropdown","dropdownNavigate","dropdownSelect"],execute(e,t){switch(t.type){case"openDropdown":we(e);break;case"closeDropdown":q(e);break;case"toggleDropdown":e.dropdownOpen?q(e):we(e);break;case"dropdownNavigate":return ql(e,t);case"dropdownSelect":return Nl(e,t)}}},Gi=10;function ql(e,t){if(!e.dropdownOpen)return;const o=e.getCurrentEditorOptions();let i=e.highlightedIndex;const r=e.dropdownOptions.length;switch(t.direction){case"up":for(i=e.highlightedIndex-1;i>=0&&de(e.dropdownOptions[i],o);)i--;if(i<0)return;break;case"down":for(i=e.highlightedIndex+1;i<r&&de(e.dropdownOptions[i],o);)i++;if(i>=r)return;break;case"page-up":for(i=Math.max(0,e.highlightedIndex-Gi);i<e.highlightedIndex&&de(e.dropdownOptions[i],o);)i++;if(i>=e.highlightedIndex)return;break;case"page-down":for(i=Math.min(r-1,e.highlightedIndex+Gi);i>e.highlightedIndex&&de(e.dropdownOptions[i],o);)i--;if(i<=e.highlightedIndex)return;break;case"home":for(i=0;i<r&&de(e.dropdownOptions[i],o);)i++;if(i>=r)return;break;case"end":for(i=r-1;i>=0&&de(e.dropdownOptions[i],o);)i--;if(i<0)return;break}e.highlightedIndex=i,e.dropdownUserInteracted=!0,fe(e),bo(e)}function Nl(e,t){var h;if(!e.dropdownOpen||e.highlightedIndex<0)return q(e),t.thenNavigate?[{type:"navigate",direction:t.thenNavigate}]:void 0;const o=e.dropdownOptions[e.highlightedIndex];if(!o)return;const i=e.grid.editingCell,r=e.grid.focusedCell,s=i?{rowIndex:i.rowIndex,field:i.field,colIndex:e.grid.columns.findIndex(f=>String(f.field)===i.field)}:r?{rowIndex:r.rowIndex,field:String((h=e.grid.columns[r.colIndex])==null?void 0:h.field),colIndex:r.colIndex}:null;if(!s)return;const{rowIndex:n,field:l,colIndex:a}=s,d=e.grid.columns[a],c=(d==null?void 0:d.editorOptions)||{};if(de(o,c))return;const u=Ae(o,c),g=e.grid.displayItems[n];if(c.onselect&&g&&c.onselect(o,g),e.justSelected=!0,e.isCommittingFromKeyboard=!0,q(e),e.grid.commitEdit(n,l,u,t.commitEmptyRow??!1),t.thenNavigate)return H(e,n,a),e.justSelected=!1,[{type:"navigate",direction:t.thenNavigate,from:{rowIndex:n,colIndex:a}}];t.moveAfterSelect?e.moveFocusAfterCommit(n,l,"down"):H(e,n,a),requestAnimationFrame(()=>{e.justSelected=!1})}const Bl={handles:["noop"],execute(){}},Wl={handles:["toggleCheckbox"],execute(e,t){t.type==="toggleCheckbox"&&Yl(e,t)}};function Yl(e,t){const{rowIndex:o,colIndex:i}=t.target,r=e.grid.columns[i];if(!r||!e.grid.isCellEditable(r))return;const s=String(r.field),n=e.grid.displayItems[o];if(!n)return;const l=r.editorOptions||{},a=l.trueValue??!0,d=l.falseValue??!1,u=e.grid.getCellRawValue(n,o,s)===a?d:a;e.grid.startEdit(o,s),e.grid.updateDraftValue(o,s,u),H(e,o,i,{focusEditor:!0})}const Ul={handles:["openDatePicker","closeDatePicker","toggleDatePicker"],execute(e,t){switch(t.type){case"openDatePicker":Qi(e);break;case"closeDatePicker":Xl(e);break;case"toggleDatePicker":Gl(e);break}}};function Qi(e){const t=e.grid.focusedCell;if(!t)return;const{rowIndex:o,colIndex:i}=t,r=e.grid.columns[i];if(!r||r.editor!=="date")return;const s=String(r.field),n=e.shadow.querySelector(`.wg__cell[data-row="${o}"][data-col="${i}"]`);if(!n)return;const l=n.querySelector(".wg__editor--date"),a=n.querySelector(".wg__date-input");if(!l||!a)return;e.datepicker&&(e.datepicker.close(!0),e.datepicker=null);const d=a.dataset.dateFormat||"YYYY-MM-DD",c=a.dataset.minDate,u=a.dataset.maxDate,g=a.dataset.dateValue||"",h=o,f=i,w=s;e.datepicker=new Dt({dateFormat:d,minDate:c||void 0,maxDate:u||void 0,onSelect:(p,m)=>{Kl(e,h,f,w,p,m)},onClose:()=>{jl(e,h,f)}}),e.datepicker.open(l,g||null)}function Kl(e,t,o,i,r,s){e.datepicker=null,e.grid.commitEdit(t,i,It(r)),H(e,t,o);const n=e.shadow.querySelector(`.wg__cell[data-row="${t}"][data-col="${o}"]`);n&&n.focus(),s==="down"?e.dispatch({type:"navigate",direction:"down"}):s==="next"&&e.dispatch({type:"navigate",direction:"tab"})}function jl(e,t,o){e.datepicker=null;const i=e.grid.columns[o];if(!i)return;if((i.editTrigger??e.grid.editTrigger)==="always")H(e,t,o);else{K(e),e.grid.cancelEdit(),H(e,t,o);const s=e.shadow.querySelector(`.wg__cell[data-row="${t}"][data-col="${o}"]`);s&&s.focus()}}function Xl(e){e.datepicker&&(e.datepicker.close(!0),e.datepicker=null)}function Gl(e){e.datepicker?e.datepicker.close(!1):Qi(e)}const Ql={handles:["startEdit","commitEdit","cancelEdit","escapeEdit","deleteCell"],execute(e,t){switch(t.type){case"startEdit":Jl(e,t);break;case"commitEdit":Zl(e,t.commitEmptyRow,t.target);break;case"cancelEdit":ea(e);break;case"escapeEdit":return ta(e,t);case"deleteCell":oa(e,t);break}}};function Jl(e,t){const{rowIndex:o,colIndex:i}=t.target;se(e,o,i,{initialSearchQuery:t.initialSearchQuery,cursorPosition:t.cursorPosition})}async function Zl(e,t,o){const i=e.grid.editingCell;let r,s,n;if(o){r=o.rowIndex,s=o.colIndex;const c=e.grid.columns[s];if(!c)return;n=String(c.field)}else if(i){if(r=i.rowIndex,n=i.field,s=e.grid.columns.findIndex(c=>String(c.field)===n),s<0)return}else return;const l=e.shadow.querySelector(`.wg__cell[data-row="${r}"][data-col="${s}"]`);if(!l)return;let a=l.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger");if(a||(a=l.querySelector(".wg__editor")),!a)return;let d;if(e.grid.columns[s],a instanceof HTMLInputElement)if(a.type==="checkbox"){const c=e.grid.displayItems[r];d=e.grid.getCellRawValue(c,r,n)}else if(a.classList.contains("wg__date-input"))d=a.dataset.dateValue||a.value;else if(a.classList.contains("wg__editor--number")){const c=a.value.trim();if(c==="")d=null;else{const u=parseFloat(c);d=isNaN(u)?c:u}}else d=a.value;else a instanceof HTMLSelectElement?d=a.value:d=a.dataset.value||"";e.dropdownOpen&&q(e),K(e),await e.grid.commitEdit(r,n,d,t),H(e,r,s)}function ea(e){const t=e.grid.editingCell;if(!t)return;const{rowIndex:o,field:i}=t,r=e.grid.columns.findIndex(n=>String(n.field)===i),s=e.grid.columns[r];e.dropdownOpen&&q(e),K(e),(s==null?void 0:s.editor)==="checkbox"&&e.grid.discardCellDraft(o,i),e.grid.cancelEdit(),r>=0&&H(e,o,r)}function ta(e,t){const o=e.grid.editingCell,i=e.grid.focusedCell;if(t.phase==="dropdown"){const r=o||i;if(!r)return;const s=o?e.grid.columns.findIndex(a=>String(a.field)===o.field):(i==null?void 0:i.colIndex)??-1,n=e.grid.columns[s],l=n==null?void 0:n.editor;if(l==="select"&&e.filterText){e.filterText="",q(e),e.dispatch({type:"openDropdown"});return}if(l==="autocomplete"||l==="combobox"){const a=e.shadow.querySelector(`.wg__cell[data-row="${r.rowIndex}"][data-col="${s}"]`),d=a==null?void 0:a.querySelector(".wg__combobox-input, .wg__autocomplete-input"),c=e.grid.displayItems[r.rowIndex],u=n==null?void 0:n.field,g=c&&u?c[u]:void 0,h=(n==null?void 0:n.editorOptions)||{},f=h.initialOptions||h.options||[],w=ct(g,f,h),p=(d==null?void 0:d.value)??"";if(d&&p!==w){e.filterText="",d.value=w,d.focus(),d.select(),q(e),e.dispatch({type:"openDropdown"});return}}q(e),o&&(K(e),l==="checkbox"&&e.grid.discardCellDraft(r.rowIndex,o.field),e.grid.cancelEdit(),H(e,r.rowIndex,s),ut(e,r.rowIndex,s));return}if(o){const{rowIndex:r,field:s}=o,n=e.grid.columns.findIndex(a=>String(a.field)===s),l=e.grid.columns[n];e.dropdownOpen&&q(e),e.datepicker&&(e.datepicker.close(!0),e.datepicker=null),K(e),(l==null?void 0:l.editor)==="checkbox"&&e.grid.discardCellDraft(r,s),e.grid.cancelEdit(),n>=0&&(H(e,r,n),ut(e,r,n))}else if(i){const{rowIndex:r,colIndex:s}=i;e.grid.clearFocusedCell(),H(e,r,s)}}function oa(e,t){const o=t.target||e.grid.focusedCell;if(!o)return;const{rowIndex:i,colIndex:r}=o,s=e.grid.columns[r];if(!s||!e.grid.isCellEditable(s))return;const n=String(s.field);e.grid.commitEdit(i,n,null),H(e,i,r)}const ia={handles:["selectRow","selectColumn","clearSelection"],execute(e,t){switch(t.type){case"selectRow":ra(e,t);break;case"selectColumn":na(e,t);break;case"clearSelection":sa(e);break}}};function ra(e,t){const{rowIndex:o,addToSelection:i,extendSelection:r}=t;e.grid.selectedColumns.length>0&&e.grid.clearColumnSelection(),e.grid.selectedCellRange&&(e.grid.clearCellSelection(),G(),ke(),Co(e)),r&&e.grid.selectedRows.length>0?e.grid.selectRow(o,"range"):i?e.grid.selectRow(o,"toggle"):e.grid.selectRow(o,"replace"),Ji(e)}function na(e,t){const{colIndex:o,addToSelection:i,extendSelection:r}=t;e.grid.selectedRows.length>0&&e.grid.clearSelection(),e.grid.selectedCellRange&&(e.grid.clearCellSelection(),G(),ke(),Co(e)),r&&e.grid.selectedColumns.length>0?e.grid.selectColumn(o,"range"):i?e.grid.selectColumn(o,"toggle"):e.grid.selectColumn(o,"replace"),Zi(e)}function sa(e){if(console.log("[clearSelection] rows:",e.grid.selectedRows.length,"cols:",e.grid.selectedColumns.length,"cellRange:",!!e.grid.selectedCellRange),e.grid.selectedRows.length>0&&(console.log("[clearSelection] clearing rows"),e.grid.clearSelection_noRender(),et(),Ji(e)),e.grid.selectedColumns.length>0){console.log("[clearSelection] clearing columns, removing visual classes"),e.grid.clearColumnSelection_noRender(),tt(),Zi(e),console.log("[clearSelection] after clear, selectedColumns:",e.grid.selectedColumns.length);const t=e.shadow.querySelectorAll(".wg__header--selected");console.log("[clearSelection] remaining header--selected elements:",t.length)}e.grid.selectedCellRange&&(e.grid.clearCellSelection_noRender(),G(),ke(),Co(e))}function Ji(e){e.shadow.querySelectorAll(".wg__row--selected").forEach(o=>o.classList.remove("wg__row--selected"));for(const o of e.grid.selectedRows){const i=e.shadow.querySelector(`tr[data-row="${o}"]`);i&&i.classList.add("wg__row--selected")}}function Zi(e){e.shadow.querySelectorAll(".wg__cell--column-selected").forEach(i=>i.classList.remove("wg__cell--column-selected")),e.shadow.querySelectorAll(".wg__header--selected").forEach(i=>i.classList.remove("wg__header--selected"));for(const i of e.grid.selectedColumns){e.shadow.querySelectorAll(`.wg__cell[data-col="${i}"]`).forEach(n=>n.classList.add("wg__cell--column-selected"));const s=e.shadow.querySelector(`.wg__header[data-col="${i}"]`);s&&s.classList.add("wg__header--selected")}}function Co(e){e.shadow.querySelectorAll(".wg__cell--in-range").forEach(u=>u.classList.remove("wg__cell--in-range"));const o=e.grid.selectedCellRange;if(!o)return;const{startRowIndex:i,endRowIndex:r,startColIndex:s,endColIndex:n}=o,l=Math.min(i,r),a=Math.max(i,r),d=Math.min(s,n),c=Math.max(s,n);for(let u=l;u<=a;u++)for(let g=d;g<=c;g++){const h=e.shadow.querySelector(`.wg__cell[data-row="${u}"][data-col="${g}"]`);h&&h.classList.add("wg__cell--in-range")}}const la={handles:["copy","paste"],execute(e,t){switch(t.type){case"copy":aa(e);break}}};async function aa(e){var o,i;let t="";if(e.grid.selectedCellRange){const r=e.grid.selectedCellRange,{startRowIndex:s,endRowIndex:n,startColIndex:l,endColIndex:a}=r,d=Math.min(s,n),c=Math.max(s,n),u=Math.min(l,a),g=Math.max(l,a),h=[];for(let f=d;f<=c;f++){const w=[];for(let p=u;p<=g;p++){const m=e.grid.displayItems[f],v=(o=e.grid.visualColumns[p])==null?void 0:o.column;if(m&&v){const y=m[String(v.field)];w.push(qt(y))}else w.push("")}h.push(w.join(" "))}t=h.join(`
|
|
659
|
-
`)}else if(
|
|
660
|
-
`)}else if(
|
|
661
|
-
`)}else if(e.grid.focusedCell){const{rowIndex:r,colIndex:s}=e.grid.focusedCell,n=e.grid.displayItems[r],l=e.grid.columns[s];if(n&&l){const a=n[String(l.field)];t=qt(a)}}if(t)try{await navigator.clipboard.writeText(t)}catch{console.warn("Failed to copy to clipboard")}}function qt(e){return e==null?"":typeof e=="object"?JSON.stringify(e):String(e)}const da={handles:["openContextMenu","closeContextMenu"],execute(e,t){switch(t.type){case"openContextMenu":ca(e,t);break;case"closeContextMenu":ga(e);break}}};function ca(e,t){t.target&&e.dispatch({type:"focusCell",target:t.target,selectText:!1})}function ga(e){e.contextMenuElement&&(ce(e.contextMenuElement),e.contextMenuElement=null),e.headerContextMenuElement&&(ce(e.headerContextMenuElement),e.headerContextMenuElement=null)}const ua={handles:["startFillDrag","updateFillDrag","completeFillDrag"],execute(e,t){switch(t.type){}}},ha={handles:["startCellSelection"],execute(e,t){if(t.type==="startCellSelection")return fa(e,t)}};function fa(e,t){Ai(e,t.rowIndex,t.colIndex,{clientX:t.clientX,clientY:t.clientY,shiftKey:t.shiftKey})}const wa={handles:["resetState"],execute(e,t){if(t.type==="resetState")return pa(e,t)}};function pa(e,t){const o=t.edit!==!1,i=t.selections!==!1,r=t.overlays!==!1,s=t.focus===!0,n=[];return r&&((e.contextMenuElement||e.headerContextMenuElement)&&n.push({type:"closeContextMenu"}),e.datepicker&&n.push({type:"closeDatePicker"})),o&&e.grid.editingCell&&n.push({type:"cancelEdit"}),i&&(e.grid.selectedRows.length>0||e.grid.selectedColumns.length>0||e.grid.selectedCellRange)&&n.push({type:"clearSelection"}),s&&e.grid.focusedCell&&n.push({type:"blurCell"}),n}const ma={handles:["openCustomEditor"],execute(e,t){if(t.type!=="openCustomEditor")return;const{rowIndex:o,colIndex:i}=t.target;e.openCustomEditor(o,i)}};function So(e,t){const{currentCell:o,dropdownOpen:i,isDropdownEditor:r}=t;if(!o)return null;const s=e.ctrlKey||e.metaKey;if(i)switch(e.key){case"ArrowUp":return{type:"dropdownNavigate",direction:"up"};case"ArrowDown":return{type:"dropdownNavigate",direction:"down"};case"ArrowLeft":case"ArrowRight":return t.editorType==="autocomplete"?null:{type:"noop"};case"Home":return t.editorType==="autocomplete"?null:{type:"dropdownNavigate",direction:"home"};case"End":return t.editorType==="autocomplete"?null:{type:"dropdownNavigate",direction:"end"};case"PageUp":return{type:"dropdownNavigate",direction:"page-up"};case"PageDown":return{type:"dropdownNavigate",direction:"page-down"};case"Enter":return{type:"dropdownSelect",moveAfterSelect:!0,commitEmptyRow:!0};case"Tab":return{type:"dropdownSelect",moveAfterSelect:!1,commitEmptyRow:!1,thenNavigate:e.shiftKey?"tab-back":"tab"};case"Escape":return{type:"escapeEdit",phase:"dropdown"}}if(e.key==="Escape")return{type:"escapeEdit",phase:"edit"};if(t.isCheckboxEditor){if(e.key===" ")return{type:"toggleCheckbox",target:o};if(e.key==="ArrowUp"||e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight")return{type:"noop"}}if(r&&!i)switch(e.key){case" ":case"F2":return{type:"openDropdown"};case"Enter":return{type:"openDropdown"}}let n=null;switch(e.key){case"Tab":n=e.shiftKey?"tab-back":"tab";break;case"Enter":n="enter";break;case"ArrowUp":n="up";break;case"ArrowDown":n="down";break;case"ArrowLeft":n="left";break;case"ArrowRight":n="right";break;case"Home":n="home";break;case"End":n="end";break;case"PageUp":n="page-up";break;case"PageDown":n="page-down";break;default:return null}return n?{type:"navigate",direction:n,from:o,ctrlKey:s}:null}function er(e,t,o,i=!1){return!!(["Tab","Enter","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"].includes(e)||e==="Escape"||o&&!t&&(e===" "||e==="F2")||i&&e===" ")}function tr(e,t){const{cell:o,dropdownOpen:i,isToggleClick:r,isDateTriggerClick:s,isCheckboxClick:n,isCellClick:l}=t,a=[];if(n)return a.push({type:"toggleCheckbox",target:o}),a;if(s)return a.push({type:"focusCell",target:o,selectText:!1}),a.push({type:"startEdit",target:o}),a.push({type:"toggleDatePicker"}),a;i&&!r&&a.push({type:"closeDropdown"});const{isDropdownEditor:d}=t,c=!r&&(!l||d);return a.push({type:"focusCell",target:o,selectText:c}),r&&(i?a.push({type:"closeDropdown"}):(a.push({type:"startEdit",target:o}),a.push({type:"openDropdown"}))),a}class ba{constructor(t){b(this,"pipeline");b(this,"ctx");this.ctx=t,this.pipeline=Dl(t),this.pipeline.registerExecutor(Tl),this.pipeline.registerExecutor(Al),this.pipeline.registerExecutor(Pl),this.pipeline.registerExecutor(Hl),this.pipeline.registerExecutor(Vl),this.pipeline.registerExecutor(Wl),this.pipeline.registerExecutor(Ul),this.pipeline.registerExecutor(Ql),this.pipeline.registerExecutor(ia),this.pipeline.registerExecutor(la),this.pipeline.registerExecutor(da),this.pipeline.registerExecutor(ua),this.pipeline.registerExecutor(ha),this.pipeline.registerExecutor(wa),this.pipeline.registerExecutor(ma),this.pipeline.registerExecutor(Bl)}getEditTrigger(t){const o=this.ctx.grid.columns[t];return o?o.editTrigger??this.ctx.grid.editTrigger:"navigate"}isAlwaysMode(t){return this.ctx.grid.isEditable?this.getEditTrigger(t)==="always":!1}isEditingCell(t,o){const i=this.ctx.grid.editingCell;if(!i)return!1;const r=this.ctx.grid.columns[o];return r?i.rowIndex===t&&i.field===String(r.field):!1}isDropdownEditor(t){const o=this.ctx.grid.columns[t];if(!o)return!1;const i=o.editor;return i==="select"||i==="combobox"||i==="autocomplete"}isCheckboxEditor(t){const o=this.ctx.grid.columns[t];return o?o.editor==="checkbox":!1}isDateEditor(t){const o=this.ctx.grid.columns[t];return o?o.editor==="date":!1}isCustomEditor(t){const o=this.ctx.grid.columns[t];return o?o.editor==="custom":!1}getDropdownEditorType(t){const o=this.ctx.grid.columns[t];if(!o)return;const i=o.editor;if(i==="select"||i==="combobox"||i==="autocomplete")return i}getCellFromTarget(t){const o=t.closest(".wg__cell");if(!o)return null;const i=parseInt(o.dataset.row||"",10),r=parseInt(o.dataset.col||"",10);return isNaN(i)||isNaN(r)?null:{rowIndex:i,colIndex:r}}tryHandleKeyDown(t){const o=t.target,i=this.getCellFromTarget(o);if(!i||this.ctx.datepicker&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(t.key))return!1;const r=this.getEditTrigger(i.colIndex),s=this.isAlwaysMode(i.colIndex),n=this.isEditingCell(i.rowIndex,i.colIndex),l=this.ctx.dropdownOpen,a=this.isDropdownEditor(i.colIndex),d=this.isCheckboxEditor(i.colIndex),c=this.isDateEditor(i.colIndex);if(s){if(!er(t.key,l,a,d))return!1;const g=So(t,{currentCell:i,dropdownOpen:l,isDropdownEditor:a,isCheckboxEditor:d,editorType:this.getDropdownEditorType(i.colIndex)});return g?(t.preventDefault(),t.stopPropagation(),this.pipeline.dispatch(g),!0):!1}if(n){const g=t.key==="ArrowLeft"||t.key==="ArrowRight";if(g&&r==="navigate"&&a)return t.preventDefault(),t.stopPropagation(),this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"navigate",direction:t.key==="ArrowLeft"?"left":"right",from:i}),!0;if(t.key==="Tab"&&r==="navigate"&&l)return t.preventDefault(),t.stopPropagation(),this.ctx.dropdownUserInteracted?this.pipeline.dispatch({type:"dropdownSelect",moveAfterSelect:!1,thenNavigate:t.shiftKey?"tab-back":"tab"}):(this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"navigate",direction:t.shiftKey?"tab-back":"tab",from:i})),!0;if(!er(t.key,l,a,d)||!a&&!d&&!c&&g&&!l)return!1;const w=So(t,{currentCell:i,dropdownOpen:l,isDropdownEditor:a,isCheckboxEditor:d,editorType:this.getDropdownEditorType(i.colIndex)});return w?(t.preventDefault(),t.stopPropagation(),this.pipeline.dispatch(w),!0):!1}if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab","Home","End","PageUp","PageDown"].includes(t.key)){const g=So(t,{currentCell:i,dropdownOpen:!1,isDropdownEditor:!1,isCheckboxEditor:!1});return g?(t.preventDefault(),t.stopPropagation(),this.pipeline.dispatch(g),!0):!1}if(t.key==="F2"){const g=this.isCustomEditor(i.colIndex);return t.preventDefault(),t.stopPropagation(),this.pipeline.dispatch({type:"startEdit",target:i}),a?this.pipeline.dispatch({type:"openDropdown"}):c?this.pipeline.dispatch({type:"openDatePicker"}):g&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}if(t.key==="Enter"){if(c)return t.preventDefault(),t.stopPropagation(),this.pipeline.dispatch({type:"startEdit",target:i}),this.pipeline.dispatch({type:"openDatePicker"}),!0;if(a){const g=this.ctx.grid.columns[i.colIndex];return g&&this.ctx.grid.getEffectiveShouldOpenDropdownOnEnter(g)?(t.preventDefault(),t.stopPropagation(),this.pipeline.dispatch({type:"startEdit",target:i}),this.pipeline.dispatch({type:"openDropdown"}),!0):!1}return!1}if(t.key===" "){const g=this.isCustomEditor(i.colIndex);if(a||c||d||g)return t.preventDefault(),t.stopPropagation(),d?this.pipeline.dispatch({type:"toggleCheckbox",target:i}):(this.pipeline.dispatch({type:"startEdit",target:i}),a?this.pipeline.dispatch({type:"openDropdown"}):c?this.pipeline.dispatch({type:"openDatePicker"}):g&&this.pipeline.dispatch({type:"openCustomEditor",target:i})),!0}if(t.key==="Delete")return t.preventDefault(),t.stopPropagation(),this.pipeline.dispatch({type:"deleteCell",target:i}),!0;if((t.ctrlKey||t.metaKey)&&t.key==="c")return t.preventDefault(),t.stopPropagation(),this.pipeline.dispatch({type:"copy"}),!0;if(t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey){if(this.isEditingCell(i.rowIndex,i.colIndex))return!1;t.preventDefault(),t.stopPropagation();const g=this.isCustomEditor(i.colIndex);return this.pipeline.dispatch({type:"startEdit",target:i,initialSearchQuery:t.key}),a?this.pipeline.dispatch({type:"openDropdown"}):g&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}return!1}tryHandleFocus(t){const o=t.target,i=this.getCellFromTarget(o);if(!i||!this.isAlwaysMode(i.colIndex)||!o.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger"))return!1;const s=this.ctx.grid.focusedCell;return(!s||s.rowIndex!==i.rowIndex||s.colIndex!==i.colIndex)&&this.pipeline.dispatch({type:"focusCell",target:i,selectText:!1}),!0}tryHandleMouseDown(t){const o=t.target,i=o.matches(".wg__combobox-toggle, .wg__select-toggle"),r=!!o.closest(".wg__date-trigger"),s=o.matches('.wg__checkbox-input, input[type="checkbox"]'),n=!i&&!r&&!s&&(o.matches(".wg__cell")||o.closest(".wg__cell")!==null);let l=null;if(i){const w=o.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete")||o.closest(".wg__cell-dropdown-display");if(w){const p=parseInt(w.dataset.row||"",10),m=w.dataset.field||"",v=this.ctx.grid.columns.findIndex(y=>String(y.field)===m);!isNaN(p)&&v>=0&&(l={rowIndex:p,colIndex:v})}}else if(r){const w=o.closest(".wg__editor--date")||o.closest(".wg__cell-date-display");if(w){const p=parseInt(w.dataset.row||"",10),m=w.dataset.field||"",v=this.ctx.grid.columns.findIndex(y=>String(y.field)===m);!isNaN(p)&&v>=0&&(l={rowIndex:p,colIndex:v})}}else l=this.getCellFromTarget(o);if(!l)return!1;this.ctx.grid.tabTraversalStartColIndex=null;const a=this.isAlwaysMode(l.colIndex),d=this.isEditingCell(l.rowIndex,l.colIndex);if(!i&&!r&&!s&&!n)return!1;const c=this.ctx.grid.cellSelectionMode,u=t.shiftKey;if(c==="shift"&&u&&n)return this.pipeline.dispatch({type:"startCellSelection",rowIndex:l.rowIndex,colIndex:l.colIndex,clientX:t.clientX,clientY:t.clientY,shiftKey:!0}),t.preventDefault(),!0;if(a||d){const w=o.matches(".wg__editor--text, .wg__editor--number, .wg__date-input"),p=o.matches(".wg__combobox-input, .wg__autocomplete-input"),m=this.ctx.grid.focusedCell,v=m&&m.rowIndex===l.rowIndex&&m.colIndex===l.colIndex;if((w||p)&&v&&n)return!0;const y=n&&this.ctx.grid.selectedCellRange;n&&(y||this.ctx.grid.selectedRows.length>0||this.ctx.grid.selectedColumns.length>0)&&(y&&(this.ctx.isTransitioningCells=!0),this.pipeline.dispatch({type:"clearSelection"}));const C=this.ctx.dropdownOpen,_=this.isDropdownEditor(l.colIndex),S=tr(t,{cell:l,dropdownOpen:C,isDropdownEditor:_,isDateEditor:this.isDateEditor(l.colIndex),isCheckboxEditor:this.isCheckboxEditor(l.colIndex),isToggleClick:i,isDateTriggerClick:r,isCheckboxClick:s,isCellClick:n});if(S.length===0)return y&&(this.ctx.isTransitioningCells=!1),!1;w||(t.preventDefault(),t.stopPropagation());for(const k of S)this.pipeline.dispatch(k);return y&&requestAnimationFrame(()=>{this.ctx.isTransitioningCells=!1}),!0}if(i)return t.preventDefault(),t.stopPropagation(),this.ctx.grid.editingCell&&this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"focusCell",target:l,selectText:!1}),this.pipeline.dispatch({type:"startEdit",target:l}),this.pipeline.dispatch({type:"openDropdown"}),!0;if(r)return t.preventDefault(),t.stopPropagation(),this.ctx.grid.editingCell&&this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"focusCell",target:l,selectText:!1}),this.pipeline.dispatch({type:"startEdit",target:l}),this.pipeline.dispatch({type:"openDatePicker"}),!0;if(n&&!i&&!s){t.preventDefault(),this.ctx.grid.editingCell&&(this.ctx.isTransitioningCells=!0,this.pipeline.dispatch({type:"cancelEdit"})),(this.ctx.grid.selectedRows.length>0||this.ctx.grid.selectedColumns.length>0||this.ctx.grid.selectedCellRange)&&this.pipeline.dispatch({type:"clearSelection"}),this.pipeline.dispatch({type:"focusCell",target:l,selectText:!1});const w=this.ctx.grid.cellSelectionMode,p=t.shiftKey;return w!=="disabled"&&(w==="click"&&!p||w==="shift"&&p)&&this.pipeline.dispatch({type:"startCellSelection",rowIndex:l.rowIndex,colIndex:l.colIndex,clientX:t.clientX,clientY:t.clientY,shiftKey:t.shiftKey}),this.ctx.isTransitioningCells&&requestAnimationFrame(()=>{this.ctx.isTransitioningCells=!1}),!0}const g=this.ctx.dropdownOpen,h=this.isDropdownEditor(l.colIndex),f=tr(t,{cell:l,dropdownOpen:g,isDropdownEditor:h,isDateEditor:this.isDateEditor(l.colIndex),isCheckboxEditor:this.isCheckboxEditor(l.colIndex),isToggleClick:i,isDateTriggerClick:r,isCheckboxClick:s,isCellClick:n});if(f.length===0)return!1;t.preventDefault(),t.stopPropagation();for(const w of f)this.pipeline.dispatch(w);return!0}tryHandleClick(t){const o=t.target,i=this.getCellFromTarget(o);if(!i||this.getEditTrigger(i.colIndex)!=="click"||this.isEditingCell(i.rowIndex,i.colIndex))return!1;t.preventDefault();const s=this.isDropdownEditor(i.colIndex),n=this.isDateEditor(i.colIndex),l=this.isCustomEditor(i.colIndex);(s||n||l)&&t.stopImmediatePropagation();const a=o.closest(".wg__cell"),d=a?ht(t,a):null;return this.pipeline.dispatch({type:"startEdit",target:i,cursorPosition:d??void 0}),s?this.pipeline.dispatch({type:"openDropdown"}):n?this.pipeline.dispatch({type:"openDatePicker"}):l&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}tryHandleDblClick(t){const o=t.target,i=this.getCellFromTarget(o);if(!i)return!1;const r=this.getEditTrigger(i.colIndex);if(r!=="dblclick"&&r!=="navigate"||this.isEditingCell(i.rowIndex,i.colIndex))return!1;t.preventDefault();const s=this.isDropdownEditor(i.colIndex),n=this.isDateEditor(i.colIndex),l=this.isCustomEditor(i.colIndex),a=o.closest(".wg__cell"),d=a?ht(t,a):null;return this.pipeline.dispatch({type:"startEdit",target:i,cursorPosition:d??void 0}),s?this.pipeline.dispatch({type:"openDropdown"}):n?this.pipeline.dispatch({type:"openDatePicker"}):l&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}isDatepickerOpen(){return!!this.ctx.datepicker}clearSelection(){this.pipeline.dispatch({type:"clearSelection"})}}function _a(e){return new ba(e)}class xo extends HTMLElement{constructor(){super();b(this,"grid");b(this,"shadow");b(this,"styleElement");b(this,"customStyleElement",null);b(this,"updatePending",!1);b(this,"isCommittingFromKeyboard",!1);b(this,"isTransitioningCells",!1);b(this,"toolbarOutsideClickAdded",!1);b(this,"clickEventsSubscribed",!1);b(this,"focusEventsSubscribed",!1);b(this,"toolbarMoveInProgress",!1);b(this,"toolbarHideTimeout",null);b(this,"toolbarHovered",!1);b(this,"toolbarShortcutHandler",null);b(this,"hoveredCell",null);b(this,"currentCellToolbarItems",null);b(this,"toolbarMousemoveHandler",null);b(this,"inlineShortcutHandler",null);b(this,"dropdownOpen",!1);b(this,"dropdownOptions",[]);b(this,"highlightedIndex",-1);b(this,"filterText","");b(this,"isUserFiltering",!1);b(this,"justSelected",!1);b(this,"isOpeningDropdown",!1);b(this,"dropdownUserInteracted",!1);b(this,"isClosingViaToggle",!1);b(this,"isProgrammaticScroll",!1);b(this,"searchDebounceTimer",null);b(this,"searchAbortController",null);b(this,"isSearching",!1);b(this,"tooltipElement",null);b(this,"tooltipArrowElement",null);b(this,"tooltipAnchor",null);b(this,"tooltipShowTimer",null);b(this,"tooltipHideTimer",null);b(this,"_tooltipShowDelay",200);b(this,"_tooltipHideDelay",100);b(this,"datepicker",null);b(this,"contextMenuElement",null);b(this,"headerContextMenuElement",null);b(this,"virtualScrollStart",0);b(this,"virtualScrollEnd",0);b(this,"isLoadingMoreItems",!1);b(this,"scrollEvents");b(this,"focusEvents");b(this,"clickEvents");b(this,"pipelineAdapter",null);b(this,"_isMouseDown",!1);b(this,"handlePaste",async o=>{var l;if(!this.grid.isNavigateMode||this.grid.editingCell||!this.grid.focusedCell)return;const{rowIndex:i,colIndex:r}=this.grid.focusedCell,s=((l=o.clipboardData)==null?void 0:l.getData("text"))||"";if(!s)return;if(s.includes(" ")||s.includes(`
|
|
662
|
-
`))o.preventDefault(),await El(this,s,i,r),this.render();else{const a=this.grid.columns[r],d=this.grid.displayItems[i];if(!a||!d||!this.grid.isCellEditable(a))return;o.preventDefault();let c=s;a.beforePasteCallback&&(c=a.beforePasteCallback(s,d));const u=String(a.field);await this.grid.commitEdit(i,u,c),this.render()}});this.shadow=this.attachShadow({mode:"open"}),this.grid=new ei,this.scrollEvents=sl(),this.clickEvents=al(),this.focusEvents=ll(()=>({isCommittingFromKeyboard:this.isCommittingFromKeyboard,isTransitioningCells:this.isTransitioningCells,isClosingViaToggle:this.isClosingViaToggle,isOpeningDropdown:this.isOpeningDropdown}),()=>{this.isClosingViaToggle=!1}),this.styleElement=document.createElement("style"),this.styleElement.textContent=Wn,this.shadow.appendChild(this.styleElement),this.grid.requestUpdate=()=>this.requestUpdate(),this.grid._onInteractionChange=(o,i)=>{o==="editingCell"&&i.current===null&&q(this)}}get tooltipShowDelay(){return this._tooltipShowDelay}set tooltipShowDelay(o){this._tooltipShowDelay=o}get tooltipHideDelay(){return this._tooltipHideDelay}set tooltipHideDelay(o){this._tooltipHideDelay=o}connectedCallback(){ro.debug("connectedCallback — grid attached to DOM"),this.grid.gridName&&this.grid.shouldPersistColumnWidths&&this.grid.loadPersistedWidths(),this.pipelineAdapter=_a(this),this.render(),this.addEventListener("paste",this.handlePaste)}disconnectedCallback(){ro.debug("disconnectedCallback — grid removed from DOM"),this.scrollEvents.destroy(),this.focusEvents.destroy(),this.clickEvents.destroy(),this.clickEventsSubscribed=!1,this.focusEventsSubscribed=!1,this.removeEventListener("paste",this.handlePaste),this.datepicker&&(this.datepicker.destroy(),this.datepicker=null),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null),Tt(),this.removeInlineShortcuts(),vl()}get items(){return this.grid.items}set items(o){this.grid.items=o,this.isLoadingMoreItems=!1}get columns(){return this.grid.columns}set columns(o){this.grid.columns=o}get isFilterable(){return this.grid.isFilterable}set isFilterable(o){this.grid.isFilterable=o}get isPageable(){return this.grid.isPageable}set isPageable(o){this.grid.isPageable=o}get pageSize(){return this.grid.pageSize}set pageSize(o){this.grid.pageSize=o}get pageSizes(){return this.grid.pageSizes}set pageSizes(o){this.grid.pageSizes=o}get paginationMode(){return this.grid.paginationMode}set paginationMode(o){this.grid.paginationMode=o}get isStriped(){return this.grid.isStriped}set isStriped(o){this.grid.isStriped=o}get isHoverable(){return this.grid.isHoverable}set isHoverable(o){this.grid.isHoverable=o}get isEditable(){return this.grid.isEditable}set isEditable(o){this.grid.isEditable=o}get editTrigger(){return this.grid.editTrigger}set editTrigger(o){this.grid.editTrigger=o}get editStartSelection(){return this.grid.editStartSelection}set editStartSelection(o){this.grid.editStartSelection=o}get mode(){return this.grid.mode}set mode(o){this.grid.mode=o}get dropdownToggleVisibility(){return this.grid.dropdownToggleVisibility}set dropdownToggleVisibility(o){this.grid.dropdownToggleVisibility=o}get shouldShowDropdownOnFocus(){return this.grid.shouldShowDropdownOnFocus}set shouldShowDropdownOnFocus(o){this.grid.shouldShowDropdownOnFocus=o}get shouldOpenDropdownOnEnter(){return this.grid.shouldOpenDropdownOnEnter}set shouldOpenDropdownOnEnter(o){this.grid.shouldOpenDropdownOnEnter=o}get isCheckboxAlwaysEditable(){return this.grid.isCheckboxAlwaysEditable}set isCheckboxAlwaysEditable(o){this.grid.isCheckboxAlwaysEditable=o}get isRowNumbersVisible(){return this.grid.isRowNumbersVisible}set isRowNumbersVisible(o){this.grid.isRowNumbersVisible=o}get isDirtyIndicatorVisible(){return this.grid.isDirtyIndicatorVisible}set isDirtyIndicatorVisible(o){this.grid.isDirtyIndicatorVisible=o}isCellDirty(o,i){return this.grid.isCellDirty(o,i)}isRowDirty(o){return this.grid.isRowDirty(o)}get isStickyRowNumbers(){return this.grid.isStickyRowNumbers}set isStickyRowNumbers(o){this.grid.isStickyRowNumbers=o}get freezeColumns(){return this.grid.freezeColumns}set freezeColumns(o){this.grid.freezeColumns=o}get invalidCells(){return this.grid.invalidCells}set invalidCells(o){this.grid.invalidCells=o}get isRowToolbarVisible(){return this.grid.isRowToolbarVisible}set isRowToolbarVisible(o){this.grid.isRowToolbarVisible=o}get rowToolbar(){return this.grid.rowToolbar}set rowToolbar(o){this.grid.rowToolbar=o}get toolbarVerticalAlign(){return this.grid.toolbarVerticalAlign}set toolbarVerticalAlign(o){this.grid.toolbarVerticalAlign=o}get toolbarHorizontalAlign(){return this.grid.toolbarHorizontalAlign}set toolbarHorizontalAlign(o){this.grid.toolbarHorizontalAlign=o}get toolbarAlign(){return this.grid.toolbarVerticalAlign}set toolbarAlign(o){this.grid.toolbarVerticalAlign=o}get toolbarTopPosition(){return this.grid.toolbarHorizontalAlign}set toolbarTopPosition(o){this.grid.toolbarHorizontalAlign=o}get toolbarTrigger(){return this.grid.toolbarTrigger}set toolbarTrigger(o){this.grid.toolbarTrigger=o}get toolbarPosition(){return this.grid.toolbarPosition}set toolbarPosition(o){this.grid.toolbarPosition=o}get toolbarColumn(){return this.grid.toolbarColumn}set toolbarColumn(o){this.grid.toolbarColumn=o}get toolbarFollowsCursor(){return this.grid.toolbarFollowsCursor}set toolbarFollowsCursor(o){this.grid.toolbarFollowsCursor=o}get cellToolbar(){return this.grid.cellToolbar}set cellToolbar(o){this.grid.cellToolbar=o}get cellToolbarOffset(){return this.grid.cellToolbarOffset}set cellToolbarOffset(o){this.grid.cellToolbarOffset=o}get toolbarBtnMinWidth(){return this.grid.toolbarBtnMinWidth}set toolbarBtnMinWidth(o){this.grid.toolbarBtnMinWidth=o}get inlineActionsTitle(){return this.grid.inlineActionsTitle}set inlineActionsTitle(o){this.grid.inlineActionsTitle=o}get contextMenu(){return this.grid.contextMenu}set contextMenu(o){this.grid.contextMenu=o}get contextMenuXOffset(){return this.grid.contextMenuXOffset}set contextMenuXOffset(o){this.grid.contextMenuXOffset=o}get contextMenuYOffset(){return this.grid.contextMenuYOffset}set contextMenuYOffset(o){this.grid.contextMenuYOffset=o}get headerContextMenu(){return this.grid.headerContextMenu}set headerContextMenu(o){this.grid.headerContextMenu=o}set onheadercontextmenuopen(o){this.grid.onheadercontextmenuopen=o}get rowShortcuts(){return this.grid.rowShortcuts}set rowShortcuts(o){this.grid.rowShortcuts=o}get rangeShortcuts(){return this.grid.rangeShortcuts}set rangeShortcuts(o){this.grid.rangeShortcuts=o}get selectedRows(){return this.grid.selectedRows}selectRow(o,i="replace"){this.grid.selectRow(o,i)}selectRowRange(o,i){this.grid.selectRowRange(o,i)}clearSelection(){this.grid.clearSelection()}isRowSelected(o){return this.grid.isRowSelected(o)}getSelectedRowsData(){return this.grid.getSelectedRowsData()}copySelectedRowsToClipboard(){return this.grid.copySelectedRowsToClipboard()}get cellSelectionMode(){return this.grid.cellSelectionMode}set cellSelectionMode(o){this.grid.cellSelectionMode=o}get selectedCellRange(){return this.grid.selectedCellRange}selectCellRange(o){this.grid.selectCellRange(o)}clearCellSelection(){this.grid.clearCellSelection()}getSelectedCells(){return this.grid.getSelectedCells()}copyCellSelectionToClipboard(){return this.grid.copyCellSelectionToClipboard()}get shouldCopyWithHeaders(){return this.grid.shouldCopyWithHeaders}set shouldCopyWithHeaders(o){this.grid.shouldCopyWithHeaders=o}get oncellselectionchange(){return this.grid.oncellselectionchange}set oncellselectionchange(o){this.grid.oncellselectionchange=o}get isNewRowEnabled(){return this.grid.isNewRowEnabled}set isNewRowEnabled(o){this.grid.isNewRowEnabled=o}get newRowPosition(){return this.grid.newRowPosition}set newRowPosition(o){this.grid.newRowPosition=o}get newRowIndicator(){return this.grid.newRowIndicator}set newRowIndicator(o){this.grid.newRowIndicator=o}get createEmptyRowCallback(){return this.grid.createEmptyRowCallback}set createEmptyRowCallback(o){this.grid.createEmptyRowCallback=o}get isShortcutsHelpVisible(){return this.grid.isShortcutsHelpVisible}set isShortcutsHelpVisible(o){this.grid.isShortcutsHelpVisible=o}get shortcutsHelpPosition(){return this.grid.shortcutsHelpPosition}set shortcutsHelpPosition(o){this.grid.shortcutsHelpPosition=o}get shortcutsHelpContentCallback(){return this.grid.shortcutsHelpContentCallback}set shortcutsHelpContentCallback(o){this.grid.shortcutsHelpContentCallback=o}set onrowchange(o){this.grid.onrowchange=o}set onroweditstart(o){this.grid.onroweditstart=o}set onroweditcancel(o){this.grid.onroweditcancel=o}set onvalidationerror(o){this.grid.onvalidationerror=o}get validationTooltipCallback(){return this.grid.validationTooltipCallback}set validationTooltipCallback(o){this.grid.validationTooltipCallback=o}set ontoolbarclick(o){this.grid.ontoolbarclick=o}set onrowaction(o){this.grid.onrowaction=o}set oncontextmenuopen(o){this.grid.oncontextmenuopen=o}get ondatarequest(){return this.grid.ondatarequest}set ondatarequest(o){this.grid.ondatarequest=o}get onrowdelete(){return this.grid.onrowdelete}set onrowdelete(o){this.grid.onrowdelete=o}get onrowfocus(){return this.grid.onrowfocus}set onrowfocus(o){this.grid.onrowfocus=o}get focusedRowIndex(){return this.grid.focusedRowIndex}set focusedRowIndex(o){this.grid.focusedRowIndex=o}get sort(){return this.grid.sort}set sort(o){this.grid.sort=o}get sortMode(){return this.grid.sortMode}set sortMode(o){this.grid.sortMode=o}get currentPage(){return this.grid.currentPage}set currentPage(o){this.grid.currentPage=o}get totalItems(){return this.grid.totalItems}set totalItems(o){this.grid.totalItems=o}get showPagination(){return this.grid.showPagination}set showPagination(o){this.grid.showPagination=o}get paginationPosition(){return this.grid.paginationPosition}set paginationPosition(o){this.grid.paginationPosition=o}get paginationLabelsCallback(){return this.grid.paginationLabelsCallback}set paginationLabelsCallback(o){this.grid.paginationLabelsCallback=o}get paginationLayout(){return this.grid.paginationLayout}set paginationLayout(o){this.grid.paginationLayout=o}get summaryPosition(){return this.grid.summaryPosition}set summaryPosition(o){this.grid.summaryPosition=o}get summaryContentCallback(){return this.grid.summaryContentCallback}set summaryContentCallback(o){this.grid.summaryContentCallback=o}get customStylesCallback(){return this.grid.customStylesCallback}set customStylesCallback(o){this.grid.customStylesCallback=o,this.updateCustomStyles()}get rowClassCallback(){return this.grid.rowClassCallback}set rowClassCallback(o){this.grid.rowClassCallback=o}get labels(){return this.grid.labels}set labels(o){this.grid.labels=o}get summaryMetadata(){return this.grid.summaryMetadata}set summaryMetadata(o){this.grid.summaryMetadata=o}get isSummaryInline(){return this.grid.isSummaryInline}set isSummaryInline(o){this.grid.isSummaryInline=o}get idValueMember(){return this.grid.idValueMember}set idValueMember(o){this.grid.idValueMember=o}get idValueCallback(){return this.grid.idValueCallback}set idValueCallback(o){this.grid.idValueCallback=o}get rowLocking(){return this.grid.rowLocking}set rowLocking(o){this.grid.rowLocking=o}get onrowlockchange(){return this.grid.onrowlockchange}set onrowlockchange(o){this.grid.onrowlockchange=o}get gridName(){return this.grid.gridName}set gridName(o){this.grid.gridName=o,this.tryLoadPersistedWidths()}get shouldPersistColumnWidths(){return this.grid.shouldPersistColumnWidths}set shouldPersistColumnWidths(o){this.grid.shouldPersistColumnWidths=o,this.tryLoadPersistedState()}get isColumnReorderAllowed(){return this.grid.isColumnReorderAllowed}set isColumnReorderAllowed(o){this.grid.isColumnReorderAllowed=o}get shouldPersistColumnOrder(){return this.grid.shouldPersistColumnOrder}set shouldPersistColumnOrder(o){this.grid.shouldPersistColumnOrder=o,this.tryLoadPersistedState()}tryLoadPersistedState(){this.grid.gridName&&(this.grid.shouldPersistColumnWidths||this.grid.shouldPersistColumnOrder)&&(this.grid.loadPersistedState(),this.isConnected&&this.render())}tryLoadPersistedWidths(){this.tryLoadPersistedState()}get oncolumnresize(){return this.grid.oncolumnresize}set oncolumnresize(o){this.grid.oncolumnresize=o}get oncolumnreorder(){return this.grid.oncolumnreorder}set oncolumnreorder(o){this.grid.oncolumnreorder=o}get fillDragCallback(){return this.grid.fillDragCallback}set fillDragCallback(o){this.grid.fillDragCallback=o}get isScrollable(){return this.grid.isScrollable}set isScrollable(o){this.grid.isScrollable=o}get scrollMaxHeight(){return this.grid.scrollMaxHeight}set scrollMaxHeight(o){this.grid.scrollMaxHeight=o}get tableBorderOnly(){return this.grid.tableBorderOnly}set tableBorderOnly(o){this.grid.tableBorderOnly=o}get isVirtualScrollEnabled(){return this.grid.isVirtualScrollEnabled}set isVirtualScrollEnabled(o){this.grid.isVirtualScrollEnabled=o}get virtualScrollThreshold(){return this.grid.virtualScrollThreshold}set virtualScrollThreshold(o){this.grid.virtualScrollThreshold=o}get virtualScrollRowHeight(){return this.grid.virtualScrollRowHeight}set virtualScrollRowHeight(o){this.grid.virtualScrollRowHeight=o}get virtualScrollBuffer(){return this.grid.virtualScrollBuffer}set virtualScrollBuffer(o){this.grid.virtualScrollBuffer=o}get isInfiniteScrollEnabled(){return this.grid.isInfiniteScrollEnabled}set isInfiniteScrollEnabled(o){this.grid.isInfiniteScrollEnabled=o}get infiniteScrollThreshold(){return this.grid.infiniteScrollThreshold}set infiniteScrollThreshold(o){this.grid.infiniteScrollThreshold=o}get hasMoreItems(){return this.grid.hasMoreItems}set hasMoreItems(o){this.grid.hasMoreItems=o}get displayItems(){return this.grid.displayItems}get totalPages(){return this.grid.totalPages}get isNavigateMode(){return this.grid.isNavigateMode}getRowDraft(o){return this.grid.getRowDraft(o)}hasRowDraft(o){return this.grid.hasRowDraft(o)}discardRowDraft(o){this.grid.discardRowDraft(o)}getDraftRowIndices(){return this.grid.getDraftRowIndices()}discardAllDrafts(){this.grid.discardAllDrafts()}isCellInvalid(o,i){return this.grid.isCellInvalid(o,i)}getCellValidationError(o,i){return this.grid.getCellValidationError(o,i)}getRowId(o){return this.grid.getRowId(o)}findRowById(o){return this.grid.findRowById(o)}isRowLocked(o){return this.grid.isRowLocked(o)}getRowLockInfo(o){return this.grid.getRowLockInfo(o)}lockRowById(o,i){return this.grid.lockRowById(o,i)}unlockRowById(o){return this.grid.unlockRowById(o)}getExternalLocks(){return this.grid.getExternalLocks()}clearExternalLocks(){this.grid.clearExternalLocks()}updateRowById(o,i){return this.grid.updateRowById(o,i)}replaceRowById(o,i){return this.grid.replaceRowById(o,i)}canEditCell(o,i){return this.grid.canEditCell(o,i)}setColumnWidth(o,i){this.grid.setColumnWidth(o,i)}setColumnWidths(o){this.grid.setColumnWidths(o)}getColumnWidthsState(){return this.grid.getColumnWidthsState()}setColumnOrder(o){this.grid.setColumnOrder(o)}getColumnOrderState(){return this.grid.getColumnOrderState()}focusCell(o,i){const r=this.grid.columns,s=this.grid.displayItems;o<0||o>=s.length||i<0||i>=r.length||(this.grid.setFocusedCell(o,i),requestAnimationFrame(()=>{V(this,o,i)}))}startEditing(o,i){const r=this.grid.columns;if(i<0||i>=r.length)return;const s=r[i],n=String(s.field);this.grid.startEdit(o,n);const l=this.shadow.querySelector(`td[data-row="${o}"][data-col="${i}"]`);l&&(l.classList.remove("wg__cell--focused"),l.classList.add("wg__cell--editing"),l.innerHTML=At(this,o,i,s))}escapeHtml(o){const i=document.createElement("div");return i.textContent=o,i.innerHTML}getCurrentEditingColumn(){const o=this.grid.editingCell;return o&&this.grid.columns.find(i=>String(i.field)===o.field)||null}getCurrentEditorOptions(){const o=this.getCurrentEditingColumn();return(o==null?void 0:o.editorOptions)||{}}moveFocusAfterCommit(o,i,r){wo(this,o,i,r)}requestUpdate(){this.updatePending||(Jo.debug("requestUpdate: scheduling render"),this.updatePending=!0,queueMicrotask(()=>{this.updatePending=!1,this.render()}))}updateCustomStyles(){const o=this.grid.customStylesCallback;if(o){const i=o();this.customStyleElement||(this.customStyleElement=document.createElement("style"),this.shadow.appendChild(this.customStyleElement)),this.customStyleElement.textContent=i}else this.customStyleElement&&(this.customStyleElement.remove(),this.customStyleElement=null)}handleCellKeyDown(o,i,r){var u;if(!this.grid.isNavigateMode)return;const s=this.grid.columns,n=this.grid.displayItems,l=this.grid.getEditableColumns(),a=l.findIndex(g=>g.index===r);if((o.ctrlKey||o.metaKey)&&o.key==="c"){if(this.grid.selectedCellRange){o.preventDefault(),this.grid.copyCellSelectionToClipboard();return}const g=s[r],h=n[i];if(g&&h){let f=this.grid.getCellRawValue(h,i,String(g.field));g.beforeCopyCallback&&(f=g.beforeCopyCallback(f,h));const w=f!=null?String(f):"";navigator.clipboard.writeText(w)}return}const d=this.grid.selectedRows;if(d.length>0){const g=this.grid.rangeShortcuts;if(g&&g.length>0)for(const h of g){const f=wt(h.key);if(pt(o,f)){const w={rows:this.grid.getSelectedRowsData(),rowIndices:d};if(!(typeof h.disabled=="function"?h.disabled(w):h.disabled===!0)){o.preventDefault(),h.action(w);return}}}}const c=this.grid.rowShortcuts;if(c&&c.length>0){const g=s[r],h=n[i];if(g&&h)for(const f of c){const w=wt(f.key);if(pt(o,w)){const p={row:h,rowIndex:i,colIndex:r,column:g,cellValue:this.grid.getCellRawValue(h,i,String(g.field))};if(!(typeof f.disabled=="function"?f.disabled(p):f.disabled===!0)){o.preventDefault(),f.action(p);return}}}}switch(o.key){case"ArrowUp":o.preventDefault(),i>0&&V(this,i-1,r);break;case"ArrowDown":o.preventDefault(),i<n.length-1&&V(this,i+1,r);break;case"ArrowLeft":o.preventDefault(),r>0&&V(this,i,r-1);break;case"ArrowRight":o.preventDefault(),r<s.length-1&&V(this,i,r+1);break;case"Tab":if(o.preventDefault(),o.shiftKey){if(a>0){const g=l[a-1].index;V(this,i,g)}else if(i>0){const g=l[l.length-1].index;V(this,i-1,g)}}else if(a>=0&&a<l.length-1){const g=l[a+1].index;V(this,i,g)}else if(a===-1&&l.length>0)V(this,i,l[0].index);else if(i<n.length-1){const g=l[0].index;V(this,i+1,g)}else this.grid.isEmptyRowIndex(i)&&V(this,i,l[0].index);break;case"Home":if(o.preventDefault(),o.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(0,0),this.scrollToRowProgrammatically(0);const h=this.shadow.querySelector('td[data-row="0"][data-col="0"]');h&&(h.focus({preventScroll:!0}),J(this,g,{rowIndex:0,colIndex:0}))}else V(this,0,0);else V(this,i,0);break;case"End":if(o.preventDefault(),o.ctrlKey){const g=n.length-1,h=s.length-1;if(this.grid.shouldUseVirtualScroll()){const f=this.grid.focusedCell;this.grid.setFocusedCell(g,h),this.scrollToRowProgrammatically(g);const w=this.shadow.querySelector(`td[data-row="${g}"][data-col="${h}"]`);w&&(w.focus({preventScroll:!0}),J(this,f,{rowIndex:g,colIndex:h}))}else V(this,g,h)}else V(this,i,s.length-1);break;case"PageUp":if(o.preventDefault(),o.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(0,r),this.scrollToRowProgrammatically(0);const h=this.shadow.querySelector(`td[data-row="0"][data-col="${r}"]`);h&&(h.focus({preventScroll:!0}),J(this,g,{rowIndex:0,colIndex:r}))}else V(this,0,r);else{const g=Math.max(0,i-10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),J(this,h,{rowIndex:g,colIndex:r}))}else V(this,g,r)}break;case"PageDown":if(o.preventDefault(),o.ctrlKey){const g=n.length-1;if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),J(this,h,{rowIndex:g,colIndex:r}))}else V(this,g,r)}else{const g=Math.min(n.length-1,i+10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),J(this,h,{rowIndex:g,colIndex:r}))}else V(this,g,r)}break;case"g":case"G":o.ctrlKey&&(o.preventDefault(),this.showGoToRowDialog(r));break;case"Enter":{o.preventDefault();const g=s[r],h=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",f=this.grid.isEmptyRowIndex(i);if(h&&this.grid.getEffectiveShouldOpenDropdownOnEnter(g))se(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||we(this)});else if(f&&g&&this.grid.isCellEditable(g))se(this,i,r);else if(i<n.length-1){const w=this.grid.tabTraversalStartColIndex??r;this.grid.tabTraversalStartColIndex=null,V(this,i+1,w)}break}case"F2":{o.preventDefault();const g=s[r],h=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",f=(g==null?void 0:g.editor)==="custom";se(this,i,r),h?requestAnimationFrame(()=>{this.dropdownOpen||we(this)}):f&&requestAnimationFrame(()=>{this.openCustomEditor(i,r)});break}case" ":{o.preventDefault();const g=s[r],h=(g==null?void 0:g.editor)==="checkbox",f=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",w=(g==null?void 0:g.editor)==="date",p=(g==null?void 0:g.editor)==="custom";h&&g&&this.grid.isCellEditable(g)?cs(this,i,r):f?(se(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||we(this)})):w?(se(this,i,r),requestAnimationFrame(()=>{var x;const m=(x=this.shadowRoot)==null?void 0:x.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`),v=m==null?void 0:m.querySelector(".wg__date-input"),y=m==null?void 0:m.querySelector(".wg__editor--date");v&&y&&this.openDatePicker(v,y)})):p&&(se(this,i,r),requestAnimationFrame(()=>{this.openCustomEditor(i,r)}));break}case"Escape":if(o.preventDefault(),this.grid.editingCell)K(this),this.grid.cancelEdit();else if(this.grid.selectedRows.length>0)this.grid.clearSelection();else{const g=this.grid.focusedCell;this.grid.clearFocusedCell(),J(this,g,null),(u=o.target)==null||u.blur()}break;case"Delete":{o.preventDefault();const g=s[r],h=n[i];if(o.ctrlKey){if(h){const f={rowIndex:i,row:h};this.grid.onrowdelete&&this.grid.onrowdelete(f),this.dispatchEvent(new CustomEvent("rowdelete",{detail:f}))}}else g&&this.grid.isCellEditable(g)&&(this.grid.commitEdit(i,String(g.field),null),this.render(),requestAnimationFrame(()=>{const f=this.shadow.querySelector(`td[data-row="${i}"][data-col="${r}"]`);f==null||f.focus()}));break}default:if(o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey){const g=s[r];if((g==null?void 0:g.editor)==="number"&&!/[\d.\-]/.test(o.key))return;se(this,i,r,{initialSearchQuery:o.key}),o.preventDefault()}break}}async handleEditorKeyDown(o,i){const r=parseInt(i.dataset.row||"0",10),s=i.dataset.field||"",n=this.grid.columns.find(c=>c.field===s),l=(n==null?void 0:n.editor)||"text",a=l==="select"||l==="combobox"||l==="autocomplete",d=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"];if(a&&!this.dropdownOpen&&d.includes(o.key)){o.preventDefault(),o.stopPropagation();const c=this.grid.columns.findIndex(m=>m.field===s),u=this.grid.columns.map((m,v)=>({index:v,column:m})).filter(m=>m.column.isEditable!==!1),g=u.findIndex(m=>m.index===c),h=this.grid.displayItems;let f=r,w=c,p=!1;switch(o.key){case"ArrowUp":r>0&&(f=r-1,p=!0);break;case"ArrowDown":r<h.length-1&&(f=r+1,p=!0);break;case"ArrowLeft":g>0&&(w=u[g-1].index,p=!0);break;case"ArrowRight":g<u.length-1&&(w=u[g+1].index,p=!0);break;case"PageUp":f=Math.max(0,r-10),p=!0;break;case"PageDown":f=Math.min(h.length-1,r+10),p=!0;break;case"Home":o.ctrlKey&&(f=0),w=0,p=!0;break;case"End":o.ctrlKey?(f=h.length-1,w=this.grid.columns.length-1):w=this.grid.columns.length-1,p=!0;break}p&&(K(this),this.grid.cancelEdit(),queueMicrotask(()=>{V(this,f,w)}));return}switch(o.key){case"ArrowDown":if(this.dropdownOpen){o.preventDefault(),o.stopPropagation();const p=this.getCurrentEditorOptions();let m=this.highlightedIndex+1;for(;m<this.dropdownOptions.length&&de(this.dropdownOptions[m],p);)m++;m<this.dropdownOptions.length&&(this.highlightedIndex=m,fe(this),bo(this))}break;case"ArrowUp":if(this.dropdownOpen){o.preventDefault(),o.stopPropagation();const p=this.getCurrentEditorOptions();let m=this.highlightedIndex-1;for(;m>=0&&de(this.dropdownOptions[m],p);)m--;m>=0&&(this.highlightedIndex=m,fe(this),bo(this))}break;case"Enter":if(this.datepicker)return;o.preventDefault(),o.stopPropagation(),this.dropdownOpen&&this.highlightedIndex>=0?wi(this,this.highlightedIndex,!0,!0):a&&!this.dropdownOpen?we(this):(this.isCommittingFromKeyboard=!0,q(this),l==="date"&&i instanceof HTMLInputElement?await this.commitDateEditor(i,!0):await $t(this,i,!0),wo(this,r,s,"down"));break;case"Tab":if(this.datepicker)return;o.preventDefault(),o.stopPropagation(),this.isCommittingFromKeyboard=!0;const c=this.grid.getEditableColumns(),u=this.grid.columns.findIndex(p=>String(p.field)===s),g=c.findIndex(p=>p.index===u),h=this.grid.isEmptyRowIndex(r),f=g===c.length-1,w=h&&f&&!o.shiftKey;if(this.dropdownOpen&&this.highlightedIndex>=0&&a){const p=this.dropdownOptions[this.highlightedIndex],m=this.getCurrentEditorOptions();if(p&&!de(p,m)){const v=Ae(p,m);await this.grid.commitEdit(r,s,v,w)}q(this)}else q(this),l==="date"&&i instanceof HTMLInputElement?await this.commitDateEditor(i,w):a||await $t(this,i,w);if(w){Mt(this,r,u);const p=c.length>0?c[0].index:0;queueMicrotask(()=>{const m=this.grid.newRowPosition==="top"?0:this.grid.displayItems.length-1;V(this,m,p),this.isCommittingFromKeyboard=!1})}else wo(this,r,s,o.shiftKey?"prev":"next");break;case"Escape":if(o.preventDefault(),o.stopPropagation(),this.dropdownOpen){q(this),(l==="autocomplete"||l==="combobox")&&(this.filterText="",i instanceof HTMLInputElement&&(i.value="",i.focus()));return}if(this.datepicker){this.datepicker.close(!0),this.datepicker=null;return}this.isCommittingFromKeyboard=!0,K(this),this.grid.cancelEdit(),us(this,r,s);break;case"F2":o.preventDefault(),o.stopPropagation(),a&&!this.dropdownOpen&&we(this);break;case"Backspace":l==="select"&&(o.preventDefault(),o.stopPropagation(),this.filterText.length>0&&(this.filterText=this.filterText.slice(0,-1),pi(this,n.editorOptions||{})));break;default:l==="select"&&o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&(o.preventDefault(),o.stopPropagation(),this.filterText+=o.key,pi(this,n.editorOptions||{}));break}}attachEventListeners(){const o=this.shadow.querySelector(".wg__table");if(!o)return;o.addEventListener("mousedown",()=>{this._isMouseDown=!0},!0),document.addEventListener("mouseup",()=>{this._isMouseDown=!1},!0),o.addEventListener("focus",n=>{const l=n.target;if(l.matches(".wg__cell")){const a=parseInt(l.dataset.row||"0",10),d=parseInt(l.dataset.col||"0",10);if(ss(this,a,d),Lt(this),!this._isMouseDown&&!yo()&&!$i()){const c=this.grid.focusedRowIndex;this.grid.setFocusedRow(a),this.updateRowFocusVisual(c,a)}fo(this,l,a)}if(l.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger")){const a=l.closest(".wg__cell");if(a){const d=parseInt(a.dataset.row||"0",10),c=parseInt(a.dataset.col||"0",10),u=this.grid.columns[c];if(((u==null?void 0:u.editTrigger)??this.grid.editTrigger)==="always"){const h=this.grid.focusedCell;if(!h||h.rowIndex!==d||h.colIndex!==c){if(this.grid.setFocusedCell(d,c),h){const f=this.shadow.querySelector(`td[data-row="${h.rowIndex}"][data-col="${h.colIndex}"]`);f&&f.classList.remove("wg__cell--always-edit-focused")}if(a.classList.add("wg__cell--always-edit-focused"),!this._isMouseDown){const f=this.grid.focusedRowIndex;this.grid.setFocusedRow(d),this.updateRowFocusVisual(f,d)}}}}}},!0),o.addEventListener("keydown",n=>{var a;const l=n.target;if(!((a=this.pipelineAdapter)!=null&&a.tryHandleKeyDown(n))){if(this.datepicker){const d=n.key;if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(d))return}if(l.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input")){this.handleEditorKeyDown(n,l);return}if(l.matches(".wg__cell")){const d=parseInt(l.dataset.row||"0",10),c=parseInt(l.dataset.col||"0",10);this.handleCellKeyDown(n,d,c)}}}),this.focusEvents.init(o),this.focusEvents.subscribe("focusout",(n,l)=>{(!l||!o.contains(l))&&ls(this,{relatedTarget:l})}),o.addEventListener("dblclick",n=>{var d;if((d=this.pipelineAdapter)!=null&&d.tryHandleDblClick(n))return;n.preventDefault();const a=n.target.closest(".wg__cell");if(a){const c=parseInt(a.dataset.row||"0",10),u=parseInt(a.dataset.col||"0",10),g=this.grid.columns[u];if(g){const h=g.editTrigger||this.grid.editTrigger;if(h==="dblclick"||h==="navigate"){const f=ht(n,a);se(this,c,u,{cursorPosition:f??void 0});const w=g.editor;w==="select"||w==="combobox"||w==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||we(this)}):w==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(c,u)})}}}}),o.addEventListener("click",n=>{var d;if((d=this.pipelineAdapter)!=null&&d.tryHandleClick(n))return;const a=n.target.closest(".wg__cell");if(a&&!a.classList.contains("wg__cell--editing")){const c=parseInt(a.dataset.row||"0",10),u=parseInt(a.dataset.col||"0",10),g=this.grid.columns[u];if(g&&(g.editTrigger||this.grid.editTrigger)==="click"){n.preventDefault();const f=ht(n,a);se(this,c,u,{cursorPosition:f??void 0});const w=g.editor;w==="select"||w==="combobox"||w==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||we(this)}):w==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(c,u)})}}}),o.addEventListener("mousedown",n=>{var g,h;const l=n.target,a=n;if((g=this.pipelineAdapter)!=null&&g.tryHandleMouseDown(a))return;const d=l.closest(".wg__cell"),c=l.closest(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(d&&!d.classList.contains("wg__cell--editing")&&!l.closest(".wg__row-number")&&!c){const f=parseInt(d.dataset.row||"0",10),w=parseInt(d.dataset.col||"0",10),p=(h=this.grid.visualColumns[w])==null?void 0:h.column;if(p){const m=this.grid.cellSelectionMode,v=a.shiftKey;if(p.editTrigger||this.grid.editTrigger,m!=="disabled"&&(m==="click"&&!v||m==="shift"&&v)){if(this.grid.editingCell){const x=this.grid.editingCell,C=this.grid.columns.findIndex(_=>String(_.field)===x.field);q(this),K(this),this.grid.cancelEdit(),C>=0&&H(this,x.rowIndex,C)}this.grid.selectedRows.length>0&&this.grid.clearSelection(),this.grid.selectedColumns.length>0&&this.grid.clearColumnSelection(),Ai(this,f,w,a);return}else this.grid.selectedCellRange&&(this.grid.clearCellSelection(),G())}}if(l.closest(".wg__date-trigger")){n.preventDefault(),n.stopPropagation();const f=l.closest(".wg__cell-date-display"),w=l.closest(".wg__editor--date");if(w){const p=w.querySelector(".wg__date-input");p&&this.openDatePicker(p,w)}else if(f){const p=parseInt(f.dataset.row||"0",10),m=f.dataset.field||"",v=this.grid.columns.findIndex(y=>String(y.field)===m);if(v>=0){if(this.clearAllSelections(),this.isTransitioningCells=!0,this.grid.editingCell){const y=this.grid.editingCell,x=this.grid.columns.findIndex(C=>String(C.field)===y.field);q(this),K(this),this.grid.cancelEdit(),this.grid.setFocusedCell(p,v),x>=0&&H(this,y.rowIndex,x)}se(this,p,v),requestAnimationFrame(()=>{var _;this.isTransitioningCells=!1;const y=(_=this.shadowRoot)==null?void 0:_.querySelector(`.wg__cell[data-row="${p}"][data-field="${m}"]`),x=y==null?void 0:y.querySelector(".wg__date-input"),C=y==null?void 0:y.querySelector(".wg__editor--date");x&&C&&this.openDatePicker(x,C)})}}return}if(this.dropdownOpen||this.grid.editingCell){const f=l.closest(".wg__cell");if(f&&!l.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete, .wg__editor--date")){const w=parseInt(f.dataset.row||"0",10),p=parseInt(f.dataset.col||"0",10),m=this.grid.editingCell,v=l.matches(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(m&&!v){const y=this.grid.columns.findIndex(x=>String(x.field)===m.field);if(w!==m.rowIndex||p!==y){n.preventDefault(),this.isTransitioningCells=!0;const x=m.rowIndex,C=y;q(this),K(this),this.grid.cancelEdit(),this.grid.setFocusedCell(w,p),C>=0&&H(this,x,C);const _=this.grid.columns[p],S=(_==null?void 0:_.editTrigger)||this.grid.editTrigger,E=n.clientX;requestAnimationFrame(()=>{if(this.isTransitioningCells=!1,S==="click"&&_&&this.grid.isCellEditable(_)){const R=this.shadow.querySelector(`td[data-row="${w}"][data-col="${p}"]`),I=R?ht({clientX:E},R):void 0;se(this,w,p,{cursorPosition:I??void 0})}else V(this,w,p)});return}}}}if(l.matches(".wg__cell-dropdown-display")){n.preventDefault(),n.stopPropagation();const f=l.closest(".wg__cell-dropdown-display");if(f){const w=parseInt(f.dataset.row||"0",10),p=f.dataset.field||"",m=this.grid.columns.findIndex(v=>String(v.field)===p);if(m>=0){this.isTransitioningCells=!0;const v=this.grid.editingCell,y=v?this.grid.columns.findIndex(x=>String(x.field)===v.field):-1;v&&(q(this),K(this),this.grid.cancelEdit(),this.grid.setFocusedCell(w,m),y>=0&&H(this,v.rowIndex,y)),se(this,w,m),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||we(this)})}}}}),o.addEventListener("click",n=>{const l=n.target;if(l.matches(".wg__select-trigger, .wg__select-value")){const a=l.closest(".wg__cell");if(a){const d=parseInt(a.dataset.col||"",10),c=this.grid.columns[d];if(((c==null?void 0:c.editTrigger)??this.grid.editTrigger)==="always")return}n.preventDefault(),n.stopPropagation(),Ms(this)}}),o.addEventListener("mousedown",n=>{const l=n.target,a=l.closest(".wg__resize-handle");if(a){n.preventDefault(),n.stopPropagation(),this.clearAllSelections();const g=a.dataset.field;g&&js(this,n,g);return}if(this.grid.isColumnReorderAllowed){const g=n;if(!g.ctrlKey&&!g.metaKey&&!g.shiftKey){const h=l.closest(".wg__header");if(h&&!h.classList.contains("wg__header--frozen")&&!h.classList.contains("wg__row-number-header")){this.clearAllSelections();const f=h.dataset.field;f&&Zs(this,n,f)}}}if((!this.grid.isColumnReorderAllowed||n.shiftKey)&&n.button===0){const g=l.closest(".wg__header:not(.wg__row-number-header):not(.wg__inline-actions-header):not(.wg__actions-column):not(.wg__filler)");if(g&&!l.closest(".wg__resize-handle")&&!l.closest(".wg__sort-indicator")){const h=g.dataset.field;if(h){const f=this.grid.visualColumns.findIndex(w=>String(w.column.field)===h);f>=0&&Cl(this,f,n)}}}const d=l.closest(".wg__row-number[data-row-number]");if(d&&n.button===0){const g=parseInt(d.dataset.rowNumber||"-1",10);g>=0&&pl(this,g,n)}l.closest(".wg__row-number-header")&&n.button===0&&(n.preventDefault(),this.grid.selectAll(),this.grid.selectedCellRange&&Ot(this),this.render(),requestAnimationFrame(()=>{const g=this.shadow.querySelector(".wg");g==null||g.focus({preventScroll:!0})}));const u=l.closest(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");if(u&&!l.closest(".wg__header")&&!yo()&&!$i()){const g=parseInt(u.dataset.row||"-1",10);if(g>=0){const h=this.grid.focusedRowIndex;this.grid.setFocusedRow(g),this.updateRowFocusVisual(h,g)}}if(l.closest(".wg__cell")&&!l.closest(".wg__row-number, .wg__header")&&!yo()){let g=!1;this.grid.selectedRows.length>0&&(this.grid.clearSelection(),g=!0),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),g=!0),g&&this.render()}if(!l.closest(".wg__cell, .wg__row-number, .wg__header, .wg__toolbar, button, input, select, textarea")){let g=!1;this.grid.selectedCellRange&&(this.grid.clearCellSelection(),G(),g=!0),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),g=!0),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),g=!0),g&&this.render()}}),o.addEventListener("click",n=>{const l=n,a=l.target;if(a.closest(".wg__resize-handle")||a.closest(".wg__sort-indicator")||Ii()||!this.grid.isColumnReorderAllowed)return;const d=a.closest(".wg__header:not(.wg__row-number-header):not(.wg__inline-actions-header):not(.wg__actions-column):not(.wg__filler)");if(d){n.preventDefault();const c=d.dataset.field;if(!c)return;const u=this.grid.visualColumns.findIndex(g=>String(g.column.field)===c);if(u===-1)return;G(),l.ctrlKey||l.metaKey?this.grid.selectColumn(u,"toggle"):l.shiftKey?this.grid.selectColumn(u,"range"):this.grid.selectColumn(u,"replace"),this.render(),requestAnimationFrame(()=>{const g=this.shadow.querySelector(".wg");g==null||g.focus({preventScroll:!0})})}}),o.addEventListener("contextmenu",n=>{this.handleContextMenu(n)}),o.addEventListener("change",n=>{const l=n.target;l.matches(".wg__editor--checkbox")&&ds(this,l)}),o.addEventListener("input",n=>{const l=n.target;l.matches(".wg__combobox-input")?$s(this,n):l.matches(".wg__autocomplete-input")&&As(this,n)}),this.focusEventsSubscribed||(this.focusEvents.subscribe("blur",(n,l)=>{this.focusEvents.shouldSkipBlur()||!l||!this.shadow.contains(l)||(n.matches(".wg__editor--text, .wg__editor--number")?gs(this,n):n.matches(".wg__date-input")?this.datepicker||this.commitDateEditor(n):n.matches(".wg__select-trigger")?this.handleSelectBlur(l):n.matches(".wg__combobox-input, .wg__autocomplete-input")&&this.handleComboboxBlur(n))}),this.focusEventsSubscribed=!0);const i=this.shadow.querySelector(".wg"),r=this.grid.tableBorderOnly&&this.shadow.querySelector(".wg__table-container")||i;i&&(i.setAttribute("tabindex","-1"),i.addEventListener("keydown",n=>{const l=this.grid.selectedRows,a=this.grid.selectedColumns,d=!!this.grid.selectedCellRange;if(l.length===0&&a.length===0&&!d||n.target.matches('input, textarea, select, [contenteditable="true"]'))return;if(n.key==="Escape"){n.preventDefault(),this.grid.selectedCellRange?(this.grid.clearCellSelection(),G()):a.length>0?this.grid.clearColumnSelection():this.grid.clearSelection();return}if((n.ctrlKey||n.metaKey)&&n.key==="c"){n.preventDefault(),d?this.grid.copyCellSelectionToClipboard():a.length>0?this.grid.copySelectedColumnsToClipboard():l.length>0&&this.grid.copySelectedRowsToClipboard();return}const u=this.grid.rangeShortcuts;if(u!=null&&u.length)for(const g of u){const h=wt(g.key);if(pt(n,h)){const f=d?{rows:[],rowIndices:[],cellRange:this.grid.selectedCellRange,cells:this.grid.getSelectedCells()}:{rows:this.grid.getSelectedRowsData(),rowIndices:l};if(!(typeof g.disabled=="function"?g.disabled(f):g.disabled===!0)){n.preventDefault(),g.action(f);return}}}}),this.scrollEvents.init(r),this.scrollEvents.subscribe("container",()=>{const n=r.scrollLeft>0;i.classList.toggle("wg--scrolled-horizontal",n),this.dropdownOpen&&!this.isTransitioningCells&&!this.isOpeningDropdown&&this.handleScrollCloseDropdown(),this.grid.shouldUseVirtualScroll()&&this.handleVirtualScroll(r),this.grid.isInfiniteScrollEnabled&&this.grid.hasMoreItems&&!this.isLoadingMoreItems&&this.handleInfiniteScroll(r),We()!==null&&(ii(this,this.grid.displayItems),this.renderConnector()),Lt(this),this.grid.selectedCellRange&&qi(this),_l(this)}),this.scrollEvents.subscribe("window",()=>{this.dropdownOpen&&!this.isTransitioningCells&&this.handleScrollCloseDropdown(),We()!==null&&this.closeToolbarAndReset()}),this.clickEventsSubscribed||(this.clickEvents.init(i,this),this.clickEvents.subscribe("outsideClick",()=>{let n=!1;if(this.grid.focusedCell){const{rowIndex:l,colIndex:a}=this.grid.focusedCell,d=this.shadow.querySelector(`.wg__cell[data-row="${l}"][data-col="${a}"]`);d==null||d.classList.remove("wg__cell--focused","wg__cell--always-edit-focused"),this.grid.clearFocusedCell()}if(this.grid.focusedRowIndex!==null&&(this.grid.clearRowFocus(),n=!0),this.dropdownOpen||this.grid.editingCell){const l=this.grid.editingCell,a=l?this.grid.columns.findIndex(d=>String(d.field)===l.field):-1;q(this),K(this),this.grid.cancelEdit(),l&&a>=0&&H(this,l.rowIndex,a)}this.grid.selectedCellRange&&(this.grid.clearCellSelection(),G(),n=!0),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),n=!0),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),n=!0),n&&this.render()}),this.clickEvents.subscribe("sortClick",n=>{Ii()||(this.grid.selectedCellRange&&(this.grid.clearCellSelection(),G()),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),et()),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),tt()),Ys(this,n.event,n.field),this.render())}),this.clickEventsSubscribed=!0)),o.addEventListener("mouseenter",n=>{const l=n.target,a=l.closest("[data-tooltip-html]");if(a){const c=a.getAttribute("data-tooltip-html");vo(this,a,c,this._tooltipShowDelay,!0);return}const d=l.closest("[data-tooltip]");if(d){const c=d.getAttribute("data-tooltip");vo(this,d,c,this._tooltipShowDelay,!1)}},!0),o.addEventListener("mouseleave",n=>{const l=n,a=l.target,d=l.relatedTarget,c=a.closest("[data-tooltip], [data-tooltip-html]");c&&(d==null?void 0:d.closest("[data-tooltip], [data-tooltip-html]"))===c||c&&zt(this,this._tooltipHideDelay)},!0),o.addEventListener("click",n=>{const a=n.target.closest(".wg__toolbar-trigger");if(a&&this.grid.toolbarTrigger==="button"){n.preventDefault(),n.stopPropagation();const d=parseInt(a.dataset.toolbarTrigger||"0",10),c=o.querySelector(`tr[data-row-index="${d}"]`);c&&(lo(d)?this.closeToolbarAndReset():this.showToolbarForRow(c,d))}}),o.addEventListener("click",n=>{if(this.grid.toolbarPosition!=="inline")return;const a=n.target.closest(".wg__inline-action-btn");if(a&&!a.disabled){n.preventDefault(),n.stopPropagation();const d=a.dataset.actionId,c=parseInt(a.dataset.row||"0",10);this.handleInlineActionClick(d,c,n,a)}}),o.addEventListener("mouseenter",n=>{const l=n,d=l.target.closest(".wg__row");if(d){const c=parseInt(d.dataset.rowIndex||"0",10);this.grid.setHoveredRow(c),this.grid.toolbarPosition==="inline"&&this.setupInlineShortcuts(),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline"&&(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),lo(c)||this.showToolbarForRow(d,c,l.clientX))}},!0),o.addEventListener("mouseleave",n=>{if(n.target.closest(".wg__row")&&(this.grid.toolbarPosition==="inline"&&setTimeout(()=>{o.matches(":hover")||(this.grid.setHoveredRow(null),this.removeInlineShortcuts())},50),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline")){if(this.toolbarMoveInProgress)return;this.toolbarHideTimeout&&clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=setTimeout(()=>{const c=this.shadow.querySelector(".wg__toolbar-container"),u=c==null?void 0:c.matches(":hover"),g=o.matches(":hover");!u&&!g&&(this.grid.setHoveredRow(null),this.closeToolbarAndReset())},150)}},!0),o.addEventListener("mousemove",n=>{const l=n,a=l.target,d=a.closest(".wg__row");if(!d)return;const c=parseInt(d.dataset.rowIndex||"0",10);if(!(We()!==c||this.grid.toolbarPosition!=="top")){if(this.grid.toolbarFollowsCursor&&!this.grid.cellToolbar&&this.grid.toolbarColumn===void 0){const g=a.closest(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");if(g){const h=g.getBoundingClientRect(),f=so(h,this.grid.cellToolbarOffset);ao(f,d,"start")}else ao(l.clientX)}if(this.grid.cellToolbar){const g=a.closest(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");if(g){const h=g.dataset.field||"",f=this.grid.visualColumns.findIndex(p=>String(p.column.field)===h);if(!this.hoveredCell||this.hoveredCell.rowIndex!==c||this.hoveredCell.field!==h){this.hoveredCell={rowIndex:c,colIndex:f,field:h};const p=this.grid.displayItems[c];if(p){const v=this.grid.cellToolbar(p,c,h,f)||this.grid.rowToolbar,y=JSON.stringify(v);y!==this.currentCellToolbarItems&&(this.currentCellToolbarItems=y,this.updateToolbarWithCellItems(c,v));const x=g.getBoundingClientRect(),C=so(x,this.grid.cellToolbarOffset);ao(C,d,"start")}}}}}}),o.addEventListener("click",n=>{if(this.grid.toolbarTrigger!=="click")return;const l=n,a=l.target,d=a.closest(".wg__row");if(d&&!a.closest(".wg__cell--editing")){const c=parseInt(d.dataset.rowIndex||"0",10);lo(c)?this.closeToolbarAndReset():this.showToolbarForRow(d,c,l.clientX)}}),this.toolbarOutsideClickAdded||(this.toolbarOutsideClickAdded=!0,document.addEventListener("click",n=>{if(!oi(this.shadow))return;const l=n.composedPath(),a=l.some(u=>{var g;return(g=u.classList)==null?void 0:g.contains("wg__toolbar-container")}),d=l.some(u=>{var g;return(g=u.classList)==null?void 0:g.contains("wg__toolbar-trigger")});a||d||l.includes(this)&&(this.grid.toolbarTrigger==="hover"||this.grid.toolbarTrigger==="click")||We()!==null&&this.closeToolbarAndReset()})),this.shadow.querySelectorAll(".wg__pagination").forEach(n=>{n.addEventListener("click",a=>{Us(this,a)&&this.render()});const l=n.querySelector(".wg__pagination-select");l&&l.addEventListener("change",()=>{Ks(this,l)&&this.render()})})}scrollToRowProgrammatically(o){const i=this.shadow.querySelector(".wg");if(!i)return;const{scrollTop:r,startIndex:s,endIndex:n}=Bs({targetRow:o,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,viewportHeight:i.clientHeight,scrollHeight:i.scrollHeight,clientHeight:i.clientHeight});(s!==this.virtualScrollStart||n!==this.virtualScrollEnd)&&(this.virtualScrollStart=s,this.virtualScrollEnd=n,this.renderVirtualRows(i)),this.isProgrammaticScroll=!0,i.scrollTop=r,queueMicrotask(()=>{this.isProgrammaticScroll=!1})}handleVirtualScroll(o){var s;if(this.isProgrammaticScroll)return;const{startIndex:i,endIndex:r}=Ns({scrollTop:o.scrollTop,viewportHeight:o.clientHeight,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,editingRowIndex:(s=this.grid.editingCell)==null?void 0:s.rowIndex});(i!==this.virtualScrollStart||r!==this.virtualScrollEnd)&&(this.virtualScrollStart=i,this.virtualScrollEnd=r,this.renderVirtualRows(o))}renderVirtualRows(o){const i=o.querySelector("tbody");if(!i)return;const r=this.grid.displayItems,s={startIndex:this.virtualScrollStart,endIndex:this.virtualScrollEnd,rowHeight:this.grid.virtualScrollRowHeight,totalItems:r.length},n=this.grid.focusedCell;if(i.innerHTML=si(this,s),n){this.grid.setFocusedCell(n.rowIndex,n.colIndex);const l=i.querySelector(`td[data-row="${n.rowIndex}"][data-col="${n.colIndex}"]`);l&&(l.focus({preventScroll:!0}),J(this,null,n))}}handleInfiniteScroll(o){Ws(o.scrollTop,o.scrollHeight,o.clientHeight,this.grid.infiniteScrollThreshold)&&(this.isLoadingMoreItems=!0,this.grid.fireDataRequest("loadMore"))}renderShortcutsHelpIcon(){var n,l,a;if(!this.grid.isShortcutsHelpVisible||!((n=this.grid.rowShortcuts)!=null&&n.length))return"";const i=this.grid.shortcutsHelpPosition==="top-left"?"wg__shortcuts-help--left":"",r=this.grid.rowShortcuts.map(d=>`<div class="wg__shortcuts-help-item">
|
|
663
|
-
<span class="wg__shortcuts-help-key">${
|
|
658
|
+
`?(o.push(i),o.some(a=>a!=="")&&e.push(o),o=[],i="",n==="\r"&&s++):n!=="\r"&&(i+=n)}return(i!==""||o.length>0)&&(o.push(i),o.some(s=>s!=="")&&e.push(o)),e}function El(t,e){const o=new Map,i=new Map;e.forEach((a,d)=>{var g;if(a.isHidden)return;const c=String(a.field),u=((g=a.title)==null?void 0:g.toLowerCase().trim())||"";u&&o.set(u,{field:c,colIndex:d}),i.set(c.toLowerCase(),{field:c,colIndex:d})});const r=[];let s=0;for(const a of t){const d=a.trim().toLowerCase();if(!d)continue;const c=o.get(d)||i.get(d);c&&(s++,r.push({pastedHeader:a,gridField:c.field,colIndex:c.colIndex}))}const n=t.filter(a=>a.trim()!=="").length,l=Math.max(2,Math.floor(n*.5));return s>=l?r:null}async function Il(t,e,o,i){var _;const r=t.grid,s=kl(e);if(s.length===0)return{totalCells:0,successfulCells:0,failedCells:0,skippedCells:0,newRowsCreated:0,cellResults:[],hadHeaders:!1};const n=El(s[0],r.columns),l=n!==null,a=l?s.slice(1):s;if(a.length===0)return{totalCells:0,successfulCells:0,failedCells:0,skippedCells:0,newRowsCreated:0,cellResults:[],hadHeaders:l};const d=r.visualColumns,c=r.isEmptyRowIndex(o),u=r.items.length;let g;if(c)g=a.length;else{const x=o+a.length-1;g=Math.max(0,x-u+1)}const h={rawText:e,parsedRows:s,hasHeaders:l,headerMapping:n,targetRowIndex:o,targetColIndex:i,newRowsCount:g,cancel:!1,skipCells:new Set};if(r.onbeforepaste&&(r.onbeforepaste(h),h.cancel))return{totalCells:a.reduce((x,k)=>x+k.length,0),successfulCells:0,failedCells:0,skippedCells:a.reduce((x,k)=>x+k.length,0),newRowsCreated:0,cellResults:[],hadHeaders:l};let f=0,w=u;if(g>0){const x=[];for(let k=0;k<g;k++){const I=c?k:u+k-o,E=a[I],R={};l&&n?E==null||E.forEach((L,M)=>{const z=n[M];z&&(R[z.gridField]=L)}):E==null||E.forEach((L,M)=>{const z=i+M;if(z<d.length){const X=String(d[z].column.field);R[X]=L}});let D;r.createRowCallback?D=r.createRowCallback(R,u+k):D=R,x.push(D),f++}c&&r.newRowPosition==="top"?(r.items=[...x,...r.items],w=0):(r.items=[...r.items,...x],w=u)}const p=[],m=r.pasteMode;for(let x=0;x<a.length;x++){const k=a[x],I=c?w+x:o+x,E=c?r.newRowPosition==="top"?1+x:r.items.length-a.length+x:o+x,R=I;for(let D=0;D<k.length;D++){const L=k[D];let M,z;if(l&&n){const G=n[D];if(!G)continue;M=G.gridField,z=G.colIndex}else{if(z=i+D,z>=d.length){p.push({rowIndex:E,field:"",value:L,isValid:!1,wasSkipped:!0,skipReason:"out-of-bounds"});continue}M=String(d[z].column.field)}const X=`${x}-${D}`;if(h.skipCells.has(X)){p.push({rowIndex:E,field:M,value:L,isValid:!0,wasSkipped:!0,skipReason:"user-canceled"});continue}const T=r.columns.find(G=>String(G.field)===M);if(!T)continue;if(!r.isCellEditable(T)){if(m==="editable-only"){p.push({rowIndex:E,field:M,value:L,isValid:!1,wasSkipped:!0,skipReason:"non-editable"});continue}else if(m==="skip-non-editable"){p.push({rowIndex:E,field:M,value:L,isValid:!0,wasSkipped:!0,skipReason:"non-editable"});continue}}const Y=c?r.items[R]:r.displayItems[R];if(Y&&r.isRowLocked(Y)){p.push({rowIndex:E,field:M,value:L,isValid:!0,wasSkipped:!0,skipReason:"locked"});continue}let B=L;if(T.beforePasteCallback&&Y&&(B=T.beforePasteCallback(L,Y)),c){const G=r.items[R];if(G&&r.shouldValidateOnPaste&&T.beforeCommitCallback){const Re={value:B,oldValue:void 0,row:G,rowIndex:R,field:M},te=await Promise.resolve(T.beforeCommitCallback(Re)),Fe=te===!0||te===void 0||typeof te=="object"&&te!==null&&te.valid!==!1,De=typeof te=="object"&&te!==null?te.error||te.message:typeof te=="string"?te:void 0;Fe||(r.addInvalidCell(E,M,De||"Invalid value"),(_=r.onvalidationerror)==null||_.call(r,{row:G,rowIndex:E,field:M,error:De||"Invalid value"})),p.push({rowIndex:E,field:M,value:B,isValid:Fe,validationError:Fe?void 0:De,wasSkipped:!1})}else p.push({rowIndex:E,field:M,value:B,isValid:!0,wasSkipped:!1})}else if(r.shouldValidateOnPaste){await r.commitEdit(E,M,B);const G=r.invalidCells.find(Re=>Re.rowIndex===E&&Re.field===M);p.push({rowIndex:E,field:M,value:B,isValid:!G,validationError:G==null?void 0:G.error,wasSkipped:!1})}else{const G=r.items[R];G&&(G[M]=B),p.push({rowIndex:E,field:M,value:B,isValid:!0,wasSkipped:!1})}}}const v=p.filter(x=>!x.wasSkipped&&x.isValid).length,y=p.filter(x=>!x.wasSkipped&&!x.isValid).length,C=p.filter(x=>x.wasSkipped).length,S={totalCells:p.length,successfulCells:v,failedCells:y,skippedCells:C,newRowsCreated:f,cellResults:p,hadHeaders:l};return r.onpaste&&r.onpaste(S),S}class Rl{constructor(e){b(this,"executors",new Map);b(this,"ctx");this.ctx=e}registerExecutor(e){for(const o of e.handles)this.executors.set(o,e)}dispatch(e){const o=[e];for(;o.length>0;){const i=o.shift(),r=this.executors.get(i.type);if(!r){console.warn(`[ActionPipeline] No executor for action type: ${i.type}`);continue}const s=new Proxy(this.ctx,{get:(l,a)=>a==="dispatch"?d=>this.dispatch(d):l[a],set:(l,a,d)=>(l[a]=d,!0)}),n=r.execute(s,i);n&&n.length>0&&o.unshift(...n)}}}function Dl(t){return new Rl(t)}const Tl={handles:["focusCell","blurCell"],execute(t,e){switch(e.type){case"focusCell":return Ml(t,e);case"blurCell":return $l(t)}}};function Ml(t,e){const{rowIndex:o,colIndex:i}=e.target,r=t.grid.columns[i];if(!r)return;const s=r.editTrigger??t.grid.editTrigger,n=s==="always",l=t.grid.focusedCell;(!l||l.rowIndex!==o||l.colIndex!==i)&&(t.filterText="",t.searchDebounceTimer&&(clearTimeout(t.searchDebounceTimer),t.searchDebounceTimer=null),t.searchAbortController&&(t.searchAbortController.abort(),t.searchAbortController=null)),t.grid.setFocusedCell(o,i),Z(t,l,{rowIndex:o,colIndex:i});const d=t.shadow.querySelector(`td[data-row="${o}"][data-col="${i}"]`);if(!d)return;if(n){let h=d.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger");h||(h=d.querySelector(".wg__editor")),h&&(h.focus({preventScroll:!0}),e.selectText!==!1&&h instanceof HTMLInputElement&&h.type==="text"&&h.select())}else d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1"),d.focus({preventScroll:!0});d.scrollIntoView({block:"nearest",inline:"nearest"}),zt(t);const c=r.editor,u=c==="select"||c==="combobox"||c==="autocomplete",g=s==="navigate";if(n&&t.grid.shouldShowDropdownOnFocus&&!t.justSelected&&u)return[{type:"openDropdown"}];if(g&&t.grid.shouldShowDropdownOnFocus&&u)return[{type:"startEdit",target:{rowIndex:o,colIndex:i}},{type:"openDropdown"}]}function $l(t,e){const o=t.grid.focusedCell;t.grid.clearFocusedCell(),Z(t,o,null)}const Pl={handles:["navigate"],execute(t,e){if(e.type==="navigate")return Al(t,e)}};function Al(t,e){const o=e.from??t.grid.focusedCell;if(!o)return;const i=Ll(t,o,e),r=t.grid.columns[o.colIndex],s=r?String(r.field):"",n=t.grid.editingCell&&t.grid.editingCell.rowIndex===o.rowIndex&&t.grid.editingCell.field===s;return i?i.rowIndex===o.rowIndex&&i.colIndex===o.colIndex?void 0:[{type:"transitionCell",from:o,to:i,selectText:!0}]:n?[{type:"commitEdit"},{type:"renderCell",target:o},{type:"focusCell",target:o,selectText:!1}]:void 0}function Ll(t,e,o){const{direction:i,ctrlKey:r}=o,{rowIndex:s,colIndex:n}=e,l=t.grid.columns,d=t.grid.displayItems.length-1,c=l.length-1,u=t.grid.getEditableColumns();switch(i!=="tab"&&i!=="tab-back"&&i!=="enter"&&(t.grid.tabTraversalStartColIndex=null),i){case"up":if(s>0)return{rowIndex:s-1,colIndex:n};break;case"down":if(s<d)return{rowIndex:s+1,colIndex:n};break;case"left":if(n>0)return{rowIndex:s,colIndex:n-1};break;case"right":if(n<c)return{rowIndex:s,colIndex:n+1};break;case"tab":{if(u.length===0){if(n<c)return{rowIndex:s,colIndex:n+1};if(s<d)return{rowIndex:s+1,colIndex:0};break}t.grid.tabTraversalStartColIndex===null&&(t.grid.tabTraversalStartColIndex=n);const g=u.findIndex(h=>h.index===n);if(g>=0&&g<u.length-1)return{rowIndex:s,colIndex:u[g+1].index};if(g===-1&&u.length>0)return{rowIndex:s,colIndex:u[0].index};if(s<d)return{rowIndex:s+1,colIndex:u[0].index};if(t.grid.isEmptyRowIndex(s))return{rowIndex:s,colIndex:u[0].index};break}case"tab-back":{if(u.length===0){if(n>0)return{rowIndex:s,colIndex:n-1};if(s>0)return{rowIndex:s-1,colIndex:c};break}t.grid.tabTraversalStartColIndex===null&&(t.grid.tabTraversalStartColIndex=n);const g=u.findIndex(h=>h.index===n);if(g>0)return{rowIndex:s,colIndex:u[g-1].index};if(s>0)return{rowIndex:s-1,colIndex:u[u.length-1].index};break}case"enter":{const g=t.grid.tabTraversalStartColIndex??n;if(t.grid.tabTraversalStartColIndex=null,s<d)return{rowIndex:s+1,colIndex:g};break}case"home":return r?{rowIndex:0,colIndex:0}:{rowIndex:s,colIndex:0};case"end":return r?{rowIndex:d,colIndex:c}:{rowIndex:s,colIndex:c};case"page-up":return r?{rowIndex:0,colIndex:n}:{rowIndex:Math.max(0,s-10),colIndex:n};case"page-down":return r?{rowIndex:d,colIndex:n}:{rowIndex:Math.min(d,s+10),colIndex:n}}return null}const zl={handles:["transitionCell"],execute(t,e){if(e.type==="transitionCell")return Ol(t,e)}};function Ol(t,e){const{from:o,to:i,selectText:r}=e,s=[],n=t.grid.editingCell,l=n&&n.rowIndex===o.rowIndex&&t.grid.columns.findIndex(g=>String(g.field)===n.field)===o.colIndex,a=t.grid.columns[o.colIndex],c=((a==null?void 0:a.editTrigger)??t.grid.editTrigger)==="always";if(o.rowIndex!==i.rowIndex||o.colIndex!==i.colIndex)if(l)s.push({type:"commitEdit"});else if(c)s.push({type:"commitEdit",target:o});else{const g={type:"renderCell",target:o};s.push(g)}const u={type:"focusCell",target:i,selectText:r};return s.push(u),s}const Hl={handles:["renderCell"],execute(t,e){e.type==="renderCell"&&Fl(t,e)}};function Fl(t,e){const{target:o,focusEditor:i,cursorPosition:r,initialSearchQuery:s}=e;H(t,o.rowIndex,o.colIndex,{focusEditor:i,cursorPosition:r,initialSearchQuery:s})}const ql={handles:["openDropdown","closeDropdown","toggleDropdown","dropdownNavigate","dropdownSelect"],execute(t,e){switch(e.type){case"openDropdown":fe(t);break;case"closeDropdown":V(t);break;case"toggleDropdown":t.dropdownOpen?V(t):fe(t);break;case"dropdownNavigate":return Vl(t,e);case"dropdownSelect":return Nl(t,e)}}},Ji=10;function Vl(t,e){if(!t.dropdownOpen)return;const o=t.getCurrentEditorOptions();let i=t.highlightedIndex;const r=t.dropdownOptions.length;switch(e.direction){case"up":for(i=t.highlightedIndex-1;i>=0&&ae(t.dropdownOptions[i],o);)i--;if(i<0)return;break;case"down":for(i=t.highlightedIndex+1;i<r&&ae(t.dropdownOptions[i],o);)i++;if(i>=r)return;break;case"page-up":for(i=Math.max(0,t.highlightedIndex-Ji);i<t.highlightedIndex&&ae(t.dropdownOptions[i],o);)i++;if(i>=t.highlightedIndex)return;break;case"page-down":for(i=Math.min(r-1,t.highlightedIndex+Ji);i>t.highlightedIndex&&ae(t.dropdownOptions[i],o);)i--;if(i<=t.highlightedIndex)return;break;case"home":for(i=0;i<r&&ae(t.dropdownOptions[i],o);)i++;if(i>=r)return;break;case"end":for(i=r-1;i>=0&&ae(t.dropdownOptions[i],o);)i--;if(i<0)return;break}t.highlightedIndex=i,t.dropdownUserInteracted=!0,he(t),_o(t)}function Nl(t,e){var h;if(!t.dropdownOpen||t.highlightedIndex<0)return V(t),e.thenNavigate?[{type:"navigate",direction:e.thenNavigate}]:void 0;const o=t.dropdownOptions[t.highlightedIndex];if(!o)return;const i=t.grid.editingCell,r=t.grid.focusedCell,s=i?{rowIndex:i.rowIndex,field:i.field,colIndex:t.grid.columns.findIndex(f=>String(f.field)===i.field)}:r?{rowIndex:r.rowIndex,field:String((h=t.grid.columns[r.colIndex])==null?void 0:h.field),colIndex:r.colIndex}:null;if(!s)return;const{rowIndex:n,field:l,colIndex:a}=s,d=t.grid.columns[a],c=(d==null?void 0:d.editorOptions)||{};if(ae(o,c))return;const u=Ae(o,c),g=t.grid.displayItems[n];if(c.onselect&&g&&c.onselect(o,g),t.justSelected=!0,t.isCommittingFromKeyboard=!0,V(t),t.grid.commitEdit(n,l,u,e.commitEmptyRow??!1),e.thenNavigate)return H(t,n,a),t.justSelected=!1,[{type:"navigate",direction:e.thenNavigate,from:{rowIndex:n,colIndex:a}}];e.moveAfterSelect?t.moveFocusAfterCommit(n,l,"down"):H(t,n,a),requestAnimationFrame(()=>{t.justSelected=!1})}const Bl={handles:["noop"],execute(){}},Wl={handles:["toggleCheckbox"],execute(t,e){e.type==="toggleCheckbox"&&Yl(t,e)}};function Yl(t,e){const{rowIndex:o,colIndex:i}=e.target,r=t.grid.columns[i];if(!r||!t.grid.isCellEditable(r))return;const s=String(r.field),n=t.grid.displayItems[o];if(!n)return;const l=r.editorOptions||{},a=l.trueValue??!0,d=l.falseValue??!1,u=t.grid.getCellRawValue(n,o,s)===a?d:a;t.grid.startEdit(o,s),t.grid.updateDraftValue(o,s,u),H(t,o,i,{focusEditor:!0})}const Ul={handles:["openDatePicker","closeDatePicker","toggleDatePicker"],execute(t,e){switch(e.type){case"openDatePicker":Zi(t);break;case"closeDatePicker":Xl(t);break;case"toggleDatePicker":Gl(t);break}}};function Zi(t){const e=t.grid.focusedCell;if(!e)return;const{rowIndex:o,colIndex:i}=e,r=t.grid.columns[i];if(!r||r.editor!=="date")return;const s=String(r.field),n=t.shadow.querySelector(`.wg__cell[data-row="${o}"][data-col="${i}"]`);if(!n)return;const l=n.querySelector(".wg__editor--date"),a=n.querySelector(".wg__date-input");if(!l||!a)return;t.datepicker&&(t.datepicker.close(!0),t.datepicker=null);const d=a.dataset.dateFormat||"YYYY-MM-DD",c=a.dataset.minDate,u=a.dataset.maxDate,g=a.dataset.dateValue||"",h=o,f=i,w=s;t.datepicker=new Tt({dateFormat:d,minDate:c||void 0,maxDate:u||void 0,onSelect:(p,m)=>{Kl(t,h,f,w,p,m)},onClose:()=>{jl(t,h,f)}}),t.datepicker.open(l,g||null)}function Kl(t,e,o,i,r,s){t.datepicker=null,t.grid.commitEdit(e,i,Dt(r)),H(t,e,o);const n=t.shadow.querySelector(`.wg__cell[data-row="${e}"][data-col="${o}"]`);n&&n.focus(),s==="down"?t.dispatch({type:"navigate",direction:"down"}):s==="next"&&t.dispatch({type:"navigate",direction:"tab"})}function jl(t,e,o){t.datepicker=null;const i=t.grid.columns[o];if(!i)return;if((i.editTrigger??t.grid.editTrigger)==="always")H(t,e,o);else{j(t),t.grid.cancelEdit(),H(t,e,o);const s=t.shadow.querySelector(`.wg__cell[data-row="${e}"][data-col="${o}"]`);s&&s.focus()}}function Xl(t){t.datepicker&&(t.datepicker.close(!0),t.datepicker=null)}function Gl(t){t.datepicker?t.datepicker.close(!1):Zi(t)}const Ql={handles:["startEdit","commitEdit","cancelEdit","escapeEdit","deleteCell"],execute(t,e){switch(e.type){case"startEdit":Jl(t,e);break;case"commitEdit":Zl(t,e.commitEmptyRow,e.target);break;case"cancelEdit":ea(t);break;case"escapeEdit":return ta(t,e);case"deleteCell":oa(t,e);break}}};function Jl(t,e){const{rowIndex:o,colIndex:i}=e.target;ie(t,o,i,{initialSearchQuery:e.initialSearchQuery,cursorPosition:e.cursorPosition})}async function Zl(t,e,o){const i=t.grid.editingCell;let r,s,n;if(o){r=o.rowIndex,s=o.colIndex;const c=t.grid.columns[s];if(!c)return;n=String(c.field)}else if(i){if(r=i.rowIndex,n=i.field,s=t.grid.columns.findIndex(c=>String(c.field)===n),s<0)return}else return;const l=t.shadow.querySelector(`.wg__cell[data-row="${r}"][data-col="${s}"]`);if(!l)return;let a=l.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger");if(a||(a=l.querySelector(".wg__editor")),!a)return;let d;if(t.grid.columns[s],a instanceof HTMLInputElement)if(a.type==="checkbox"){const c=t.grid.displayItems[r];d=t.grid.getCellRawValue(c,r,n)}else if(a.classList.contains("wg__date-input"))d=a.dataset.dateValue||a.value;else if(a.classList.contains("wg__editor--number")){const c=a.value.trim();if(c==="")d=null;else{const u=parseFloat(c);d=isNaN(u)?c:u}}else d=a.value;else a instanceof HTMLSelectElement?d=a.value:d=a.dataset.value||"";t.dropdownOpen&&V(t),j(t),await t.grid.commitEdit(r,n,d,e),H(t,r,s)}function ea(t){const e=t.grid.editingCell;if(!e)return;const{rowIndex:o,field:i}=e,r=t.grid.columns.findIndex(n=>String(n.field)===i),s=t.grid.columns[r];t.dropdownOpen&&V(t),j(t),(s==null?void 0:s.editor)==="checkbox"&&t.grid.discardCellDraft(o,i),t.grid.cancelEdit(),r>=0&&H(t,o,r)}function ta(t,e){const o=t.grid.editingCell,i=t.grid.focusedCell;if(e.phase==="dropdown"){const r=o||i;if(!r)return;const s=o?t.grid.columns.findIndex(a=>String(a.field)===o.field):(i==null?void 0:i.colIndex)??-1,n=t.grid.columns[s],l=n==null?void 0:n.editor;if(l==="select"&&t.filterText){t.filterText="",V(t),t.dispatch({type:"openDropdown"});return}if(l==="autocomplete"||l==="combobox"){const a=t.shadow.querySelector(`.wg__cell[data-row="${r.rowIndex}"][data-col="${s}"]`),d=a==null?void 0:a.querySelector(".wg__combobox-input, .wg__autocomplete-input"),c=t.grid.displayItems[r.rowIndex],u=n==null?void 0:n.field,g=c&&u?c[u]:void 0,h=(n==null?void 0:n.editorOptions)||{},f=h.initialOptions||h.options||[],w=gt(g,f,h),p=(d==null?void 0:d.value)??"";if(d&&p!==w){t.filterText="",d.value=w,d.focus(),d.select(),V(t),t.dispatch({type:"openDropdown"});return}}V(t),o&&(j(t),l==="checkbox"&&t.grid.discardCellDraft(r.rowIndex,o.field),t.grid.cancelEdit(),H(t,r.rowIndex,s),ht(t,r.rowIndex,s));return}if(o){const{rowIndex:r,field:s}=o,n=t.grid.columns.findIndex(a=>String(a.field)===s),l=t.grid.columns[n];t.dropdownOpen&&V(t),t.datepicker&&(t.datepicker.close(!0),t.datepicker=null),j(t),(l==null?void 0:l.editor)==="checkbox"&&t.grid.discardCellDraft(r,s),t.grid.cancelEdit(),n>=0&&(H(t,r,n),ht(t,r,n))}else if(i){const{rowIndex:r,colIndex:s}=i;t.grid.clearFocusedCell(),H(t,r,s)}}function oa(t,e){const o=e.target||t.grid.focusedCell;if(!o)return;const{rowIndex:i,colIndex:r}=o,s=t.grid.columns[r];if(!s||!t.grid.isCellEditable(s))return;const n=String(s.field);t.grid.commitEdit(i,n,null),H(t,i,r)}const ia={handles:["selectRow","selectColumn","clearSelection"],execute(t,e){switch(e.type){case"selectRow":ra(t,e);break;case"selectColumn":na(t,e);break;case"clearSelection":sa(t);break}}};function ra(t,e){const{rowIndex:o,addToSelection:i,extendSelection:r}=e;t.grid.selectedColumns.length>0&&t.grid.clearColumnSelection(),t.grid.selectedCellRange&&(t.grid.clearCellSelection(),Q(),ke(),So(t)),r&&t.grid.selectedRows.length>0?t.grid.selectRow(o,"range"):i?t.grid.selectRow(o,"toggle"):t.grid.selectRow(o,"replace"),er(t)}function na(t,e){const{colIndex:o,addToSelection:i,extendSelection:r}=e;t.grid.selectedRows.length>0&&t.grid.clearSelection(),t.grid.selectedCellRange&&(t.grid.clearCellSelection(),Q(),ke(),So(t)),r&&t.grid.selectedColumns.length>0?t.grid.selectColumn(o,"range"):i?t.grid.selectColumn(o,"toggle"):t.grid.selectColumn(o,"replace"),tr(t)}function sa(t){if(console.log("[clearSelection] rows:",t.grid.selectedRows.length,"cols:",t.grid.selectedColumns.length,"cellRange:",!!t.grid.selectedCellRange),t.grid.selectedRows.length>0&&(console.log("[clearSelection] clearing rows"),t.grid.clearSelection_noRender(),ot(),er(t)),t.grid.selectedColumns.length>0){console.log("[clearSelection] clearing columns, removing visual classes"),t.grid.clearColumnSelection_noRender(),it(),tr(t),console.log("[clearSelection] after clear, selectedColumns:",t.grid.selectedColumns.length);const e=t.shadow.querySelectorAll(".wg__header--selected");console.log("[clearSelection] remaining header--selected elements:",e.length)}t.grid.selectedCellRange&&(t.grid.clearCellSelection_noRender(),Q(),ke(),So(t))}function er(t){t.shadow.querySelectorAll(".wg__row--selected").forEach(o=>o.classList.remove("wg__row--selected"));for(const o of t.grid.selectedRows){const i=t.shadow.querySelector(`tr[data-row="${o}"]`);i&&i.classList.add("wg__row--selected")}}function tr(t){t.shadow.querySelectorAll(".wg__cell--column-selected").forEach(i=>i.classList.remove("wg__cell--column-selected")),t.shadow.querySelectorAll(".wg__header--selected").forEach(i=>i.classList.remove("wg__header--selected"));for(const i of t.grid.selectedColumns){t.shadow.querySelectorAll(`.wg__cell[data-col="${i}"]`).forEach(n=>n.classList.add("wg__cell--column-selected"));const s=t.shadow.querySelector(`.wg__header[data-col="${i}"]`);s&&s.classList.add("wg__header--selected")}}function So(t){t.shadow.querySelectorAll(".wg__cell--in-range").forEach(u=>u.classList.remove("wg__cell--in-range"));const o=t.grid.selectedCellRange;if(!o)return;const{startRowIndex:i,endRowIndex:r,startColIndex:s,endColIndex:n}=o,l=Math.min(i,r),a=Math.max(i,r),d=Math.min(s,n),c=Math.max(s,n);for(let u=l;u<=a;u++)for(let g=d;g<=c;g++){const h=t.shadow.querySelector(`.wg__cell[data-row="${u}"][data-col="${g}"]`);h&&h.classList.add("wg__cell--in-range")}}const la={handles:["copy","paste"],execute(t,e){switch(e.type){case"copy":aa(t);break}}};async function aa(t){var o,i;let e="";if(t.grid.selectedCellRange){const r=t.grid.selectedCellRange,{startRowIndex:s,endRowIndex:n,startColIndex:l,endColIndex:a}=r,d=Math.min(s,n),c=Math.max(s,n),u=Math.min(l,a),g=Math.max(l,a),h=[];for(let f=d;f<=c;f++){const w=[];for(let p=u;p<=g;p++){const m=t.grid.displayItems[f],v=(o=t.grid.visualColumns[p])==null?void 0:o.column;if(m&&v){const y=m[String(v.field)];w.push(Bt(y))}else w.push("")}h.push(w.join(" "))}e=h.join(`
|
|
659
|
+
`)}else if(t.grid.selectedColumns.length>0){const r=[],s=t.grid.displayItems;for(let n=0;n<s.length;n++){const l=[];for(const a of t.grid.selectedColumns){const d=s[n],c=(i=t.grid.visualColumns[a])==null?void 0:i.column;if(d&&c){const u=d[String(c.field)];l.push(Bt(u))}else l.push("")}r.push(l.join(" "))}e=r.join(`
|
|
660
|
+
`)}else if(t.grid.selectedRows.length>0){const r=[],s=t.grid.visualColumns;for(const n of t.grid.selectedRows){const l=t.grid.displayItems[n];if(l){const a=[];for(const d of s){const c=l[String(d.column.field)];a.push(Bt(c))}r.push(a.join(" "))}}e=r.join(`
|
|
661
|
+
`)}else if(t.grid.focusedCell){const{rowIndex:r,colIndex:s}=t.grid.focusedCell,n=t.grid.displayItems[r],l=t.grid.columns[s];if(n&&l){const a=n[String(l.field)];e=Bt(a)}}if(e)try{await navigator.clipboard.writeText(e)}catch{console.warn("Failed to copy to clipboard")}}function Bt(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}const da={handles:["openContextMenu","closeContextMenu"],execute(t,e){switch(e.type){case"openContextMenu":ca(t,e);break;case"closeContextMenu":ga(t);break}}};function ca(t,e){e.target&&t.dispatch({type:"focusCell",target:e.target,selectText:!1})}function ga(t){t.contextMenuElement&&(de(t.contextMenuElement),t.contextMenuElement=null),t.headerContextMenuElement&&(de(t.headerContextMenuElement),t.headerContextMenuElement=null)}const ua={handles:["startFillDrag","updateFillDrag","completeFillDrag"],execute(t,e){switch(e.type){}}},ha={handles:["startCellSelection"],execute(t,e){if(e.type==="startCellSelection")return fa(t,e)}};function fa(t,e){Li(t,e.rowIndex,e.colIndex,{clientX:e.clientX,clientY:e.clientY,shiftKey:e.shiftKey})}const wa={handles:["resetState"],execute(t,e){if(e.type==="resetState")return pa(t,e)}};function pa(t,e){const o=e.edit!==!1,i=e.selections!==!1,r=e.overlays!==!1,s=e.focus===!0,n=[];return r&&((t.contextMenuElement||t.headerContextMenuElement)&&n.push({type:"closeContextMenu"}),t.datepicker&&n.push({type:"closeDatePicker"})),o&&t.grid.editingCell&&n.push({type:"cancelEdit"}),i&&(t.grid.selectedRows.length>0||t.grid.selectedColumns.length>0||t.grid.selectedCellRange)&&n.push({type:"clearSelection"}),s&&t.grid.focusedCell&&n.push({type:"blurCell"}),n}const ma={handles:["openCustomEditor"],execute(t,e){if(e.type!=="openCustomEditor")return;const{rowIndex:o,colIndex:i}=e.target;t.openCustomEditor(o,i)}};function xo(t,e){const{currentCell:o,dropdownOpen:i,isDropdownEditor:r}=e;if(!o)return null;const s=t.ctrlKey||t.metaKey;if(i)switch(t.key){case"ArrowUp":return{type:"dropdownNavigate",direction:"up"};case"ArrowDown":return{type:"dropdownNavigate",direction:"down"};case"ArrowLeft":case"ArrowRight":return e.editorType==="autocomplete"?null:{type:"noop"};case"Home":return e.editorType==="autocomplete"?null:{type:"dropdownNavigate",direction:"home"};case"End":return e.editorType==="autocomplete"?null:{type:"dropdownNavigate",direction:"end"};case"PageUp":return{type:"dropdownNavigate",direction:"page-up"};case"PageDown":return{type:"dropdownNavigate",direction:"page-down"};case"Enter":return{type:"dropdownSelect",moveAfterSelect:!0,commitEmptyRow:!0};case"Tab":return{type:"dropdownSelect",moveAfterSelect:!1,commitEmptyRow:!1,thenNavigate:t.shiftKey?"tab-back":"tab"};case"Escape":return{type:"escapeEdit",phase:"dropdown"}}if(t.key==="Escape")return{type:"escapeEdit",phase:"edit"};if(e.isCheckboxEditor){if(t.key===" ")return{type:"toggleCheckbox",target:o};if(t.key==="ArrowUp"||t.key==="ArrowDown"||t.key==="ArrowLeft"||t.key==="ArrowRight")return{type:"noop"}}if(r&&!i)switch(t.key){case" ":case"F2":return{type:"openDropdown"};case"Enter":return{type:"openDropdown"}}let n=null;switch(t.key){case"Tab":n=t.shiftKey?"tab-back":"tab";break;case"Enter":n="enter";break;case"ArrowUp":n="up";break;case"ArrowDown":n="down";break;case"ArrowLeft":n="left";break;case"ArrowRight":n="right";break;case"Home":n="home";break;case"End":n="end";break;case"PageUp":n="page-up";break;case"PageDown":n="page-down";break;default:return null}return n?{type:"navigate",direction:n,from:o,ctrlKey:s}:null}function or(t,e,o,i=!1){return!!(["Tab","Enter","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"].includes(t)||t==="Escape"||o&&!e&&(t===" "||t==="F2")||i&&t===" ")}function ir(t,e){const{cell:o,dropdownOpen:i,isToggleClick:r,isDateTriggerClick:s,isCheckboxClick:n,isCellClick:l}=e,a=[];if(n)return a.push({type:"toggleCheckbox",target:o}),a;if(s)return a.push({type:"focusCell",target:o,selectText:!1}),a.push({type:"startEdit",target:o}),a.push({type:"toggleDatePicker"}),a;i&&!r&&a.push({type:"closeDropdown"});const{isDropdownEditor:d}=e,c=!r&&(!l||d);return a.push({type:"focusCell",target:o,selectText:c}),r&&(i?a.push({type:"closeDropdown"}):(a.push({type:"startEdit",target:o}),a.push({type:"openDropdown"}))),a}class ba{constructor(e){b(this,"pipeline");b(this,"ctx");this.ctx=e,this.pipeline=Dl(e),this.pipeline.registerExecutor(Tl),this.pipeline.registerExecutor(Pl),this.pipeline.registerExecutor(zl),this.pipeline.registerExecutor(Hl),this.pipeline.registerExecutor(ql),this.pipeline.registerExecutor(Wl),this.pipeline.registerExecutor(Ul),this.pipeline.registerExecutor(Ql),this.pipeline.registerExecutor(ia),this.pipeline.registerExecutor(la),this.pipeline.registerExecutor(da),this.pipeline.registerExecutor(ua),this.pipeline.registerExecutor(ha),this.pipeline.registerExecutor(wa),this.pipeline.registerExecutor(ma),this.pipeline.registerExecutor(Bl)}getEditTrigger(e){const o=this.ctx.grid.columns[e];return o?o.editTrigger??this.ctx.grid.editTrigger:"navigate"}isAlwaysMode(e){return this.ctx.grid.isEditable?this.getEditTrigger(e)==="always":!1}isEditingCell(e,o){const i=this.ctx.grid.editingCell;if(!i)return!1;const r=this.ctx.grid.columns[o];return r?i.rowIndex===e&&i.field===String(r.field):!1}isDropdownEditor(e){const o=this.ctx.grid.columns[e];if(!o)return!1;const i=o.editor;return i==="select"||i==="combobox"||i==="autocomplete"}isCheckboxEditor(e){const o=this.ctx.grid.columns[e];return o?o.editor==="checkbox":!1}isDateEditor(e){const o=this.ctx.grid.columns[e];return o?o.editor==="date":!1}isCustomEditor(e){const o=this.ctx.grid.columns[e];return o?o.editor==="custom":!1}getDropdownEditorType(e){const o=this.ctx.grid.columns[e];if(!o)return;const i=o.editor;if(i==="select"||i==="combobox"||i==="autocomplete")return i}getCellFromTarget(e){const o=e.closest(".wg__cell");if(!o)return null;const i=parseInt(o.dataset.row||"",10),r=parseInt(o.dataset.col||"",10);return isNaN(i)||isNaN(r)?null:{rowIndex:i,colIndex:r}}tryHandleKeyDown(e){const o=e.target,i=this.getCellFromTarget(o);if(!i||this.ctx.datepicker&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(e.key))return!1;const r=this.getEditTrigger(i.colIndex),s=this.isAlwaysMode(i.colIndex),n=this.isEditingCell(i.rowIndex,i.colIndex),l=this.ctx.dropdownOpen,a=this.isDropdownEditor(i.colIndex),d=this.isCheckboxEditor(i.colIndex),c=this.isDateEditor(i.colIndex);if(s){if(!or(e.key,l,a,d))return!1;const g=xo(e,{currentCell:i,dropdownOpen:l,isDropdownEditor:a,isCheckboxEditor:d,editorType:this.getDropdownEditorType(i.colIndex)});return g?(e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch(g),!0):!1}if(n){const g=e.key==="ArrowLeft"||e.key==="ArrowRight";if(g&&r==="navigate"&&a)return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"navigate",direction:e.key==="ArrowLeft"?"left":"right",from:i}),!0;if(e.key==="Tab"&&r==="navigate"&&l)return e.preventDefault(),e.stopPropagation(),this.ctx.dropdownUserInteracted?this.pipeline.dispatch({type:"dropdownSelect",moveAfterSelect:!1,thenNavigate:e.shiftKey?"tab-back":"tab"}):(this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"navigate",direction:e.shiftKey?"tab-back":"tab",from:i})),!0;if(!or(e.key,l,a,d)||!a&&!d&&!c&&g&&!l)return!1;const w=xo(e,{currentCell:i,dropdownOpen:l,isDropdownEditor:a,isCheckboxEditor:d,editorType:this.getDropdownEditorType(i.colIndex)});return w?(e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch(w),!0):!1}if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab","Home","End","PageUp","PageDown"].includes(e.key)){const g=xo(e,{currentCell:i,dropdownOpen:!1,isDropdownEditor:!1,isCheckboxEditor:!1});return g?(e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch(g),!0):!1}if(e.key==="F2"){const g=this.isCustomEditor(i.colIndex);return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"startEdit",target:i}),a?this.pipeline.dispatch({type:"openDropdown"}):c?this.pipeline.dispatch({type:"openDatePicker"}):g&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}if(e.key==="Enter"){if(c)return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"startEdit",target:i}),this.pipeline.dispatch({type:"openDatePicker"}),!0;if(a){const g=this.ctx.grid.columns[i.colIndex];return g&&this.ctx.grid.getEffectiveShouldOpenDropdownOnEnter(g)?(e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"startEdit",target:i}),this.pipeline.dispatch({type:"openDropdown"}),!0):!1}return!1}if(e.key===" "){const g=this.isCustomEditor(i.colIndex);if(a||c||d||g)return e.preventDefault(),e.stopPropagation(),d?this.pipeline.dispatch({type:"toggleCheckbox",target:i}):(this.pipeline.dispatch({type:"startEdit",target:i}),a?this.pipeline.dispatch({type:"openDropdown"}):c?this.pipeline.dispatch({type:"openDatePicker"}):g&&this.pipeline.dispatch({type:"openCustomEditor",target:i})),!0}if(e.key==="Delete")return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"deleteCell",target:i}),!0;if((e.ctrlKey||e.metaKey)&&e.key==="c")return e.preventDefault(),e.stopPropagation(),this.pipeline.dispatch({type:"copy"}),!0;if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){if(this.isEditingCell(i.rowIndex,i.colIndex))return!1;e.preventDefault(),e.stopPropagation();const g=this.isCustomEditor(i.colIndex);return this.pipeline.dispatch({type:"startEdit",target:i,initialSearchQuery:e.key}),a?this.pipeline.dispatch({type:"openDropdown"}):g&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}return!1}tryHandleFocus(e){const o=e.target,i=this.getCellFromTarget(o);if(!i||!this.isAlwaysMode(i.colIndex)||!o.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger"))return!1;const s=this.ctx.grid.focusedCell;return(!s||s.rowIndex!==i.rowIndex||s.colIndex!==i.colIndex)&&this.pipeline.dispatch({type:"focusCell",target:i,selectText:!1}),!0}tryHandleMouseDown(e){const o=e.target,i=o.matches(".wg__combobox-toggle, .wg__select-toggle"),r=!!o.closest(".wg__date-trigger"),s=o.matches('.wg__checkbox-input, input[type="checkbox"]'),n=!i&&!r&&!s&&(o.matches(".wg__cell")||o.closest(".wg__cell")!==null);let l=null;if(i){const w=o.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete")||o.closest(".wg__cell-dropdown-display");if(w){const p=parseInt(w.dataset.row||"",10),m=w.dataset.field||"",v=this.ctx.grid.columns.findIndex(y=>String(y.field)===m);!isNaN(p)&&v>=0&&(l={rowIndex:p,colIndex:v})}}else if(r){const w=o.closest(".wg__editor--date")||o.closest(".wg__cell-date-display");if(w){const p=parseInt(w.dataset.row||"",10),m=w.dataset.field||"",v=this.ctx.grid.columns.findIndex(y=>String(y.field)===m);!isNaN(p)&&v>=0&&(l={rowIndex:p,colIndex:v})}}else l=this.getCellFromTarget(o);if(!l)return!1;this.ctx.grid.tabTraversalStartColIndex=null;const a=this.isAlwaysMode(l.colIndex),d=this.isEditingCell(l.rowIndex,l.colIndex);if(!i&&!r&&!s&&!n)return!1;const c=this.ctx.grid.cellSelectionMode,u=e.shiftKey;if(c==="shift"&&u&&n)return this.pipeline.dispatch({type:"startCellSelection",rowIndex:l.rowIndex,colIndex:l.colIndex,clientX:e.clientX,clientY:e.clientY,shiftKey:!0}),e.preventDefault(),!0;if(a||d){const w=o.matches(".wg__editor--text, .wg__editor--number, .wg__date-input"),p=o.matches(".wg__combobox-input, .wg__autocomplete-input"),m=this.ctx.grid.focusedCell,v=m&&m.rowIndex===l.rowIndex&&m.colIndex===l.colIndex;if((w||p)&&v&&n)return!0;const y=n&&this.ctx.grid.selectedCellRange;n&&(y||this.ctx.grid.selectedRows.length>0||this.ctx.grid.selectedColumns.length>0)&&(y&&(this.ctx.isTransitioningCells=!0),this.pipeline.dispatch({type:"clearSelection"}));const S=this.ctx.dropdownOpen,_=this.isDropdownEditor(l.colIndex),x=ir(e,{cell:l,dropdownOpen:S,isDropdownEditor:_,isDateEditor:this.isDateEditor(l.colIndex),isCheckboxEditor:this.isCheckboxEditor(l.colIndex),isToggleClick:i,isDateTriggerClick:r,isCheckboxClick:s,isCellClick:n});if(x.length===0)return y&&(this.ctx.isTransitioningCells=!1),!1;w||(e.preventDefault(),e.stopPropagation());for(const k of x)this.pipeline.dispatch(k);return y&&requestAnimationFrame(()=>{this.ctx.isTransitioningCells=!1}),!0}if(i)return e.preventDefault(),e.stopPropagation(),this.ctx.grid.editingCell&&this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"focusCell",target:l,selectText:!1}),this.pipeline.dispatch({type:"startEdit",target:l}),this.pipeline.dispatch({type:"openDropdown"}),!0;if(r)return e.preventDefault(),e.stopPropagation(),this.ctx.grid.editingCell&&this.pipeline.dispatch({type:"cancelEdit"}),this.pipeline.dispatch({type:"focusCell",target:l,selectText:!1}),this.pipeline.dispatch({type:"startEdit",target:l}),this.pipeline.dispatch({type:"openDatePicker"}),!0;if(n&&!i&&!s){e.preventDefault(),this.ctx.grid.editingCell&&(this.ctx.isTransitioningCells=!0,this.pipeline.dispatch({type:"cancelEdit"})),(this.ctx.grid.selectedRows.length>0||this.ctx.grid.selectedColumns.length>0||this.ctx.grid.selectedCellRange)&&this.pipeline.dispatch({type:"clearSelection"}),this.pipeline.dispatch({type:"focusCell",target:l,selectText:!1});const w=this.ctx.grid.cellSelectionMode,p=e.shiftKey;return w!=="disabled"&&(w==="click"&&!p||w==="shift"&&p)&&this.pipeline.dispatch({type:"startCellSelection",rowIndex:l.rowIndex,colIndex:l.colIndex,clientX:e.clientX,clientY:e.clientY,shiftKey:e.shiftKey}),this.ctx.isTransitioningCells&&requestAnimationFrame(()=>{this.ctx.isTransitioningCells=!1}),!0}const g=this.ctx.dropdownOpen,h=this.isDropdownEditor(l.colIndex),f=ir(e,{cell:l,dropdownOpen:g,isDropdownEditor:h,isDateEditor:this.isDateEditor(l.colIndex),isCheckboxEditor:this.isCheckboxEditor(l.colIndex),isToggleClick:i,isDateTriggerClick:r,isCheckboxClick:s,isCellClick:n});if(f.length===0)return!1;e.preventDefault(),e.stopPropagation();for(const w of f)this.pipeline.dispatch(w);return!0}tryHandleClick(e){const o=e.target,i=this.getCellFromTarget(o);if(!i||this.getEditTrigger(i.colIndex)!=="click"||this.isEditingCell(i.rowIndex,i.colIndex))return!1;e.preventDefault();const s=this.isDropdownEditor(i.colIndex),n=this.isDateEditor(i.colIndex),l=this.isCustomEditor(i.colIndex);(s||n||l)&&e.stopImmediatePropagation();const a=o.closest(".wg__cell"),d=a?et(e,a):null;return this.pipeline.dispatch({type:"startEdit",target:i,cursorPosition:d??void 0}),s?this.pipeline.dispatch({type:"openDropdown"}):n?this.pipeline.dispatch({type:"openDatePicker"}):l&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}tryHandleDblClick(e){const o=e.target,i=this.getCellFromTarget(o);if(!i)return!1;const r=this.getEditTrigger(i.colIndex);if(r!=="dblclick"&&r!=="navigate"||this.isEditingCell(i.rowIndex,i.colIndex))return!1;e.preventDefault();const s=this.isDropdownEditor(i.colIndex),n=this.isDateEditor(i.colIndex),l=this.isCustomEditor(i.colIndex),a=o.closest(".wg__cell"),d=a?et(e,a):null;return this.pipeline.dispatch({type:"startEdit",target:i,cursorPosition:d??void 0}),s?this.pipeline.dispatch({type:"openDropdown"}):n?this.pipeline.dispatch({type:"openDatePicker"}):l&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}isDatepickerOpen(){return!!this.ctx.datepicker}clearSelection(){this.pipeline.dispatch({type:"clearSelection"})}}function _a(t){return new ba(t)}class ko extends HTMLElement{constructor(){super();b(this,"grid");b(this,"shadow");b(this,"styleElement");b(this,"customStyleElement",null);b(this,"updatePending",!1);b(this,"isCommittingFromKeyboard",!1);b(this,"isTransitioningCells",!1);b(this,"toolbarOutsideClickAdded",!1);b(this,"clickEventsSubscribed",!1);b(this,"focusEventsSubscribed",!1);b(this,"toolbarMoveInProgress",!1);b(this,"toolbarHideTimeout",null);b(this,"toolbarHovered",!1);b(this,"toolbarShortcutHandler",null);b(this,"hoveredCell",null);b(this,"currentCellToolbarItems",null);b(this,"toolbarMousemoveHandler",null);b(this,"inlineShortcutHandler",null);b(this,"dropdownOpen",!1);b(this,"dropdownOptions",[]);b(this,"highlightedIndex",-1);b(this,"filterText","");b(this,"isUserFiltering",!1);b(this,"justSelected",!1);b(this,"isOpeningDropdown",!1);b(this,"dropdownUserInteracted",!1);b(this,"isClosingViaToggle",!1);b(this,"isProgrammaticScroll",!1);b(this,"searchDebounceTimer",null);b(this,"searchAbortController",null);b(this,"isSearching",!1);b(this,"tooltipElement",null);b(this,"tooltipArrowElement",null);b(this,"tooltipAnchor",null);b(this,"tooltipShowTimer",null);b(this,"tooltipHideTimer",null);b(this,"_tooltipShowDelay",200);b(this,"_tooltipHideDelay",100);b(this,"datepicker",null);b(this,"contextMenuElement",null);b(this,"headerContextMenuElement",null);b(this,"virtualScrollStart",0);b(this,"virtualScrollEnd",0);b(this,"isLoadingMoreItems",!1);b(this,"scrollEvents");b(this,"focusEvents");b(this,"clickEvents");b(this,"pipelineAdapter",null);b(this,"_isMouseDown",!1);b(this,"handlePaste",async o=>{var l;if(!this.grid.isNavigateMode||this.grid.editingCell||!this.grid.focusedCell)return;const{rowIndex:i,colIndex:r}=this.grid.focusedCell,s=((l=o.clipboardData)==null?void 0:l.getData("text"))||"";if(!s)return;if(s.includes(" ")||s.includes(`
|
|
662
|
+
`))o.preventDefault(),await Il(this,s,i,r),this.render();else{const a=this.grid.columns[r],d=this.grid.displayItems[i];if(!a||!d||!this.grid.isCellEditable(a))return;o.preventDefault();let c=s;a.beforePasteCallback&&(c=a.beforePasteCallback(s,d));const u=String(a.field);await this.grid.commitEdit(i,u,c),this.render()}});this.shadow=this.attachShadow({mode:"open"}),this.grid=new oi,this.scrollEvents=sl(),this.clickEvents=al(),this.focusEvents=ll(()=>({isCommittingFromKeyboard:this.isCommittingFromKeyboard,isTransitioningCells:this.isTransitioningCells,isClosingViaToggle:this.isClosingViaToggle,isOpeningDropdown:this.isOpeningDropdown}),()=>{this.isClosingViaToggle=!1}),this.styleElement=document.createElement("style"),this.styleElement.textContent=Wn,this.shadow.appendChild(this.styleElement),this.grid.requestUpdate=()=>this.requestUpdate(),this.grid._onInteractionChange=(o,i)=>{o==="editingCell"&&i.current===null&&V(this)}}get tooltipShowDelay(){return this._tooltipShowDelay}set tooltipShowDelay(o){this._tooltipShowDelay=o}get tooltipHideDelay(){return this._tooltipHideDelay}set tooltipHideDelay(o){this._tooltipHideDelay=o}connectedCallback(){no.debug("connectedCallback — grid attached to DOM"),this.grid.gridName&&this.grid.shouldPersistColumnWidths&&this.grid.loadPersistedWidths(),this.pipelineAdapter=_a(this),this.render(),this.addEventListener("paste",this.handlePaste)}disconnectedCallback(){no.debug("disconnectedCallback — grid removed from DOM"),this.scrollEvents.destroy(),this.focusEvents.destroy(),this.clickEvents.destroy(),this.clickEventsSubscribed=!1,this.focusEventsSubscribed=!1,this.removeEventListener("paste",this.handlePaste),this.datepicker&&(this.datepicker.destroy(),this.datepicker=null),this.contextMenuElement&&(de(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(de(this.headerContextMenuElement),this.headerContextMenuElement=null),$t(),this.removeInlineShortcuts(),vl()}get items(){return this.grid.items}set items(o){this.grid.items=o,this.isLoadingMoreItems=!1}get columns(){return this.grid.columns}set columns(o){this.grid.columns=o}get isFilterable(){return this.grid.isFilterable}set isFilterable(o){this.grid.isFilterable=o}get isPageable(){return this.grid.isPageable}set isPageable(o){this.grid.isPageable=o}get pageSize(){return this.grid.pageSize}set pageSize(o){this.grid.pageSize=o}get pageSizes(){return this.grid.pageSizes}set pageSizes(o){this.grid.pageSizes=o}get paginationMode(){return this.grid.paginationMode}set paginationMode(o){this.grid.paginationMode=o}get isStriped(){return this.grid.isStriped}set isStriped(o){this.grid.isStriped=o}get isHoverable(){return this.grid.isHoverable}set isHoverable(o){this.grid.isHoverable=o}get isEditable(){return this.grid.isEditable}set isEditable(o){this.grid.isEditable=o}get editTrigger(){return this.grid.editTrigger}set editTrigger(o){this.grid.editTrigger=o}get editStartSelection(){return this.grid.editStartSelection}set editStartSelection(o){this.grid.editStartSelection=o}get mode(){return this.grid.mode}set mode(o){this.grid.mode=o}get dropdownToggleVisibility(){return this.grid.dropdownToggleVisibility}set dropdownToggleVisibility(o){this.grid.dropdownToggleVisibility=o}get shouldShowDropdownOnFocus(){return this.grid.shouldShowDropdownOnFocus}set shouldShowDropdownOnFocus(o){this.grid.shouldShowDropdownOnFocus=o}get shouldOpenDropdownOnEnter(){return this.grid.shouldOpenDropdownOnEnter}set shouldOpenDropdownOnEnter(o){this.grid.shouldOpenDropdownOnEnter=o}get isCheckboxAlwaysEditable(){return this.grid.isCheckboxAlwaysEditable}set isCheckboxAlwaysEditable(o){this.grid.isCheckboxAlwaysEditable=o}get isRowNumbersVisible(){return this.grid.isRowNumbersVisible}set isRowNumbersVisible(o){this.grid.isRowNumbersVisible=o}get isDirtyIndicatorVisible(){return this.grid.isDirtyIndicatorVisible}set isDirtyIndicatorVisible(o){this.grid.isDirtyIndicatorVisible=o}isCellDirty(o,i){return this.grid.isCellDirty(o,i)}isRowDirty(o){return this.grid.isRowDirty(o)}get isStickyRowNumbers(){return this.grid.isStickyRowNumbers}set isStickyRowNumbers(o){this.grid.isStickyRowNumbers=o}get freezeColumns(){return this.grid.freezeColumns}set freezeColumns(o){this.grid.freezeColumns=o}get invalidCells(){return this.grid.invalidCells}set invalidCells(o){this.grid.invalidCells=o}get isRowToolbarVisible(){return this.grid.isRowToolbarVisible}set isRowToolbarVisible(o){this.grid.isRowToolbarVisible=o}get rowToolbar(){return this.grid.rowToolbar}set rowToolbar(o){this.grid.rowToolbar=o}get toolbarVerticalAlign(){return this.grid.toolbarVerticalAlign}set toolbarVerticalAlign(o){this.grid.toolbarVerticalAlign=o}get toolbarHorizontalAlign(){return this.grid.toolbarHorizontalAlign}set toolbarHorizontalAlign(o){this.grid.toolbarHorizontalAlign=o}get toolbarAlign(){return this.grid.toolbarVerticalAlign}set toolbarAlign(o){this.grid.toolbarVerticalAlign=o}get toolbarTopPosition(){return this.grid.toolbarHorizontalAlign}set toolbarTopPosition(o){this.grid.toolbarHorizontalAlign=o}get toolbarTrigger(){return this.grid.toolbarTrigger}set toolbarTrigger(o){this.grid.toolbarTrigger=o}get toolbarPosition(){return this.grid.toolbarPosition}set toolbarPosition(o){this.grid.toolbarPosition=o}get toolbarColumn(){return this.grid.toolbarColumn}set toolbarColumn(o){this.grid.toolbarColumn=o}get toolbarFollowsCursor(){return this.grid.toolbarFollowsCursor}set toolbarFollowsCursor(o){this.grid.toolbarFollowsCursor=o}get cellToolbar(){return this.grid.cellToolbar}set cellToolbar(o){this.grid.cellToolbar=o}get cellToolbarOffset(){return this.grid.cellToolbarOffset}set cellToolbarOffset(o){this.grid.cellToolbarOffset=o}get toolbarBtnMinWidth(){return this.grid.toolbarBtnMinWidth}set toolbarBtnMinWidth(o){this.grid.toolbarBtnMinWidth=o}get inlineActionsTitle(){return this.grid.inlineActionsTitle}set inlineActionsTitle(o){this.grid.inlineActionsTitle=o}get contextMenu(){return this.grid.contextMenu}set contextMenu(o){this.grid.contextMenu=o}get contextMenuXOffset(){return this.grid.contextMenuXOffset}set contextMenuXOffset(o){this.grid.contextMenuXOffset=o}get contextMenuYOffset(){return this.grid.contextMenuYOffset}set contextMenuYOffset(o){this.grid.contextMenuYOffset=o}get headerContextMenu(){return this.grid.headerContextMenu}set headerContextMenu(o){this.grid.headerContextMenu=o}set onheadercontextmenuopen(o){this.grid.onheadercontextmenuopen=o}get rowShortcuts(){return this.grid.rowShortcuts}set rowShortcuts(o){this.grid.rowShortcuts=o}get rangeShortcuts(){return this.grid.rangeShortcuts}set rangeShortcuts(o){this.grid.rangeShortcuts=o}get selectedRows(){return this.grid.selectedRows}selectRow(o,i="replace"){this.grid.selectRow(o,i)}selectRowRange(o,i){this.grid.selectRowRange(o,i)}clearSelection(){this.grid.clearSelection()}isRowSelected(o){return this.grid.isRowSelected(o)}getSelectedRowsData(){return this.grid.getSelectedRowsData()}copySelectedRowsToClipboard(){return this.grid.copySelectedRowsToClipboard()}get cellSelectionMode(){return this.grid.cellSelectionMode}set cellSelectionMode(o){this.grid.cellSelectionMode=o}get selectedCellRange(){return this.grid.selectedCellRange}selectCellRange(o){this.grid.selectCellRange(o)}clearCellSelection(){this.grid.clearCellSelection()}getSelectedCells(){return this.grid.getSelectedCells()}copyCellSelectionToClipboard(){return this.grid.copyCellSelectionToClipboard()}get shouldCopyWithHeaders(){return this.grid.shouldCopyWithHeaders}set shouldCopyWithHeaders(o){this.grid.shouldCopyWithHeaders=o}get oncellselectionchange(){return this.grid.oncellselectionchange}set oncellselectionchange(o){this.grid.oncellselectionchange=o}get isNewRowEnabled(){return this.grid.isNewRowEnabled}set isNewRowEnabled(o){this.grid.isNewRowEnabled=o}get newRowPosition(){return this.grid.newRowPosition}set newRowPosition(o){this.grid.newRowPosition=o}get newRowIndicator(){return this.grid.newRowIndicator}set newRowIndicator(o){this.grid.newRowIndicator=o}get createEmptyRowCallback(){return this.grid.createEmptyRowCallback}set createEmptyRowCallback(o){this.grid.createEmptyRowCallback=o}get treePathMember(){return this.grid.treePathMember}set treePathMember(o){this.grid.treePathMember=o}get treeLevelMember(){return this.grid.treeLevelMember}set treeLevelMember(o){this.grid.treeLevelMember=o}get treeParentMember(){return this.grid.treeParentMember}set treeParentMember(o){this.grid.treeParentMember=o}get treeSeparator(){return this.grid.treeSeparator}set treeSeparator(o){this.grid.treeSeparator=o}get treeDataSorted(){return this.grid.treeDataSorted}set treeDataSorted(o){this.grid.treeDataSorted=o}get expandedPaths(){return this.grid.expandedPaths}set expandedPaths(o){this.grid.expandedPaths=o}get defaultExpandDepth(){return this.grid.defaultExpandDepth}set defaultExpandDepth(o){this.grid.defaultExpandDepth=o}set onexpandedpathschange(o){this.grid.onexpandedpathschange=o}get onexpandedpathschange(){return this.grid.onexpandedpathschange}isPathExpanded(o){return this.grid.isPathExpanded(o)}toggleExpandedPath(o){this.grid.toggleExpandedPath(o)}expandAll(){this.grid.expandAll()}collapseAll(){this.grid.collapseAll()}get treeDoubleClickBehavior(){return this.grid.treeDoubleClickBehavior}set treeDoubleClickBehavior(o){this.grid.treeDoubleClickBehavior=o}get treeExpandedGlyph(){return this.grid.treeExpandedGlyph}set treeExpandedGlyph(o){this.grid.treeExpandedGlyph=o}get treeCollapsedGlyph(){return this.grid.treeCollapsedGlyph}set treeCollapsedGlyph(o){this.grid.treeCollapsedGlyph=o}get treeChevronCallback(){return this.grid.treeChevronCallback}set treeChevronCallback(o){this.grid.treeChevronCallback=o}get isShortcutsHelpVisible(){return this.grid.isShortcutsHelpVisible}set isShortcutsHelpVisible(o){this.grid.isShortcutsHelpVisible=o}get shortcutsHelpPosition(){return this.grid.shortcutsHelpPosition}set shortcutsHelpPosition(o){this.grid.shortcutsHelpPosition=o}get shortcutsHelpContentCallback(){return this.grid.shortcutsHelpContentCallback}set shortcutsHelpContentCallback(o){this.grid.shortcutsHelpContentCallback=o}set onrowchange(o){this.grid.onrowchange=o}set onroweditstart(o){this.grid.onroweditstart=o}set onroweditcancel(o){this.grid.onroweditcancel=o}set onvalidationerror(o){this.grid.onvalidationerror=o}get validationTooltipCallback(){return this.grid.validationTooltipCallback}set validationTooltipCallback(o){this.grid.validationTooltipCallback=o}set ontoolbarclick(o){this.grid.ontoolbarclick=o}set onrowaction(o){this.grid.onrowaction=o}set oncontextmenuopen(o){this.grid.oncontextmenuopen=o}get ondatarequest(){return this.grid.ondatarequest}set ondatarequest(o){this.grid.ondatarequest=o}get onrowdelete(){return this.grid.onrowdelete}set onrowdelete(o){this.grid.onrowdelete=o}get onrowfocus(){return this.grid.onrowfocus}set onrowfocus(o){this.grid.onrowfocus=o}get focusedRowIndex(){return this.grid.focusedRowIndex}set focusedRowIndex(o){this.grid.focusedRowIndex=o}get sort(){return this.grid.sort}set sort(o){this.grid.sort=o}get sortMode(){return this.grid.sortMode}set sortMode(o){this.grid.sortMode=o}get currentPage(){return this.grid.currentPage}set currentPage(o){this.grid.currentPage=o}get totalItems(){return this.grid.totalItems}set totalItems(o){this.grid.totalItems=o}get showPagination(){return this.grid.showPagination}set showPagination(o){this.grid.showPagination=o}get paginationPosition(){return this.grid.paginationPosition}set paginationPosition(o){this.grid.paginationPosition=o}get paginationLabelsCallback(){return this.grid.paginationLabelsCallback}set paginationLabelsCallback(o){this.grid.paginationLabelsCallback=o}get paginationLayout(){return this.grid.paginationLayout}set paginationLayout(o){this.grid.paginationLayout=o}get summaryPosition(){return this.grid.summaryPosition}set summaryPosition(o){this.grid.summaryPosition=o}get summaryContentCallback(){return this.grid.summaryContentCallback}set summaryContentCallback(o){this.grid.summaryContentCallback=o}get customStylesCallback(){return this.grid.customStylesCallback}set customStylesCallback(o){this.grid.customStylesCallback=o,this.updateCustomStyles()}get rowClassCallback(){return this.grid.rowClassCallback}set rowClassCallback(o){this.grid.rowClassCallback=o}get labels(){return this.grid.labels}set labels(o){this.grid.labels=o}get summaryMetadata(){return this.grid.summaryMetadata}set summaryMetadata(o){this.grid.summaryMetadata=o}get isSummaryInline(){return this.grid.isSummaryInline}set isSummaryInline(o){this.grid.isSummaryInline=o}get idValueMember(){return this.grid.idValueMember}set idValueMember(o){this.grid.idValueMember=o}get idValueCallback(){return this.grid.idValueCallback}set idValueCallback(o){this.grid.idValueCallback=o}get rowLocking(){return this.grid.rowLocking}set rowLocking(o){this.grid.rowLocking=o}get onrowlockchange(){return this.grid.onrowlockchange}set onrowlockchange(o){this.grid.onrowlockchange=o}get gridName(){return this.grid.gridName}set gridName(o){this.grid.gridName=o,this.tryLoadPersistedWidths()}get shouldPersistColumnWidths(){return this.grid.shouldPersistColumnWidths}set shouldPersistColumnWidths(o){this.grid.shouldPersistColumnWidths=o,this.tryLoadPersistedState()}get isColumnReorderAllowed(){return this.grid.isColumnReorderAllowed}set isColumnReorderAllowed(o){this.grid.isColumnReorderAllowed=o}get shouldPersistColumnOrder(){return this.grid.shouldPersistColumnOrder}set shouldPersistColumnOrder(o){this.grid.shouldPersistColumnOrder=o,this.tryLoadPersistedState()}tryLoadPersistedState(){this.grid.gridName&&(this.grid.shouldPersistColumnWidths||this.grid.shouldPersistColumnOrder)&&(this.grid.loadPersistedState(),this.isConnected&&this.render())}tryLoadPersistedWidths(){this.tryLoadPersistedState()}get oncolumnresize(){return this.grid.oncolumnresize}set oncolumnresize(o){this.grid.oncolumnresize=o}get oncolumnreorder(){return this.grid.oncolumnreorder}set oncolumnreorder(o){this.grid.oncolumnreorder=o}get fillDragCallback(){return this.grid.fillDragCallback}set fillDragCallback(o){this.grid.fillDragCallback=o}get isScrollable(){return this.grid.isScrollable}set isScrollable(o){this.grid.isScrollable=o}get scrollMaxHeight(){return this.grid.scrollMaxHeight}set scrollMaxHeight(o){this.grid.scrollMaxHeight=o}get tableBorderOnly(){return this.grid.tableBorderOnly}set tableBorderOnly(o){this.grid.tableBorderOnly=o}get isVirtualScrollEnabled(){return this.grid.isVirtualScrollEnabled}set isVirtualScrollEnabled(o){this.grid.isVirtualScrollEnabled=o}get virtualScrollThreshold(){return this.grid.virtualScrollThreshold}set virtualScrollThreshold(o){this.grid.virtualScrollThreshold=o}get virtualScrollRowHeight(){return this.grid.virtualScrollRowHeight}set virtualScrollRowHeight(o){this.grid.virtualScrollRowHeight=o}get virtualScrollBuffer(){return this.grid.virtualScrollBuffer}set virtualScrollBuffer(o){this.grid.virtualScrollBuffer=o}get isInfiniteScrollEnabled(){return this.grid.isInfiniteScrollEnabled}set isInfiniteScrollEnabled(o){this.grid.isInfiniteScrollEnabled=o}get infiniteScrollThreshold(){return this.grid.infiniteScrollThreshold}set infiniteScrollThreshold(o){this.grid.infiniteScrollThreshold=o}get hasMoreItems(){return this.grid.hasMoreItems}set hasMoreItems(o){this.grid.hasMoreItems=o}get displayItems(){return this.grid.displayItems}get totalPages(){return this.grid.totalPages}get isNavigateMode(){return this.grid.isNavigateMode}getRowDraft(o){return this.grid.getRowDraft(o)}hasRowDraft(o){return this.grid.hasRowDraft(o)}discardRowDraft(o){this.grid.discardRowDraft(o)}getDraftRowIndices(){return this.grid.getDraftRowIndices()}discardAllDrafts(){this.grid.discardAllDrafts()}isCellInvalid(o,i){return this.grid.isCellInvalid(o,i)}getCellValidationError(o,i){return this.grid.getCellValidationError(o,i)}getRowId(o){return this.grid.getRowId(o)}findRowById(o){return this.grid.findRowById(o)}isRowLocked(o){return this.grid.isRowLocked(o)}getRowLockInfo(o){return this.grid.getRowLockInfo(o)}lockRowById(o,i){return this.grid.lockRowById(o,i)}unlockRowById(o){return this.grid.unlockRowById(o)}getExternalLocks(){return this.grid.getExternalLocks()}clearExternalLocks(){this.grid.clearExternalLocks()}updateRowById(o,i){return this.grid.updateRowById(o,i)}replaceRowById(o,i){return this.grid.replaceRowById(o,i)}canEditCell(o,i){return this.grid.canEditCell(o,i)}setColumnWidth(o,i){this.grid.setColumnWidth(o,i)}setColumnWidths(o){this.grid.setColumnWidths(o)}getColumnWidthsState(){return this.grid.getColumnWidthsState()}setColumnOrder(o){this.grid.setColumnOrder(o)}getColumnOrderState(){return this.grid.getColumnOrderState()}focusCell(o,i){const r=this.grid.columns,s=this.grid.displayItems;o<0||o>=s.length||i<0||i>=r.length||(this.grid.setFocusedCell(o,i),requestAnimationFrame(()=>{q(this,o,i)}))}startEditing(o,i){const r=this.grid.columns;if(i<0||i>=r.length)return;const s=r[i],n=String(s.field);this.grid.startEdit(o,n);const l=this.shadow.querySelector(`td[data-row="${o}"][data-col="${i}"]`);l&&(l.classList.remove("wg__cell--focused"),l.classList.add("wg__cell--editing"),l.innerHTML=Lt(this,o,i,s))}escapeHtml(o){const i=document.createElement("div");return i.textContent=o,i.innerHTML}getCurrentEditingColumn(){const o=this.grid.editingCell;return o&&this.grid.columns.find(i=>String(i.field)===o.field)||null}getCurrentEditorOptions(){const o=this.getCurrentEditingColumn();return(o==null?void 0:o.editorOptions)||{}}moveFocusAfterCommit(o,i,r){po(this,o,i,r)}requestUpdate(){this.updatePending||(xe.debug("requestUpdate: scheduling render"),this.updatePending=!0,queueMicrotask(()=>{this.updatePending=!1,this.render()}))}updateCustomStyles(){const o=this.grid.customStylesCallback;if(o){const i=o();this.customStyleElement||(this.customStyleElement=document.createElement("style"),this.shadow.appendChild(this.customStyleElement)),this.customStyleElement.textContent=i}else this.customStyleElement&&(this.customStyleElement.remove(),this.customStyleElement=null)}handleCellKeyDown(o,i,r){var u;if(!this.grid.isNavigateMode)return;const s=this.grid.columns,n=this.grid.displayItems,l=this.grid.getEditableColumns(),a=l.findIndex(g=>g.index===r);if((o.ctrlKey||o.metaKey)&&o.key==="c"){if(this.grid.selectedCellRange){o.preventDefault(),this.grid.copyCellSelectionToClipboard();return}const g=s[r],h=n[i];if(g&&h){let f=this.grid.getCellRawValue(h,i,String(g.field));g.beforeCopyCallback&&(f=g.beforeCopyCallback(f,h));const w=f!=null?String(f):"";navigator.clipboard.writeText(w)}return}const d=this.grid.selectedRows;if(d.length>0){const g=this.grid.rangeShortcuts;if(g&&g.length>0)for(const h of g){const f=wt(h.key);if(pt(o,f)){const w={rows:this.grid.getSelectedRowsData(),rowIndices:d};if(!(typeof h.disabled=="function"?h.disabled(w):h.disabled===!0)){o.preventDefault(),h.action(w);return}}}}const c=this.grid.rowShortcuts;if(c&&c.length>0){const g=s[r],h=n[i];if(g&&h)for(const f of c){const w=wt(f.key);if(pt(o,w)){const p={row:h,rowIndex:i,colIndex:r,column:g,cellValue:this.grid.getCellRawValue(h,i,String(g.field))};if(!(typeof f.disabled=="function"?f.disabled(p):f.disabled===!0)){o.preventDefault(),f.action(p);return}}}}switch(o.key){case"ArrowUp":o.preventDefault(),i>0&&q(this,i-1,r);break;case"ArrowDown":o.preventDefault(),i<n.length-1&&q(this,i+1,r);break;case"ArrowLeft":o.preventDefault(),r>0&&q(this,i,r-1);break;case"ArrowRight":o.preventDefault(),r<s.length-1&&q(this,i,r+1);break;case"Tab":if(o.preventDefault(),o.shiftKey){if(a>0){const g=l[a-1].index;q(this,i,g)}else if(i>0){const g=l[l.length-1].index;q(this,i-1,g)}}else if(a>=0&&a<l.length-1){const g=l[a+1].index;q(this,i,g)}else if(a===-1&&l.length>0)q(this,i,l[0].index);else if(i<n.length-1){const g=l[0].index;q(this,i+1,g)}else this.grid.isEmptyRowIndex(i)&&q(this,i,l[0].index);break;case"Home":if(o.preventDefault(),o.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(0,0),this.scrollToRowProgrammatically(0);const h=this.shadow.querySelector('td[data-row="0"][data-col="0"]');h&&(h.focus({preventScroll:!0}),Z(this,g,{rowIndex:0,colIndex:0}))}else q(this,0,0);else q(this,i,0);break;case"End":if(o.preventDefault(),o.ctrlKey){const g=n.length-1,h=s.length-1;if(this.grid.shouldUseVirtualScroll()){const f=this.grid.focusedCell;this.grid.setFocusedCell(g,h),this.scrollToRowProgrammatically(g);const w=this.shadow.querySelector(`td[data-row="${g}"][data-col="${h}"]`);w&&(w.focus({preventScroll:!0}),Z(this,f,{rowIndex:g,colIndex:h}))}else q(this,g,h)}else q(this,i,s.length-1);break;case"PageUp":if(o.preventDefault(),o.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(0,r),this.scrollToRowProgrammatically(0);const h=this.shadow.querySelector(`td[data-row="0"][data-col="${r}"]`);h&&(h.focus({preventScroll:!0}),Z(this,g,{rowIndex:0,colIndex:r}))}else q(this,0,r);else{const g=Math.max(0,i-10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),Z(this,h,{rowIndex:g,colIndex:r}))}else q(this,g,r)}break;case"PageDown":if(o.preventDefault(),o.ctrlKey){const g=n.length-1;if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),Z(this,h,{rowIndex:g,colIndex:r}))}else q(this,g,r)}else{const g=Math.min(n.length-1,i+10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),Z(this,h,{rowIndex:g,colIndex:r}))}else q(this,g,r)}break;case"g":case"G":o.ctrlKey&&(o.preventDefault(),this.showGoToRowDialog(r));break;case"Enter":{o.preventDefault();const g=s[r],h=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",f=this.grid.isEmptyRowIndex(i);if(h&&this.grid.getEffectiveShouldOpenDropdownOnEnter(g))ie(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||fe(this)});else if(f&&g&&this.grid.isCellEditable(g))ie(this,i,r);else if(i<n.length-1){const w=this.grid.tabTraversalStartColIndex??r;this.grid.tabTraversalStartColIndex=null,q(this,i+1,w)}break}case"F2":{o.preventDefault();const g=s[r],h=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",f=(g==null?void 0:g.editor)==="custom";ie(this,i,r),h?requestAnimationFrame(()=>{this.dropdownOpen||fe(this)}):f&&requestAnimationFrame(()=>{this.openCustomEditor(i,r)});break}case" ":{o.preventDefault();const g=s[r],h=(g==null?void 0:g.editor)==="checkbox",f=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",w=(g==null?void 0:g.editor)==="date",p=(g==null?void 0:g.editor)==="custom";h&&g&&this.grid.isCellEditable(g)?cs(this,i,r):f?(ie(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||fe(this)})):w?(ie(this,i,r),requestAnimationFrame(()=>{var C;const m=(C=this.shadowRoot)==null?void 0:C.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`),v=m==null?void 0:m.querySelector(".wg__date-input"),y=m==null?void 0:m.querySelector(".wg__editor--date");v&&y&&this.openDatePicker(v,y)})):p&&(ie(this,i,r),requestAnimationFrame(()=>{this.openCustomEditor(i,r)}));break}case"Escape":if(o.preventDefault(),this.grid.editingCell)j(this),this.grid.cancelEdit();else if(this.grid.selectedRows.length>0)this.grid.clearSelection();else{const g=this.grid.focusedCell;this.grid.clearFocusedCell(),Z(this,g,null),(u=o.target)==null||u.blur()}break;case"Delete":{o.preventDefault();const g=s[r],h=n[i];if(o.ctrlKey){if(h){const f={rowIndex:i,row:h};this.grid.onrowdelete&&this.grid.onrowdelete(f),this.dispatchEvent(new CustomEvent("rowdelete",{detail:f}))}}else g&&this.grid.isCellEditable(g)&&(this.grid.commitEdit(i,String(g.field),null),this.render(),requestAnimationFrame(()=>{const f=this.shadow.querySelector(`td[data-row="${i}"][data-col="${r}"]`);f==null||f.focus()}));break}default:if(o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey){const g=s[r];if((g==null?void 0:g.editor)==="number"&&!/[\d.\-]/.test(o.key))return;ie(this,i,r,{initialSearchQuery:o.key}),o.preventDefault()}break}}async handleEditorKeyDown(o,i){const r=parseInt(i.dataset.row||"0",10),s=i.dataset.field||"",n=this.grid.columns.find(c=>c.field===s),l=(n==null?void 0:n.editor)||"text",a=l==="select"||l==="combobox"||l==="autocomplete",d=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"];if(a&&!this.dropdownOpen&&d.includes(o.key)){o.preventDefault(),o.stopPropagation();const c=this.grid.columns.findIndex(m=>m.field===s),u=this.grid.columns.map((m,v)=>({index:v,column:m})).filter(m=>m.column.isEditable!==!1),g=u.findIndex(m=>m.index===c),h=this.grid.displayItems;let f=r,w=c,p=!1;switch(o.key){case"ArrowUp":r>0&&(f=r-1,p=!0);break;case"ArrowDown":r<h.length-1&&(f=r+1,p=!0);break;case"ArrowLeft":g>0&&(w=u[g-1].index,p=!0);break;case"ArrowRight":g<u.length-1&&(w=u[g+1].index,p=!0);break;case"PageUp":f=Math.max(0,r-10),p=!0;break;case"PageDown":f=Math.min(h.length-1,r+10),p=!0;break;case"Home":o.ctrlKey&&(f=0),w=0,p=!0;break;case"End":o.ctrlKey?(f=h.length-1,w=this.grid.columns.length-1):w=this.grid.columns.length-1,p=!0;break}p&&(j(this),this.grid.cancelEdit(),queueMicrotask(()=>{q(this,f,w)}));return}switch(o.key){case"ArrowDown":if(this.dropdownOpen){o.preventDefault(),o.stopPropagation();const p=this.getCurrentEditorOptions();let m=this.highlightedIndex+1;for(;m<this.dropdownOptions.length&&ae(this.dropdownOptions[m],p);)m++;m<this.dropdownOptions.length&&(this.highlightedIndex=m,he(this),_o(this))}break;case"ArrowUp":if(this.dropdownOpen){o.preventDefault(),o.stopPropagation();const p=this.getCurrentEditorOptions();let m=this.highlightedIndex-1;for(;m>=0&&ae(this.dropdownOptions[m],p);)m--;m>=0&&(this.highlightedIndex=m,he(this),_o(this))}break;case"Enter":if(this.datepicker)return;o.preventDefault(),o.stopPropagation(),this.dropdownOpen&&this.highlightedIndex>=0?mi(this,this.highlightedIndex,!0,!0):a&&!this.dropdownOpen?fe(this):(this.isCommittingFromKeyboard=!0,V(this),l==="date"&&i instanceof HTMLInputElement?await this.commitDateEditor(i,!0):await At(this,i,!0),po(this,r,s,"down"));break;case"Tab":if(this.datepicker)return;o.preventDefault(),o.stopPropagation(),this.isCommittingFromKeyboard=!0;const c=this.grid.getEditableColumns(),u=this.grid.columns.findIndex(p=>String(p.field)===s),g=c.findIndex(p=>p.index===u),h=this.grid.isEmptyRowIndex(r),f=g===c.length-1,w=h&&f&&!o.shiftKey;if(this.dropdownOpen&&this.highlightedIndex>=0&&a){const p=this.dropdownOptions[this.highlightedIndex],m=this.getCurrentEditorOptions();if(p&&!ae(p,m)){const v=Ae(p,m);await this.grid.commitEdit(r,s,v,w)}V(this)}else V(this),l==="date"&&i instanceof HTMLInputElement?await this.commitDateEditor(i,w):a||await At(this,i,w);if(w){Pt(this,r,u);const p=c.length>0?c[0].index:0;queueMicrotask(()=>{const m=this.grid.newRowPosition==="top"?0:this.grid.displayItems.length-1;q(this,m,p),this.isCommittingFromKeyboard=!1})}else po(this,r,s,o.shiftKey?"prev":"next");break;case"Escape":if(o.preventDefault(),o.stopPropagation(),this.dropdownOpen){V(this),(l==="autocomplete"||l==="combobox")&&(this.filterText="",i instanceof HTMLInputElement&&(i.value="",i.focus()));return}if(this.datepicker){this.datepicker.close(!0),this.datepicker=null;return}this.isCommittingFromKeyboard=!0,j(this),this.grid.cancelEdit(),us(this,r,s);break;case"F2":o.preventDefault(),o.stopPropagation(),a&&!this.dropdownOpen&&fe(this);break;case"Backspace":l==="select"&&(o.preventDefault(),o.stopPropagation(),this.filterText.length>0&&(this.filterText=this.filterText.slice(0,-1),bi(this,n.editorOptions||{})));break;default:l==="select"&&o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&(o.preventDefault(),o.stopPropagation(),this.filterText+=o.key,bi(this,n.editorOptions||{}));break}}attachEventListeners(){const o=this.shadow.querySelector(".wg__table");if(!o)return;o.addEventListener("mousedown",()=>{this._isMouseDown=!0},!0),document.addEventListener("mouseup",()=>{this._isMouseDown=!1},!0),o.addEventListener("focus",n=>{const l=n.target;if(l.matches(".wg__cell")){const a=parseInt(l.dataset.row||"0",10),d=parseInt(l.dataset.col||"0",10);if(ss(this,a,d),zt(this),!this._isMouseDown&&!Co()&&!Ai()){const c=this.grid.focusedRowIndex;this.grid.setFocusedRow(a),this.updateRowFocusVisual(c,a)}wo(this,l,a)}if(l.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger")){const a=l.closest(".wg__cell");if(a){const d=parseInt(a.dataset.row||"0",10),c=parseInt(a.dataset.col||"0",10),u=this.grid.columns[c];if(((u==null?void 0:u.editTrigger)??this.grid.editTrigger)==="always"){const h=this.grid.focusedCell;if(!h||h.rowIndex!==d||h.colIndex!==c){if(this.grid.setFocusedCell(d,c),h){const f=this.shadow.querySelector(`td[data-row="${h.rowIndex}"][data-col="${h.colIndex}"]`);f&&f.classList.remove("wg__cell--always-edit-focused")}if(a.classList.add("wg__cell--always-edit-focused"),!this._isMouseDown){const f=this.grid.focusedRowIndex;this.grid.setFocusedRow(d),this.updateRowFocusVisual(f,d)}}}}}},!0),o.addEventListener("keydown",n=>{var a;const l=n.target;if(!((a=this.pipelineAdapter)!=null&&a.tryHandleKeyDown(n))){if(this.datepicker){const d=n.key;if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Enter","Escape","Tab"].includes(d))return}if(l.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input")){this.handleEditorKeyDown(n,l);return}if(l.matches(".wg__cell")){const d=parseInt(l.dataset.row||"0",10),c=parseInt(l.dataset.col||"0",10);this.handleCellKeyDown(n,d,c)}}}),this.focusEvents.init(o),this.focusEvents.subscribe("focusout",(n,l)=>{(!l||!o.contains(l))&&ls(this,{relatedTarget:l})}),o.addEventListener("dblclick",n=>{var d;const l=n.target;if((d=this.pipelineAdapter)!=null&&d.tryHandleDblClick(n))return;n.preventDefault();const a=l.closest(".wg__cell");if(a){const c=parseInt(a.dataset.row||"0",10),u=parseInt(a.dataset.col||"0",10),g=this.grid.columns[u];if(g){const h=g.editTrigger||this.grid.editTrigger;if(h==="dblclick"||h==="navigate"){const f=et(n,a);ie(this,c,u,{cursorPosition:f??void 0});const w=g.editor;w==="select"||w==="combobox"||w==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||fe(this)}):w==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(c,u)})}}}}),xe.debug("attaching click handler on table"),o.addEventListener("click",n=>{var c;const l=n.target;xe.debug("CLICK fired | target:",l.tagName,l.className,"| connected:",l.isConnected);const a=l.closest(".wg__tree-chevron[data-tree-toggle]");if(a){n.preventDefault(),n.stopPropagation();const u=a.getAttribute("data-tree-toggle");xe.debug("chevron click:",u,"| target:",l.tagName,l.className),u!==null&&this.grid.toggleExpandedPath(u);return}if((c=this.pipelineAdapter)!=null&&c.tryHandleClick(n))return;const d=l.closest(".wg__cell");if(d&&!d.classList.contains("wg__cell--editing")){const u=parseInt(d.dataset.row||"0",10),g=parseInt(d.dataset.col||"0",10),h=this.grid.columns[g];if(h&&(h.editTrigger||this.grid.editTrigger)==="click"){n.preventDefault();const w=et(n,d);ie(this,u,g,{cursorPosition:w??void 0});const p=h.editor;p==="select"||p==="combobox"||p==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||fe(this)}):p==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(u,g)})}}}),o.addEventListener("mousedown",n=>{var g,h;const l=n.target,a=n;if(xe.debug("MOUSEDOWN fired | target:",l.tagName,l.className,"| connected:",l.isConnected,"| detail:",a.detail,"| button:",a.button),l.closest(".wg__tree-chevron[data-tree-toggle]")){xe.debug("chevron mousedown intercepted (suppress focus/selection)"),n.preventDefault(),n.stopPropagation();return}if(a.detail===2&&a.button===0&&this.grid.isTreeMode){const f=l.closest(".wg__cell");if(f&&!l.closest(".wg__tree-chevron")){const w=parseInt(f.dataset.col||"-1",10),p=parseInt(f.dataset.row||"-1",10),m=w>=0?this.grid.columns[w]:null;if(m!=null&&m.isTree&&p>=0){if(this.grid.treeDoubleClickBehavior==="toggle"){const y=this.grid.displayItems[p],C=y?this.grid.getRowTreeInfo(y):null;if(C!=null&&C.hasChildren){xe.debug("tree dblclick (mousedown.detail=2) toggle:",C.path),n.preventDefault(),n.stopPropagation(),this.grid.toggleExpandedPath(C.path);return}}const v=m.editTrigger||this.grid.editTrigger;if((v==="dblclick"||v==="navigate")&&this.grid.canEditCell(p,String(m.field))){const y=et(a,f);xe.debug("tree dblclick (mousedown.detail=2) start edit:",String(m.field),"| trigger:",v),n.preventDefault(),n.stopPropagation(),ie(this,p,w,{cursorPosition:y??void 0});return}}}}if((g=this.pipelineAdapter)!=null&&g.tryHandleMouseDown(a))return;const d=l.closest(".wg__cell"),c=l.closest(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(d&&!d.classList.contains("wg__cell--editing")&&!l.closest(".wg__row-number")&&!c){const f=parseInt(d.dataset.row||"0",10),w=parseInt(d.dataset.col||"0",10),p=(h=this.grid.visualColumns[w])==null?void 0:h.column;if(p){const m=this.grid.cellSelectionMode,v=a.shiftKey;if(p.editTrigger||this.grid.editTrigger,m!=="disabled"&&(m==="click"&&!v||m==="shift"&&v)){if(this.grid.editingCell){const C=this.grid.editingCell,S=this.grid.columns.findIndex(_=>String(_.field)===C.field);V(this),j(this),this.grid.cancelEdit(),S>=0&&H(this,C.rowIndex,S)}this.grid.selectedRows.length>0&&this.grid.clearSelection(),this.grid.selectedColumns.length>0&&this.grid.clearColumnSelection(),Li(this,f,w,a);return}else this.grid.selectedCellRange&&(this.grid.clearCellSelection(),Q())}}if(l.closest(".wg__date-trigger")){n.preventDefault(),n.stopPropagation();const f=l.closest(".wg__cell-date-display"),w=l.closest(".wg__editor--date");if(w){const p=w.querySelector(".wg__date-input");p&&this.openDatePicker(p,w)}else if(f){const p=parseInt(f.dataset.row||"0",10),m=f.dataset.field||"",v=this.grid.columns.findIndex(y=>String(y.field)===m);if(v>=0){if(this.clearAllSelections(),this.isTransitioningCells=!0,this.grid.editingCell){const y=this.grid.editingCell,C=this.grid.columns.findIndex(S=>String(S.field)===y.field);V(this),j(this),this.grid.cancelEdit(),this.grid.setFocusedCell(p,v),C>=0&&H(this,y.rowIndex,C)}ie(this,p,v),requestAnimationFrame(()=>{var _;this.isTransitioningCells=!1;const y=(_=this.shadowRoot)==null?void 0:_.querySelector(`.wg__cell[data-row="${p}"][data-field="${m}"]`),C=y==null?void 0:y.querySelector(".wg__date-input"),S=y==null?void 0:y.querySelector(".wg__editor--date");C&&S&&this.openDatePicker(C,S)})}}return}if(this.dropdownOpen||this.grid.editingCell){const f=l.closest(".wg__cell");if(f&&!l.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete, .wg__editor--date")){const w=parseInt(f.dataset.row||"0",10),p=parseInt(f.dataset.col||"0",10),m=this.grid.editingCell,v=l.matches(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(m&&!v){const y=this.grid.columns.findIndex(C=>String(C.field)===m.field);if(w!==m.rowIndex||p!==y){n.preventDefault(),this.isTransitioningCells=!0;const C=m.rowIndex,S=y;V(this),j(this),this.grid.cancelEdit(),this.grid.setFocusedCell(w,p),S>=0&&H(this,C,S);const _=this.grid.columns[p],x=(_==null?void 0:_.editTrigger)||this.grid.editTrigger,I=n.clientX;requestAnimationFrame(()=>{if(this.isTransitioningCells=!1,x==="click"&&_&&this.grid.isCellEditable(_)){const E=this.shadow.querySelector(`td[data-row="${w}"][data-col="${p}"]`),R=E?et({clientX:I},E):void 0;ie(this,w,p,{cursorPosition:R??void 0})}else q(this,w,p)});return}}}}if(l.matches(".wg__cell-dropdown-display")){n.preventDefault(),n.stopPropagation();const f=l.closest(".wg__cell-dropdown-display");if(f){const w=parseInt(f.dataset.row||"0",10),p=f.dataset.field||"",m=this.grid.columns.findIndex(v=>String(v.field)===p);if(m>=0){this.isTransitioningCells=!0;const v=this.grid.editingCell,y=v?this.grid.columns.findIndex(C=>String(C.field)===v.field):-1;v&&(V(this),j(this),this.grid.cancelEdit(),this.grid.setFocusedCell(w,m),y>=0&&H(this,v.rowIndex,y)),ie(this,w,m),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||fe(this)})}}}}),o.addEventListener("click",n=>{const l=n.target;if(l.matches(".wg__select-trigger, .wg__select-value")){const a=l.closest(".wg__cell");if(a){const d=parseInt(a.dataset.col||"",10),c=this.grid.columns[d];if(((c==null?void 0:c.editTrigger)??this.grid.editTrigger)==="always")return}n.preventDefault(),n.stopPropagation(),Ms(this)}}),o.addEventListener("mousedown",n=>{const l=n.target,a=l.closest(".wg__resize-handle");if(a){n.preventDefault(),n.stopPropagation(),this.clearAllSelections();const g=a.dataset.field;g&&js(this,n,g);return}if(this.grid.isColumnReorderAllowed){const g=n;if(!g.ctrlKey&&!g.metaKey&&!g.shiftKey){const h=l.closest(".wg__header");if(h&&!h.classList.contains("wg__header--frozen")&&!h.classList.contains("wg__row-number-header")){this.clearAllSelections();const f=h.dataset.field;f&&Zs(this,n,f)}}}if((!this.grid.isColumnReorderAllowed||n.shiftKey)&&n.button===0){const g=l.closest(".wg__header:not(.wg__row-number-header):not(.wg__inline-actions-header):not(.wg__actions-column):not(.wg__filler)");if(g&&!l.closest(".wg__resize-handle")&&!l.closest(".wg__sort-indicator")){const h=g.dataset.field;if(h){const f=this.grid.visualColumns.findIndex(w=>String(w.column.field)===h);f>=0&&Cl(this,f,n)}}}const d=l.closest(".wg__row-number[data-row-number]");if(d&&n.button===0){const g=parseInt(d.dataset.rowNumber||"-1",10);g>=0&&pl(this,g,n)}l.closest(".wg__row-number-header")&&n.button===0&&(n.preventDefault(),this.grid.selectAll(),this.grid.selectedCellRange&&Ft(this),this.render(),requestAnimationFrame(()=>{const g=this.shadow.querySelector(".wg");g==null||g.focus({preventScroll:!0})}));const u=l.closest(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");if(u&&!l.closest(".wg__header")&&!Co()&&!Ai()){const g=parseInt(u.dataset.row||"-1",10);if(g>=0){const h=this.grid.focusedRowIndex;this.grid.setFocusedRow(g),this.updateRowFocusVisual(h,g)}}if(l.closest(".wg__cell")&&!l.closest(".wg__row-number, .wg__header")&&!Co()){let g=!1;this.grid.selectedRows.length>0&&(this.grid.clearSelection(),g=!0),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),g=!0),g&&this.render()}if(!l.closest(".wg__cell, .wg__row-number, .wg__header, .wg__toolbar, button, input, select, textarea")){let g=!1;this.grid.selectedCellRange&&(this.grid.clearCellSelection(),Q(),g=!0),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),g=!0),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),g=!0),g&&this.render()}}),o.addEventListener("click",n=>{const l=n,a=l.target;if(a.closest(".wg__resize-handle")||a.closest(".wg__sort-indicator")||Ti()||!this.grid.isColumnReorderAllowed)return;const d=a.closest(".wg__header:not(.wg__row-number-header):not(.wg__inline-actions-header):not(.wg__actions-column):not(.wg__filler)");if(d){n.preventDefault();const c=d.dataset.field;if(!c)return;const u=this.grid.visualColumns.findIndex(g=>String(g.column.field)===c);if(u===-1)return;Q(),l.ctrlKey||l.metaKey?this.grid.selectColumn(u,"toggle"):l.shiftKey?this.grid.selectColumn(u,"range"):this.grid.selectColumn(u,"replace"),this.render(),requestAnimationFrame(()=>{const g=this.shadow.querySelector(".wg");g==null||g.focus({preventScroll:!0})})}}),o.addEventListener("contextmenu",n=>{this.handleContextMenu(n)}),o.addEventListener("change",n=>{const l=n.target;l.matches(".wg__editor--checkbox")&&ds(this,l)}),o.addEventListener("input",n=>{const l=n.target;l.matches(".wg__combobox-input")?$s(this,n):l.matches(".wg__autocomplete-input")&&Ps(this,n)}),this.focusEventsSubscribed||(this.focusEvents.subscribe("blur",(n,l)=>{this.focusEvents.shouldSkipBlur()||!l||!this.shadow.contains(l)||(n.matches(".wg__editor--text, .wg__editor--number")?gs(this,n):n.matches(".wg__date-input")?this.datepicker||this.commitDateEditor(n):n.matches(".wg__select-trigger")?this.handleSelectBlur(l):n.matches(".wg__combobox-input, .wg__autocomplete-input")&&this.handleComboboxBlur(n))}),this.focusEventsSubscribed=!0);const i=this.shadow.querySelector(".wg"),r=this.grid.tableBorderOnly&&this.shadow.querySelector(".wg__table-container")||i;i&&(i.setAttribute("tabindex","-1"),i.addEventListener("keydown",n=>{const l=this.grid.selectedRows,a=this.grid.selectedColumns,d=!!this.grid.selectedCellRange;if(l.length===0&&a.length===0&&!d||n.target.matches('input, textarea, select, [contenteditable="true"]'))return;if(n.key==="Escape"){n.preventDefault(),this.grid.selectedCellRange?(this.grid.clearCellSelection(),Q()):a.length>0?this.grid.clearColumnSelection():this.grid.clearSelection();return}if((n.ctrlKey||n.metaKey)&&n.key==="c"){n.preventDefault(),d?this.grid.copyCellSelectionToClipboard():a.length>0?this.grid.copySelectedColumnsToClipboard():l.length>0&&this.grid.copySelectedRowsToClipboard();return}const u=this.grid.rangeShortcuts;if(u!=null&&u.length)for(const g of u){const h=wt(g.key);if(pt(n,h)){const f=d?{rows:[],rowIndices:[],cellRange:this.grid.selectedCellRange,cells:this.grid.getSelectedCells()}:{rows:this.grid.getSelectedRowsData(),rowIndices:l};if(!(typeof g.disabled=="function"?g.disabled(f):g.disabled===!0)){n.preventDefault(),g.action(f);return}}}}),this.scrollEvents.init(r),this.scrollEvents.subscribe("container",()=>{const n=r.scrollLeft>0;i.classList.toggle("wg--scrolled-horizontal",n),this.dropdownOpen&&!this.isTransitioningCells&&!this.isOpeningDropdown&&this.handleScrollCloseDropdown(),this.grid.shouldUseVirtualScroll()&&this.handleVirtualScroll(r),this.grid.isInfiniteScrollEnabled&&this.grid.hasMoreItems&&!this.isLoadingMoreItems&&this.handleInfiniteScroll(r),Ye()!==null&&(ni(this,this.grid.displayItems),this.renderConnector()),zt(this),this.grid.selectedCellRange&&Bi(this),_l(this)}),this.scrollEvents.subscribe("window",()=>{this.dropdownOpen&&!this.isTransitioningCells&&this.handleScrollCloseDropdown(),Ye()!==null&&this.closeToolbarAndReset()}),this.clickEventsSubscribed||(this.clickEvents.init(i,this),this.clickEvents.subscribe("outsideClick",()=>{let n=!1;if(this.grid.focusedCell){const{rowIndex:l,colIndex:a}=this.grid.focusedCell,d=this.shadow.querySelector(`.wg__cell[data-row="${l}"][data-col="${a}"]`);d==null||d.classList.remove("wg__cell--focused","wg__cell--always-edit-focused"),this.grid.clearFocusedCell()}if(this.grid.focusedRowIndex!==null&&(this.grid.clearRowFocus(),n=!0),this.dropdownOpen||this.grid.editingCell){const l=this.grid.editingCell,a=l?this.grid.columns.findIndex(d=>String(d.field)===l.field):-1;V(this),j(this),this.grid.cancelEdit(),l&&a>=0&&H(this,l.rowIndex,a)}this.grid.selectedCellRange&&(this.grid.clearCellSelection(),Q(),n=!0),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),n=!0),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),n=!0),n&&this.render()}),this.clickEvents.subscribe("sortClick",n=>{Ti()||(this.grid.selectedCellRange&&(this.grid.clearCellSelection(),Q()),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),ot()),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),it()),Ys(this,n.event,n.field),this.render())}),this.clickEventsSubscribed=!0)),o.addEventListener("mouseenter",n=>{const l=n.target,a=l.closest("[data-tooltip-html]");if(a){const c=a.getAttribute("data-tooltip-html");yo(this,a,c,this._tooltipShowDelay,!0);return}const d=l.closest("[data-tooltip]");if(d){const c=d.getAttribute("data-tooltip");yo(this,d,c,this._tooltipShowDelay,!1)}},!0),o.addEventListener("mouseleave",n=>{const l=n,a=l.target,d=l.relatedTarget,c=a.closest("[data-tooltip], [data-tooltip-html]");c&&(d==null?void 0:d.closest("[data-tooltip], [data-tooltip-html]"))===c||c&&Ot(this,this._tooltipHideDelay)},!0),o.addEventListener("click",n=>{const a=n.target.closest(".wg__toolbar-trigger");if(a&&this.grid.toolbarTrigger==="button"){n.preventDefault(),n.stopPropagation();const d=parseInt(a.dataset.toolbarTrigger||"0",10),c=o.querySelector(`tr[data-row-index="${d}"]`);c&&(ao(d)?this.closeToolbarAndReset():this.showToolbarForRow(c,d))}}),o.addEventListener("click",n=>{if(this.grid.toolbarPosition!=="inline")return;const a=n.target.closest(".wg__inline-action-btn");if(a&&!a.disabled){n.preventDefault(),n.stopPropagation();const d=a.dataset.actionId,c=parseInt(a.dataset.row||"0",10);this.handleInlineActionClick(d,c,n,a)}}),o.addEventListener("mouseenter",n=>{const l=n,d=l.target.closest(".wg__row");if(d){const c=parseInt(d.dataset.rowIndex||"0",10);this.grid.setHoveredRow(c),this.grid.toolbarPosition==="inline"&&this.setupInlineShortcuts(),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline"&&(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),ao(c)||this.showToolbarForRow(d,c,l.clientX))}},!0),o.addEventListener("mouseleave",n=>{if(n.target.closest(".wg__row")&&(this.grid.toolbarPosition==="inline"&&setTimeout(()=>{o.matches(":hover")||(this.grid.setHoveredRow(null),this.removeInlineShortcuts())},50),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline")){if(this.toolbarMoveInProgress)return;this.toolbarHideTimeout&&clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=setTimeout(()=>{const c=this.shadow.querySelector(".wg__toolbar-container"),u=c==null?void 0:c.matches(":hover"),g=o.matches(":hover");!u&&!g&&(this.grid.setHoveredRow(null),this.closeToolbarAndReset())},150)}},!0),o.addEventListener("mousemove",n=>{const l=n,a=l.target,d=a.closest(".wg__row");if(!d)return;const c=parseInt(d.dataset.rowIndex||"0",10);if(!(Ye()!==c||this.grid.toolbarPosition!=="top")){if(this.grid.toolbarFollowsCursor&&!this.grid.cellToolbar&&this.grid.toolbarColumn===void 0){const g=a.closest(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");if(g){const h=g.getBoundingClientRect(),f=lo(h,this.grid.cellToolbarOffset);co(f,d,"start")}else co(l.clientX)}if(this.grid.cellToolbar){const g=a.closest(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");if(g){const h=g.dataset.field||"",f=this.grid.visualColumns.findIndex(p=>String(p.column.field)===h);if(!this.hoveredCell||this.hoveredCell.rowIndex!==c||this.hoveredCell.field!==h){this.hoveredCell={rowIndex:c,colIndex:f,field:h};const p=this.grid.displayItems[c];if(p){const v=this.grid.cellToolbar(p,c,h,f)||this.grid.rowToolbar,y=JSON.stringify(v);y!==this.currentCellToolbarItems&&(this.currentCellToolbarItems=y,this.updateToolbarWithCellItems(c,v));const C=g.getBoundingClientRect(),S=lo(C,this.grid.cellToolbarOffset);co(S,d,"start")}}}}}}),o.addEventListener("click",n=>{if(this.grid.toolbarTrigger!=="click")return;const l=n,a=l.target,d=a.closest(".wg__row");if(d&&!a.closest(".wg__cell--editing")){const c=parseInt(d.dataset.rowIndex||"0",10);ao(c)?this.closeToolbarAndReset():this.showToolbarForRow(d,c,l.clientX)}}),this.toolbarOutsideClickAdded||(this.toolbarOutsideClickAdded=!0,document.addEventListener("click",n=>{if(!ri(this.shadow))return;const l=n.composedPath(),a=l.some(u=>{var g;return(g=u.classList)==null?void 0:g.contains("wg__toolbar-container")}),d=l.some(u=>{var g;return(g=u.classList)==null?void 0:g.contains("wg__toolbar-trigger")});a||d||l.includes(this)&&(this.grid.toolbarTrigger==="hover"||this.grid.toolbarTrigger==="click")||Ye()!==null&&this.closeToolbarAndReset()})),this.shadow.querySelectorAll(".wg__pagination").forEach(n=>{n.addEventListener("click",a=>{Us(this,a)&&this.render()});const l=n.querySelector(".wg__pagination-select");l&&l.addEventListener("change",()=>{Ks(this,l)&&this.render()})})}scrollToRowProgrammatically(o){const i=this.shadow.querySelector(".wg");if(!i)return;const{scrollTop:r,startIndex:s,endIndex:n}=Bs({targetRow:o,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,viewportHeight:i.clientHeight,scrollHeight:i.scrollHeight,clientHeight:i.clientHeight});(s!==this.virtualScrollStart||n!==this.virtualScrollEnd)&&(this.virtualScrollStart=s,this.virtualScrollEnd=n,this.renderVirtualRows(i)),this.isProgrammaticScroll=!0,i.scrollTop=r,queueMicrotask(()=>{this.isProgrammaticScroll=!1})}handleVirtualScroll(o){var s;if(this.isProgrammaticScroll)return;const{startIndex:i,endIndex:r}=Ns({scrollTop:o.scrollTop,viewportHeight:o.clientHeight,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,editingRowIndex:(s=this.grid.editingCell)==null?void 0:s.rowIndex});(i!==this.virtualScrollStart||r!==this.virtualScrollEnd)&&(this.virtualScrollStart=i,this.virtualScrollEnd=r,this.renderVirtualRows(o))}renderVirtualRows(o){const i=o.querySelector("tbody");if(!i)return;const r=this.grid.displayItems,s={startIndex:this.virtualScrollStart,endIndex:this.virtualScrollEnd,rowHeight:this.grid.virtualScrollRowHeight,totalItems:r.length},n=this.grid.focusedCell;if(i.innerHTML=ai(this,s),n){this.grid.setFocusedCell(n.rowIndex,n.colIndex);const l=i.querySelector(`td[data-row="${n.rowIndex}"][data-col="${n.colIndex}"]`);l&&(l.focus({preventScroll:!0}),Z(this,null,n))}}handleInfiniteScroll(o){Ws(o.scrollTop,o.scrollHeight,o.clientHeight,this.grid.infiniteScrollThreshold)&&(this.isLoadingMoreItems=!0,this.grid.fireDataRequest("loadMore"))}renderShortcutsHelpIcon(){var n,l,a;if(!this.grid.isShortcutsHelpVisible||!((n=this.grid.rowShortcuts)!=null&&n.length))return"";const i=this.grid.shortcutsHelpPosition==="top-left"?"wg__shortcuts-help--left":"",r=this.grid.rowShortcuts.map(d=>`<div class="wg__shortcuts-help-item">
|
|
663
|
+
<span class="wg__shortcuts-help-key">${Vs(d.key)}</span>
|
|
664
664
|
<span class="wg__shortcuts-help-label">${d.label}</span>
|
|
665
665
|
</div>`).join(""),s=((a=(l=this.grid).shortcutsHelpContentCallback)==null?void 0:a.call(l))||"";return`
|
|
666
666
|
<div class="wg__shortcuts-help ${i}">
|
|
@@ -679,13 +679,13 @@ toolbarColumn takes priority — cursor following is disabled.`,r)}requestUpdate
|
|
|
679
679
|
</div>
|
|
680
680
|
</div>
|
|
681
681
|
</div>
|
|
682
|
-
`}render(){var
|
|
683
|
-
${
|
|
684
|
-
${
|
|
685
|
-
</div>`:[...new Set([...
|
|
686
|
-
${
|
|
687
|
-
${
|
|
688
|
-
</div>`:
|
|
682
|
+
`}render(){var C;xe.debug("render:",this.grid.displayItems.length,"rows,",this.grid.visualColumns.length,"columns");const o=this.shadow.querySelector(".wg"),i=this.grid.tableBorderOnly&&this.shadow.querySelector(".wg__table-container")||o,r=(i==null?void 0:i.scrollTop)||0,s=(i==null?void 0:i.scrollLeft)||0,n=this.grid.focusedCell;o&&o.remove();const l=document.createElement("div");l.className=es(this),this.grid.isScrollable&&this.grid.scrollMaxHeight!=="100vh"&&l.style.setProperty("--wg-scroll-max-height",this.grid.scrollMaxHeight);const a=this.grid.paginationPosition.split("|").map(S=>S.trim()),d=this.grid.summaryPosition?this.grid.summaryPosition.split("|").map(S=>S.trim()):[],c=(S,_)=>{const x=a.filter(D=>_?D.startsWith("top-"):D.startsWith("bottom-")),k=d.filter(D=>_?D.startsWith("top-"):D.startsWith("bottom-")),I=x.length>0,E=k.length>0;return!I&&!E?"":E&&I&&this.grid.isSummaryInline?`<div class="wg__footer${_?" wg__footer--top":""}">
|
|
683
|
+
${fo(this,k[0])}
|
|
684
|
+
${ho(this,x[0])}
|
|
685
|
+
</div>`:[...new Set([...x,...k])].map(D=>{const L=x.includes(D),M=k.includes(D);return M&&L?`<div class="wg__footer${_?" wg__footer--top":""}">
|
|
686
|
+
${fo(this,D)}
|
|
687
|
+
${ho(this,D)}
|
|
688
|
+
</div>`:M?fo(this,D):ho(this,D)}).join("")},u=c(a,!0),g=c(a,!1),h=this.grid.shouldUseVirtualScroll();let f;if(h){const S=this.grid.displayItems,_=this.grid.virtualScrollRowHeight,x=this.grid.virtualScrollBuffer,k=(o==null?void 0:o.clientHeight)||400,I=Math.max(0,Math.floor(r/_)-x),E=Math.ceil(k/_)+x*2,R=Math.min(S.length,I+E);this.virtualScrollStart=I,this.virtualScrollEnd=R;const D={startIndex:I,endIndex:R,rowHeight:_,totalItems:S.length};f=ai(this,D)}else f=os(this);h&&l.classList.add("wg--virtual-scroll");const w=this.renderShortcutsHelpIcon(),p=`
|
|
689
689
|
<table class="wg__table">
|
|
690
690
|
<thead>
|
|
691
691
|
${ts(this)}
|
|
@@ -699,10 +699,10 @@ toolbarColumn takes priority — cursor following is disabled.`,r)}requestUpdate
|
|
|
699
699
|
${u}
|
|
700
700
|
${m}
|
|
701
701
|
${g}
|
|
702
|
-
`;l.innerHTML=v,this.shadow.appendChild(l);const y=this.grid.tableBorderOnly&&l.querySelector(".wg__table-container")||l;if(h){const
|
|
703
|
-
.wg__autocomplete-input[data-row="${
|
|
704
|
-
.wg__select-trigger[data-row="${
|
|
705
|
-
.wg__date-input[data-row="${
|
|
702
|
+
`;l.innerHTML=v,this.shadow.appendChild(l);const y=this.grid.tableBorderOnly&&l.querySelector(".wg__table-container")||l;if(h){const S=Math.max(0,this.grid.displayItems.length*this.grid.virtualScrollRowHeight-y.clientHeight);y.scrollTop=Math.min(r,S)}else y.scrollTop=r;if(y.scrollLeft=s,this.attachEventListeners(),this.grid.editingCell){const{rowIndex:S,field:_}=this.grid.editingCell;let x=this.shadow.querySelector(`.wg__combobox-input[data-row="${S}"][data-field="${_}"],
|
|
703
|
+
.wg__autocomplete-input[data-row="${S}"][data-field="${_}"],
|
|
704
|
+
.wg__select-trigger[data-row="${S}"][data-field="${_}"],
|
|
705
|
+
.wg__date-input[data-row="${S}"][data-field="${_}"]`);if(x||(x=this.shadow.querySelector(`.wg__editor[data-row="${S}"][data-field="${_}"]`)),x&&(x.focus(),x instanceof HTMLInputElement&&x.type==="text")){const k=this.grid.editingCell.cursorPosition,I=this.getCurrentEditingColumn(),E=((C=I==null?void 0:I.editorOptions)==null?void 0:C.editStartSelection)||this.grid.editStartSelection;if(this.grid.editingCell.initialSearchQuery!==void 0){const R=x.value.length;x.setSelectionRange(R,R)}else switch(E){case"mousePosition":if(k!==void 0){const R=Math.min(k,x.value.length);x.setSelectionRange(R,R)}else x.setSelectionRange(x.value.length,x.value.length);break;case"cursorAtStart":x.setSelectionRange(0,0);break;case"cursorAtEnd":x.setSelectionRange(x.value.length,x.value.length);break;case"selectAll":default:x.select();break}}}else if(n&&!this.grid.editingCell){const S=l.querySelector(`td[data-row="${n.rowIndex}"][data-col="${n.colIndex}"]`);S&&setTimeout(()=>S.focus(),0)}h&&requestAnimationFrame(()=>{l.style.pointerEvents="none",requestAnimationFrame(()=>{l.style.pointerEvents=""})}),this.renderConnector(),zt(this),this.grid.selectedCellRange&&Bi(this),this.grid.selectedRows.length>0?ji(this):ot(),this.grid.selectedColumns.length>0?Xi(this):it()}renderConnector(){const o=this.shadow.querySelector(".wg__connector");o&&o.remove();const i=Jn();if(!i.path||!i.arrowPos)return;const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","wg__connector"),r.setAttribute("style","position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 999;");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",i.path),s.setAttribute("stroke","var(--wg-accent-color, #0078d4)"),s.setAttribute("stroke-width","2"),s.setAttribute("fill","none"),r.appendChild(s);const n=document.createElementNS("http://www.w3.org/2000/svg","polygon"),l=i.arrowDir==="down"?"-4,0 4,0 0,8":i.arrowDir==="up"?"-4,0 4,0 0,-8":i.arrowDir==="left"?"0,-4 -8,0 0,4":"0,-4 8,0 0,4";n.setAttribute("points",l),n.setAttribute("fill","var(--wg-accent-color, #0078d4)"),n.setAttribute("transform",`translate(${i.arrowPos.x}, ${i.arrowPos.y})`),r.appendChild(n),this.shadow.appendChild(r)}clearAllSelections(){this.grid.selectedCellRange&&(this.grid.clearCellSelection_noRender(),Q(),this.shadow.querySelectorAll(".wg__cell--in-range").forEach(i=>i.classList.remove("wg__cell--in-range"))),this.grid.selectedRows.length>0&&(this.grid.clearSelection_noRender(),ot(),this.shadow.querySelectorAll(".wg__row--selected").forEach(i=>i.classList.remove("wg__row--selected"))),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection_noRender(),it(),this.shadow.querySelectorAll(".wg__cell--column-selected").forEach(r=>r.classList.remove("wg__cell--column-selected")),this.shadow.querySelectorAll(".wg__header--selected").forEach(r=>r.classList.remove("wg__header--selected")))}updateRowFocusVisual(o,i){if(o!==i){if(o!==null){const r=this.shadow.querySelector(`tr[data-row-index="${o}"]`);r==null||r.classList.remove("wg__row--focused")}if(i!==null){const r=this.shadow.querySelector(`tr[data-row-index="${i}"]`);r==null||r.classList.add("wg__row--focused")}}}openDatePicker(o,i){console.trace("[LEGACY] openDatePicker"),this.datepicker&&(this.datepicker.close(!0),this.datepicker=null);const r=o.dataset.dateFormat||"YYYY-MM-DD",s=o.dataset.minDate,n=o.dataset.maxDate,l=o.dataset.dateValue||"";this.datepicker=new Tt({dateFormat:r,minDate:s||void 0,maxDate:n||void 0,onSelect:(a,d)=>{this.handleDatePickerSelect(o,a,d)},onClose:()=>{const a=this.grid.editingCell,d=a?this.grid.columns.findIndex(u=>String(u.field)===a.field):-1,c=(a==null?void 0:a.rowIndex)??-1;if(this.datepicker=null,j(this),this.grid.cancelEdit(),c>=0&&d>=0){ns(this,c,d);const u=this.shadow.querySelector(`.wg__cell[data-row="${c}"][data-col="${d}"]`);u&&u.focus()}}}),this.datepicker.open(i,l||null)}handleDatePickerSelect(o,i,r){console.trace("[LEGACY] handleDatePickerSelect");const s=o.dataset.dateFormat||"YYYY-MM-DD",n=Rt(s);o.value=eo(i,n),o.dataset.dateValue=Dt(i),this.datepicker=null,this.isCommittingFromKeyboard=!0;const l=r==="down"||r===void 0;this.commitDateEditor(o,l);const a=parseInt(o.dataset.row||"0",10),d=o.dataset.field||"";this.moveFocusAfterCommit(a,d,r||"down")}async commitDateEditor(o,i=!1){if(console.trace("[LEGACY] commitDateEditor"),!this.grid.editingCell)return;const r=parseInt(o.dataset.row||"0",10),s=o.dataset.field||"",n=o.dataset.outputFormat||"iso",l=o.dataset.dateFormat||"YYYY-MM-DD",a=Rt(l),d=o.value?this.parseDateInput(o.value,a):null;let c=null;if(d)switch(n){case"date":c=d;break;case"timestamp":c=d.getTime();break;case"iso":default:c=Dt(d);break}await this.grid.commitEdit(r,s,c,i)}parseDateInput(o,i){if(!o)return null;const r=o.split(i.separator);let s=null,n=null,l=null;if(r.forEach((d,c)=>{var g,h,f;if(!d)return;const u=parseInt(d,10);((g=i.parts.year)==null?void 0:g.index)===c?s=u<100?u+2e3:u:((h=i.parts.month)==null?void 0:h.index)===c?n=u:((f=i.parts.day)==null?void 0:f.index)===c&&(l=u)}),s===null||n===null||l===null)return null;const a=new Date(s,n-1,l);return a.getMonth()!==n-1||a.getDate()!==l?null:a}showGoToRowDialog(o){const i=this.grid.displayItems;if(i.length===0)return;const r=document.createElement("div");r.className="wg__goto-overlay",r.innerHTML=`
|
|
706
706
|
<div class="wg__goto-dialog">
|
|
707
707
|
<label class="wg__goto-label">Go to row (1-${i.length}):</label>
|
|
708
708
|
<input type="number" class="wg__goto-input" min="1" max="${i.length}" value="1" />
|
|
@@ -711,4 +711,4 @@ toolbarColumn takes priority — cursor following is disabled.`,r)}requestUpdate
|
|
|
711
711
|
<button type="button" class="wg__goto-btn wg__goto-btn--go">Go</button>
|
|
712
712
|
</div>
|
|
713
713
|
</div>
|
|
714
|
-
`;const s=r.querySelector(".wg__goto-input"),n=r.querySelector(".wg__goto-btn--go"),l=r.querySelector(".wg__goto-btn--cancel"),a=()=>{r.remove()},d=()=>{const c=parseInt(s.value,10);if(isNaN(c)||c<1||c>i.length){s.focus(),s.select();return}a();const u=c-1,g=this.grid.focusedCell;if(this.grid.setFocusedCell(u,o),this.grid.shouldUseVirtualScroll())this.scrollToRowProgrammatically(u),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const h=this.shadow.querySelector(`td[data-row="${u}"][data-col="${o}"]`);h==null||h.focus()})});else{const h=this.shadow.querySelector(`td[data-row="${u}"][data-col="${o}"]`);h&&(h.scrollIntoView({block:"nearest",behavior:"auto"}),h.focus(),J(this,g,{rowIndex:u,colIndex:o}))}};n.addEventListener("click",d),l.addEventListener("click",a),r.addEventListener("click",c=>{c.target===r&&a()}),s.addEventListener("keydown",c=>{c.key==="Enter"?(c.preventDefault(),d()):c.key==="Escape"&&(c.preventDefault(),a())}),this.shadow.appendChild(r),s.focus(),s.select()}openCustomEditor(o,i){const r=this.grid.columns[i];if(!r||r.editor!=="custom"||!r.cellEditCallback)return;const s=String(r.field),n=this.grid.displayItems[o];if(!n)return;const a={value:this.grid.getCellRawValue(n,o,s),row:n,rowIndex:o,field:s,commit:d=>{this.grid.commitEdit(o,s,d),K(this),requestAnimationFrame(()=>{V(this,o,i)})},cancel:()=>{K(this),this.grid.cancelEdit(),requestAnimationFrame(()=>{V(this,o,i)})}};r.cellEditCallback(a)}handleContextMenu(o){const i=o.target,r=i.closest(".wg__header");if(r){this.handleHeaderContextMenu(o,r);return}if(i.closest("th.wg__filler")){this.handleFillerContextMenu(o);return}const n=this.grid.contextMenu;if(!n||n.length===0)return;const l=i.closest(".wg__cell");if(!l)return;o.preventDefault(),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null);const a=parseInt(l.dataset.row||"0",10),d=parseInt(l.dataset.col||"0",10),c=this.grid.columns[d];if(!c)return;const u=this.grid.displayItems[a];if(!u)return;const g=String(c.field),h=this.grid.getCellRawValue(u,a,g),f={row:u,rowIndex:a,colIndex:d,column:c,cellValue:h};this.grid.oncontextmenuopen&&this.grid.oncontextmenuopen(f);const w=Object.getOwnPropertyDescriptor(this,"contextMenuXOffset"),p=Object.getOwnPropertyDescriptor(this,"contextMenuYOffset");w&&"value"in w&&(this.grid.contextMenuXOffset=w.value,delete this.contextMenuXOffset),p&&"value"in p&&(this.grid.contextMenuYOffset=p.value,delete this.contextMenuYOffset),this.contextMenuElement=Hs(this,o.clientX,o.clientY,this.grid.contextMenuXOffset,this.grid.contextMenuYOffset,n,f,m=>{const v=n.find(y=>y.id===m);v!=null&&v.onclick&&v.onclick(f),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null)},()=>{this.contextMenuElement=null})}handleHeaderContextMenu(o,i){const r=this.grid.headerContextMenu;if(!r||r.length===0)return;o.preventDefault(),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null);const s=i.dataset.field;if(!s)return;const n=this.grid.columns.findIndex(f=>String(f.field)===s);if(n===-1)return;const l=this.grid.columns[n],a=this.grid.freezeColumns,d=n<a,c=this.grid.sort.find(f=>f.column===s),u=(c==null?void 0:c.direction)??null,g={column:l,field:s,columnIndex:n,sortDirection:u,isFrozen:d,allColumns:this.grid.columns,labels:this.grid.labels};this.grid.onheadercontextmenuopen&&this.grid.onheadercontextmenuopen(g);const h=_i(r,g);h.length!==0&&(this.headerContextMenuElement=xi(this,o.clientX,o.clientY,h,g,(f,w,p)=>{if(["sortAsc","sortDesc","clearSort","hideColumn","freezeColumn","unfreezeColumn"].includes(f)&&Vs(this,f,g,p),f==="show-all-columns"){this.grid.columns.forEach(y=>{y.isHidden=!1}),this.grid.columns=[...this.grid.columns];return}if(f.startsWith("toggle-col-")){const y=f.replace("toggle-col-",""),x=this.grid.columns.find(C=>String(C.field)===y);x&&(x.isHidden=!x.isHidden,this.grid.columns=[...this.grid.columns]);return}const v=h.find(y=>y.id===f);v!=null&&v.onclick&&v.onclick(g),!w&&this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null)},()=>{this.headerContextMenuElement=null}))}handleFillerContextMenu(o){const i=this.grid.headerContextMenu;if(!i||i.length===0)return;o.preventDefault(),this.contextMenuElement&&(ce(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null);const r=i.filter(l=>l==="columnVisibility"?!0:typeof l=="object"&&l.id?!(typeof l.label=="function"||typeof l.icon=="function"):(typeof l=="string"||typeof l=="object"&&l.dividerBefore&&!l.id&&!l.label,!1));if(r.length===0)return;const s={column:null,field:"",columnIndex:-1,sortDirection:null,isFrozen:!1,allColumns:this.grid.columns,labels:this.grid.labels},n=_i(r,s);n.length!==0&&(this.headerContextMenuElement=xi(this,o.clientX,o.clientY,n,s,(l,a,d)=>{if(l==="show-all-columns"){this.grid.columns.forEach(u=>{u.isHidden=!1}),this.grid.columns=[...this.grid.columns];return}if(l.startsWith("toggle-col-")){const u=l.replace("toggle-col-",""),g=this.grid.columns.find(h=>String(h.field)===u);g&&(g.isHidden=!g.isHidden,this.grid.columns=[...this.grid.columns]);return}const c=n.find(u=>u.id===l);c!=null&&c.onclick&&c.onclick(s),!a&&this.headerContextMenuElement&&(ce(this.headerContextMenuElement),this.headerContextMenuElement=null)},()=>{this.headerContextMenuElement=null}))}setupToolbarShortcuts(){this.toolbarShortcutHandler&&document.removeEventListener("keydown",this.toolbarShortcutHandler);const o=this.grid.rowShortcuts;o!=null&&o.length&&(this.toolbarShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const s=We();if(s===null||!oi(this.shadow))return;const n=this.grid.displayItems[s];if(!n)return;const l=this.grid.columns;for(const a of o){const d=wt(a.key);if(pt(i,d)){const c={row:n,rowIndex:s,colIndex:0,column:l[0],cellValue:null};if(!(typeof a.disabled=="function"?a.disabled(c):a.disabled===!0)){i.preventDefault(),i.stopPropagation(),a.action(c);return}}}},document.addEventListener("keydown",this.toolbarShortcutHandler))}setupInlineShortcuts(){this.removeInlineShortcuts();const o=this.grid.rowShortcuts;!(o!=null&&o.length)||this.grid.hoveredRowIndex===null||(this.inlineShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const s=this.grid.hoveredRowIndex;if(s===null)return;const n=this.grid.displayItems[s];if(!n)return;const l=this.grid.columns;for(const a of o){const d=wt(a.key);if(pt(i,d)){const c={row:n,rowIndex:s,colIndex:0,column:l[0],cellValue:null};if(!(typeof a.disabled=="function"?a.disabled(c):a.disabled===!0)){i.preventDefault(),i.stopPropagation(),a.action(c);return}}}},document.addEventListener("keydown",this.inlineShortcutHandler))}removeInlineShortcuts(){this.inlineShortcutHandler&&(document.removeEventListener("keydown",this.inlineShortcutHandler),this.inlineShortcutHandler=null)}setupToolbarTooltips(o,i,r){const s=this.shadow.querySelector(".wg__toolbar-container");if(!s)return;s.querySelectorAll(".wg__toolbar-btn").forEach(l=>{var g;const a=l,d=a.dataset.toolbarItem,c=o.find(h=>h.id===d);if(!c)return;const u=(g=this.grid.rowShortcuts)==null?void 0:g.find(h=>h.id===c.id);a.addEventListener("mouseenter",()=>{const h=c.tooltipCallback?c.tooltipCallback(i,r):Gn(c,u==null?void 0:u.key);vo(this,a,h,0,!0)}),a.addEventListener("mouseleave",()=>{zt(this)})})}showToolbarForRow(o,i,r){if(this.grid.toolbarPosition==="inline"||!this.grid.isRowToolbarVisible||!this.grid.rowToolbar.length)return;const s=Je(this.grid.rowToolbar),n=this.grid.displayItems[i];if(!n)return;if(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),zt(this,0),this.currentCellToolbarItems=null,Qn(this,o,i,s,n,(a,d,c)=>{this.handleToolbarItemClick(a,i,n,d,c)},r),this.setupToolbarShortcuts(),this.renderConnector(),this.setupToolbarTooltips(s,n,i),this.grid.toolbarTrigger==="hover"){const a=this.shadow.querySelector(".wg__toolbar-container");a&&(a.addEventListener("mouseenter",()=>{this.toolbarHovered=!0,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null)}),a.addEventListener("mouseleave",()=>{this.toolbarHovered=!1,!this.toolbarMoveInProgress&&(this.toolbarHideTimeout=setTimeout(()=>{const d=this.shadow.querySelector(".wg__table"),c=d==null?void 0:d.matches(":hover"),u=a.matches(":hover");!c&&!u&&this.closeToolbarAndReset()},150))}))}const l=this.shadow.querySelector(`[data-toolbar-trigger="${i}"]`);l&&(this.shadow.querySelectorAll(".wg__toolbar-trigger--active").forEach(a=>{a.classList.remove("wg__toolbar-trigger--active")}),l.classList.add("wg__toolbar-trigger--active"))}closeToolbarAndReset(){this.toolbarMoveInProgress=!1,this.toolbarHovered=!1,this.hoveredCell=null,this.currentCellToolbarItems=null,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),this.toolbarShortcutHandler&&(document.removeEventListener("keydown",this.toolbarShortcutHandler),this.toolbarShortcutHandler=null),zt(this,0),Tt()}updateToolbarWithCellItems(o,i){const r=this.grid.displayItems[o];if(!r)return;const s=Je(this.grid.rowToolbar),n=Je(i),l=new Map(n.map(f=>[f.id,f])),a=[...n];for(const f of s)l.has(f.id)||a.push(f);a.sort((f,w)=>f.row!==w.row?f.row-w.row:f.group-w.group);const d=this.grid.toolbarVerticalAlign!=="top",c=Zn();if(!c)return;const u=ti(a,r,o,d),g=document.createElement("div");g.innerHTML=u;const h=g.querySelector(".wg__toolbar");if(h){const{left:f,top:w,position:p,visibility:m}=c.toolbar.style;c.toolbar.innerHTML=h.innerHTML,c.toolbar.style.left=f,c.toolbar.style.top=w,c.toolbar.style.position=p,c.toolbar.style.visibility=m,this.setupToolbarTooltips(a,r,o)}}handleScrollCloseDropdown(){const o=this.grid.editingCell,i=o?this.grid.columns.findIndex(r=>String(r.field)===o.field):-1;q(this),K(this),this.grid.cancelEdit(),o&&i>=0&&H(this,o.rowIndex,i)}handleSelectBlur(o){if(this.isOpeningDropdown||o!=null&&o.closest(".wg__dropdown"))return;const i=this.grid.editingCell,r=i?this.grid.columns.findIndex(s=>String(s.field)===i.field):-1;q(this),K(this),this.grid.cancelEdit(),i&&r>=0&&H(this,i.rowIndex,r)}handleComboboxBlur(o){if(q(this),this.grid.editingCell){const i=this.grid.editingCell,r=this.grid.columns.findIndex(n=>String(n.field)===i.field),s=this.getCurrentEditingColumn();if(s){const n=s.editorOptions||{},a=(n.options||n.initialOptions||[]).find(c=>Be(c,n).toLowerCase()===o.value.toLowerCase()),d=a?Ae(a,n):o.value;K(this),this.grid.commitEdit(i.rowIndex,i.field,d),r>=0&&H(this,i.rowIndex,r)}}}handleToolbarItemClick(o,i,r,s,n){var d;(d=this.pipelineAdapter)==null||d.clearSelection();const l=this.grid.displayItems.findIndex(c=>c===r);if(l===-1){this.closeToolbarAndReset();return}const a=o.id==="moveUp"||o.id==="moveDown";if(a&&(this.toolbarMoveInProgress=!0),o.onclick&&o.onclick({row:r,rowIndex:l}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:o,rowIndex:l,row:r,event:s,triggerElement:n}),o.id==="delete"){this.closeToolbarAndReset();return}a?(this.render(),ii(this,this.grid.displayItems),this.renderConnector()):this.render()}handleInlineActionClick(o,i,r,s){var d;if(!o)return;(d=this.pipelineAdapter)==null||d.clearSelection();const l=Je(this.grid.rowToolbar).find(c=>c.id===o),a=this.grid.displayItems[i];!l||!a||(l.onclick&&l.onclick({row:a,rowIndex:i}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:l,rowIndex:i,row:a,event:r,triggerElement:s}))}}typeof customElements<"u"&&!customElements.get("web-grid")&&customElements.define("web-grid",xo),typeof window<"u"&&(window.components=window.components||{},window.components["web-grid"]={version:()=>"1.0.5",config:{name:"@keenmate/web-grid",version:"1.0.5",author:"KeenMate",license:"MIT",repository:"git+https://github.com/KeenMate/web-grid.git",homepage:"https://github.com/KeenMate/web-grid#readme"},logging:{enableLogging:Vn,disableLogging:qn,setLogLevel:Nn,setCategoryLevel:Bn,getCategories:()=>[...Fn]}}),oe.GridElement=xo,oe.WebGrid=ei,oe.default=xo,Object.defineProperties(oe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
714
|
+
`;const s=r.querySelector(".wg__goto-input"),n=r.querySelector(".wg__goto-btn--go"),l=r.querySelector(".wg__goto-btn--cancel"),a=()=>{r.remove()},d=()=>{const c=parseInt(s.value,10);if(isNaN(c)||c<1||c>i.length){s.focus(),s.select();return}a();const u=c-1,g=this.grid.focusedCell;if(this.grid.setFocusedCell(u,o),this.grid.shouldUseVirtualScroll())this.scrollToRowProgrammatically(u),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const h=this.shadow.querySelector(`td[data-row="${u}"][data-col="${o}"]`);h==null||h.focus()})});else{const h=this.shadow.querySelector(`td[data-row="${u}"][data-col="${o}"]`);h&&(h.scrollIntoView({block:"nearest",behavior:"auto"}),h.focus(),Z(this,g,{rowIndex:u,colIndex:o}))}};n.addEventListener("click",d),l.addEventListener("click",a),r.addEventListener("click",c=>{c.target===r&&a()}),s.addEventListener("keydown",c=>{c.key==="Enter"?(c.preventDefault(),d()):c.key==="Escape"&&(c.preventDefault(),a())}),this.shadow.appendChild(r),s.focus(),s.select()}openCustomEditor(o,i){const r=this.grid.columns[i];if(!r||r.editor!=="custom"||!r.cellEditCallback)return;const s=String(r.field),n=this.grid.displayItems[o];if(!n)return;const a={value:this.grid.getCellRawValue(n,o,s),row:n,rowIndex:o,field:s,commit:d=>{this.grid.commitEdit(o,s,d),j(this),requestAnimationFrame(()=>{q(this,o,i)})},cancel:()=>{j(this),this.grid.cancelEdit(),requestAnimationFrame(()=>{q(this,o,i)})}};r.cellEditCallback(a)}handleContextMenu(o){const i=o.target,r=i.closest(".wg__header");if(r){this.handleHeaderContextMenu(o,r);return}if(i.closest("th.wg__filler")){this.handleFillerContextMenu(o);return}const n=this.grid.contextMenu;if(!n||n.length===0)return;const l=i.closest(".wg__cell");if(!l)return;o.preventDefault(),this.contextMenuElement&&(de(this.contextMenuElement),this.contextMenuElement=null);const a=parseInt(l.dataset.row||"0",10),d=parseInt(l.dataset.col||"0",10),c=this.grid.columns[d];if(!c)return;const u=this.grid.displayItems[a];if(!u)return;const g=String(c.field),h=this.grid.getCellRawValue(u,a,g),f={row:u,rowIndex:a,colIndex:d,column:c,cellValue:h};this.grid.oncontextmenuopen&&this.grid.oncontextmenuopen(f);const w=Object.getOwnPropertyDescriptor(this,"contextMenuXOffset"),p=Object.getOwnPropertyDescriptor(this,"contextMenuYOffset");w&&"value"in w&&(this.grid.contextMenuXOffset=w.value,delete this.contextMenuXOffset),p&&"value"in p&&(this.grid.contextMenuYOffset=p.value,delete this.contextMenuYOffset),this.contextMenuElement=Hs(this,o.clientX,o.clientY,this.grid.contextMenuXOffset,this.grid.contextMenuYOffset,n,f,m=>{const v=n.find(y=>y.id===m);v!=null&&v.onclick&&v.onclick(f),this.contextMenuElement&&(de(this.contextMenuElement),this.contextMenuElement=null)},()=>{this.contextMenuElement=null})}handleHeaderContextMenu(o,i){const r=this.grid.headerContextMenu;if(!r||r.length===0)return;o.preventDefault(),this.contextMenuElement&&(de(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(de(this.headerContextMenuElement),this.headerContextMenuElement=null);const s=i.dataset.field;if(!s)return;const n=this.grid.columns.findIndex(f=>String(f.field)===s);if(n===-1)return;const l=this.grid.columns[n],a=this.grid.freezeColumns,d=n<a,c=this.grid.sort.find(f=>f.column===s),u=(c==null?void 0:c.direction)??null,g={column:l,field:s,columnIndex:n,sortDirection:u,isFrozen:d,allColumns:this.grid.columns,labels:this.grid.labels};this.grid.onheadercontextmenuopen&&this.grid.onheadercontextmenuopen(g);const h=yi(r,g);h.length!==0&&(this.headerContextMenuElement=Ei(this,o.clientX,o.clientY,h,g,(f,w,p)=>{if(["sortAsc","sortDesc","clearSort","hideColumn","freezeColumn","unfreezeColumn"].includes(f)&&qs(this,f,g,p),f==="show-all-columns"){this.grid.columns.forEach(y=>{y.isHidden=!1}),this.grid.columns=[...this.grid.columns];return}if(f.startsWith("toggle-col-")){const y=f.replace("toggle-col-",""),C=this.grid.columns.find(S=>String(S.field)===y);C&&(C.isHidden=!C.isHidden,this.grid.columns=[...this.grid.columns]);return}const v=h.find(y=>y.id===f);v!=null&&v.onclick&&v.onclick(g),!w&&this.headerContextMenuElement&&(de(this.headerContextMenuElement),this.headerContextMenuElement=null)},()=>{this.headerContextMenuElement=null}))}handleFillerContextMenu(o){const i=this.grid.headerContextMenu;if(!i||i.length===0)return;o.preventDefault(),this.contextMenuElement&&(de(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(de(this.headerContextMenuElement),this.headerContextMenuElement=null);const r=i.filter(l=>l==="columnVisibility"?!0:typeof l=="object"&&l.id?!(typeof l.label=="function"||typeof l.icon=="function"):(typeof l=="string"||typeof l=="object"&&l.dividerBefore&&!l.id&&!l.label,!1));if(r.length===0)return;const s={column:null,field:"",columnIndex:-1,sortDirection:null,isFrozen:!1,allColumns:this.grid.columns,labels:this.grid.labels},n=yi(r,s);n.length!==0&&(this.headerContextMenuElement=Ei(this,o.clientX,o.clientY,n,s,(l,a,d)=>{if(l==="show-all-columns"){this.grid.columns.forEach(u=>{u.isHidden=!1}),this.grid.columns=[...this.grid.columns];return}if(l.startsWith("toggle-col-")){const u=l.replace("toggle-col-",""),g=this.grid.columns.find(h=>String(h.field)===u);g&&(g.isHidden=!g.isHidden,this.grid.columns=[...this.grid.columns]);return}const c=n.find(u=>u.id===l);c!=null&&c.onclick&&c.onclick(s),!a&&this.headerContextMenuElement&&(de(this.headerContextMenuElement),this.headerContextMenuElement=null)},()=>{this.headerContextMenuElement=null}))}setupToolbarShortcuts(){this.toolbarShortcutHandler&&document.removeEventListener("keydown",this.toolbarShortcutHandler);const o=this.grid.rowShortcuts;o!=null&&o.length&&(this.toolbarShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const s=Ye();if(s===null||!ri(this.shadow))return;const n=this.grid.displayItems[s];if(!n)return;const l=this.grid.columns;for(const a of o){const d=wt(a.key);if(pt(i,d)){const c={row:n,rowIndex:s,colIndex:0,column:l[0],cellValue:null};if(!(typeof a.disabled=="function"?a.disabled(c):a.disabled===!0)){i.preventDefault(),i.stopPropagation(),a.action(c);return}}}},document.addEventListener("keydown",this.toolbarShortcutHandler))}setupInlineShortcuts(){this.removeInlineShortcuts();const o=this.grid.rowShortcuts;!(o!=null&&o.length)||this.grid.hoveredRowIndex===null||(this.inlineShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const s=this.grid.hoveredRowIndex;if(s===null)return;const n=this.grid.displayItems[s];if(!n)return;const l=this.grid.columns;for(const a of o){const d=wt(a.key);if(pt(i,d)){const c={row:n,rowIndex:s,colIndex:0,column:l[0],cellValue:null};if(!(typeof a.disabled=="function"?a.disabled(c):a.disabled===!0)){i.preventDefault(),i.stopPropagation(),a.action(c);return}}}},document.addEventListener("keydown",this.inlineShortcutHandler))}removeInlineShortcuts(){this.inlineShortcutHandler&&(document.removeEventListener("keydown",this.inlineShortcutHandler),this.inlineShortcutHandler=null)}setupToolbarTooltips(o,i,r){const s=this.shadow.querySelector(".wg__toolbar-container");if(!s)return;s.querySelectorAll(".wg__toolbar-btn").forEach(l=>{var g;const a=l,d=a.dataset.toolbarItem,c=o.find(h=>h.id===d);if(!c)return;const u=(g=this.grid.rowShortcuts)==null?void 0:g.find(h=>h.id===c.id);a.addEventListener("mouseenter",()=>{const h=c.tooltipCallback?c.tooltipCallback(i,r):Gn(c,u==null?void 0:u.key);yo(this,a,h,0,!0)}),a.addEventListener("mouseleave",()=>{Ot(this)})})}showToolbarForRow(o,i,r){if(this.grid.toolbarPosition==="inline"||!this.grid.isRowToolbarVisible||!this.grid.rowToolbar.length)return;const s=Ze(this.grid.rowToolbar),n=this.grid.displayItems[i];if(!n)return;if(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),Ot(this,0),this.currentCellToolbarItems=null,Qn(this,o,i,s,n,(a,d,c)=>{this.handleToolbarItemClick(a,i,n,d,c)},r),this.setupToolbarShortcuts(),this.renderConnector(),this.setupToolbarTooltips(s,n,i),this.grid.toolbarTrigger==="hover"){const a=this.shadow.querySelector(".wg__toolbar-container");a&&(a.addEventListener("mouseenter",()=>{this.toolbarHovered=!0,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null)}),a.addEventListener("mouseleave",()=>{this.toolbarHovered=!1,!this.toolbarMoveInProgress&&(this.toolbarHideTimeout=setTimeout(()=>{const d=this.shadow.querySelector(".wg__table"),c=d==null?void 0:d.matches(":hover"),u=a.matches(":hover");!c&&!u&&this.closeToolbarAndReset()},150))}))}const l=this.shadow.querySelector(`[data-toolbar-trigger="${i}"]`);l&&(this.shadow.querySelectorAll(".wg__toolbar-trigger--active").forEach(a=>{a.classList.remove("wg__toolbar-trigger--active")}),l.classList.add("wg__toolbar-trigger--active"))}closeToolbarAndReset(){this.toolbarMoveInProgress=!1,this.toolbarHovered=!1,this.hoveredCell=null,this.currentCellToolbarItems=null,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),this.toolbarShortcutHandler&&(document.removeEventListener("keydown",this.toolbarShortcutHandler),this.toolbarShortcutHandler=null),Ot(this,0),$t()}updateToolbarWithCellItems(o,i){const r=this.grid.displayItems[o];if(!r)return;const s=Ze(this.grid.rowToolbar),n=Ze(i),l=new Map(n.map(f=>[f.id,f])),a=[...n];for(const f of s)l.has(f.id)||a.push(f);a.sort((f,w)=>f.row!==w.row?f.row-w.row:f.group-w.group);const d=this.grid.toolbarVerticalAlign!=="top",c=Zn();if(!c)return;const u=ii(a,r,o,d),g=document.createElement("div");g.innerHTML=u;const h=g.querySelector(".wg__toolbar");if(h){const{left:f,top:w,position:p,visibility:m}=c.toolbar.style;c.toolbar.innerHTML=h.innerHTML,c.toolbar.style.left=f,c.toolbar.style.top=w,c.toolbar.style.position=p,c.toolbar.style.visibility=m,this.setupToolbarTooltips(a,r,o)}}handleScrollCloseDropdown(){const o=this.grid.editingCell,i=o?this.grid.columns.findIndex(r=>String(r.field)===o.field):-1;V(this),j(this),this.grid.cancelEdit(),o&&i>=0&&H(this,o.rowIndex,i)}handleSelectBlur(o){if(this.isOpeningDropdown||o!=null&&o.closest(".wg__dropdown"))return;const i=this.grid.editingCell,r=i?this.grid.columns.findIndex(s=>String(s.field)===i.field):-1;V(this),j(this),this.grid.cancelEdit(),i&&r>=0&&H(this,i.rowIndex,r)}handleComboboxBlur(o){if(V(this),this.grid.editingCell){const i=this.grid.editingCell,r=this.grid.columns.findIndex(n=>String(n.field)===i.field),s=this.getCurrentEditingColumn();if(s){const n=s.editorOptions||{},a=(n.options||n.initialOptions||[]).find(c=>We(c,n).toLowerCase()===o.value.toLowerCase()),d=a?Ae(a,n):o.value;j(this),this.grid.commitEdit(i.rowIndex,i.field,d),r>=0&&H(this,i.rowIndex,r)}}}handleToolbarItemClick(o,i,r,s,n){var d;(d=this.pipelineAdapter)==null||d.clearSelection();const l=this.grid.displayItems.findIndex(c=>c===r);if(l===-1){this.closeToolbarAndReset();return}const a=o.id==="moveUp"||o.id==="moveDown";if(a&&(this.toolbarMoveInProgress=!0),o.onclick&&o.onclick({row:r,rowIndex:l}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:o,rowIndex:l,row:r,event:s,triggerElement:n}),o.id==="delete"){this.closeToolbarAndReset();return}a?(this.render(),ni(this,this.grid.displayItems),this.renderConnector()):this.render()}handleInlineActionClick(o,i,r,s){var d;if(!o)return;(d=this.pipelineAdapter)==null||d.clearSelection();const l=Ze(this.grid.rowToolbar).find(c=>c.id===o),a=this.grid.displayItems[i];!l||!a||(l.onclick&&l.onclick({row:a,rowIndex:i}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:l,rowIndex:i,row:a,event:r,triggerElement:s}))}}typeof customElements<"u"&&!customElements.get("web-grid")&&customElements.define("web-grid",ko),typeof window<"u"&&(window.components=window.components||{},window.components["web-grid"]={version:()=>"1.1.0",config:{name:"@keenmate/web-grid",version:"1.1.0",author:"KeenMate",license:"MIT",repository:"git+https://github.com/KeenMate/web-grid.git",homepage:"https://github.com/KeenMate/web-grid#readme"},logging:{enableLogging:qn,disableLogging:Vn,setLogLevel:Nn,setCategoryLevel:Bn,getCategories:()=>[...Fn]}}),oe.GridElement=ko,oe.WebGrid=oi,oe.default=ko,Object.defineProperties(oe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|