@keenmate/web-grid 1.0.0 → 1.0.1
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 +12 -3
- package/dist/modules/toolbar/index.d.ts +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/web-grid.js +1759 -1741
- package/dist/web-grid.umd.js +77 -77
- package/package.json +1 -1
- package/src/css/_dark-mode.css +44 -7
- package/src/css/_dialogs.css +1 -1
- package/src/css/_variables.css +1 -0
package/dist/web-grid.umd.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
(function(te,Y){typeof exports=="object"&&typeof module<"u"?Y(exports):typeof define=="function"&&define.amd?define(["exports"],Y):(te=typeof globalThis<"u"?globalThis:te||self,Y(te.WebGrid={}))})(this,function(te){"use strict";var Vl=Object.defineProperty;var Nl=(te,Y,G)=>Y in te?Vl(te,Y,{enumerable:!0,configurable:!0,writable:!0,value:G}):te[Y]=G;var b=(te,Y,G)=>Nl(te,typeof Y!="symbol"?Y+"":Y,G);const Y=Math.min,G=Math.max,ct=Math.round,gt=Math.floor,me=e=>({x:e,y:e}),qi={left:"right",right:"left",bottom:"top",top:"bottom"},Vi={start:"end",end:"start"};function Pt(e,t,o){return G(e,Y(t,o))}function Ve(e,t){return typeof e=="function"?e(t):e}function Ie(e){return e.split("-")[0]}function Ne(e){return e.split("-")[1]}function fo(e){return e==="x"?"y":"x"}function zt(e){return e==="y"?"height":"width"}const Ni=new Set(["top","bottom"]);function Ce(e){return Ni.has(Ie(e))?"y":"x"}function Lt(e){return fo(Ce(e))}function Bi(e,t,o){o===void 0&&(o=!1);const i=Ne(e),n=Lt(e),s=zt(n);let r=n==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=ut(r)),[r,ut(r)]}function Wi(e){const t=ut(e);return[Ot(e),t,Ot(t)]}function Ot(e){return e.replace(/start|end/g,t=>Vi[t])}const wo=["left","right"],po=["right","left"],Yi=["top","bottom"],Ui=["bottom","top"];function Ki(e,t,o){switch(e){case"top":case"bottom":return o?t?po:wo:t?wo:po;case"left":case"right":return t?Yi:Ui;default:return[]}}function ji(e,t,o,i){const n=Ne(e);let s=Ki(Ie(e),o==="start",i);return n&&(s=s.map(r=>r+"-"+n),t&&(s=s.concat(s.map(Ot)))),s}function ut(e){return e.replace(/left|right|bottom|top/g,t=>qi[t])}function Xi(e){return{top:0,right:0,bottom:0,left:0,...e}}function mo(e){return typeof e!="number"?Xi(e):{top:e,right:e,bottom:e,left:e}}function ht(e){const{x:t,y:o,width:i,height:n}=e;return{width:i,height:n,top:o,left:t,right:t+i,bottom:o+n,x:t,y:o}}function bo(e,t,o){let{reference:i,floating:n}=e;const s=Ce(t),r=Lt(t),l=zt(r),a=Ie(t),d=s==="y",c=i.x+i.width/2-n.width/2,u=i.y+i.height/2-n.height/2,g=i[l]/2-n[l]/2;let h;switch(a){case"top":h={x:c,y:i.y-n.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-n.width,y:u};break;default:h={x:i.x,y:i.y}}switch(Ne(t)){case"start":h[r]-=g*(o&&d?-1:1);break;case"end":h[r]+=g*(o&&d?-1:1);break}return h}const Gi=async(e,t,o)=>{const{placement:i="bottom",strategy:n="absolute",middleware:s=[],platform:r}=o,l=s.filter(Boolean),a=await(r.isRTL==null?void 0:r.isRTL(t));let d=await r.getElementRects({reference:e,floating:t,strategy:n}),{x:c,y:u}=bo(d,i,a),g=i,h={},f=0;for(let w=0;w<l.length;w++){const{name:p,fn:m}=l[w],{x:y,y:v,data:x,reset:C}=await m({x:c,y:u,initialPlacement:i,placement:g,strategy:n,middlewareData:h,rects:d,platform:r,elements:{reference:e,floating:t}});c=y??c,u=v??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 r.getElementRects({reference:e,floating:t,strategy:n}):C.rects),{x:c,y:u}=bo(d,g,a)),w=-1)}return{x:c,y:u,placement:g,strategy:n,middlewareData:h}};async function Ht(e,t){var o;t===void 0&&(t={});const{x:i,y:n,platform:s,rects:r,elements:l,strategy:a}=e,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:u="floating",altBoundary:g=!1,padding:h=0}=Ve(t,e),f=mo(h),p=l[g?u==="floating"?"reference":"floating":u],m=ht(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})),y=u==="floating"?{x:i,y:n,width:r.floating.width,height:r.floating.height}:r.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),x=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},C=ht(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:v,strategy:a}):y);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 Qi=e=>({name:"arrow",options:e,async fn(t){const{x:o,y:i,placement:n,rects:s,platform:r,elements:l,middlewareData:a}=t,{element:d,padding:c=0}=Ve(e,t)||{};if(d==null)return{};const u=mo(c),g={x:o,y:i},h=Lt(n),f=zt(h),w=await r.getDimensions(d),p=h==="y",m=p?"top":"left",y=p?"bottom":"right",v=p?"clientHeight":"clientWidth",x=s.reference[f]+s.reference[h]-g[h]-s.floating[f],C=g[h]-s.reference[h],_=await(r.getOffsetParent==null?void 0:r.getOffsetParent(d));let S=_?_[v]:0;(!S||!await(r.isElement==null?void 0:r.isElement(_)))&&(S=l.floating[v]||s.floating[f]);const E=x/2-C/2,I=S/2-w[f]/2-1,k=Y(u[m],I),R=Y(u[y],I),M=k,z=S-w[f]-R,D=S/2-w[f]/2+E,L=Pt(M,D,z),K=!a.arrow&&Ne(n)!=null&&D!==L&&s.reference[f]/2-(D<M?k:R)-w[f]/2<0,T=K?D<M?D-M:D-z:0;return{[h]:g[h]+T,data:{[h]:L,centerOffset:D-L-T,...K&&{alignmentOffset:T}},reset:K}}}),Ji=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,i;const{placement:n,middlewareData:s,rects:r,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}=Ve(e,t);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const m=Ie(n),y=Ce(l),v=Ie(l)===l,x=await(a.isRTL==null?void 0:a.isRTL(d.floating)),C=g||(v||!w?[ut(l)]:Wi(l)),_=f!=="none";!g&&_&&C.push(...ji(l,w,f,x));const S=[l,...C],E=await Ht(t,p),I=[];let k=((i=s.flip)==null?void 0:i.overflows)||[];if(c&&I.push(E[m]),u){const D=Bi(n,r,x);I.push(E[D[0]],E[D[1]])}if(k=[...k,{placement:n,overflows:I}],!I.every(D=>D<=0)){var R,M;const D=(((R=s.flip)==null?void 0:R.index)||0)+1,L=S[D];if(L&&(!(u==="alignment"?y!==Ce(L):!1)||k.every(A=>Ce(A.placement)===y?A.overflows[0]>0:!0)))return{data:{index:D,overflows:k},reset:{placement:L}};let K=(M=k.filter(T=>T.overflows[0]<=0).sort((T,A)=>T.overflows[1]-A.overflows[1])[0])==null?void 0:M.placement;if(!K)switch(h){case"bestFit":{var z;const T=(z=k.filter(A=>{if(_){const B=Ce(A.placement);return B===y||B==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(B=>B>0).reduce((B,N)=>B+N,0)]).sort((A,B)=>A[1]-B[1])[0])==null?void 0:z[0];T&&(K=T);break}case"initialPlacement":K=l;break}if(n!==K)return{reset:{placement:K}}}return{}}}},Zi=new Set(["left","top"]);async function en(e,t){const{placement:o,platform:i,elements:n}=e,s=await(i.isRTL==null?void 0:i.isRTL(n.floating)),r=Ie(o),l=Ne(o),a=Ce(o)==="y",d=Zi.has(r)?-1:1,c=s&&a?-1:1,u=Ve(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 tn=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,i;const{x:n,y:s,placement:r,middlewareData:l}=t,a=await en(t,e);return r===((o=l.offset)==null?void 0:o.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:n+a.x,y:s+a.y,data:{...a,placement:r}}}}},on=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:i,placement:n}=t,{mainAxis:s=!0,crossAxis:r=!1,limiter:l={fn:p=>{let{x:m,y}=p;return{x:m,y}}},...a}=Ve(e,t),d={x:o,y:i},c=await Ht(t,a),u=Ce(Ie(n)),g=fo(u);let h=d[g],f=d[u];if(s){const p=g==="y"?"top":"left",m=g==="y"?"bottom":"right",y=h+c[p],v=h-c[m];h=Pt(y,h,v)}if(r){const p=u==="y"?"top":"left",m=u==="y"?"bottom":"right",y=f+c[p],v=f-c[m];f=Pt(y,f,v)}const w=l.fn({...t,[g]:h,[u]:f});return{...w,data:{x:w.x-o,y:w.y-i,enabled:{[g]:s,[u]:r}}}}}},nn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var o,i;const{placement:n,rects:s,platform:r,elements:l}=t,{apply:a=()=>{},...d}=Ve(e,t),c=await Ht(t,d),u=Ie(n),g=Ne(n),h=Ce(n)==="y",{width:f,height:w}=s.floating;let p,m;u==="top"||u==="bottom"?(p=u,m=g===(await(r.isRTL==null?void 0:r.isRTL(l.floating))?"start":"end")?"left":"right"):(m=u,p=g==="end"?"top":"bottom");const y=w-c.top-c.bottom,v=f-c.left-c.right,x=Y(w-c[p],y),C=Y(f-c[m],v),_=!t.middlewareData.shift;let S=x,E=C;if((o=t.middlewareData.shift)!=null&&o.enabled.x&&(E=v),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(S=y),_&&!g){const k=G(c.left,0),R=G(c.right,0),M=G(c.top,0),z=G(c.bottom,0);h?E=f-2*(k!==0||R!==0?k+R:G(c.left,c.right)):S=w-2*(M!==0||z!==0?M+z:G(c.top,c.bottom))}await a({...t,availableWidth:E,availableHeight:S});const I=await r.getDimensions(l.floating);return f!==I.width||w!==I.height?{reset:{rects:!0}}:{}}}};function ft(){return typeof window<"u"}function Be(e){return _o(e)?(e.nodeName||"").toLowerCase():"#document"}function ie(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function be(e){var t;return(t=(_o(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function _o(e){return ft()?e instanceof Node||e instanceof ie(e).Node:!1}function ce(e){return ft()?e instanceof Element||e instanceof ie(e).Element:!1}function _e(e){return ft()?e instanceof HTMLElement||e instanceof ie(e).HTMLElement:!1}function vo(e){return!ft()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ie(e).ShadowRoot}const rn=new Set(["inline","contents"]);function Ze(e){const{overflow:t,overflowX:o,overflowY:i,display:n}=ge(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+o)&&!rn.has(n)}const sn=new Set(["table","td","th"]);function ln(e){return sn.has(Be(e))}const an=[":popover-open",":modal"];function wt(e){return an.some(t=>{try{return e.matches(t)}catch{return!1}})}const dn=["transform","translate","scale","rotate","perspective"],cn=["transform","translate","scale","rotate","perspective","filter"],gn=["paint","layout","strict","content"];function Ft(e){const t=qt(),o=ce(e)?ge(e):e;return dn.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)||cn.some(i=>(o.willChange||"").includes(i))||gn.some(i=>(o.contain||"").includes(i))}function un(e){let t=De(e);for(;_e(t)&&!We(t);){if(Ft(t))return t;if(wt(t))return null;t=De(t)}return null}function qt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const hn=new Set(["html","body","#document"]);function We(e){return hn.has(Be(e))}function ge(e){return ie(e).getComputedStyle(e)}function pt(e){return ce(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function De(e){if(Be(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vo(e)&&e.host||be(e);return vo(t)?t.host:t}function yo(e){const t=De(e);return We(t)?e.ownerDocument?e.ownerDocument.body:e.body:_e(t)&&Ze(t)?t:yo(t)}function et(e,t,o){var i;t===void 0&&(t=[]),o===void 0&&(o=!0);const n=yo(e),s=n===((i=e.ownerDocument)==null?void 0:i.body),r=ie(n);if(s){const l=Vt(r);return t.concat(r,r.visualViewport||[],Ze(n)?n:[],l&&o?et(l):[])}return t.concat(n,et(n,[],o))}function Vt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Co(e){const t=ge(e);let o=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const n=_e(e),s=n?e.offsetWidth:o,r=n?e.offsetHeight:i,l=ct(o)!==s||ct(i)!==r;return l&&(o=s,i=r),{width:o,height:i,$:l}}function Nt(e){return ce(e)?e:e.contextElement}function Ye(e){const t=Nt(e);if(!_e(t))return me(1);const o=t.getBoundingClientRect(),{width:i,height:n,$:s}=Co(t);let r=(s?ct(o.width):o.width)/i,l=(s?ct(o.height):o.height)/n;return(!r||!Number.isFinite(r))&&(r=1),(!l||!Number.isFinite(l))&&(l=1),{x:r,y:l}}const fn=me(0);function So(e){const t=ie(e);return!qt()||!t.visualViewport?fn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function wn(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==ie(e)?!1:t}function Oe(e,t,o,i){t===void 0&&(t=!1),o===void 0&&(o=!1);const n=e.getBoundingClientRect(),s=Nt(e);let r=me(1);t&&(i?ce(i)&&(r=Ye(i)):r=Ye(e));const l=wn(s,o,i)?So(s):me(0);let a=(n.left+l.x)/r.x,d=(n.top+l.y)/r.y,c=n.width/r.x,u=n.height/r.y;if(s){const g=ie(s),h=i&&ce(i)?ie(i):i;let f=g,w=Vt(f);for(;w&&i&&h!==f;){const p=Ye(w),m=w.getBoundingClientRect(),y=ge(w),v=m.left+(w.clientLeft+parseFloat(y.paddingLeft))*p.x,x=m.top+(w.clientTop+parseFloat(y.paddingTop))*p.y;a*=p.x,d*=p.y,c*=p.x,u*=p.y,a+=v,d+=x,f=ie(w),w=Vt(f)}}return ht({width:c,height:u,x:a,y:d})}function mt(e,t){const o=pt(e).scrollLeft;return t?t.left+o:Oe(be(e)).left+o}function xo(e,t){const o=e.getBoundingClientRect(),i=o.left+t.scrollLeft-mt(e,o),n=o.top+t.scrollTop;return{x:i,y:n}}function pn(e){let{elements:t,rect:o,offsetParent:i,strategy:n}=e;const s=n==="fixed",r=be(i),l=t?wt(t.floating):!1;if(i===r||l&&s)return o;let a={scrollLeft:0,scrollTop:0},d=me(1);const c=me(0),u=_e(i);if((u||!u&&!s)&&((Be(i)!=="body"||Ze(r))&&(a=pt(i)),_e(i))){const h=Oe(i);d=Ye(i),c.x=h.x+i.clientLeft,c.y=h.y+i.clientTop}const g=r&&!u&&!s?xo(r,a):me(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 mn(e){return Array.from(e.getClientRects())}function bn(e){const t=be(e),o=pt(e),i=e.ownerDocument.body,n=G(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=G(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let r=-o.scrollLeft+mt(e);const l=-o.scrollTop;return ge(i).direction==="rtl"&&(r+=G(t.clientWidth,i.clientWidth)-n),{width:n,height:s,x:r,y:l}}const ko=25;function _n(e,t){const o=ie(e),i=be(e),n=o.visualViewport;let s=i.clientWidth,r=i.clientHeight,l=0,a=0;if(n){s=n.width,r=n.height;const c=qt();(!c||c&&t==="fixed")&&(l=n.offsetLeft,a=n.offsetTop)}const d=mt(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<=ko&&(s-=f)}else d<=ko&&(s+=d);return{width:s,height:r,x:l,y:a}}const vn=new Set(["absolute","fixed"]);function yn(e,t){const o=Oe(e,!0,t==="fixed"),i=o.top+e.clientTop,n=o.left+e.clientLeft,s=_e(e)?Ye(e):me(1),r=e.clientWidth*s.x,l=e.clientHeight*s.y,a=n*s.x,d=i*s.y;return{width:r,height:l,x:a,y:d}}function Eo(e,t,o){let i;if(t==="viewport")i=_n(e,o);else if(t==="document")i=bn(be(e));else if(ce(t))i=yn(t,o);else{const n=So(e);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ht(i)}function Ro(e,t){const o=De(e);return o===t||!ce(o)||We(o)?!1:ge(o).position==="fixed"||Ro(o,t)}function Cn(e,t){const o=t.get(e);if(o)return o;let i=et(e,[],!1).filter(l=>ce(l)&&Be(l)!=="body"),n=null;const s=ge(e).position==="fixed";let r=s?De(e):e;for(;ce(r)&&!We(r);){const l=ge(r),a=Ft(r);!a&&l.position==="fixed"&&(n=null),(s?!a&&!n:!a&&l.position==="static"&&!!n&&vn.has(n.position)||Ze(r)&&!a&&Ro(e,r))?i=i.filter(c=>c!==r):n=l,r=De(r)}return t.set(e,i),i}function Sn(e){let{element:t,boundary:o,rootBoundary:i,strategy:n}=e;const r=[...o==="clippingAncestors"?wt(t)?[]:Cn(t,this._c):[].concat(o),i],l=r[0],a=r.reduce((d,c)=>{const u=Eo(t,c,n);return d.top=G(u.top,d.top),d.right=Y(u.right,d.right),d.bottom=Y(u.bottom,d.bottom),d.left=G(u.left,d.left),d},Eo(t,l,n));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function xn(e){const{width:t,height:o}=Co(e);return{width:t,height:o}}function kn(e,t,o){const i=_e(t),n=be(t),s=o==="fixed",r=Oe(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const a=me(0);function d(){a.x=mt(n)}if(i||!i&&!s)if((Be(t)!=="body"||Ze(n))&&(l=pt(t)),i){const h=Oe(t,!0,s,t);a.x=h.x+t.clientLeft,a.y=h.y+t.clientTop}else n&&d();s&&!i&&n&&d();const c=n&&!i&&!s?xo(n,l):me(0),u=r.left+l.scrollLeft-a.x-c.x,g=r.top+l.scrollTop-a.y-c.y;return{x:u,y:g,width:r.width,height:r.height}}function Bt(e){return ge(e).position==="static"}function Io(e,t){if(!_e(e)||ge(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return be(e)===o&&(o=o.ownerDocument.body),o}function Do(e,t){const o=ie(e);if(wt(e))return o;if(!_e(e)){let n=De(e);for(;n&&!We(n);){if(ce(n)&&!Bt(n))return n;n=De(n)}return o}let i=Io(e,t);for(;i&&ln(i)&&Bt(i);)i=Io(i,t);return i&&We(i)&&Bt(i)&&!Ft(i)?o:i||un(e)||o}const En=async function(e){const t=this.getOffsetParent||Do,o=this.getDimensions,i=await o(e.floating);return{reference:kn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Rn(e){return ge(e).direction==="rtl"}const In={convertOffsetParentRelativeRectToViewportRelativeRect:pn,getDocumentElement:be,getClippingRect:Sn,getOffsetParent:Do,getElementRects:En,getClientRects:mn,getDimensions:xn,getScale:Ye,isElement:ce,isRTL:Rn};function To(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Dn(e,t){let o=null,i;const n=be(e);function s(){var l;clearTimeout(i),(l=o)==null||l.disconnect(),o=null}function r(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=gt(u),w=gt(n.clientWidth-(c+g)),p=gt(n.clientHeight-(u+h)),m=gt(c),v={rootMargin:-f+"px "+-w+"px "+-p+"px "+-m+"px",threshold:G(0,Y(1,a))||1};let x=!0;function C(_){const S=_[0].intersectionRatio;if(S!==a){if(!x)return r();S?r(!1,S):i=setTimeout(()=>{r(!1,1e-7)},1e3)}S===1&&!To(d,e.getBoundingClientRect())&&r(),x=!1}try{o=new IntersectionObserver(C,{...v,root:n.ownerDocument})}catch{o=new IntersectionObserver(C,v)}o.observe(e)}return r(!0),s}function Tn(e,t,o,i){i===void 0&&(i={});const{ancestorScroll:n=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=i,d=Nt(e),c=n||s?[...d?et(d):[],...et(t)]:[];c.forEach(m=>{n&&m.addEventListener("scroll",o,{passive:!0}),s&&m.addEventListener("resize",o)});const u=d&&l?Dn(d,o):null;let g=-1,h=null;r&&(h=new ResizeObserver(m=>{let[y]=m;y&&y.target===d&&h&&(h.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var v;(v=h)==null||v.observe(t)})),o()}),d&&!a&&h.observe(d),h.observe(t));let f,w=a?Oe(e):null;a&&p();function p(){const m=Oe(e);w&&!To(w,m)&&o(),w=m,f=requestAnimationFrame(p)}return o(),()=>{var m;c.forEach(y=>{n&&y.removeEventListener("scroll",o),s&&y.removeEventListener("resize",o)}),u==null||u(),(m=h)==null||m.disconnect(),h=null,a&&cancelAnimationFrame(f)}}const Wt=tn,bt=on,Ue=Ji,Mn=nn,$n=Qi,Ke=(e,t,o)=>{const i=new Map,n={platform:In,...o},s={...n.platform,_c:i};return Gi(e,t,{...n,platform:s})},Mo={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 _t(e){const t={};let o="";return e.includes("-")?o="-":e.includes("/")?o="/":e.includes(".")&&(o="."),e.split(o).forEach((n,s)=>{n==="YYYY"||n==="YY"?t.year={index:s,length:n.length}:n==="MM"||n==="M"?t.month={index:s,length:2}:(n==="DD"||n==="D")&&(t.day={index:s,length:2})}),{format:e,separator:o,parts:t,maxLength:e.length}}function Yt(e,t){if(!e||isNaN(e.getTime()))return"";const o=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0"),{separator:s,parts:r}=t,l=[];for(let a=0;a<3;a++)r.year&&r.year.index===a?l.push(r.year.length===2?String(o).slice(-2):o):r.month&&r.month.index===a?l.push(i):r.day&&r.day.index===a&&l.push(n);return l.join(s)}function An(e,t){if(!e)return null;const{separator:o,parts:i}=t,n=e.split(o);let s=null,r=null,l=null;if(n.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&&(r=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||r===null||l===null)return null;const a=new Date(s,r-1,l);return a.getMonth()!==r-1||a.getDate()!==l?null:a}function ne(e){if(!e)return null;let t;if(typeof e=="string"){const[o,i,n]=e.split("-").map(Number);!o||!i||!n?t=new Date(e):t=new Date(o,i-1,n)}else t=new Date(e);return t.setHours(0,0,0,0),isNaN(t.getTime())?null:t}function vt(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 tt(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Pn(e){return tt(e,new Date)}function je(e,t){return new Date(e,t+1,0).getDate()}function zn(e,t){return new Date(e,t,1).getDay()}function Ln(e,t){if(!e)return{min:t-10,max:t+10};if(e.includes("-")){const[i,n]=e.split("-");return{min:parseInt(i,10),max:parseInt(n,10)}}const o=parseInt(e,10);return{min:o,max:o}}function On(e,t,o=Mo){const i=Hn(e,o),n=Fn(e,t,o),s=qn(e,t,o),r=t.showTodayButton!==!1?Bn(o):"";return`
|
|
1
|
+
(function(te,Y){typeof exports=="object"&&typeof module<"u"?Y(exports):typeof define=="function"&&define.amd?define(["exports"],Y):(te=typeof globalThis<"u"?globalThis:te||self,Y(te.WebGrid={}))})(this,function(te){"use strict";var Vl=Object.defineProperty;var Nl=(te,Y,G)=>Y in te?Vl(te,Y,{enumerable:!0,configurable:!0,writable:!0,value:G}):te[Y]=G;var b=(te,Y,G)=>Nl(te,typeof Y!="symbol"?Y+"":Y,G);const Y=Math.min,G=Math.max,ct=Math.round,gt=Math.floor,be=e=>({x:e,y:e}),Vi={left:"right",right:"left",bottom:"top",top:"bottom"},Ni={start:"end",end:"start"};function Pt(e,t,o){return G(e,Y(t,o))}function Ve(e,t){return typeof e=="function"?e(t):e}function De(e){return e.split("-")[0]}function Ne(e){return e.split("-")[1]}function fo(e){return e==="x"?"y":"x"}function zt(e){return e==="y"?"height":"width"}const Bi=new Set(["top","bottom"]);function Ce(e){return Bi.has(De(e))?"y":"x"}function Lt(e){return fo(Ce(e))}function Wi(e,t,o){o===void 0&&(o=!1);const i=Ne(e),r=Lt(e),s=zt(r);let n=r==="x"?i===(o?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(n=ut(n)),[n,ut(n)]}function Yi(e){const t=ut(e);return[Ot(e),t,Ot(t)]}function Ot(e){return e.replace(/start|end/g,t=>Ni[t])}const wo=["left","right"],po=["right","left"],Ui=["top","bottom"],Ki=["bottom","top"];function ji(e,t,o){switch(e){case"top":case"bottom":return o?t?po:wo:t?wo:po;case"left":case"right":return t?Ui:Ki;default:return[]}}function Xi(e,t,o,i){const r=Ne(e);let s=ji(De(e),o==="start",i);return r&&(s=s.map(n=>n+"-"+r),t&&(s=s.concat(s.map(Ot)))),s}function ut(e){return e.replace(/left|right|bottom|top/g,t=>Vi[t])}function Gi(e){return{top:0,right:0,bottom:0,left:0,...e}}function mo(e){return typeof e!="number"?Gi(e):{top:e,right:e,bottom:e,left:e}}function ht(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 bo(e,t,o){let{reference:i,floating:r}=e;const s=Ce(t),n=Lt(t),l=zt(n),a=De(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(Ne(t)){case"start":h[n]-=g*(o&&d?-1:1);break;case"end":h[n]+=g*(o&&d?-1:1);break}return h}const Qi=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}=bo(d,i,a),g=i,h={},f=0;for(let w=0;w<l.length;w++){const{name:p,fn:m}=l[w],{x:y,y:v,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=y??c,u=v??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}=bo(d,g,a)),w=-1)}return{x:c,y:u,placement:g,strategy:r,middlewareData:h}};async function Ht(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}=Ve(t,e),f=mo(h),p=l[g?u==="floating"?"reference":"floating":u],m=ht(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})),y=u==="floating"?{x:i,y:r,width:n.floating.width,height:n.floating.height}:n.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),x=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},C=ht(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:v,strategy:a}):y);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 Ji=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}=Ve(e,t)||{};if(d==null)return{};const u=mo(c),g={x:o,y:i},h=Lt(r),f=zt(h),w=await n.getDimensions(d),p=h==="y",m=p?"top":"left",y=p?"bottom":"right",v=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=_?_[v]:0;(!S||!await(n.isElement==null?void 0:n.isElement(_)))&&(S=l.floating[v]||s.floating[f]);const E=x/2-C/2,I=S/2-w[f]/2-1,k=Y(u[m],I),R=Y(u[y],I),M=k,z=S-w[f]-R,D=S/2-w[f]/2+E,L=Pt(M,D,z),K=!a.arrow&&Ne(r)!=null&&D!==L&&s.reference[f]/2-(D<M?k:R)-w[f]/2<0,T=K?D<M?D-M:D-z:0;return{[h]:g[h]+T,data:{[h]:L,centerOffset:D-L-T,...K&&{alignmentOffset:T}},reset:K}}}),Zi=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}=Ve(e,t);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const m=De(r),y=Ce(l),v=De(l)===l,x=await(a.isRTL==null?void 0:a.isRTL(d.floating)),C=g||(v||!w?[ut(l)]:Yi(l)),_=f!=="none";!g&&_&&C.push(...Xi(l,w,f,x));const S=[l,...C],E=await Ht(t,p),I=[];let k=((i=s.flip)==null?void 0:i.overflows)||[];if(c&&I.push(E[m]),u){const D=Wi(r,n,x);I.push(E[D[0]],E[D[1]])}if(k=[...k,{placement:r,overflows:I}],!I.every(D=>D<=0)){var R,M;const D=(((R=s.flip)==null?void 0:R.index)||0)+1,L=S[D];if(L&&(!(u==="alignment"?y!==Ce(L):!1)||k.every(A=>Ce(A.placement)===y?A.overflows[0]>0:!0)))return{data:{index:D,overflows:k},reset:{placement:L}};let K=(M=k.filter(T=>T.overflows[0]<=0).sort((T,A)=>T.overflows[1]-A.overflows[1])[0])==null?void 0:M.placement;if(!K)switch(h){case"bestFit":{var z;const T=(z=k.filter(A=>{if(_){const B=Ce(A.placement);return B===y||B==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(B=>B>0).reduce((B,N)=>B+N,0)]).sort((A,B)=>A[1]-B[1])[0])==null?void 0:z[0];T&&(K=T);break}case"initialPlacement":K=l;break}if(r!==K)return{reset:{placement:K}}}return{}}}},er=new Set(["left","top"]);async function tr(e,t){const{placement:o,platform:i,elements:r}=e,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),n=De(o),l=Ne(o),a=Ce(o)==="y",d=er.has(n)?-1:1,c=s&&a?-1:1,u=Ve(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 or=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 tr(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}}}}},ir=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}=p;return{x:m,y}}},...a}=Ve(e,t),d={x:o,y:i},c=await Ht(t,a),u=Ce(De(r)),g=fo(u);let h=d[g],f=d[u];if(s){const p=g==="y"?"top":"left",m=g==="y"?"bottom":"right",y=h+c[p],v=h-c[m];h=Pt(y,h,v)}if(n){const p=u==="y"?"top":"left",m=u==="y"?"bottom":"right",y=f+c[p],v=f-c[m];f=Pt(y,f,v)}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}}}}}},rr=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}=Ve(e,t),c=await Ht(t,d),u=De(r),g=Ne(r),h=Ce(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 y=w-c.top-c.bottom,v=f-c.left-c.right,x=Y(w-c[p],y),C=Y(f-c[m],v),_=!t.middlewareData.shift;let S=x,E=C;if((o=t.middlewareData.shift)!=null&&o.enabled.x&&(E=v),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(S=y),_&&!g){const k=G(c.left,0),R=G(c.right,0),M=G(c.top,0),z=G(c.bottom,0);h?E=f-2*(k!==0||R!==0?k+R:G(c.left,c.right)):S=w-2*(M!==0||z!==0?M+z:G(c.top,c.bottom))}await a({...t,availableWidth:E,availableHeight:S});const I=await n.getDimensions(l.floating);return f!==I.width||w!==I.height?{reset:{rects:!0}}:{}}}};function ft(){return typeof window<"u"}function Be(e){return _o(e)?(e.nodeName||"").toLowerCase():"#document"}function ie(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function _e(e){var t;return(t=(_o(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function _o(e){return ft()?e instanceof Node||e instanceof ie(e).Node:!1}function ce(e){return ft()?e instanceof Element||e instanceof ie(e).Element:!1}function ve(e){return ft()?e instanceof HTMLElement||e instanceof ie(e).HTMLElement:!1}function vo(e){return!ft()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ie(e).ShadowRoot}const nr=new Set(["inline","contents"]);function Ze(e){const{overflow:t,overflowX:o,overflowY:i,display:r}=ge(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+o)&&!nr.has(r)}const sr=new Set(["table","td","th"]);function lr(e){return sr.has(Be(e))}const ar=[":popover-open",":modal"];function wt(e){return ar.some(t=>{try{return e.matches(t)}catch{return!1}})}const dr=["transform","translate","scale","rotate","perspective"],cr=["transform","translate","scale","rotate","perspective","filter"],gr=["paint","layout","strict","content"];function Ft(e){const t=qt(),o=ce(e)?ge(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)||cr.some(i=>(o.willChange||"").includes(i))||gr.some(i=>(o.contain||"").includes(i))}function ur(e){let t=Te(e);for(;ve(t)&&!We(t);){if(Ft(t))return t;if(wt(t))return null;t=Te(t)}return null}function qt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const hr=new Set(["html","body","#document"]);function We(e){return hr.has(Be(e))}function ge(e){return ie(e).getComputedStyle(e)}function pt(e){return ce(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Te(e){if(Be(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vo(e)&&e.host||_e(e);return vo(t)?t.host:t}function yo(e){const t=Te(e);return We(t)?e.ownerDocument?e.ownerDocument.body:e.body:ve(t)&&Ze(t)?t:yo(t)}function et(e,t,o){var i;t===void 0&&(t=[]),o===void 0&&(o=!0);const r=yo(e),s=r===((i=e.ownerDocument)==null?void 0:i.body),n=ie(r);if(s){const l=Vt(n);return t.concat(n,n.visualViewport||[],Ze(r)?r:[],l&&o?et(l):[])}return t.concat(r,et(r,[],o))}function Vt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Co(e){const t=ge(e);let o=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const r=ve(e),s=r?e.offsetWidth:o,n=r?e.offsetHeight:i,l=ct(o)!==s||ct(i)!==n;return l&&(o=s,i=n),{width:o,height:i,$:l}}function Nt(e){return ce(e)?e:e.contextElement}function Ye(e){const t=Nt(e);if(!ve(t))return be(1);const o=t.getBoundingClientRect(),{width:i,height:r,$:s}=Co(t);let n=(s?ct(o.width):o.width)/i,l=(s?ct(o.height):o.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!l||!Number.isFinite(l))&&(l=1),{x:n,y:l}}const fr=be(0);function So(e){const t=ie(e);return!qt()||!t.visualViewport?fr:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function wr(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==ie(e)?!1:t}function Oe(e,t,o,i){t===void 0&&(t=!1),o===void 0&&(o=!1);const r=e.getBoundingClientRect(),s=Nt(e);let n=be(1);t&&(i?ce(i)&&(n=Ye(i)):n=Ye(e));const l=wr(s,o,i)?So(s):be(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=ie(s),h=i&&ce(i)?ie(i):i;let f=g,w=Vt(f);for(;w&&i&&h!==f;){const p=Ye(w),m=w.getBoundingClientRect(),y=ge(w),v=m.left+(w.clientLeft+parseFloat(y.paddingLeft))*p.x,x=m.top+(w.clientTop+parseFloat(y.paddingTop))*p.y;a*=p.x,d*=p.y,c*=p.x,u*=p.y,a+=v,d+=x,f=ie(w),w=Vt(f)}}return ht({width:c,height:u,x:a,y:d})}function mt(e,t){const o=pt(e).scrollLeft;return t?t.left+o:Oe(_e(e)).left+o}function xo(e,t){const o=e.getBoundingClientRect(),i=o.left+t.scrollLeft-mt(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=_e(i),l=t?wt(t.floating):!1;if(i===n||l&&s)return o;let a={scrollLeft:0,scrollTop:0},d=be(1);const c=be(0),u=ve(i);if((u||!u&&!s)&&((Be(i)!=="body"||Ze(n))&&(a=pt(i)),ve(i))){const h=Oe(i);d=Ye(i),c.x=h.x+i.clientLeft,c.y=h.y+i.clientTop}const g=n&&!u&&!s?xo(n,a):be(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 mr(e){return Array.from(e.getClientRects())}function br(e){const t=_e(e),o=pt(e),i=e.ownerDocument.body,r=G(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=G(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let n=-o.scrollLeft+mt(e);const l=-o.scrollTop;return ge(i).direction==="rtl"&&(n+=G(t.clientWidth,i.clientWidth)-r),{width:r,height:s,x:n,y:l}}const ko=25;function _r(e,t){const o=ie(e),i=_e(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=qt();(!c||c&&t==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}const d=mt(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<=ko&&(s-=f)}else d<=ko&&(s+=d);return{width:s,height:n,x:l,y:a}}const vr=new Set(["absolute","fixed"]);function yr(e,t){const o=Oe(e,!0,t==="fixed"),i=o.top+e.clientTop,r=o.left+e.clientLeft,s=ve(e)?Ye(e):be(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 Eo(e,t,o){let i;if(t==="viewport")i=_r(e,o);else if(t==="document")i=br(_e(e));else if(ce(t))i=yr(t,o);else{const r=So(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return ht(i)}function Ro(e,t){const o=Te(e);return o===t||!ce(o)||We(o)?!1:ge(o).position==="fixed"||Ro(o,t)}function Cr(e,t){const o=t.get(e);if(o)return o;let i=et(e,[],!1).filter(l=>ce(l)&&Be(l)!=="body"),r=null;const s=ge(e).position==="fixed";let n=s?Te(e):e;for(;ce(n)&&!We(n);){const l=ge(n),a=Ft(n);!a&&l.position==="fixed"&&(r=null),(s?!a&&!r:!a&&l.position==="static"&&!!r&&vr.has(r.position)||Ze(n)&&!a&&Ro(e,n))?i=i.filter(c=>c!==n):r=l,n=Te(n)}return t.set(e,i),i}function Sr(e){let{element:t,boundary:o,rootBoundary:i,strategy:r}=e;const n=[...o==="clippingAncestors"?wt(t)?[]:Cr(t,this._c):[].concat(o),i],l=n[0],a=n.reduce((d,c)=>{const u=Eo(t,c,r);return d.top=G(u.top,d.top),d.right=Y(u.right,d.right),d.bottom=Y(u.bottom,d.bottom),d.left=G(u.left,d.left),d},Eo(t,l,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function xr(e){const{width:t,height:o}=Co(e);return{width:t,height:o}}function kr(e,t,o){const i=ve(t),r=_e(t),s=o==="fixed",n=Oe(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const a=be(0);function d(){a.x=mt(r)}if(i||!i&&!s)if((Be(t)!=="body"||Ze(r))&&(l=pt(t)),i){const h=Oe(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?xo(r,l):be(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 Bt(e){return ge(e).position==="static"}function Io(e,t){if(!ve(e)||ge(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return _e(e)===o&&(o=o.ownerDocument.body),o}function Do(e,t){const o=ie(e);if(wt(e))return o;if(!ve(e)){let r=Te(e);for(;r&&!We(r);){if(ce(r)&&!Bt(r))return r;r=Te(r)}return o}let i=Io(e,t);for(;i&&lr(i)&&Bt(i);)i=Io(i,t);return i&&We(i)&&Bt(i)&&!Ft(i)?o:i||ur(e)||o}const Er=async function(e){const t=this.getOffsetParent||Do,o=this.getDimensions,i=await o(e.floating);return{reference:kr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Rr(e){return ge(e).direction==="rtl"}const Ir={convertOffsetParentRelativeRectToViewportRelativeRect:pr,getDocumentElement:_e,getClippingRect:Sr,getOffsetParent:Do,getElementRects:Er,getClientRects:mr,getDimensions:xr,getScale:Ye,isElement:ce,isRTL:Rr};function To(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Dr(e,t){let o=null,i;const r=_e(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=gt(u),w=gt(r.clientWidth-(c+g)),p=gt(r.clientHeight-(u+h)),m=gt(c),v={rootMargin:-f+"px "+-w+"px "+-p+"px "+-m+"px",threshold:G(0,Y(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&&!To(d,e.getBoundingClientRect())&&n(),x=!1}try{o=new IntersectionObserver(C,{...v,root:r.ownerDocument})}catch{o=new IntersectionObserver(C,v)}o.observe(e)}return n(!0),s}function Tr(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=Nt(e),c=r||s?[...d?et(d):[],...et(t)]:[];c.forEach(m=>{r&&m.addEventListener("scroll",o,{passive:!0}),s&&m.addEventListener("resize",o)});const u=d&&l?Dr(d,o):null;let g=-1,h=null;n&&(h=new ResizeObserver(m=>{let[y]=m;y&&y.target===d&&h&&(h.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var v;(v=h)==null||v.observe(t)})),o()}),d&&!a&&h.observe(d),h.observe(t));let f,w=a?Oe(e):null;a&&p();function p(){const m=Oe(e);w&&!To(w,m)&&o(),w=m,f=requestAnimationFrame(p)}return o(),()=>{var m;c.forEach(y=>{r&&y.removeEventListener("scroll",o),s&&y.removeEventListener("resize",o)}),u==null||u(),(m=h)==null||m.disconnect(),h=null,a&&cancelAnimationFrame(f)}}const Wt=or,bt=ir,Ue=Zi,Mr=rr,$r=Ji,Ke=(e,t,o)=>{const i=new Map,r={platform:Ir,...o},s={...r.platform,_c:i};return Qi(e,t,{...r,platform:s})},Mo={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 _t(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 Yt(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 Ar(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 re(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 vt(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 tt(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Pr(e){return tt(e,new Date)}function je(e,t){return new Date(e,t+1,0).getDate()}function zr(e,t){return new Date(e,t,1).getDay()}function Lr(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 Or(e,t,o=Mo){const i=Hr(e,o),r=Fr(e,t,o),s=qr(e,t,o),n=t.showTodayButton!==!1?Br(o):"";return`
|
|
2
2
|
<div class="wg-datepicker">
|
|
3
3
|
<div class="wg-datepicker__header">
|
|
4
4
|
${i}
|
|
5
5
|
</div>
|
|
6
6
|
<div class="wg-datepicker__rolling-selector${e.rollingSelectorOpen?" wg-datepicker__rolling-selector--visible":""}">
|
|
7
|
-
${
|
|
7
|
+
${r}
|
|
8
8
|
</div>
|
|
9
9
|
<div class="wg-datepicker__calendar${e.rollingSelectorOpen?" wg-datepicker__calendar--hidden":""}">
|
|
10
10
|
${s}
|
|
11
11
|
</div>
|
|
12
|
-
${
|
|
12
|
+
${n}
|
|
13
13
|
</div>
|
|
14
|
-
`}function
|
|
14
|
+
`}function Hr(e,t){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>
|
|
@@ -21,29 +21,29 @@
|
|
|
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 Fr(e,t,o){const i=Lr(t.rollingYearRange,new Date().getFullYear());let r="";for(let n=i.min;n<=i.max;n++){const l=n===e.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===e.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}
|
|
28
28
|
</div>
|
|
29
29
|
<div class="wg-datepicker__rolling-list" data-list="years">
|
|
30
|
-
${
|
|
30
|
+
${r}
|
|
31
31
|
</div>
|
|
32
32
|
</div>
|
|
33
|
-
`}function
|
|
33
|
+
`}function qr(e,t,o){const i=Vr(o),r=$o(e,t);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 Vr(e){return e.weekdayNamesShort.map(t=>`<div class="wg-datepicker__weekday">${t}</div>`).join("")}function $o(e,t){const{viewYear:o,viewMonth:i,selectedDate:r,focusedDate:s}=e,n=t.minDate?re(t.minDate):null,l=t.maxDate?re(t.maxDate):null,a=zr(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 C=a-1;C>=0;C--){const _=c-C;m.push({date:new Date(g,h,_),day:_,isOtherMonth:!0})}for(let C=1;C<=d;C++)m.push({date:new Date(o,i,C),day:C,isOtherMonth:!1});const v=Math.ceil((a+d)/7)*7-m.length;for(let C=1;C<=v;C++)m.push({date:new Date(w,p,C),day:C,isOtherMonth:!0});let x="";for(const C of m){const _=["wg-datepicker__day"];C.isOtherMonth&&_.push("wg-datepicker__day--other-month"),Nr(C.date,n,l)&&_.push("wg-datepicker__day--disabled"),Pr(C.date)&&_.push("wg-datepicker__day--today"),tt(C.date,r)&&_.push("wg-datepicker__day--selected"),tt(C.date,s)&&_.push("wg-datepicker__day--focused");const E=vt(C.date);x+=`<div class="${_.join(" ")}" data-date="${E}">${C.day}</div>`}return x}function Nr(e,t,o){return!!(t&&e<t||o&&e>o)}function Br(e){return`
|
|
41
41
|
<div class="wg-datepicker__footer">
|
|
42
42
|
<button type="button" class="wg-datepicker__today-btn" data-action="today">
|
|
43
43
|
${e.today}
|
|
44
44
|
</button>
|
|
45
45
|
</div>
|
|
46
|
-
`}function
|
|
46
|
+
`}function Wr(e,t,o){const i=e.querySelector(".wg-datepicker__days");i&&(i.innerHTML=$o(t,o))}function Yr(e,t,o){const i=e.querySelector(".wg-datepicker__month-year");if(i){const r=o.monthNames[t.viewMonth];i.textContent=`${r} ${t.viewYear}`}}function Ur(e,t){const o=e.querySelector(".wg-datepicker__rolling-selector"),i=e.querySelector(".wg-datepicker__calendar");o&&o.classList.toggle("wg-datepicker__rolling-selector--visible",t),i&&i.classList.toggle("wg-datepicker__calendar--hidden",t)}function Kr(e,t){e.querySelectorAll("[data-year]").forEach(r=>{const s=parseInt(r.dataset.year||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",s===t.viewYear)}),e.querySelectorAll("[data-month]").forEach(r=>{const s=parseInt(r.dataset.month||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",s===t.viewMonth)})}function Ao(e){const t=e.querySelector("[data-year].wg-datepicker__rolling-item--selected"),o=e.querySelector("[data-month].wg-datepicker__rolling-item--selected");if(t){const i=t.parentElement;if(i){const r=t.offsetTop-i.clientHeight/2+t.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 Ut(e){e.viewMonth===0?(e.viewMonth=11,e.viewYear--):e.viewMonth--}function Kt(e){e.viewMonth===11?(e.viewMonth=0,e.viewYear++):e.viewMonth++}function jr(e,t,o,i){var s,n,l,a;const{key:r}=e;if(r==="Escape")return(s=i.onClose)==null||s.call(i),!0;if(t.rollingSelectorOpen)return Gr(e,t);if((r==="ArrowLeft"||r==="ArrowRight")&&(e.ctrlKey||e.metaKey)){if(e.preventDefault(),r==="ArrowLeft"?Ut(t):Kt(t),t.focusedDate){const d=Math.min(t.focusedDate.getDate(),je(t.viewYear,t.viewMonth));t.focusedDate=new Date(t.viewYear,t.viewMonth,d)}return!0}if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(r))return e.preventDefault(),Xr(t,r,o),!0;if(r==="Enter")return e.preventDefault(),e.stopPropagation(),t.focusedDate&&((n=i.onSelect)==null||n.call(i,t.focusedDate,"down")),!0;if(r==="Tab")return e.preventDefault(),t.focusedDate?(l=i.onSelect)==null||l.call(i,t.focusedDate,"next"):(a=i.onClose)==null||a.call(i),!0;if(r==="Home"){if(e.preventDefault(),e.ctrlKey||e.metaKey){let d=t.viewYear;const c=new Date(d,0,1);if(t.focusedDate&&tt(t.focusedDate,c)&&d--,o.minDate){const u=re(o.minDate);u&&d<u.getFullYear()&&(d=u.getFullYear())}t.viewMonth=0,t.viewYear=d,t.focusedDate=new Date(d,0,1)}else t.focusedDate=new Date(t.viewYear,t.viewMonth,1);return!0}if(r==="End"){if(e.preventDefault(),e.ctrlKey||e.metaKey){let d=t.viewYear;const c=new Date(d,11,31);if(t.focusedDate&&tt(t.focusedDate,c)&&d++,o.maxDate){const u=re(o.maxDate);u&&d>u.getFullYear()&&(d=u.getFullYear())}t.viewMonth=11,t.viewYear=d,t.focusedDate=new Date(d,11,31)}else{const d=je(t.viewYear,t.viewMonth);t.focusedDate=new Date(t.viewYear,t.viewMonth,d)}return!0}if(r==="PageUp"){if(e.preventDefault(),Ut(t),t.focusedDate){const d=Math.min(t.focusedDate.getDate(),je(t.viewYear,t.viewMonth));t.focusedDate=new Date(t.viewYear,t.viewMonth,d)}return!0}if(r==="PageDown"){if(e.preventDefault(),Kt(t),t.focusedDate){const d=Math.min(t.focusedDate.getDate(),je(t.viewYear,t.viewMonth));t.focusedDate=new Date(t.viewYear,t.viewMonth,d)}return!0}return!1}function Xr(e,t,o){if(!e.focusedDate){e.focusedDate=e.selectedDate?new Date(e.selectedDate):new Date(e.viewYear,e.viewMonth,1);return}const i=new Date(e.focusedDate),r=o.minDate?re(o.minDate):null,s=o.maxDate?re(o.maxDate):null;switch(t){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||(e.focusedDate=i,(i.getMonth()!==e.viewMonth||i.getFullYear()!==e.viewYear)&&(e.viewMonth=i.getMonth(),e.viewYear=i.getFullYear()))}function Gr(e,t){const{key:o}=e;if(o==="ArrowUp"||o==="ArrowDown"){e.preventDefault();const i=o==="ArrowUp"?-1:1;if(t.rollingSelectorMode==="month"){const r=t.viewMonth+i;r>=0&&r<=11&&(t.viewMonth=r)}else t.viewYear+=i;return!0}return o==="ArrowLeft"||o==="ArrowRight"?(e.preventDefault(),t.rollingSelectorMode=t.rollingSelectorMode==="month"?"year":"month",!0):o==="Enter"||o==="Escape"?(e.preventDefault(),t.rollingSelectorOpen=!1,!0):!1}function Qr(e){if(e.selectedDate)e.focusedDate=new Date(e.selectedDate),e.viewYear=e.selectedDate.getFullYear(),e.viewMonth=e.selectedDate.getMonth();else{const t=new Date;e.focusedDate=new Date(e.viewYear,e.viewMonth,t.getDate())}}function Jr(e,t,o){const i=e.dataset.date;if(!i||e.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?re(o.minDate):null,d=o.maxDate?re(o.maxDate):null;return a&&l<a||d&&l>d?null:(t.selectedDate=l,t.focusedDate=l,l)}function Zr(e,t){const o=new Date;o.setHours(0,0,0,0);const i=t.minDate?re(t.minDate):null,r=t.maxDate?re(t.maxDate):null;return i&&o<i||r&&o>r?null:(e.selectedDate=o,e.focusedDate=o,e.viewYear=o.getFullYear(),e.viewMonth=o.getMonth(),o)}function en(e,t){const o=e.dataset.month;o!==void 0&&(t.viewMonth=parseInt(o,10))}function tn(e,t){const o=e.dataset.year;o!==void 0&&(t.viewYear=parseInt(o,10))}function jt(e,t){var u,g,h,f;const{separator:o,parts:i,maxLength:r}=t,s=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=e.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 on(e,t,o){const i=e.value,r=e.selectionStart||0,s=i.length<o.length,{separator:n}=t,l=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=i.replace(new RegExp(`[^0-9${l}]`,"g"),""),d=jt(a,t);if(d!==i){e.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}e.setSelectionRange(c,c)}return d}function rn(e,t){const{key:o,ctrlKey:i,metaKey:r}=e,{separator:s}=t;if(["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(o)||i||r)return!1;if(o===s){const l=e.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)){e.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?(e.preventDefault(),!0):!1}function nn(e,t,o){var h;e.preventDefault();const i=((h=e.clipboardData)==null?void 0:h.getData("text"))||"",{separator:r}=o,s=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=i.replace(new RegExp(`[^0-9${s}]`,"g"),""),l=jt(n,o),a=t.selectionStart||0,d=t.selectionEnd||0,c=t.value,u=c.substring(0,a)+l+c.substring(d);t.value=jt(u,o);const g=a+l.length;t.setSelectionRange(g,g)}function sn(e,t,o,i){if(!e||e.length<t.maxLength)return!1;const r=Ar(e,t);if(!r)return!1;const s=i.minDate?re(i.minDate):null,n=i.maxDate?re(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 ln=`
|
|
47
47
|
.wg-datepicker-container {
|
|
48
48
|
position: fixed;
|
|
49
49
|
z-index: var(--wg-dp-z-index, 9999);
|
|
@@ -293,49 +293,49 @@
|
|
|
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 Po=!1;class yt{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=_t(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"}),n=new Intl.DateTimeFormat(o,{month:"short"}),s=new Intl.DateTimeFormat(o,{weekday:"long"}),r=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(n.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=r.format(g);c.push(h.substring(0,2))}return{today:"Today",clear:"Clear",monthNames:l,monthNamesShort:a,weekdayNames:d,weekdayNamesShort:c}}catch{return Mo}}static injectStyles(){if(Po)return;const t=document.createElement("style");t.id="wg-datepicker-styles",t.textContent=sr,document.head.appendChild(t),Po=!0}open(t,o=null){yt.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 n=new Date;this.state.viewYear=n.getFullYear(),this.state.viewMonth=n.getMonth()}Qn(this.state),this.element=document.createElement("div"),this.element.className="wg-datepicker-container",this.element.innerHTML=On(this.state,this.options,this.localeStrings),document.body.appendChild(this.element),this.position(),this.attachListeners(),this.state.isOpen=!0,this.state.rollingSelectorOpen&&Ao(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 Yt(this.state.selectedDate,this.formatInfo)}position(){if(!this.element||!this.anchor)return;const t=this.element.querySelector(".wg-datepicker");t&&(this.cleanupAutoUpdate=Tn(this.anchor,t,()=>{if(!this.anchor.isConnected){this.close(!0);return}Ke(this.anchor,t,{placement:"bottom-start",middleware:[Wt(4),Ue({fallbackPlacements:["top-start","bottom-end","top-end"]}),bt({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(),Ut(this.state),this.render();return}if(i==="next-month"){t.preventDefault(),Kt(this.state),this.render();return}if(i==="toggle-rolling"){t.preventDefault(),this.state.rollingSelectorOpen=!this.state.rollingSelectorOpen,this.render(),this.state.rollingSelectorOpen&&this.element&&Ao(this.element);return}if(i==="today"){t.preventDefault();const a=Zn(this.state,this.options);a&&this.selectDate(a);return}const n=o.closest(".wg-datepicker__day");if(n){t.preventDefault();const a=Jn(n,this.state,this.options);a&&this.selectDate(a);return}const s=o.closest("[data-month]");if(s&&this.state.rollingSelectorOpen){t.preventDefault(),er(s,this.state),this.render();return}const r=o.closest("[data-year]");if(r&&this.state.rollingSelectorOpen){t.preventDefault(),tr(r,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){jn(t,this.state,this.options,{onSelect:(i,n)=>this.selectDate(i,n),onClose:()=>this.close()})&&this.render()}selectDate(t,o){var i,n;this.state.selectedDate=t,(n=(i=this.options).onSelect)==null||n.call(i,t,o),this.close(!0)}render(){if(!this.element)return;const t=this.element.querySelector(".wg-datepicker");t&&(Yn(t,this.state,this.localeStrings),Un(t,this.state.rollingSelectorOpen),this.state.rollingSelectorOpen?Kn(t,this.state):Wn(t,this.state,this.options))}connectInput(t){this.input=t,this.previousInputValue=t.value,t.addEventListener("input",()=>{this.previousInputValue=or(t,this.formatInfo,this.previousInputValue),rr(t.value,this.formatInfo,this.state,this.options)}),t.addEventListener("keydown",o=>{ir(o,this.formatInfo)}),t.addEventListener("paste",o=>{nr(o,t,this.formatInfo)}),t.addEventListener("focus",()=>{!this.state.isOpen&&this.anchor&&this.open(this.anchor,t.value)})}}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 Lo{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,"_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){this._items=t,this.requestUpdate()}get columns(){return this._columns}set columns(t){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 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,r)=>{if(s.isHidden)return;const l={column:s,originalIndex:r};s.isFrozen?t.push(l):o.push(l)});const i=[],n=[];return o.forEach((s,r)=>{r<this._freezeColumns?i.push(s):n.push(s)}),this._columnOrder.size>0&&n.sort((s,r)=>{const l=String(s.column.field),a=String(r.column.field),d=this._columnOrder.get(l)??s.originalIndex,c=this._columnOrder.get(a)??r.originalIndex;return d-c}),[...t,...i,...n]}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){this._sort=t,this.requestUpdate()}get currentPage(){return this._currentPage}set currentPage(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(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),n=Math.max(this._lastSelectedRowIndex,t);for(let s=i;s<=n;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),n=Math.max(t,o);for(let s=i;s<=n;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 n=[];for(const s of this.visualColumns){const r=s.column.title??s.column.field??"";n.push(String(r))}o.push(n.join(" "))}for(const n of t){const s=this.displayItems[n];if(!s)continue;const r=[];for(const l of this.visualColumns){const a=String(l.column.field),d=s[a],c=d==null?"":String(d);r.push(c)}o.push(r.join(" "))}const i=o.join(`
|
|
297
|
-
`);try{return await navigator.clipboard.writeText(i),!0}catch{return!1}}async copySelectedColumnsToClipboard(){const t=this.selectedColumns;if(t.length===0)return!1;const o=[];if(this._shouldCopyWithHeaders){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(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],
|
|
299
|
-
`);try{return await navigator.clipboard.writeText(c),!0}catch{return!1}}get isNavigateMode(){return this._editTrigger==="navigate"||this._columns.some(t=>t.editTrigger==="navigate")}get filteredItems(){return!this._isFilterable||Object.keys(this._filters).length===0?this._items:this._items.filter(t=>Object.entries(this._filters).every(([o,i])=>i?String(t[o]??"").toLowerCase().includes(i.toLowerCase()):!0))}get sortedItems(){return this._sort.length===0?this.filteredItems:[...this.filteredItems].sort((t,o)=>{for(const i of this._sort){const
|
|
296
|
+
`;let Po=!1;class yt{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=_t(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 Mo}}static injectStyles(){if(Po)return;const t=document.createElement("style");t.id="wg-datepicker-styles",t.textContent=ln,document.head.appendChild(t),Po=!0}open(t,o=null){yt.injectStyles(),this.state.isOpen&&this.close(),this.anchor=t;const i=re(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()}Qr(this.state),this.element=document.createElement("div"),this.element.className="wg-datepicker-container",this.element.innerHTML=Or(this.state,this.options,this.localeStrings),document.body.appendChild(this.element),this.position(),this.attachListeners(),this.state.isOpen=!0,this.state.rollingSelectorOpen&&Ao(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 Yt(this.state.selectedDate,this.formatInfo)}position(){if(!this.element||!this.anchor)return;const t=this.element.querySelector(".wg-datepicker");t&&(this.cleanupAutoUpdate=Tr(this.anchor,t,()=>{if(!this.anchor.isConnected){this.close(!0);return}Ke(this.anchor,t,{placement:"bottom-start",middleware:[Wt(4),Ue({fallbackPlacements:["top-start","bottom-end","top-end"]}),bt({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(),Ut(this.state),this.render();return}if(i==="next-month"){t.preventDefault(),Kt(this.state),this.render();return}if(i==="toggle-rolling"){t.preventDefault(),this.state.rollingSelectorOpen=!this.state.rollingSelectorOpen,this.render(),this.state.rollingSelectorOpen&&this.element&&Ao(this.element);return}if(i==="today"){t.preventDefault();const a=Zr(this.state,this.options);a&&this.selectDate(a);return}const r=o.closest(".wg-datepicker__day");if(r){t.preventDefault();const a=Jr(r,this.state,this.options);a&&this.selectDate(a);return}const s=o.closest("[data-month]");if(s&&this.state.rollingSelectorOpen){t.preventDefault(),en(s,this.state),this.render();return}const n=o.closest("[data-year]");if(n&&this.state.rollingSelectorOpen){t.preventDefault(),tn(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){jr(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&&(Yr(t,this.state,this.localeStrings),Ur(t,this.state.rollingSelectorOpen),this.state.rollingSelectorOpen?Kr(t,this.state):Wr(t,this.state,this.options))}connectInput(t){this.input=t,this.previousInputValue=t.value,t.addEventListener("input",()=>{this.previousInputValue=on(t,this.formatInfo,this.previousInputValue),sn(t.value,this.formatInfo,this.state,this.options)}),t.addEventListener("keydown",o=>{rn(o,this.formatInfo)}),t.addEventListener("paste",o=>{nn(o,t,this.formatInfo)}),t.addEventListener("focus",()=>{!this.state.isOpen&&this.anchor&&this.open(this.anchor,t.value)})}}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 Lo{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,"_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){this._items=t,this.requestUpdate()}get columns(){return this._columns}set columns(t){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 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){this._sort=t,this.requestUpdate()}get currentPage(){return this._currentPage}set currentPage(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(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 t=this.selectedColumns;if(t.length===0)return!1;const o=[];if(this._shouldCopyWithHeaders){const r=[];for(const s of t){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 t){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(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(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 y=String(m.field),v=f[y],x=v==null?"":String(v);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(t=>t.editTrigger==="navigate")}get filteredItems(){return!this._isFilterable||Object.keys(this._filters).length===0?this._items:this._items.filter(t=>Object.entries(this._filters).every(([o,i])=>i?String(t[o]??"").toLowerCase().includes(i.toLowerCase()):!0))}get sortedItems(){return this._sort.length===0?this.filteredItems:[...this.filteredItems].sort((t,o)=>{for(const i of this._sort){const r=t[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(){if(!this._isPageable)return this.sortedItems;if(this._paginationMode==="server")return this.sortedItems;const t=(this._currentPage-1)*this._pageSize,o=t+this._pageSize;return this.sortedItems.slice(t,o)}get totalPages(){const t=this._totalItems!==null?this._totalItems:this.sortedItems.length;return Math.max(1,Math.ceil(t/this._pageSize))}get displayItems(){const t=this.paginatedItems;if(!this._isNewRowEnabled)return t;const o=this.getEmptyRow();return this._newRowPosition==="top"?[o,...t]:[...t,o]}getEmptyRow(){if(this._emptyRowDraft)return this._emptyRowDraft;const t=this.createNewEmptyRow();return this._emptyRowDraft=t,t}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 t={};for(const o of this._columns)t[String(o.field)]=null;return t}isEmptyRowIndex(t){return this._isNewRowEnabled?this._newRowPosition==="top"?t===0:t===this.paginatedItems.length:!1}getDataIndexFromDisplayIndex(t){return this._isNewRowEnabled&&this._newRowPosition==="top"?t-1:t}emptyRowHasData(t){for(const o of this._columns){const i=t[String(o.field)];if(i!=null&&i!=="")return!0}return!1}fireDataRequest(t){if(this._ondatarequest){const o=t==="loadMore"?this._items.length:(this._currentPage-1)*this._pageSize,i={sort:[...this._sort],page:this._currentPage,pageSize:this._pageSize,trigger:t,mode:t==="loadMore"?"append":"replace",skip:o};this._ondatarequest(i)}}getColumnSortState(t){return this._sort.find(o=>o.column===t)}getColumnSortPriority(t){const o=this._sort.findIndex(i=>i.column===t);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 t=this._toolbarPosition,o=t==="top"||t==="inline",i=t==="top",
|
|
302
|
-
verticalAlign only applies to side positions: "left", "right", or "auto".`,
|
|
303
|
-
horizontalAlign only applies to toolbarPosition="top".`,
|
|
304
|
-
toolbarColumn only applies to toolbarPosition="top".`,
|
|
305
|
-
toolbarFollowsCursor only applies to toolbarPosition="top".`,
|
|
306
|
-
cellToolbar requires toolbarPosition="top".`,
|
|
307
|
-
toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate(){}getRowDraft(t){return this._draftRows.get(t)}hasRowDraft(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 n=this.displayItems[t];if(!n)return;const s=n[o];i[o]=s;const r=Object.keys(i);let l=!1;for(const a of r){const d=i[a],c=n[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 n=this._draftRows.get(o);if(n)return n[i]}return t[i]}getCellValue(t,o,i){var s;if(o.templateCallback)return o.templateCallback(t);const n=i!==void 0?this.getCellRawValue(t,i,String(o.field)):t[String(o.field)];if(o.formatCallback)return o.formatCallback(n,t);if(o.editor==="date"&&((s=o.editorOptions)!=null&&s.dateFormat)&&n)try{const r=n instanceof Date?n:new Date(n);if(!isNaN(r.getTime())){const l=_t(o.editorOptions.dateFormat);return Yt(r,l)}}catch{}return String(n??"")}isCellInvalid(t,o){return this._invalidCells.some(i=>i.rowIndex===t&&i.field===o)}getCellValidationError(t,o){const i=this._invalidCells.find(n=>n.rowIndex===t&&n.field===o);return(i==null?void 0:i.error)||null}addInvalidCell(t,o,i){const n=this._invalidCells.findIndex(s=>s.rowIndex===t&&s.field===o);n>=0?this._invalidCells[n]={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,n;return((i=this._editingCell)==null?void 0:i.rowIndex)===t&&((n=this._editingCell)==null?void 0:n.field)===o}shouldShowEditor(t,o){const i=this._columns[o];if(!i)return!1;const n=String(i.field);return!!(this.isEditing(t,n)||(i.editTrigger??this._editTrigger)==="always"&&this.isCellEditable(i))}startEdit(t,o,i){var r,l;if(!this.canEditCell(t,o))return;const n=this.displayItems[t];if(!n)return;this._draftRows.has(t)||this._draftRows.set(t,{...n});const s=this._editingCell;this._editingCell={rowIndex:t,field:o,initialSearchQuery:i==null?void 0:i.initialSearchQuery,cursorPosition:i==null?void 0:i.cursorPosition},(r=this._onInteractionChange)==null||r.call(this,"editingCell",{prev:s,current:this._editingCell}),this._currentCellError=null,(l=this._onroweditstart)==null||l.call(this,{row:n,rowIndex:t,field:o})}cancelEdit(){var t,o;if(this._editingCell){const i=this._editingCell,{rowIndex:n,field:s}=i,r=this.displayItems[n];r&&((t=this._onroweditcancel)==null||t.call(this,{row:r,rowIndex:n,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,n=!1){var f,w,p,m,y,v,x;const s=this._columns.find(C=>String(C.field)===o);if(!s)return;const r=this.displayItems[t];if(!r)return;const l=this.isEmptyRowIndex(t),a=r[o];let d=i,c=null,u=!0;this._isValidating=!0;try{if(s.beforeCommitCallback){const C={value:i,oldValue:a,row:r,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,r));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={...r}),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:r,rowIndex:t,field:o,error:c||"Invalid value"})),n&&this.emptyRowHasData(this._emptyRowDraft)){const S={...this._emptyRowDraft},E=this._newRowPosition==="top"?0:this._items.length;this._invalidCells=this._invalidCells.map(R=>R.rowIndex===t?{...R,rowIndex:E}:this._newRowPosition==="top"?{...R,rowIndex:R.rowIndex+1}:R),this._newRowPosition==="top"?this._items=[S,...this._items]:this._items=[...this._items,S];const I=this._invalidCells.some(R=>R.rowIndex===E);(w=this._onrowchange)==null||w.call(this,{row:S,draftRow:S,rowIndex:E,field:o,oldValue:null,newValue:d,isValid:!I,validationError:I?"Row has invalid cells":null}),this._emptyRowDraft=null;const k=this._editingCell;this._editingCell=null,(p=this._onInteractionChange)==null||p.call(this,"editingCell",{prev:k,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={...r},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,(y=this._onvalidationerror)==null||y.call(this,{row:r,rowIndex:t,field:o,error:c||"Invalid value"})),(v=this._onrowchange)==null||v.call(this,{row:r,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 r=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:r,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,n;return((i=this._focusedCell)==null?void 0:i.rowIndex)===t&&((n=this._focusedCell)==null?void 0:n.colIndex)===o}get focusedCell(){return this._focusedCell}setFocusedCell(t,o){var s;const i=this._focusedCell,n={rowIndex:t,colIndex:o};(i==null?void 0:i.rowIndex)===n.rowIndex&&(i==null?void 0:i.colIndex)===n.colIndex||(this._focusedCell=n,(s=this._onInteractionChange)==null||s.call(this,"focusedCell",{prev:i,current:n}))}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 n;if(this._focusedRowIndex===t)return;const o=this._focusedRowIndex;this._focusedRowIndex=t,(n=this._onInteractionChange)==null||n.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,n=-1;if(typeof t=="object"&&t!==null)o=t,i=this.getRowId(o),n=this._items.indexOf(o),n===-1&&(n=this.displayItems.indexOf(o));else{i=t;const r=this.findRowById(i);r&&(o=r.row,n=r.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 r=s.getLockInfoCallback(o,n);if(r!=null&&r.isLocked)return r}if(s.isLockedCallback&&s.isLockedCallback(o,n))return{isLocked:!0};if(s.lockInfoMember){const r=o[String(s.lockInfoMember)];if(r!=null&&r.isLocked)return r}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 n=this.findRowById(t);return n&&this._editingCell&&this._editingCell.rowIndex===n.index&&this.cancelEdit(),this.requestUpdate(),(s=this._onrowlockchange)==null||s.call(this,{rowId:t,row:(n==null?void 0:n.row)??null,rowIndex:(n==null?void 0:n.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 n=this.findRowById(t);(i=this._onrowlockchange)==null||i.call(this,{rowId:t,row:(n==null?void 0:n.row)??null,rowIndex:(n==null?void 0:n.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 n=this._draftRows.get(i.index);return n&&Object.assign(n,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 n=this.displayItems[t];if(!n)return!1;const s=this.getRowLockInfo(n);if(!(s!=null&&s.isLocked))return!0;const r=this._rowLocking;switch((r==null?void 0:r.lockedEditBehavior)??"block"){case"allow":return!0;case"callback":return((a=r==null?void 0:r.canEditLockedCallback)==null?void 0:a.call(r,n,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),n=new Set(this._columns.map(r=>String(r.field)));let s=!1;if(i.columnWidths){this._columnWidths.clear();for(const r of i.columnWidths)n.has(r.field)?this._columnWidths.set(r.field,r.width):s=!0}if(i.columnOrder){this._columnOrder.clear();for(const r of i.columnOrder)n.has(r.field)?this._columnOrder.set(r.field,r.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,n)=>({field:String(i.column.field),order:n}))}moveColumn(t,o){const i=this.visualColumns,n=this.totalFrozenColumns,s=i.slice(n),r=s.findIndex(d=>String(d.column.field)===t);if(r===-1||r===o)return;this._columnOrder.clear();const l=[...s],[a]=l.splice(r,1);l.splice(o,0,a),l.forEach((d,c)=>{this._columnOrder.set(String(d.column.field),c)}),this.requestUpdate()}}const lr=':host{--wg-rem: 10px;font-family:var(--wg-font-family);display:block;--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, #e6f2ff);--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-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: 1001;--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-dropdown: 9999;--wg-z-toolbar: 1000;--wg-z-context-menu: 1001;--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:1}.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:1;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:1;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:2;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:10000;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:999;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:10;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:5;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:1}.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:0;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:0;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))}.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:4!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:2!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:1}.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__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:5}.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:fixed;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}}:host([data-theme="dark"]),[data-theme=dark] :host,:host([data-bs-theme="dark"]),[data-bs-theme=dark] :host,.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}';function ot(e,t,o){const i=o.valueMember||"value",n=t.find(s=>s[i]===e);return n?He(n,o):e!=null?String(e):""}function He(e,t){if(t.getDisplayCallback)return t.getDisplayCallback(e);const o=t.displayMember||"label";return String(e[o]??e.label??"")}function Te(e,t){if(t.getValueCallback)return t.getValueCallback(e);const o=t.valueMember||"value";return e[o]??e.value}function ar(e,t){return t.getIconCallback?t.getIconCallback(e):t.iconMember&&e[t.iconMember]||null}function dr(e,t){return t.getSubtitleCallback?t.getSubtitleCallback(e):t.subtitleMember&&e[t.subtitleMember]||null}function ae(e,t){return t.getDisabledCallback?t.getDisabledCallback(e):t.disabledMember?!!e[t.disabledMember]:!1}function Xt(e,t,o,i,n,s,r=!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(n)}</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`
|
|
301
|
+
The grid may behave unexpectedly.`,"font-size: 14px; font-weight: bold;")}checkToolbarConflicts(){const t=this._toolbarPosition,o=t==="top"||t==="inline",i=t==="top",r="font-size: 14px; font-weight: bold;";this._toolbarVerticalAlign!=="bottom"&&o&&console.warn(`%cWebGrid: toolbarVerticalAlign="${this._toolbarVerticalAlign}" has no effect with toolbarPosition="${t}".
|
|
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="${t}".
|
|
303
|
+
horizontalAlign only applies to toolbarPosition="top".`,r),this._toolbarColumn!==void 0&&!i&&console.warn(`%cWebGrid: toolbarColumn has no effect with toolbarPosition="${t}".
|
|
304
|
+
toolbarColumn only applies to toolbarPosition="top".`,r),this._toolbarFollowsCursor&&!i&&console.warn(`%cWebGrid: toolbarFollowsCursor has no effect with toolbarPosition="${t}".
|
|
305
|
+
toolbarFollowsCursor only applies to toolbarPosition="top".`,r),this._cellToolbar!==void 0&&!i&&console.warn(`%cWebGrid: cellToolbar has no effect with toolbarPosition="${t}".
|
|
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)}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=_t(o.editorOptions.dateFormat);return Yt(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))return;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,y,v,x;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},E=this._newRowPosition==="top"?0:this._items.length;this._invalidCells=this._invalidCells.map(R=>R.rowIndex===t?{...R,rowIndex:E}:this._newRowPosition==="top"?{...R,rowIndex:R.rowIndex+1}:R),this._newRowPosition==="top"?this._items=[S,...this._items]:this._items=[...this._items,S];const I=this._invalidCells.some(R=>R.rowIndex===E);(w=this._onrowchange)==null||w.call(this,{row:S,draftRow:S,rowIndex:E,field:o,oldValue:null,newValue:d,isValid:!I,validationError:I?"Row has invalid cells":null}),this._emptyRowDraft=null;const k=this._editingCell;this._editingCell=null,(p=this._onInteractionChange)==null||p.call(this,"editingCell",{prev:k,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,(y=this._onvalidationerror)==null||y.call(this,{row:n,rowIndex:t,field:o,error:c||"Invalid value"})),(v=this._onrowchange)==null||v.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;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 an=':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, #e6f2ff);--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-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: 1001;--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-dropdown: 9999;--wg-z-toolbar: 1000;--wg-z-context-menu: 1001;--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:1}.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:1;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:1;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:2;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:10000;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:999;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:10;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:5;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:1}.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:0;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:0;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))}.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:4!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:2!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:1}.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__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:5}.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}}: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}: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 ot(e,t,o){const i=o.valueMember||"value",r=t.find(s=>s[i]===e);return r?He(r,o):e!=null?String(e):""}function He(e,t){if(t.getDisplayCallback)return t.getDisplayCallback(e);const o=t.displayMember||"label";return String(e[o]??e.label??"")}function Me(e,t){if(t.getValueCallback)return t.getValueCallback(e);const o=t.valueMember||"value";return e[o]??e.value}function dn(e,t){return t.getIconCallback?t.getIconCallback(e):t.iconMember&&e[t.iconMember]||null}function cn(e,t){return t.getSubtitleCallback?t.getSubtitleCallback(e):t.subtitleMember&&e[t.subtitleMember]||null}function ae(e,t){return t.getDisabledCallback?t.getDisabledCallback(e):t.disabledMember?!!e[t.disabledMember]:!1}function Xt(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`
|
|
308
308
|
<input
|
|
309
309
|
type="checkbox"
|
|
310
|
-
class="wg__checkbox-display${
|
|
310
|
+
class="wg__checkbox-display${n?"":" wg__checkbox-display--readonly"}"
|
|
311
311
|
${h===w?"checked":""}
|
|
312
312
|
disabled
|
|
313
313
|
tabindex="-1"
|
|
314
314
|
data-row="${t}"
|
|
315
315
|
data-field="${c}"
|
|
316
316
|
/>
|
|
317
|
-
`}if(l){const g=e.grid.displayItems[t],h=g?e.grid.getCellRawValue(g,t,c):void 0,f=i.editorOptions||{},w=f.initialOptions||f.options||[],p=ot(h,w,f),y=e.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-dropdown-display--toggle-on-focus":"",v=
|
|
317
|
+
`}if(l){const g=e.grid.displayItems[t],h=g?e.grid.getCellRawValue(g,t,c):void 0,f=i.editorOptions||{},w=f.initialOptions||f.options||[],p=ot(h,w,f),y=e.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-dropdown-display--toggle-on-focus":"",v=n?'<span class="wg__select-toggle">▼</span>':"";return`
|
|
318
318
|
<div class="wg__cell-dropdown-display ${y}" data-row="${t}" data-field="${c}">
|
|
319
319
|
<span class="wg__select-value">${e.escapeHtml(p)}</span>
|
|
320
320
|
${v}
|
|
321
321
|
</div>
|
|
322
|
-
`}if(a){const h=e.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-date-display--toggle-on-focus":"",f=
|
|
322
|
+
`}if(a){const h=e.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
325
|
<div class="wg__cell-date-display ${h}" data-row="${t}" data-field="${c}">
|
|
326
|
-
<span class="wg__date-value">${e.escapeHtml(
|
|
326
|
+
<span class="wg__date-value">${e.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}>${
|
|
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}>${e.escapeHtml(r)}</span>`}function Gt(e,t){if(typeof t=="number")return e.left+e.width*t;const o=document.createElement("div");o.style.cssText=`position:fixed;left:0;top:0;width:${t};height:0;visibility:hidden;pointer-events:none`,document.body.appendChild(o);const i=o.getBoundingClientRect().width;return o.remove(),e.left+i}let Z={path:null,arrowPos:null,arrowDir:"right"};const it={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>'},gn={add:{icon:it.add,title:"Add row"},delete:{icon:it.delete,title:"Delete row",danger:!0},duplicate:{icon:it.duplicate,title:"Duplicate row"},moveUp:{icon:it.moveUp,title:"Move up"},moveDown:{icon:it.moveDown,title:"Move down"}};function Xe(e){return e.map((t,o)=>{if(typeof t=="string"){const i=gn[t];return i?{id:t,icon:i.icon,title:i.title,row:1,group:1,type:t,danger:i.danger}:(console.warn(`Unknown predefined toolbar action: ${t}`),null)}return{id:t.id||`toolbar-item-${o}`,icon:t.icon,title:t.title,label:t.label,row:t.row??1,group:t.group??1,type:t.type,danger:t.danger,disabled:t.disabled,hidden:t.hidden,onclick:t.onclick,tooltip:t.tooltip,tooltipCallback:t.tooltipCallback}}).filter(t=>t!==null)}function un(e){const t=new Map;for(const r of e){const s=r.row;t.has(s)||t.set(s,[]),t.get(s).push(r)}const o=[],i=[...t.keys()].sort((r,s)=>r-s);for(const r of i){const s=t.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 hn(e){return e.replace(/\+/g," + ")}function fn(e,t){var r,s;const o=[];o.push(`<span class="wg__tooltip-title">${e.title}</span>`),(r=e.tooltip)!=null&&r.description&&o.push(`<div class="wg__tooltip-desc">${e.tooltip.description}</div>`);const i=((s=e.tooltip)==null?void 0:s.shortcut)||t;return i&&o.push(`<div class="wg__tooltip-shortcut">${hn(i)}</div>`),o.join("")}function Oo(e,t,o,i=!1){let r=un(e);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(t,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
|
|
334
|
+
>${g.icon}${w}</button>`}).join("");return c+u}).join("")}</div>`).join("")}</div>`}let F=null;function wn(e,t,o,i,r,s,n){Ct();const l=e.grid.toolbarVerticalAlign!=="top",a=Oo(i,r,o,l),d=document.createElement("div");d.className="wg__toolbar-container",e.grid.toolbarBtnMinWidth&&d.style.setProperty("--wg-toolbar-btn-min-width",e.grid.toolbarBtnMinWidth),d.innerHTML=a,e.shadow.appendChild(d);const c=d.querySelector(".wg__toolbar"),u=e.grid.toolbarPosition;let g=u==="top"?"top":u==="right"?"right":"left";c.style.position="fixed",c.style.visibility="hidden",requestAnimationFrame(()=>{const f=e.shadow.querySelector(`tr[data-row-index="${o}"]`);if(!f){Ct();return}const w=e.grid.toolbarPosition,p=e.grid.toolbarVerticalAlign,m=e.grid.toolbarHorizontalAlign;let y,v,x="";p==="top"?x="-end":p==="bottom"&&(x="-start");const C=()=>m==="start"?"top-start":m==="end"?"top-end":"top";w==="left"?(y=`left${x}`,v=[`right${x}`,C()]):w==="right"?(y=`right${x}`,v=[`left${x}`,C()]):w==="top"?(y=C(),v=[`left${x}`,`right${x}`]):(y=`left${x}`,v=[`right${x}`,C()]);let _=f;const S=e.grid.toolbarColumn;if(w==="top"){if(S!==void 0){const E=f.querySelectorAll(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");let I=null;if(typeof S=="number")I=E[S]||null;else for(let k=0;k<E.length;k++){const R=E[k];if(R.dataset.field===S){I=R;break}}if(I){const k=I.getBoundingClientRect();_={getBoundingClientRect:()=>({x:k.left+k.width/2,y:k.top,top:k.top,left:k.left+k.width/2,bottom:k.bottom,right:k.left+k.width/2,width:0,height:k.height,toJSON:()=>({})})}}}else if(m==="cursor"&&n!==void 0){const E=f.getBoundingClientRect();_={getBoundingClientRect:()=>({x:n,y:E.top,top:E.top,left:n,bottom:E.bottom,right:n,width:0,height:E.height,toJSON:()=>({})})}}}Ke(_,c,{strategy:"fixed",placement:y,middleware:[Ue({fallbackPlacements:v}),bt({padding:8})]}).then(({x:E,y:I,placement:k})=>{let R=E;if((e.grid.toolbarFollowsCursor||e.grid.cellToolbar)&&k.startsWith("top")&&n!==void 0&&e.grid.toolbarColumn===void 0){const M=f.querySelectorAll(".wg__cell:not(.wg__row-number):not(.wg__inline-actions-cell)");for(const z of M){const D=z.getBoundingClientRect();if(n>=D.left&&n<=D.right){R=Gt(D,e.grid.cellToolbarOffset);break}}}Object.assign(c.style,{left:`${R}px`,top:`${I}px`,visibility:"visible"}),g=k.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(y=>y.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()}},Z={path:null,arrowPos:null,arrowDir:"right"}}function Ct(){F&&(F.cleanup(),F=null),Z={path:null,arrowPos:null,arrowDir:"right"}}function Fe(){return(F==null?void 0:F.rowIndex)??null}function Ho(e){return(F==null?void 0:F.container.getRootNode())===e}function Qt(e){return(F==null?void 0:F.rowIndex)===e}function pn(){return Z}function mn(){return F?{toolbar:F.toolbar,container:F.container}:null}function Jt(e,t,o="center"){if(!F||F.position!=="top")return;const i=F.toolbar,r=i.getBoundingClientRect();let s;o==="start"?s=e:s=e-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=e}function Fo(e,t){if(!F){Z={path:null,arrowPos:null,arrowDir:"right"};return}const{toolbar:o,rowItem:i,position:r}=F,s=t.findIndex(C=>C===i);if(s===-1){Z={path:null,arrowPos:null,arrowDir:"right"};return}const n=e.shadow.querySelector(`tr[data-row-index="${s}"]`);if(!n){Z={path:null,arrowPos:null,arrowDir:"right"};return}if(s===F.rowIndex||(F.hasRowMoved=!0),!F.hasRowMoved){Z={path:null,arrowPos:null,arrowDir:"right"};return}const a=o.getBoundingClientRect(),d=n.getBoundingClientRect(),c=e.shadow.querySelector(".wg__table"),u=c==null?void 0:c.getBoundingClientRect(),g=e.shadow.querySelector(".wg"),h=g==null?void 0:g.getBoundingClientRect();if(!u||!h){Z={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,y=!p&&!m;let v,x="right";if(p?(v=h.top+8,x="up"):m?(v=h.bottom-8,x="down"):v=w,r==="left"){const C=a.right,_=a.top+a.height/2,S=f?h.right+15:h.left-15;if(!y){Z={path:`M ${C} ${_} H ${S} V ${v}`,arrowPos:{x:S,y:v},arrowDir:x};return}const E=f?h.right-8:h.left+8;x=f?"left":"right",Z={path:`M ${C} ${_} H ${S} V ${v} H ${E}`,arrowPos:{x:E,y:v},arrowDir:x};return}else if(r==="right"){const C=a.left,_=a.top+a.height/2,S=f?h.left-15:h.right+15;if(!y){Z={path:`M ${C} ${_} H ${S} V ${v}`,arrowPos:{x:S,y:v},arrowDir:x};return}const E=f?h.left+8:h.right-8;x=f?"right":"left",Z={path:`M ${C} ${_} H ${S} V ${v} H ${E}`,arrowPos:{x:E,y:v},arrowDir:x};return}else{const _=a.right,S=a.top+a.height/2,E=_+48,I=s-F.rowIndex,k=8;if(I===0){let R=d.top-k;m&&(R=h.bottom-k),Z={path:`M ${_} ${S} H ${E} V ${R}`,arrowPos:{x:E,y:R},arrowDir:"down"};return}else if(I===-1){const M=a.top+a.height*.25,z=a.top+a.height*.75,D=a.right+24,L=a.right+k;Z={path:`M ${a.right} ${M} H ${D} V ${z} H ${L}`,arrowPos:{x:L,y:z},arrowDir:"left"};return}else if(I<0){let R=d.bottom+k;p&&(R=h.top+k),Z={path:`M ${_} ${S} H ${E} V ${R}`,arrowPos:{x:E,y:R},arrowDir:"up"};return}else{let R=d.top-k;m&&(R=h.bottom-k),Z={path:`M ${_} ${S} H ${E} V ${R}`,arrowPos:{x:E,y:R},arrowDir:"down"};return}}}function qo(e,t,o="Row actions"){return`<button
|
|
335
335
|
class="wg__toolbar-trigger ${t?"wg__toolbar-trigger--active":""}"
|
|
336
336
|
data-toolbar-trigger="${e}"
|
|
337
337
|
title="${o}"
|
|
338
|
-
>⋮</button>`}const Zt=40;function eo(e){if(!e||e==="auto")return 150;const t=e.match(/^([\d.]+)(px|em|rem|%)?$/);if(!t)return 150;const o=parseFloat(t[1]);switch(t[2]||"px"){case"px":return o;case"em":return o*16;case"rem":return o*10;case"%":return 150;default:return o}}function
|
|
338
|
+
>⋮</button>`}const Zt=40;function eo(e){if(!e||e==="auto")return 150;const t=e.match(/^([\d.]+)(px|em|rem|%)?$/);if(!t)return 150;const o=parseFloat(t[1]);switch(t[2]||"px"){case"px":return o;case"em":return o*16;case"rem":return o*10;case"%":return 150;default:return o}}function bn(e){const t=["wg"];return e.grid.isStriped&&t.push("wg--striped"),e.grid.isHoverable&&t.push("wg--hoverable"),e.grid.isEditable&&t.push("wg--editable"),e.grid.isNavigateMode&&t.push("wg--navigate-mode"),e.grid.isColumnReorderAllowed&&t.push("wg--reorderable"),e.grid.isScrollable&&t.push("wg--scrollable"),e.grid.tableBorderOnly&&t.push("wg--table-border-only"),t.join(" ")}function _n(e){const t=e.grid.visualColumns;if(t.length===0)return"";let o=0,i="";if(e.grid.isRowNumbersVisible){const d=e.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+=Zt}const r=e.grid.isRowToolbarVisible&&e.grid.toolbarPosition==="inline";let s="";if(r){const d=Xe(e.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))`}">${e.escapeHtml(e.grid.inlineActionsTitle??e.grid.labels.inlineActionsHeader)}</th>`}const l=e.grid.isRowToolbarVisible&&e.grid.toolbarTrigger==="button"&&e.grid.toolbarPosition!=="inline"?'<th class="wg__header wg__actions-column"></th>':"",a=t.map(({column:d,originalIndex:c},u)=>{const g=String(d.field),h=d.isSortable!==!1&&e.grid.sortMode!=="none",f=e.grid.getColumnSortState(g),w=e.grid.getColumnSortPriority(g),p=f!==void 0,m=e.grid.isColumnFrozen(u),y=m&&u===e.grid.totalFrozenColumns-1,v=e.grid.isColumnSelected(u),x=["wg__header"];h&&x.push("wg__header--sortable"),p&&x.push("wg__header--sorted"),m&&x.push("wg__header--frozen"),y&&x.push("wg__header--frozen-last"),v&&x.push("wg__header--selected");const _=e.grid.getColumnWidth(g)||d.width||d.maxWidth,S=eo(_),E=d.minWidth,I=d.headerHorizontalAlign||d.horizontalAlign||"left",k=d.headerVerticalAlign||d.verticalAlign||"middle",M=`style="${[m?"position: sticky":"",m?`left: ${o}px`:"",m?"z-index: 2":"",_?`width: ${_}`:"",_?`max-width: ${_}`:"",E?`min-width: ${E}`:"",`text-align: ${I}`,`vertical-align: ${k}`].filter(Boolean).join("; ")}"`;m&&(o+=S);let z="";if(h)if(p){const T=f.direction==="asc"?"▲":"▼",A=e.grid.sort.length>1?`<sup class="wg__sort-priority">${w}</sup>`:"";z=`<span class="wg__sort-indicator">${T}${A}</span>`}else z='<span class="wg__sort-indicator wg__sort-placeholder">⬍</span>';let D="";d.headerInfo&&(D=`<span class="wg__header-info" data-tooltip="${e.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 K=`<div class="wg__resize-handle${d.isResizable!==!1?"":" wg__resize-handle--disabled"}" data-field="${g}"></div>`;return`
|
|
339
339
|
<th class="${x.join(" ")}" ${M} data-field="${g}">
|
|
340
340
|
<div class="wg__header-container">
|
|
341
341
|
<div class="wg__header-content wg__header-content--align-${I} wg__header-content--valign-${k}">
|
|
@@ -348,20 +348,20 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
348
348
|
</div>
|
|
349
349
|
${K}
|
|
350
350
|
</th>
|
|
351
|
-
`}).join("");return`<tr>${i}${s}${l}${a}<th class="wg__filler"> </th></tr>`}function
|
|
351
|
+
`}).join("");return`<tr>${i}${s}${l}${a}<th class="wg__filler"> </th></tr>`}function vn(e){const t=e.grid.displayItems,o=e.grid.visualColumns,i=e.grid.isRowNumbersVisible,r=e.grid.isStickyRowNumbers,s=e.grid.isRowToolbarVisible&&e.grid.toolbarPosition==="inline",n=e.grid.isRowToolbarVisible&&e.grid.toolbarTrigger==="button"&&e.grid.toolbarPosition!=="inline",l=o.length+(n?1:0)+(i?1:0)+(s?1:0);if(t.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=Fe(),d=o.map(({column:c})=>eo(c.width||c.maxWidth));return t.map((c,u)=>{const g=e.grid.getRowLockInfo(c),h=(g==null?void 0:g.isLocked)===!0,f=e.grid.isEmptyRowIndex(u);let w=0,p="";if(i){const _=
|
|
357
|
+
`;const a=Fe(),d=o.map(({column:c})=>eo(c.width||c.maxWidth));return t.map((c,u)=>{const g=e.grid.getRowLockInfo(c),h=(g==null?void 0:g.isLocked)===!0,f=e.grid.isEmptyRowIndex(u);let w=0,p="";if(i){const _=r?"position: sticky; left: 0; z-index: 2;":"",S=r?" wg__cell--frozen":"";if(h){const E=g!=null&&g.lockedBy?`Locked by ${g.lockedBy}`:"This row is locked";p=`<td class="wg__cell wg__row-number wg__row-number--locked${S}" style="${_}" data-tooltip="${e.escapeHtml(E)}" data-row-number="${u}">🔒</td>`}else f?p=`<td class="wg__cell wg__row-number wg__empty-row-indicator${S}" style="${_}" data-row-number="${u}">${e.grid.newRowIndicator}</td>`:p=`<td class="wg__cell wg__row-number${S}" style="${_}" data-row-number="${u}">${u+1}</td>`;w+=Zt}const m=s?Vo(e,c,u):"";let y="";n&&(y=`
|
|
358
358
|
<td class="wg__cell wg__actions-column">
|
|
359
359
|
${qo(u,a===u,e.grid.labels.rowActions)}
|
|
360
360
|
</td>
|
|
361
|
-
`);const v=o.map(({column:_,originalIndex:S},E)=>{const I=String(_.field),k=e.grid.getCellValue(c,_,u),R=_.horizontalAlign||"left",M=_.verticalAlign||"middle",z=e.grid.canEditCell(u,I),D=e.grid.isCellFocused(u,S),L=e.grid.isColumnFrozen(E),K=L&&E===e.grid.totalFrozenColumns-1,T=_.editTrigger??e.grid.editTrigger,A=["wg__cell"],B=e.grid.shouldShowEditor(u,S),N=e.grid.isEditing(u,I);if(z&&A.push("wg__cell--editable"),D&&!N&&A.push("wg__cell--focused"),D&&T==="always"&&A.push("wg__cell--always-edit-focused"),_.textOverflow!=="wrap"&&A.push("wg__cell--ellipsis"),_.maxLines&&A.push("wg__cell--line-clamp"),N&&A.push("wg__cell--editing"),e.grid.isCellInvalid(u,I)&&A.push("wg__cell--invalid"),e.grid.isCellInSelectedRange(u,E)&&A.push("wg__cell--in-range"),e.grid.isColumnSelected(E)&&A.push("wg__cell--column-selected"),L&&A.push("wg__cell--frozen"),K&&A.push("wg__cell--frozen-last"),_.cellClass&&A.push(_.cellClass),_.cellClassCallback){const le=e.grid.getCellRawValue(c,u,I),
|
|
361
|
+
`);const v=o.map(({column:_,originalIndex:S},E)=>{const I=String(_.field),k=e.grid.getCellValue(c,_,u),R=_.horizontalAlign||"left",M=_.verticalAlign||"middle",z=e.grid.canEditCell(u,I),D=e.grid.isCellFocused(u,S),L=e.grid.isColumnFrozen(E),K=L&&E===e.grid.totalFrozenColumns-1,T=_.editTrigger??e.grid.editTrigger,A=["wg__cell"],B=e.grid.shouldShowEditor(u,S),N=e.grid.isEditing(u,I);if(z&&A.push("wg__cell--editable"),D&&!N&&A.push("wg__cell--focused"),D&&T==="always"&&A.push("wg__cell--always-edit-focused"),_.textOverflow!=="wrap"&&A.push("wg__cell--ellipsis"),_.maxLines&&A.push("wg__cell--line-clamp"),N&&A.push("wg__cell--editing"),e.grid.isCellInvalid(u,I)&&A.push("wg__cell--invalid"),e.grid.isCellInSelectedRange(u,E)&&A.push("wg__cell--in-range"),e.grid.isColumnSelected(E)&&A.push("wg__cell--column-selected"),L&&A.push("wg__cell--frozen"),K&&A.push("wg__cell--frozen-last"),_.cellClass&&A.push(_.cellClass),_.cellClassCallback){const le=e.grid.getCellRawValue(c,u,I),pe=_.cellClassCallback(le,c);pe&&A.push(pe)}const Ee=e.grid.getColumnWidth(I)||_.width,ee=_.minWidth,Le=[L?"position: sticky":"",L?`left: ${w}px`:"",L?"z-index: 1":"",`text-align: ${R}`,`vertical-align: ${M}`,Ee?`width: ${Ee}`:"",ee?`min-width: ${ee}`:"",_.maxWidth?`max-width: ${_.maxWidth}`:""].filter(Boolean).join("; ");L&&(w+=d[E]);const Re=e.grid.isNavigateMode?'tabindex="0"':"";let oe="";if(_.tooltipCallback){const le=e.grid.getCellRawValue(c,u,I),pe=_.tooltipCallback(le,c);pe&&(oe=`${_.isTooltipHtml?"data-tooltip-html":"data-tooltip"}="${e.escapeHtml(pe)}"`)}else if(_.tooltipMember){const le=c[_.tooltipMember];le&&typeof le=="string"&&(oe=`${_.isTooltipHtml?"data-tooltip-html":"data-tooltip"}="${e.escapeHtml(le)}"`)}if(!oe&&e.grid.isCellInvalid(u,I)){const le=e.grid.getCellValidationError(u,I);if(le){const pe=_.validationTooltipCallback||e.grid.validationTooltipCallback;if(pe){const J=e.grid.getCellRawValue(c,u,I),At=pe({field:I,error:le,value:J,row:c,rowIndex:u});At&&(oe=`data-tooltip-html="${e.escapeHtml(At)}"`)}oe||(oe=`data-tooltip="${e.escapeHtml(le)}"`)}}return`
|
|
362
362
|
<td
|
|
363
363
|
class="${A.join(" ")}"
|
|
364
|
-
style="${
|
|
364
|
+
style="${Le}"
|
|
365
365
|
data-row="${u}"
|
|
366
366
|
data-col="${S}"
|
|
367
367
|
data-field="${I}"
|
|
@@ -370,29 +370,29 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
370
370
|
>
|
|
371
371
|
${B?kt(e,u,S,_):Xt(e,u,S,_,k,D,z)}
|
|
372
372
|
</td>
|
|
373
|
-
`}).join(""),x=["wg__row"];if(h&&x.push("wg__row--locked"),f&&x.push("wg__row--empty-row"),e.grid.isRowSelected(u)&&x.push("wg__row--selected"),e.grid.isRowFocused(u)&&x.push("wg__row--focused"),e.grid.rowClassCallback){const _=e.grid.rowClassCallback(c,u);_&&x.push(_)}const C=h&&!i?`data-tooltip="${e.escapeHtml(g!=null&&g.lockedBy?`Locked by ${g.lockedBy}`:"This row is locked")}"`:"";return`<tr class="${x.join(" ")}" data-row-index="${u}" ${C}>${p}${m}${y}${v}<td class="wg__cell wg__filler" data-row="${u}"></td></tr>`}).join("")}function Vo(e,t,o){const
|
|
373
|
+
`}).join(""),x=["wg__row"];if(h&&x.push("wg__row--locked"),f&&x.push("wg__row--empty-row"),e.grid.isRowSelected(u)&&x.push("wg__row--selected"),e.grid.isRowFocused(u)&&x.push("wg__row--focused"),e.grid.rowClassCallback){const _=e.grid.rowClassCallback(c,u);_&&x.push(_)}const C=h&&!i?`data-tooltip="${e.escapeHtml(g!=null&&g.lockedBy?`Locked by ${g.lockedBy}`:"This row is locked")}"`:"";return`<tr class="${x.join(" ")}" data-row-index="${u}" ${C}>${p}${m}${y}${v}<td class="wg__cell wg__filler" data-row="${u}"></td></tr>`}).join("")}function Vo(e,t,o){const r=Xe(e.grid.rowToolbar).filter(a=>typeof a.hidden=="function"?!a.hidden(t,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(t,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="${e.escapeHtml(u.title)}" ${f}>${u.icon}</button>`}).join("")}</div>`).join("")}</div></td>`}function No(e,t){const o=e.grid.displayItems,i=e.grid.visualColumns,{startIndex:r,endIndex:s,rowHeight:n,totalItems:l}=t,a=e.grid.isRowNumbersVisible,d=e.grid.isStickyRowNumbers,c=e.grid.isRowToolbarVisible&&e.grid.toolbarPosition==="inline",u=e.grid.isRowToolbarVisible&&e.grid.toolbarTrigger==="button"&&e.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=Fe(),f=i.map(({column:x})=>eo(x.width||x.maxWidth)),w=n
|
|
379
|
+
`;const h=Fe(),f=i.map(({column:x})=>eo(x.width||x.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>`:"",y=[];for(let x=r;x<s&&x<o.length;x++){const C=o[x],_=x,S=e.grid.getRowLockInfo(C),E=(S==null?void 0:S.isLocked)===!0,I=e.grid.isEmptyRowIndex(_);let k=0,R="";if(a){const T=d?"position: sticky; left: 0; z-index: 2;":"",A=d?" wg__cell--frozen":"";if(E){const B=S!=null&&S.lockedBy?`Locked by ${S.lockedBy}`:"This row is locked";R=`<td class="wg__cell wg__row-number wg__row-number--locked${A}" style="${T}" data-tooltip="${e.escapeHtml(B)}" data-row-number="${_}">🔒</td>`}else I?R=`<td class="wg__cell wg__row-number wg__empty-row-indicator${A}" style="${T}" data-row-number="${_}">${e.grid.newRowIndicator}</td>`:R=`<td class="wg__cell wg__row-number${A}" style="${T}" data-row-number="${_}">${_+1}</td>`;k+=Zt}const M=c?Vo(e,C,_):"";let z="";u&&(z=`
|
|
380
380
|
<td class="wg__cell wg__actions-column">
|
|
381
381
|
${qo(_,h===_,e.grid.labels.rowActions)}
|
|
382
382
|
</td>
|
|
383
|
-
`);const D=i.map(({column:T,originalIndex:A},B)=>{const N=String(T.field),j=e.grid.getCellValue(C,T,_),Ee=T.horizontalAlign||"left",
|
|
383
|
+
`);const D=i.map(({column:T,originalIndex:A},B)=>{const N=String(T.field),j=e.grid.getCellValue(C,T,_),Ee=T.horizontalAlign||"left",ee=T.verticalAlign||"middle",Le=e.grid.canEditCell(_,N),Re=e.grid.isCellFocused(_,A),oe=e.grid.isColumnFrozen(B),le=oe&&B===e.grid.totalFrozenColumns-1,pe=T.editTrigger??e.grid.editTrigger,J=["wg__cell"],At=e.grid.shouldShowEditor(_,A),Li=e.grid.isEditing(_,N);if(Le&&J.push("wg__cell--editable"),Re&&!Li&&J.push("wg__cell--focused"),Re&&pe==="always"&&J.push("wg__cell--always-edit-focused"),T.textOverflow!=="wrap"&&J.push("wg__cell--ellipsis"),T.maxLines&&J.push("wg__cell--line-clamp"),Li&&J.push("wg__cell--editing"),e.grid.isCellInvalid(_,N)&&J.push("wg__cell--invalid"),e.grid.isCellInSelectedRange(_,B)&&J.push("wg__cell--in-range"),e.grid.isColumnSelected(B)&&J.push("wg__cell--column-selected"),oe&&J.push("wg__cell--frozen"),le&&J.push("wg__cell--frozen-last"),T.cellClass&&J.push(T.cellClass),T.cellClassCallback){const me=e.grid.getCellRawValue(C,_,N),Ie=T.cellClassCallback(me,C);Ie&&J.push(Ie)}const Oi=e.grid.getColumnWidth(N)||T.width,Hi=T.minWidth,Fl=[oe?"position: sticky":"",oe?`left: ${k}px`:"",oe?"z-index: 1":"",`text-align: ${Ee}`,`vertical-align: ${ee}`,Oi?`width: ${Oi}`:"",Hi?`min-width: ${Hi}`:"",T.maxWidth?`max-width: ${T.maxWidth}`:""].filter(Boolean).join("; ");oe&&(k+=f[B]);const ql=e.grid.isNavigateMode?'tabindex="0"':"";let qe="";if(T.tooltipCallback){const me=e.grid.getCellRawValue(C,_,N),Ie=T.tooltipCallback(me,C);Ie&&(qe=`${T.isTooltipHtml?"data-tooltip-html":"data-tooltip"}="${e.escapeHtml(Ie)}"`)}else if(T.tooltipMember){const me=C[T.tooltipMember];me&&typeof me=="string"&&(qe=`${T.isTooltipHtml?"data-tooltip-html":"data-tooltip"}="${e.escapeHtml(me)}"`)}if(!qe&&e.grid.isCellInvalid(_,N)){const me=e.grid.getCellValidationError(_,N);if(me){const Ie=T.validationTooltipCallback||e.grid.validationTooltipCallback;if(Ie){const Fi=e.grid.getCellRawValue(C,_,N),qi=Ie({field:N,error:me,value:Fi,row:C,rowIndex:_});qi&&(qe=`data-tooltip-html="${e.escapeHtml(qi)}"`)}qe||(qe=`data-tooltip="${e.escapeHtml(me)}"`)}}return`
|
|
384
384
|
<td
|
|
385
|
-
class="${
|
|
386
|
-
style="${
|
|
385
|
+
class="${J.join(" ")}"
|
|
386
|
+
style="${Fl}"
|
|
387
387
|
data-row="${_}"
|
|
388
388
|
data-col="${A}"
|
|
389
389
|
data-field="${N}"
|
|
390
|
-
${
|
|
390
|
+
${ql}
|
|
391
391
|
${qe}
|
|
392
392
|
>
|
|
393
|
-
${At?kt(e,_,A,T):Xt(e,_,A,T,j,Re,
|
|
393
|
+
${At?kt(e,_,A,T):Xt(e,_,A,T,j,Re,Le)}
|
|
394
394
|
</td>
|
|
395
|
-
`}).join(""),L=["wg__row"];if(E&&L.push("wg__row--locked"),I&&L.push("wg__row--empty-row"),e.grid.isRowSelected(_)&&L.push("wg__row--selected"),e.grid.isRowFocused(_)&&L.push("wg__row--focused"),e.grid.rowClassCallback){const T=e.grid.rowClassCallback(C,_);T&&L.push(T)}const K=E&&!a?`data-tooltip="${e.escapeHtml(S!=null&&S.lockedBy?`Locked by ${S.lockedBy}`:"This row is locked")}"`:"";y.push(`<tr class="${L.join(" ")}" data-row-index="${_}" ${K}>${R}${M}${z}${D}<td class="wg__cell wg__filler" data-row="${_}"></td></tr>`)}const v=p>0?`<tr class="wg__spacer-bottom"><td colspan="${g}" style="height: ${p}px"></td></tr>`:"";return m+y.join("")+v}function to(e,t="bottom-center"){const o=e.grid.showPagination;if(!e.grid.isPageable||o===!1||o==="auto"&&e.grid.totalPages<=1)return"";const i=e.grid.currentPage,
|
|
395
|
+
`}).join(""),L=["wg__row"];if(E&&L.push("wg__row--locked"),I&&L.push("wg__row--empty-row"),e.grid.isRowSelected(_)&&L.push("wg__row--selected"),e.grid.isRowFocused(_)&&L.push("wg__row--focused"),e.grid.rowClassCallback){const T=e.grid.rowClassCallback(C,_);T&&L.push(T)}const K=E&&!a?`data-tooltip="${e.escapeHtml(S!=null&&S.lockedBy?`Locked by ${S.lockedBy}`:"This row is locked")}"`:"";y.push(`<tr class="${L.join(" ")}" data-row-index="${_}" ${K}>${R}${M}${z}${D}<td class="wg__cell wg__filler" data-row="${_}"></td></tr>`)}const v=p>0?`<tr class="wg__spacer-bottom"><td colspan="${g}" style="height: ${p}px"></td></tr>`:"";return m+y.join("")+v}function to(e,t="bottom-center"){const o=e.grid.showPagination;if(!e.grid.isPageable||o===!1||o==="auto"&&e.grid.totalPages<=1)return"";const i=e.grid.currentPage,r=e.grid.totalPages,s=e.grid.pageSize,n=e.grid.pageSizes,l=e.grid.totalItems!==null?e.grid.totalItems:e.grid.sortedItems.length,a=e.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=e.grid.paginationLabelsCallback,u=c?c({currentPage:i,totalPages:r,totalItems:l,pageSize:s}):{},g={...d,...u},h=t.startsWith("top-"),f=t.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>
|
|
@@ -401,11 +401,11 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
401
401
|
${g.previous}
|
|
402
402
|
</button>
|
|
403
403
|
`,next:`
|
|
404
|
-
<button class="wg__pagination-btn" data-action="next" ${i===
|
|
404
|
+
<button class="wg__pagination-btn" data-action="next" ${i===r?"disabled":""}>
|
|
405
405
|
${g.next}
|
|
406
406
|
</button>
|
|
407
407
|
`,last:`
|
|
408
|
-
<button class="wg__pagination-btn" data-action="last" ${i===
|
|
408
|
+
<button class="wg__pagination-btn" data-action="last" ${i===r?"disabled":""}>
|
|
409
409
|
${g.last}
|
|
410
410
|
</button>
|
|
411
411
|
`,pageInfo:`
|
|
@@ -413,17 +413,17 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
413
413
|
${g.pageInfo}
|
|
414
414
|
<span class="wg__pagination-count">${g.itemCount}</span>
|
|
415
415
|
</div>
|
|
416
|
-
`,pageSize:
|
|
416
|
+
`,pageSize:n.length>0?`
|
|
417
417
|
<div class="wg__pagination-pagesize">
|
|
418
418
|
<select class="wg__pagination-select" data-action="pagesize">
|
|
419
|
-
${
|
|
419
|
+
${n.map(v=>`<option value="${v}" ${v===s?"selected":""}>${v}</option>`).join("")}
|
|
420
420
|
</select>
|
|
421
421
|
<span class="wg__pagination-label">${g.perPage}</span>
|
|
422
422
|
</div>
|
|
423
|
-
`:""},y=e.grid.paginationLayout.split("|").map(v=>v.trim()).map(v=>p[v]||"").join("");return`<div class="${w.join(" ")}">${y}</div>`}function oo(e,t){const o=e.grid.summaryContentCallback;if(!o)return"";const i=e.grid.currentPage,
|
|
423
|
+
`:""},y=e.grid.paginationLayout.split("|").map(v=>v.trim()).map(v=>p[v]||"").join("");return`<div class="${w.join(" ")}">${y}</div>`}function oo(e,t){const o=e.grid.summaryContentCallback;if(!o)return"";const i=e.grid.currentPage,r=e.grid.pageSize,s=e.grid.sortedItems,n=e.grid.displayItems,l=e.grid.totalItems!==null?e.grid.totalItems:s.length,a=o({items:n,allItems:s,totalItems:l,currentPage:i,pageSize:r,metadata:e.grid.summaryMetadata}),d=t.startsWith("top-"),c=t.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 Bo(e,t){if(t){let o=e.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__date-input, .wg__select-trigger");if(o||(o=e.querySelector(".wg__editor")),o){o.focus({preventScroll:!0}),o instanceof HTMLInputElement&&o.type==="text"&&o.select();return}}e.focus({preventScroll:!0})}function rt(e,t,o){const i=e.grid.columns[o],s=((i==null?void 0:i.editTrigger)??e.grid.editTrigger)==="always";if(e.grid.shouldUseVirtualScroll()){yn(e,t);const d=e.shadow.querySelector(`[data-row="${t}"][data-col="${o}"]`);d&&(Bo(d,s),io(e,d,t));return}const n=e.shadow.querySelector(`[data-row="${t}"][data-col="${o}"]`);if(!n)return;Bo(n,s),n.scrollIntoView({block:"nearest",inline:"nearest"});const l=e.shadow.querySelector(".wg__header"),a=e.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"})}io(e,n,t)}}function io(e,t,o){const i=e.shadow.querySelector(".wg");if(!i)return;const r=e.shadow.querySelector(`tr[data-row-index="${o}"] .wg__cell--frozen-last`);if(!r)return;const s=r.getBoundingClientRect().right,n=t.getBoundingClientRect();n.left<s&&i.scrollBy({left:n.left-s,behavior:"instant"})}function yn(e,t){const o=e.shadow.querySelector(".wg");if(!o)return;const i=e.grid.virtualScrollRowHeight,r=o.scrollTop,s=o.clientHeight,n=e.shadow.querySelector(".wg__header"),l=(n==null?void 0:n.offsetHeight)||0,a=t*i,d=a+i,c=r+l,u=r+s;a<c?o.scrollTop=a-l:d>u&&(o.scrollTop=d-s)}let Wo=0;const Cn=100;function Q(e,t,o){const i=t&&o&&t.rowIndex===o.rowIndex&&t.colIndex===o.colIndex,r=Date.now();if(i&&r-Wo<Cn)return;Wo=r;const s=e.grid.editingCell;if(t){const n=s&&s.rowIndex===t.rowIndex&&e.grid.columns.findIndex(c=>String(c.field)===s.field)===t.colIndex,l=e.grid.columns[t.colIndex],d=((l==null?void 0:l.editTrigger)??e.grid.editTrigger)==="always";if(!n&&!d)H(e,t.rowIndex,t.colIndex);else{const c=e.shadow.querySelector(`td[data-row="${t.rowIndex}"][data-col="${t.colIndex}"]`);c&&c.classList.remove("wg__cell--focused","wg__cell--always-edit-focused")}}if(o){const n=e.grid.columns[o.colIndex],l=(n==null?void 0:n.editTrigger)??e.grid.editTrigger,a=l==="always",d=l==="click"||l==="dblclick";if(!(s&&s.rowIndex===o.rowIndex&&e.grid.columns.findIndex(u=>String(u.field)===s.field)===o.colIndex)&&!a&&!d)H(e,o.rowIndex,o.colIndex);else if(a||d){const u=e.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 U(e){const t=e.grid.editingCell;if(t){const o=e.grid.columns.findIndex(r=>String(r.field)===t.field),i=e.shadow.querySelector(`[data-row="${t.rowIndex}"][data-col="${o}"]`);i&&i.classList.remove("wg__cell--editing")}}function Sn(e,t,o){H(e,t,o)}function xn(e,t,o){if(!e.grid.isNavigateMode)return;const i=e.grid.focusedCell,r={rowIndex:t,colIndex:o};(i==null?void 0:i.rowIndex)===t&&(i==null?void 0:i.colIndex)===o||(e.grid.setFocusedCell(t,o),Q(e,i,r))}function q(e,t,o){const i=e.grid.focusedCell,r={rowIndex:t,colIndex:o};e.grid.setFocusedCell(t,o),Q(e,i,r),rt(e,t,o)}function ne(e,t,o,i){const r=e.grid.columns[o];if(!r)return;const s=String(r.field);if(!e.grid.canEditCell(t,s))return;e.dropdownOpen&&V(e);const n=e.grid.editingCell;if(n){const l=e.grid.columns.findIndex(a=>String(a.field)===n.field);(n.rowIndex!==t||l!==o)&&(e.isTransitioningCells=!0,e.grid.cancelEdit(),H(e,n.rowIndex,l))}e.grid.startEdit(t,s,i),H(e,t,o,{focusEditor:!0,cursorPosition:i==null?void 0:i.cursorPosition,initialSearchQuery:i==null?void 0:i.initialSearchQuery}),e.isTransitioningCells&&requestAnimationFrame(()=>{e.isTransitioningCells=!1})}function nt(e,t){const o=t.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=e.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 Yo(e){if(e.dropdownOpen&&V(e),e.grid.editingCell){const t=e.grid.editingCell,o=e.grid.columns.findIndex(i=>String(i.field)===t.field);U(e),e.grid.cancelEdit(),o>=0&&H(e,t.rowIndex,o)}if(e.grid.focusedCell){const t=e.grid.focusedCell;e.grid.clearFocusedCell(),Q(e,t,null),Se(e.shadow.host)}}function kn(e,t){if(e.isTransitioningCells)return;const o=t.relatedTarget,i=e.shadow.querySelector(".wg__table");o&&(i!=null&&i.contains(o))||requestAnimationFrame(()=>{if(e.isTransitioningCells)return;const r=e.shadow.activeElement;if(r&&(i==null?void 0:i.contains(r)))return;const n=e.shadow.host;if(document.activeElement===n||n.contains(document.activeElement))return;const a=e.grid.focusedCell;e.grid.clearFocusedCell(),Q(e,a,null),Se(n)})}function En(e,t){if(!e)return null;const[o,i,r]=e.split("-").map(Number),s=new Date(o,i-1,r);if(isNaN(s.getTime()))return null;switch(t){case"date":return s;case"timestamp":return s.getTime();case"iso":default:return e}}function St(e,t,o){H(e,t,o)}async function xt(e,t,o=!1){const i=parseInt(t.dataset.row||"0",10),r=t.dataset.field||"";let s;if(t instanceof HTMLInputElement)if(t.type==="checkbox"){const n=JSON.parse(t.dataset.trueValue||"true"),l=JSON.parse(t.dataset.falseValue||"false");s=t.checked?n:l}else t.classList.contains("wg__editor--number")?s=t.value===""?null:parseFloat(t.value):t.type==="date"?s=En(t.value,t.dataset.outputFormat||"iso"):s=t.value;else t instanceof HTMLSelectElement&&(s=t.value);await e.grid.commitEdit(i,r,s,o)}function Rn(e,t){xt(e,t)}function In(e,t,o){console.trace("[LEGACY] toggleCheckboxAndMove");const i=e.grid.columns[o];if(!i)return;const r=String(i.field),s=e.grid.displayItems[t];if(!s)return;const n=i.editorOptions||{},l=n.trueValue??!0,a=n.falseValue??!1,c=s[r]===l?a:l;e.grid.commitEdit(t,r,c),H(e,t,o);const u=e.grid.displayItems;t<u.length-1&&requestAnimationFrame(()=>{q(e,t+1,o)})}async function Dn(e,t){if(!e.isCommittingFromKeyboard&&e.grid.editingCell){const o=parseInt(t.dataset.row||"0",10),i=t.dataset.field||"",r=e.grid.columns.findIndex(s=>String(s.field)===i);await xt(e,t),r>=0&&St(e,o,r)}}function ro(e,t,o,i){const s=e.grid.columns.findIndex(d=>String(d.field)===o),n=e.grid.displayItems;let l=t,a=s;if(i==="down"){const d=e.grid.tabTraversalStartColIndex;d!==null&&(a=d,e.grid.tabTraversalStartColIndex=null),l=Math.min(t+1,n.length-1)}else if(i==="up")l=Math.max(t-1,0);else{e.grid.tabTraversalStartColIndex===null&&(e.grid.tabTraversalStartColIndex=s);const d=e.grid.getEditableColumns(),c=d.findIndex(u=>u.index===s);i==="next"?c>=0&&c<d.length-1?a=d[c+1].index:t<n.length-1&&(l=t+1,a=d[0].index):c>0?a=d[c-1].index:t>0&&(l=t-1,a=d[d.length-1].index)}St(e,t,s),q(e,l,a),e.isCommittingFromKeyboard=!1}function Tn(e,t,o){const r=e.grid.columns.findIndex(s=>String(s.field)===o);r>=0&&(St(e,t,r),q(e,t,r),e.isCommittingFromKeyboard=!1)}function kt(e,t,o,i){const r=String(i.field),s=e.grid.displayItems[t],n=e.grid.getCellRawValue(s,t,r);switch(i.editor||"text"){case"checkbox":return zn(e,t,r,n,i);case"number":return $n(e,t,r,n,i);case"date":return An(e,t,r,n,i);case"select":return Ln(e,t,r,n,i);case"combobox":return On(e,t,r,n,i);case"autocomplete":return Hn(e,t,r,n,i);case"custom":return Fn(e,t,r,n,i);case"text":default:return Mn(e,t,r,n,i)}}function Uo(e){return`wg__editor--valign-${e.verticalAlign||"middle"}`}function Mn(e,t,o,i,r){var d;const s=r.editorOptions||{},n=(d=e.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 ${Uo(
|
|
426
|
+
class="wg__editor wg__editor--text ${Uo(r)}"
|
|
427
427
|
value="${e.escapeHtml(l)}"
|
|
428
428
|
data-row="${t}"
|
|
429
429
|
data-field="${o}"
|
|
@@ -431,16 +431,16 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
431
431
|
${s.placeholder?`placeholder="${e.escapeHtml(s.placeholder)}"`:""}
|
|
432
432
|
${s.pattern?`pattern="${e.escapeHtml(s.pattern)}"`:""}
|
|
433
433
|
/>
|
|
434
|
-
`}function
|
|
434
|
+
`}function $n(e,t,o,i,r){var a;r.editorOptions;const s=(a=e.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 ${Uo(
|
|
439
|
-
value="${
|
|
438
|
+
class="wg__editor wg__editor--number ${Uo(r)}"
|
|
439
|
+
value="${n}"
|
|
440
440
|
data-row="${t}"
|
|
441
441
|
data-field="${o}"
|
|
442
442
|
/>
|
|
443
|
-
`}function
|
|
443
|
+
`}function An(e,t,o,i,r){var d;const s=r.editorOptions||{},n=(d=e.grid.editingCell)==null?void 0:d.initialSearchQuery,l=no(i),a=n!==void 0?n:Pn(i,s.dateFormat);return`
|
|
444
444
|
<div class="wg__editor wg__editor--date" data-row="${t}" data-field="${o}">
|
|
445
445
|
<input
|
|
446
446
|
type="text"
|
|
@@ -451,15 +451,15 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
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="${
|
|
454
|
+
${s.minDate?`data-min-date="${no(s.minDate)}"`:""}
|
|
455
|
+
${s.maxDate?`data-max-date="${no(s.maxDate)}"`:""}
|
|
456
456
|
placeholder="${e.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
|
|
462
|
+
`}function Pn(e,t){if(!e)return"";let o=null;if(e instanceof Date?o=e:typeof e=="number"?o=new Date(e):typeof e=="string"&&(o=new Date(e)),!o||isNaN(o.getTime()))return"";const i=t||"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 no(e){if(!e)return"";let t=null;if(e instanceof Date?t=e:typeof e=="number"?t=new Date(e):typeof e=="string"&&(t=new Date(e)),!t||isNaN(t.getTime()))return"";const o=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${o}-${i}-${r}`}function zn(e,t,o,i,r){const s=r.editorOptions||{};return`
|
|
463
463
|
<input
|
|
464
464
|
type="checkbox"
|
|
465
465
|
class="wg__editor wg__editor--checkbox"
|
|
@@ -469,7 +469,7 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
469
469
|
data-true-value="${e.escapeHtml(JSON.stringify(s.trueValue??!0))}"
|
|
470
470
|
data-false-value="${e.escapeHtml(JSON.stringify(s.falseValue??!1))}"
|
|
471
471
|
/>
|
|
472
|
-
`}function
|
|
472
|
+
`}function Ln(e,t,o,i,r){var d;const s=r.editorOptions||{},n=s.options||[],l=ot(i,n,s),a=(d=e.grid.editingCell)==null?void 0:d.initialSearchQuery;return e.dropdownOptions=n,e.filterText=a||"",e.highlightedIndex=n.findIndex(c=>Me(c,s)===i),e.highlightedIndex<0&&n.length>0&&(e.highlightedIndex=0),`
|
|
473
473
|
<div
|
|
474
474
|
class="wg__editor wg__editor--select wg__select-trigger"
|
|
475
475
|
tabindex="0"
|
|
@@ -482,7 +482,7 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
482
482
|
<span class="wg__select-value">${e.escapeHtml(l)}</span>
|
|
483
483
|
<span class="wg__select-toggle">▼</span>
|
|
484
484
|
</div>
|
|
485
|
-
`}function
|
|
485
|
+
`}function On(e,t,o,i,r){var c;const s=r.editorOptions||{},n=s.options||[],l=ot(i,n,s),a=(c=e.grid.editingCell)==null?void 0:c.initialSearchQuery,d=a!==void 0?a:l;return e.dropdownOptions=n,e.filterText=d,e.highlightedIndex=n.length>0?0:-1,`
|
|
486
486
|
<div class="wg__editor wg__editor--combobox" data-row="${t}" data-field="${o}">
|
|
487
487
|
<input
|
|
488
488
|
type="text"
|
|
@@ -493,7 +493,7 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
493
493
|
/>
|
|
494
494
|
<span class="wg__combobox-toggle">▼</span>
|
|
495
495
|
</div>
|
|
496
|
-
`}function
|
|
496
|
+
`}function Hn(e,t,o,i,r){var c;const s=r.editorOptions||{},n=s.initialOptions||s.options||[],l=ot(i,n,s),a=(c=e.grid.editingCell)==null?void 0:c.initialSearchQuery,d=a!==void 0?a:l;return e.dropdownOptions=n,e.filterText=d,e.highlightedIndex=n.length>0?0:-1,`
|
|
497
497
|
<div class="wg__editor wg__editor--autocomplete" data-row="${t}" data-field="${o}">
|
|
498
498
|
<input
|
|
499
499
|
type="text"
|
|
@@ -506,7 +506,7 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
506
506
|
<span class="wg__combobox-toggle">▼</span>
|
|
507
507
|
<span class="wg__loading-indicator" style="display: none;">⏳</span>
|
|
508
508
|
</div>
|
|
509
|
-
`}function
|
|
509
|
+
`}function Fn(e,t,o,i,r){const s=r.formatCallback?r.formatCallback(i,e.grid.displayItems[t]):i!=null?String(i):"";return`
|
|
510
510
|
<div
|
|
511
511
|
class="wg__editor wg__editor--custom"
|
|
512
512
|
tabindex="0"
|
|
@@ -515,23 +515,23 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
515
515
|
>
|
|
516
516
|
<span class="wg__custom-value">${e.escapeHtml(s)}</span>
|
|
517
517
|
</div>
|
|
518
|
-
`}function H(e,t,o,i={}){const
|
|
518
|
+
`}function H(e,t,o,i={}){const r=e.grid.columns[o];if(!r)return;const s=e.shadow.querySelector(`td[data-row="${t}"][data-col="${o}"]`);if(!s)return;const n=String(r.field),l=e.grid.displayItems[t];if(!l)return;const a=e.grid.shouldShowEditor(t,o),d=e.grid.isEditing(t,n),c=e.grid.isCellFocused(t,o),u=e.grid.canEditCell(t,n),g=e.grid.isCellInvalid(t,n),h=e.grid.visualColumns.findIndex(y=>y.originalIndex===o),f=h>=0&&e.grid.isColumnFrozen(h),w=f&&h===e.grid.totalFrozenColumns-1,p=r.editTrigger??e.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"),h>=0&&e.grid.isCellInSelectedRange(t,h)&&m.push("wg__cell--in-range"),h>=0&&e.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 y=e.grid.getCellRawValue(l,t,n),v=r.cellClassCallback(y,l);v&&m.push(v)}if(s.className=m.join(" "),a)s.innerHTML=kt(e,t,o,r),i.focusEditor&&qn(e,s,r,i);else{const y=e.grid.getCellValue(l,r,t);s.innerHTML=Xt(e,t,o,r,y,c,u)}}function qn(e,t,o,i){var s;let r=t.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__select-trigger, .wg__date-input");if(r||(r=t.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||e.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 Vn=5;function Nn(e,t){var i,r;switch(t.editor||"text"){case"number":return typeof e=="number"&&!isNaN(e);case"select":case"combobox":{const s=(i=t.editorOptions)==null?void 0:i.options;if(!s||s.length===0)return!0;const n=((r=t.editorOptions)==null?void 0:r.valueMember)||"value";return s.some(l=>l[n]===e)}case"date":{if(e==null||e==="")return!0;if(e instanceof Date)return!isNaN(e.getTime());if(typeof e=="string"){if(!/\d{4}[-/]\d{1,2}[-/]\d{1,2}/.test(e)&&!/\d{1,2}[-/.]\d{1,2}[-/.]\d{2,4}/.test(e))return!1;const s=new Date(e);return!isNaN(s.getTime())}if(typeof e=="number"){const s=new Date("2000-01-01").getTime(),n=new Date("2100-01-01").getTime();if(e<s||e>n)return!1;const l=new Date(e);return!isNaN(l.getTime())}return!1}case"text":case"autocomplete":case"checkbox":case"custom":default:return!0}}let P={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startField:"",startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,handleElement:null,rangeElement:null},ye=null,st=null;function Et(e){var p;const t=e.grid.focusedCell,o=e.shadow.host;if(!t||e.grid.editingCell||e.dropdownOpen){Se(o);return}const{rowIndex:i,colIndex:r}=t,s=(p=e.grid.visualColumns[r])==null?void 0:p.column;if(!s||!e.grid.isCellEditable(s)){Se(o);return}const n=e.shadow.querySelector(`[data-row="${i}"][data-col="${r}"]`);if(!n){Se(o);return}const l=e.shadow.querySelector(".wg");if(!l)return;const a=l.getBoundingClientRect(),d=n.getBoundingClientRect(),c=l.scrollLeft,u=l.scrollTop,g=8,h=i===e.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(P.handleElement&&P.handleElement.parentElement!==l&&(P.handleElement.remove(),P.handleElement=null,st=null),!P.handleElement){const m=document.createElement("div");m.className="wg__fill-handle",l.appendChild(m),P.handleElement=m,st=o,m.addEventListener("mousedown",y=>Bn(e,y))}P.handleElement.style.left=`${f}px`,P.handleElement.style.top=`${w}px`}function Se(e){if(P.handleElement){if(e&&st&&e!==st)return;P.handleElement.remove(),P.handleElement=null,st=null}}function Bn(e,t){var l;t.preventDefault(),t.stopPropagation();const o=e.grid.focusedCell;if(!o)return;const{rowIndex:i,colIndex:r}=o,n=(l=e.grid.visualColumns[r])==null?void 0:l.column;n&&(P={...P,isPending:!0,isDragging:!1,startRowIndex:i,startColIndex:r,startField:String(n.field),startX:t.clientX,startY:t.clientY,currentRowIndex:i,currentColIndex:r},ye=e,document.addEventListener("mousemove",Ko),document.addEventListener("mouseup",Xo),document.addEventListener("keydown",Go))}function Ko(e){if(!ye)return;if(P.isPending){const o=e.clientX-P.startX,i=e.clientY-P.startY;Math.sqrt(o*o+i*i)>=Vn&&Wn(ye);return}if(!P.isDragging)return;const t=Un(ye,e.clientX,e.clientY);t&&(t.rowIndex!==P.currentRowIndex||t.colIndex!==P.currentColIndex)&&(P.currentRowIndex=t.rowIndex,P.currentColIndex=t.colIndex,jo(ye))}function Wn(e){P.isPending=!1,P.isDragging=!0;const t=e.shadow.querySelector(".wg");t==null||t.classList.add("wg--filling"),Yn(e)}function Yn(e){const t=e.shadow.querySelector(".wg");if(!t)return;const o=document.createElement("div");o.className="wg__fill-range",t.appendChild(o),P.rangeElement=o,jo(e)}function jo(e){if(!P.rangeElement)return;const t=e.shadow.querySelector(".wg");if(!t)return;const{startRowIndex:o,startColIndex:i,currentRowIndex:r,currentColIndex:s}=P,n=Math.min(o,r),l=Math.max(o,r),a=Math.min(i,s),d=Math.max(i,s),c=e.shadow.querySelector(`[data-row="${n}"][data-col="${a}"]`),u=e.shadow.querySelector(`[data-row="${l}"][data-col="${d}"]`);if(!c||!u)return;const g=t.getBoundingClientRect(),h=c.getBoundingClientRect(),f=u.getBoundingClientRect(),w=t.scrollLeft,p=t.scrollTop,m=h.left-g.left+w,y=h.top-g.top+p,v=f.right-h.left,x=f.bottom-h.top;P.rangeElement.style.left=`${m}px`,P.rangeElement.style.top=`${y}px`,P.rangeElement.style.width=`${v}px`,P.rangeElement.style.height=`${x}px`}function Xo(e){if(!ye)return;const t=ye;if(P.isPending){so(t);return}P.isDragging&&(jn(t),so(t))}function Go(e){e.key==="Escape"&&ye&&(e.preventDefault(),so(ye))}function Un(e,t,o){if(!e.shadow.querySelector(".wg"))return null;const r=e.shadow.querySelectorAll(".wg__cell[data-row][data-col]");for(const s of r){const n=s.getBoundingClientRect();if(t>=n.left&&t<=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 Kn(e,t,o,i){const r=o-e,s=i-t;return r===0&&s===0?"down":Math.abs(r)>=Math.abs(s)?r>0?"down":"up":s>0?"right":"left"}async function jn(e){var y,v;const{startRowIndex:t,startColIndex:o,currentRowIndex:i,currentColIndex:r,startField:s}=P,n=e.grid.visualColumns,l=(y=n[o])==null?void 0:y.column;if(!l)return;const a=e.grid.getRowDraft(t)??e.grid.displayItems[t];if(!a)return;const d=a[s],c=Kn(t,o,i,r),u=l.fillDirection??e.grid.fillDirection,g=[],h=Math.min(t,i),f=Math.max(t,i),w=u==="vertical"?o:Math.min(o,r),p=u==="vertical"?o:Math.max(o,r);for(let x=h;x<=f;x++)for(let C=w;C<=p;C++){if(x===t&&C===o)continue;const _=(v=n[C])==null?void 0:v.column;if(!_)continue;const S=String(_.field);e.grid.canEditCell(x,S)&&Nn(d,_)&&g.push({rowIndex:x,colIndex:C,field:S})}if(g.length===0)return;const m={sourceCell:{rowIndex:t,colIndex:o,field:s,value:d},targetCells:g,direction:c};if(!(e.grid.fillDragCallback&&e.grid.fillDragCallback(m)===!1))for(const x of g)await e.grid.commitEdit(x.rowIndex,x.field,d),H(e,x.rowIndex,x.colIndex)}function so(e){P.rangeElement&&(P.rangeElement.remove(),P.rangeElement=null);const t=e.shadow.querySelector(".wg");t==null||t.classList.remove("wg--filling"),document.removeEventListener("mousemove",Ko),document.removeEventListener("mouseup",Xo),document.removeEventListener("keydown",Go),P={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startField:"",startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,handleElement:P.handleElement,rangeElement:null},ye=null}function $e(e,t,o,i){var s;V(e);const r=document.createElement("div");if(r.className="wg__dropdown",r.style.cssText=`
|
|
519
519
|
position: fixed;
|
|
520
520
|
top: 0;
|
|
521
521
|
left: 0;
|
|
522
522
|
max-height: 200px;
|
|
523
523
|
overflow-y: auto;
|
|
524
524
|
z-index: 1000;
|
|
525
|
-
`,o.length===0){const
|
|
525
|
+
`,o.length===0){const n=e.isSearching?i.searchingText||e.grid.labels.dropdownSearching:i.noOptionsText||e.grid.labels.dropdownNoOptions;r.innerHTML=`<div class="wg__dropdown-empty">${e.escapeHtml(n)}</div>`}else{const n=e.grid.editingCell,l=n?(s=e.grid.displayItems[n.rowIndex])==null?void 0:s[n.field]:void 0,a=e.getCurrentEditingColumn(),d=(a==null?void 0:a.horizontalAlign)||"left";r.innerHTML=o.map((c,u)=>{const g=u===e.highlightedIndex,h=Me(c,i)===l,f=ae(c,i);if(i.renderOptionCallback){const C={index:u,isHighlighted:g,isSelected:h,isDisabled:f};return i.renderOptionCallback(c,C)}const w=He(c,i),p=dn(c,i),m=cn(c,i),y=["wg__dropdown-option",`wg__dropdown-option--align-${d}`];g&&y.push("wg__dropdown-option--highlighted"),h&&y.push("wg__dropdown-option--selected"),f&&y.push("wg__dropdown-option--disabled");const v=p?`<span class="wg__dropdown-option-icon">${e.escapeHtml(p)}</span>`:"",x=m?`<span class="wg__dropdown-option-subtitle">${e.escapeHtml(m)}</span>`:"";return`<div class="${y.join(" ")}" data-index="${u}" ${f?'data-disabled="true"':""}>
|
|
526
526
|
${v}
|
|
527
527
|
<div class="wg__dropdown-option-content">
|
|
528
528
|
<span class="wg__dropdown-option-label">${e.escapeHtml(w)}</span>
|
|
529
529
|
${x}
|
|
530
530
|
</div>
|
|
531
|
-
</div>`}).join("")}return e.shadow.appendChild(
|
|
532
|
-
.wg__editor--combobox[data-row="${
|
|
533
|
-
.wg__editor--autocomplete[data-row="${
|
|
534
|
-
.wg__autocomplete-input[data-row="${
|
|
531
|
+
</div>`}).join("")}return e.shadow.appendChild(r),e.dropdownOpen=!0,Se(),Ke(t,r,{strategy:"fixed",placement:"bottom-start",middleware:[Wt(1),Ue({fallbackPlacements:["top-start"]}),Mr({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(e){const t=e.shadow.querySelector(".wg__dropdown");t==null||t.remove(),e.dropdownOpen=!1,e.highlightedIndex=-1,e.filterText="",e.dropdownUserInteracted=!1}function Qo(e,t,o=!0,i=!1){var w;const r=e.dropdownOptions[t];if(!r)return;const s=e.grid.editingCell,n=e.grid.focusedCell,l=s?{rowIndex:s.rowIndex,field:s.field,colIndex:e.grid.columns.findIndex(p=>String(p.field)===s.field)}:n?{rowIndex:n.rowIndex,field:String((w=e.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=e.grid.columns[c],g=(u==null?void 0:u.editorOptions)||{};if(ae(r,g))return;const h=Me(r,g),f=e.grid.displayItems[a];g.onselect&&f&&g.onselect(r,f),e.justSelected=!0,e.isCommittingFromKeyboard=!0,V(e),e.grid.commitEdit(a,d,h,i),o?e.moveFocusAfterCommit(a,d,"down"):H(e,a,c),requestAnimationFrame(()=>{e.justSelected=!1})}function ue(e){const t=e.shadow.querySelector(".wg__dropdown");if(!t)return;t.querySelectorAll(".wg__dropdown-option").forEach((i,r)=>{i.classList.toggle("wg__dropdown-option--highlighted",r===e.highlightedIndex)})}function lo(e){const t=e.shadow.querySelector(".wg__dropdown-option--highlighted");t==null||t.scrollIntoView({block:"nearest"})}function ao(e,t){const o=e.shadow.querySelector(".wg__loading-indicator");o&&(o.style.display=t?"inline":"none");const i=e.shadow.querySelector(".wg__editor--autocomplete .wg__combobox-toggle");i&&(i.style.display=t?"none":"inline")}function he(e){var u;if(e.justSelected)return;e.dropdownUserInteracted=!1;const t=e.grid.editingCell,o=e.grid.focusedCell,i=t?{rowIndex:t.rowIndex,field:t.field}:o?{rowIndex:o.rowIndex,field:String((u=e.grid.columns[o.colIndex])==null?void 0:u.field)}:null;if(!i)return;const{rowIndex:r,field:s}=i;let n=e.getCurrentEditingColumn();if(n||(n=e.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(e.filterText){const h=e.filterText.toLowerCase();e.dropdownOptions=g.filter(f=>He(f,l).toLowerCase().includes(h)),d=e.dropdownOptions.length>0?0:-1}else{e.dropdownOptions=g;const h=e.grid.displayItems[r],f=h?h[s]:void 0,w=e.dropdownOptions.findIndex(p=>Me(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=e.grid.displayItems[r],f=h?h[s]:void 0,w=g.findIndex(p=>Me(p,l)===f);if(w>=0)e.dropdownOptions=g,d=w;else if(f!=null&&f!==""){const p=l.valueMember||"value",m=l.displayMember||"label",y=String(f),v={value:f,label:y,[p]:f,[m]:y};e.dropdownOptions=[v,...g],d=0}else e.dropdownOptions=g,d=g.length>0?0:-1}const c=e.shadow.querySelector(`.wg__editor--select[data-row="${r}"][data-field="${s}"],
|
|
532
|
+
.wg__editor--combobox[data-row="${r}"][data-field="${s}"],
|
|
533
|
+
.wg__editor--autocomplete[data-row="${r}"][data-field="${s}"]`);if(c&&e.dropdownOptions.length>0){const g=e.filterText;e.isOpeningDropdown=!0;const h=$e(e,c,e.dropdownOptions,l);Ae(e,h),e.filterText=g,e.highlightedIndex=d,ue(e);const f=e.shadow.querySelector(`.wg__select-trigger[data-row="${r}"][data-field="${s}"]`),w=e.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!==e.shadow.activeElement&&p.focus(),requestAnimationFrame(()=>{e.isOpeningDropdown=!1})}}function Xn(e){e.dropdownOpen?V(e):he(e)}function Ae(e,t){t.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);Qo(e,r,!1)}}),t.addEventListener("mouseover",o=>{const i=o.target.closest(".wg__dropdown-option");i&&!i.hasAttribute("data-disabled")&&(e.highlightedIndex=parseInt(i.getAttribute("data-index")||"0",10),e.dropdownUserInteracted=!0,ue(e))})}function Jo(e,t){const o=t.options||[],i=e.filterText.toLowerCase(),r=e.filterText;e.dropdownOptions=o.filter(n=>He(n,t).toLowerCase().includes(i)),e.highlightedIndex=e.dropdownOptions.length>0?0:-1;const s=e.shadow.querySelector(".wg__editor--select");if(s){const n=$e(e,s,e.dropdownOptions,t);Ae(e,n),e.filterText=r,e.dropdownOptions.length>0&&(e.highlightedIndex=0,ue(e))}}function Gn(e,t){const o=t.target;e.filterText=o.value,e.isUserFiltering=!0;let i=e.getCurrentEditingColumn();if(!i){const l=o.dataset.field;l&&(i=e.grid.columns.find(a=>String(a.field)===l)||null)}if(!i)return;const r=i.editorOptions||{},s=r.options||[];if(e.filterText.trim()){const l=e.filterText.toLowerCase();e.dropdownOptions=s.filter(a=>He(a,r).toLowerCase().includes(l))}else e.dropdownOptions=s;e.highlightedIndex=e.dropdownOptions.length>0?0:-1;const n=o.closest(".wg__editor--combobox");if(n){const l=$e(e,n,e.dropdownOptions,r);Ae(e,l),e.highlightedIndex=e.dropdownOptions.length>0?0:-1,ue(e)}}function Qn(e,t){const o=t.target;e.filterText=o.value;let i=e.getCurrentEditingColumn();if(!i){const a=o.dataset.field;a&&(i=e.grid.columns.find(d=>String(d.field)===a)||null)}if(!i)return;const r=i.editorOptions||{},s=r.debounceMs??300,n=r.minSearchLength??1;e.searchDebounceTimer&&clearTimeout(e.searchDebounceTimer);const l=o.closest(".wg__editor--autocomplete");if(!e.dropdownOpen&&l){e.dropdownOptions=r.initialOptions||[];const a=$e(e,l,e.dropdownOptions,r);Ae(e,a),e.highlightedIndex=e.dropdownOptions.length>0?0:-1,ue(e)}if(e.filterText.length<n){if(e.dropdownOptions=r.initialOptions||[],l){const a=$e(e,l,e.dropdownOptions,r);Ae(e,a),e.highlightedIndex=e.dropdownOptions.length>0?0:-1,ue(e)}return}e.searchDebounceTimer=setTimeout(()=>{Jn(e,e.filterText,i)},s)}async function Jn(e,t,o){const i=o.editorOptions||{};if(!i.searchCallback){const s=i.initialOptions||i.options||[],n=t.toLowerCase();e.dropdownOptions=s.filter(a=>He(a,i).toLowerCase().includes(n)),e.highlightedIndex=e.dropdownOptions.length>0?0:-1;const l=e.grid.editingCell;if(l){const{rowIndex:a,field:d}=l,c=e.shadow.querySelector(`.wg__editor--autocomplete[data-row="${a}"][data-field="${d}"]`);if(c){const u=$e(e,c,e.dropdownOptions,i);Ae(e,u),ue(e)}}return}e.searchAbortController&&e.searchAbortController.abort(),e.searchAbortController=new AbortController;const r=e.searchAbortController.signal;e.isSearching=!0,ao(e,!0);try{const s=e.grid.editingCell;if(!s)return;const n=e.grid.displayItems[s.rowIndex],l=await i.searchCallback(t,n,r);if(!r.aborted){e.isSearching=!1,ao(e,!1),e.dropdownOptions=l;const{rowIndex:a,field:d}=s,c=e.shadow.querySelector(`.wg__editor--autocomplete[data-row="${a}"][data-field="${d}"]`);if(c){const u=$e(e,c,e.dropdownOptions,i);Ae(e,u),e.highlightedIndex=l.length>0?0:-1,ue(e)}}}catch(s){if(s instanceof Error&&s.name==="AbortError")return;console.error("Autocomplete search failed:",s),e.isSearching=!1,ao(e,!1),e.dropdownOptions=[];const n=e.grid.editingCell;if(n){const{rowIndex:l,field:a}=n,d=e.shadow.querySelector(`.wg__editor--autocomplete[data-row="${l}"][data-field="${a}"]`);if(d){const c=$e(e,d,e.dropdownOptions,i);Ae(e,c)}}}}function co(e,t,o,i,r){const s=i??e.tooltipShowDelay;e.tooltipHideTimer&&(clearTimeout(e.tooltipHideTimer),e.tooltipHideTimer=null),!(e.tooltipElement&&e.tooltipAnchor===t)&&(e.tooltipShowTimer&&clearTimeout(e.tooltipShowTimer),e.tooltipShowTimer=setTimeout(()=>{Zn(e,t,o,r)},s))}function Zo(e,t){const o=t??e.tooltipHideDelay;e.tooltipShowTimer&&(clearTimeout(e.tooltipShowTimer),e.tooltipShowTimer=null),e.tooltipElement&&(e.tooltipHideTimer=setTimeout(()=>{e.tooltipElement&&(e.tooltipElement.classList.remove("wg__tooltip--visible"),setTimeout(()=>{var i;(i=e.tooltipElement)==null||i.remove(),e.tooltipElement=null,e.tooltipArrowElement=null,e.tooltipAnchor=null},100))},o))}function Zn(e,t,o,i){var l;(l=e.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),e.shadow.appendChild(r),e.tooltipElement=r,e.tooltipArrowElement=n,e.tooltipAnchor=t,Ke(t,r,{strategy:"absolute",placement:"top",middleware:[Wt(8),Ue({fallbackPlacements:["bottom","left","right"]}),$r({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 es=`
|
|
535
535
|
.wg-context-menu-container {
|
|
536
536
|
position: fixed;
|
|
537
537
|
z-index: var(--wg-cm-z-index, 10000);
|
|
@@ -660,13 +660,13 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
660
660
|
.wg-context-menu__item--toggle.wg-context-menu__item--checked .wg-context-menu__icon {
|
|
661
661
|
opacity: 1;
|
|
662
662
|
}
|
|
663
|
-
`;let ei=!1;function ti(){if(ei)return;const e=document.createElement("style");e.id="wg-context-menu-styles",e.textContent=Zr,document.head.appendChild(e),ei=!0}function es(e,t){const o=e.filter(n=>n.visible===void 0?!0:typeof n.visible=="function"?n.visible(t):n.visible);return o.length===0?"":`<div class="wg-context-menu">${o.map((n,s)=>{const r=typeof n.label=="function"?n.label(t):n.label,l=typeof n.icon=="function"?n.icon(t):n.icon,a=n.shortcut,d=typeof n.disabled=="function"?n.disabled(t):n.disabled,c=n.danger===!0,u=["wg-context-menu__item",d?"wg-context-menu__item--disabled":"",c?"wg-context-menu__item--danger":""].filter(Boolean).join(" "),g=n.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="${n.id}" data-disabled="${d?"true":"false"}" data-shortcut="${a||""}">${h}<span class="wg-context-menu__label">${r}</span>${f}</div>`}).join("")}</div>`}function ts(e,t,o,i,n,s,r,l,a){ti();const d=es(s,r);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"),g=t+i,h=o+n;Ke({getBoundingClientRect:()=>({width:0,height:0,x:g,y:h,top:h,left:g,right:g,bottom:h})},u,{placement:"bottom-start",middleware:[Ue({fallbackPlacements:["top-start","bottom-end","top-end"]}),bt({padding:8})]}).then(({x:v,y:x})=>{Object.assign(u.style,{left:`${v}px`,top:`${x}px`})}),c.addEventListener("click",v=>{const x=v.target.closest(".wg-context-menu__item");if(x&&x.dataset.disabled!=="true"){const C=x.dataset.itemId||"";l(C)}});const w=e.scrollEvents.subscribe("window",()=>{p(),a()}),p=()=>{w.unsubscribe(),document.removeEventListener("mousedown",m),document.removeEventListener("keydown",y),c.remove()},m=v=>{c.contains(v.target)||(p(),a())},y=v=>{if(v.key==="Escape"){v.preventDefault(),p(),a();return}const x=v.key.toLowerCase(),C=c.querySelectorAll(".wg-context-menu__item");for(const _ of C){const S=_.dataset.shortcut;if(_.dataset.disabled==="true"||!S)continue;if(S.toLowerCase()===x||S===v.key){v.preventDefault();const k=_.dataset.itemId||"";l(k),p(),a();return}}};return setTimeout(()=>{document.addEventListener("mousedown",m),document.addEventListener("keydown",y)},0),c._cleanup=p,c}function de(e,t,o){const i=e._cleanup;if(typeof i=="function"){i();return}e.remove()}const os={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 oi(e,t){const o=[];let i=!1;for(let n=0;n<e.length;n++){const s=e[n];if(typeof s=="string"){const r=os[s];if(!r){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:r.icon,label:t.labels.contextMenu[r.labelKey],danger:r.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-${n}`,...s,dividerBefore:i||s.dividerBefore}),i=!1)}return o}function ii(e,t,o,i=!1){var y,v;const n=typeof e.label=="function"?e.label(t):e.label,s=typeof e.icon=="function"?e.icon(t):e.icon,r=e.shortcut,l=typeof e.disabled=="function"?e.disabled(t):e.disabled,a=e.danger===!0,d=((y=e.children)==null?void 0:y.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,_)=>ii(C,t,_,!0)).join("")}</div>`);const g=i&&((v=e.id)==null?void 0:v.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=r?`<span class="wg-context-menu__shortcut">${r}</span>`:"";return`${w}<div class="${f}" data-item-id="${e.id}" data-disabled="${l?"true":"false"}" data-shortcut="${r||""}">${p}<span class="wg-context-menu__label">${n}</span>${m}${u}</div>`}function ni(e,t){const o=e.filter(n=>n.visible===void 0?!0:typeof n.visible=="function"?n.visible(t):n.visible);return o.length===0?"":`<div class="wg-context-menu">${o.map((n,s)=>ii(n,t,s)).join("")}</div>`}function is(e,t,o,i=!1){const{field:n,columnIndex:s}=o;switch(t){case"sortAsc":case"sortDesc":{const r=t==="sortAsc"?"asc":"desc",l=[...e.grid.sort];if(i&&e.grid.sortMode==="multi"){const a=l.findIndex(d=>d.column===n);a>=0?l[a]={column:n,direction:r}:l.push({column:n,direction:r}),e.grid.sort=l}else e.grid.sort=[{column:n,direction:r}];break}case"clearSort":e.grid.sort=e.grid.sort.filter(r=>r.column!==n);break;case"hideColumn":{const r=e.grid.columns.find(l=>String(l.field)===n);r&&(r.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 ri(e,t,o,i,n,s,r){ti();const l=ni(i,n);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");Ke({getBoundingClientRect:()=>({width:0,height:0,x:t,y:o,top:o,left:t,right:t,bottom:o})},d,{placement:"bottom-start",middleware:[Ue({fallbackPlacements:["top-start","bottom-end","top-end"]}),bt({padding:8})]}).then(({x:w,y:p})=>{Object.assign(d.style,{left:`${w}px`,top:`${p}px`})}),a.addEventListener("click",w=>{const p=w.target.closest(".wg-context-menu__item");if(!p||p.dataset.disabled==="true")return;const m=p.dataset.itemId||"",y=w.ctrlKey;if(!p.classList.contains("wg-context-menu__item--has-submenu")){if(m.startsWith("toggle-col-")||m==="show-all-columns"){s(m,!0,y);const v=ni(i,n),x=document.createElement("div");x.innerHTML=v;const C=x.querySelector(".wg-context-menu");if(C&&d.parentNode){C.style.left=d.style.left,C.style.top=d.style.top,d.parentNode.replaceChild(C,d),d=C;const _=C.querySelector(".wg-context-menu--submenu");_&&(_.style.display="block")}return}s(m,!1,y)}});const u=e.scrollEvents.subscribe("window",()=>{g(),r()}),g=()=>{u.unsubscribe(),document.removeEventListener("mousedown",h),document.removeEventListener("keydown",f),a.remove()},h=w=>{a.contains(w.target)||(g(),r())},f=w=>{if(w.key==="Escape"){w.preventDefault(),g(),r();return}const p=w.key.toLowerCase(),m=a.querySelectorAll(".wg-context-menu__item");for(const y of m){const v=y.dataset.shortcut;if(y.dataset.disabled==="true"||!v)continue;if(v.toLowerCase()===p||v===w.key){w.preventDefault();const _=y.dataset.itemId||"";s(_),g(),r();return}}};return setTimeout(()=>{document.addEventListener("mousedown",h),document.addEventListener("keydown",f)},0),a._cleanup=g,a}function lt(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 n=i.toLowerCase();n==="ctrl"||n==="control"?o.ctrl=!0:n==="shift"?o.shift=!0:n==="alt"?o.alt=!0:n==="meta"||n==="cmd"||n==="command"?o.meta=!0:o.key=i}return o}function at(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 ns(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 rs(e){const{scrollTop:t,viewportHeight:o,rowHeight:i,buffer:n,totalItems:s,editingRowIndex:r}=e;let l=Math.max(0,Math.floor(t/i)-n);const a=Math.ceil(o/i)+n*2;let d=Math.min(s,l+a);return r!==void 0&&(r<l&&(l=r),r>=d&&(d=r+1)),{startIndex:l,endIndex:d}}function ss(e){const{targetRow:t,rowHeight:o,buffer:i,totalItems:n,viewportHeight:s,scrollHeight:r,clientHeight:l}=e,a=Math.max(0,(t-1)*o),d=Math.max(0,r-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(n,u+g);return t<u&&(u=t),t>=h&&(h=t+1),{scrollTop:c,startIndex:u,endIndex:h}}function ls(e,t,o,i){return t-(e+o)<=i}function as(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],n=i.findIndex(r=>r.column===o);(t.ctrlKey||t.metaKey)&&e.grid.sortMode==="multi"?n>=0?i[n].direction==="asc"?i[n]={column:o,direction:"desc"}:i.splice(n,1):i.push({column:o,direction:"asc"}):n>=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 ds(e,t){const i=t.target.closest(".wg__pagination-btn");if(!i||i.hasAttribute("disabled"))return!1;const n=i.dataset.action;let s=!1;return n==="first"&&e.grid.currentPage!==1?(e.grid.currentPage=1,s=!0):n==="prev"&&e.grid.currentPage>1?(e.grid.currentPage--,s=!0):n==="next"&&e.grid.currentPage<e.grid.totalPages?(e.grid.currentPage++,s=!0):n==="last"&&e.grid.currentPage!==e.grid.totalPages&&(e.grid.currentPage=e.grid.totalPages,s=!0),s&&e.grid.fireDataRequest("page"),s}function cs(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 W={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},xe=null;function si(e,t){if(!e)return t;const o=parseFloat(e);return isNaN(o)?t:o}function gs(e,t,o){const i=t.target,n=i.closest(".wg__header");if(!n)return;const s=e.grid.columns.find(a=>String(a.field)===o);if(!s||s.isResizable===!1)return;const r=n.getBoundingClientRect().width;W={isResizing:!0,startX:t.clientX,startWidth:r,field:o,headerCell:n,minWidth:si(s.minWidth,30),maxWidth:s.maxWidth?si(s.maxWidth,1/0):null},xe=e,s.minWidth?n.style.minWidth=s.minWidth:n.style.minWidth=`${W.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",li),document.addEventListener("mouseup",ai),t.preventDefault()}function li(e){if(!W.isResizing||!xe)return;const t=e.clientX-W.startX;let o=W.startWidth+t;o=Math.max(o,W.minWidth),W.maxWidth!==null&&(o=Math.min(o,W.maxWidth)),W.headerCell&&(W.headerCell.style.width=`${o}px`,W.headerCell.style.maxWidth=`${o}px`),us(xe,W.field,`${o}px`),(xe.grid.freezeColumns>0||xe.grid.isStickyRowNumbers)&&fs(xe)}function ai(e){if(!W.isResizing||!xe)return;const t=xe,o=W.field,i=`${W.startWidth}px`,n=e.clientX-W.startX;let s=W.startWidth+n;s=Math.max(s,W.minWidth),W.maxWidth!==null&&(s=Math.min(s,W.maxWidth));const r=`${s}px`;t.grid.setColumnWidth(o,r,!0);const l=t.shadow.querySelector(`col[data-field="${o}"]`);l&&(l.style.width=r);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:r,allWidths:t.grid.getColumnWidthsState()}),t.grid.shouldPersistColumnWidths&&t.grid.gridName&&t.grid.savePersistedWidths(),document.removeEventListener("mousemove",li),document.removeEventListener("mouseup",ai),W={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},xe=null}function us(e,t,o){e.shadow.querySelectorAll(`td[data-field="${t}"]`).forEach(n=>{n.style.width=o,n.style.maxWidth=o})}const hs=40;function fs(e){const t=e.grid.freezeColumns;let i=e.grid.isRowNumbersVisible&&e.grid.isStickyRowNumbers?hs:0;const n=e.grid.visualColumns;for(let s=0;s<t&&s<n.length;s++){const{column:r}=n[s],l=String(r.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 ws=5;let O={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},ke=null,Rt=!1;function di(){return Rt?(Rt=!1,!0):O.isReordering}function ps(e,t,o){var c;const i=t.target,n=i.closest(".wg__header");if(!n||i.classList.contains("wg__resize-handle"))return;const s=e.grid.visualColumns,r=e.grid.totalFrozenColumns,l=s.findIndex(u=>String(u.column.field)===o);if(l<r)return;const a=(c=s[l])==null?void 0:c.column;if((a==null?void 0:a.isMovable)===!1)return;const d=l-r;O={isPending:!0,isReordering:!1,field:o,startX:t.clientX,startY:t.clientY,headerCell:n,ghost:null,dropIndicator:null,fromIndex:d,currentDropIndex:d},ke=e,document.addEventListener("mousemove",ci),document.addEventListener("mouseup",gi),t.preventDefault()}function ms(e,t,o){var n;const i=document.createElement("div");i.className="wg__reorder-ghost",i.textContent=((n=t.querySelector(".wg__header-title"))==null?void 0:n.textContent)||"",i.style.left=`${o.clientX+10}px`,i.style.top=`${o.clientY-10}px`,e.shadow.appendChild(i),O.ghost=i}function bs(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 _s(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&&ms(e,O.headerCell,t),bs(e)}function ci(e){if(!ke)return;if(O.isPending){const i=e.clientX-O.startX,n=e.clientY-O.startY;Math.sqrt(i*i+n*n)>=ws&&_s(ke,e);return}if(!O.isReordering||!ke.shadow.querySelector(".wg"))return;O.ghost&&(O.ghost.style.left=`${e.clientX+10}px`,O.ghost.style.top=`${e.clientY-10}px`);const o=ys(ke,e.clientX);o!==O.currentDropIndex&&(O.currentDropIndex=o,Cs(ke,o))}function vs(e){const t=e.grid.visualColumns,o=e.grid.totalFrozenColumns,i=t.slice(o);let n=0;for(let s=0;s<i.length;s++)i[s].column.isMovable===!1&&(n=s+1);return n}function ys(e,t){const o=e.grid.visualColumns,i=e.grid.totalFrozenColumns,n=o.slice(i);if(n.length===0)return 0;const s=vs(e),r=String(n[0].column.field),l=e.shadow.querySelector(`th[data-field="${r}"]`);if(l){const a=l.getBoundingClientRect();if(t<a.left)return s}for(let a=0;a<n.length;a++){const d=String(n[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 n.length}function Cs(e,t){const o=O.dropIndicator;if(!o)return;const i=e.grid.visualColumns,n=e.grid.totalFrozenColumns,s=i.slice(n),r=e.shadow.querySelector(".wg"),l=r==null?void 0:r.getBoundingClientRect();if(!l||!r)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+r.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+r.scrollLeft;else return}const d=r.scrollTop,c=r.clientHeight;o.style.left=`${a}px`,o.style.top=`${d}px`,o.style.height=`${c}px`,o.style.display="block"}function gi(e){if(!ke)return;const t=ke;if(O.isPending){ui(t);return}if(!O.isReordering)return;const o=O.field,i=O.fromIndex,n=O.currentDropIndex;if(i!==n&&n!==i+1){const s=n>i?n-1:n;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()}Rt=!0,requestAnimationFrame(()=>{Rt=!1}),ui(t)}function ui(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",ci),document.removeEventListener("mouseup",gi),O={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},ke=null}function Ss(){const e=new Set,t=new Set;let o=null,i=!1;const n=()=>{e.forEach(r=>r())},s=()=>{t.forEach(r=>r())};return{subscribe(r,l){const a=r==="container"?e:t;return a.add(l),{unsubscribe:()=>{a.delete(l)}}},init(r){o=r,r.addEventListener("scroll",n),i||(window.addEventListener("scroll",s,{capture:!0,passive:!0}),i=!0)},destroy(){o&&(o.removeEventListener("scroll",n),o=null),i&&(window.removeEventListener("scroll",s,!0),i=!1),e.clear(),t.clear()}}}function xs(e,t){const o=new Set,i=new Set;let n=null;const s=l=>{const a=l.target,d=l.relatedTarget;o.forEach(c=>c(a,d))},r=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){n=l,l.addEventListener("blur",s,!0),l.addEventListener("focusout",r)},destroy(){n&&(n.removeEventListener("blur",s,!0),n.removeEventListener("focusout",r),n=null),o.clear(),i.clear()}}}function ks(){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 n=(a,d)=>{for(const c of e[a])if(c(d)===!0)return!0;return!1},s=()=>{setTimeout(()=>{i&&(i=!1)},10)},r=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),n("sortClick",g);return}}f?(g.rowIndex=parseInt(f.dataset.rowNumber||"-1",10),n("rowNumberClick",g)):w&&!u.closest(".wg__resize-handle")?(g.field=w.dataset.field,g.colIndex=parseInt(w.dataset.colIndex||"-1",10),n("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),n("cellClick",g)):u.closest(".wg__toolbar, button, input, select, textarea")||n("emptyAreaClick",g)},l=a=>{if(!t)return;if(i){i=!1;return}const d=a,c=d.target;(d.composedPath?d.composedPath():[]).includes(t)||n("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",r),d.addEventListener("mouseup",s),o||(document.addEventListener("click",l,!0),o=!0)},destroy(){t&&(t.removeEventListener("mousedown",r),t.removeEventListener("mouseup",s)),o&&(document.removeEventListener("click",l,!0),o=!1),t=null,i=!1,Object.values(e).forEach(a=>a.clear())}}}const Es=5;let $={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,rangeBorder:null},se=null,dt=null,Ge=null;function Rs(){return $.isPending}function hi(e,t,o,i){var l;const n=i.shiftKey&&e.grid.cellSelectionMode==="shift";e.grid.selectedCellRange&&!n&&(e.grid.clearCellSelection(),X()),(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},se=e,document.addEventListener("mousemove",fi),document.addEventListener("mouseup",pi),document.addEventListener("keydown",mi))}function Is(e,t,o){var i,n;if(X(),e.grid.lastClickedCell){const{rowIndex:s,colIndex:r}=e.grid.lastClickedCell,l=e.grid.visualColumns,a=(i=l[r])==null?void 0:i.column,d=(n=l[o])==null?void 0:n.column;if(a&&d){const c={startRowIndex:s,startColIndex:r,endRowIndex:t,endColIndex:o,startField:String(a.field),endField:String(d.field)};e.grid.clearFocusedCell(),e.grid.selectCellRange(c),It(e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const u=e.shadow.querySelector(".wg");u==null||u.focus({preventScroll:!0})})})}}else e.grid.lastClickedCell={rowIndex:t,colIndex:o}}function fi(e){if(se){if($.isPending){const t=e.clientX-$.startX,o=e.clientY-$.startY;Math.sqrt(t*t+o*o)>=Es&&Ts(se);return}$.isDragging&&(dt=e,Ge||(Ge=requestAnimationFrame(Ds)))}}function Ds(){if(Ge=null,!dt||!se)return;const e=dt;dt=null;const t=Ms(se,e.clientX,e.clientY);if(t&&(t.rowIndex!==$.currentRowIndex||t.colIndex!==$.currentColIndex)){$.currentRowIndex=t.rowIndex,$.currentColIndex=t.colIndex;const o=bi(se);wi(se),_i(se,o)}}function Ts(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(),Q(e,o,null);const i=e.grid.focusedRowIndex;if(i!==null){const n=e.shadow.querySelector(`tr[data-row-index="${i}"]`);n==null||n.classList.remove("wg__row--focused"),e.grid.clearRowFocus()}wi(e),vi(e)}function wi(e){const{startRowIndex:t,startColIndex:o,currentRowIndex:i,currentColIndex:n}=$,s=Math.min(t,i),r=Math.max(t,i),l=Math.min(o,n),a=Math.max(o,n);e.shadow.querySelectorAll(".wg__cell--in-range").forEach(c=>c.classList.remove("wg__cell--in-range"));for(let c=s;c<=r;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(!se)return;const t=se;if($.isPending){e.shiftKey&&t.grid.cellSelectionMode==="shift"&&t.grid.lastClickedCell?Is(t,$.startRowIndex,$.startColIndex):t.grid.lastClickedCell={rowIndex:$.startRowIndex,colIndex:$.startColIndex},Dt(t);return}if(!$.isDragging)return;if($.startRowIndex===$.currentRowIndex&&$.startColIndex===$.currentColIndex){t.shadow.querySelectorAll(".wg__cell--in-range").forEach(r=>r.classList.remove("wg__cell--in-range")),X();const{startRowIndex:n,startColIndex:s}=$;t.grid.setFocusedCell(n,s),Q(t,null,{rowIndex:n,colIndex:s}),nt(t,n,s),Dt(t)}else $s(t),Dt(t),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=t.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})})}function mi(e){if(e.key==="Escape"&&se){e.preventDefault();const t=se;if($.isDragging){t.shadow.querySelectorAll(".wg__cell--in-range").forEach(s=>s.classList.remove("wg__cell--in-range")),X();const{startRowIndex:i,startColIndex:n}=$;t.grid.setFocusedCell(i,n),Q(t,null,{rowIndex:i,colIndex:n}),nt(t,i,n)}Dt(t)}}function Ms(e,t,o){const i=e.shadow.elementFromPoint(t,o);if(!i)return null;const n=i.closest(".wg__cell[data-row][data-col]");if(!n)return null;const s=parseInt(n.dataset.row||"-1",10),r=parseInt(n.dataset.col||"-1",10);return s>=0&&r>=0?{rowIndex:s,colIndex:r}:null}function $s(e){var d,c;const{startRowIndex:t,startColIndex:o,currentRowIndex:i,currentColIndex:n}=$,s=e.grid.visualColumns,r=(d=s[o])==null?void 0:d.column,l=(c=s[n])==null?void 0:c.column;if(!r||!l)return;const a={startRowIndex:t,startColIndex:o,endRowIndex:i,endColIndex:n,startField:String(r.field),endField:String(l.field)};e.grid.clearFocusedCell(),e.grid.selectCellRange(a),It(e)}function bi(e){const{startRowIndex:t,startColIndex:o,currentRowIndex:i,currentColIndex:n}=$,s=e.shadow.querySelector(".wg");if(!s)return null;const r=Math.min(t,i),l=Math.max(t,i),a=Math.min(o,n),d=Math.max(o,n),c=e.shadow.querySelector(`[data-row="${r}"][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 _i(e,t){if(!t){X();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=bi(e);_i(e,t)}function It(e){X();const t=e.grid.selectedCellRange;if(!t)return;const o=e.shadow.querySelector(".wg");if(!o)return;const{startRowIndex:i,endRowIndex:n,startColIndex:s,endColIndex:r}=t,l=Math.min(i,n),a=Math.max(i,n),d=Math.min(s,r),c=Math.max(s,r),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,y=f.left-h.left+p-o.clientLeft,v=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=`${y}px`,_.style.top=`${v}px`,_.style.width=`${x}px`,_.style.height=`${C}px`,o.appendChild(_),$.rangeBorder=_}function yi(e){$.rangeBorder&&(X(),$.isDragging?vi(e):It(e))}function X(){$.rangeBorder&&($.rangeBorder.remove(),$.rangeBorder=null)}function Dt(e){const t=e.shadow.querySelector(".wg");t==null||t.classList.remove("wg--selecting-cells"),Ge&&(cancelAnimationFrame(Ge),Ge=null),dt=null,document.removeEventListener("mousemove",fi),document.removeEventListener("mouseup",pi),document.removeEventListener("keydown",mi),$={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,rangeBorder:$.rangeBorder},se=null}const As=5;let fe={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},Ae=null;function Ps(e,t,o){if(o.preventDefault(),o.stopPropagation(),Yo(e),e.grid.selectedCellRange&&(e.grid.clearCellSelection(),X()),e.grid.focusedCell){const{rowIndex:i,colIndex:n}=e.grid.focusedCell,s=e.shadow.querySelector(`.wg__cell[data-row="${i}"][data-col="${n}"]`);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}fe={isPending:!0,isDragging:!1,startRowIndex:t,startX:o.clientX,startY:o.clientY,currentRowIndex:t},Ae=e,e.grid.selectRow(t,"replace"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=e.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})}),document.addEventListener("mousemove",Ci),document.addEventListener("mouseup",Si)}function Ci(e){if(!Ae)return;if(fe.isPending){const o=e.clientX-fe.startX,i=e.clientY-fe.startY;Math.sqrt(o*o+i*i)>=As&&zs(Ae);return}if(!fe.isDragging)return;const t=Ls(Ae,e.clientY);t!==null&&t!==fe.currentRowIndex&&(fe.currentRowIndex=t,Ae.grid.selectRowRange(fe.startRowIndex,t))}function zs(e){fe.isPending=!1,fe.isDragging=!0;const t=e.shadow.querySelector(".wg");t==null||t.classList.add("wg--selecting")}function Si(){if(!Ae)return;const e=Ae,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",Ci),document.removeEventListener("mouseup",Si),fe={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},Ae=null}function Ls(e,t){const o=e.shadow.querySelectorAll(".wg__row[data-row-index]");for(const i of o){const n=i.getBoundingClientRect();if(t>=n.top&&t<=n.bottom){const s=parseInt(i.dataset.rowIndex||"-1",10);if(s>=0)return s}}if(o.length>0){const i=o[0],n=o[o.length-1],s=i.getBoundingClientRect(),r=n.getBoundingClientRect();if(t<s.top)return parseInt(i.dataset.rowIndex||"0",10);if(t>r.bottom)return parseInt(n.dataset.rowIndex||"0",10)}return null}let Tt=[],Mt=[];function xi(e){if(e.length===0)return[];const t=[...e].sort((s,r)=>s-r),o=[];let i=t[0],n=t[0];for(let s=1;s<t.length;s++)t[s]===n+1||(o.push({start:i,end:n}),i=t[s]),n=t[s];return o.push({start:i,end:n}),o}function ki(e,t,o,i,n,s){const r=document.createElement("div");return r.className=s,r.style.left=`${t}px`,r.style.top=`${o}px`,r.style.width=`${i}px`,r.style.height=`${n}px`,e.appendChild(r),r}function Ei(e){Qe();const t=e.grid.selectedRows;if(t.length===0)return;const o=e.shadow.querySelector(".wg");if(!o)return;const i=xi(t),n=e.grid.visualColumns;if(n.length===0)return;const s=o.getBoundingClientRect(),r=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=n.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+r-o.clientLeft,w=g.top-s.top+l-o.clientTop,p=h.right-g.left,m=h.bottom-g.top,y=ki(o,f,w,p,m,"wg__row-selection-border");Tt.push(y)}}function Ri(e){Je();const t=e.grid.selectedColumns;if(t.length===0)return;const o=e.shadow.querySelector(".wg");if(!o)return;const i=xi(t),n=e.grid.displayItems,s=e.grid.visualColumns;if(n.length===0||s.length===0)return;const r=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=n.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 y=f.getBoundingClientRect(),v=m.getBoundingClientRect(),x=p.getBoundingClientRect(),C=y.left-r.left+l-o.clientLeft,_=y.top-r.top+a-o.clientTop,S=v.right-y.left,E=x.bottom-y.top,I=ki(o,C,_,S,E,"wg__column-selection-border");Mt.push(I)}}function Os(e){Tt.length>0&&Ei(e),Mt.length>0&&Ri(e)}function Qe(){for(const e of Tt)e.remove();Tt=[]}function Je(){for(const e of Mt)e.remove();Mt=[]}function Hs(){Qe(),Je()}const Fs=5;let we={isPending:!1,isDragging:!1,startColIndex:-1,startX:0,startY:0,currentColIndex:-1},Pe=null;function qs(e,t,o){if(o.preventDefault(),o.stopPropagation(),Yo(e),e.grid.selectedCellRange&&(e.grid.clearCellSelection(),X()),o.ctrlKey||o.metaKey){e.grid.selectColumn(t,"toggle"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=e.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})});return}we={isPending:!0,isDragging:!1,startColIndex:t,startX:o.clientX,startY:o.clientY,currentColIndex:t},Pe=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",Ii),document.addEventListener("mouseup",Di)}function Ii(e){if(!Pe)return;if(we.isPending){const o=e.clientX-we.startX,i=e.clientY-we.startY;Math.sqrt(o*o+i*i)>=Fs&&Vs(Pe);return}if(!we.isDragging)return;const t=Ns(Pe,e.clientX);t!==null&&t!==we.currentColIndex&&(we.currentColIndex=t,Pe.grid.selectColumnRange(we.startColIndex,t))}function Vs(e){we.isPending=!1,we.isDragging=!0;const t=e.shadow.querySelector(".wg");t==null||t.classList.add("wg--selecting-columns")}function Di(){if(!Pe)return;const e=Pe,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",Ii),document.removeEventListener("mouseup",Di),we={isPending:!1,isDragging:!1,startColIndex:-1,startX:0,startY:0,currentColIndex:-1},Pe=null}function Ns(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 n of o){const s=n.getBoundingClientRect();if(t>=s.left&&t<=s.right){const r=n.dataset.field;if(r){const l=i.findIndex(a=>String(a.column.field)===r);if(l>=0)return l}}}if(o.length>0){const n=o[0],s=o[o.length-1],r=n.getBoundingClientRect(),l=s.getBoundingClientRect();if(t<r.left){const a=n.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 Bs(e){const t=[];let o=[],i="",n=!1;for(let s=0;s<e.length;s++){const r=e[s],l=e[s+1];n?r==='"'?l==='"'?(i+='"',s++):n=!1:i+=r:r==='"'?n=!0:r===" "?(o.push(i),i=""):r===`
|
|
664
|
-
`||
|
|
665
|
-
`?(o.push(i),o.some(a=>a!=="")&&t.push(o),o=[],i="",r==="\r"&&s++):r!=="\r"&&(i+=r)}return(i!==""||o.length>0)&&(o.push(i),o.some(s=>s!=="")&&t.push(o)),t}function Ws(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 n=[];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++,n.push({pastedHeader:a,gridField:c.field,colIndex:c.colIndex}))}const r=e.filter(a=>a.trim()!=="").length,l=Math.max(2,Math.floor(r*.5));return s>=l?n:null}async function Ys(e,t,o,i){var _;const n=e.grid,s=Bs(t);if(s.length===0)return{totalCells:0,successfulCells:0,failedCells:0,skippedCells:0,newRowsCreated:0,cellResults:[],hadHeaders:!1};const r=Ws(s[0],n.columns),l=r!==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=n.visualColumns,c=n.isEmptyRowIndex(o),u=n.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:r,targetRowIndex:o,targetColIndex:i,newRowsCount:g,cancel:!1,skipCells:new Set};if(n.onbeforepaste&&(n.onbeforepaste(h),h.cancel))return{totalCells:a.reduce((S,E)=>S+E.length,0),successfulCells:0,failedCells:0,skippedCells:a.reduce((S,E)=>S+E.length,0),newRowsCreated:0,cellResults:[],hadHeaders:l};let f=0,w=u;if(g>0){const S=[];for(let E=0;E<g;E++){const I=c?E:u+E-o,k=a[I],R={};l&&r?k==null||k.forEach((z,D)=>{const L=r[D];L&&(R[L.gridField]=z)}):k==null||k.forEach((z,D)=>{const L=i+D;if(L<d.length){const K=String(d[L].column.field);R[K]=z}});let M;n.createRowCallback?M=n.createRowCallback(R,u+E):M=R,S.push(M),f++}c&&n.newRowPosition==="top"?(n.items=[...S,...n.items],w=0):(n.items=[...n.items,...S],w=u)}const p=[],m=n.pasteMode;for(let S=0;S<a.length;S++){const E=a[S],I=c?w+S:o+S,k=c?n.newRowPosition==="top"?1+S:n.items.length-a.length+S:o+S,R=I;for(let M=0;M<E.length;M++){const z=E[M];let D,L;if(l&&r){const j=r[M];if(!j)continue;D=j.gridField,L=j.colIndex}else{if(L=i+M,L>=d.length){p.push({rowIndex:k,field:"",value:z,isValid:!1,wasSkipped:!0,skipReason:"out-of-bounds"});continue}D=String(d[L].column.field)}const K=`${S}-${M}`;if(h.skipCells.has(K)){p.push({rowIndex:k,field:D,value:z,isValid:!0,wasSkipped:!0,skipReason:"user-canceled"});continue}const T=n.columns.find(j=>String(j.field)===D);if(!T)continue;if(!n.isCellEditable(T)){if(m==="editable-only"){p.push({rowIndex:k,field:D,value:z,isValid:!1,wasSkipped:!0,skipReason:"non-editable"});continue}else if(m==="skip-non-editable"){p.push({rowIndex:k,field:D,value:z,isValid:!0,wasSkipped:!0,skipReason:"non-editable"});continue}}const B=c?n.items[R]:n.displayItems[R];if(B&&n.isRowLocked(B)){p.push({rowIndex:k,field:D,value:z,isValid:!0,wasSkipped:!0,skipReason:"locked"});continue}let N=z;if(T.beforePasteCallback&&B&&(N=T.beforePasteCallback(z,B)),c){const j=n.items[R];if(j&&n.shouldValidateOnPaste&&T.beforeCommitCallback){const Ee={value:N,oldValue:void 0,row:j,rowIndex:R,field:D},Z=await Promise.resolve(T.beforeCommitCallback(Ee)),ze=Z===!0||Z===void 0||typeof Z=="object"&&Z!==null&&Z.valid!==!1,Re=typeof Z=="object"&&Z!==null?Z.error||Z.message:typeof Z=="string"?Z:void 0;ze||(n.addInvalidCell(k,D,Re||"Invalid value"),(_=n.onvalidationerror)==null||_.call(n,{row:j,rowIndex:k,field:D,error:Re||"Invalid value"})),p.push({rowIndex:k,field:D,value:N,isValid:ze,validationError:ze?void 0:Re,wasSkipped:!1})}else p.push({rowIndex:k,field:D,value:N,isValid:!0,wasSkipped:!1})}else if(n.shouldValidateOnPaste){await n.commitEdit(k,D,N);const j=n.invalidCells.find(Ee=>Ee.rowIndex===k&&Ee.field===D);p.push({rowIndex:k,field:D,value:N,isValid:!j,validationError:j==null?void 0:j.error,wasSkipped:!1})}else{const j=n.items[R];j&&(j[D]=N),p.push({rowIndex:k,field:D,value:N,isValid:!0,wasSkipped:!1})}}}const y=p.filter(S=>!S.wasSkipped&&S.isValid).length,v=p.filter(S=>!S.wasSkipped&&!S.isValid).length,x=p.filter(S=>S.wasSkipped).length,C={totalCells:p.length,successfulCells:y,failedCells:v,skippedCells:x,newRowsCreated:f,cellResults:p,hadHeaders:l};return n.onpaste&&n.onpaste(C),C}class Us{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(),n=this.executors.get(i.type);if(!n){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)}),r=n.execute(s,i);r&&r.length>0&&o.unshift(...r)}}}function Ks(e){return new Us(e)}const js={handles:["focusCell","blurCell"],execute(e,t){switch(t.type){case"focusCell":return Xs(e,t);case"blurCell":return Gs(e)}}};function Xs(e,t){const{rowIndex:o,colIndex:i}=t.target,n=e.grid.columns[i];if(!n)return;const s=n.editTrigger??e.grid.editTrigger,r=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),Q(e,l,{rowIndex:o,colIndex:i});const d=e.shadow.querySelector(`td[data-row="${o}"][data-col="${i}"]`);if(!d)return;if(r){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"}),Et(e);const c=n.editor,u=c==="select"||c==="combobox"||c==="autocomplete",g=s==="navigate";if(r&&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 Gs(e,t){const o=e.grid.focusedCell;e.grid.clearFocusedCell(),Q(e,o,null)}const Qs={handles:["navigate"],execute(e,t){if(t.type==="navigate")return Js(e,t)}};function Js(e,t){const o=t.from??e.grid.focusedCell;if(!o)return;const i=Zs(e,o,t),n=e.grid.columns[o.colIndex],s=n?String(n.field):"",r=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}]:r?[{type:"commitEdit"},{type:"renderCell",target:o},{type:"focusCell",target:o,selectText:!1}]:void 0}function Zs(e,t,o){const{direction:i,ctrlKey:n}=o,{rowIndex:s,colIndex:r}=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:r};break;case"down":if(s<d)return{rowIndex:s+1,colIndex:r};break;case"left":if(r>0)return{rowIndex:s,colIndex:r-1};break;case"right":if(r<c)return{rowIndex:s,colIndex:r+1};break;case"tab":{e.grid.tabTraversalStartColIndex===null&&(e.grid.tabTraversalStartColIndex=r);const g=u.findIndex(h=>h.index===r);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":{e.grid.tabTraversalStartColIndex===null&&(e.grid.tabTraversalStartColIndex=r);const g=u.findIndex(h=>h.index===r);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??r;if(e.grid.tabTraversalStartColIndex=null,s<d)return{rowIndex:s+1,colIndex:g};break}case"home":return n?{rowIndex:0,colIndex:0}:{rowIndex:s,colIndex:0};case"end":return n?{rowIndex:d,colIndex:c}:{rowIndex:s,colIndex:c};case"page-up":return n?{rowIndex:0,colIndex:r}:{rowIndex:Math.max(0,s-10),colIndex:r};case"page-down":return n?{rowIndex:d,colIndex:r}:{rowIndex:Math.min(d,s+10),colIndex:r}}return null}const el={handles:["transitionCell"],execute(e,t){if(t.type==="transitionCell")return tl(e,t)}};function tl(e,t){const{from:o,to:i,selectText:n}=t,s=[],r=e.grid.editingCell,l=r&&r.rowIndex===o.rowIndex&&e.grid.columns.findIndex(g=>String(g.field)===r.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:n};return s.push(u),s}const ol={handles:["renderCell"],execute(e,t){t.type==="renderCell"&&il(e,t)}};function il(e,t){const{target:o,focusEditor:i,cursorPosition:n,initialSearchQuery:s}=t;H(e,o.rowIndex,o.colIndex,{focusEditor:i,cursorPosition:n,initialSearchQuery:s})}const nl={handles:["openDropdown","closeDropdown","toggleDropdown","dropdownNavigate","dropdownSelect"],execute(e,t){switch(t.type){case"openDropdown":he(e);break;case"closeDropdown":V(e);break;case"toggleDropdown":e.dropdownOpen?V(e):he(e);break;case"dropdownNavigate":return rl(e,t);case"dropdownSelect":return sl(e,t)}}},Ti=10;function rl(e,t){if(!e.dropdownOpen)return;const o=e.getCurrentEditorOptions();let i=e.highlightedIndex;const n=e.dropdownOptions.length;switch(t.direction){case"up":for(i=e.highlightedIndex-1;i>=0&&ae(e.dropdownOptions[i],o);)i--;if(i<0)return;break;case"down":for(i=e.highlightedIndex+1;i<n&&ae(e.dropdownOptions[i],o);)i++;if(i>=n)return;break;case"page-up":for(i=Math.max(0,e.highlightedIndex-Ti);i<e.highlightedIndex&&ae(e.dropdownOptions[i],o);)i++;if(i>=e.highlightedIndex)return;break;case"page-down":for(i=Math.min(n-1,e.highlightedIndex+Ti);i>e.highlightedIndex&&ae(e.dropdownOptions[i],o);)i--;if(i<=e.highlightedIndex)return;break;case"home":for(i=0;i<n&&ae(e.dropdownOptions[i],o);)i++;if(i>=n)return;break;case"end":for(i=n-1;i>=0&&ae(e.dropdownOptions[i],o);)i--;if(i<0)return;break}e.highlightedIndex=i,e.dropdownUserInteracted=!0,ue(e),lo(e)}function sl(e,t){var h;if(!e.dropdownOpen||e.highlightedIndex<0)return V(e),t.thenNavigate?[{type:"navigate",direction:t.thenNavigate}]:void 0;const o=e.dropdownOptions[e.highlightedIndex];if(!o)return;const i=e.grid.editingCell,n=e.grid.focusedCell,s=i?{rowIndex:i.rowIndex,field:i.field,colIndex:e.grid.columns.findIndex(f=>String(f.field)===i.field)}:n?{rowIndex:n.rowIndex,field:String((h=e.grid.columns[n.colIndex])==null?void 0:h.field),colIndex:n.colIndex}:null;if(!s)return;const{rowIndex:r,field:l,colIndex:a}=s,d=e.grid.columns[a],c=(d==null?void 0:d.editorOptions)||{};if(ae(o,c))return;const u=Te(o,c),g=e.grid.displayItems[r];if(c.onselect&&g&&c.onselect(o,g),e.justSelected=!0,e.isCommittingFromKeyboard=!0,V(e),e.grid.commitEdit(r,l,u,t.commitEmptyRow??!1),t.thenNavigate)return H(e,r,a),e.justSelected=!1,[{type:"navigate",direction:t.thenNavigate,from:{rowIndex:r,colIndex:a}}];t.moveAfterSelect?e.moveFocusAfterCommit(r,l,"down"):H(e,r,a),requestAnimationFrame(()=>{e.justSelected=!1})}const ll={handles:["noop"],execute(){}},al={handles:["toggleCheckbox"],execute(e,t){t.type==="toggleCheckbox"&&dl(e,t)}};function dl(e,t){const{rowIndex:o,colIndex:i}=t.target,n=e.grid.columns[i];if(!n||!e.grid.isCellEditable(n))return;const s=String(n.field),r=e.grid.displayItems[o];if(!r)return;const l=n.editorOptions||{},a=l.trueValue??!0,d=l.falseValue??!1,u=e.grid.getCellRawValue(r,o,s)===a?d:a;e.grid.startEdit(o,s),e.grid.updateDraftValue(o,s,u),H(e,o,i,{focusEditor:!0})}const cl={handles:["openDatePicker","closeDatePicker","toggleDatePicker"],execute(e,t){switch(t.type){case"openDatePicker":Mi(e);break;case"closeDatePicker":hl(e);break;case"toggleDatePicker":fl(e);break}}};function Mi(e){const t=e.grid.focusedCell;if(!t)return;const{rowIndex:o,colIndex:i}=t,n=e.grid.columns[i];if(!n||n.editor!=="date")return;const s=String(n.field),r=e.shadow.querySelector(`.wg__cell[data-row="${o}"][data-col="${i}"]`);if(!r)return;const l=r.querySelector(".wg__editor--date"),a=r.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 yt({dateFormat:d,minDate:c||void 0,maxDate:u||void 0,onSelect:(p,m)=>{gl(e,h,f,w,p,m)},onClose:()=>{ul(e,h,f)}}),e.datepicker.open(l,g||null)}function gl(e,t,o,i,n,s){e.datepicker=null,e.grid.commitEdit(t,i,vt(n)),H(e,t,o);const r=e.shadow.querySelector(`.wg__cell[data-row="${t}"][data-col="${o}"]`);r&&r.focus(),s==="down"?e.dispatch({type:"navigate",direction:"down"}):s==="next"&&e.dispatch({type:"navigate",direction:"tab"})}function ul(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{U(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 hl(e){e.datepicker&&(e.datepicker.close(!0),e.datepicker=null)}function fl(e){e.datepicker?e.datepicker.close(!1):Mi(e)}const wl={handles:["startEdit","commitEdit","cancelEdit","escapeEdit","deleteCell"],execute(e,t){switch(t.type){case"startEdit":pl(e,t);break;case"commitEdit":ml(e,t.commitEmptyRow,t.target);break;case"cancelEdit":bl(e);break;case"escapeEdit":return _l(e,t);case"deleteCell":vl(e,t);break}}};function pl(e,t){const{rowIndex:o,colIndex:i}=t.target;re(e,o,i,{initialSearchQuery:t.initialSearchQuery,cursorPosition:t.cursorPosition})}async function ml(e,t,o){const i=e.grid.editingCell;let n,s,r;if(o){n=o.rowIndex,s=o.colIndex;const c=e.grid.columns[s];if(!c)return;r=String(c.field)}else if(i){if(n=i.rowIndex,r=i.field,s=e.grid.columns.findIndex(c=>String(c.field)===r),s<0)return}else return;const l=e.shadow.querySelector(`.wg__cell[data-row="${n}"][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[n];d=e.grid.getCellRawValue(c,n,r)}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&&V(e),U(e),await e.grid.commitEdit(n,r,d,t),H(e,n,s)}function bl(e){const t=e.grid.editingCell;if(!t)return;const{rowIndex:o,field:i}=t,n=e.grid.columns.findIndex(r=>String(r.field)===i),s=e.grid.columns[n];e.dropdownOpen&&V(e),U(e),(s==null?void 0:s.editor)==="checkbox"&&e.grid.discardCellDraft(o,i),e.grid.cancelEdit(),n>=0&&H(e,o,n)}function _l(e,t){const o=e.grid.editingCell,i=e.grid.focusedCell;if(t.phase==="dropdown"){const n=o||i;if(!n)return;const s=o?e.grid.columns.findIndex(a=>String(a.field)===o.field):(i==null?void 0:i.colIndex)??-1,r=e.grid.columns[s],l=r==null?void 0:r.editor;if(l==="select"&&e.filterText){e.filterText="",V(e),e.dispatch({type:"openDropdown"});return}if(l==="autocomplete"||l==="combobox"){const a=e.shadow.querySelector(`.wg__cell[data-row="${n.rowIndex}"][data-col="${s}"]`),d=a==null?void 0:a.querySelector(".wg__combobox-input, .wg__autocomplete-input"),c=e.grid.displayItems[n.rowIndex],u=r==null?void 0:r.field,g=c&&u?c[u]:void 0,h=(r==null?void 0:r.editorOptions)||{},f=h.initialOptions||h.options||[],w=ot(g,f,h),p=(d==null?void 0:d.value)??"";if(d&&p!==w){e.filterText="",d.value=w,d.focus(),d.select(),V(e),e.dispatch({type:"openDropdown"});return}}V(e),o&&(U(e),l==="checkbox"&&e.grid.discardCellDraft(n.rowIndex,o.field),e.grid.cancelEdit(),H(e,n.rowIndex,s),nt(e,n.rowIndex,s));return}if(o){const{rowIndex:n,field:s}=o,r=e.grid.columns.findIndex(a=>String(a.field)===s),l=e.grid.columns[r];e.dropdownOpen&&V(e),e.datepicker&&(e.datepicker.close(!0),e.datepicker=null),U(e),(l==null?void 0:l.editor)==="checkbox"&&e.grid.discardCellDraft(n,s),e.grid.cancelEdit(),r>=0&&(H(e,n,r),nt(e,n,r))}else if(i){const{rowIndex:n,colIndex:s}=i;e.grid.clearFocusedCell(),H(e,n,s)}}function vl(e,t){const o=t.target||e.grid.focusedCell;if(!o)return;const{rowIndex:i,colIndex:n}=o,s=e.grid.columns[n];if(!s||!e.grid.isCellEditable(s))return;const r=String(s.field);e.grid.commitEdit(i,r,null),H(e,i,n)}const yl={handles:["selectRow","selectColumn","clearSelection"],execute(e,t){switch(t.type){case"selectRow":Cl(e,t);break;case"selectColumn":Sl(e,t);break;case"clearSelection":xl(e);break}}};function Cl(e,t){const{rowIndex:o,addToSelection:i,extendSelection:n}=t;e.grid.selectedColumns.length>0&&e.grid.clearColumnSelection(),e.grid.selectedCellRange&&(e.grid.clearCellSelection(),X(),Se(),go(e)),n&&e.grid.selectedRows.length>0?e.grid.selectRow(o,"range"):i?e.grid.selectRow(o,"toggle"):e.grid.selectRow(o,"replace"),$i(e)}function Sl(e,t){const{colIndex:o,addToSelection:i,extendSelection:n}=t;e.grid.selectedRows.length>0&&e.grid.clearSelection(),e.grid.selectedCellRange&&(e.grid.clearCellSelection(),X(),Se(),go(e)),n&&e.grid.selectedColumns.length>0?e.grid.selectColumn(o,"range"):i?e.grid.selectColumn(o,"toggle"):e.grid.selectColumn(o,"replace"),Ai(e)}function xl(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(),Qe(),$i(e)),e.grid.selectedColumns.length>0){console.log("[clearSelection] clearing columns, removing visual classes"),e.grid.clearColumnSelection_noRender(),Je(),Ai(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(),X(),Se(),go(e))}function $i(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 Ai(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(r=>r.classList.add("wg__cell--column-selected"));const s=e.shadow.querySelector(`.wg__header[data-col="${i}"]`);s&&s.classList.add("wg__header--selected")}}function go(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:n,startColIndex:s,endColIndex:r}=o,l=Math.min(i,n),a=Math.max(i,n),d=Math.min(s,r),c=Math.max(s,r);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 kl={handles:["copy","paste"],execute(e,t){switch(t.type){case"copy":El(e);break}}};async function El(e){var o,i;let t="";if(e.grid.selectedCellRange){const n=e.grid.selectedCellRange,{startRowIndex:s,endRowIndex:r,startColIndex:l,endColIndex:a}=n,d=Math.min(s,r),c=Math.max(s,r),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],y=(o=e.grid.visualColumns[p])==null?void 0:o.column;if(m&&y){const v=m[String(y.field)];w.push($t(v))}else w.push("")}h.push(w.join(" "))}t=h.join(`
|
|
666
|
-
`)}else if(e.grid.selectedColumns.length>0){const
|
|
667
|
-
`)}else if(e.grid.selectedRows.length>0){const
|
|
668
|
-
`)}else if(e.grid.focusedCell){const{rowIndex:n,colIndex:s}=e.grid.focusedCell,r=e.grid.displayItems[n],l=e.grid.columns[s];if(r&&l){const a=r[String(l.field)];t=$t(a)}}if(t)try{await navigator.clipboard.writeText(t)}catch{console.warn("Failed to copy to clipboard")}}function $t(e){return e==null?"":typeof e=="object"?JSON.stringify(e):String(e)}const Rl={handles:["openContextMenu","closeContextMenu"],execute(e,t){switch(t.type){case"openContextMenu":Il(e,t);break;case"closeContextMenu":Dl(e);break}}};function Il(e,t){t.target&&e.dispatch({type:"focusCell",target:t.target,selectText:!1})}function Dl(e){e.contextMenuElement&&(de(e.contextMenuElement),e.contextMenuElement=null),e.headerContextMenuElement&&(de(e.headerContextMenuElement),e.headerContextMenuElement=null)}const Tl={handles:["startFillDrag","updateFillDrag","completeFillDrag"],execute(e,t){switch(t.type){}}},Ml={handles:["startCellSelection"],execute(e,t){if(t.type==="startCellSelection")return $l(e,t)}};function $l(e,t){hi(e,t.rowIndex,t.colIndex,{clientX:t.clientX,clientY:t.clientY,shiftKey:t.shiftKey})}const Al={handles:["resetState"],execute(e,t){if(t.type==="resetState")return Pl(e,t)}};function Pl(e,t){const o=t.edit!==!1,i=t.selections!==!1,n=t.overlays!==!1,s=t.focus===!0,r=[];return n&&((e.contextMenuElement||e.headerContextMenuElement)&&r.push({type:"closeContextMenu"}),e.datepicker&&r.push({type:"closeDatePicker"})),o&&e.grid.editingCell&&r.push({type:"cancelEdit"}),i&&(e.grid.selectedRows.length>0||e.grid.selectedColumns.length>0||e.grid.selectedCellRange)&&r.push({type:"clearSelection"}),s&&e.grid.focusedCell&&r.push({type:"blurCell"}),r}const zl={handles:["openCustomEditor"],execute(e,t){if(t.type!=="openCustomEditor")return;const{rowIndex:o,colIndex:i}=t.target;e.openCustomEditor(o,i)}};function uo(e,t){const{currentCell:o,dropdownOpen:i,isDropdownEditor:n}=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(n&&!i)switch(e.key){case" ":case"F2":return{type:"openDropdown"};case"Enter":return{type:"openDropdown"}}let r=null;switch(e.key){case"Tab":r=e.shiftKey?"tab-back":"tab";break;case"Enter":r="enter";break;case"ArrowUp":r="up";break;case"ArrowDown":r="down";break;case"ArrowLeft":r="left";break;case"ArrowRight":r="right";break;case"Home":r="home";break;case"End":r="end";break;case"PageUp":r="page-up";break;case"PageDown":r="page-down";break;default:return null}return r?{type:"navigate",direction:r,from:o,ctrlKey:s}:null}function Pi(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 zi(e,t){const{cell:o,dropdownOpen:i,isToggleClick:n,isDateTriggerClick:s,isCheckboxClick:r,isCellClick:l}=t,a=[];if(r)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&&!n&&a.push({type:"closeDropdown"});const{isDropdownEditor:d}=t,c=!n&&(!l||d);return a.push({type:"focusCell",target:o,selectText:c}),n&&(i?a.push({type:"closeDropdown"}):(a.push({type:"startEdit",target:o}),a.push({type:"openDropdown"}))),a}class Ll{constructor(t){b(this,"pipeline");b(this,"ctx");this.ctx=t,this.pipeline=Ks(t),this.pipeline.registerExecutor(js),this.pipeline.registerExecutor(Qs),this.pipeline.registerExecutor(el),this.pipeline.registerExecutor(ol),this.pipeline.registerExecutor(nl),this.pipeline.registerExecutor(al),this.pipeline.registerExecutor(cl),this.pipeline.registerExecutor(wl),this.pipeline.registerExecutor(yl),this.pipeline.registerExecutor(kl),this.pipeline.registerExecutor(Rl),this.pipeline.registerExecutor(Tl),this.pipeline.registerExecutor(Ml),this.pipeline.registerExecutor(Al),this.pipeline.registerExecutor(zl),this.pipeline.registerExecutor(ll)}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 n=this.ctx.grid.columns[o];return n?i.rowIndex===t&&i.field===String(n.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),n=parseInt(o.dataset.col||"",10);return isNaN(i)||isNaN(n)?null:{rowIndex:i,colIndex:n}}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 n=this.getEditTrigger(i.colIndex),s=this.isAlwaysMode(i.colIndex),r=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(!Pi(t.key,l,a,d))return!1;const g=uo(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(r){const g=t.key==="ArrowLeft"||t.key==="ArrowRight";if(g&&n==="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"&&n==="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(!Pi(t.key,l,a,d)||!a&&!d&&!c&&g&&!l)return!1;const w=uo(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=uo(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"),n=!!o.closest(".wg__date-trigger"),s=o.matches('.wg__checkbox-input, input[type="checkbox"]'),r=!i&&!n&&!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||"",y=this.ctx.grid.columns.findIndex(v=>String(v.field)===m);!isNaN(p)&&y>=0&&(l={rowIndex:p,colIndex:y})}}else if(n){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||"",y=this.ctx.grid.columns.findIndex(v=>String(v.field)===m);!isNaN(p)&&y>=0&&(l={rowIndex:p,colIndex:y})}}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&&!n&&!s&&!r)return!1;const c=this.ctx.grid.cellSelectionMode,u=t.shiftKey;if(c==="shift"&&u&&r)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,y=m&&m.rowIndex===l.rowIndex&&m.colIndex===l.colIndex;if((w||p)&&y&&r)return!0;const v=r&&this.ctx.grid.selectedCellRange;r&&(v||this.ctx.grid.selectedRows.length>0||this.ctx.grid.selectedColumns.length>0)&&(v&&(this.ctx.isTransitioningCells=!0),this.pipeline.dispatch({type:"clearSelection"}));const C=this.ctx.dropdownOpen,_=this.isDropdownEditor(l.colIndex),S=zi(t,{cell:l,dropdownOpen:C,isDropdownEditor:_,isDateEditor:this.isDateEditor(l.colIndex),isCheckboxEditor:this.isCheckboxEditor(l.colIndex),isToggleClick:i,isDateTriggerClick:n,isCheckboxClick:s,isCellClick:r});if(S.length===0)return v&&(this.ctx.isTransitioningCells=!1),!1;w||(t.preventDefault(),t.stopPropagation());for(const E of S)this.pipeline.dispatch(E);return v&&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(n)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(r&&!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=zi(t,{cell:l,dropdownOpen:g,isDropdownEditor:h,isDateEditor:this.isDateEditor(l.colIndex),isCheckboxEditor:this.isCheckboxEditor(l.colIndex),isToggleClick:i,isDateTriggerClick:n,isCheckboxClick:s,isCellClick:r});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),r=this.isDateEditor(i.colIndex),l=this.isCustomEditor(i.colIndex);(s||r||l)&&t.stopImmediatePropagation();const a=o.closest(".wg__cell"),d=a?rt(t,a):null;return this.pipeline.dispatch({type:"startEdit",target:i,cursorPosition:d??void 0}),s?this.pipeline.dispatch({type:"openDropdown"}):r?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 n=this.getEditTrigger(i.colIndex);if(n!=="dblclick"&&n!=="navigate"||this.isEditingCell(i.rowIndex,i.colIndex))return!1;t.preventDefault();const s=this.isDropdownEditor(i.colIndex),r=this.isDateEditor(i.colIndex),l=this.isCustomEditor(i.colIndex),a=o.closest(".wg__cell"),d=a?rt(t,a):null;return this.pipeline.dispatch({type:"startEdit",target:i,cursorPosition:d??void 0}),s?this.pipeline.dispatch({type:"openDropdown"}):r?this.pipeline.dispatch({type:"openDatePicker"}):l&&this.pipeline.dispatch({type:"openCustomEditor",target:i}),!0}isDatepickerOpen(){return!!this.ctx.datepicker}}function Ol(e){return new Ll(e)}class ho 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",400);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,"handlePaste",async o=>{var l;if(!this.grid.isNavigateMode||this.grid.editingCell||!this.grid.focusedCell)return;const{rowIndex:i,colIndex:n}=this.grid.focusedCell,s=((l=o.clipboardData)==null?void 0:l.getData("text"))||"";if(!s)return;if(s.includes(" ")||s.includes(`
|
|
669
|
-
`))o.preventDefault(),await Ys(this,s,i,n),this.render();else{const a=this.grid.columns[n],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 Lo,this.scrollEvents=Ss(),this.clickEvents=ks(),this.focusEvents=xs(()=>({isCommittingFromKeyboard:this.isCommittingFromKeyboard,isTransitioningCells:this.isTransitioningCells,isClosingViaToggle:this.isClosingViaToggle,isOpeningDropdown:this.isOpeningDropdown}),()=>{this.isClosingViaToggle=!1}),this.styleElement=document.createElement("style"),this.styleElement.textContent=lr,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(){this.grid.gridName&&this.grid.shouldPersistColumnWidths&&this.grid.loadPersistedWidths(),this.pipelineAdapter=Ol(this),this.render(),this.addEventListener("paste",this.handlePaste)}disconnectedCallback(){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),Ct(),this.removeInlineShortcuts(),Hs()}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 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 n=this.grid.columns,s=this.grid.displayItems;o<0||o>=s.length||i<0||i>=n.length||(this.grid.setFocusedCell(o,i),requestAnimationFrame(()=>{q(this,o,i)}))}startEditing(o,i){const n=this.grid.columns;if(i<0||i>=n.length)return;const s=n[i],r=String(s.field);this.grid.startEdit(o,r);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=kt(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,n){no(this,o,i,n)}requestUpdate(){this.updatePending||(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,n){var u;if(!this.grid.isNavigateMode)return;const s=this.grid.columns,r=this.grid.displayItems,l=this.grid.getEditableColumns(),a=l.findIndex(g=>g.index===n);if((o.ctrlKey||o.metaKey)&&o.key==="c"){if(this.grid.selectedCellRange){o.preventDefault(),this.grid.copyCellSelectionToClipboard();return}const g=s[n],h=r[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=lt(h.key);if(at(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[n],h=r[i];if(g&&h)for(const f of c){const w=lt(f.key);if(at(o,w)){const p={row:h,rowIndex:i,colIndex:n,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,n);break;case"ArrowDown":o.preventDefault(),i<r.length-1&&q(this,i+1,n);break;case"ArrowLeft":o.preventDefault(),n>0&&q(this,i,n-1);break;case"ArrowRight":o.preventDefault(),n<s.length-1&&q(this,i,n+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<r.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}),Q(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=r.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}),Q(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,n),this.scrollToRowProgrammatically(0);const h=this.shadow.querySelector(`td[data-row="0"][data-col="${n}"]`);h&&(h.focus({preventScroll:!0}),Q(this,g,{rowIndex:0,colIndex:n}))}else q(this,0,n);else{const g=Math.max(0,i-10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,n),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${n}"]`);f&&(f.focus({preventScroll:!0}),Q(this,h,{rowIndex:g,colIndex:n}))}else q(this,g,n)}break;case"PageDown":if(o.preventDefault(),o.ctrlKey){const g=r.length-1;if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,n),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${n}"]`);f&&(f.focus({preventScroll:!0}),Q(this,h,{rowIndex:g,colIndex:n}))}else q(this,g,n)}else{const g=Math.min(r.length-1,i+10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,n),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${n}"]`);f&&(f.focus({preventScroll:!0}),Q(this,h,{rowIndex:g,colIndex:n}))}else q(this,g,n)}break;case"g":case"G":o.ctrlKey&&(o.preventDefault(),this.showGoToRowDialog(n));break;case"Enter":{o.preventDefault();const g=s[n],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))re(this,i,n),requestAnimationFrame(()=>{this.dropdownOpen||he(this)});else if(f&&g&&this.grid.isCellEditable(g))re(this,i,n);else if(i<r.length-1){const w=this.grid.tabTraversalStartColIndex??n;this.grid.tabTraversalStartColIndex=null,q(this,i+1,w)}break}case"F2":{o.preventDefault();const g=s[n],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";re(this,i,n),h?requestAnimationFrame(()=>{this.dropdownOpen||he(this)}):f&&requestAnimationFrame(()=>{this.openCustomEditor(i,n)});break}case" ":{o.preventDefault();const g=s[n],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)?Rr(this,i,n):f?(re(this,i,n),requestAnimationFrame(()=>{this.dropdownOpen||he(this)})):w?(re(this,i,n),requestAnimationFrame(()=>{var x;const m=(x=this.shadowRoot)==null?void 0:x.querySelector(`.wg__cell[data-row="${i}"][data-col="${n}"]`),y=m==null?void 0:m.querySelector(".wg__date-input"),v=m==null?void 0:m.querySelector(".wg__editor--date");y&&v&&this.openDatePicker(y,v)})):p&&(re(this,i,n),requestAnimationFrame(()=>{this.openCustomEditor(i,n)}));break}case"Escape":if(o.preventDefault(),this.grid.editingCell)U(this),this.grid.cancelEdit();else if(this.grid.selectedRows.length>0)this.grid.clearSelection();else{const g=this.grid.focusedCell;this.grid.clearFocusedCell(),Q(this,g,null),(u=o.target)==null||u.blur()}break;case"Delete":{o.preventDefault();const g=s[n],h=r[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="${n}"]`);f==null||f.focus()}));break}default:if(o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey){const g=s[n];if((g==null?void 0:g.editor)==="number"&&!/[\d.\-]/.test(o.key))return;re(this,i,n,{initialSearchQuery:o.key}),o.preventDefault()}break}}async handleEditorKeyDown(o,i){const n=parseInt(i.dataset.row||"0",10),s=i.dataset.field||"",r=this.grid.columns.find(c=>c.field===s),l=(r==null?void 0:r.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,y)=>({index:y,column:m})).filter(m=>m.column.isEditable!==!1),g=u.findIndex(m=>m.index===c),h=this.grid.displayItems;let f=n,w=c,p=!1;switch(o.key){case"ArrowUp":n>0&&(f=n-1,p=!0);break;case"ArrowDown":n<h.length-1&&(f=n+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,n-10),p=!0;break;case"PageDown":f=Math.min(h.length-1,n+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&&(U(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,ue(this),lo(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,ue(this),lo(this))}break;case"Enter":if(this.datepicker)return;o.preventDefault(),o.stopPropagation(),this.dropdownOpen&&this.highlightedIndex>=0?Qo(this,this.highlightedIndex,!0,!0):a&&!this.dropdownOpen?he(this):(this.isCommittingFromKeyboard=!0,V(this),l==="date"&&i instanceof HTMLInputElement?await this.commitDateEditor(i,!0):await xt(this,i,!0),no(this,n,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(n),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 y=Te(p,m);await this.grid.commitEdit(n,s,y,w)}V(this)}else V(this),l==="date"&&i instanceof HTMLInputElement?await this.commitDateEditor(i,w):a||await xt(this,i,w);if(w){St(this,n,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 no(this,n,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,U(this),this.grid.cancelEdit(),Dr(this,n,s);break;case"F2":o.preventDefault(),o.stopPropagation(),a&&!this.dropdownOpen&&he(this);break;case"Backspace":l==="select"&&(o.preventDefault(),o.stopPropagation(),this.filterText.length>0&&(this.filterText=this.filterText.slice(0,-1),Jo(this,r.editorOptions||{})));break;default:l==="select"&&o.key.length===1&&!o.ctrlKey&&!o.altKey&&!o.metaKey&&(o.preventDefault(),o.stopPropagation(),this.filterText+=o.key,Jo(this,r.editorOptions||{}));break}}attachEventListeners(){const o=this.shadow.querySelector(".wg__table");if(!o)return;o.addEventListener("focus",r=>{const l=r.target;if(l.matches(".wg__cell")){const a=parseInt(l.dataset.row||"0",10),d=parseInt(l.dataset.col||"0",10);Sr(this,a,d),Et(this);const c=this.grid.focusedRowIndex;this.grid.setFocusedRow(a),this.updateRowFocusVisual(c,a),io(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 w=this.shadow.querySelector(`td[data-row="${h.rowIndex}"][data-col="${h.colIndex}"]`);w&&w.classList.remove("wg__cell--always-edit-focused")}a.classList.add("wg__cell--always-edit-focused");const f=this.grid.focusedRowIndex;this.grid.setFocusedRow(d),this.updateRowFocusVisual(f,d)}}}}},!0),o.addEventListener("keydown",r=>{var a;const l=r.target;if(!((a=this.pipelineAdapter)!=null&&a.tryHandleKeyDown(r))){if(this.datepicker){const d=r.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(r,l);return}if(l.matches(".wg__cell")){const d=parseInt(l.dataset.row||"0",10),c=parseInt(l.dataset.col||"0",10);this.handleCellKeyDown(r,d,c)}}}),this.focusEvents.init(o),this.focusEvents.subscribe("focusout",(r,l)=>{(!l||!o.contains(l))&&xr(this,{relatedTarget:l})}),o.addEventListener("dblclick",r=>{var d;if((d=this.pipelineAdapter)!=null&&d.tryHandleDblClick(r))return;r.preventDefault();const a=r.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=rt(r,a);re(this,c,u,{cursorPosition:f??void 0});const w=g.editor;w==="select"||w==="combobox"||w==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||he(this)}):w==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(c,u)})}}}}),o.addEventListener("click",r=>{var d;if((d=this.pipelineAdapter)!=null&&d.tryHandleClick(r))return;const a=r.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"){r.preventDefault();const f=rt(r,a);re(this,c,u,{cursorPosition:f??void 0});const w=g.editor;w==="select"||w==="combobox"||w==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||he(this)}):w==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(c,u)})}}}),o.addEventListener("mousedown",r=>{var g,h;const l=r.target,a=r;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,y=a.shiftKey;if(p.editTrigger||this.grid.editTrigger,m!=="disabled"&&(m==="click"&&!y||m==="shift"&&y)){if(this.grid.editingCell){const x=this.grid.editingCell,C=this.grid.columns.findIndex(_=>String(_.field)===x.field);V(this),U(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(),hi(this,f,w,a);return}else this.grid.selectedCellRange&&(this.grid.clearCellSelection(),X())}}if(l.closest(".wg__date-trigger")){r.preventDefault(),r.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||"",y=this.grid.columns.findIndex(v=>String(v.field)===m);if(y>=0){if(this.clearAllSelections(),this.isTransitioningCells=!0,this.grid.editingCell){const v=this.grid.editingCell,x=this.grid.columns.findIndex(C=>String(C.field)===v.field);V(this),U(this),this.grid.cancelEdit(),this.grid.setFocusedCell(p,y),x>=0&&H(this,v.rowIndex,x)}re(this,p,y),requestAnimationFrame(()=>{var _;this.isTransitioningCells=!1;const v=(_=this.shadowRoot)==null?void 0:_.querySelector(`.wg__cell[data-row="${p}"][data-field="${m}"]`),x=v==null?void 0:v.querySelector(".wg__date-input"),C=v==null?void 0:v.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,y=l.matches(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(m&&!y){const v=this.grid.columns.findIndex(x=>String(x.field)===m.field);if(w!==m.rowIndex||p!==v){r.preventDefault(),this.isTransitioningCells=!0;const x=m.rowIndex,C=v;V(this),U(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,I=r.clientX;requestAnimationFrame(()=>{if(this.isTransitioningCells=!1,S==="click"&&_&&this.grid.isCellEditable(_)){const k=this.shadow.querySelector(`td[data-row="${w}"][data-col="${p}"]`),R=k?rt({clientX:I},k):void 0;re(this,w,p,{cursorPosition:R??void 0})}else q(this,w,p)});return}}}}if(l.matches(".wg__cell-dropdown-display")){r.preventDefault(),r.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(y=>String(y.field)===p);if(m>=0){this.isTransitioningCells=!0;const y=this.grid.editingCell,v=y?this.grid.columns.findIndex(x=>String(x.field)===y.field):-1;y&&(V(this),U(this),this.grid.cancelEdit(),this.grid.setFocusedCell(w,m),v>=0&&H(this,y.rowIndex,v)),re(this,w,m),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||he(this)})}}}}),o.addEventListener("click",r=>{const l=r.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}r.preventDefault(),r.stopPropagation(),jr(this)}}),o.addEventListener("mousedown",r=>{const l=r.target,a=l.closest(".wg__resize-handle");if(a){r.preventDefault(),r.stopPropagation(),this.clearAllSelections();const g=a.dataset.field;g&&gs(this,r,g);return}if(this.grid.isColumnReorderAllowed){const g=r;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&&ps(this,r,f)}}}if((!this.grid.isColumnReorderAllowed||r.shiftKey)&&r.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&&qs(this,f,r)}}}const d=l.closest(".wg__row-number[data-row-number]");if(d&&r.button===0){const g=parseInt(d.dataset.rowNumber||"-1",10);g>=0&&Ps(this,g,r)}l.closest(".wg__row-number-header")&&r.button===0&&(r.preventDefault(),this.grid.selectAll(),this.grid.selectedCellRange&&It(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")){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")&&!Rs()){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(),X(),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",r=>{const l=r,a=l.target;if(a.closest(".wg__resize-handle")||a.closest(".wg__sort-indicator")||di()||!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){r.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;X(),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",r=>{this.handleContextMenu(r)}),o.addEventListener("change",r=>{const l=r.target;l.matches(".wg__editor--checkbox")&&Er(this,l)}),o.addEventListener("input",r=>{const l=r.target;l.matches(".wg__combobox-input")?Xr(this,r):l.matches(".wg__autocomplete-input")&&Gr(this,r)}),this.focusEventsSubscribed||(this.focusEvents.subscribe("blur",(r,l)=>{this.focusEvents.shouldSkipBlur()||!l||!this.shadow.contains(l)||(r.matches(".wg__editor--text, .wg__editor--number")?Ir(this,r):r.matches(".wg__date-input")?this.datepicker||this.commitDateEditor(r):r.matches(".wg__select-trigger")?this.handleSelectBlur(l):r.matches(".wg__combobox-input, .wg__autocomplete-input")&&this.handleComboboxBlur(r))}),this.focusEventsSubscribed=!0);const i=this.shadow.querySelector(".wg"),n=this.grid.tableBorderOnly&&this.shadow.querySelector(".wg__table-container")||i;i&&(i.setAttribute("tabindex","-1"),i.addEventListener("keydown",r=>{const l=this.grid.selectedRows,a=this.grid.selectedColumns,d=!!this.grid.selectedCellRange;if(l.length===0&&a.length===0&&!d||r.target.matches('input, textarea, select, [contenteditable="true"]'))return;if(r.key==="Escape"){r.preventDefault(),this.grid.selectedCellRange?(this.grid.clearCellSelection(),X()):a.length>0?this.grid.clearColumnSelection():this.grid.clearSelection();return}if((r.ctrlKey||r.metaKey)&&r.key==="c"){r.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=lt(g.key);if(at(r,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)){r.preventDefault(),g.action(f);return}}}}),this.scrollEvents.init(n),this.scrollEvents.subscribe("container",()=>{const r=n.scrollLeft>0;i.classList.toggle("wg--scrolled-horizontal",r),this.dropdownOpen&&!this.isTransitioningCells&&!this.isOpeningDropdown&&this.handleScrollCloseDropdown(),this.grid.shouldUseVirtualScroll()&&this.handleVirtualScroll(n),this.grid.isInfiniteScrollEnabled&&this.grid.hasMoreItems&&!this.isLoadingMoreItems&&this.handleInfiniteScroll(n),Fe()!==null&&(Fo(this,this.grid.displayItems),this.renderConnector()),Et(this),this.grid.selectedCellRange&&yi(this),Os(this)}),this.scrollEvents.subscribe("window",()=>{this.dropdownOpen&&!this.isTransitioningCells&&this.handleScrollCloseDropdown(),Fe()!==null&&this.closeToolbarAndReset()}),this.clickEventsSubscribed||(this.clickEvents.init(i,this),this.clickEvents.subscribe("outsideClick",()=>{let r=!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(),r=!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),U(this),this.grid.cancelEdit(),l&&a>=0&&H(this,l.rowIndex,a)}this.grid.selectedCellRange&&(this.grid.clearCellSelection(),X(),r=!0),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),r=!0),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),r=!0),r&&this.render()}),this.clickEvents.subscribe("sortClick",r=>{di()||(this.grid.selectedCellRange&&(this.grid.clearCellSelection(),X()),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),Qe()),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),Je()),as(this,r.event,r.field),this.render())}),this.clickEventsSubscribed=!0)),o.addEventListener("mouseenter",r=>{const l=r.target,a=l.closest("[data-tooltip-html]");if(a){const c=a.getAttribute("data-tooltip-html");co(this,a,c,this._tooltipShowDelay,!0);return}const d=l.closest("[data-tooltip]");if(d){const c=d.getAttribute("data-tooltip");co(this,d,c,this._tooltipShowDelay,!1)}},!0),o.addEventListener("mouseleave",r=>{const l=r,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&&Zo(this,this._tooltipHideDelay)},!0),o.addEventListener("click",r=>{const a=r.target.closest(".wg__toolbar-trigger");if(a&&this.grid.toolbarTrigger==="button"){r.preventDefault(),r.stopPropagation();const d=parseInt(a.dataset.toolbarTrigger||"0",10),c=o.querySelector(`tr[data-row-index="${d}"]`);c&&(Qt(d)?this.closeToolbarAndReset():this.showToolbarForRow(c,d))}}),o.addEventListener("click",r=>{if(this.grid.toolbarPosition!=="inline")return;const a=r.target.closest(".wg__inline-action-btn");if(a&&!a.disabled){r.preventDefault(),r.stopPropagation();const d=a.dataset.actionId,c=parseInt(a.dataset.row||"0",10);this.handleInlineActionClick(d,c)}}),o.addEventListener("mouseenter",r=>{const l=r,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),Qt(c)||this.showToolbarForRow(d,c,l.clientX))}},!0),o.addEventListener("mouseleave",r=>{if(r.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",r=>{const l=r,a=l.target,d=a.closest(".wg__row");if(!d)return;const c=parseInt(d.dataset.rowIndex||"0",10);if(!(Fe()!==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=Gt(h,this.grid.cellToolbarOffset);Jt(f,d,"start")}else Jt(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 y=this.grid.cellToolbar(p,c,h,f)||this.grid.rowToolbar,v=JSON.stringify(y);v!==this.currentCellToolbarItems&&(this.currentCellToolbarItems=v,this.updateToolbarWithCellItems(c,y));const x=g.getBoundingClientRect(),C=Gt(x,this.grid.cellToolbarOffset);Jt(C,d,"start")}}}}}}),o.addEventListener("click",r=>{if(this.grid.toolbarTrigger!=="click")return;const l=r,a=l.target,d=a.closest(".wg__row");if(d&&!a.closest(".wg__cell--editing")){const c=parseInt(d.dataset.rowIndex||"0",10);Qt(c)?this.closeToolbarAndReset():this.showToolbarForRow(d,c,l.clientX)}}),this.toolbarOutsideClickAdded||(this.toolbarOutsideClickAdded=!0,document.addEventListener("click",r=>{if(!Ho(this.shadow))return;const l=r.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")||Fe()!==null&&this.closeToolbarAndReset()})),this.shadow.querySelectorAll(".wg__pagination").forEach(r=>{r.addEventListener("click",a=>{ds(this,a)&&this.render()});const l=r.querySelector(".wg__pagination-select");l&&l.addEventListener("change",()=>{cs(this,l)&&this.render()})})}scrollToRowProgrammatically(o){const i=this.shadow.querySelector(".wg");if(!i)return;const{scrollTop:n,startIndex:s,endIndex:r}=ss({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||r!==this.virtualScrollEnd)&&(this.virtualScrollStart=s,this.virtualScrollEnd=r,this.renderVirtualRows(i)),this.isProgrammaticScroll=!0,i.scrollTop=n,queueMicrotask(()=>{this.isProgrammaticScroll=!1})}handleVirtualScroll(o){var s;if(this.isProgrammaticScroll)return;const{startIndex:i,endIndex:n}=rs({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||n!==this.virtualScrollEnd)&&(this.virtualScrollStart=i,this.virtualScrollEnd=n,this.renderVirtualRows(o))}renderVirtualRows(o){const i=o.querySelector("tbody");if(!i)return;const n=this.grid.displayItems,s={startIndex:this.virtualScrollStart,endIndex:this.virtualScrollEnd,rowHeight:this.grid.virtualScrollRowHeight,totalItems:n.length},r=this.grid.focusedCell;if(i.innerHTML=No(this,s),r){this.grid.setFocusedCell(r.rowIndex,r.colIndex);const l=i.querySelector(`td[data-row="${r.rowIndex}"][data-col="${r.colIndex}"]`);l&&(l.focus({preventScroll:!0}),Q(this,null,r))}}handleInfiniteScroll(o){ls(o.scrollTop,o.scrollHeight,o.clientHeight,this.grid.infiniteScrollThreshold)&&(this.isLoadingMoreItems=!0,this.grid.fireDataRequest("loadMore"))}renderShortcutsHelpIcon(){var r,l,a;if(!this.grid.isShortcutsHelpVisible||!((r=this.grid.rowShortcuts)!=null&&r.length))return"";const i=this.grid.shortcutsHelpPosition==="top-left"?"wg__shortcuts-help--left":"",n=this.grid.rowShortcuts.map(d=>`<div class="wg__shortcuts-help-item">
|
|
663
|
+
`;let ei=!1;function ti(){if(ei)return;const e=document.createElement("style");e.id="wg-context-menu-styles",e.textContent=es,document.head.appendChild(e),ei=!0}function ts(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 os(e,t,o,i,r,s,n,l,a){ti();const d=ts(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"),g=t+i,h=o+r;Ke({getBoundingClientRect:()=>({width:0,height:0,x:g,y:h,top:h,left:g,right:g,bottom:h})},u,{placement:"bottom-start",middleware:[Ue({fallbackPlacements:["top-start","bottom-end","top-end"]}),bt({padding:8})]}).then(({x:v,y:x})=>{Object.assign(u.style,{left:`${v}px`,top:`${x}px`})}),c.addEventListener("click",v=>{const x=v.target.closest(".wg-context-menu__item");if(x&&x.dataset.disabled!=="true"){const C=x.dataset.itemId||"";l(C)}});const w=e.scrollEvents.subscribe("window",()=>{p(),a()}),p=()=>{w.unsubscribe(),document.removeEventListener("mousedown",m),document.removeEventListener("keydown",y),c.remove()},m=v=>{c.contains(v.target)||(p(),a())},y=v=>{if(v.key==="Escape"){v.preventDefault(),p(),a();return}const x=v.key.toLowerCase(),C=c.querySelectorAll(".wg-context-menu__item");for(const _ of C){const S=_.dataset.shortcut;if(_.dataset.disabled==="true"||!S)continue;if(S.toLowerCase()===x||S===v.key){v.preventDefault();const k=_.dataset.itemId||"";l(k),p(),a();return}}};return setTimeout(()=>{document.addEventListener("mousedown",m),document.addEventListener("keydown",y)},0),c._cleanup=p,c}function de(e,t,o){const i=e._cleanup;if(typeof i=="function"){i();return}e.remove()}const is={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 oi(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=is[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 ii(e,t,o,i=!1){var y,v;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=((y=e.children)==null?void 0:y.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,_)=>ii(C,t,_,!0)).join("")}</div>`);const g=i&&((v=e.id)==null?void 0:v.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 ri(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)=>ii(r,t,s)).join("")}</div>`}function rs(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 ni(e,t,o,i,r,s,n){ti();const l=ri(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");Ke({getBoundingClientRect:()=>({width:0,height:0,x:t,y:o,top:o,left:t,right:t,bottom:o})},d,{placement:"bottom-start",middleware:[Ue({fallbackPlacements:["top-start","bottom-end","top-end"]}),bt({padding:8})]}).then(({x:w,y:p})=>{Object.assign(d.style,{left:`${w}px`,top:`${p}px`})}),a.addEventListener("click",w=>{const p=w.target.closest(".wg-context-menu__item");if(!p||p.dataset.disabled==="true")return;const m=p.dataset.itemId||"",y=w.ctrlKey;if(!p.classList.contains("wg-context-menu__item--has-submenu")){if(m.startsWith("toggle-col-")||m==="show-all-columns"){s(m,!0,y);const v=ri(i,r),x=document.createElement("div");x.innerHTML=v;const C=x.querySelector(".wg-context-menu");if(C&&d.parentNode){C.style.left=d.style.left,C.style.top=d.style.top,d.parentNode.replaceChild(C,d),d=C;const _=C.querySelector(".wg-context-menu--submenu");_&&(_.style.display="block")}return}s(m,!1,y)}});const u=e.scrollEvents.subscribe("window",()=>{g(),n()}),g=()=>{u.unsubscribe(),document.removeEventListener("mousedown",h),document.removeEventListener("keydown",f),a.remove()},h=w=>{a.contains(w.target)||(g(),n())},f=w=>{if(w.key==="Escape"){w.preventDefault(),g(),n();return}const p=w.key.toLowerCase(),m=a.querySelectorAll(".wg-context-menu__item");for(const y of m){const v=y.dataset.shortcut;if(y.dataset.disabled==="true"||!v)continue;if(v.toLowerCase()===p||v===w.key){w.preventDefault();const _=y.dataset.itemId||"";s(_),g(),n();return}}};return setTimeout(()=>{document.addEventListener("mousedown",h),document.addEventListener("keydown",f)},0),a._cleanup=g,a}function lt(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 at(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 ns(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 ss(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 ls(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 as(e,t,o,i){return t-(e+o)<=i}function ds(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 cs(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 gs(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 W={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},xe=null;function si(e,t){if(!e)return t;const o=parseFloat(e);return isNaN(o)?t:o}function us(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;W={isResizing:!0,startX:t.clientX,startWidth:n,field:o,headerCell:r,minWidth:si(s.minWidth,30),maxWidth:s.maxWidth?si(s.maxWidth,1/0):null},xe=e,s.minWidth?r.style.minWidth=s.minWidth:r.style.minWidth=`${W.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",li),document.addEventListener("mouseup",ai),t.preventDefault()}function li(e){if(!W.isResizing||!xe)return;const t=e.clientX-W.startX;let o=W.startWidth+t;o=Math.max(o,W.minWidth),W.maxWidth!==null&&(o=Math.min(o,W.maxWidth)),W.headerCell&&(W.headerCell.style.width=`${o}px`,W.headerCell.style.maxWidth=`${o}px`),hs(xe,W.field,`${o}px`),(xe.grid.freezeColumns>0||xe.grid.isStickyRowNumbers)&&ws(xe)}function ai(e){if(!W.isResizing||!xe)return;const t=xe,o=W.field,i=`${W.startWidth}px`,r=e.clientX-W.startX;let s=W.startWidth+r;s=Math.max(s,W.minWidth),W.maxWidth!==null&&(s=Math.min(s,W.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",li),document.removeEventListener("mouseup",ai),W={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},xe=null}function hs(e,t,o){e.shadow.querySelectorAll(`td[data-field="${t}"]`).forEach(r=>{r.style.width=o,r.style.maxWidth=o})}const fs=40;function ws(e){const t=e.grid.freezeColumns;let i=e.grid.isRowNumbersVisible&&e.grid.isStickyRowNumbers?fs: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 ps=5;let O={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},ke=null,Rt=!1;function di(){return Rt?(Rt=!1,!0):O.isReordering}function ms(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},ke=e,document.addEventListener("mousemove",ci),document.addEventListener("mouseup",gi),t.preventDefault()}function bs(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 _s(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 vs(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&&bs(e,O.headerCell,t),_s(e)}function ci(e){if(!ke)return;if(O.isPending){const i=e.clientX-O.startX,r=e.clientY-O.startY;Math.sqrt(i*i+r*r)>=ps&&vs(ke,e);return}if(!O.isReordering||!ke.shadow.querySelector(".wg"))return;O.ghost&&(O.ghost.style.left=`${e.clientX+10}px`,O.ghost.style.top=`${e.clientY-10}px`);const o=Cs(ke,e.clientX);o!==O.currentDropIndex&&(O.currentDropIndex=o,Ss(ke,o))}function ys(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 Cs(e,t){const o=e.grid.visualColumns,i=e.grid.totalFrozenColumns,r=o.slice(i);if(r.length===0)return 0;const s=ys(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 Ss(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 gi(e){if(!ke)return;const t=ke;if(O.isPending){ui(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()}Rt=!0,requestAnimationFrame(()=>{Rt=!1}),ui(t)}function ui(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",ci),document.removeEventListener("mouseup",gi),O={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},ke=null}function xs(){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 ks(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 Es(){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 Rs=5;let $={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,rangeBorder:null},se=null,dt=null,Ge=null;function Is(){return $.isPending}function hi(e,t,o,i){var l;const r=i.shiftKey&&e.grid.cellSelectionMode==="shift";e.grid.selectedCellRange&&!r&&(e.grid.clearCellSelection(),X()),(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},se=e,document.addEventListener("mousemove",fi),document.addEventListener("mouseup",pi),document.addEventListener("keydown",mi))}function Ds(e,t,o){var i,r;if(X(),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),It(e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const u=e.shadow.querySelector(".wg");u==null||u.focus({preventScroll:!0})})})}}else e.grid.lastClickedCell={rowIndex:t,colIndex:o}}function fi(e){if(se){if($.isPending){const t=e.clientX-$.startX,o=e.clientY-$.startY;Math.sqrt(t*t+o*o)>=Rs&&Ms(se);return}$.isDragging&&(dt=e,Ge||(Ge=requestAnimationFrame(Ts)))}}function Ts(){if(Ge=null,!dt||!se)return;const e=dt;dt=null;const t=$s(se,e.clientX,e.clientY);if(t&&(t.rowIndex!==$.currentRowIndex||t.colIndex!==$.currentColIndex)){$.currentRowIndex=t.rowIndex,$.currentColIndex=t.colIndex;const o=bi(se);wi(se),_i(se,o)}}function Ms(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(),Q(e,o,null);const i=e.grid.focusedRowIndex;if(i!==null){const r=e.shadow.querySelector(`tr[data-row-index="${i}"]`);r==null||r.classList.remove("wg__row--focused"),e.grid.clearRowFocus()}wi(e),vi(e)}function wi(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(!se)return;const t=se;if($.isPending){e.shiftKey&&t.grid.cellSelectionMode==="shift"&&t.grid.lastClickedCell?Ds(t,$.startRowIndex,$.startColIndex):t.grid.lastClickedCell={rowIndex:$.startRowIndex,colIndex:$.startColIndex},Dt(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")),X();const{startRowIndex:r,startColIndex:s}=$;t.grid.setFocusedCell(r,s),Q(t,null,{rowIndex:r,colIndex:s}),rt(t,r,s),Dt(t)}else As(t),Dt(t),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=t.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})})}function mi(e){if(e.key==="Escape"&&se){e.preventDefault();const t=se;if($.isDragging){t.shadow.querySelectorAll(".wg__cell--in-range").forEach(s=>s.classList.remove("wg__cell--in-range")),X();const{startRowIndex:i,startColIndex:r}=$;t.grid.setFocusedCell(i,r),Q(t,null,{rowIndex:i,colIndex:r}),rt(t,i,r)}Dt(t)}}function $s(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 As(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),It(e)}function bi(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 _i(e,t){if(!t){X();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=bi(e);_i(e,t)}function It(e){X();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,y=f.left-h.left+p-o.clientLeft,v=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=`${y}px`,_.style.top=`${v}px`,_.style.width=`${x}px`,_.style.height=`${C}px`,o.appendChild(_),$.rangeBorder=_}function yi(e){$.rangeBorder&&(X(),$.isDragging?vi(e):It(e))}function X(){$.rangeBorder&&($.rangeBorder.remove(),$.rangeBorder=null)}function Dt(e){const t=e.shadow.querySelector(".wg");t==null||t.classList.remove("wg--selecting-cells"),Ge&&(cancelAnimationFrame(Ge),Ge=null),dt=null,document.removeEventListener("mousemove",fi),document.removeEventListener("mouseup",pi),document.removeEventListener("keydown",mi),$={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,rangeBorder:$.rangeBorder},se=null}const Ps=5;let fe={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},Pe=null;function zs(e,t,o){if(o.preventDefault(),o.stopPropagation(),Yo(e),e.grid.selectedCellRange&&(e.grid.clearCellSelection(),X()),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}fe={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",Ci),document.addEventListener("mouseup",Si)}function Ci(e){if(!Pe)return;if(fe.isPending){const o=e.clientX-fe.startX,i=e.clientY-fe.startY;Math.sqrt(o*o+i*i)>=Ps&&Ls(Pe);return}if(!fe.isDragging)return;const t=Os(Pe,e.clientY);t!==null&&t!==fe.currentRowIndex&&(fe.currentRowIndex=t,Pe.grid.selectRowRange(fe.startRowIndex,t))}function Ls(e){fe.isPending=!1,fe.isDragging=!0;const t=e.shadow.querySelector(".wg");t==null||t.classList.add("wg--selecting")}function Si(){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",Ci),document.removeEventListener("mouseup",Si),fe={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},Pe=null}function Os(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 Tt=[],Mt=[];function xi(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 ki(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 Ei(e){Qe();const t=e.grid.selectedRows;if(t.length===0)return;const o=e.shadow.querySelector(".wg");if(!o)return;const i=xi(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,y=ki(o,f,w,p,m,"wg__row-selection-border");Tt.push(y)}}function Ri(e){Je();const t=e.grid.selectedColumns;if(t.length===0)return;const o=e.shadow.querySelector(".wg");if(!o)return;const i=xi(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 y=f.getBoundingClientRect(),v=m.getBoundingClientRect(),x=p.getBoundingClientRect(),C=y.left-n.left+l-o.clientLeft,_=y.top-n.top+a-o.clientTop,S=v.right-y.left,E=x.bottom-y.top,I=ki(o,C,_,S,E,"wg__column-selection-border");Mt.push(I)}}function Hs(e){Tt.length>0&&Ei(e),Mt.length>0&&Ri(e)}function Qe(){for(const e of Tt)e.remove();Tt=[]}function Je(){for(const e of Mt)e.remove();Mt=[]}function Fs(){Qe(),Je()}const qs=5;let we={isPending:!1,isDragging:!1,startColIndex:-1,startX:0,startY:0,currentColIndex:-1},ze=null;function Vs(e,t,o){if(o.preventDefault(),o.stopPropagation(),Yo(e),e.grid.selectedCellRange&&(e.grid.clearCellSelection(),X()),o.ctrlKey||o.metaKey){e.grid.selectColumn(t,"toggle"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=e.shadow.querySelector(".wg");i==null||i.focus({preventScroll:!0})})});return}we={isPending:!0,isDragging:!1,startColIndex:t,startX:o.clientX,startY:o.clientY,currentColIndex:t},ze=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",Ii),document.addEventListener("mouseup",Di)}function Ii(e){if(!ze)return;if(we.isPending){const o=e.clientX-we.startX,i=e.clientY-we.startY;Math.sqrt(o*o+i*i)>=qs&&Ns(ze);return}if(!we.isDragging)return;const t=Bs(ze,e.clientX);t!==null&&t!==we.currentColIndex&&(we.currentColIndex=t,ze.grid.selectColumnRange(we.startColIndex,t))}function Ns(e){we.isPending=!1,we.isDragging=!0;const t=e.shadow.querySelector(".wg");t==null||t.classList.add("wg--selecting-columns")}function Di(){if(!ze)return;const e=ze,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",Ii),document.removeEventListener("mouseup",Di),we={isPending:!1,isDragging:!1,startColIndex:-1,startX:0,startY:0,currentColIndex:-1},ze=null}function Bs(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 Ws(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===`
|
|
664
|
+
`||n==="\r"&&l===`
|
|
665
|
+
`?(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 Ys(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 Us(e,t,o,i){var _;const r=e.grid,s=Ws(t);if(s.length===0)return{totalCells:0,successfulCells:0,failedCells:0,skippedCells:0,newRowsCreated:0,cellResults:[],hadHeaders:!1};const n=Ys(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,E)=>S+E.length,0),successfulCells:0,failedCells:0,skippedCells:a.reduce((S,E)=>S+E.length,0),newRowsCreated:0,cellResults:[],hadHeaders:l};let f=0,w=u;if(g>0){const S=[];for(let E=0;E<g;E++){const I=c?E:u+E-o,k=a[I],R={};l&&n?k==null||k.forEach((z,D)=>{const L=n[D];L&&(R[L.gridField]=z)}):k==null||k.forEach((z,D)=>{const L=i+D;if(L<d.length){const K=String(d[L].column.field);R[K]=z}});let M;r.createRowCallback?M=r.createRowCallback(R,u+E):M=R,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 E=a[S],I=c?w+S:o+S,k=c?r.newRowPosition==="top"?1+S:r.items.length-a.length+S:o+S,R=I;for(let M=0;M<E.length;M++){const z=E[M];let D,L;if(l&&n){const j=n[M];if(!j)continue;D=j.gridField,L=j.colIndex}else{if(L=i+M,L>=d.length){p.push({rowIndex:k,field:"",value:z,isValid:!1,wasSkipped:!0,skipReason:"out-of-bounds"});continue}D=String(d[L].column.field)}const K=`${S}-${M}`;if(h.skipCells.has(K)){p.push({rowIndex:k,field:D,value:z,isValid:!0,wasSkipped:!0,skipReason:"user-canceled"});continue}const T=r.columns.find(j=>String(j.field)===D);if(!T)continue;if(!r.isCellEditable(T)){if(m==="editable-only"){p.push({rowIndex:k,field:D,value:z,isValid:!1,wasSkipped:!0,skipReason:"non-editable"});continue}else if(m==="skip-non-editable"){p.push({rowIndex:k,field:D,value:z,isValid:!0,wasSkipped:!0,skipReason:"non-editable"});continue}}const B=c?r.items[R]:r.displayItems[R];if(B&&r.isRowLocked(B)){p.push({rowIndex:k,field:D,value:z,isValid:!0,wasSkipped:!0,skipReason:"locked"});continue}let N=z;if(T.beforePasteCallback&&B&&(N=T.beforePasteCallback(z,B)),c){const j=r.items[R];if(j&&r.shouldValidateOnPaste&&T.beforeCommitCallback){const Ee={value:N,oldValue:void 0,row:j,rowIndex:R,field:D},ee=await Promise.resolve(T.beforeCommitCallback(Ee)),Le=ee===!0||ee===void 0||typeof ee=="object"&&ee!==null&&ee.valid!==!1,Re=typeof ee=="object"&&ee!==null?ee.error||ee.message:typeof ee=="string"?ee:void 0;Le||(r.addInvalidCell(k,D,Re||"Invalid value"),(_=r.onvalidationerror)==null||_.call(r,{row:j,rowIndex:k,field:D,error:Re||"Invalid value"})),p.push({rowIndex:k,field:D,value:N,isValid:Le,validationError:Le?void 0:Re,wasSkipped:!1})}else p.push({rowIndex:k,field:D,value:N,isValid:!0,wasSkipped:!1})}else if(r.shouldValidateOnPaste){await r.commitEdit(k,D,N);const j=r.invalidCells.find(Ee=>Ee.rowIndex===k&&Ee.field===D);p.push({rowIndex:k,field:D,value:N,isValid:!j,validationError:j==null?void 0:j.error,wasSkipped:!1})}else{const j=r.items[R];j&&(j[D]=N),p.push({rowIndex:k,field:D,value:N,isValid:!0,wasSkipped:!1})}}}const y=p.filter(S=>!S.wasSkipped&&S.isValid).length,v=p.filter(S=>!S.wasSkipped&&!S.isValid).length,x=p.filter(S=>S.wasSkipped).length,C={totalCells:p.length,successfulCells:y,failedCells:v,skippedCells:x,newRowsCreated:f,cellResults:p,hadHeaders:l};return r.onpaste&&r.onpaste(C),C}class Ks{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 js(e){return new Ks(e)}const Xs={handles:["focusCell","blurCell"],execute(e,t){switch(t.type){case"focusCell":return Gs(e,t);case"blurCell":return Qs(e)}}};function Gs(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),Q(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"}),Et(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 Qs(e,t){const o=e.grid.focusedCell;e.grid.clearFocusedCell(),Q(e,o,null)}const Js={handles:["navigate"],execute(e,t){if(t.type==="navigate")return Zs(e,t)}};function Zs(e,t){const o=t.from??e.grid.focusedCell;if(!o)return;const i=el(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 el(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 tl={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 il={handles:["renderCell"],execute(e,t){t.type==="renderCell"&&rl(e,t)}};function rl(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 nl={handles:["openDropdown","closeDropdown","toggleDropdown","dropdownNavigate","dropdownSelect"],execute(e,t){switch(t.type){case"openDropdown":he(e);break;case"closeDropdown":V(e);break;case"toggleDropdown":e.dropdownOpen?V(e):he(e);break;case"dropdownNavigate":return sl(e,t);case"dropdownSelect":return ll(e,t)}}},Ti=10;function sl(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&&ae(e.dropdownOptions[i],o);)i--;if(i<0)return;break;case"down":for(i=e.highlightedIndex+1;i<r&&ae(e.dropdownOptions[i],o);)i++;if(i>=r)return;break;case"page-up":for(i=Math.max(0,e.highlightedIndex-Ti);i<e.highlightedIndex&&ae(e.dropdownOptions[i],o);)i++;if(i>=e.highlightedIndex)return;break;case"page-down":for(i=Math.min(r-1,e.highlightedIndex+Ti);i>e.highlightedIndex&&ae(e.dropdownOptions[i],o);)i--;if(i<=e.highlightedIndex)return;break;case"home":for(i=0;i<r&&ae(e.dropdownOptions[i],o);)i++;if(i>=r)return;break;case"end":for(i=r-1;i>=0&&ae(e.dropdownOptions[i],o);)i--;if(i<0)return;break}e.highlightedIndex=i,e.dropdownUserInteracted=!0,ue(e),lo(e)}function ll(e,t){var h;if(!e.dropdownOpen||e.highlightedIndex<0)return V(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(ae(o,c))return;const u=Me(o,c),g=e.grid.displayItems[n];if(c.onselect&&g&&c.onselect(o,g),e.justSelected=!0,e.isCommittingFromKeyboard=!0,V(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 al={handles:["noop"],execute(){}},dl={handles:["toggleCheckbox"],execute(e,t){t.type==="toggleCheckbox"&&cl(e,t)}};function cl(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 gl={handles:["openDatePicker","closeDatePicker","toggleDatePicker"],execute(e,t){switch(t.type){case"openDatePicker":Mi(e);break;case"closeDatePicker":fl(e);break;case"toggleDatePicker":wl(e);break}}};function Mi(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 yt({dateFormat:d,minDate:c||void 0,maxDate:u||void 0,onSelect:(p,m)=>{ul(e,h,f,w,p,m)},onClose:()=>{hl(e,h,f)}}),e.datepicker.open(l,g||null)}function ul(e,t,o,i,r,s){e.datepicker=null,e.grid.commitEdit(t,i,vt(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 hl(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{U(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 fl(e){e.datepicker&&(e.datepicker.close(!0),e.datepicker=null)}function wl(e){e.datepicker?e.datepicker.close(!1):Mi(e)}const pl={handles:["startEdit","commitEdit","cancelEdit","escapeEdit","deleteCell"],execute(e,t){switch(t.type){case"startEdit":ml(e,t);break;case"commitEdit":bl(e,t.commitEmptyRow,t.target);break;case"cancelEdit":_l(e);break;case"escapeEdit":return vl(e,t);case"deleteCell":yl(e,t);break}}};function ml(e,t){const{rowIndex:o,colIndex:i}=t.target;ne(e,o,i,{initialSearchQuery:t.initialSearchQuery,cursorPosition:t.cursorPosition})}async function bl(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&&V(e),U(e),await e.grid.commitEdit(r,n,d,t),H(e,r,s)}function _l(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&&V(e),U(e),(s==null?void 0:s.editor)==="checkbox"&&e.grid.discardCellDraft(o,i),e.grid.cancelEdit(),r>=0&&H(e,o,r)}function vl(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="",V(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=ot(g,f,h),p=(d==null?void 0:d.value)??"";if(d&&p!==w){e.filterText="",d.value=w,d.focus(),d.select(),V(e),e.dispatch({type:"openDropdown"});return}}V(e),o&&(U(e),l==="checkbox"&&e.grid.discardCellDraft(r.rowIndex,o.field),e.grid.cancelEdit(),H(e,r.rowIndex,s),rt(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&&V(e),e.datepicker&&(e.datepicker.close(!0),e.datepicker=null),U(e),(l==null?void 0:l.editor)==="checkbox"&&e.grid.discardCellDraft(r,s),e.grid.cancelEdit(),n>=0&&(H(e,r,n),rt(e,r,n))}else if(i){const{rowIndex:r,colIndex:s}=i;e.grid.clearFocusedCell(),H(e,r,s)}}function yl(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 Cl={handles:["selectRow","selectColumn","clearSelection"],execute(e,t){switch(t.type){case"selectRow":Sl(e,t);break;case"selectColumn":xl(e,t);break;case"clearSelection":kl(e);break}}};function Sl(e,t){const{rowIndex:o,addToSelection:i,extendSelection:r}=t;e.grid.selectedColumns.length>0&&e.grid.clearColumnSelection(),e.grid.selectedCellRange&&(e.grid.clearCellSelection(),X(),Se(),go(e)),r&&e.grid.selectedRows.length>0?e.grid.selectRow(o,"range"):i?e.grid.selectRow(o,"toggle"):e.grid.selectRow(o,"replace"),$i(e)}function xl(e,t){const{colIndex:o,addToSelection:i,extendSelection:r}=t;e.grid.selectedRows.length>0&&e.grid.clearSelection(),e.grid.selectedCellRange&&(e.grid.clearCellSelection(),X(),Se(),go(e)),r&&e.grid.selectedColumns.length>0?e.grid.selectColumn(o,"range"):i?e.grid.selectColumn(o,"toggle"):e.grid.selectColumn(o,"replace"),Ai(e)}function kl(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(),Qe(),$i(e)),e.grid.selectedColumns.length>0){console.log("[clearSelection] clearing columns, removing visual classes"),e.grid.clearColumnSelection_noRender(),Je(),Ai(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(),X(),Se(),go(e))}function $i(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 Ai(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 go(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 El={handles:["copy","paste"],execute(e,t){switch(t.type){case"copy":Rl(e);break}}};async function Rl(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],y=(o=e.grid.visualColumns[p])==null?void 0:o.column;if(m&&y){const v=m[String(y.field)];w.push($t(v))}else w.push("")}h.push(w.join(" "))}t=h.join(`
|
|
666
|
+
`)}else if(e.grid.selectedColumns.length>0){const r=[],s=e.grid.displayItems;for(let n=0;n<s.length;n++){const l=[];for(const a of e.grid.selectedColumns){const d=s[n],c=(i=e.grid.visualColumns[a])==null?void 0:i.column;if(d&&c){const u=d[String(c.field)];l.push($t(u))}else l.push("")}r.push(l.join(" "))}t=r.join(`
|
|
667
|
+
`)}else if(e.grid.selectedRows.length>0){const r=[],s=e.grid.visualColumns;for(const n of e.grid.selectedRows){const l=e.grid.displayItems[n];if(l){const a=[];for(const d of s){const c=l[String(d.column.field)];a.push($t(c))}r.push(a.join(" "))}}t=r.join(`
|
|
668
|
+
`)}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=$t(a)}}if(t)try{await navigator.clipboard.writeText(t)}catch{console.warn("Failed to copy to clipboard")}}function $t(e){return e==null?"":typeof e=="object"?JSON.stringify(e):String(e)}const Il={handles:["openContextMenu","closeContextMenu"],execute(e,t){switch(t.type){case"openContextMenu":Dl(e,t);break;case"closeContextMenu":Tl(e);break}}};function Dl(e,t){t.target&&e.dispatch({type:"focusCell",target:t.target,selectText:!1})}function Tl(e){e.contextMenuElement&&(de(e.contextMenuElement),e.contextMenuElement=null),e.headerContextMenuElement&&(de(e.headerContextMenuElement),e.headerContextMenuElement=null)}const Ml={handles:["startFillDrag","updateFillDrag","completeFillDrag"],execute(e,t){switch(t.type){}}},$l={handles:["startCellSelection"],execute(e,t){if(t.type==="startCellSelection")return Al(e,t)}};function Al(e,t){hi(e,t.rowIndex,t.colIndex,{clientX:t.clientX,clientY:t.clientY,shiftKey:t.shiftKey})}const Pl={handles:["resetState"],execute(e,t){if(t.type==="resetState")return zl(e,t)}};function zl(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 Ll={handles:["openCustomEditor"],execute(e,t){if(t.type!=="openCustomEditor")return;const{rowIndex:o,colIndex:i}=t.target;e.openCustomEditor(o,i)}};function uo(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 Pi(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 zi(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 Ol{constructor(t){b(this,"pipeline");b(this,"ctx");this.ctx=t,this.pipeline=js(t),this.pipeline.registerExecutor(Xs),this.pipeline.registerExecutor(Js),this.pipeline.registerExecutor(tl),this.pipeline.registerExecutor(il),this.pipeline.registerExecutor(nl),this.pipeline.registerExecutor(dl),this.pipeline.registerExecutor(gl),this.pipeline.registerExecutor(pl),this.pipeline.registerExecutor(Cl),this.pipeline.registerExecutor(El),this.pipeline.registerExecutor(Il),this.pipeline.registerExecutor(Ml),this.pipeline.registerExecutor($l),this.pipeline.registerExecutor(Pl),this.pipeline.registerExecutor(Ll),this.pipeline.registerExecutor(al)}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(!Pi(t.key,l,a,d))return!1;const g=uo(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(!Pi(t.key,l,a,d)||!a&&!d&&!c&&g&&!l)return!1;const w=uo(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=uo(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||"",y=this.ctx.grid.columns.findIndex(v=>String(v.field)===m);!isNaN(p)&&y>=0&&(l={rowIndex:p,colIndex:y})}}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||"",y=this.ctx.grid.columns.findIndex(v=>String(v.field)===m);!isNaN(p)&&y>=0&&(l={rowIndex:p,colIndex:y})}}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,y=m&&m.rowIndex===l.rowIndex&&m.colIndex===l.colIndex;if((w||p)&&y&&n)return!0;const v=n&&this.ctx.grid.selectedCellRange;n&&(v||this.ctx.grid.selectedRows.length>0||this.ctx.grid.selectedColumns.length>0)&&(v&&(this.ctx.isTransitioningCells=!0),this.pipeline.dispatch({type:"clearSelection"}));const C=this.ctx.dropdownOpen,_=this.isDropdownEditor(l.colIndex),S=zi(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 v&&(this.ctx.isTransitioningCells=!1),!1;w||(t.preventDefault(),t.stopPropagation());for(const E of S)this.pipeline.dispatch(E);return v&&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=zi(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?nt(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?nt(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}}function Hl(e){return new Ol(e)}class ho 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,"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(`
|
|
669
|
+
`))o.preventDefault(),await Us(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 Lo,this.scrollEvents=xs(),this.clickEvents=Es(),this.focusEvents=ks(()=>({isCommittingFromKeyboard:this.isCommittingFromKeyboard,isTransitioningCells:this.isTransitioningCells,isClosingViaToggle:this.isClosingViaToggle,isOpeningDropdown:this.isOpeningDropdown}),()=>{this.isClosingViaToggle=!1}),this.styleElement=document.createElement("style"),this.styleElement.textContent=an,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(){this.grid.gridName&&this.grid.shouldPersistColumnWidths&&this.grid.loadPersistedWidths(),this.pipelineAdapter=Hl(this),this.render(),this.addEventListener("paste",this.handlePaste)}disconnectedCallback(){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),Ct(),this.removeInlineShortcuts(),Fs()}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 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(()=>{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=kt(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){ro(this,o,i,r)}requestUpdate(){this.updatePending||(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=lt(h.key);if(at(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=lt(f.key);if(at(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}),Q(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}),Q(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}),Q(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}),Q(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}),Q(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}),Q(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))ne(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||he(this)});else if(f&&g&&this.grid.isCellEditable(g))ne(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";ne(this,i,r),h?requestAnimationFrame(()=>{this.dropdownOpen||he(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)?In(this,i,r):f?(ne(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||he(this)})):w?(ne(this,i,r),requestAnimationFrame(()=>{var x;const m=(x=this.shadowRoot)==null?void 0:x.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`),y=m==null?void 0:m.querySelector(".wg__date-input"),v=m==null?void 0:m.querySelector(".wg__editor--date");y&&v&&this.openDatePicker(y,v)})):p&&(ne(this,i,r),requestAnimationFrame(()=>{this.openCustomEditor(i,r)}));break}case"Escape":if(o.preventDefault(),this.grid.editingCell)U(this),this.grid.cancelEdit();else if(this.grid.selectedRows.length>0)this.grid.clearSelection();else{const g=this.grid.focusedCell;this.grid.clearFocusedCell(),Q(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;ne(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,y)=>({index:y,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&&(U(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,ue(this),lo(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,ue(this),lo(this))}break;case"Enter":if(this.datepicker)return;o.preventDefault(),o.stopPropagation(),this.dropdownOpen&&this.highlightedIndex>=0?Qo(this,this.highlightedIndex,!0,!0):a&&!this.dropdownOpen?he(this):(this.isCommittingFromKeyboard=!0,V(this),l==="date"&&i instanceof HTMLInputElement?await this.commitDateEditor(i,!0):await xt(this,i,!0),ro(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 y=Me(p,m);await this.grid.commitEdit(r,s,y,w)}V(this)}else V(this),l==="date"&&i instanceof HTMLInputElement?await this.commitDateEditor(i,w):a||await xt(this,i,w);if(w){St(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 ro(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,U(this),this.grid.cancelEdit(),Tn(this,r,s);break;case"F2":o.preventDefault(),o.stopPropagation(),a&&!this.dropdownOpen&&he(this);break;case"Backspace":l==="select"&&(o.preventDefault(),o.stopPropagation(),this.filterText.length>0&&(this.filterText=this.filterText.slice(0,-1),Jo(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,Jo(this,n.editorOptions||{}));break}}attachEventListeners(){const o=this.shadow.querySelector(".wg__table");if(!o)return;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);xn(this,a,d),Et(this);const c=this.grid.focusedRowIndex;this.grid.setFocusedRow(a),this.updateRowFocusVisual(c,a),io(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 w=this.shadow.querySelector(`td[data-row="${h.rowIndex}"][data-col="${h.colIndex}"]`);w&&w.classList.remove("wg__cell--always-edit-focused")}a.classList.add("wg__cell--always-edit-focused");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))&&kn(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=nt(n,a);ne(this,c,u,{cursorPosition:f??void 0});const w=g.editor;w==="select"||w==="combobox"||w==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||he(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=nt(n,a);ne(this,c,u,{cursorPosition:f??void 0});const w=g.editor;w==="select"||w==="combobox"||w==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||he(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,y=a.shiftKey;if(p.editTrigger||this.grid.editTrigger,m!=="disabled"&&(m==="click"&&!y||m==="shift"&&y)){if(this.grid.editingCell){const x=this.grid.editingCell,C=this.grid.columns.findIndex(_=>String(_.field)===x.field);V(this),U(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(),hi(this,f,w,a);return}else this.grid.selectedCellRange&&(this.grid.clearCellSelection(),X())}}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||"",y=this.grid.columns.findIndex(v=>String(v.field)===m);if(y>=0){if(this.clearAllSelections(),this.isTransitioningCells=!0,this.grid.editingCell){const v=this.grid.editingCell,x=this.grid.columns.findIndex(C=>String(C.field)===v.field);V(this),U(this),this.grid.cancelEdit(),this.grid.setFocusedCell(p,y),x>=0&&H(this,v.rowIndex,x)}ne(this,p,y),requestAnimationFrame(()=>{var _;this.isTransitioningCells=!1;const v=(_=this.shadowRoot)==null?void 0:_.querySelector(`.wg__cell[data-row="${p}"][data-field="${m}"]`),x=v==null?void 0:v.querySelector(".wg__date-input"),C=v==null?void 0:v.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,y=l.matches(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(m&&!y){const v=this.grid.columns.findIndex(x=>String(x.field)===m.field);if(w!==m.rowIndex||p!==v){n.preventDefault(),this.isTransitioningCells=!0;const x=m.rowIndex,C=v;V(this),U(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,I=n.clientX;requestAnimationFrame(()=>{if(this.isTransitioningCells=!1,S==="click"&&_&&this.grid.isCellEditable(_)){const k=this.shadow.querySelector(`td[data-row="${w}"][data-col="${p}"]`),R=k?nt({clientX:I},k):void 0;ne(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(y=>String(y.field)===p);if(m>=0){this.isTransitioningCells=!0;const y=this.grid.editingCell,v=y?this.grid.columns.findIndex(x=>String(x.field)===y.field):-1;y&&(V(this),U(this),this.grid.cancelEdit(),this.grid.setFocusedCell(w,m),v>=0&&H(this,y.rowIndex,v)),ne(this,w,m),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||he(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(),Xn(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&&us(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&&ms(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&&Vs(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&&zs(this,g,n)}l.closest(".wg__row-number-header")&&n.button===0&&(n.preventDefault(),this.grid.selectAll(),this.grid.selectedCellRange&&It(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")){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")&&!Is()){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(),X(),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")||di()||!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;X(),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")&&Rn(this,l)}),o.addEventListener("input",n=>{const l=n.target;l.matches(".wg__combobox-input")?Gn(this,n):l.matches(".wg__autocomplete-input")&&Qn(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")?Dn(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(),X()):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=lt(g.key);if(at(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),Fe()!==null&&(Fo(this,this.grid.displayItems),this.renderConnector()),Et(this),this.grid.selectedCellRange&&yi(this),Hs(this)}),this.scrollEvents.subscribe("window",()=>{this.dropdownOpen&&!this.isTransitioningCells&&this.handleScrollCloseDropdown(),Fe()!==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),U(this),this.grid.cancelEdit(),l&&a>=0&&H(this,l.rowIndex,a)}this.grid.selectedCellRange&&(this.grid.clearCellSelection(),X(),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=>{di()||(this.grid.selectedCellRange&&(this.grid.clearCellSelection(),X()),this.grid.selectedRows.length>0&&(this.grid.clearSelection(),Qe()),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection(),Je()),ds(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");co(this,a,c,this._tooltipShowDelay,!0);return}const d=l.closest("[data-tooltip]");if(d){const c=d.getAttribute("data-tooltip");co(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&&Zo(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&&(Qt(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),Qt(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(!(Fe()!==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=Gt(h,this.grid.cellToolbarOffset);Jt(f,d,"start")}else Jt(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 y=this.grid.cellToolbar(p,c,h,f)||this.grid.rowToolbar,v=JSON.stringify(y);v!==this.currentCellToolbarItems&&(this.currentCellToolbarItems=v,this.updateToolbarWithCellItems(c,y));const x=g.getBoundingClientRect(),C=Gt(x,this.grid.cellToolbarOffset);Jt(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);Qt(c)?this.closeToolbarAndReset():this.showToolbarForRow(d,c,l.clientX)}}),this.toolbarOutsideClickAdded||(this.toolbarOutsideClickAdded=!0,document.addEventListener("click",n=>{if(!Ho(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")||Fe()!==null&&this.closeToolbarAndReset()})),this.shadow.querySelectorAll(".wg__pagination").forEach(n=>{n.addEventListener("click",a=>{cs(this,a)&&this.render()});const l=n.querySelector(".wg__pagination-select");l&&l.addEventListener("change",()=>{gs(this,l)&&this.render()})})}scrollToRowProgrammatically(o){const i=this.shadow.querySelector(".wg");if(!i)return;const{scrollTop:r,startIndex:s,endIndex:n}=ls({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}=ss({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=No(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}),Q(this,null,n))}}handleInfiniteScroll(o){as(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">
|
|
670
670
|
<span class="wg__shortcuts-help-key">${ns(d.key)}</span>
|
|
671
671
|
<span class="wg__shortcuts-help-label">${d.label}</span>
|
|
672
672
|
</div>`).join(""),s=((a=(l=this.grid).shortcutsHelpContentCallback)==null?void 0:a.call(l))||"";return`
|
|
@@ -682,20 +682,20 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
682
682
|
${s?`<div class="wg__shortcuts-help-custom">${s}</div>`:""}
|
|
683
683
|
<div class="wg__shortcuts-help-title">${this.grid.labels.keyboardShortcuts}</div>
|
|
684
684
|
<div class="wg__shortcuts-help-list">
|
|
685
|
-
${
|
|
685
|
+
${r}
|
|
686
686
|
</div>
|
|
687
687
|
</div>
|
|
688
688
|
</div>
|
|
689
|
-
`}render(){var x;const o=this.shadow.querySelector(".wg"),i=this.grid.tableBorderOnly&&this.shadow.querySelector(".wg__table-container")||o,
|
|
689
|
+
`}render(){var x;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=bn(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(C=>C.trim()),d=this.grid.summaryPosition?this.grid.summaryPosition.split("|").map(C=>C.trim()):[],c=(C,_)=>{const S=a.filter(M=>_?M.startsWith("top-"):M.startsWith("bottom-")),E=d.filter(M=>_?M.startsWith("top-"):M.startsWith("bottom-")),I=S.length>0,k=E.length>0;return!I&&!k?"":k&&I&&this.grid.isSummaryInline?`<div class="wg__footer${_?" wg__footer--top":""}">
|
|
690
690
|
${oo(this,E[0])}
|
|
691
691
|
${to(this,S[0])}
|
|
692
692
|
</div>`:[...new Set([...S,...E])].map(M=>{const z=S.includes(M),D=E.includes(M);return D&&z?`<div class="wg__footer${_?" wg__footer--top":""}">
|
|
693
693
|
${oo(this,M)}
|
|
694
694
|
${to(this,M)}
|
|
695
|
-
</div>`:D?oo(this,M):to(this,M)}).join("")},u=c(a,!0),g=c(a,!1),h=this.grid.shouldUseVirtualScroll();let f;if(h){const C=this.grid.displayItems,_=this.grid.virtualScrollRowHeight,S=this.grid.virtualScrollBuffer,E=(o==null?void 0:o.clientHeight)||400,I=Math.max(0,Math.floor(
|
|
695
|
+
</div>`:D?oo(this,M):to(this,M)}).join("")},u=c(a,!0),g=c(a,!1),h=this.grid.shouldUseVirtualScroll();let f;if(h){const C=this.grid.displayItems,_=this.grid.virtualScrollRowHeight,S=this.grid.virtualScrollBuffer,E=(o==null?void 0:o.clientHeight)||400,I=Math.max(0,Math.floor(r/_)-S),k=Math.ceil(E/_)+S*2,R=Math.min(C.length,I+k);this.virtualScrollStart=I,this.virtualScrollEnd=R;const M={startIndex:I,endIndex:R,rowHeight:_,totalItems:C.length};f=No(this,M)}else f=vn(this);h&&l.classList.add("wg--virtual-scroll");const w=this.renderShortcutsHelpIcon(),p=`
|
|
696
696
|
<table class="wg__table">
|
|
697
697
|
<thead>
|
|
698
|
-
${
|
|
698
|
+
${_n(this)}
|
|
699
699
|
</thead>
|
|
700
700
|
<tbody>
|
|
701
701
|
${f}
|
|
@@ -706,10 +706,10 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
706
706
|
${u}
|
|
707
707
|
${m}
|
|
708
708
|
${g}
|
|
709
|
-
`;l.innerHTML=y,this.shadow.appendChild(l);const v=this.grid.tableBorderOnly&&l.querySelector(".wg__table-container")||l;if(h){const C=Math.max(0,this.grid.displayItems.length*this.grid.virtualScrollRowHeight-v.clientHeight);v.scrollTop=Math.min(
|
|
709
|
+
`;l.innerHTML=y,this.shadow.appendChild(l);const v=this.grid.tableBorderOnly&&l.querySelector(".wg__table-container")||l;if(h){const C=Math.max(0,this.grid.displayItems.length*this.grid.virtualScrollRowHeight-v.clientHeight);v.scrollTop=Math.min(r,C)}else v.scrollTop=r;if(v.scrollLeft=s,this.attachEventListeners(),this.grid.editingCell){const{rowIndex:C,field:_}=this.grid.editingCell;let S=this.shadow.querySelector(`.wg__combobox-input[data-row="${C}"][data-field="${_}"],
|
|
710
710
|
.wg__autocomplete-input[data-row="${C}"][data-field="${_}"],
|
|
711
711
|
.wg__select-trigger[data-row="${C}"][data-field="${_}"],
|
|
712
|
-
.wg__date-input[data-row="${C}"][data-field="${_}"]`);if(S||(S=this.shadow.querySelector(`.wg__editor[data-row="${C}"][data-field="${_}"]`)),S&&(S.focus(),S instanceof HTMLInputElement&&S.type==="text")){const E=this.grid.editingCell.cursorPosition,I=this.getCurrentEditingColumn(),k=((x=I==null?void 0:I.editorOptions)==null?void 0:x.editStartSelection)||this.grid.editStartSelection;if(this.grid.editingCell.initialSearchQuery!==void 0){const R=S.value.length;S.setSelectionRange(R,R)}else switch(k){case"mousePosition":if(E!==void 0){const R=Math.min(E,S.value.length);S.setSelectionRange(R,R)}else S.setSelectionRange(S.value.length,S.value.length);break;case"cursorAtStart":S.setSelectionRange(0,0);break;case"cursorAtEnd":S.setSelectionRange(S.value.length,S.value.length);break;case"selectAll":default:S.select();break}}}else if(
|
|
712
|
+
.wg__date-input[data-row="${C}"][data-field="${_}"]`);if(S||(S=this.shadow.querySelector(`.wg__editor[data-row="${C}"][data-field="${_}"]`)),S&&(S.focus(),S instanceof HTMLInputElement&&S.type==="text")){const E=this.grid.editingCell.cursorPosition,I=this.getCurrentEditingColumn(),k=((x=I==null?void 0:I.editorOptions)==null?void 0:x.editStartSelection)||this.grid.editStartSelection;if(this.grid.editingCell.initialSearchQuery!==void 0){const R=S.value.length;S.setSelectionRange(R,R)}else switch(k){case"mousePosition":if(E!==void 0){const R=Math.min(E,S.value.length);S.setSelectionRange(R,R)}else S.setSelectionRange(S.value.length,S.value.length);break;case"cursorAtStart":S.setSelectionRange(0,0);break;case"cursorAtEnd":S.setSelectionRange(S.value.length,S.value.length);break;case"selectAll":default:S.select();break}}}else if(n&&!this.grid.editingCell){const C=l.querySelector(`td[data-row="${n.rowIndex}"][data-col="${n.colIndex}"]`);C&&setTimeout(()=>C.focus(),0)}h&&requestAnimationFrame(()=>{l.style.pointerEvents="none",requestAnimationFrame(()=>{l.style.pointerEvents=""})}),this.renderConnector(),Et(this),this.grid.selectedCellRange&&yi(this),this.grid.selectedRows.length>0?Ei(this):Qe(),this.grid.selectedColumns.length>0?Ri(this):Je()}renderConnector(){const o=this.shadow.querySelector(".wg__connector");o&&o.remove();const i=pn();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(),X(),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(),Qe(),this.shadow.querySelectorAll(".wg__row--selected").forEach(i=>i.classList.remove("wg__row--selected"))),this.grid.selectedColumns.length>0&&(this.grid.clearColumnSelection_noRender(),Je(),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 yt({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,U(this),this.grid.cancelEdit(),c>=0&&d>=0){Sn(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=_t(s);o.value=Yt(i,n),o.dataset.dateValue=vt(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=_t(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=vt(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=`
|
|
713
713
|
<div class="wg__goto-dialog">
|
|
714
714
|
<label class="wg__goto-label">Go to row (1-${i.length}):</label>
|
|
715
715
|
<input type="number" class="wg__goto-input" min="1" max="${i.length}" value="1" />
|
|
@@ -718,4 +718,4 @@ toolbarColumn takes priority — cursor following is disabled.`,n)}requestUpdate
|
|
|
718
718
|
<button type="button" class="wg__goto-btn wg__goto-btn--go">Go</button>
|
|
719
719
|
</div>
|
|
720
720
|
</div>
|
|
721
|
-
`;const s=n.querySelector(".wg__goto-input"),r=n.querySelector(".wg__goto-btn--go"),l=n.querySelector(".wg__goto-btn--cancel"),a=()=>{n.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(),Q(this,g,{rowIndex:u,colIndex:o}))}};r.addEventListener("click",d),l.addEventListener("click",a),n.addEventListener("click",c=>{c.target===n&&a()}),s.addEventListener("keydown",c=>{c.key==="Enter"?(c.preventDefault(),d()):c.key==="Escape"&&(c.preventDefault(),a())}),this.shadow.appendChild(n),s.focus(),s.select()}openCustomEditor(o,i){const n=this.grid.columns[i];if(!n||n.editor!=="custom"||!n.cellEditCallback)return;const s=String(n.field),r=this.grid.displayItems[o];if(!r)return;const a={value:this.grid.getCellRawValue(r,o,s),row:r,rowIndex:o,field:s,commit:d=>{this.grid.commitEdit(o,s,d),U(this),requestAnimationFrame(()=>{q(this,o,i)})},cancel:()=>{U(this),this.grid.cancelEdit(),requestAnimationFrame(()=>{q(this,o,i)})}};n.cellEditCallback(a)}handleContextMenu(o){const i=o.target,n=i.closest(".wg__header");if(n){this.handleHeaderContextMenu(o,n);return}if(i.closest("th.wg__filler")){this.handleFillerContextMenu(o);return}const r=this.grid.contextMenu;if(!r||r.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=ts(this,o.clientX,o.clientY,this.grid.contextMenuXOffset,this.grid.contextMenuYOffset,r,f,m=>{const y=r.find(v=>v.id===m);y!=null&&y.onclick&&y.onclick(f),this.contextMenuElement&&(de(this.contextMenuElement),this.contextMenuElement=null)},()=>{this.contextMenuElement=null})}handleHeaderContextMenu(o,i){const n=this.grid.headerContextMenu;if(!n||n.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 r=this.grid.columns.findIndex(f=>String(f.field)===s);if(r===-1)return;const l=this.grid.columns[r],a=this.grid.freezeColumns,d=r<a,c=this.grid.sort.find(f=>f.column===s),u=(c==null?void 0:c.direction)??null,g={column:l,field:s,columnIndex:r,sortDirection:u,isFrozen:d,allColumns:this.grid.columns,labels:this.grid.labels};this.grid.onheadercontextmenuopen&&this.grid.onheadercontextmenuopen(g);const h=oi(n,g);h.length!==0&&(this.headerContextMenuElement=ri(this,o.clientX,o.clientY,h,g,(f,w,p)=>{if(["sortAsc","sortDesc","clearSort","hideColumn","freezeColumn","unfreezeColumn"].includes(f)&&is(this,f,g,p),f==="show-all-columns"){this.grid.columns.forEach(v=>{v.isHidden=!1}),this.grid.columns=[...this.grid.columns];return}if(f.startsWith("toggle-col-")){const v=f.replace("toggle-col-",""),x=this.grid.columns.find(C=>String(C.field)===v);x&&(x.isHidden=!x.isHidden,this.grid.columns=[...this.grid.columns]);return}const y=h.find(v=>v.id===f);y!=null&&y.onclick&&y.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 n=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(n.length===0)return;const s={column:null,field:"",columnIndex:-1,sortDirection:null,isFrozen:!1,allColumns:this.grid.columns,labels:this.grid.labels},r=oi(n,s);r.length!==0&&(this.headerContextMenuElement=ri(this,o.clientX,o.clientY,r,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=r.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=Fe();if(s===null||!Ho(this.shadow))return;const r=this.grid.displayItems[s];if(!r)return;const l=this.grid.columns;for(const a of o){const d=lt(a.key);if(at(i,d)){const c={row:r,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 r=this.grid.displayItems[s];if(!r)return;const l=this.grid.columns;for(const a of o){const d=lt(a.key);if(at(i,d)){const c={row:r,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,n){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,n):hr(c,u==null?void 0:u.key);co(this,a,h,0,!0)}),a.addEventListener("mouseleave",()=>{Zo(this)})})}showToolbarForRow(o,i,n){if(this.grid.toolbarPosition==="inline"||!this.grid.isRowToolbarVisible||!this.grid.rowToolbar.length)return;const s=Xe(this.grid.rowToolbar),r=this.grid.displayItems[i];if(!r)return;if(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),this.currentCellToolbarItems=null,fr(this,o,i,s,r,a=>{this.handleToolbarItemClick(a,i,r)},n),this.setupToolbarShortcuts(),this.renderConnector(),this.setupToolbarTooltips(s,r,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),Ct()}updateToolbarWithCellItems(o,i){const n=this.grid.displayItems[o];if(!n)return;const s=Xe(this.grid.rowToolbar),r=Xe(i),l=new Map(r.map(f=>[f.id,f])),a=[...r];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=pr();if(!c)return;const u=Oo(a,n,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,n,o)}}handleScrollCloseDropdown(){const o=this.grid.editingCell,i=o?this.grid.columns.findIndex(n=>String(n.field)===o.field):-1;V(this),U(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,n=i?this.grid.columns.findIndex(s=>String(s.field)===i.field):-1;V(this),U(this),this.grid.cancelEdit(),i&&n>=0&&H(this,i.rowIndex,n)}handleComboboxBlur(o){if(V(this),this.grid.editingCell){const i=this.grid.editingCell,n=this.grid.columns.findIndex(r=>String(r.field)===i.field),s=this.getCurrentEditingColumn();if(s){const r=s.editorOptions||{},a=(r.options||r.initialOptions||[]).find(c=>He(c,r).toLowerCase()===o.value.toLowerCase()),d=a?Te(a,r):o.value;U(this),this.grid.commitEdit(i.rowIndex,i.field,d),n>=0&&H(this,i.rowIndex,n)}}}handleToolbarItemClick(o,i,n){const s=this.grid.displayItems.findIndex(l=>l===n);if(s===-1){this.closeToolbarAndReset();return}const r=o.id==="moveUp"||o.id==="moveDown";if(r&&(this.toolbarMoveInProgress=!0),o.onclick&&o.onclick({row:n,rowIndex:s}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:o,rowIndex:s,row:n}),o.id==="delete"){this.closeToolbarAndReset();return}r?(this.render(),Fo(this,this.grid.displayItems),this.renderConnector()):this.render()}handleInlineActionClick(o,i){if(!o)return;const s=Xe(this.grid.rowToolbar).find(l=>l.id===o),r=this.grid.displayItems[i];!s||!r||(s.onclick&&s.onclick({row:r,rowIndex:i}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:s,rowIndex:i,row:r}),this.render())}}typeof customElements<"u"&&!customElements.get("web-grid")&&customElements.define("web-grid",ho),te.GridElement=ho,te.WebGrid=Lo,te.default=ho,Object.defineProperties(te,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
721
|
+
`;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(),Q(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),U(this),requestAnimationFrame(()=>{q(this,o,i)})},cancel:()=>{U(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=os(this,o.clientX,o.clientY,this.grid.contextMenuXOffset,this.grid.contextMenuYOffset,n,f,m=>{const y=n.find(v=>v.id===m);y!=null&&y.onclick&&y.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=oi(r,g);h.length!==0&&(this.headerContextMenuElement=ni(this,o.clientX,o.clientY,h,g,(f,w,p)=>{if(["sortAsc","sortDesc","clearSort","hideColumn","freezeColumn","unfreezeColumn"].includes(f)&&rs(this,f,g,p),f==="show-all-columns"){this.grid.columns.forEach(v=>{v.isHidden=!1}),this.grid.columns=[...this.grid.columns];return}if(f.startsWith("toggle-col-")){const v=f.replace("toggle-col-",""),x=this.grid.columns.find(C=>String(C.field)===v);x&&(x.isHidden=!x.isHidden,this.grid.columns=[...this.grid.columns]);return}const y=h.find(v=>v.id===f);y!=null&&y.onclick&&y.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=oi(r,s);n.length!==0&&(this.headerContextMenuElement=ni(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=Fe();if(s===null||!Ho(this.shadow))return;const n=this.grid.displayItems[s];if(!n)return;const l=this.grid.columns;for(const a of o){const d=lt(a.key);if(at(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=lt(a.key);if(at(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):fn(c,u==null?void 0:u.key);co(this,a,h,0,!0)}),a.addEventListener("mouseleave",()=>{Zo(this)})})}showToolbarForRow(o,i,r){if(this.grid.toolbarPosition==="inline"||!this.grid.isRowToolbarVisible||!this.grid.rowToolbar.length)return;const s=Xe(this.grid.rowToolbar),n=this.grid.displayItems[i];if(!n)return;if(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),this.currentCellToolbarItems=null,wn(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),Ct()}updateToolbarWithCellItems(o,i){const r=this.grid.displayItems[o];if(!r)return;const s=Xe(this.grid.rowToolbar),n=Xe(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=mn();if(!c)return;const u=Oo(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),U(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),U(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=>He(c,n).toLowerCase()===o.value.toLowerCase()),d=a?Me(a,n):o.value;U(this),this.grid.commitEdit(i.rowIndex,i.field,d),r>=0&&H(this,i.rowIndex,r)}}}handleToolbarItemClick(o,i,r,s,n){const l=this.grid.displayItems.findIndex(d=>d===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(),Fo(this,this.grid.displayItems),this.renderConnector()):this.render()}handleInlineActionClick(o,i,r,s){if(!o)return;const l=Xe(this.grid.rowToolbar).find(d=>d.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}),this.render())}}typeof customElements<"u"&&!customElements.get("web-grid")&&customElements.define("web-grid",ho),te.GridElement=ho,te.WebGrid=Lo,te.default=ho,Object.defineProperties(te,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|