@gramlot/gramlot 0.3.36 → 0.3.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/charts/__init__.py +1 -1
- package/dist/components/charts/assets/collection.js +9 -9
- package/dist/components/charts/assets/index.js +1 -1
- package/dist/components/charts/grammar.json +0 -30
- package/dist/components/drawing/__init__.py +1 -1
- package/dist/components/drawing/assets/collection.js +3 -3
- package/dist/components/drawing/assets/index.js +1 -1
- package/dist/components/grid/__init__.py +1 -1
- package/dist/components/grid/assets/collection.js +6 -6
- package/dist/components/grid/assets/index.js +1 -1
- package/dist/components/grid/grammar.json +0 -2
- package/dist/components/inputs/__init__.py +1 -1
- package/dist/components/inputs/assets/collection.js +8 -8
- package/dist/components/inputs/assets/index.js +1 -1
- package/dist/components/inputs/grammar.json +2 -1
- package/dist/components/layout/__init__.py +1 -1
- package/dist/components/layout/assets/collection.js +9 -9
- package/dist/components/layout/assets/index.js +1 -1
- package/dist/components/layout/grammar.json +2 -2
- package/dist/components/selection_trial/__init__.py +1 -1
- package/dist/components/selection_trial/assets/collection.js +3 -3
- package/dist/components/selection_trial/assets/index.js +1 -1
- package/dist/components/tree/__init__.py +1 -1
- package/dist/components/tree/assets/collection.js +6 -6
- package/dist/components/tree/assets/index.js +1 -1
- package/dist/components/tree/grammar.json +0 -1
- package/dist/components/uploads/__init__.py +1 -1
- package/dist/components/uploads/assets/collection.js +3 -3
- package/dist/components/uploads/assets/index.js +1 -1
- package/dist/components/uploads/grammar.json +0 -3
- package/dist/gramlot.js +1205 -627
- package/dist/gramlot.min.js +45 -45
- package/dist/standard-collections.js +1 -1
- package/package.json +2 -3
- package/src/binding/data-binder.js +11 -3
- package/src/binding/grid-struct.js +7 -4
- package/src/binding/runtime.js +203 -46
- package/src/builder/binding.json +23 -1
- package/src/builder/gramlot-builder.d.ts +1 -4
- package/src/builder/source.js +185 -29
- package/src/chat.js +26 -20
- package/src/components/attachment-manager.js +38 -34
- package/src/components/chart-data-view.js +4 -7
- package/src/components/chart-fields.js +18 -6
- package/src/components/chart-renderer.js +10 -3
- package/src/components/chart-timeline.js +7 -5
- package/src/components/charts.js +74 -67
- package/src/components/check-box-text-editor.js +3 -3
- package/src/components/check-box-text.js +7 -22
- package/src/components/check-box-tree.js +20 -16
- package/src/components/choice-editor.js +1 -1
- package/src/components/drawing.js +47 -34
- package/src/components/grid-cell-editor.js +72 -29
- package/src/components/grid-column-filters.js +47 -40
- package/src/components/grid-formulas.js +22 -17
- package/src/components/grid-header-interaction.js +9 -11
- package/src/components/grid-row-interaction.js +25 -24
- package/src/components/grid-row-layout.js +28 -29
- package/src/components/grid-search-box.js +3 -3
- package/src/components/grid-search.js +3 -8
- package/src/components/grid-selection.js +33 -29
- package/src/components/grid-structure.js +48 -10
- package/src/components/grid-tools.js +14 -14
- package/src/components/grid.js +83 -79
- package/src/components/image-crop-dialog.js +2 -2
- package/src/components/image-crop.js +16 -9
- package/src/components/image-uploader.js +21 -28
- package/src/components/inputs.js +19 -1
- package/src/components/registry.js +3 -5
- package/src/components/tray-pane.js +85 -61
- package/src/components/tree.js +332 -239
- package/src/components/upload-engine.js +10 -2
- package/src/components/uploader.js +31 -27
- package/src/editing-session.d.ts +4 -1
- package/src/editing-session.js +120 -83
- package/src/experiments/window-selection.js +4 -6
- package/src/filesystem.js +2 -2
- package/src/gramlot.js +1 -0
- package/src/handlers/device-handler.js +219 -213
- package/src/handlers/rpc-handler.d.ts +17 -0
- package/src/handlers/rpc-handler.js +22 -0
- package/src/ide-documents.js +29 -11
- package/src/ide-runtime.js +33 -31
- package/src/index-page-runtime.d.ts +2 -2
- package/src/index-page-runtime.js +67 -48
- package/src/message-port-connection.js +100 -0
- package/src/message-port-store.js +158 -0
- package/src/page-store-connection.js +6 -1
- package/src/renderer/gramlot-renderer.js +21 -2
- package/src/source-picker.d.ts +2 -2
- package/src/source-picker.js +15 -6
- package/src/stores/bag-collection-store.js +25 -7
- package/src/stores/bag-collection-view.js +23 -22
- package/src/view/controls.js +1 -1
- package/src/view/html.js +40 -20
- package/src/visual-editor-canvas.js +1 -1
- package/src/visual-editor.js +18 -19
- package/tools/gramlot-tools-inspector.js +400 -374
- package/tools/inspector-agent.js +223 -49
- package/dist/components/vizabi/__init__.py +0 -13
- package/dist/components/vizabi/assets/collection.js +0 -4
- package/dist/components/vizabi/assets/index.js +0 -3
- package/dist/components/vizabi/commands.json +0 -7
- package/dist/components/vizabi/grammar.json +0 -128
- package/src/components/vizabi-session.js +0 -66
- package/src/components/vizabi.js +0 -66
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{a as Et,b as N}from"./modules/chunk-BLMUM44K.js";var A={"assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt":new URL("./files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt",import.meta.url),"assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt":new URL("./files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt",import.meta.url)};import{Bag as et,sourceTarget as S}from"@gramlot/gramlot";import{sharedModules as At}from"@gramlot/gramlot";var St=c=>At["./components/popup.js"][c],R=St("positionPopup");import{sharedModules as Tt}from"@gramlot/gramlot";var Dt=c=>Tt["@genrojs/tytx"][c];var z=Dt("isDecimal");var E=class{constructor(t,e){this.store=t,this.format=e}read(t,e=this.store.getRows()){return e.map(i=>({node:i,cells:t.map(r=>r.check?"":C(this.store.value(i,r.field),r,this.format))}))}};function C(c,t,e){if(c==null)return"";let{dtype:i,format:r}=t;if(i==="T"&&typeof c!="string"||i==="B"&&typeof c!="boolean")throw new TypeError(`grid ${t.field} does not match ${i}`);if(typeof c=="string"||typeof c=="boolean"){if(i&&!["T","B"].includes(i)||r!=null)throw new TypeError(`grid ${t.field} requires a typed numeric or temporal value`);return String(c)}if(c instanceof Date||r!=null)return e(c,{dtype:i,pattern:r??"short"});if(i&&!["L","R","N"].includes(i))throw new TypeError(`grid ${t.field} does not match ${i}`);if(i==="L"&&!Number.isInteger(c))throw new TypeError("grid L requires an integer");if(typeof c=="number"&&Number.isFinite(c)||z(c)&&c.isFinite())return String(c);throw new TypeError(`grid ${t.field} requires a scalar value`)}import{sharedModules as Lt}from"@gramlot/gramlot";var Nt=c=>Lt["./renderer/attributes.js"][c],y=Nt("SVG_NS");import{sharedModules as Ct}from"@gramlot/gramlot";var _t=c=>Ct["./random-id.js"][c],M=_t("randomId");var F=class{#t;#e;#s;#o=[];#i;#l;#r;#a=null;#n=null;#h;#A;#S;#x;#c;#y=!1;#u=[];#p;#E=[];#v=!1;#b=!1;constructor(t,e){this.#t=t,this.#e=e;let i=this.#r=t.ownerDocument.createElement("div");i.className="column-filter-panel",i.setAttribute("popover","auto"),i.setAttribute("role","dialog");let r=t.ownerDocument.createElement("slot");r.name="column-filter",i.append(r),i.addEventListener("toggle",s=>{s.newState==="closed"&&!i.matches(":popover-open")&&this.#N()}),t.addEventListener("keydown",s=>{this.#a&&s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),this.close())}),t.shadowRoot.append(i)}setSourceContext(t){this.#l=t;let e=t.sourceNode,i=e.rootBuilder;e.staticValue===null&&e.setValue(new i.source.constructor(null,i),!1),t.sourceNode.rootBuilder.binding.bindingFor(t.sourceNode).track(()=>this.dispose())}#f(){if(this.#c)return;let t=this.#l.sourceNode,e=t.rootBuilder;this.#x=`_gramlot.grid.${M()}.columnFilter`,this.#c=new et({rows:new et,checked:"",title:"",summary:"",from:null,to:null,hideRange:!0,rangeError:""}),t.setRelativeData(this.#x,this.#c);let i=e.wrapSource(t).div({node_label:`column_filter_${M()}`,slot:"column-filter",display:"flex",flex_direction:"column",gap:"8px",padding:"10px",style:"font-size:12px;--gramlot-grid-row-height:28px;--gramlot-grid-font-size:12px;--gramlot-grid-cell-padding:4px 7px;--gramlot-menu-item-padding:4px 7px"});this.#h=S(i),this.#h.setAttr({datapath:this.#x});let r=new e.source.constructor(null,e),s=e.wrapSource(r);s.div("^.title",{font_weight:"600",padding:"0 2px"});let o=s.div({display:"flex",gap:"8px",hidden:"^.hideRange"});this.#u=[S(o.dateTextBox({value:"^.from",period_to:".to",lbl:"From",width:"136px"})),S(o.dateTextBox({value:"^.to",lbl:"To",width:"136px"}))],s.div("^.rangeError",{role:"alert",color:"var(--gramlot-error)"});let n=s.frameGrid({storepath:".rows",rowMode:"attributes",height:"270px",width:"100%"});this.#A=S(n),this.#S=S(n.toolbar.menuline({group:!0,class:"gramlot-grid-search"}).searchBox({searchOn:"Value:caption",searchLiteral:!0}));let a=n.grid;a.setAttr({sortedBy:"caption:a"});let d=a.struct();d.column({field:"selected",name:"\u2713",title:"Selected values",width:"32px",align:"center",check:"multiple",checked:"^.checked",checkedField:"id"}),d.column({field:"caption",name:"Value",width:"170px"}),d.column({field:"count",name:"Rows",dtype:"L",width:"64px",align:"end"});let l=s.menu({presentation:"bar",aria_label:"Column filter actions"});Object.defineProperty(S(l),"gridColumnFilters",{value:this,configurable:!0});for(let[m,h]of[["All","selectAll"],["None","selectNone"],["Reset","reset"]])l.menuline({caption:m,action:`this.parentBag.parentNode.gridColumnFilters.${h}()`});s.div("^.summary",{color:"var(--gramlot-text-secondary)",font_size:"11px",padding:"0 2px"});let p=e.binding.gramlot.src.prepareSource(r);e.binding.renderer.validateCandidate(p),this.#h.setValue(p),this.#k()}#k(){if(!this.#c||this.#E.length)return;let t=this.#l.sourceNode.rootBuilder.binding.router;this.#E.push(t.register({path:this.#x+".checked",recipient:{receive:()=>this.#w()}}));for(let e of["from","to"])this.#E.push(t.register({path:this.#x+"."+e,recipient:{receive:()=>this.#T()}}))}#w(){if(this.#b||this.#n===null)return;let t=","+this.#c.getItem("checked")+",",e=this.#c.getItem("rows").getNodes(),i=e.filter(r=>t.includes(","+r.label+",")).map(r=>r.getAttr("value"));this.#s.applyColumnFilter(this.#n,this.#s.columnRange(this.#n)&&i.length===e.length?null:i)}#T(){this.#b||this.#y||this.#n===null||(this.#y=!0,queueMicrotask(()=>{this.#y=!1,this.#n!==null&&this.#v&&this.#B()}))}#B(){let t=this.#o.find(o=>o.field===this.#n);if(!["D","DH","DHZ"].includes(t.dtype))return;let e=this.#c.getItem("from"),i=this.#c.getItem("to"),r=this.#s.columnRange(this.#n);if(r?.from&&!e&&(i=null,this.#b=!0,this.#c.setItem("to",null),this.#b=!1),e&&i&&e>i){this.#c.setItem("rangeError","From must not be after To.");return}if(this.#c.setItem("rangeError",""),+e==+(r?.from??null)&&+i==+(r?.to??null))return;let s=!e&&!i?this.#s.columnFacets(this.#n).filter(o=>o.selected).map(o=>o.value):null;this.#s.applyColumnFilter(this.#n,s,{from:e,to:i,dtype:t.dtype,timeZone:this.#l.timeZone})}selectAll(){this.#s.applyColumnFilter(this.#n,this.#s.columnRange(this.#n)?null:this.#s.columnFacets(this.#n).map(t=>t.value))}selectNone(){this.#s.applyColumnFilter(this.#n,[])}reset(){this.#b=!0;try{this.#c.setItem("from",null),this.#c.setItem("to",null),this.#c.setItem("rangeError","");let t=this.#l.sourceNode.rootBuilder.binding.renderer;for(let e of this.#u)t.getDomNode(e).restoreFormValue(null)}finally{this.#b=!1}this.#s.applyColumnFilter(this.#n,null,null)}button(t){let e=this.#t.ownerDocument,i=e.createElement("button");i.type="button",i.className="column-filter",i.dataset.field=t.field,i.setAttribute("aria-label",`Filter ${t.title??t.name}`),i.setAttribute("aria-haspopup","dialog"),i.setAttribute("aria-expanded","false"),i.title=`Filter ${t.title??t.name}`;let r=e.createElementNS(y,"svg");r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("aria-hidden","true");let s=e.createElementNS(y,"path");return s.setAttribute("d","M3 5h18l-7 8v6l-4 2v-8z"),r.append(s),i.append(r),i}update(t,e,i,r){t!==this.#s&&(this.close(),this.#p?.(),this.#p=null,this.#s=t),this.#o=e,this.#i=r,(!i||this.#a&&!this.#a.isConnected)&&this.close(),this.#v&&!this.#p&&(this.#p=t.subscribe(this.refresh)),this.refresh()}#L=t=>{let e=t.target.closest(".column-filter");if(!e)return;if(t.stopPropagation(),e===this.#a){this.close();return}this.close(),this.#f(),this.#a=e,this.#n=e.dataset.field,this.#b=!0;let i=this.#s.columnRange(this.#n);this.#c.setItem("from",i?.from??null),this.#c.setItem("to",i?.to??null),this.#c.setItem("rangeError","");let r=this.#o.find(o=>o.field===this.#n);this.#c.setItem("hideRange",!["D","DH","DHZ"].includes(r.dtype));let s=this.#l.sourceNode.rootBuilder.binding.renderer;for(let[o,n]of["from","to"].entries())s.getDomNode(this.#u[o]).restoreFormValue(this.#c.getItem(n));this.#c.getItem("rows").clear(),this.#c.setItem("checked",""),s.getDomNode(this.#S).clear(),this.#b=!1,this.refresh(),this.#r.showPopover(),e.setAttribute("aria-expanded","true"),this.#d(),this.#l.sourceNode.rootBuilder.binding.renderer.getDomNode(this.#S).focus()};refresh=()=>{if(!this.#s)return;for(let n of this.#e.querySelectorAll(".column-filter")){let a=this.#s.columnFilter(n.dataset.field)!==null||this.#s.columnRange(n.dataset.field)!==null;n.classList.toggle("active",a),n.closest("th").classList.toggle("column-filtered",a),n.setAttribute("aria-pressed",String(a))}if(this.#n===null)return;let t=this.#o.find(n=>n.field===this.#n);if(!t){this.close();return}let e=t.title??t.name;this.#r.setAttribute("aria-label",`Filter ${e}`);let i=this.#s.columnFacets(this.#n),r=this.#c.getItem("rows");this.#A.setAttr({height:`${76+28*Math.max(1,Math.min(i.length,8))}px`});let s=new Map(r.getNodes().map(n=>[n.getAttr("key"),n])),o=[];this.#b=!0;try{this.#c.setItem("title",e);for(let a of i){let d=a.value===null?"Empty":C(a.value,t,this.#i),l={key:a.key,value:a.value,caption:d,count:a.count},p=s.get(a.key);if(p)s.delete(a.key),p.setAttr(l);else{let m=`v_${M()}`;r.setItem(m,null,{...l,id:m}),p=r.getNode(m)}a.selected&&o.push(p.label)}for(let a of s.values())r.popNode(a.label);let n=o.join(",");this.#c.getItem("checked")!==n&&this.#c.setItem("checked",n),this.#c.setItem("summary",`${o.length} of ${i.length} values selected`)}finally{this.#b=!1}this.#d()};#d=()=>{this.#a&&R(this.#r,this.#a,{align:"start"})};#N(){this.#a?.setAttribute("aria-expanded","false"),this.#a=null,this.#n=null}close(){if(!this.#a)return;let t=this.#a;this.#r.hidePopover(),this.#N(),t.isConnected&&t.focus({preventScroll:!0})}connect(){this.#v||(this.#v=!0,this.#k(),this.#e.addEventListener("click",this.#L),this.#t.ownerDocument.defaultView.addEventListener("resize",this.#d),this.#t.ownerDocument.defaultView.addEventListener("scroll",this.#d,!0))}disconnect(){this.close(),this.#v=!1,this.#p?.(),this.#p=null;for(let t of this.#E)t.close();this.#E=[],this.#e.removeEventListener("click",this.#L),this.#t.ownerDocument.defaultView.removeEventListener("resize",this.#d),this.#t.ownerDocument.defaultView.removeEventListener("scroll",this.#d,!0)}dispose(){this.disconnect(),this.#x&&this.#l.sourceNode.data.popNode(this.#x)}};import{Bag as J}from"@gramlot/gramlot";var w={};Et(w,{defineCollection:()=>Rt});N(w,ve);import*as ve from"@gramlot/gramlot/components";import{defineCollection as Bt}from"@gramlot/gramlot/components";function Rt(c){if(c.name!=="grid")throw new Error("Unexpected bundled collection");let t=[],e={writeExcelFileLicense:A["assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt"],fflateLicense:A["assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt"]};c.css?.forEach((i,r)=>{i.href=t[r].href});for(let[i,r]of Object.entries(c.assets??{}))r.href=e[i].href;return Bt({...c,css:t,assets:e})}import{sharedModules as zt}from"@gramlot/gramlot";var Mt=c=>zt["./components/parameters.js"][c];var it=Mt("projectParameters");function _(c){return class extends c{constructor(){super();let t=this.attachShadow({mode:"open"}),e=this.ownerDocument.createElement("style");e.textContent=`:host{box-sizing:border-box;display:block;min-width:0;font:inherit;color:var(--gramlot-ink,CanvasText)}
|
|
1
|
+
import{a as St,b as N}from"./modules/chunk-BLMUM44K.js";var S={"assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt":new URL("./files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt",import.meta.url),"assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt":new URL("./files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt",import.meta.url)};import{Bag as et,sourceTarget as G}from"@gramlot/gramlot";import{sharedModules as Tt}from"@gramlot/gramlot";var Dt=d=>Tt["./components/popup.js"][d],B=Dt("positionPopup");import{sharedModules as Lt}from"@gramlot/gramlot";var Nt=d=>Lt["@genrojs/tytx"][d];var z=Nt("isDecimal");var A=class{constructor(t,e){this.store=t,this.format=e}read(t,e=this.store.getRows()){return e.map(r=>({node:r,cells:t.map(i=>i.check?"":C(this.store.value(r,i.field),i,this.format))}))}};function C(d,t,e){if(d==null)return"";let{dtype:r,format:i}=t;if(r==="T"&&typeof d!="string"||r==="B"&&typeof d!="boolean")throw new TypeError(`grid ${t.field} does not match ${r}`);if(typeof d=="string"||typeof d=="boolean"){if(r&&!["T","B"].includes(r)||i!=null)throw new TypeError(`grid ${t.field} requires a typed numeric or temporal value`);return String(d)}if(d instanceof Date||i!=null)return e(d,{dtype:r,pattern:i??"short"});if(r&&!["L","R","N"].includes(r))throw new TypeError(`grid ${t.field} does not match ${r}`);if(r==="L"&&!Number.isInteger(d))throw new TypeError("grid L requires an integer");if(typeof d=="number"&&Number.isFinite(d)||z(d)&&d.isFinite())return String(d);throw new TypeError(`grid ${t.field} requires a scalar value`)}import{sharedModules as Ct}from"@gramlot/gramlot";var _t=d=>Ct["./renderer/attributes.js"][d],x=_t("SVG_NS");import{sharedModules as Rt}from"@gramlot/gramlot";var Bt=d=>Rt["./random-id.js"][d],P=Bt("randomId");var M=class{#t;#e;#s;#r=[];#o;#c;#n;#a=null;#i=null;#p=null;#k=!1;#w;#x=[];#y=!1;#l=!1;constructor(t,e){this.#t=t,this.#e=e;let r=this.#n=t.ownerDocument.createElement("div");r.className="column-filter-panel",r.setAttribute("popover","auto"),r.setAttribute("role","dialog");let i=t.ownerDocument.createElement("slot");i.name="column-filter",r.append(i),r.addEventListener("toggle",s=>{s.newState==="closed"&&!r.matches(":popover-open")&&this.#z()}),t.addEventListener("keydown",s=>{this.#a&&s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),this.close())}),t.shadowRoot.append(r)}setSourceContext(t){this.#c=t;let e=t.sourceNode,r=e.rootBuilder;e.staticValue===null&&e.setValue(new r.source.constructor(null,r),!1),t.sourceNode.rootBuilder.binding.bindingFor(t.sourceNode).track(()=>this.dispose())}#g(){if(this.#p!==null)return;let t=this.#c.sourceNode,e=t.rootBuilder;this.#p=`${t.workspaceDatapath}.columnFilter`,t.setRelativeData(this.#p,new et({rows:new et,checked:"",title:"",summary:"",from:null,to:null,hideRange:!0,rangeError:""}));let r=e.wrapSource(t).div({node_label:`column_filter_${P()}`,childname:"columnFilter",slot:"column-filter",display:"flex",flex_direction:"column",gap:"8px",padding:"10px",style:"font-size:12px;--gramlot-grid-row-height:28px;--gramlot-grid-font-size:12px;--gramlot-grid-cell-padding:4px 7px;--gramlot-menu-item-padding:4px 7px"});G(r).setAttr({datapath:this.#p});let i=new e.source.constructor(null,e),s=e.wrapSource(i);s.div("^.title",{font_weight:"600",padding:"0 2px"});let o=s.div({display:"flex",gap:"8px",hidden:"^.hideRange"});o.dateTextBox({value:"^.from",period_to:".to",lbl:"From",width:"136px",childname:"from"}),o.dateTextBox({value:"^.to",lbl:"To",width:"136px",childname:"to"}),s.div("^.rangeError",{role:"alert",color:"var(--gramlot-error)"});let n=s.frameGrid({storepath:".rows",rowMode:"attributes",height:"270px",width:"100%",childname:"frame"});n.toolbar.menuline({group:!0,class:"gramlot-grid-search"}).searchBox({searchOn:"Value:caption",searchLiteral:!0,childname:"search"});let a=n.grid;a.setAttr({sortedBy:"caption:a"});let l=a.struct();l.column({field:"selected",name:"\u2713",title:"Selected values",width:"32px",align:"center",check:"multiple",checked:"^.checked",checkedField:"id"}),l.column({field:"caption",name:"Value",width:"170px"}),l.column({field:"count",name:"Rows",dtype:"L",width:"64px",align:"end"});let c=s.menu({presentation:"bar",aria_label:"Column filter actions"});G(c)._internal.gridColumnFilters=this;for(let[m,u]of[["All","selectAll"],["None","selectNone"],["Reset","reset"]])c.menuline({caption:m,action:`this.parentBag.parentNode._internal.gridColumnFilters.${u}()`});s.div("^.summary",{color:"var(--gramlot-text-secondary)",font_size:"11px",padding:"0 2px"});let h=e.binding.gramlot.src.prepareSource(i);e.binding.renderer.validateCandidate(h),G(r).setValue(h),this.#b()}#E(t){return this.#c.sourceNode.getChild(`columnFilter/${t}`)}#v(t){return this.#c.sourceNode.rootBuilder.binding.renderer.getDomNode(this.#E(t))}#h(t){return this.#c.sourceNode.data.getItem(`${this.#p}.${t}`)}#u(t,e){this.#c.sourceNode.data.setItem(`${this.#p}.${t}`,e)}#b(){if(this.#p===null||this.#x.length)return;let t=this.#c.sourceNode.rootBuilder.binding.router;this.#x.push(t.register({path:this.#p+".checked",recipient:{receive:()=>this.#D()}}));for(let e of["from","to"])this.#x.push(t.register({path:this.#p+"."+e,recipient:{receive:()=>this.#A()}}))}#D(){if(this.#l||this.#i===null)return;let t=","+this.#h("checked")+",",e=this.#h("rows").getNodes(),r=e.filter(i=>t.includes(","+i.label+",")).map(i=>i.getAttr("value"));this.#s.applyColumnFilter(this.#i,this.#s.columnRange(this.#i)&&r.length===e.length?null:r)}#A(){this.#l||this.#k||this.#i===null||(this.#k=!0,queueMicrotask(()=>{this.#k=!1,this.#i!==null&&this.#y&&this.#S()}))}#S(){let t=this.#r.find(o=>o.field===this.#i);if(!["D","DH","DHZ"].includes(t.dtype))return;let e=this.#h("from"),r=this.#h("to"),i=this.#s.columnRange(this.#i);if(i?.from&&!e&&(r=null,this.#l=!0,this.#u("to",null),this.#l=!1),e&&r&&e>r){this.#u("rangeError","From must not be after To.");return}if(this.#u("rangeError",""),+e==+(i?.from??null)&&+r==+(i?.to??null))return;let s=!e&&!r?this.#s.columnFacets(this.#i).filter(o=>o.selected).map(o=>o.value):null;this.#s.applyColumnFilter(this.#i,s,{from:e,to:r,dtype:t.dtype,timeZone:this.#c.timeZone})}selectAll(){this.#s.applyColumnFilter(this.#i,this.#s.columnRange(this.#i)?null:this.#s.columnFacets(this.#i).map(t=>t.value))}selectNone(){this.#s.applyColumnFilter(this.#i,[])}reset(){this.#l=!0;try{this.#u("from",null),this.#u("to",null),this.#u("rangeError","");for(let t of["from","to"])this.#v(t).restoreFormValue(null)}finally{this.#l=!1}this.#s.applyColumnFilter(this.#i,null,null)}button(t){let e=this.#t.ownerDocument,r=e.createElement("button");r.type="button",r.className="column-filter",r.dataset.field=t.field,r.setAttribute("aria-label",`Filter ${t.title??t.name}`),r.setAttribute("aria-haspopup","dialog"),r.setAttribute("aria-expanded","false"),r.title=`Filter ${t.title??t.name}`;let i=e.createElementNS(x,"svg");i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("aria-hidden","true");let s=e.createElementNS(x,"path");return s.setAttribute("d","M3 5h18l-7 8v6l-4 2v-8z"),i.append(s),r.append(i),r}update(t,e,r,i){t!==this.#s&&(this.close(),this.#w?.(),this.#w=null,this.#s=t),this.#r=e,this.#o=i,(!r||this.#a&&!this.#a.isConnected)&&this.close(),this.#y&&!this.#w&&(this.#w=t.subscribe(this.refresh)),this.refresh()}#d=t=>{let e=t.target.closest(".column-filter");if(!e)return;if(t.stopPropagation(),e===this.#a){this.close();return}this.close(),this.#g(),this.#a=e,this.#i=e.dataset.field,this.#l=!0;let r=this.#s.columnRange(this.#i);this.#u("from",r?.from??null),this.#u("to",r?.to??null),this.#u("rangeError","");let i=this.#r.find(s=>s.field===this.#i);this.#u("hideRange",!["D","DH","DHZ"].includes(i.dtype));for(let s of["from","to"])this.#v(s).restoreFormValue(this.#h(s));this.#h("rows").clear(),this.#u("checked",""),this.#v("frame/search").clear(),this.#l=!1,this.refresh(),this.#n.showPopover(),e.setAttribute("aria-expanded","true"),this.#T(),this.#v("frame/search").focus()};refresh=()=>{if(!this.#s)return;for(let n of this.#e.querySelectorAll(".column-filter")){let a=this.#s.columnFilter(n.dataset.field)!==null||this.#s.columnRange(n.dataset.field)!==null;n.classList.toggle("active",a),n.closest("th").classList.toggle("column-filtered",a),n.setAttribute("aria-pressed",String(a))}if(this.#i===null)return;let t=this.#r.find(n=>n.field===this.#i);if(!t){this.close();return}let e=t.title??t.name;this.#n.setAttribute("aria-label",`Filter ${e}`);let r=this.#s.columnFacets(this.#i),i=this.#h("rows");this.#E("frame").setAttr({height:`${76+28*Math.max(1,Math.min(r.length,8))}px`});let s=new Map(i.getNodes().map(n=>[n.getAttr("key"),n])),o=[];this.#l=!0;try{this.#u("title",e);for(let a of r){let l=a.value===null?"Empty":C(a.value,t,this.#o),c={key:a.key,value:a.value,caption:l,count:a.count},h=s.get(a.key);if(h)s.delete(a.key),h.setAttr(c);else{let m=`v_${P()}`;i.setItem(m,null,{...c,id:m}),h=i.getNode(m)}a.selected&&o.push(h.label)}for(let a of s.values())i.popNode(a.label);let n=o.join(",");this.#h("checked")!==n&&this.#u("checked",n),this.#u("summary",`${o.length} of ${r.length} values selected`)}finally{this.#l=!1}this.#T()};#T=()=>{this.#a&&B(this.#n,this.#a,{align:"start"})};#z(){this.#a?.setAttribute("aria-expanded","false"),this.#a=null,this.#i=null}close(){if(!this.#a)return;let t=this.#a;this.#n.hidePopover(),this.#z(),t.isConnected&&t.focus({preventScroll:!0})}connect(){this.#y||(this.#y=!0,this.#b(),this.#e.addEventListener("click",this.#d),this.#t.ownerDocument.defaultView.addEventListener("resize",this.#T),this.#t.ownerDocument.defaultView.addEventListener("scroll",this.#T,!0))}disconnect(){this.close(),this.#y=!1,this.#w?.(),this.#w=null;for(let t of this.#x)t.close();this.#x=[],this.#e.removeEventListener("click",this.#d),this.#t.ownerDocument.defaultView.removeEventListener("resize",this.#T),this.#t.ownerDocument.defaultView.removeEventListener("scroll",this.#T,!0)}dispose(){this.disconnect(),this.#p&&this.#c.sourceNode.data.popNode(this.#p)}};import{Bag as J}from"@gramlot/gramlot";var y={};St(y,{defineCollection:()=>Mt});N(y,Ae);import*as Ae from"@gramlot/gramlot/components";import{defineCollection as zt}from"@gramlot/gramlot/components";function Mt(d){if(d.name!=="grid")throw new Error("Unexpected bundled collection");let t=[],e={writeExcelFileLicense:S["assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt"],fflateLicense:S["assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt"]};d.css?.forEach((r,i)=>{r.href=t[i].href});for(let[r,i]of Object.entries(d.assets??{}))i.href=e[r].href;return zt({...d,css:t,assets:e})}import{sharedModules as Ft}from"@gramlot/gramlot";var $t=d=>Ft["./components/parameters.js"][d];var rt=$t("projectParameters");function _(d){return class extends d{constructor(){super();let t=this.attachShadow({mode:"open"}),e=this.ownerDocument.createElement("style");e.textContent=`:host{box-sizing:border-box;display:block;min-width:0;font:inherit;color:var(--gramlot-ink,CanvasText)}
|
|
2
2
|
*,*::before,*::after{box-sizing:border-box}.control-box{min-width:0}slot{display:contents}
|
|
3
|
-
::slotted(*){min-width:0;max-width:100%}`,this.controlBox=this.ownerDocument.createElement("div"),this.controlBox.className="control-box",this.control=this.controlBox,this.control.id="control",this.control.append(this.ownerDocument.createElement("slot")),t.append(e,this.controlBox)}projectAttributes(t){return
|
|
4
|
-
`)):(
|
|
3
|
+
::slotted(*){min-width:0;max-width:100%}`,this.controlBox=this.ownerDocument.createElement("div"),this.controlBox.className="control-box",this.control=this.controlBox,this.control.id="control",this.control.append(this.ownerDocument.createElement("slot")),t.append(e,this.controlBox)}projectAttributes(t){return rt(this,t)}}}_.parameters={};import{sharedModules as It}from"@gramlot/gramlot";var jt=d=>It["./stores/bag-collection-view.js"][d];var W=jt("parseSort");import ie from"@gramlot/collections/inputs";import{Bag as st,sourceTarget as K,toTytx as Ot}from"@gramlot/gramlot";import{sharedModules as qt}from"@gramlot/gramlot";var Ht=d=>qt["@genrojs/builders"][d];var it=Ht("pointerTransform");var F=class{constructor(t,e,r,i,s,o,n){this.grid=t,this.context=e,this.cellFor=r,this.store=i,this.renderedRows=s,this.navigate=o,this.focusField=n,this.retained=new Map,this.declarations=new Map,this.checking=new Set,this.columns=[],this.layer=t.ownerDocument.createElement("div"),this.layer.className="cell-editor",this.layer.hidden=!0;let a=t.ownerDocument.createElement("slot");a.name="cell-editor",this.layer.append(a),t.control.append(this.layer),this.keydown=l=>{if(!(!this.active||l.isComposing)){if(l.key==="Escape"){l.preventDefault();let c=this.cellFor(this.active.row,this.active.column.field);this.session.clearDraft(this.control(this.active)),this.close(),c?.focus({preventScroll:!0})}else if(l.key==="Enter"||l.key==="Tab"){if(l.key==="Enter"&&this.active.element.control.localName==="textarea"&&!l.ctrlKey&&!l.metaKey)return;l.preventDefault();let c=this.active;this.session.commitField(c.path);let h=this.cellFor(c.row,c.column.field);this.close(),h?.focus({preventScroll:!0}),l.key==="Tab"&&this.navigate(c.row,c.column.field,l.shiftKey?-1:1)}}},this.arrowKeydown=l=>{if(!this.active||l.isComposing||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(l.key)||l.altKey||l.ctrlKey||l.metaKey||l.shiftKey)return;let c=this.active.element.control;if(c.localName==="textarea"||["range","date","time","datetime-local"].includes(c.type)||["gramlot-date-text-box","gramlot-time-text-box","gramlot-date-calendar"].includes(this.active.element.localName)||c.getAttribute("aria-expanded")==="true"||l.key==="ArrowDown"&&c.getAttribute("role")==="combobox")return;let h=l.key==="ArrowLeft"||l.key==="ArrowRight",m=l.key==="ArrowLeft"||l.key==="ArrowUp";if(h&&(typeof c.selectionStart!="number"||c.selectionStart!==c.selectionEnd||c.selectionStart!==(m?0:c.value.length)))return;l.preventDefault(),l.stopPropagation();let u=this.active;if(this.session.commitField(u.path),this.navigate(u.row,u.column.field,h?m?-1:1:{row:m?-1:1}),h&&this.active&&this.active!==u){let f=this.active.element.control;if(typeof f.selectionStart=="number"){let p=m?f.value.length:0;f.setSelectionRange(p,p)}}},this.connect(),e.sourceNode.rootBuilder.binding.bindingFor(e.sourceNode).track(()=>this.dispose())}connect(){this.grid.addEventListener("keydown",this.keydown),this.grid.addEventListener("keydown",this.arrowKeydown,!0),this.session&&!this.releaseNavigator&&(this.releaseNavigator=this.session.registerNavigator(this.focusField))}disconnect(){this.close(),this.grid.removeEventListener("keydown",this.keydown),this.grid.removeEventListener("keydown",this.arrowKeydown,!0),this.releaseNavigator?.(),this.releaseNavigator=null}path(t,e){return this.context.sourceNode.absDatapath(`#ROW.${e}`,{row:t})}configure(t){let e=t.filter(i=>i.edit);if(e.length){if(this.store().window!==null)throw new Error("Editing requires a fully resident Bag; remote windows are read-only.");let i=this.context.sourceNode;this.session=i.editCollection(i.absDatapath(i.getAttr("storepath")))}let r=Ot(e.map(({field:i,dtype:s,edit:o})=>({field:i,dtype:s,edit:o})));if(r!==this.validationSignature){this.validationSignature=r,this.columns=e;for(let[i,s]of this.declarations){let o=e.find(n=>n.field===s.field);if(!o)this.active?.path===i&&this.close(),this.releaseField(i);else{let{tag:n,options:a}=this.definition(o);n!==s.tag?(this.active?.path===i&&this.close(),this.releaseField(i)):(this.control(s).setAttr({...Object.fromEntries(Object.keys(s.options).map(l=>[l,null])),...this.rowOptions(a,this.retained.get(i))}),s.options=a)}}if(!e.length){this.releaseValidation?.(),this.releaseValidation=null;return}this.releaseStatus||(this.releaseStatus=this.session.subscribe(()=>this.refresh())),this.releaseNavigator||(this.releaseNavigator=this.session.registerNavigator(this.focusField)),this.releaseValidation?this.session.invalidateValidation():this.releaseValidation=this.session.registerValidationSource(()=>this.validationFields())}}definition(t){let e=t.edit===!0?{}:{...t.edit},r=e.tag??{L:"numberTextBox",R:"numberTextBox",N:"numberTextBox",D:"dateTextBox",H:"timeTextBox",B:"checkBox"}[t.dtype]??"textbox";if(t.dtype==="DHZ"&&!e.tag)throw new Error("A datetime column requires an explicitly declared supported editor.");return delete e.tag,{tag:r,options:{...e,dtype:t.dtype??"T"}}}rowOptions(t,e){let r=this.context.sourceNode;return Object.fromEntries(Object.entries(t).map(([i,s])=>{let o=it(s)?.pointer??s,n=r.pointerType(o),a=n?o.slice(1):null;return a!=="#ROW"&&!a?.startsWith("#ROW.")&&!a?.startsWith("#ROW?")?[i,s]:[i,`${n}${r.absDatapath(o,{row:e})}${s.slice(o.length)}`]}))}*validationFields(){let t=this.context.sourceNode;this.session.trackValidationDependency(t.absDatapath(t.getAttr("structpath")));for(let e of this.store().labels())for(let r of this.columns){let i=this.collection();if(!(i instanceof st)||!i.getNode(e))continue;let s=this.path(e,r.field);this.checking.add(s);try{let o=this.declare(e,r,!1);yield{node:this.control(o),release:()=>{this.checking.delete(s),s!==this.active?.path&&this.releaseCleanField(s)}}}catch(o){throw this.checking.delete(s),this.releaseCleanField(s),o}}}open(t,e,r){if(this.store().window!==null)throw new Error("Editing requires a fully resident Bag; remote windows are read-only.");if(this.active?.row===t&&this.active.column.field===e.field){this.active.element.control.focus();return}this.close();let i=this.path(t,e.field),s=this.declare(t,e,!0),o=this.grid.ownerDocument.getElementById(s.id);this.active={row:t,column:e,path:i,...s,element:o},this.layer.hidden=!1,this.position(r),o.control.focus()}declare(t,e,r){let i=this.context.sourceNode,s=this.path(t,e.field);this.retained.has(s)||(this.session.retainField(s),this.retained.set(s,t));let o=this.declarations.get(s);if(o)r&&i.rootBuilder.binding.renderer.mountView(this.container(o));else{let{tag:n,options:a}=this.definition(e);if(!i.rootBuilder.schemaTag(n))throw new Error(`Grid editor requires the ${n} input collection.`);let l=i.rootBuilder,c=`grid-cell-${crypto.randomUUID()}`,h=l.wrapSource(i).div({node_label:c,slot:"cell-editor"});r||l.binding.renderer.unmountView(K(h));try{let m=K(h[n]({...this.rowOptions(a,t),value:"^"+s,id:c,width:"100%",margin:"0"}));o={id:c,tag:n,options:a,field:e.field};let u=this.grid.ownerDocument.defaultView.customElements.get(m._getMeta("render_tag"));this.session.registerField(m,u,r),this.declarations.set(s,o)}catch(m){let u=K(h);throw u.parentBag.popNode(u.label),this.releaseCleanField(s),m}}return o}container(t){let e=this.context.sourceNode.value.getNode(t.id);if(!e)throw new Error(`Grid cell editor container ${t.id} is missing from the grid Source.`);return e}control(t){let e=this.container(t).value.getNodes();if(e.length!==1)throw new Error(`Grid cell editor container ${t.id} must hold exactly one control, found ${e.length}.`);return e[0]}close(){let t=this.active;this.active=null,this.layer.hidden=!0,t&&(this.context.sourceNode.rootBuilder.binding.renderer.unmountView(this.container(t)),this.releaseCleanField(t.path))}releaseCleanField(t){if(this.checking.has(t))return;let e=this.session.fieldStatus(t);e.error===null&&e.pending===null&&e.draft===null&&this.retained.has(t)&&this.releaseField(t)}releaseField(t){let e=this.declarations.get(t);this.declarations.delete(t),e&&this.context.sourceNode.value.getNode(e.id)&&this.context.sourceNode.value.popNode(e.id),this.session.releaseField(t),this.retained.delete(t)}position(t=null){if(!this.active)return;if(t??=this.cellFor(this.active.row,this.active.column.field),!t){this.close();return}let e=t.getBoundingClientRect(),r=this.grid.control.getBoundingClientRect(),i=this.grid.shadowRoot.querySelector(".body-viewport").getBoundingClientRect();Object.assign(this.layer.style,{left:`${e.left-r.left-this.grid.control.clientLeft}px`,top:`${e.top-r.top-this.grid.control.clientTop}px`,width:`${e.width}px`}),this.layer.style.setProperty("--grid-editor-height",`${e.height}px`);let s=t.style.getPropertyValue("--grid-cell-max-height");s?this.layer.style.setProperty("--grid-cell-max-height",s):this.layer.style.removeProperty("--grid-cell-max-height");let o=this.layer.getBoundingClientRect();i.height&&(o.top<i.top||o.bottom>i.bottom||o.right<=i.left||o.left>=i.right)&&this.close()}decorate(t,e){if(this.session)for(let r of t.querySelectorAll("td[data-field]")){let i=this.session.fieldStatus(this.path(e,r.dataset.field));r.classList.toggle("invalid-cell",!!i.error),r.classList.toggle("draft-cell",i.draft!==null),i.error?(r.setAttribute("aria-invalid","true"),r.title=i.error.getNodes().map(s=>s.value).join(`
|
|
4
|
+
`)):(r.removeAttribute("aria-invalid"),r.removeAttribute("title"))}}collection(){let t=this.context.sourceNode;return this.context.getStaticData(t.absDatapath(t.getAttr("storepath")))}refresh(){let t=this.collection(),e=new Set(t instanceof st?t.keys():[]);for(let[r,i]of this.retained)e.has(i)||(this.active?.row===i&&this.close(),this.retained.has(r)&&this.releaseField(r));for(let r of this.retained.keys())r!==this.active?.path&&this.releaseCleanField(r);for(let[r,i]of this.renderedRows())this.decorate(i,r)}dispose(){if(this.releaseValidation?.(),this.releaseValidation=null,this.disconnect(),this.session)for(let t of[...this.retained.keys()])this.releaseField(t);this.releaseStatus?.(),this.layer.remove()}};import{sharedModules as Vt}from"@gramlot/gramlot";var U=d=>Vt["./stores/id-set.js"][d],ot=U("containsId"),Z=U("requireId"),nt=U("requireIdSet");function at(d){return typeof d=="number"&&Number.isFinite(d)?d:Z(d)}var $=class{#t=[];#e=!1;constructor(t,e,r,i,s,o,n){this.source=t,this.body=e,this.columns=r,this.rowFor=i,this.read=s,this.selection=o,this.view=n}path(t){return this.source.absDatapath(t.checked.slice(1))}value(t){let e=this.source.getRelativeData(t.checked.slice(1));return t.check==="single"?e==null||e===""?e:at(e):nt(e)}id(t,e){let r=this.read(t,e.checkedField);return e.check==="single"?at(r):Z(r)}contains(t,e,r){return t.check==="single"?e===r:ot(e,r)}filter(){let t=this.selection(),e=t===""?null:t.split(",").map(r=>{let i=this.columns().find(s=>s.field===r&&s.check==="multiple");if(!i)throw new TypeError(`Unknown external check column: ${r}`);return{field:i.checkedField,value:this.value(i)}});this.view().applySetFilter(e)}project(t,e,r){let i=this.id(e,r),s=this.value(r),o=t.querySelector("input.grid-set-check");o||(o=t.ownerDocument.createElement("input"),o.className="grid-set-check",t.replaceChildren(o)),o.type=r.check==="single"?"radio":"checkbox",r.check==="single"?o.name=r.field:o.removeAttribute("name"),o.setAttribute("aria-label",`${r.title??r.name}: ${i}`),o.checked=this.contains(r,s,i)}refresh=()=>{this.filter();for(let t of this.body.querySelectorAll("input.grid-set-check")){let e=t.closest("td[data-field]"),r=this.columns().find(s=>s.field===e.dataset.field),i=this.rowFor(e.parentElement);r?.check&&i&&this.project(t.parentElement,i,r)}};change=t=>{let e=t.target;if(!e.matches("input.grid-set-check"))return;let r=e.closest("td[data-field]"),i=this.columns().find(c=>c.field===r.dataset.field),s=this.rowFor(r.parentElement),o=this.id(s,i),n=this.value(i),a=this.contains(i,n,o);if(e.checked===a)return;if(i.check==="single"){e.checked?this.source.setRelativeData(i.checked.slice(1),o):this.project(e.parentElement,s,i);return}let l=e.checked?n?n+","+o:o:(","+n+",").replace(","+o+",",",").slice(1,-1);this.source.setRelativeData(i.checked.slice(1),l)};configure(){for(let t of this.#t)t.close();if(this.#t=[],!!this.#e){this.filter();for(let t of this.columns().filter(e=>e.check))this.#t.push(this.source.rootBuilder.binding.router.register({path:this.path(t),recipient:{receive:this.refresh}}))}}connect(){this.#e||(this.#e=!0,this.body.addEventListener("change",this.change))}disconnect(){this.body.removeEventListener("change",this.change),this.#e=!1,this.configure()}};import{sharedModules as Pt}from"@gramlot/gramlot";var Gt=d=>Pt["./components/grid-structure.js"][d],lt=Gt("GridStructure");import{sharedModules as Wt}from"@gramlot/gramlot";var X=d=>Wt["./components/grid-formulas.js"][d],ct=X("GridFormulas"),dt=X("addNumeric");var ht=X("sameValue");var I=class{#t;#e;#s;#r;#o;#c;#n;#a=[];#i=!1;#p=new Map;constructor(t,e,r){this.#t=t,this.#e=e,this.#s=r;let i=r.ownerDocument;this.#r=i.createElement("div"),this.#r.className="footer-frame",this.#r.setAttribute("part","footer"),this.#o=i.createElement("div"),this.#o.className="footer-viewport",this.#c=i.createElement("table"),this.#c.setAttribute("role","presentation");let s=i.createElement("tfoot");s.setAttribute("role","rowgroup"),this.#n=i.createElement("tr"),this.#n.setAttribute("role","row"),s.append(this.#n),this.#c.append(s),this.#o.append(this.#c),this.#r.append(this.#o)}get source(){return this.#t}get frame(){return this.#r}get table(){return this.#c}get viewport(){return this.#o}get errors(){return new Map(this.#p)}cell(t){return this.#n.querySelector(`td[data-field="${t}"]`)}configure(t,e,r){this.#i=t,this.#a=e,t===!1?this.#r.remove():this.#s.after(this.#r);let i=this.#n.ownerDocument,s=[];if(r){let o=i.createElement("th");o.className="row-heading",o.setAttribute("role","rowheader"),s.push(o)}for(let[o,n]of e.entries()){let a=i.createElement("td");a.dataset.field=n.field,a.setAttribute("role","cell"),a.setAttribute("part","footer-cell"),a.setAttribute("aria-colindex",String(o+1+Number(r))),a.style.textAlign=n.totalize?"end":n.align,a.classList.toggle("numeric",!!n.totalize),s.push(a)}this.#n.replaceChildren(...s)}update(t,e){for(let[r,i]of this.#a.entries()){let s=this.cell(i.field),o=i.footer_value??"",n=null;if(i.totalize){let a=0;try{for(let l of e){let c=t.value(l,i.field);a=dt(a,typeof c=="boolean"?Number(c):c)}this.#p.delete(i.field)}catch(l){a=null,this.#p.set(i.field,l)}this.#k(i,a),a===null?(o="\u2014",n=this.#p.get(i.field).message):o=C(a,{...i,dtype:i.dtype==="B"?"L":i.dtype,format:i.footer_format??i.format},this.#e)}else r===0&&o===""&&(o=this.#i===!0?"Total":this.#i);s.textContent!==o&&(s.textContent=o),n===null?(s.removeAttribute("title"),s.removeAttribute("aria-invalid")):(s.title=n,s.setAttribute("aria-invalid","true"))}}totalPaths(){return this.#a.filter(t=>t.totalize).map(t=>this.source.absDatapath(t.totalize===!0?`.totalize.${t.field}`:t.totalize))}#k(t,e){let r=t.totalize===!0?`.totalize.${t.field}`:t.totalize;ht(this.source.getRelativeData(r),e)||this.source.setRelativeData(r,e)}};import{Bag as T}from"@gramlot/gramlot";import{sharedModules as Kt}from"@gramlot/gramlot";var Ut=d=>Kt["./libraries.js"][d];var ut=Ut("loadLibrary");var pt=Object.freeze({csv:{caption:"CSV",extension:"csv",type:"text/csv"},json:{caption:"JSON",extension:"json",type:"application/json"},tytx:{caption:"TYTX",extension:"tytx",type:"text/plain"},xml:{caption:"XML",extension:"xml",type:"application/xml"},xlsx:{caption:"Excel",extension:"xlsx",type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}}),Zt=null,Xt=Object.freeze({export:{label:"Export",publish:"export",icon:"\u21E9",tooltip:"Export the visible rows"},printRows:{label:"Print",publish:"printRows",icon:"\u2399",tooltip:"Print the visible rows"},lineNumbers:{label:"Line numbers",publish:"lineNumbers",tooltip:"Show or hide the row numbers"},addrow:{label:"Add row",publish:"addrow",icon:"+",tooltip:"Add a row"},duprow:{label:"Duplicate",publish:"duprow",icon:"\u29C9",tooltip:"Duplicate the selected rows"},delrow:{label:"Delete",publish:"delrow",icon:"\u2212",tooltip:"Delete the selected rows"}}),Yt=new Set(["grid:addrow","grid:duprow","grid:delrow"]),Jt=new Set(["grid:duprow","grid:delrow"]);function mt(d){let t=d.commands.registerGroup("grid",{description:"Grid toolbar tools"});for(let[e,r]of Object.entries(Xt))t.register(e,r)}function Qt(d){return/[",\r\n]/.test(d)?`"${d.replaceAll('"','""')}"`:d}var j=class{#t;#e;#s=[];constructor(t,e){this.#t=t,this.#e=e}get source(){return this.#t.sourceNode}get runtime(){return this.source.rootBuilder.binding}connect(){if(this.#s.length)return;let t=this.runtime.subscriptions,e={export:r=>this.exportRows(r.parameters.format),printRows:()=>this.printRows(),lineNumbers:()=>this.toggleLineNumbers(),addrow:r=>this.addRow(r.parameters.defaults??{}),duprow:()=>this.duplicateRows(),delrow:()=>this.deleteRows()};for(let[r,i]of Object.entries(e))this.#s.push(t.subscribe(t.topicFor(this.source,r),async s=>{try{await i(s)}catch(o){this.#t.reportError(o,"Grid tool")}}))}disconnect(){for(let t of this.#s)this.runtime.subscriptions.unsubscribe(t);this.#s=[]}#r(){let t=this.#e.columns().filter(r=>!r.check),e=new A(this.#e.reader(),this.#t.format).read(t,this.#e.rows());return{captions:t.map(r=>r.name),cells:e.map(r=>r.cells)}}csv(){let{captions:t,cells:e}=this.#r();return[t,...e].map(r=>r.map(Qt).join(",")).join(`\r
|
|
5
5
|
`)+`\r
|
|
6
|
-
`}#i(){let t=this.#e.columns().filter(i=>!i.check),e=this.#e.reader();return{columns:t,rows:this.#e.rows().map(i=>[i,t.map(r=>e.value(i,r.field)??null)])}}rowsBag(){let{columns:t,rows:e}=this.#i(),i=new T,r=this.#e.store().mode==="values";for(let[s,o]of e){let n=Object.fromEntries(t.map((a,d)=>[a.field,o[d]]));r?i.setItem(s.label,new T(n)):i.setItem(s.label,null,n)}return i}xml(){let t=new T;return t.setItem("GenRoBag",this.rowsBag()),t.toXml({docHeader:!0})}json(){let{columns:t,rows:e}=this.#i();return JSON.stringify(e.map(([,i])=>new T(Object.fromEntries(t.map((r,s)=>[r.field,i[s]]))).asDict(!1,!1,!0)),null,2)}async xlsx(){let{columns:t,rows:e}=this.#i(),i=(await(Gt??=ct("writeExcelFile",this.#e.document,()=>import("./modules/browser-Y2BRNI3P.js")))).default,r=(n,a)=>n===null?null:z(n)?Number(n.toString()):n instanceof Date?{value:n,type:Date,format:["DH","DHZ"].includes(a.dtype)?"yyyy-mm-dd hh:mm:ss":"yyyy-mm-dd"}:["number","boolean","string"].includes(typeof n)?n:String(n),o=[t.map(n=>({value:n.name,fontWeight:"bold"})),...e.map(([,n])=>n.map((a,d)=>r(a,t[d])))];return i(o,{sheet:this.source.label,stickyRowsCount:1}).toBlob()}async exportRows(t){let e=ht[t];if(!e)throw new TypeError(`grid export format must be one of ${Object.keys(ht).join(", ")}`);let i=t==="csv"?this.csv():t==="json"?this.json():t==="tytx"?this.rowsBag().toTytx():t==="xml"?this.xml():await this.xlsx();this.runtime.gramlot.utl.inout.saveText(i,`${this.source.label}.${e.extension}`,e.type)}printRows(){let t=this.#e.document,{captions:e,cells:i}=this.#o(),r=t.createElement("iframe");r.className="gramlot-grid-print",r.setAttribute("aria-hidden","true"),r.style.cssText="position:fixed;inset-inline-start:-10000px;inline-size:1px;block-size:1px;border:0",t.body.append(r);let s=r.contentDocument,o=s.createElement("table"),n=s.createElement("thead"),a=s.createElement("tbody"),d=(p,m,h)=>{let u=s.createElement("tr");for(let f of m){let g=s.createElement(h);g.textContent=f,u.append(g)}p.append(u)};d(n,e,"th");for(let p of i)d(a,p,"td");o.append(n,a);let l=s.createElement("style");l.textContent="table{border-collapse:collapse;font:12px sans-serif}th,td{border:1px solid #888;padding:2px 6px;text-align:start}",s.head.append(l),s.body.append(o),r.contentWindow.addEventListener("afterprint",()=>r.remove()),r.contentWindow.print()}toggleLineNumbers(){let t=!this.#e.parameters().rowHeaders;this.source.pointerType(this.source.getAttr("rowHeaders"))?this.#t.writeParameter("rowHeaders",t):this.source.setAttr({rowHeaders:t})}addRow(t){let{bag:e,mode:i}=this.#e.store(),r=`r_${crypto.randomUUID().replaceAll("-","")}`;return i==="values"?e.setItem(r,new T(t)):e.setItem(r,null,t),e.getNode(r)}duplicateRows(){let{bag:t,mode:e}=this.#e.store();for(let i of this.#e.selected()){let r=`r_${crypto.randomUUID().replaceAll("-","")}`;e==="values"?t.setItem(r,i.staticValue.deepcopy()):t.setItem(r,null,{...i.getAttr()})}}deleteRows(){let{bag:t}=this.#e.store();for(let e of this.#e.selected())t.popNode(e.label)}requireEditableTools(t){let e=t.some(o=>o.edit),i=this.#e.selectionMode()!=="none";if(e&&i)return;let r=this.source.parentNode;for(;r&&r.nodeTag!=="framePane";)r=r.parentNode;if(!r)return;let s=o=>{if(o.nodeTag==="framePane")return;let n=o.nodeTag==="menuline"?o.getAttr("command"):null;if(!e&&Kt.has(n))throw new TypeError(`grid tool '${n}' requires an editable column`);if(!i&&Zt.has(n))throw new TypeError(`grid tool '${n}' requires selectionMode single or multi`);if(!e&&o.nodeTag==="editingStatus")throw new TypeError("grid editing status requires an editable column");if(o.value instanceof T)for(let a of o.value.getNodes())s(a)};for(let o of r.value.getNodes())s(o)}};import{Bag as pt}from"@gramlot/gramlot";var mt=Object.freeze(["none","single","multi"]),ft=["selectedId","selectedIndex","selectedLabel","selectedPkeys","selectedRowidx","selectedNodes","selectedRowData"],V=class{#t;#e;#s=new Set;#o=null;#i=null;constructor(t,e){this.#t=t,this.#e=e}get source(){return this.#t.sourceNode}get mode(){return this.#e.mode()}get current(){return this.#o}isSelected(t){return this.#s.has(t)}get nodes(){return this.#e.view().getRows().filter(t=>this.#s.has(t))}select(t,{toggle:e=!1,range:i=!1}={}){if(this.mode==="none")return;let r=this.#e.view().getRows();if(this.mode==="multi"&&i&&this.#i!==null&&r.includes(this.#i)){let[s,o]=[r.indexOf(this.#i),r.indexOf(t)].sort((n,a)=>n-a);this.#r(new Set(r.slice(s,o+1)),t,this.#i)}else if(this.mode==="multi"&&e){let s=new Set(this.#s);s.has(t)?s.delete(t):s.add(t),this.#r(s,s.has(t)?t:this.nodes.find(o=>s.has(o))??null,t)}else this.#r(new Set([t]),t,t)}move(t,e=!1){if(this.mode==="none")return null;let i=this.#e.view().getRows();if(!i.length)return null;let r=this.#o===null?t>0?-1:i.length:i.indexOf(this.#o),s=i[Math.max(0,Math.min(i.length-1,r+t))];return this.select(s,{range:e}),s}selectAll(){if(this.mode!=="multi")return;let t=this.#e.view().getRows();this.#r(new Set(t),this.#o??t[0]??null,this.#i??t[0]??null)}prune(){let t=new Set(this.mode==="none"?[]:this.#e.view().getRows());if([...this.#s].every(i=>t.has(i))&&(this.#o===null||t.has(this.#o)))return;let e=new Set([...this.#s].filter(i=>t.has(i)));this.#r(e,t.has(this.#o)?this.#o:null,t.has(this.#i)?this.#i:null)}get#l(){return this.source.attributeOwnerNode("datapath")!==null}paths(){let e=Object.keys(this.source.getAttr()).filter(i=>ft.includes(i)||i.startsWith("selected_")).map(i=>this.source.absDatapath(this.source.getAttr(i)));return this.#l?[this.source.absDatapath(".selectionLength"),...e]:e}#r(t,e,i){this.#s=t,this.#o=e,this.#i=i,this.publish()}publish(){let t=this.#e.store(),e=this.#e.view(),i=this.nodes,r=this.#o,s=r===null?-1:e.getRows().indexOf(r),o=r===null?null:r.label,n=i.map(l=>l.label),a=t.getRows(),d={selectedId:o,selectedIndex:s<0?null:s,selectedLabel:o,selectedPkeys:n,selectedRowidx:i.map(l=>a.indexOf(l)).join(","),selectedNodes:()=>{let l=new pt;for(let p of i)l.setItem(p.label,null,this.#e.rowData(p));return l},selectedRowData:()=>r===null?null:new pt(this.#e.rowData(r))};for(let l of ft){if(this.source.getAttr(l)==null)continue;let p=typeof d[l]=="function"?d[l]():d[l];this.#t.writeParameter(l,p),l==="selectedNodes"&&this.source.rootBuilder.binding.data.getNode(this.source.absDatapath(this.source.getAttr(l))).setAttr({count:i.length})}for(let l of Object.keys(this.source.getAttr())){if(!l.startsWith("selected_"))continue;let p=l.slice(9);this.#t.writeParameter(l,[...new Set(i.map(m=>t.value(m,p)))].join(","))}this.#l&&this.source.getRelativeData(".selectionLength")!==i.length&&this.source.setRelativeData(".selectionLength",i.length),this.#t.publish("onSelectedRow",{idx:s,selectedId:o,selectedPkeys:n})}};var P=class{#t;#e;#s;#o;#i;#l;#r=!1;#a=null;#n=null;constructor(t,e,i,r,s,o){this.#t=t,this.#e=e,this.#s=i,this.#o=r,this.#i=s,this.#l=o}connect(){this.#t.addEventListener("click",this.#h),this.#t.addEventListener("pointerdown",this.#E),this.#t.addEventListener("pointermove",this.#v),this.#t.addEventListener("pointerup",this.#b),this.#t.addEventListener("pointercancel",this.#w),this.#t.addEventListener("lostpointercapture",this.#w),this.#t.addEventListener("keydown",this.#f),this.#t.addEventListener("dragstart",this.#A),this.#t.addEventListener("dragover",this.#x),this.#t.addEventListener("drop",this.#c),this.#t.addEventListener("dragend",this.#y)}disconnect(){this.cancel(),this.#t.removeEventListener("click",this.#h),this.#t.removeEventListener("pointerdown",this.#E),this.#t.removeEventListener("pointermove",this.#v),this.#t.removeEventListener("pointerup",this.#b),this.#t.removeEventListener("pointercancel",this.#w),this.#t.removeEventListener("lostpointercapture",this.#w),this.#t.removeEventListener("keydown",this.#f),this.#t.removeEventListener("dragstart",this.#A),this.#t.removeEventListener("dragover",this.#x),this.#t.removeEventListener("drop",this.#c),this.#t.removeEventListener("dragend",this.#y)}#h=t=>{if(this.#r){this.#r=!1;return}if(t.target.closest(".column-resize, .column-filter"))return;let e=t.target.closest("th[data-field]");e&&this.#o(e.dataset.field,t.shiftKey)};#A=t=>{if(t.target.closest(".column-filter")){t.preventDefault();return}let e=t.target.closest("th[data-field]");if(!e||this.#a){t.preventDefault();return}this.#r=!0,this.#n={field:e.dataset.field,node:this.#s().columnNode(e.dataset.field)},t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",e.textContent),e.classList.add("column-dragging")};#S(t){let e=t.target.closest("th[data-field]");if(!this.#n||!e)return null;let i=this.#s().columnNode(e.dataset.field);return this.#s().columnNode(this.#n.field)!==this.#n.node||i===this.#n.node||i.parentBag!==this.#n.node.parentBag?null:{header:e,field:e.dataset.field,after:t.clientX>e.getBoundingClientRect().left+e.getBoundingClientRect().width/2}}#x=t=>{let e=this.#S(t);for(let i of this.#t.querySelectorAll("[data-drop]"))i.removeAttribute("data-drop");e&&(t.preventDefault(),t.dataTransfer.dropEffect="move",e.header.dataset.drop=e.after?"after":"before")};#c=t=>{let e=this.#S(t);if(!e)return;t.preventDefault();let i=this.#n.field;this.#y(),this.#s().moveColumn(i,e.field,e.after),this.#t.querySelector(`th[data-field="${i}"]`).focus({preventScroll:!0})};#y=()=>{this.#n=null;for(let t of this.#t.querySelectorAll("th"))t.classList.remove("column-dragging"),t.removeAttribute("data-drop")};#u(t){let e=t.dataset.field;if(e===void 0){let s=this.#i();return{identity:s,width:s.headerWidth,setWidth:o=>{s.setHeaderWidth(o),this.#l()}}}let i=this.#s(),r=i.columnNode(e);return{identity:r,width:r.getAttr("width"),setWidth:s=>i.setColumnWidth(e,s)}}#p(t){return t.classList.contains("row-heading")?Math.max(40,Math.ceil(t.querySelector(".row-number-measure").getBoundingClientRect().width)):Number.parseFloat(this.#e.ownerDocument.defaultView.getComputedStyle(this.#e).getPropertyValue("--gramlot-grid-column-min-width"))||40}#E=t=>{this.#r=!1;let e=t.target.closest(".column-resize");if(!e||t.button!==0||this.#a)return;let i=e.closest("th"),r=i.dataset.field,s=this.#u(i),o=[...this.#e.querySelectorAll("table")],n=[...this.#t.querySelectorAll("th[scope=col]")],a=n.map(d=>d.getBoundingClientRect().width);this.#a={pointerId:t.pointerId,field:r,header:i,identity:s.identity,originalWidth:s.width,x:t.clientX,index:n.indexOf(i),widths:a,width:i.getBoundingClientRect().width,tables:o.map(d=>({table:d,width:d.style.width,columns:[...d.querySelectorAll("col")].map(l=>({col:l,width:l.style.width}))}))},this.#t.setPointerCapture(t.pointerId),this.#e.classList.add("resizing"),t.preventDefault()};#v=t=>{let e=this.#a;if(!e||e.pointerId!==t.pointerId)return;e.width=Math.max(this.#p(e.header),Math.round(e.widths[e.index]+t.clientX-e.x));let i=e.widths.map((r,s)=>s===e.index?e.width:r);for(let{table:r,columns:s}of e.tables)r.style.width=`${i.reduce((o,n)=>o+n,0)}px`,s.forEach(({col:o},n)=>{o.style.width=`${i[n]}px`})};#b=t=>{let e=this.#a;if(!e||e.pointerId!==t.pointerId)return;this.#v(t);let i=this.#u(e.header);this.#r=!0,this.cancel(),!(i.identity!==e.identity||i.width!==e.originalWidth)&&(i.setWidth(e.width),this.#k(e.field))};#f=t=>{if(t.target.closest(".column-filter"))return;if(t.key==="Escape"&&this.#a){this.cancel(),t.preventDefault();return}let e=t.target.closest(".column-resize");if(!e&&["Enter"," "].includes(t.key)){let s=t.target.closest("th[data-field]");s&&(t.preventDefault(),this.#o(s.dataset.field,t.shiftKey));return}if(!["ArrowLeft","ArrowRight"].includes(t.key))return;if(!e){let s=t.target.closest("th[data-field]");if(!s||!t.altKey)return;let o=s.dataset.field,n=this.#s(),a=n.columnNode(o),d=a.parentBag.getNodes(),l=d[d.indexOf(a)+(t.key==="ArrowRight"?1:-1)];l?.getAttr("tag")==="cell"&&(n.moveColumn(o,l.getAttr("field"),t.key==="ArrowRight"),this.#t.querySelector(`th[data-field="${o}"]`).focus({preventScroll:!0})),t.preventDefault();return}let i=e.closest("th"),r=(t.key==="ArrowRight"?1:-1)*(t.shiftKey?1:10);this.#u(i).setWidth(Math.max(this.#p(i),Math.round(i.getBoundingClientRect().width+r))),this.#k(i.dataset.field),t.preventDefault()};#k(t){this.#t.querySelector(t===void 0?".row-heading .column-resize":`th[data-field="${t}"] .column-resize`).focus({preventScroll:!0})}#w=()=>{this.#a&&this.cancel()};cancel(){this.#y();let t=this.#a;if(t){this.#a=null;for(let{table:e,width:i,columns:r}of t.tables){e.style.width=i;for(let{col:s,width:o}of r)s.style.width=o}this.#e.classList.remove("resizing"),this.#t.hasPointerCapture(t.pointerId)&&this.#t.releasePointerCapture(t.pointerId)}}};var O=class{#t;#e=null;setWindow(t){if(t!==null&&(!Number.isSafeInteger(t.start)||t.start<0||!Number.isSafeInteger(t.total)||t.total<t.start))throw new TypeError("Invalid grid window");this.#e=t,this.#a=!0}#s=null;get headerWidth(){return this.#s}setHeaderWidth(t){if(!Number.isFinite(t)||t<=0)throw new TypeError("Grid row header width must be positive pixels");this.#s=Math.round(t)}#o=new Map;#i=new Map;#l=[];#r=[0];#a=!0;#n=32;bindStore(t){t!==this.#t&&(this.#o.clear(),this.resetMeasurements(),this.#t=t)}retain(t){let e=new Set(t);for(let i of[this.#o,this.#i])for(let r of i.keys())e.has(r)||i.delete(r);this.#a=!0}height(t){return this.#o.get(t)??null}setHeight(t,e){if(t.parentBag===this.#t){if(e===null)this.#o.delete(t);else{if(!Number.isFinite(e)||e<=0)throw new TypeError("Grid row height must be positive pixels");this.#o.set(t,Math.round(e))}this.forget(t)}}setRows(t){this.#l=t,this.#a=!0}resetMeasurements(){this.#i.clear(),this.#a=!0}forget(t){this.#i.delete(t),this.#a=!0}measure(t,e){return e<=0||this.#i.get(t)===e?!1:(this.#i.set(t,e),this.#a=!0,!0)}#h(){if(!this.#a)return;let t=1/0;for(let[e,i]of this.#i)this.#o.has(e)||(t=Math.min(t,i));t!==1/0&&(this.#n=t),this.#r=[0];for(let e of this.#l)this.#r.push(this.#r.at(-1)+(this.#i.get(e)??Math.max(this.#o.get(e)??0,this.#n)));this.#a=!1}offset(t){if(this.#h(),!this.#e)return this.#r[t];let e=t-this.#e.start;return e<=0?t*this.#n:e<=this.#l.length?this.#e.start*this.#n+this.#r[e]:t*this.#n+this.#r.at(-1)-this.#l.length*this.#n}get count(){return this.#e?.total??this.#l.length}get totalHeight(){return this.offset(this.count)}indexAt(t){this.#h();let e=0,i=this.count;for(;e<i;){let r=e+i>>>1;this.offset(r+1)<=t?e=r+1:i=r}return Math.min(e,Math.max(0,this.count-1))}window(t,e){this.#h();let i=Math.max(e,this.#n*8);return{start:this.indexAt(Math.max(0,t-i)),end:Math.min(this.count,this.indexAt(t+e+i)+1)}}};var G=class{#t;#e;#s;#o;#i=null;#l=null;#r;#a;#n;constructor(t,e,i,r,s,o,n){this.#t=t,this.#e=e,this.#s=i,this.#o=r,this.#r=s,this.#a=o,this.#n=n}get resizing(){return this.#i!==null}connect(){this.#t.addEventListener("pointerdown",this.#v),this.#t.addEventListener("pointermove",this.#b),this.#t.addEventListener("pointerup",this.#f),this.#t.addEventListener("pointercancel",this.#T),this.#t.addEventListener("lostpointercapture",this.#T),this.#t.addEventListener("keydown",this.#k),this.#t.addEventListener("dblclick",this.#w),this.#t.addEventListener("dragstart",this.#h),this.#t.addEventListener("dragover",this.#x),this.#t.addEventListener("dragleave",this.#c),this.#t.addEventListener("drop",this.#y),this.#t.addEventListener("dragend",this.#u)}disconnect(){this.cancel(),this.cancelDrag(),this.#t.removeEventListener("pointerdown",this.#v),this.#t.removeEventListener("pointermove",this.#b),this.#t.removeEventListener("pointerup",this.#f),this.#t.removeEventListener("pointercancel",this.#T),this.#t.removeEventListener("lostpointercapture",this.#T),this.#t.removeEventListener("keydown",this.#k),this.#t.removeEventListener("dblclick",this.#w),this.#t.removeEventListener("dragstart",this.#h),this.#t.removeEventListener("dragover",this.#x),this.#t.removeEventListener("dragleave",this.#c),this.#t.removeEventListener("drop",this.#y),this.#t.removeEventListener("dragend",this.#u)}#h=t=>{let e=t.target.closest("tr"),i=this.#o(e);if(!this.#a()||!i||this.#i||t.target.closest(".row-height-handle")){t.preventDefault();return}this.#l={node:i,bag:this.#r().bag},t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",i.label),e.classList.add("row-dragging")};#A(t){if(!this.#l||!this.#a())return null;let{node:e,bag:i}=this.#l,r=t.target.closest("tr"),s=this.#o(r);if(!s||s===e||this.#r().bag!==i||e.parentBag!==i||s.parentBag!==i)return null;let o=r.getBoundingClientRect();return{row:r,target:s,after:t.clientY>o.top+o.height/2}}#S(){for(let t of this.#t.querySelectorAll("[data-row-drop]"))t.removeAttribute("data-row-drop")}#x=t=>{this.#S();let e=this.#A(t);e&&(t.preventDefault(),t.dataTransfer.dropEffect="move",e.row.dataset.rowDrop=e.after?"after":"before")};#c=t=>{this.#t.contains(t.relatedTarget)||this.#S()};#y=t=>{let e=this.#A(t);if(!e)return;t.preventDefault(),t.stopPropagation();let{node:i}=this.#l;this.cancelDrag(),this.#r().moveRow(i,e.target,e.after)};#u=()=>{this.cancelDrag()};cancelDrag(){this.#l=null,this.#S();for(let t of this.#t.querySelectorAll(".row-dragging"))t.classList.remove("row-dragging")}#p(t){let e=t.target.closest(".row-height-handle");if(!e)return null;let i=e.closest("tr"),r=this.#o(i);return r?{handle:e,row:i,node:r}:null}project(t,e){let i=this.#s().height(e);t.style.height=i===null?"":`${i}px`}#E(t){let e=t.querySelector(".row-height-handle");e&&e.setAttribute("aria-valuenow",String(Math.round(t.getBoundingClientRect().height))),this.#n()}#v=t=>{let e=this.#p(t);if(!e||t.button!==0||this.#i)return;let{row:i}=e,r=i.getBoundingClientRect().height,s=i.style.height;i.style.height="";let o=i.getBoundingClientRect().height;i.style.height=s,this.#i={...e,pointerId:t.pointerId,y:t.clientY,height:r,minimum:o,preview:r},e.handle.focus({preventScroll:!0}),e.handle.setPointerCapture(t.pointerId),this.#e.classList.add("resizing-row"),t.preventDefault()};#b=t=>{let e=this.#i;!e||e.pointerId!==t.pointerId||(e.preview=Math.max(e.minimum,Math.round(e.height+t.clientY-e.y)),e.row.style.height=`${e.preview}px`,this.#E(e.row))};#f=t=>{let e=this.#i;!e||e.pointerId!==t.pointerId||(this.#b(t),this.cancel(),!(this.#o(e.row)!==e.node||e.preview===e.height)&&(this.#s().setHeight(e.node,e.preview),this.project(e.row,e.node),this.#E(e.row)))};#k=t=>{if(t.key==="Escape"&&(this.#i||this.#l)){this.cancel(),this.cancelDrag(),t.preventDefault();return}let e=this.#p(t);if(!e||!["ArrowUp","ArrowDown","Home"].includes(t.key))return;this.cancel();let i=null;if(t.key!=="Home"){let r=e.row.getBoundingClientRect().height;e.row.style.height="";let s=e.row.getBoundingClientRect().height;i=Math.max(s,r+(t.key==="ArrowDown"?10:-10))}this.#s().setHeight(e.node,i),this.project(e.row,e.node),this.#E(e.row),t.preventDefault()};#w=t=>{let e=this.#p(t);e&&(this.cancel(),this.#s().setHeight(e.node,null),this.project(e.row,e.node),this.#E(e.row),t.preventDefault())};#T=()=>{this.cancel()};cancel(){let t=this.#i;t&&(this.#i=null,this.project(t.row,t.node),this.#e.classList.remove("resizing-row"),t.handle.hasPointerCapture(t.pointerId)&&t.handle.releasePointerCapture(t.pointerId))}};var gt=`
|
|
6
|
+
`}#o(){let t=this.#e.columns().filter(r=>!r.check),e=this.#e.reader();return{columns:t,rows:this.#e.rows().map(r=>[r,t.map(i=>e.value(r,i.field)??null)])}}rowsBag(){let{columns:t,rows:e}=this.#o(),r=new T,i=this.#e.store().mode==="values";for(let[s,o]of e){let n=Object.fromEntries(t.map((a,l)=>[a.field,o[l]]));i?r.setItem(s.label,new T(n)):r.setItem(s.label,null,n)}return r}xml(){let t=new T;return t.setItem("GenRoBag",this.rowsBag()),t.toXml({docHeader:!0})}json(){let{columns:t,rows:e}=this.#o();return JSON.stringify(e.map(([,r])=>new T(Object.fromEntries(t.map((i,s)=>[i.field,r[s]]))).asDict(!1,!1,!0)),null,2)}async xlsx(){let{columns:t,rows:e}=this.#o(),r=(await(Zt??=ut("writeExcelFile",this.#e.document,()=>import("./modules/browser-Y2BRNI3P.js")))).default,i=(n,a)=>n===null?null:z(n)?Number(n.toString()):n instanceof Date?{value:n,type:Date,format:["DH","DHZ"].includes(a.dtype)?"yyyy-mm-dd hh:mm:ss":"yyyy-mm-dd"}:["number","boolean","string"].includes(typeof n)?n:String(n),o=[t.map(n=>({value:n.name,fontWeight:"bold"})),...e.map(([,n])=>n.map((a,l)=>i(a,t[l])))];return r(o,{sheet:this.source.label,stickyRowsCount:1}).toBlob()}async exportRows(t){let e=pt[t];if(!e)throw new TypeError(`grid export format must be one of ${Object.keys(pt).join(", ")}`);let r=t==="csv"?this.csv():t==="json"?this.json():t==="tytx"?this.rowsBag().toTytx():t==="xml"?this.xml():await this.xlsx();this.runtime.gramlot.utl.inout.saveText(r,`${this.source.label}.${e.extension}`,e.type)}printRows(){let t=this.#e.document,{captions:e,cells:r}=this.#r(),i=t.createElement("iframe");i.className="gramlot-grid-print",i.setAttribute("aria-hidden","true"),i.style.cssText="position:fixed;inset-inline-start:-10000px;inline-size:1px;block-size:1px;border:0",t.body.append(i);let s=i.contentDocument,o=s.createElement("table"),n=s.createElement("thead"),a=s.createElement("tbody"),l=(h,m,u)=>{let f=s.createElement("tr");for(let p of m){let b=s.createElement(u);b.textContent=p,f.append(b)}h.append(f)};l(n,e,"th");for(let h of r)l(a,h,"td");o.append(n,a);let c=s.createElement("style");c.textContent="table{border-collapse:collapse;font:12px sans-serif}th,td{border:1px solid #888;padding:2px 6px;text-align:start}",s.head.append(c),s.body.append(o),i.contentWindow.addEventListener("afterprint",()=>i.remove()),i.contentWindow.print()}toggleLineNumbers(){let t=!this.#e.parameters().rowHeaders;this.source.pointerType(this.source.getAttr("rowHeaders"))?this.#t.writeParameter("rowHeaders",t):this.source.setAttr({rowHeaders:t})}#c(t){return this.source.absDatapath("#ROW",{row:t})}addRow(t){let e=this.#c(`r_${crypto.randomUUID().replaceAll("-","")}`);this.#e.store().mode==="values"?this.source.data.setItem(e,new T(t)):this.source.data.setItem(e,null,t)}duplicateRows(){let t=this.#e.store().mode==="values";for(let e of this.#e.selected()){let r=this.#c(`r_${crypto.randomUUID().replaceAll("-","")}`);t?this.source.data.setItem(r,e.staticValue.deepcopy()):this.source.data.setItem(r,null,{...e.getAttr()})}}deleteRows(){for(let t of this.#e.selected().map(e=>e.label))this.source.data.popNode(this.#c(t))}requireEditableTools(t){let e=t.some(o=>o.edit),r=this.#e.selectionMode()!=="none";if(e&&r)return;let i=this.source.parentNode;for(;i&&i.nodeTag!=="framePane";)i=i.parentNode;if(!i)return;let s=o=>{if(o.nodeTag==="framePane")return;let n=o.nodeTag==="menuline"?o.getAttr("command"):null;if(!e&&Yt.has(n))throw new TypeError(`grid tool '${n}' requires an editable column`);if(!r&&Jt.has(n))throw new TypeError(`grid tool '${n}' requires selectionMode single or multi`);if(!e&&o.nodeTag==="editingStatus")throw new TypeError("grid editing status requires an editable column");if(o.value instanceof T)for(let a of o.value.getNodes())s(a)};for(let o of i.value.getNodes())s(o)}};import{Bag as ft}from"@gramlot/gramlot";var bt=Object.freeze(["none","single","multi"]),gt=["selectedId","selectedIndex","selectedLabel","selectedPkeys","selectedRowidx","selectedNodes","selectedRowData"],q=class{#t;#e;#s=new Set;#r=null;#o=null;constructor(t,e){this.#t=t,this.#e=e}get source(){return this.#t.sourceNode}get mode(){return this.#e.mode()}get current(){return this.#r}isSelected(t){return this.#s.has(t)}get nodes(){return this.#e.view().getRows().filter(t=>this.#s.has(t.label))}select(t,{toggle:e=!1,range:r=!1}={}){if(this.mode==="none")return;let i=this.#e.view().getRows().map(s=>s.label);if(this.mode==="multi"&&r&&this.#o!==null&&i.includes(this.#o)){let[s,o]=[i.indexOf(this.#o),i.indexOf(t)].sort((n,a)=>n-a);this.#n(new Set(i.slice(s,o+1)),t,this.#o)}else if(this.mode==="multi"&&e){let s=new Set(this.#s);s.has(t)?s.delete(t):s.add(t),this.#n(s,s.has(t)?t:i.find(o=>s.has(o))??null,t)}else this.#n(new Set([t]),t,t)}move(t,e=!1){if(this.mode==="none")return null;let r=this.#e.view().getRows().map(o=>o.label);if(!r.length)return null;let i=this.#r===null?t>0?-1:r.length:r.indexOf(this.#r),s=r[Math.max(0,Math.min(r.length-1,i+t))];return this.select(s,{range:e}),s}selectAll(){if(this.mode!=="multi")return;let t=this.#e.view().getRows().map(e=>e.label);this.#n(new Set(t),this.#r??t[0]??null,this.#o??t[0]??null)}prune(){let t=new Set(this.mode==="none"?[]:this.#e.view().getRows().map(r=>r.label));if([...this.#s].every(r=>t.has(r))&&(this.#r===null||t.has(this.#r)))return;let e=new Set([...this.#s].filter(r=>t.has(r)));this.#n(e,t.has(this.#r)?this.#r:null,t.has(this.#o)?this.#o:null)}get#c(){return this.source.attributeOwnerNode("datapath")!==null}paths(){let e=Object.keys(this.source.getAttr()).filter(r=>gt.includes(r)||r.startsWith("selected_")).map(r=>this.source.absDatapath(this.source.getAttr(r)));return this.#c?[this.source.absDatapath(".selectionLength"),...e]:e}#n(t,e,r){this.#s=t,this.#r=e,this.#o=r,this.publish()}publish(){let t=this.#e.store(),e=this.#e.view().getRows(),r=e.filter(c=>this.#s.has(c.label)),i=this.#r===null?-1:e.findIndex(c=>c.label===this.#r),s=i<0?null:e[i],o=this.#r,n=r.map(c=>c.label),a=t.getRows().map(c=>c.label),l={selectedId:o,selectedIndex:i<0?null:i,selectedLabel:o,selectedPkeys:n,selectedRowidx:r.map(c=>a.indexOf(c.label)).join(","),selectedNodes:()=>{let c=new ft;for(let h of r)c.setItem(h.label,null,this.#e.rowData(h));return c},selectedRowData:()=>s===null?null:new ft(this.#e.rowData(s))};for(let c of gt){if(this.source.getAttr(c)==null)continue;let h=typeof l[c]=="function"?l[c]():l[c];this.#t.writeParameter(c,h),c==="selectedNodes"&&this.source.rootBuilder.binding.data.getNode(this.source.absDatapath(this.source.getAttr(c))).setAttr({count:r.length})}for(let c of Object.keys(this.source.getAttr())){if(!c.startsWith("selected_"))continue;let h=c.slice(9);this.#t.writeParameter(c,[...new Set(r.map(m=>t.value(m,h)))].join(","))}this.#c&&this.source.getRelativeData(".selectionLength")!==r.length&&this.source.setRelativeData(".selectionLength",r.length),this.#t.publish("onSelectedRow",{idx:i,selectedId:o,selectedPkeys:n})}};var H=class{#t;#e;#s;#r;#o;#c;#n=!1;#a=null;#i=null;constructor(t,e,r,i,s,o){this.#t=t,this.#e=e,this.#s=r,this.#r=i,this.#o=s,this.#c=o}connect(){this.#t.addEventListener("click",this.#p),this.#t.addEventListener("pointerdown",this.#v),this.#t.addEventListener("pointermove",this.#h),this.#t.addEventListener("pointerup",this.#u),this.#t.addEventListener("pointercancel",this.#A),this.#t.addEventListener("lostpointercapture",this.#A),this.#t.addEventListener("keydown",this.#b),this.#t.addEventListener("dragstart",this.#k),this.#t.addEventListener("dragover",this.#x),this.#t.addEventListener("drop",this.#y),this.#t.addEventListener("dragend",this.#l)}disconnect(){this.cancel(),this.#t.removeEventListener("click",this.#p),this.#t.removeEventListener("pointerdown",this.#v),this.#t.removeEventListener("pointermove",this.#h),this.#t.removeEventListener("pointerup",this.#u),this.#t.removeEventListener("pointercancel",this.#A),this.#t.removeEventListener("lostpointercapture",this.#A),this.#t.removeEventListener("keydown",this.#b),this.#t.removeEventListener("dragstart",this.#k),this.#t.removeEventListener("dragover",this.#x),this.#t.removeEventListener("drop",this.#y),this.#t.removeEventListener("dragend",this.#l)}#p=t=>{if(this.#n){this.#n=!1;return}if(t.target.closest(".column-resize, .column-filter"))return;let e=t.target.closest("th[data-field]");e&&this.#r(e.dataset.field,t.shiftKey)};#k=t=>{if(t.target.closest(".column-filter")){t.preventDefault();return}let e=t.target.closest("th[data-field]");if(!e||this.#a){t.preventDefault();return}this.#n=!0,this.#i={field:e.dataset.field},t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",e.textContent),e.classList.add("column-dragging")};#w(t){let e=t.target.closest("th[data-field]");return!this.#i||!e||e.dataset.field===this.#i.field||!this.#s().fields.includes(this.#i.field)?null:{header:e,field:e.dataset.field,after:t.clientX>e.getBoundingClientRect().left+e.getBoundingClientRect().width/2}}#x=t=>{let e=this.#w(t);for(let r of this.#t.querySelectorAll("[data-drop]"))r.removeAttribute("data-drop");e&&(t.preventDefault(),t.dataTransfer.dropEffect="move",e.header.dataset.drop=e.after?"after":"before")};#y=t=>{let e=this.#w(t);if(!e)return;t.preventDefault();let r=this.#i.field;this.#l(),this.#s().moveColumn(r,e.field,e.after),this.#t.querySelector(`th[data-field="${r}"]`).focus({preventScroll:!0})};#l=()=>{this.#i=null;for(let t of this.#t.querySelectorAll("th"))t.classList.remove("column-dragging"),t.removeAttribute("data-drop")};#g(t){let e=t.dataset.field;if(e===void 0){let i=this.#o();return{identity:i,width:i.headerWidth,setWidth:s=>{i.setHeaderWidth(s),this.#c()}}}let r=this.#s();return{identity:e,width:r.columnWidth(e),setWidth:i=>r.setColumnWidth(e,i)}}#E(t){return t.classList.contains("row-heading")?Math.max(40,Math.ceil(t.querySelector(".row-number-measure").getBoundingClientRect().width)):Number.parseFloat(this.#e.ownerDocument.defaultView.getComputedStyle(this.#e).getPropertyValue("--gramlot-grid-column-min-width"))||40}#v=t=>{this.#n=!1;let e=t.target.closest(".column-resize");if(!e||t.button!==0||this.#a)return;let r=e.closest("th"),i=r.dataset.field,s=this.#g(r),o=[...this.#e.querySelectorAll("table")],n=[...this.#t.querySelectorAll("th[scope=col]")],a=n.map(l=>l.getBoundingClientRect().width);this.#a={pointerId:t.pointerId,field:i,header:r,identity:s.identity,originalWidth:s.width,x:t.clientX,index:n.indexOf(r),widths:a,width:r.getBoundingClientRect().width,tables:o.map(l=>({table:l,width:l.style.width,columns:[...l.querySelectorAll("col")].map(c=>({col:c,width:c.style.width}))}))},this.#t.setPointerCapture(t.pointerId),this.#e.classList.add("resizing"),t.preventDefault()};#h=t=>{let e=this.#a;if(!e||e.pointerId!==t.pointerId)return;e.width=Math.max(this.#E(e.header),Math.round(e.widths[e.index]+t.clientX-e.x));let r=e.widths.map((i,s)=>s===e.index?e.width:i);for(let{table:i,columns:s}of e.tables)i.style.width=`${r.reduce((o,n)=>o+n,0)}px`,s.forEach(({col:o},n)=>{o.style.width=`${r[n]}px`})};#u=t=>{let e=this.#a;if(!e||e.pointerId!==t.pointerId)return;this.#h(t);let r=this.#g(e.header);this.#n=!0,this.cancel(),!(r.identity!==e.identity||r.width!==e.originalWidth)&&(r.setWidth(e.width),this.#D(e.field))};#b=t=>{if(t.target.closest(".column-filter"))return;if(t.key==="Escape"&&this.#a){this.cancel(),t.preventDefault();return}let e=t.target.closest(".column-resize");if(!e&&["Enter"," "].includes(t.key)){let s=t.target.closest("th[data-field]");s&&(t.preventDefault(),this.#r(s.dataset.field,t.shiftKey));return}if(!["ArrowLeft","ArrowRight"].includes(t.key))return;if(!e){let s=t.target.closest("th[data-field]");if(!s||!t.altKey)return;let o=s.dataset.field,n=this.#s(),a=n.adjacentField(o,t.key==="ArrowRight"?1:-1);a!==null&&(n.moveColumn(o,a,t.key==="ArrowRight"),this.#t.querySelector(`th[data-field="${o}"]`).focus({preventScroll:!0})),t.preventDefault();return}let r=e.closest("th"),i=(t.key==="ArrowRight"?1:-1)*(t.shiftKey?1:10);this.#g(r).setWidth(Math.max(this.#E(r),Math.round(r.getBoundingClientRect().width+i))),this.#D(r.dataset.field),t.preventDefault()};#D(t){this.#t.querySelector(t===void 0?".row-heading .column-resize":`th[data-field="${t}"] .column-resize`).focus({preventScroll:!0})}#A=()=>{this.#a&&this.cancel()};cancel(){this.#l();let t=this.#a;if(t){this.#a=null;for(let{table:e,width:r,columns:i}of t.tables){e.style.width=r;for(let{col:s,width:o}of i)s.style.width=o}this.#e.classList.remove("resizing"),this.#t.hasPointerCapture(t.pointerId)&&this.#t.releasePointerCapture(t.pointerId)}}};var O=class{#t=new Set;#e=null;setWindow(t){if(t!==null&&(!Number.isSafeInteger(t.start)||t.start<0||!Number.isSafeInteger(t.total)||t.total<t.start))throw new TypeError("Invalid grid window");this.#e=t,this.#a=!0}#s=null;get headerWidth(){return this.#s}setHeaderWidth(t){if(!Number.isFinite(t)||t<=0)throw new TypeError("Grid row header width must be positive pixels");this.#s=Math.round(t)}#r=new Map;#o=new Map;#c=[];#n=[0];#a=!0;#i=32;retain(t){this.#t=new Set(t);for(let e of[this.#r,this.#o])for(let r of e.keys())this.#t.has(r)||e.delete(r);this.#a=!0}height(t){return this.#r.get(t)??null}setHeight(t,e){if(this.#t.has(t)){if(e===null)this.#r.delete(t);else{if(!Number.isFinite(e)||e<=0)throw new TypeError("Grid row height must be positive pixels");this.#r.set(t,Math.round(e))}this.forget(t)}}setRows(t){this.#c=[...t],this.#a=!0}resetMeasurements(){this.#o.clear(),this.#a=!0}forget(t){this.#o.delete(t),this.#a=!0}measure(t,e){return e<=0||this.#o.get(t)===e?!1:(this.#o.set(t,e),this.#a=!0,!0)}#p(){if(!this.#a)return;let t=1/0;for(let[e,r]of this.#o)this.#r.has(e)||(t=Math.min(t,r));t!==1/0&&(this.#i=t),this.#n=[0];for(let e of this.#c)this.#n.push(this.#n.at(-1)+(this.#o.get(e)??Math.max(this.#r.get(e)??0,this.#i)));this.#a=!1}offset(t){if(this.#p(),!this.#e)return this.#n[t];let e=t-this.#e.start;return e<=0?t*this.#i:e<=this.#c.length?this.#e.start*this.#i+this.#n[e]:t*this.#i+this.#n.at(-1)-this.#c.length*this.#i}get count(){return this.#e?.total??this.#c.length}get totalHeight(){return this.offset(this.count)}indexAt(t){this.#p();let e=0,r=this.count;for(;e<r;){let i=e+r>>>1;this.offset(i+1)<=t?e=i+1:r=i}return Math.min(e,Math.max(0,this.count-1))}window(t,e){this.#p();let r=Math.max(e,this.#i*8);return{start:this.indexAt(Math.max(0,t-r)),end:Math.min(this.count,this.indexAt(t+e+r)+1)}}};var V=class{#t;#e;#s;#r;#o=null;#c=null;#n;#a;#i;constructor(t,e,r,i,s,o,n){this.#t=t,this.#e=e,this.#s=r,this.#r=i,this.#n=s,this.#a=o,this.#i=n}get resizing(){return this.#o!==null}connect(){this.#t.addEventListener("pointerdown",this.#h),this.#t.addEventListener("pointermove",this.#u),this.#t.addEventListener("pointerup",this.#b),this.#t.addEventListener("pointercancel",this.#S),this.#t.addEventListener("lostpointercapture",this.#S),this.#t.addEventListener("keydown",this.#D),this.#t.addEventListener("dblclick",this.#A),this.#t.addEventListener("dragstart",this.#p),this.#t.addEventListener("dragover",this.#x),this.#t.addEventListener("dragleave",this.#y),this.#t.addEventListener("drop",this.#l),this.#t.addEventListener("dragend",this.#g)}disconnect(){this.cancel(),this.cancelDrag(),this.#t.removeEventListener("pointerdown",this.#h),this.#t.removeEventListener("pointermove",this.#u),this.#t.removeEventListener("pointerup",this.#b),this.#t.removeEventListener("pointercancel",this.#S),this.#t.removeEventListener("lostpointercapture",this.#S),this.#t.removeEventListener("keydown",this.#D),this.#t.removeEventListener("dblclick",this.#A),this.#t.removeEventListener("dragstart",this.#p),this.#t.removeEventListener("dragover",this.#x),this.#t.removeEventListener("dragleave",this.#y),this.#t.removeEventListener("drop",this.#l),this.#t.removeEventListener("dragend",this.#g)}#p=t=>{let e=t.target.closest("tr"),r=this.#r(e);if(!this.#a()||r===null||this.#o||t.target.closest(".row-height-handle")){t.preventDefault();return}this.#c={label:r},t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",r),e.classList.add("row-dragging")};#k(t){if(!this.#c||!this.#a())return null;let e=t.target.closest("tr"),r=this.#r(e);if(r===null||r===this.#c.label)return null;let i=e.getBoundingClientRect();return{row:e,target:r,after:t.clientY>i.top+i.height/2}}#w(){for(let t of this.#t.querySelectorAll("[data-row-drop]"))t.removeAttribute("data-row-drop")}#x=t=>{this.#w();let e=this.#k(t);e&&(t.preventDefault(),t.dataTransfer.dropEffect="move",e.row.dataset.rowDrop=e.after?"after":"before")};#y=t=>{this.#t.contains(t.relatedTarget)||this.#w()};#l=t=>{let e=this.#k(t);if(!e)return;t.preventDefault(),t.stopPropagation();let{label:r}=this.#c;this.cancelDrag(),this.#n().moveRow(r,e.target,e.after)};#g=()=>{this.cancelDrag()};cancelDrag(){this.#c=null,this.#w();for(let t of this.#t.querySelectorAll(".row-dragging"))t.classList.remove("row-dragging")}#E(t){let e=t.target.closest(".row-height-handle");if(!e)return null;let r=e.closest("tr"),i=this.#r(r);return i===null?null:{handle:e,row:r,label:i}}project(t,e){let r=this.#s().height(e);t.style.height=r===null?"":`${r}px`}#v(t){let e=t.querySelector(".row-height-handle");e&&e.setAttribute("aria-valuenow",String(Math.round(t.getBoundingClientRect().height))),this.#i()}#h=t=>{let e=this.#E(t);if(!e||t.button!==0||this.#o)return;let{row:r}=e,i=r.getBoundingClientRect().height,s=r.style.height;r.style.height="";let o=r.getBoundingClientRect().height;r.style.height=s,this.#o={...e,pointerId:t.pointerId,y:t.clientY,height:i,minimum:o,preview:i},e.handle.focus({preventScroll:!0}),e.handle.setPointerCapture(t.pointerId),this.#e.classList.add("resizing-row"),t.preventDefault()};#u=t=>{let e=this.#o;!e||e.pointerId!==t.pointerId||(e.preview=Math.max(e.minimum,Math.round(e.height+t.clientY-e.y)),e.row.style.height=`${e.preview}px`,this.#v(e.row))};#b=t=>{let e=this.#o;!e||e.pointerId!==t.pointerId||(this.#u(t),this.cancel(),!(this.#r(e.row)!==e.label||e.preview===e.height)&&(this.#s().setHeight(e.label,e.preview),this.project(e.row,e.label),this.#v(e.row)))};#D=t=>{if(t.key==="Escape"&&(this.#o||this.#c)){this.cancel(),this.cancelDrag(),t.preventDefault();return}let e=this.#E(t);if(!e||!["ArrowUp","ArrowDown","Home"].includes(t.key))return;this.cancel();let r=null;if(t.key!=="Home"){let i=e.row.getBoundingClientRect().height;e.row.style.height="";let s=e.row.getBoundingClientRect().height;r=Math.max(s,i+(t.key==="ArrowDown"?10:-10))}this.#s().setHeight(e.label,r),this.project(e.row,e.label),this.#v(e.row),t.preventDefault()};#A=t=>{let e=this.#E(t);e&&(this.cancel(),this.#s().setHeight(e.label,null),this.project(e.row,e.label),this.#v(e.row),t.preventDefault())};#S=()=>{this.cancel()};cancel(){let t=this.#o;t&&(this.#o=null,this.project(t.row,t.label),this.#e.classList.remove("resizing-row"),t.handle.hasPointerCapture(t.pointerId)&&t.handle.releasePointerCapture(t.pointerId))}};var wt=`
|
|
7
7
|
.column-filter{position:absolute;inset-inline-end:8px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:inherit;cursor:pointer;padding:2px;margin-inline-start:4px;vertical-align:middle;line-height:0;opacity:.6}
|
|
8
8
|
th:has(.column-filter){padding-inline-end:28px}
|
|
9
9
|
.column-filter svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.5}
|
|
@@ -245,7 +245,7 @@ th:has(.column-filter){padding-inline-end:28px}
|
|
|
245
245
|
background: var(--gramlot-grid-filtered-numbering-background, var(--gramlot-warning-background, Mark));
|
|
246
246
|
}
|
|
247
247
|
.empty { text-align: center; color: var(--gramlot-text-secondary, GrayText); }
|
|
248
|
-
`;var Y=class{#t=new Set;view=null
|
|
248
|
+
`;var Y=class{#t=new Set;view=null;columns=[];update(t,e){if(!(this.view===t&&this.columns===e)){this.view=t,this.columns=e;for(let r of this.#t)r()}}detach(t){if(this.view===t){this.view=null,this.columns=[];for(let e of this.#t)e()}}subscribe(t){return this.#t.add(t),()=>this.#t.delete(t)}};function R(d){return d._internal.gridSearch??=new Y}function yt(d,t){if(d===!0||typeof d=="string"&&d.startsWith("*")){let e=d===!0?t:t.filter(r=>d.slice(1).includes(r.dtype??"T"));return e.length?[...e.length>1?[{field:e.map(r=>r.field).join("+"),name:"All columns"}]:[],...e.map(r=>({field:r.field,name:r.name}))]:[]}if(typeof d!="string"||!d.trim())throw new TypeError("searchOn requires true or a column list");return d.split(",").map(e=>{let r=e.trim().split(":"),i=r.at(-1),s=r.length===2?r[0]:t.find(o=>o.field===i)?.name;if(r.length>2||!i||i.split("+").some(o=>!t.some(n=>n.field===o)))throw new TypeError(`Unknown searchOn column: ${e}`);return{field:i,name:s??i}})}import{sharedModules as te}from"@gramlot/gramlot";var ee=d=>te["./components/labelbox.js"][d],xt=ee("Labelbox");var vt=".gramlot-search-labelbox{inline-size:var(--gramlot-search-width,240px);max-inline-size:100%;font-size:var(--gramlot-search-font-size,12px)}",kt=`
|
|
249
249
|
:host{display:inline-block;inline-size:100%;font-size:var(--gramlot-search-font-size,12px);max-inline-size:100%;min-inline-size:0}
|
|
250
250
|
.control-box{display:flex;align-items:stretch;position:relative;min-block-size:max(var(--gramlot-search-height,26px),var(--gramlot-touch-target,0px));
|
|
251
251
|
border:1px solid var(--gramlot-border,GrayText);border-radius:999px;
|
|
@@ -283,4 +283,4 @@ svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-width:1.7;stroke
|
|
|
283
283
|
box-shadow:var(--gramlot-shadow,0 3px 12px #0002);font:inherit;font-size:inherit;line-height:1.5}
|
|
284
284
|
.search-help p{margin:.6rem 0 0}.search-help p:last-child{color:var(--gramlot-text-secondary,GrayText)}
|
|
285
285
|
@media(prefers-reduced-motion:reduce){.control-box{transition:none}}
|
|
286
|
-
`;var xt=(0,w.defineComponent)({name:"searchBox",tag:"gramlot-search-box",base:_,sourceContext:!0,mixins:[wt],parameters:{lbl_position:{dtype:"T",default:"L",binding:"read"},searchLiteral:{dtype:"B",default:!1,binding:"read"},searchHelp:{dtype:"B",default:!1,binding:"read"},searchOn:{dtype:["B","T"],default:!0,binding:"read"},searchTime:{dtype:"R",nullable:!0,default:null,binding:"write"}},implementation:c=>class extends c{#t;#e;#s;#o;#i;#l=null;#r;#a;#n;#h;#A;#S;#x;constructor(){super();let t=this.ownerDocument,e=t.createElement("style");e.textContent=vt;let i=p=>{let m=t.createElementNS(y,"svg");m.setAttribute("viewBox","0 0 24 24"),m.setAttribute("aria-hidden","true");let h=t.createElementNS(y,"path");return h.setAttribute("d",p),m.append(h),m};this.#r=t.createElement("input"),this.#r.type="text",this.#r.setAttribute("role","searchbox"),this.#r.setAttribute("aria-label","Filter rows"),this.#r.setAttribute("aria-describedby","search-error"),this.#r.placeholder=" ";let r=t.createElement("button");r.type="button",r.title="Clear filter",r.setAttribute("aria-label","Clear filter"),r.append(i("M6 6L18 18M18 6L6 18")),this.#a=t.createElement("span"),this.#a.id="search-error",this.#a.className="error",this.#a.setAttribute("role","alert");let s=t.createElement("span");s.className="search-entry";let o=i("M21 21L16 16M18 10A8 8 0 1 1 2 10A8 8 0 0 1 18 10");o.classList.add("search-lens"),r.className="clear";let n=this.#n=t.createElement("button");n.type="button",n.className="info",n.hidden=!0,n.setAttribute("aria-label","Search instructions"),n.title="Search instructions",n.setAttribute("aria-haspopup","dialog"),n.setAttribute("aria-expanded","false"),n.setAttribute("aria-controls","search-help"),n.append(i("M21 12A9 9 0 1 1 3 12A9 9 0 0 1 21 12M12 11V17M12 7V7.1"));let a=this.#h=t.createElement("div");a.id="search-help",a.className="search-help",a.setAttribute("popover","auto"),a.setAttribute("role","dialog"),a.setAttribute("aria-label","Search instructions");let d=t.createElement("strong");d.textContent="Search instructions",this.#A=t.createElement("p");let l=t.createElement("p");l.textContent="Clear with \xD7 or Escape. Changing column clears the query. An incomplete expression keeps the last valid result.",a.append(d,this.#A,l),this.shadowRoot.append(a),n.addEventListener("click",()=>{a.matches(":popover-open")?a.hidePopover():(a.showPopover(),R(a,n,{align:"end"}))}),a.addEventListener("toggle",()=>n.setAttribute("aria-expanded",String(a.matches(":popover-open")))),s.append(o,this.#r,r,n),this.control.replaceChildren(s,this.#a),this.shadowRoot.append(e),this.#r.addEventListener("input",()=>{this.#c(),this.#l=t.defaultView.setTimeout(()=>{this.#l=null,this.#f()},100)}),this.#r.addEventListener("keydown",p=>{p.isComposing||(p.key==="Enter"&&(p.preventDefault(),this.#c(),this.#f()),p.key==="Escape"&&(p.preventDefault(),this.#b()))}),r.addEventListener("click",()=>{this.#b(),this.#r.focus()})}setLabelbox(t){super.setLabelbox(t),t.box.classList.add("gramlot-search-labelbox");let e=this.ownerDocument.createElement("style");e.textContent=yt,t.box.prepend(e)}focus(t){this.#r.focus(t)}clear(){this.#b()}setSourceContext(t){this.#t=t;let e=t.frameRecipient();if(e?.nodeTag!=="grid")throw new TypeError("searchBox requires a FrameGrid target");this.#e=B(e)}projectAttributes(t,e){let i=this.parameters?.lbl_value,r=super.projectAttributes(t,e),s=!this.#n.hidden;return this.#n.hidden=!this.parameters.searchHelp,s&&this.#n.hidden&&this.#h.matches(":popover-open")&&this.#h.hidePopover(),this.isConnected&&(this.#y(),i!=null&&i!==this.parameters.lbl_value&&this.#i?.filter?.columns.join("+")!==this.parameters.lbl_value&&this.#b()),r}connectedCallback(){this.#s=this.#e.subscribe(()=>this.#y()),this.#y()}disconnectedCallback(){this.#c(),this.#s?.(),this.#o?.(),this.#s=this.#o=null}#c(){this.#l!==null&&this.ownerDocument.defaultView.clearTimeout(this.#l),this.#l=null}#y(){try{this.#u()}catch(t){this.#r.disabled=!0,this.#a.textContent=t.message}}#u(){if(!this.#e.view)return;(this.#i!==this.#e.view||this.#x!==this.#e.view.bag||!this.#o)&&(this.#c(),this.#o?.(),this.#i=this.#e.view,this.#x=this.#i.bag,this.#S=void 0,this.#o=this.#i.subscribe(()=>this.#p()));let t=bt(this.parameters.searchOn,this.#e.columns),e=this.#t.sourceNode,i=t.map(({field:s,name:o})=>`${s}:${o}`).join(","),r=t.some(s=>s.field===this.parameters.lbl_value)?this.parameters.lbl_value:t[0]?.field??"";e.getAttr("lbl_values")!==i&&e.setAttr({lbl_values:i}),this.parameters.lbl_value!==r&&this.box.labelbox.choose(r),this.#r.disabled=!t.length,this.#p(),this.#v()}#p(){let t=this.#i.filter,e=JSON.stringify(t);this.#S!==e&&(this.#S=e,this.#c(),this.#r.value=t?.value??"",t&&this.parameters.lbl_value!==t.columns.join("+")&&this.box.labelbox.choose(t.columns.join("+")),this.#a.textContent="",this.#r.removeAttribute("aria-invalid"),this.#v())}#E(){let t=this.#e.columns.find(e=>e.field===this.parameters.lbl_value);return["L","R","N","D"].includes(t?.dtype)?t.dtype:"T"}#v(){let t=this.#E();this.#A.textContent=t==="T"?this.parameters.searchLiteral?"Type literal text to find it anywhere. Matching is case-insensitive.":"Type a word to find it anywhere. Text is case-insensitive. You can also use expressions: lamp|desk matches either word; ^lamp matches the start.":t==="D"?"Compare dates: = 2026-10-15, >= 2026-10-15 or < 2026-10-15. ISO dates and your browser\u2019s local date notation are accepted.":"Compare numbers: = 12, > 100, <= 50 or ! 0 (not equal). Decimal punctuation follows your browser locale."}#b(){this.#c(),this.#r.value="",this.#f(),this.#v()}#f(){if(this.#i)try{let t=this.#r.value,e=performance.now();this.#i.applyFilter(t.trim()?{value:t,columns:this.parameters.lbl_value.split("+"),dtype:this.#E(),...this.parameters.searchLiteral?{literal:!0}:{},locale:this.#t.locale,timeZone:this.#t.timeZone}:null),this.#t.writeParameter("searchTime",performance.now()-e),this.#a.textContent="",this.#r.removeAttribute("aria-invalid")}catch(t){this.#a.textContent=t.message,this.#r.setAttribute("aria-invalid","true")}}}});var kt={elements:{struct:{doc:null,sub_tags:"column,colgroup",parent_tags:"grid",inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[],accepts_var_keyword:!1,accepts_var_positional:!1},_meta:{data_element:!0,gridStruct:!0}},column:{doc:null,sub_tags:"",parent_tags:"struct,colgroup",inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[{name:"field",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[A-Za-z_][A-Za-z0-9_]*$",flags:0}]},has_default:!1},{name:"name",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"dtype",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(T|B|L|R|N|D|H|DHZ)$",flags:0}]},has_default:!0,default:null},{name:"width",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[0-9]+([.][0-9]+)?(px|em|rem|ch|%)$",flags:0}]},has_default:!0,default:null},{name:"max_height",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[0-9]+([.][0-9]+)?(px|em|rem)$",flags:0}]},has_default:!0,default:null},{name:"align",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(start|center|end)$",flags:0}]},has_default:!0,default:null},{name:"format",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"white_space",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(normal|nowrap|pre-wrap)$",flags:0}]},has_default:!0,default:null},{name:"edit",kind:"keyword_only",role:"attribute",annotation:{kind:"union",items:[{kind:"dtype",dtype:"B"},{kind:"type",module:"builtins",name:"dict"}]},has_default:!0,default:!1},{name:"check",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"checked",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"checkedField",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"title",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"formula",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"calculated",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"B"},has_default:!0,default:null},{name:"hidden",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"B"},has_default:!0,default:null},{name:"totalize",kind:"keyword_only",role:"attribute",annotation:{kind:"union",items:[{kind:"dtype",dtype:"B"},{kind:"dtype",dtype:"T"}]},has_default:!0,default:null},{name:"footer_value",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"footer_format",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"attr",kind:"var_keyword",role:"attribute",annotation:{kind:"any"},has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},_meta:{data_element:!0,keywordPattern:"^formula_[A-Za-z_$][A-Za-z0-9_$]*$"}},colgroup:{doc:null,sub_tags:"column",parent_tags:"struct",inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[{name:"code",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[A-Za-z_][A-Za-z0-9_]*$",flags:0}]},has_default:!1},{name:"name",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"background",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"color",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null}],accepts_var_keyword:!1,accepts_var_positional:!1},_meta:{data_element:!0}}}};var te=(0,w.defineComponent)({name:"grid",tag:"gramlot-grid",base:_,bagStore:!0,bagStruct:!0,sourceContext:!0,subTags:"struct,div",parameters:{columnFilters:{dtype:"B",default:!1,binding:"read"},setFilter:{dtype:"T",default:"",binding:"read"},windowInfo:{dtype:"X",nullable:!0,default:null,binding:"read"},loading:{dtype:"B",default:!1,binding:"read"},viewport:{dtype:"X",nullable:!0,default:null,binding:"write"},sortRequest:{dtype:"T",default:"",binding:"write"},storepath:{dtype:"T"},structpath:{dtype:"T"},rowMode:{dtype:"T"},rowHeaders:{dtype:"B",default:!1,binding:"read"},footer:{dtype:["B","T"],default:!1,binding:"read"},selectionMode:{dtype:"T",default:"multi",binding:"read"},selectedId:{dtype:"T",nullable:!0,default:null,binding:"write"},selectedIndex:{dtype:"L",nullable:!0,default:null,binding:"write"},selectedLabel:{dtype:"T",nullable:!0,default:null,binding:"write"},selectedPkeys:{dtype:"X",nullable:!0,default:null,binding:"write"},selectedRowidx:{dtype:"T",nullable:!0,default:null,binding:"write"},selectedNodes:{dtype:"X",nullable:!0,default:null,binding:"write"},selectedRowData:{dtype:"X",nullable:!0,default:null,binding:"write"},rowResize:{dtype:"B",default:!1,binding:"read"},selfDragRows:{dtype:"B",default:!1,binding:"read"},sortedBy:{dtype:"T",default:"",binding:"read"},filter:{annotation:{kind:"type",module:"builtins",name:"dict"},nullable:!0,default:null,binding:"read"}},implementation:c=>class extends c{#t;#e;#s;#o;#i;#l;#r;#a=null;#n=null;#h;#A=t=>{let e=t.target.closest("tr[data-row]"),i=e&&[...this.#f].find(([,r])=>r===e)?.[0];if(!(!i||this.#h.mode==="none"))try{this.#h.select(i,{toggle:t.ctrlKey||t.metaKey,range:t.shiftKey}),this.#Q()}catch(r){this.#u.reportError(r,"Grid selection")}};#S=t=>{if(this.#h.mode==="none"||t.altKey)return;let e=(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()==="a",i={ArrowUp:-1,ArrowDown:1}[t.key];if(!(!e&&(i===void 0||t.ctrlKey||t.metaKey))){t.preventDefault();try{if(e)this.#h.selectAll();else{let r=t.target.closest?.("td[data-field]")?.dataset.field,s=this.#h.move(i,t.shiftKey);s&&this.#vt(s,r)}this.#Q()}catch(r){this.#u.reportError(r,"Grid selection")}}};#x=t=>{if(t.type==="keydown"&&!["Enter","F2"].includes(t.key))return;let e=t.target.closest("td[data-field]");if(!e||!this.#p)return;let i=[...this.#f].find(([,s])=>s===e.parentElement)?.[0],r=this.#p.columns.find(s=>s.field===e.dataset.field);if(i&&r.edit){t.preventDefault();try{this.#o.open(i,r,e)}catch(s){this.#u.reportError(s,"Grid editor")}}};#c;#y;#u;#p;#E;#v=!0;#b;#f=new Map;#k;#w;#T;#B;#L;#d;#N;#V;#F=null;#I=1;#D=!1;#P;#R;#m;#g;#et;#it;#j;#$=null;#q=!1;#H=new Set;#O=[];#Z=-1;#U=-1;#G;#W;#rt;#M=!1;#X=null;#st=t=>{t.target!==this.#d||!["Home","End"].includes(t.key)||!this.#p||(t.preventDefault(),this.#M=t.key==="End",this.#_(this.#M?Math.max(0,this.#m.totalHeight-this.#d.clientHeight):0),this.#z())};#ot=()=>{let t=this.#d;t.scrollTop!==this.#X&&(this.#M=t.scrollTop>0&&t.scrollHeight-t.clientHeight-t.scrollTop<=1),this.#X=null,this.#L.scrollLeft=this.#d.scrollLeft,this.#l&&(this.#l.viewport.scrollLeft=this.#d.scrollLeft),this.#z()};constructor(){super();let t=this.ownerDocument,e=t.createElement("style");e.textContent=gt,this.control.setAttribute("role","table"),this.control.setAttribute("aria-label","Grid"),this.control.setAttribute("part","table");let i=t.createElement("div");i.className="header-frame",i.setAttribute("part","header"),this.#L=t.createElement("div"),this.#L.className="header-viewport",this.#L.setAttribute("part","header-viewport"),this.#d=t.createElement("div"),this.#d.className="body-viewport",this.#d.setAttribute("part","body-viewport"),this.#d.tabIndex=0,this.#d.setAttribute("role","rowgroup"),this.#T=t.createElement("table"),this.#B=t.createElement("table");for(let a of[this.#T,this.#B])a.setAttribute("role","presentation");this.#k=t.createElement("thead"),this.#k.setAttribute("role","rowgroup"),this.#w=t.createElement("tbody"),this.#w.setAttribute("role","presentation"),this.#T.append(this.#k),this.#B.append(this.#w),this.#L.append(this.#T),i.append(this.#L),this.#G=t.createElement("div"),this.#W=t.createElement("div");for(let a of[this.#G,this.#W])a.className="row-space",a.setAttribute("aria-hidden","true");this.#d.append(this.#G,this.#B,this.#W);let r=t.createElement("div");r.className="body-frame",this.#N=t.createElement("div"),this.#N.className="loading-status",this.#N.setAttribute("role","status"),this.#N.setAttribute("aria-label","Loading\u2026"),this.#N.hidden=!0;let s=t.createElementNS(y,"svg");s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("aria-hidden","true");let o=t.createElementNS(y,"circle");o.setAttribute("cx","12"),o.setAttribute("cy","12"),o.setAttribute("r","9"),o.setAttribute("opacity",".2");let n=t.createElementNS(y,"path");n.setAttribute("d","M12 3a9 9 0 0 1 9 9"),s.append(o,n),this.#N.append(s),r.append(this.#d,this.#N),this.control.replaceChildren(i,r),this.shadowRoot.append(e),this.#s=new F(this,this.#k),this.#P=new P(this.#k,this.control,()=>this.#p,(a,d)=>this.#kt(a,d),()=>this.#m,()=>this.#z()),this.#R=new G(this.#w,this.control,()=>this.#m,a=>{for(let[d,l]of this.#f)if(l===a)return d;return null},()=>this.#g,()=>this.parameters.selfDragRows,()=>this.#z()),this.#V=new t.defaultView.ResizeObserver(()=>this.#z())}connectedCallback(){this.#w.addEventListener("dblclick",this.#x),this.#w.addEventListener("keydown",this.#x),this.#w.addEventListener("click",this.#A),this.#d.addEventListener("keydown",this.#S),this.#o?.connect(),this.#e?.connect(),this.#r?.connect(),this.#s.connect(),this.#ct(),this.#g&&this.#Y({full:!0,rows:[]}),this.#P.connect(),this.#R.connect(),this.#d.addEventListener("scroll",this.#ot,{passive:!0}),this.#d.addEventListener("keydown",this.#st),this.#V.observe(this.#d),this.#V.observe(this.#B),this.#z()}disconnectedCallback(){this.#w.removeEventListener("dblclick",this.#x),this.#w.removeEventListener("keydown",this.#x),this.#w.removeEventListener("click",this.#A),this.#d.removeEventListener("keydown",this.#S),this.#o?.disconnect(),this.#e?.disconnect(),this.#r.disconnect(),this.#n?.(),this.#n=null,this.#a=null,this.#s.disconnect(),this.#i.disconnect(),this.#ht(),B(this.#u.sourceNode).detach(this.#g),this.#g?.disconnect(),this.#j?.(),this.#j=null,this.#P.disconnect(),this.#R.disconnect(),this.#d.removeEventListener("scroll",this.#ot),this.#d.removeEventListener("keydown",this.#st),this.#V.disconnect(),this.#F!==null&&this.ownerDocument.defaultView.cancelAnimationFrame(this.#F),this.#F=null}#z(){!this.isConnected||this.#F!==null||(this.#F=this.ownerDocument.defaultView.requestAnimationFrame(()=>{this.#F=null;let e=`${this.#d.offsetWidth-this.#d.clientWidth}px`;this.control.style.getPropertyValue("--grid-scrollbar-width")!==e&&this.control.style.setProperty("--grid-scrollbar-width",e),this.#nt();for(let i of this.#k.querySelectorAll("th[scope=col]"))i.querySelector(".column-resize").setAttribute("aria-valuenow",String(Math.round(i.getBoundingClientRect().width)));for(let i of this.#f.values()){let r=i.querySelector(".row-height-handle");r&&r.setAttribute("aria-valuenow",String(Math.round(i.getBoundingClientRect().height)))}if(this.#L.scrollLeft=this.#d.scrollLeft,this.#l.viewport.scrollLeft=this.#d.scrollLeft,!!this.#p)try{this.#at(),this.#o.position()}catch(i){this.#u.reportError(i,"Grid viewport")}}))}#nt(){if(!this.#D)return;let t=this.#k.querySelector(".row-number-measure");t.textContent=String(Math.max(1,this.#m.count));let e=Math.ceil(t.getBoundingClientRect().width);this.control.style.setProperty("--grid-row-header-min-width",`${e}px`),this.#m.headerWidth===null?this.control.style.removeProperty("--grid-row-header-width"):this.control.style.setProperty("--grid-row-header-width",`${this.#m.headerWidth}px`),this.#k.querySelector(".row-heading .column-resize").setAttribute("aria-valuemin",String(Math.max(40,e)))}#at(){let t=this.#d,e=this.#m.indexAt(t.scrollTop),i=t.scrollTop-this.#m.offset(e),r=!1,s=this.#f.values().next().value;if(s){let o=this.ownerDocument.defaultView.getComputedStyle(s.querySelector("td")),n=JSON.stringify([this.#B.getBoundingClientRect().width,o.font,o.lineHeight,o.padding,o.getPropertyValue("--gramlot-grid-row-height")]);n!==this.#rt&&(this.#m.resetMeasurements(),this.#rt=n,r=!0)}for(let[o,n]of this.#f)r=this.#m.measure(o,n.getBoundingClientRect().height)||r;if(r&&this.#O.length){let o=this.#m.offset(e)+i;this.#lt(),this.#_(this.#M?Math.max(0,this.#m.totalHeight-t.clientHeight):o)}this.#R.resizing||this.#K()}#lt(){let t=Math.max(0,this.#Z),e=Math.max(t,this.#U);this.#G.style.height=`${this.#m.offset(t)}px`,this.#W.style.height=`${Math.max(0,this.#m.totalHeight-this.#m.offset(e))}px`}#_(t){this.#d.scrollTop!==t&&(this.#d.scrollTop=t,this.#X=this.#d.scrollTop)}#K(t=!1){let e=this.#d,i=Math.max(0,this.#m.totalHeight-e.clientHeight),r=this.#M?i:Math.min(e.scrollTop,i),{start:s,end:o}=this.#m.window(r,e.clientHeight),n=this.#C();if(n){let d=n.start+this.#O.length;if(s<n.start||o>d){let l=Math.max(200,o-s),p=Math.max(0,Math.min(Math.max(0,n.total-l),s)),m=JSON.stringify([n.revision,p,l]);m!==this.#y&&(this.#y=m,this.#u.writeParameter("viewport",{start:p,count:l}))}else this.#y=null;s=Math.max(s,n.start),o=Math.max(s,Math.min(o,d))}n||(this.#y=null);let a=this.parameters.loading||this.#y!==null;if(this.#N.hidden=!a,a?this.control.setAttribute("aria-busy","true"):this.control.removeAttribute("aria-busy"),t||s!==this.#Z||o!==this.#U){let d=new E(this.#i,this.#u.format).read(this.#p.columns,this.#O.slice(s-(n?.start??0),o-(n?.start??0)));this.#St(d,this.#p.columns,s),this.#Z=s,this.#U=o,this.#z()}this.#lt(),this.#_(r)}#C(){let t=this.parameters.windowInfo;if(t===null)return null;if(!(t instanceof J))throw new TypeError("Grid windowInfo requires a Bag");return Object.fromEntries(["start","total","revision","sortedBy"].map(e=>[e,t.getItem(e)]))}#pt(t,e,i){let r=this.#g.getRows(),s=this.#p.columns.filter(n=>n.edit),o=r.indexOf(t)*s.length+s.findIndex(n=>n.field===e)+(typeof i=="object"?i.row*s.length:i);o<0||o>=r.length*s.length||this.#dt(Math.floor(o/s.length),s[o%s.length])}#dt(t,e){let i=this.#g.getRows()[t];this.#M=!1;let r=this.#m.offset(t),s=this.#m.offset(t+1);r<this.#d.scrollTop?this.#_(r):s>this.#d.scrollTop+this.#d.clientHeight&&this.#_(Math.max(0,s-this.#d.clientHeight)),this.#K(!0),this.#at();let o=this.#f.get(i).querySelector(`td[data-field="${e.field}"]`),n=o.getBoundingClientRect(),a=this.#d.getBoundingClientRect();n.top<a.top?this.#_(Math.floor(this.#d.scrollTop+n.top-a.top)):n.bottom>a.bottom&&this.#_(Math.ceil(this.#d.scrollTop+Math.min(n.top-a.top,n.bottom-a.bottom))),n.left<a.left?this.#d.scrollLeft+=n.left-a.left:n.right>a.right&&(this.#d.scrollLeft+=Math.min(n.left-a.left,n.right-a.right)),this.#L.scrollLeft=this.#d.scrollLeft,this.#o.open(i,e,o)}#ft(t){let e=this.#u.sourceNode.absDatapath(this.parameters.storepath)+".";if(!t.startsWith(e))return!1;let i=t.slice(e.length),r=this.parameters.rowMode==="attributes"?"?":".",s=i.indexOf(r);if(s<0)return!1;let o=this.#t.getNode(i.slice(0,s)),n=this.#p.columns.find(d=>d.field===i.slice(s+1)&&d.edit),a=this.#g.getRows().indexOf(o);return!n||a<0?!1:(this.#dt(a,n),!0)}get formulaErrors(){return this.#i.errors}get totalErrors(){return this.#l.errors}setSourceContext(t){this.#u=t,this.#i=new at(t.sourceNode),this.#l=new q(t.sourceNode,t.format,this.#d.parentElement),this.#h=new V(t,{view:()=>this.#g,store:()=>this.#tt(),mode:()=>this.#J(),rowData:i=>this.#yt(i)}),this.#r=new H(t,{columns:()=>this.#p.columns,rows:()=>this.#g.getRows(),selected:()=>this.#h.nodes,selectionMode:()=>this.#J(),reader:()=>this.#i,store:()=>({bag:this.#t,mode:this.parameters.rowMode}),parameters:()=>this.parameters,document:this.ownerDocument}),this.isConnected&&this.#r.connect(),this.#s.setSourceContext(t),this.#e=new $(t.sourceNode,this.#w,()=>this.#p?.columns??[],i=>[...this.#f].find(([,r])=>r===i)?.[0],(i,r)=>this.#g.value(i,r),()=>this.parameters.setFilter,()=>this.#g),this.isConnected&&this.#e.connect(),this.#o=new j(this,t,(i,r)=>this.#f.get(i)?.querySelector(`td[data-field="${r}"]`),()=>({bag:this.#t,mode:this.parameters.rowMode,window:this.parameters.windowInfo}),()=>this.#f,(i,r,s)=>this.#pt(i,r,s),i=>this.#ft(i));let e=t.sourceNode;Object.hasOwn(e,"gridRowLayout")||Object.defineProperty(e,"gridRowLayout",{value:new O,configurable:!0}),this.#m=e.gridRowLayout}setStoreBag(t){if(!(t instanceof J))throw new TypeError("grid storepath must resolve to a Bag");t!==this.#t&&this.#o?.replaceData(),this.#t=t,this.#m.bindStore(t)}setStructBag(t){this.#E=t,this.#v=!0}projectAttributes(t,e){let i=super.projectAttributes(t,e);if(this.#C()&&(this.parameters.columnFilters||this.#g?.filterContributions.some(([n])=>n.startsWith("column:"))))throw new TypeError("grid columnFilters requires a complete resident store");if(this.#C()&&this.parameters.setFilter!=="")throw new TypeError("grid setFilter requires a complete resident store");let r=this.#u.collectionView(this.#t,this.parameters.rowMode);this.#g!==r&&(this.#ht(),this.#j?.(),this.#j=null,this.#g=r,this.#ct()),!this.#C()&&this.#et!==this.parameters.sortedBy&&(this.#g.sort(this.parameters.sortedBy),this.#et=this.parameters.sortedBy);let s=this.parameters.filter,o=JSON.stringify(s);return!this.#C()&&this.#it!==o&&(this.#g.applyFilter(s===null?null:{locale:this.#u.locale,timeZone:this.#u.timeZone,...s},"base"),this.#it=o),this.#Y({full:!0,rows:[]}),i}#ct(){this.isConnected&&this.#g&&!this.#j&&(this.#g.connect(),this.#j=this.#g.subscribe(t=>this.#Y(t)))}#ht(){this.#$!==null&&this.ownerDocument.defaultView.clearTimeout(this.#$),this.#$=null,this.#q=!1,this.#H.clear()}#Y({full:t,rows:e}){if(this.#q||=t,this.#q)this.#H.clear();else for(let i of e)this.#H.add(i);!this.isConnected||this.#$!==null||(this.#$=this.ownerDocument.defaultView.setTimeout(()=>{let i=this.#q,r=[...this.#H];this.#$=null,this.#q=!1,this.#H.clear();try{i?this.#gt():this.#mt(this.#i.viewFields.size?[...this.#f.keys()]:r)}catch(s){this.#q=!0,this.#u.reportError(s,"Grid refresh")}},0))}#mt(t){for(let i of t)this.#m.forget(i);this.#l.update(this.#i,this.#tt().getRows());let e=new E(this.#i,this.#u.format).read(this.#p.columns,t.filter(i=>this.#f.has(i)));this.#R.cancel();for(let{node:i,cells:r}of e)this.#ut(this.#f.get(i),r,i);this.#z()}#gt(){let t=this.#v?new nt(this.#E):this.#p,e=this.#tt();this.#i.configure(t,this.#g,e),this.#xt(),this.#r.requireEditableTools(t.columns),this.#h.prune();let i=this.#v;this.#o.configure(t.columns),this.#p=t,this.#e.configure();let r=this.#g.getRows();this.#R.cancel(),this.#R.cancelDrag(),this.#m.retain(this.#t.getNodes()),this.#v&&this.#m.resetMeasurements();let s=this.#C();this.#m.setWindow(s),this.#m.setRows(r),this.#O=r,s&&this.#c!==s.revision&&(this.#M=!1,this.#_(0),this.#y=null),this.#c=s?.revision,this.#v=!1,B(this.#u.sourceNode).update(this.#g,t.columns.filter(a=>!a.check&&!this.#i.viewFields.has(a.field)));let o=this.parameters.rowHeaders||this.parameters.rowResize,n=JSON.stringify([t.groups,o,this.parameters.columnFilters,this.parameters.footer]);this.#D=o,n!==this.#b&&(this.#l.configure(this.parameters.footer,t.columns,o),this.#At(t),this.#b=n),this.#l.update(this.#i,e.getRows()),this.#bt(i),this.#s.update(this.#g,t.columns,this.parameters.columnFilters,this.#u.format),this.#Et(),this.#K(!0),this.#Q(),this.control.setAttribute("aria-colcount",String(t.columns.length+Number(this.#D))),this.control.setAttribute("aria-rowcount",String(this.#I+Math.max(this.#m.count,1))),this.#z()}#bt(t){let e=this.#u.sourceNode.formState;if(e===this.#a){t&&e?.updateChanges();return}this.#n?.(),this.#a=e,this.#n=e===null?null:e.registerDerived(i=>this.#wt(i))}#wt(t){let e=this.#a.path,i=n=>n===e?"":n.startsWith(e+".")?n.slice(e.length+1):null;if(this.#l.totalPaths().some(n=>i(n)===t)||this.#h.paths().some(n=>{let a=i(n);return a!==null&&(t===a||t.startsWith(a+".")||t.startsWith(a+"?"))}))return!0;let r=i(this.#u.sourceNode.absDatapath(this.parameters.storepath));if(r===null||r!==""&&!t.startsWith(r+"."))return!1;let s=r===""?t:t.slice(r.length+1),o=(this.parameters.rowMode==="attributes"?/^[^.?]+\?([^.?]+)$/:/^[^.?]+\.([^.?]+)$/).exec(s)?.[1];return o!==void 0&&this.#i.dataFields.has(o)}#J(){let t=this.parameters.selectionMode;if(!mt.includes(t))throw new TypeError("grid selectionMode requires none, single or multi");return t}#yt(t){return this.parameters.rowMode==="attributes"?{...t.getAttr()}:Object.fromEntries(t.staticValue.getNodes().filter(e=>!(e.staticValue instanceof J)).map(e=>[e.label,e.staticValue]))}#Q(){let t=this.#J();t==="multi"?this.control.setAttribute("aria-multiselectable","true"):this.control.removeAttribute("aria-multiselectable");for(let[e,i]of this.#f){let r=this.#h.isSelected(e);t==="none"?i.removeAttribute("aria-selected"):i.setAttribute("aria-selected",String(r)),i.setAttribute("part",r?"row selected-row":"row")}}#vt(t,e){let i=this.#g.getRows().indexOf(t);this.#M=!1;let r=this.#m.offset(i),s=this.#m.offset(i+1);r<this.#d.scrollTop?this.#_(r):s>this.#d.scrollTop+this.#d.clientHeight&&this.#_(Math.max(0,s-this.#d.clientHeight)),this.#K(!0),e&&this.#f.get(t)?.querySelector(`td[data-field="${e}"]`)?.focus({preventScroll:!0})}#tt(){return this.#u.sourceNode.rootBuilder.binding.collectionStore(this.#t,this.parameters.rowMode)}#xt(){let t=this.#g,e=this.#i.viewFields,i=[...t.criteria.map(({field:o})=>["sort by",o]),...t.filterContributions.flatMap(([o,{definition:n}])=>o.startsWith("column:")?[["filter",o.slice(7)]]:o==="sets"?[]:n.columns.map(a=>["search",a]))],[r,s]=i.find(([,o])=>e.has(o))??[];if(s!==void 0)throw new TypeError(`grid cannot ${r} the view value '${s}'`)}#kt(t,e){if(!this.#p.columns.find(i=>i.field===t)?.check)try{if(this.#i.viewFields.has(t))throw new TypeError(`grid cannot sort by the view value '${t}'`);let i=this.#C()?K(this.#C().sortedBy):this.#g.criteria,r=i.find(a=>a.field===t),s=r?.direction==="a"?"d":"a",o=e?i.filter(a=>a.field!==t):[];e&&r?o.splice(i.indexOf(r),0,{field:t,direction:s}):o.push({field:t,direction:s});let n=o.map(a=>`${a.field}:${a.direction}`).join(",");this.#C()?this.#u.writeParameter("sortRequest",n):this.#g.sort(n)}catch(i){this.#u.reportError(i,"Grid sort")}}#Et(){let t=this.#C()?K(this.#C().sortedBy):this.#g.criteria;this.#nt();for(let e of this.#k.querySelectorAll("th[scope=col]")){let i=t.findIndex(r=>r.field===e.dataset.field);if(e.removeAttribute("aria-sort"),i<0)delete e.dataset.sortDirection,delete e.dataset.sortPriority,e.removeAttribute("aria-label");else{let r=t[i].direction==="a"?"ascending":"descending";e.dataset.sortDirection=r,e.dataset.sortPriority=String(i+1),i===0&&e.setAttribute("aria-sort",r),e.setAttribute("aria-label",`${e.textContent}, sort ${i+1}, ${r}`)}}}#At(t){this.#P.cancel();let e=this.shadowRoot.activeElement,i=e?.closest("th[data-field]")?.dataset.field,r=e?.classList.contains("column-resize"),s=this.ownerDocument,o=t.groups.some(h=>h.name!==null);this.#I=o?2:1;let n=s.createElement("tr"),a=s.createElement("tr");for(let[h,u]of[n,a].entries())u.setAttribute("role","row"),u.setAttribute("aria-rowindex",String(h+1));let d=(h,u,f,g,x,D="start")=>{let b=s.createElement("th");if(b.textContent=h,b.colSpan=u,b.rowSpan=f,b.scope=g,b.setAttribute("role","columnheader"),b.setAttribute("part",g==="colgroup"?"group-header":"column-header"),b.setAttribute("aria-colindex",String(x+1+Number(this.#D))),b.setAttribute("aria-colspan",String(u)),b.setAttribute("aria-rowspan",String(f)),b.style.textAlign=D,g==="col"){let W=s.createElement("span");W.className="column-caption",W.textContent=h,b.replaceChildren(W);let v=t.columns[x];b.dataset.field=v.field,b.draggable=!0,b.tabIndex=0,b.setAttribute("aria-label",v.title??v.name),b.title=v.check?(v.title??v.name)+" \xB7 Drag to reorder":"Click: ascending / descending \xB7 Shift-click: add or reverse this column without changing the others \xB7 Numbers show sort priority \xB7 Drag to reorder";let L=s.createElementNS(y,"svg");L.classList.add("sort-indicator"),L.setAttribute("viewBox","0 0 16 16"),L.setAttribute("aria-hidden","true");let tt=s.createElementNS(y,"path");tt.setAttribute("d","M4 10L8 6L12 10"),L.append(tt),b.append(L),this.parameters.columnFilters&&!v.check&&!this.#i.viewFields.has(v.field)&&b.append(this.#s.button(v));let k=s.createElement("span");k.className="column-resize",k.tabIndex=0,k.setAttribute("role","separator"),k.setAttribute("aria-orientation","vertical"),k.setAttribute("aria-valuemin","40"),k.setAttribute("aria-label",`Resize ${v.name}`),k.title="Drag to resize \xB7 Arrow keys adjust width",b.append(k)}return b};if(this.#D){let h=s.createElement("th");h.textContent="#",h.scope="col",h.className="row-heading",h.rowSpan=this.#I,h.setAttribute("role","columnheader"),h.setAttribute("aria-colindex","1"),h.setAttribute("aria-rowspan",String(this.#I)),h.setAttribute("part","row-header");let u=s.createElement("span");u.className="row-number-measure",u.setAttribute("aria-hidden","true");let f=s.createElement("span");f.className="column-resize",f.tabIndex=0,f.setAttribute("role","separator"),f.setAttribute("aria-orientation","vertical"),f.setAttribute("aria-label","Resize row numbers"),f.title="Drag to resize \xB7 Arrow keys adjust width",h.append(u,f),n.append(h)}let l=0;for(let h of t.groups)if(o&&h.name!==null){let u=d(h.name,h.columns.length,1,"colgroup",l,"center");u.style.background=h.background??"",u.style.color=h.color??"",n.append(u);for(let f of h.columns)a.append(d(f.name,1,1,"col",l++,f.align))}else for(let u of h.columns){if(o){let f=s.createElement("td");f.className="group-spacer",f.setAttribute("aria-hidden","true"),n.append(f)}(o?a:n).append(d(u.name,1,1,"col",l++,u.align))}this.#k.replaceChildren(n,...o?[a]:[]),i&&this.#k.querySelector(`th[data-field="${i}"]${r?" .column-resize":""}`)?.focus({preventScroll:!0});let p=t.columns.map(h=>h.width??"var(--gramlot-grid-column-width, 10rem)");this.#D&&p.unshift("max(var(--grid-row-header-min-width, 0px), var(--grid-row-header-width, var(--gramlot-grid-row-header-width, 44px)))"),this.control.style.setProperty("--grid-columns-width",`calc(${p.join(" + ")})`);let m=this.parameters.footer===!1?[]:[this.#l.table];for(let h of[this.#T,this.#B,...m]){for(let u of h.querySelectorAll(":scope > colgroup"))u.remove();if(h.prepend(...t.groups.map(u=>{let f=s.createElement("colgroup");for(let g of u.columns){let x=s.createElement("col");x.style.width=g.width??"var(--gramlot-grid-column-width, 10rem)",f.append(x)}return f})),this.#D){let u=s.createElement("colgroup"),f=s.createElement("col");f.style.width="max(var(--grid-row-header-min-width, 0px), var(--grid-row-header-width, var(--gramlot-grid-row-header-width, 44px)))",u.append(f),h.prepend(u)}}}#St(t,e,i){this.#R.cancel();let r=new Set,s=null;this.#w.querySelector(".empty")?.parentElement.remove();for(let{node:o,cells:n}of t){let a=this.#f.get(o);a||(a=this.ownerDocument.createElement("tr"),a.setAttribute("part","row"),a.setAttribute("role","row"),a.dataset.row=o.label,this.#f.set(o,a)),a.classList.toggle("alternate",(i+r.size)%2===1),a.setAttribute("part",this.#h.isSelected(o)?"row selected-row":"row"),this.#h.mode==="none"?a.removeAttribute("aria-selected"):a.setAttribute("aria-selected",String(this.#h.isSelected(o)));let d=this.#g.isFiltered();a.draggable=this.parameters.selfDragRows;let l=a.querySelector("th[scope=row]");if(this.#D){if(!l){l=this.ownerDocument.createElement("th"),l.scope="row",l.className="row-heading",l.setAttribute("role","rowheader"),l.setAttribute("part","row-header"),l.setAttribute("aria-colindex","1");let f=this.ownerDocument.createElement("span");f.className="row-number",l.append(f),a.prepend(l)}l.querySelector(".row-number").textContent=String(i+r.size+1),l.classList.toggle("filtered-numbering",d);let u=l.querySelector(".row-height-handle");this.parameters.rowResize?(u||(u=this.ownerDocument.createElement("span"),u.className="row-height-handle",u.tabIndex=0,u.setAttribute("role","separator"),u.setAttribute("aria-orientation","horizontal"),u.title="Drag to resize row \xB7 Double-click or Home resets \xB7 Arrow keys adjust height",l.append(u)),u.setAttribute("aria-label",`Resize row ${i+r.size+1}`)):u?.remove()}else l?.remove();let p=Number(this.#D),m=new Map([...a.querySelectorAll("td[data-field]")].map(u=>[u.dataset.field,u]));for(let[u,f]of e.entries()){let g=m.get(f.field);if(!g){g=this.ownerDocument.createElement("td"),g.setAttribute("part","cell"),g.dataset.field=f.field,g.setAttribute("role","cell");let b=this.ownerDocument.createElement("div");b.className="cell-content",b.setAttribute("part","cell-content"),g.append(b)}f.edit?g.tabIndex=0:g.removeAttribute("tabindex"),g.classList.toggle("filtered-numbering",d&&this.#i.viewFields.has(f.field));let x=g.firstElementChild,D=f.max_height!=null;D?g.style.setProperty("--grid-cell-max-height",f.max_height):g.style.removeProperty("--grid-cell-max-height"),x.classList.toggle("cell-scroll",D),D?x.tabIndex=0:x.removeAttribute("tabindex"),g.style.textAlign=f.align,g.style.whiteSpace=f.white_space??"",g.style.overflowWrap=f.white_space==="pre-wrap"||f.white_space==="normal"?"anywhere":"",g.setAttribute("aria-colindex",String(u+1+p)),g.classList.toggle("numeric",["L","R","N"].includes(f.dtype)),a.cells[u+p]!==g&&a.insertBefore(g,a.cells[u+p]??null),m.delete(f.field)}for(let u of m.values())u.remove();a.setAttribute("aria-rowindex",String(this.#I+i+r.size+1)),this.#ut(a,n,o),this.#o.decorate(a,o);let h=s?s.nextSibling:this.#w.firstChild;h!==a&&this.#w.insertBefore(a,h),this.#R.project(a,o),s=a,r.add(o)}for(let[o,n]of this.#f)r.has(o)||(n.remove(),this.#f.delete(o));if(!t.length&&this.#m.count===0&&!this.parameters.loading){let o=this.ownerDocument.createElement("tr"),n=this.ownerDocument.createElement("td");o.setAttribute("role","row"),o.setAttribute("aria-rowindex",String(this.#I+1)),n.setAttribute("role","cell"),n.setAttribute("aria-colspan",String(e.length+Number(this.#D))),n.className="empty",n.colSpan=e.length+Number(this.#D),n.textContent="No rows",o.append(n),this.#w.append(o)}}#ut(t,e,i){let r=Number(this.#D);e.forEach((s,o)=>{let n=t.cells[o+r].firstElementChild,a=this.#p.columns[o];if(n.parentElement.classList.toggle("check-cell",!!a.check),a.check){this.#e.project(n,i,a);return}if(a.edit?.tag==="colorpicker"){let l=n.querySelector(".cell-color-swatch");l||(l=this.ownerDocument.createElement("span"),l.className="cell-color-swatch",l.setAttribute("role","img"),n.replaceChildren(l)),l.hidden=s==="",l.style.backgroundColor=s,l.title=s,l.setAttribute("aria-label",s)}else(n.firstElementChild||n.textContent!==s)&&(n.textContent=s)})}}}),Q=class extends w.ComponentCollection{toDocument(){let t=super.toDocument(),e=t.elements.grid.attributes.parameters;for(let i of["storepath","rowMode"]){let r=e.find(s=>s.name===i);r.has_default=!1,delete r.default,i==="rowMode"&&(r.annotation={kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(values|attributes)$",flags:0}]})}return Object.assign(t.elements,structuredClone(kt.elements)),t.elements.grid._meta.parameterPattern="^selected_[A-Za-z_][A-Za-z0-9_]*$",t}},Ii=new Q({name:"grid",components:[te,xt],dependencies:[Qt],registerCommands:ut,assets:{writeExcelFileLicense:A["assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt"],fflateLicense:A["assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt"]}});export{te as Grid,Ii as default};
|
|
286
|
+
`;var Et=(0,y.defineComponent)({name:"searchBox",tag:"gramlot-search-box",base:_,sourceContext:!0,mixins:[xt],parameters:{lbl_position:{dtype:"T",default:"L",binding:"read"},searchLiteral:{dtype:"B",default:!1,binding:"read"},searchHelp:{dtype:"B",default:!1,binding:"read"},searchOn:{dtype:["B","T"],default:!0,binding:"read"},searchTime:{dtype:"R",nullable:!0,default:null,binding:"write"}},implementation:d=>class extends d{#t;#e;#s;#r;#o;#c=null;#n;#a;#i;#p;#k;#w;constructor(){super();let t=this.ownerDocument,e=t.createElement("style");e.textContent=kt;let r=h=>{let m=t.createElementNS(x,"svg");m.setAttribute("viewBox","0 0 24 24"),m.setAttribute("aria-hidden","true");let u=t.createElementNS(x,"path");return u.setAttribute("d",h),m.append(u),m};this.#n=t.createElement("input"),this.#n.type="text",this.#n.setAttribute("role","searchbox"),this.#n.setAttribute("aria-label","Filter rows"),this.#n.setAttribute("aria-describedby","search-error"),this.#n.placeholder=" ";let i=t.createElement("button");i.type="button",i.title="Clear filter",i.setAttribute("aria-label","Clear filter"),i.append(r("M6 6L18 18M18 6L6 18")),this.#a=t.createElement("span"),this.#a.id="search-error",this.#a.className="error",this.#a.setAttribute("role","alert");let s=t.createElement("span");s.className="search-entry";let o=r("M21 21L16 16M18 10A8 8 0 1 1 2 10A8 8 0 0 1 18 10");o.classList.add("search-lens"),i.className="clear";let n=this.#i=t.createElement("button");n.type="button",n.className="info",n.hidden=!0,n.setAttribute("aria-label","Search instructions"),n.title="Search instructions",n.setAttribute("aria-haspopup","dialog"),n.setAttribute("aria-expanded","false"),n.setAttribute("aria-controls","search-help"),n.append(r("M21 12A9 9 0 1 1 3 12A9 9 0 0 1 21 12M12 11V17M12 7V7.1"));let a=this.#p=t.createElement("div");a.id="search-help",a.className="search-help",a.setAttribute("popover","auto"),a.setAttribute("role","dialog"),a.setAttribute("aria-label","Search instructions");let l=t.createElement("strong");l.textContent="Search instructions",this.#k=t.createElement("p");let c=t.createElement("p");c.textContent="Clear with \xD7 or Escape. Changing column clears the query. An incomplete expression keeps the last valid result.",a.append(l,this.#k,c),this.shadowRoot.append(a),n.addEventListener("click",()=>{a.matches(":popover-open")?a.hidePopover():(a.showPopover(),B(a,n,{align:"end"}))}),a.addEventListener("toggle",()=>n.setAttribute("aria-expanded",String(a.matches(":popover-open")))),s.append(o,this.#n,i,n),this.control.replaceChildren(s,this.#a),this.shadowRoot.append(e),this.#n.addEventListener("input",()=>{this.#x(),this.#c=t.defaultView.setTimeout(()=>{this.#c=null,this.#u()},100)}),this.#n.addEventListener("keydown",h=>{h.isComposing||(h.key==="Enter"&&(h.preventDefault(),this.#x(),this.#u()),h.key==="Escape"&&(h.preventDefault(),this.#h()))}),i.addEventListener("click",()=>{this.#h(),this.#n.focus()})}setLabelbox(t){super.setLabelbox(t),t.box.classList.add("gramlot-search-labelbox");let e=this.ownerDocument.createElement("style");e.textContent=vt,t.box.prepend(e)}focus(t){this.#n.focus(t)}clear(){this.#h()}setSourceContext(t){this.#t=t;let e=t.frameRecipient();if(e?.nodeTag!=="grid")throw new TypeError("searchBox requires a FrameGrid target");this.#e=R(e)}projectAttributes(t,e){let r=this.parameters?.lbl_value,i=super.projectAttributes(t,e),s=!this.#i.hidden;return this.#i.hidden=!this.parameters.searchHelp,s&&this.#i.hidden&&this.#p.matches(":popover-open")&&this.#p.hidePopover(),this.isConnected&&(this.#y(),r!=null&&r!==this.parameters.lbl_value&&this.#o?.filter?.columns.join("+")!==this.parameters.lbl_value&&this.#h()),i}connectedCallback(){this.#s=this.#e.subscribe(()=>this.#y()),this.#y()}disconnectedCallback(){this.#x(),this.#s?.(),this.#r?.(),this.#s=this.#r=null}#x(){this.#c!==null&&this.ownerDocument.defaultView.clearTimeout(this.#c),this.#c=null}#y(){try{this.#l()}catch(t){this.#n.disabled=!0,this.#a.textContent=t.message}}#l(){if(!this.#e.view)return;(this.#o!==this.#e.view||!this.#r)&&(this.#x(),this.#r?.(),this.#o=this.#e.view,this.#w=void 0,this.#r=this.#o.subscribe(()=>this.#g()));let t=yt(this.parameters.searchOn,this.#e.columns),e=this.#t.sourceNode,r=t.map(({field:s,name:o})=>`${s}:${o}`).join(","),i=t.some(s=>s.field===this.parameters.lbl_value)?this.parameters.lbl_value:t[0]?.field??"";e.getAttr("lbl_values")!==r&&e.setAttr({lbl_values:r}),this.parameters.lbl_value!==i&&this.box.labelbox.choose(i),this.#n.disabled=!t.length,this.#g(),this.#v()}#g(){let t=this.#o.filter,e=JSON.stringify(t);this.#w!==e&&(this.#w=e,this.#x(),this.#n.value=t?.value??"",t&&this.parameters.lbl_value!==t.columns.join("+")&&this.box.labelbox.choose(t.columns.join("+")),this.#a.textContent="",this.#n.removeAttribute("aria-invalid"),this.#v())}#E(){let t=this.#e.columns.find(e=>e.field===this.parameters.lbl_value);return["L","R","N","D"].includes(t?.dtype)?t.dtype:"T"}#v(){let t=this.#E();this.#k.textContent=t==="T"?this.parameters.searchLiteral?"Type literal text to find it anywhere. Matching is case-insensitive.":"Type a word to find it anywhere. Text is case-insensitive. You can also use expressions: lamp|desk matches either word; ^lamp matches the start.":t==="D"?"Compare dates: = 2026-10-15, >= 2026-10-15 or < 2026-10-15. ISO dates and your browser\u2019s local date notation are accepted.":"Compare numbers: = 12, > 100, <= 50 or ! 0 (not equal). Decimal punctuation follows your browser locale."}#h(){this.#x(),this.#n.value="",this.#u(),this.#v()}#u(){if(this.#o)try{let t=this.#n.value,e=performance.now();this.#o.applyFilter(t.trim()?{value:t,columns:this.parameters.lbl_value.split("+"),dtype:this.#E(),...this.parameters.searchLiteral?{literal:!0}:{},locale:this.#t.locale,timeZone:this.#t.timeZone}:null),this.#t.writeParameter("searchTime",performance.now()-e),this.#a.textContent="",this.#n.removeAttribute("aria-invalid")}catch(t){this.#a.textContent=t.message,this.#n.setAttribute("aria-invalid","true")}}}});var At={elements:{struct:{doc:null,sub_tags:"column,colgroup",parent_tags:"grid",inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[],accepts_var_keyword:!1,accepts_var_positional:!1},_meta:{data_element:!0,gridStruct:!0}},column:{doc:null,sub_tags:"",parent_tags:"struct,colgroup",inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[{name:"field",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[A-Za-z_][A-Za-z0-9_]*$",flags:0}]},has_default:!1},{name:"name",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"dtype",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(T|B|L|R|N|D|H|DHZ)$",flags:0}]},has_default:!0,default:null},{name:"width",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[0-9]+([.][0-9]+)?(px|em|rem|ch|%)$",flags:0}]},has_default:!0,default:null},{name:"max_height",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[0-9]+([.][0-9]+)?(px|em|rem)$",flags:0}]},has_default:!0,default:null},{name:"align",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(start|center|end)$",flags:0}]},has_default:!0,default:null},{name:"format",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"white_space",kind:"keyword_only",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(normal|nowrap|pre-wrap)$",flags:0}]},has_default:!0,default:null},{name:"edit",kind:"keyword_only",role:"attribute",annotation:{kind:"union",items:[{kind:"dtype",dtype:"B"},{kind:"type",module:"builtins",name:"dict"}]},has_default:!0,default:!1},{name:"check",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"checked",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"checkedField",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"title",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"formula",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"calculated",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"B"},has_default:!0,default:null},{name:"hidden",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"B"},has_default:!0,default:null},{name:"totalize",kind:"keyword_only",role:"attribute",annotation:{kind:"union",items:[{kind:"dtype",dtype:"B"},{kind:"dtype",dtype:"T"}]},has_default:!0,default:null},{name:"footer_value",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"footer_format",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"attr",kind:"var_keyword",role:"attribute",annotation:{kind:"any"},has_default:!1}],accepts_var_keyword:!0,accepts_var_positional:!1},_meta:{data_element:!0,keywordPattern:"^formula_[A-Za-z_$][A-Za-z0-9_$]*$"}},colgroup:{doc:null,sub_tags:"column",parent_tags:"struct",inherits_from:null,ns:null,node_label:null,collection_key:null,attributes:{parameters:[{name:"code",kind:"positional_or_keyword",role:"attribute",annotation:{kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^[A-Za-z_][A-Za-z0-9_]*$",flags:0}]},has_default:!1},{name:"name",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"background",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null},{name:"color",kind:"keyword_only",role:"attribute",annotation:{kind:"dtype",dtype:"T"},has_default:!0,default:null}],accepts_var_keyword:!1,accepts_var_positional:!1},_meta:{data_element:!0}}}};var se=(0,y.defineComponent)({name:"grid",tag:"gramlot-grid",base:_,sourceContext:!0,subTags:"struct,div",parameters:{columnFilters:{dtype:"B",default:!1,binding:"read"},setFilter:{dtype:"T",default:"",binding:"read"},windowInfo:{dtype:"X",nullable:!0,default:null,binding:"read"},loading:{dtype:"B",default:!1,binding:"read"},viewport:{dtype:"X",nullable:!0,default:null,binding:"write"},sortRequest:{dtype:"T",default:"",binding:"write"},storepath:{dtype:"T"},structpath:{dtype:"T"},rowMode:{dtype:"T"},rowHeaders:{dtype:"B",default:!1,binding:"read"},footer:{dtype:["B","T"],default:!1,binding:"read"},selectionMode:{dtype:"T",default:"multi",binding:"read"},selectedId:{dtype:"T",nullable:!0,default:null,binding:"write"},selectedIndex:{dtype:"L",nullable:!0,default:null,binding:"write"},selectedLabel:{dtype:"T",nullable:!0,default:null,binding:"write"},selectedPkeys:{dtype:"X",nullable:!0,default:null,binding:"write"},selectedRowidx:{dtype:"T",nullable:!0,default:null,binding:"write"},selectedNodes:{dtype:"X",nullable:!0,default:null,binding:"write"},selectedRowData:{dtype:"X",nullable:!0,default:null,binding:"write"},rowResize:{dtype:"B",default:!1,binding:"read"},selfDragRows:{dtype:"B",default:!1,binding:"read"},sortedBy:{dtype:"T",default:"",binding:"read"},filter:{annotation:{kind:"type",module:"builtins",name:"dict"},nullable:!0,default:null,binding:"read"}},implementation:d=>class extends d{#t;#e;#s;#r;#o;#c;#n=null;#a=null;#i;#p=t=>{let e=this.#W(t.target.closest("tr[data-row]"));if(!(e===null||this.#i.mode==="none"))try{this.#i.select(e,{toggle:t.ctrlKey||t.metaKey,range:t.shiftKey}),this.#tt()}catch(r){this.#l.reportError(r,"Grid selection")}};#k=t=>{if(this.#i.mode==="none"||t.altKey)return;let e=(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()==="a",r={ArrowUp:-1,ArrowDown:1}[t.key];if(!(!e&&(r===void 0||t.ctrlKey||t.metaKey))){t.preventDefault();try{if(e)this.#i.selectAll();else{let i=t.target.closest?.("td[data-field]")?.dataset.field,s=this.#i.move(r,t.shiftKey);s!==null&&this.#vt(s,i)}this.#tt()}catch(i){this.#l.reportError(i,"Grid selection")}}};#w=t=>{if(t.type==="keydown"&&!["Enter","F2"].includes(t.key))return;let e=t.target.closest("td[data-field]");if(!e||!this.#g)return;let r=this.#W(e.parentElement),i=this.#g.columns.find(s=>s.field===e.dataset.field);if(r!==null&&i.edit){t.preventDefault();try{this.#s.open(r,i,e)}catch(s){this.#l.reportError(s,"Grid editor")}}};#x;#y;#l;#g;#E=!0;#v;#h=new Map;#u;#b;#D;#A;#S;#d;#T;#z;#M=null;#F=1;#L=!1;#H;#_;#m;#f;#et;#rt;#$;#I=null;#j=!1;#q=new Set;#O=[];#U=-1;#Z=-1;#V;#P;#it;#B=!1;#X=null;#st=t=>{t.target!==this.#d||!["Home","End"].includes(t.key)||!this.#g||(t.preventDefault(),this.#B=t.key==="End",this.#C(this.#B?Math.max(0,this.#m.totalHeight-this.#d.clientHeight):0),this.#R())};#ot=()=>{let t=this.#d;t.scrollTop!==this.#X&&(this.#B=t.scrollTop>0&&t.scrollHeight-t.clientHeight-t.scrollTop<=1),this.#X=null,this.#S.scrollLeft=this.#d.scrollLeft,this.#o&&(this.#o.viewport.scrollLeft=this.#d.scrollLeft),this.#R()};constructor(){super();let t=this.ownerDocument,e=t.createElement("style");e.textContent=wt,this.control.setAttribute("role","table"),this.control.setAttribute("aria-label","Grid"),this.control.setAttribute("part","table");let r=t.createElement("div");r.className="header-frame",r.setAttribute("part","header"),this.#S=t.createElement("div"),this.#S.className="header-viewport",this.#S.setAttribute("part","header-viewport"),this.#d=t.createElement("div"),this.#d.className="body-viewport",this.#d.setAttribute("part","body-viewport"),this.#d.tabIndex=0,this.#d.setAttribute("role","rowgroup"),this.#D=t.createElement("table"),this.#A=t.createElement("table");for(let a of[this.#D,this.#A])a.setAttribute("role","presentation");this.#u=t.createElement("thead"),this.#u.setAttribute("role","rowgroup"),this.#b=t.createElement("tbody"),this.#b.setAttribute("role","presentation"),this.#D.append(this.#u),this.#A.append(this.#b),this.#S.append(this.#D),r.append(this.#S),this.#V=t.createElement("div"),this.#P=t.createElement("div");for(let a of[this.#V,this.#P])a.className="row-space",a.setAttribute("aria-hidden","true");this.#d.append(this.#V,this.#A,this.#P);let i=t.createElement("div");i.className="body-frame",this.#T=t.createElement("div"),this.#T.className="loading-status",this.#T.setAttribute("role","status"),this.#T.setAttribute("aria-label","Loading\u2026"),this.#T.hidden=!0;let s=t.createElementNS(x,"svg");s.setAttribute("viewBox","0 0 24 24"),s.setAttribute("aria-hidden","true");let o=t.createElementNS(x,"circle");o.setAttribute("cx","12"),o.setAttribute("cy","12"),o.setAttribute("r","9"),o.setAttribute("opacity",".2");let n=t.createElementNS(x,"path");n.setAttribute("d","M12 3a9 9 0 0 1 9 9"),s.append(o,n),this.#T.append(s),i.append(this.#d,this.#T),this.control.replaceChildren(r,i),this.shadowRoot.append(e),this.#e=new M(this,this.#u),this.#H=new H(this.#u,this.control,()=>this.#g,(a,l)=>this.#Et(a,l),()=>this.#m,()=>this.#R()),this.#_=new V(this.#b,this.control,()=>this.#m,a=>this.#W(a),()=>this.#f,()=>this.parameters.selfDragRows,()=>this.#R()),this.#z=new t.defaultView.ResizeObserver(()=>this.#R())}connectedCallback(){this.#b.addEventListener("dblclick",this.#w),this.#b.addEventListener("keydown",this.#w),this.#b.addEventListener("click",this.#p),this.#d.addEventListener("keydown",this.#k),this.#s?.connect(),this.#t?.connect(),this.#c?.connect(),this.#e.connect(),this.#dt(),this.#f&&this.#J({full:!0,rows:[]}),this.#H.connect(),this.#_.connect(),this.#d.addEventListener("scroll",this.#ot,{passive:!0}),this.#d.addEventListener("keydown",this.#st),this.#z.observe(this.#d),this.#z.observe(this.#A),this.#R()}disconnectedCallback(){this.#b.removeEventListener("dblclick",this.#w),this.#b.removeEventListener("keydown",this.#w),this.#b.removeEventListener("click",this.#p),this.#d.removeEventListener("keydown",this.#k),this.#s?.disconnect(),this.#t?.disconnect(),this.#c.disconnect(),this.#a?.(),this.#a=null,this.#n=null,this.#e.disconnect(),this.#r.disconnect(),this.#ht(),R(this.#l.sourceNode).detach(this.#f),this.#f?.disconnect(),this.#$?.(),this.#$=null,this.#H.disconnect(),this.#_.disconnect(),this.#d.removeEventListener("scroll",this.#ot),this.#d.removeEventListener("keydown",this.#st),this.#z.disconnect(),this.#M!==null&&this.ownerDocument.defaultView.cancelAnimationFrame(this.#M),this.#M=null}#R(){!this.isConnected||this.#M!==null||(this.#M=this.ownerDocument.defaultView.requestAnimationFrame(()=>{this.#M=null;let e=`${this.#d.offsetWidth-this.#d.clientWidth}px`;this.control.style.getPropertyValue("--grid-scrollbar-width")!==e&&this.control.style.setProperty("--grid-scrollbar-width",e),this.#nt();for(let r of this.#u.querySelectorAll("th[scope=col]"))r.querySelector(".column-resize").setAttribute("aria-valuenow",String(Math.round(r.getBoundingClientRect().width)));for(let r of this.#h.values()){let i=r.querySelector(".row-height-handle");i&&i.setAttribute("aria-valuenow",String(Math.round(r.getBoundingClientRect().height)))}if(this.#S.scrollLeft=this.#d.scrollLeft,this.#o.viewport.scrollLeft=this.#d.scrollLeft,!!this.#g)try{this.#at(),this.#s.position()}catch(r){this.#l.reportError(r,"Grid viewport")}}))}#nt(){if(!this.#L)return;let t=this.#u.querySelector(".row-number-measure");t.textContent=String(Math.max(1,this.#m.count));let e=Math.ceil(t.getBoundingClientRect().width);this.control.style.setProperty("--grid-row-header-min-width",`${e}px`),this.#m.headerWidth===null?this.control.style.removeProperty("--grid-row-header-width"):this.control.style.setProperty("--grid-row-header-width",`${this.#m.headerWidth}px`),this.#u.querySelector(".row-heading .column-resize").setAttribute("aria-valuemin",String(Math.max(40,e)))}#at(){let t=this.#d,e=this.#m.indexAt(t.scrollTop),r=t.scrollTop-this.#m.offset(e),i=!1,s=this.#h.values().next().value;if(s){let o=this.ownerDocument.defaultView.getComputedStyle(s.querySelector("td")),n=JSON.stringify([this.#A.getBoundingClientRect().width,o.font,o.lineHeight,o.padding,o.getPropertyValue("--gramlot-grid-row-height")]);n!==this.#it&&(this.#m.resetMeasurements(),this.#it=n,i=!0)}for(let[o,n]of this.#h)i=this.#m.measure(o,n.getBoundingClientRect().height)||i;if(i&&this.#O.length){let o=this.#m.offset(e)+r;this.#lt(),this.#C(this.#B?Math.max(0,this.#m.totalHeight-t.clientHeight):o)}this.#_.resizing||this.#G()}#lt(){let t=Math.max(0,this.#U),e=Math.max(t,this.#Z);this.#V.style.height=`${this.#m.offset(t)}px`,this.#P.style.height=`${Math.max(0,this.#m.totalHeight-this.#m.offset(e))}px`}#C(t){this.#d.scrollTop!==t&&(this.#d.scrollTop=t,this.#X=this.#d.scrollTop)}#G(t=!1){let e=this.#d,r=Math.max(0,this.#m.totalHeight-e.clientHeight),i=this.#B?r:Math.min(e.scrollTop,r),{start:s,end:o}=this.#m.window(i,e.clientHeight),n=this.#N();if(n){let l=n.start+this.#O.length;if(s<n.start||o>l){let c=Math.max(200,o-s),h=Math.max(0,Math.min(Math.max(0,n.total-c),s)),m=JSON.stringify([n.revision,h,c]);m!==this.#y&&(this.#y=m,this.#l.writeParameter("viewport",{start:h,count:c}))}else this.#y=null;s=Math.max(s,n.start),o=Math.max(s,Math.min(o,l))}n||(this.#y=null);let a=this.parameters.loading||this.#y!==null;if(this.#T.hidden=!a,a?this.control.setAttribute("aria-busy","true"):this.control.removeAttribute("aria-busy"),t||s!==this.#U||o!==this.#Z){let l=new A(this.#r,this.#l.format).read(this.#g.columns,this.#Y(this.#O.slice(s-(n?.start??0),o-(n?.start??0))));this.#Tt(l,this.#g.columns,s),this.#U=s,this.#Z=o,this.#R()}this.#lt(),this.#C(i)}#N(){let t=this.#l.getStaticData(this.#l.attrDatapath("windowInfo"));if(t===null)return null;if(!(t instanceof J))throw new TypeError("Grid windowInfo requires a Bag");return Object.fromEntries(["start","total","revision","sortedBy"].map(e=>[e,t.getItem(e)]))}#pt(t,e,r){let i=this.#f.getRows().map(n=>n.label),s=this.#g.columns.filter(n=>n.edit),o=i.indexOf(t)*s.length+s.findIndex(n=>n.field===e)+(typeof r=="object"?r.row*s.length:r);o<0||o>=i.length*s.length||this.#ct(Math.floor(o/s.length),s[o%s.length])}#ct(t,e){let r=this.#f.getRows()[t].label;this.#B=!1;let i=this.#m.offset(t),s=this.#m.offset(t+1);i<this.#d.scrollTop?this.#C(i):s>this.#d.scrollTop+this.#d.clientHeight&&this.#C(Math.max(0,s-this.#d.clientHeight)),this.#G(!0),this.#at();let o=this.#h.get(r).querySelector(`td[data-field="${e.field}"]`),n=o.getBoundingClientRect(),a=this.#d.getBoundingClientRect();n.top<a.top?this.#C(Math.floor(this.#d.scrollTop+n.top-a.top)):n.bottom>a.bottom&&this.#C(Math.ceil(this.#d.scrollTop+Math.min(n.top-a.top,n.bottom-a.bottom))),n.left<a.left?this.#d.scrollLeft+=n.left-a.left:n.right>a.right&&(this.#d.scrollLeft+=Math.min(n.left-a.left,n.right-a.right)),this.#S.scrollLeft=this.#d.scrollLeft,this.#s.open(r,e,o)}#mt(t){let e=this.#l.sourceNode.rowField(t);if(e===null)return!1;let r=this.#g.columns.find(s=>s.field===e.field&&s.edit),i=this.#f.getRows().findIndex(s=>s.label===e.row);return!r||i<0?!1:(this.#ct(i,r),!0)}get formulaErrors(){return this.#r.errors}get totalErrors(){return this.#o.errors}setSourceContext(t){this.#l=t,this.#r=new ct(t.sourceNode),this.#o=new I(t.sourceNode,t.format,this.#d.parentElement),this.#i=new q(t,{view:()=>this.#f,store:()=>this.#K(),mode:()=>this.#Q(),rowData:r=>this.#xt(r)}),this.#c=new j(t,{columns:()=>this.#g.columns,rows:()=>this.#f.getRows(),selected:()=>this.#i.nodes,selectionMode:()=>this.#Q(),reader:()=>this.#r,store:()=>({mode:this.parameters.rowMode}),parameters:()=>this.parameters,document:this.ownerDocument}),this.isConnected&&this.#c.connect(),this.#e.setSourceContext(t),this.#t=new $(t.sourceNode,this.#b,()=>this.#g?.columns??[],r=>{let i=this.#W(r);return i===null?void 0:this.#Y([i])[0]},(r,i)=>this.#f.value(r,i),()=>this.parameters.setFilter,()=>this.#f),this.isConnected&&this.#t.connect(),this.#s=new F(this,t,(r,i)=>this.#h.get(r)?.querySelector(`td[data-field="${i}"]`),()=>({labels:()=>this.#K().getRows().map(r=>r.label),window:this.#N()}),()=>this.#h,(r,i,s)=>this.#pt(r,i,s),r=>this.#mt(r));let e=t.sourceNode;this.#m=e._internal.gridRowLayout??=new O}#ft(){let t=this.#l.getStaticData(this.#l.attrDatapath("storepath"));if(!(t instanceof J))throw new TypeError("grid storepath must resolve to a Bag");return t}#Y(t){let e=this.#ft();return t.flatMap(r=>e.getNode(r)??[])}#W(t){return t&&this.#h.get(t.dataset.row)===t?t.dataset.row:null}projectAttributes(t,e,r=null){let i=super.projectAttributes(t,e),s=this.#l.attrDatapath("structpath");if((r===null||r===s||r.startsWith(`${s}.`)||s.startsWith(`${r}.`))&&(this.#E=!0),this.#N()&&(this.parameters.columnFilters||this.#f?.filterContributions.some(([l])=>l.startsWith("column:"))))throw new TypeError("grid columnFilters requires a complete resident store");if(this.#N()&&this.parameters.setFilter!=="")throw new TypeError("grid setFilter requires a complete resident store");let o=this.#l.collectionView(this.#l.attrDatapath("storepath"),this.parameters.rowMode);this.#f!==o&&(this.#ht(),this.#$?.(),this.#$=null,this.#f=o,this.#dt()),!this.#N()&&this.#et!==this.parameters.sortedBy&&(this.#f.sort(this.parameters.sortedBy),this.#et=this.parameters.sortedBy);let n=this.parameters.filter,a=JSON.stringify(n);return!this.#N()&&this.#rt!==a&&(this.#f.applyFilter(n===null?null:{locale:this.#l.locale,timeZone:this.#l.timeZone,...n},"base"),this.#rt=a),this.#J({full:!0,rows:[]}),i}#dt(){this.isConnected&&this.#f&&!this.#$&&(this.#f.connect(),this.#$=this.#f.subscribe(t=>this.#J(t)))}#ht(){this.#I!==null&&this.ownerDocument.defaultView.clearTimeout(this.#I),this.#I=null,this.#j=!1,this.#q.clear()}#J({full:t,rows:e}){if(this.#j||=t,this.#j)this.#q.clear();else for(let r of e)this.#q.add(r.label);!this.isConnected||this.#I!==null||(this.#I=this.ownerDocument.defaultView.setTimeout(()=>{let r=this.#j,i=[...this.#q];this.#I=null,this.#j=!1,this.#q.clear();try{r?this.#bt():this.#gt(this.#r.viewFields.size?[...this.#h.keys()]:i)}catch(s){this.#j=!0,this.#l.reportError(s,"Grid refresh")}},0))}#gt(t){for(let r of t)this.#m.forget(r);this.#o.update(this.#r,this.#K().getRows());let e=new A(this.#r,this.#l.format).read(this.#g.columns,this.#Y(t.filter(r=>this.#h.has(r))));this.#_.cancel();for(let{node:r,cells:i}of e)this.#ut(this.#h.get(r.label),i,r);this.#R()}#bt(){let t=this.#l.attrDatapath("structpath"),e=this.#E?new lt(this.#l.getStaticData(t),{data:this.#l.sourceNode.data,path:t}):this.#g,r=this.#K();this.#r.configure(e,this.#f,r),this.#kt(),this.#c.requireEditableTools(e.columns),this.#i.prune();let i=this.#E;this.#s.configure(e.columns),this.#g=e,this.#t.configure();let s=this.#f.getRows().map(l=>l.label);this.#_.cancel(),this.#_.cancelDrag(),this.#m.retain(r.getRows().map(l=>l.label)),this.#E&&this.#m.resetMeasurements();let o=this.#N();this.#m.setWindow(o),this.#m.setRows(s),this.#O=s,o&&this.#x!==o.revision&&(this.#B=!1,this.#C(0),this.#y=null),this.#x=o?.revision,this.#E=!1,R(this.#l.sourceNode).update(this.#f,e.columns.filter(l=>!l.check&&!this.#r.viewFields.has(l.field)));let n=this.parameters.rowHeaders||this.parameters.rowResize,a=JSON.stringify([e.groups,n,this.parameters.columnFilters,this.parameters.footer]);this.#L=n,a!==this.#v&&(this.#o.configure(this.parameters.footer,e.columns,n),this.#St(e),this.#v=a),this.#o.update(this.#r,r.getRows()),this.#wt(i),this.#e.update(this.#f,e.columns,this.parameters.columnFilters,this.#l.format),this.#At(),this.#G(!0),this.#tt(),this.control.setAttribute("aria-colcount",String(e.columns.length+Number(this.#L))),this.control.setAttribute("aria-rowcount",String(this.#F+Math.max(this.#m.count,1))),this.#R()}#wt(t){let e=this.#l.sourceNode.formState;if(e===this.#n){t&&e?.updateChanges();return}this.#a?.(),this.#n=e,this.#a=e===null?null:e.registerDerived(r=>this.#yt(r))}#yt(t){let e=this.#n.path,r=s=>s===e?"":s.startsWith(e+".")?s.slice(e.length+1):null;if(this.#o.totalPaths().some(s=>r(s)===t)||this.#i.paths().some(s=>{let o=r(s);return o!==null&&(t===o||t.startsWith(o+".")||t.startsWith(o+"?"))}))return!0;let i=this.#l.sourceNode.rowField(t===""?e:`${e}.${t}`);return i!==null&&this.#r.dataFields.has(i.field)}#Q(){let t=this.parameters.selectionMode;if(!bt.includes(t))throw new TypeError("grid selectionMode requires none, single or multi");return t}#xt(t){return this.parameters.rowMode==="attributes"?{...t.getAttr()}:Object.fromEntries(t.staticValue.getNodes().filter(e=>!(e.staticValue instanceof J)).map(e=>[e.label,e.staticValue]))}#tt(){let t=this.#Q();t==="multi"?this.control.setAttribute("aria-multiselectable","true"):this.control.removeAttribute("aria-multiselectable");for(let[e,r]of this.#h){let i=this.#i.isSelected(e);t==="none"?r.removeAttribute("aria-selected"):r.setAttribute("aria-selected",String(i)),r.setAttribute("part",i?"row selected-row":"row")}}#vt(t,e){let r=this.#f.getRows().findIndex(o=>o.label===t);this.#B=!1;let i=this.#m.offset(r),s=this.#m.offset(r+1);i<this.#d.scrollTop?this.#C(i):s>this.#d.scrollTop+this.#d.clientHeight&&this.#C(Math.max(0,s-this.#d.clientHeight)),this.#G(!0),e&&this.#h.get(t)?.querySelector(`td[data-field="${e}"]`)?.focus({preventScroll:!0})}#K(){return this.#l.sourceNode.rootBuilder.binding.collectionStore(this.#l.attrDatapath("storepath"),this.parameters.rowMode)}#kt(){let t=this.#f,e=this.#r.viewFields,r=[...t.criteria.map(({field:o})=>["sort by",o]),...t.filterContributions.flatMap(([o,{definition:n}])=>o.startsWith("column:")?[["filter",o.slice(7)]]:o==="sets"?[]:n.columns.map(a=>["search",a]))],[i,s]=r.find(([,o])=>e.has(o))??[];if(s!==void 0)throw new TypeError(`grid cannot ${i} the view value '${s}'`)}#Et(t,e){if(!this.#g.columns.find(r=>r.field===t)?.check)try{if(this.#r.viewFields.has(t))throw new TypeError(`grid cannot sort by the view value '${t}'`);let r=this.#N()?W(this.#N().sortedBy):this.#f.criteria,i=r.find(a=>a.field===t),s=i?.direction==="a"?"d":"a",o=e?r.filter(a=>a.field!==t):[];e&&i?o.splice(r.indexOf(i),0,{field:t,direction:s}):o.push({field:t,direction:s});let n=o.map(a=>`${a.field}:${a.direction}`).join(",");this.#N()?this.#l.writeParameter("sortRequest",n):this.#f.sort(n)}catch(r){this.#l.reportError(r,"Grid sort")}}#At(){let t=this.#N()?W(this.#N().sortedBy):this.#f.criteria;this.#nt();for(let e of this.#u.querySelectorAll("th[scope=col]")){let r=t.findIndex(i=>i.field===e.dataset.field);if(e.removeAttribute("aria-sort"),r<0)delete e.dataset.sortDirection,delete e.dataset.sortPriority,e.removeAttribute("aria-label");else{let i=t[r].direction==="a"?"ascending":"descending";e.dataset.sortDirection=i,e.dataset.sortPriority=String(r+1),r===0&&e.setAttribute("aria-sort",i),e.setAttribute("aria-label",`${e.textContent}, sort ${r+1}, ${i}`)}}}#St(t){this.#H.cancel();let e=this.shadowRoot.activeElement,r=e?.closest("th[data-field]")?.dataset.field,i=e?.classList.contains("column-resize"),s=this.ownerDocument,o=t.groups.some(u=>u.name!==null);this.#F=o?2:1;let n=s.createElement("tr"),a=s.createElement("tr");for(let[u,f]of[n,a].entries())f.setAttribute("role","row"),f.setAttribute("aria-rowindex",String(u+1));let l=(u,f,p,b,g,D="start")=>{let w=s.createElement("th");if(w.textContent=u,w.colSpan=f,w.rowSpan=p,w.scope=b,w.setAttribute("role","columnheader"),w.setAttribute("part",b==="colgroup"?"group-header":"column-header"),w.setAttribute("aria-colindex",String(g+1+Number(this.#L))),w.setAttribute("aria-colspan",String(f)),w.setAttribute("aria-rowspan",String(p)),w.style.textAlign=D,b==="col"){let E=s.createElement("span");E.className="column-caption",E.textContent=u,w.replaceChildren(E);let v=t.columns[g];w.dataset.field=v.field,w.draggable=!0,w.tabIndex=0,w.setAttribute("aria-label",v.title??v.name),w.title=v.check?(v.title??v.name)+" \xB7 Drag to reorder":"Click: ascending / descending \xB7 Shift-click: add or reverse this column without changing the others \xB7 Numbers show sort priority \xB7 Drag to reorder";let L=s.createElementNS(x,"svg");L.classList.add("sort-indicator"),L.setAttribute("viewBox","0 0 16 16"),L.setAttribute("aria-hidden","true");let tt=s.createElementNS(x,"path");tt.setAttribute("d","M4 10L8 6L12 10"),L.append(tt),w.append(L),this.parameters.columnFilters&&!v.check&&!this.#r.viewFields.has(v.field)&&w.append(this.#e.button(v));let k=s.createElement("span");k.className="column-resize",k.tabIndex=0,k.setAttribute("role","separator"),k.setAttribute("aria-orientation","vertical"),k.setAttribute("aria-valuemin","40"),k.setAttribute("aria-label",`Resize ${v.name}`),k.title="Drag to resize \xB7 Arrow keys adjust width",w.append(k)}return w};if(this.#L){let u=s.createElement("th");u.textContent="#",u.scope="col",u.className="row-heading",u.rowSpan=this.#F,u.setAttribute("role","columnheader"),u.setAttribute("aria-colindex","1"),u.setAttribute("aria-rowspan",String(this.#F)),u.setAttribute("part","row-header");let f=s.createElement("span");f.className="row-number-measure",f.setAttribute("aria-hidden","true");let p=s.createElement("span");p.className="column-resize",p.tabIndex=0,p.setAttribute("role","separator"),p.setAttribute("aria-orientation","vertical"),p.setAttribute("aria-label","Resize row numbers"),p.title="Drag to resize \xB7 Arrow keys adjust width",u.append(f,p),n.append(u)}let c=0;for(let u of t.groups)if(o&&u.name!==null){let f=l(u.name,u.columns.length,1,"colgroup",c,"center");f.style.background=u.background??"",f.style.color=u.color??"",n.append(f);for(let p of u.columns)a.append(l(p.name,1,1,"col",c++,p.align))}else for(let f of u.columns){if(o){let p=s.createElement("td");p.className="group-spacer",p.setAttribute("aria-hidden","true"),n.append(p)}(o?a:n).append(l(f.name,1,1,"col",c++,f.align))}this.#u.replaceChildren(n,...o?[a]:[]),r&&this.#u.querySelector(`th[data-field="${r}"]${i?" .column-resize":""}`)?.focus({preventScroll:!0});let h=t.columns.map(u=>u.width??"var(--gramlot-grid-column-width, 10rem)");this.#L&&h.unshift("max(var(--grid-row-header-min-width, 0px), var(--grid-row-header-width, var(--gramlot-grid-row-header-width, 44px)))"),this.control.style.setProperty("--grid-columns-width",`calc(${h.join(" + ")})`);let m=this.parameters.footer===!1?[]:[this.#o.table];for(let u of[this.#D,this.#A,...m]){for(let f of u.querySelectorAll(":scope > colgroup"))f.remove();if(u.prepend(...t.groups.map(f=>{let p=s.createElement("colgroup");for(let b of f.columns){let g=s.createElement("col");g.style.width=b.width??"var(--gramlot-grid-column-width, 10rem)",p.append(g)}return p})),this.#L){let f=s.createElement("colgroup"),p=s.createElement("col");p.style.width="max(var(--grid-row-header-min-width, 0px), var(--grid-row-header-width, var(--gramlot-grid-row-header-width, 44px)))",f.append(p),u.prepend(f)}}}#Tt(t,e,r){this.#_.cancel();let i=new Set,s=null;this.#b.querySelector(".empty")?.parentElement.remove();for(let{node:o,cells:n}of t){let a=o.label,l=this.#h.get(a);l||(l=this.ownerDocument.createElement("tr"),l.setAttribute("part","row"),l.setAttribute("role","row"),l.dataset.row=a,this.#h.set(a,l)),l.classList.toggle("alternate",(r+i.size)%2===1),l.setAttribute("part",this.#i.isSelected(a)?"row selected-row":"row"),this.#i.mode==="none"?l.removeAttribute("aria-selected"):l.setAttribute("aria-selected",String(this.#i.isSelected(a)));let c=this.#f.isFiltered();l.draggable=this.parameters.selfDragRows;let h=l.querySelector("th[scope=row]");if(this.#L){if(!h){h=this.ownerDocument.createElement("th"),h.scope="row",h.className="row-heading",h.setAttribute("role","rowheader"),h.setAttribute("part","row-header"),h.setAttribute("aria-colindex","1");let b=this.ownerDocument.createElement("span");b.className="row-number",h.append(b),l.prepend(h)}h.querySelector(".row-number").textContent=String(r+i.size+1),h.classList.toggle("filtered-numbering",c);let p=h.querySelector(".row-height-handle");this.parameters.rowResize?(p||(p=this.ownerDocument.createElement("span"),p.className="row-height-handle",p.tabIndex=0,p.setAttribute("role","separator"),p.setAttribute("aria-orientation","horizontal"),p.title="Drag to resize row \xB7 Double-click or Home resets \xB7 Arrow keys adjust height",h.append(p)),p.setAttribute("aria-label",`Resize row ${r+i.size+1}`)):p?.remove()}else h?.remove();let m=Number(this.#L),u=new Map([...l.querySelectorAll("td[data-field]")].map(p=>[p.dataset.field,p]));for(let[p,b]of e.entries()){let g=u.get(b.field);if(!g){g=this.ownerDocument.createElement("td"),g.setAttribute("part","cell"),g.dataset.field=b.field,g.setAttribute("role","cell");let E=this.ownerDocument.createElement("div");E.className="cell-content",E.setAttribute("part","cell-content"),g.append(E)}b.edit?g.tabIndex=0:g.removeAttribute("tabindex"),g.classList.toggle("filtered-numbering",c&&this.#r.viewFields.has(b.field));let D=g.firstElementChild,w=b.max_height!=null;w?g.style.setProperty("--grid-cell-max-height",b.max_height):g.style.removeProperty("--grid-cell-max-height"),D.classList.toggle("cell-scroll",w),w?D.tabIndex=0:D.removeAttribute("tabindex"),g.style.textAlign=b.align,g.style.whiteSpace=b.white_space??"",g.style.overflowWrap=b.white_space==="pre-wrap"||b.white_space==="normal"?"anywhere":"",g.setAttribute("aria-colindex",String(p+1+m)),g.classList.toggle("numeric",["L","R","N"].includes(b.dtype)),l.cells[p+m]!==g&&l.insertBefore(g,l.cells[p+m]??null),u.delete(b.field)}for(let p of u.values())p.remove();l.setAttribute("aria-rowindex",String(this.#F+r+i.size+1)),this.#ut(l,n,o),this.#s.decorate(l,a);let f=s?s.nextSibling:this.#b.firstChild;f!==l&&this.#b.insertBefore(l,f),this.#_.project(l,a),s=l,i.add(a)}for(let[o,n]of this.#h)i.has(o)||(n.remove(),this.#h.delete(o));if(!t.length&&this.#m.count===0&&!this.parameters.loading){let o=this.ownerDocument.createElement("tr"),n=this.ownerDocument.createElement("td");o.setAttribute("role","row"),o.setAttribute("aria-rowindex",String(this.#F+1)),n.setAttribute("role","cell"),n.setAttribute("aria-colspan",String(e.length+Number(this.#L))),n.className="empty",n.colSpan=e.length+Number(this.#L),n.textContent="No rows",o.append(n),this.#b.append(o)}}#ut(t,e,r){let i=Number(this.#L);e.forEach((s,o)=>{let n=t.cells[o+i].firstElementChild,a=this.#g.columns[o];if(n.parentElement.classList.toggle("check-cell",!!a.check),a.check){this.#t.project(n,r,a);return}if(a.edit?.tag==="colorpicker"){let c=n.querySelector(".cell-color-swatch");c||(c=this.ownerDocument.createElement("span"),c.className="cell-color-swatch",c.setAttribute("role","img"),n.replaceChildren(c)),c.hidden=s==="",c.style.backgroundColor=s,c.title=s,c.setAttribute("aria-label",s)}else(n.firstElementChild||n.textContent!==s)&&(n.textContent=s)})}}}),Q=class extends y.ComponentCollection{toDocument(){let t=super.toDocument(),e=t.elements.grid.attributes.parameters;for(let r of["storepath","rowMode"]){let i=e.find(s=>s.name===r);i.has_default=!1,delete i.default,r==="rowMode"&&(i.annotation={kind:"annotated",base:{kind:"dtype",dtype:"T"},metadata:[{kind:"regex",pattern:"^(values|attributes)$",flags:0}]})}return Object.assign(t.elements,structuredClone(At.elements)),t.elements.grid._meta.parameterPattern="^selected_[A-Za-z_][A-Za-z0-9_]*$",t}},Pr=new Q({name:"grid",components:[se,Et],dependencies:[ie],registerCommands:mt,assets:{writeExcelFileLicense:S["assets/files/8cf9b31947daf7adb4a7a00a037459e58241af050cd0a603bfcf1756e533f75e-write-excel-file.txt"],fflateLicense:S["assets/files/0a1df3a083d0c010560aa342e87959c8c1070e6fd54545741f083f22d0c8b551-fflate.txt"]}});export{se as Grid,Pr as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export {default} from "./collection.js";
|
|
2
2
|
export * from "./collection.js";
|
|
3
|
-
export const buildId = "sha256:
|
|
3
|
+
export const buildId = "sha256:92b20ec86b7a4dfe2e8430f4cafcbb06a15d95798ca180c082275302c4bb6663";
|
|
@@ -9,6 +9,6 @@ mygramlot = GramlotCollection(
|
|
|
9
9
|
module="assets/index.js",
|
|
10
10
|
css=(),
|
|
11
11
|
dependencies=(_dependency_0,),
|
|
12
|
-
build_id="sha256:
|
|
12
|
+
build_id="sha256:ce7739715731d46ee8154e34725c8795cb477021fcb2ca61f70ad7420c00d6e4",
|
|
13
13
|
files=("assets/collection.js", "assets/index.js", "commands.json", "grammar.json",),
|
|
14
14
|
)
|