@omegagrid/bundle 0.6.133 → 0.6.135
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/omegagrid.js +25 -6
- package/package.json +18 -18
package/omegagrid.js
CHANGED
|
@@ -433,6 +433,11 @@
|
|
|
433
433
|
line-height: 1;
|
|
434
434
|
border-radius: var(--og-base-radius);
|
|
435
435
|
}
|
|
436
|
+
|
|
437
|
+
:host(.radiusfix) {
|
|
438
|
+
border-top-left-radius: 0;
|
|
439
|
+
border-top-right-radius: 0;
|
|
440
|
+
}
|
|
436
441
|
`,Wd=Bd([Cs("og-dropdown-container")],Wd);let Ud=class extends xs{constructor(){super(...arguments),this.alignment="right",this.positionOffset=0,this.dropdownParent=document.body,this.color=ua.Accent,this.noCaret=!1,this.dropdownRef=ld(),this._onDocumentMouseDown=t=>{for(const e of t.composedPath())if(e==this.dropdown||e==this)return;this.close()},this._onMousedown=async()=>this.toggle(),this.renderDropdown=()=>es`
|
|
437
442
|
<og-dropdown-container ${dd(this.dropdownRef)}
|
|
438
443
|
style="display: none">
|
|
@@ -452,7 +457,7 @@
|
|
|
452
457
|
</og-button>
|
|
453
458
|
|
|
454
459
|
${this.renderDropdown()}
|
|
455
|
-
`}get dropdown(){return this.dropdownRef?.value}get isOpen(){return this.dropdown&&!Ct(this.dropdown)}connectedCallback(){super.connectedCallback(),this.tabIndex=0}async open(){this.dispatchEvent(new Fd("beforeOpen")),await this.updateComplete,this.dropdown.parentElement!==this.dropdownParent&&this.dropdownParent.appendChild(this.dropdown),this.children.length>0&&!this._contentElm&&(this._contentElm=[...this.children].find((t=>"content"==t.slot)),this._contentElm&&(this._contentElm.slot="inner-content",this.dropdown.appendChild(this._contentElm))),this.width>0&&Dt(this.dropdown,{w:this.width}),xt(this.dropdown),this.requestUpdate(),await this.dropdown.updateComplete,this.dispatchEvent(new Fd("open")),this.layout(),document.body.addEventListener("mousedown",this._onDocumentMouseDown)}close(){this.dropdown&&kt(this.dropdown),document.body.removeEventListener("mousedown",this._onDocumentMouseDown)}toggle(){this.isOpen?this.close():this.open()}disconnectedCallback(){this.dropdown?.remove(),super.disconnectedCallback()}get hasLabelSlot(){return null!=this.querySelector('[slot="label"]')}get hasLabel(){return""!==this.label&&null!=this.label}layout(){if(
|
|
460
|
+
`}get dropdown(){return this.dropdownRef?.value}get isOpen(){return this.dropdown&&!Ct(this.dropdown)}connectedCallback(){super.connectedCallback(),this.tabIndex=0}async open(){this.dispatchEvent(new Fd("beforeOpen")),await this.updateComplete,this.dropdown.parentElement!==this.dropdownParent&&this.dropdownParent.appendChild(this.dropdown),this.children.length>0&&!this._contentElm&&(this._contentElm=[...this.children].find((t=>"content"==t.slot)),this._contentElm&&(this._contentElm.slot="inner-content",this.dropdown.appendChild(this._contentElm))),this.width>0&&Dt(this.dropdown,{w:this.width}),xt(this.dropdown),this.requestUpdate(),await this.dropdown.updateComplete,this.dispatchEvent(new Fd("open")),this.layout(),document.body.addEventListener("mousedown",this._onDocumentMouseDown)}close(){this.dropdown&&kt(this.dropdown),this.layout(),document.body.removeEventListener("mousedown",this._onDocumentMouseDown)}toggle(){this.isOpen?this.close():this.open()}disconnectedCallback(){this.dropdown?.remove(),super.disconnectedCallback()}get hasLabelSlot(){return null!=this.querySelector('[slot="label"]')}get hasLabel(){return""!==this.label&&null!=this.label}layout(){if(this.classList.toggle("radiusfix",this.isOpen),!this.dropdown)return;if(this.dropdown.classList.toggle("radiusfix",this.isOpen),!this.isOpen)return;const t=Ht(this,this.dropdownParent);Dt(this.dropdown,{w:this.offsetWidth},!0),jt(this.dropdown,{t:t.top+this.offsetHeight-1,l:this.positionOffset+("left"==this.alignment?t.left:t.left+this.offsetWidth-this.dropdown.offsetWidth)}),Ft(this.dropdown)}};Ud.styles=[fr`
|
|
456
461
|
* {
|
|
457
462
|
box-sizing: border-box;
|
|
458
463
|
}
|
|
@@ -469,6 +474,11 @@
|
|
|
469
474
|
border-radius: var(--og-base-radius);
|
|
470
475
|
}
|
|
471
476
|
|
|
477
|
+
:host(.radiusfix) {
|
|
478
|
+
border-bottom-left-radius: 0;
|
|
479
|
+
border-bottom-right-radius: 0;
|
|
480
|
+
}
|
|
481
|
+
|
|
472
482
|
div.text {
|
|
473
483
|
flex: 1;
|
|
474
484
|
color: var(--og-text-color-2);
|
|
@@ -2235,6 +2245,15 @@
|
|
|
2235
2245
|
line-height: 18px;
|
|
2236
2246
|
}
|
|
2237
2247
|
|
|
2248
|
+
.toolbar-search {
|
|
2249
|
+
margin: 0;
|
|
2250
|
+
border-bottom: 1px solid var(--og-accent-color);
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
.toolbar-search og-tree-search {
|
|
2254
|
+
min-height: 20px;
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2238
2257
|
.main {
|
|
2239
2258
|
flex: 1;
|
|
2240
2259
|
}
|
|
@@ -2372,7 +2391,7 @@
|
|
|
2372
2391
|
<og-loader></og-loader>
|
|
2373
2392
|
</div>
|
|
2374
2393
|
`:null;return nm([this.options.search?es`
|
|
2375
|
-
<div class="toolbar">
|
|
2394
|
+
<div class="toolbar toolbar-search">
|
|
2376
2395
|
<og-tree-search
|
|
2377
2396
|
.tree="${this}"
|
|
2378
2397
|
@search="${this._onSearch}">
|
|
@@ -2434,7 +2453,7 @@
|
|
|
2434
2453
|
#content {
|
|
2435
2454
|
display: flex;
|
|
2436
2455
|
}
|
|
2437
|
-
`;var hf=function(t,e,i,o){var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};let df=class extends Ud{get hasCrossButton(){return this.cross&&(this.selection.count>0&&this.options.allowEmpty||""!==this.searchTerm)}get tree(){return this._tree||(this._tree=new af,this._tree.disableAutoload=!0,this._tree.model=this.adapter?null:this.model,this._tree.adapter=this.adapter,this._tree.selection=this.selection,this._tree.options=this.options,this._tree.maxHeight=this.maxHeight,this._tree.addEventListener("change",(t=>this._onChange(t))),this._tree.addEventListener("render",this._onTreeRender),this._tree.slot="inner-content"),this._tree}_onChange(t){this._autoHighlight=!1,this.selectedItems=null,this.selectedItems=t.component.selection.items,this.value=t.component.selection.serialize(),this.options.autoClose&&this.close(),this.dispatchEvent(new nf(t.type,{component:t.component,node:t.node}))}async open(){this.tree.parentElement!=this.dropdown&&this.dropdown.appendChild(this._tree),await super.open()}async willUpdate(t){this.buttonInput&&(this.options.search=!1),t.has("value")&&(this.selection.setItems(this.value),this.selectedItems=null,this.selectedItems=this.selection.items,this._autoHighlight?this.tree.highlightFirstSelectedNode():this._autoHighlight=!0,this.tree.renderItems(!0)),this._tree&&(t.has("adapter")&&(this._tree.adapter=this.adapter),t.has("model")&&(this._tree.model=this.model)),t.has("adapter")&&this.adapter&&(this._firstOpen=!0,this.options=Xm(await this.adapter.getOptions(),this.options)),this._renderDropdown=!0}async filter(t){this.input&&(this.searchTerm=t),await this.updateComplete,this.input&&(this.input.value=t),await this.tree.updateComplete,this.tree.filter(t)}async clearFilter(){this.input&&(this.searchTerm=""),await this.updateComplete,this.input&&(this.input.value=""),await this.tree.updateComplete,this.tree.clearFilter()}focus(){this.buttonInput?this.input?.focus():super.focus()}constructor(){super(),this.options=Xm(),this.selection=new Ym(this.options),this.maxHeight=300,this.maxWidth=400,this.cross=!1,this.buttonInput=!1,this.preventInputEnter=!1,this.dynamicWidth=!1,this.selectedItems=new Map,this.searchTerm="",this._renderDropdown=!0,this._firstOpen=!0,this._autoHighlight=!0,this.originalWidth=0,this._debounceWidthUpdate=Y((()=>{this.dropdown&&this.dropdown.isConnected&&(Ft(this.dropdown),this.dynamicWidth&&this.adjustWidth())})),this._onTreeRender=()=>{this._debounceWidthUpdate()},this.tooltip=yt("og-tooltip"),this._onMouseOver=()=>{this.contentDiv&&this.contentDiv.scrollWidth>this.contentDiv.clientWidth&&(this.tooltip.parentElement||(document.body.appendChild(this.tooltip),this.tooltip.style.maxWidth="200px"),this.tooltip.content=this.getButtonContentHtml(),this.tooltip.attachTo(this.button,"bottom"))},this._onMouseOut=()=>{this.tooltip.deatach()},this._debounceFilter=Y((t=>{this.tree.filter(t),this.dispatchEvent(new nf("tree.filter"))}),300),this._onInput=async t=>{this.isOpen||await this.open();const e=t.target.value;this._debounceFilter(e),this.searchTerm=e},this._onInputKeyDown=t=>{switch(t.key){case"ArrowDown":t.preventDefault(),this.tree.list.moveDown();break;case"ArrowUp":t.preventDefault(),this.tree.list.moveUp();break;case"Enter":if(t.preventDefault(),this.preventInputEnter)return;this.tree.list.selectedIndex>-1&&(this.tree.list.select(this.tree.list.selectedIndex,_u.Enter),setTimeout((()=>this.input.focus()),100))}},this._onInputBlur=()=>this.input.value=this.getSelectionText(),this.render=()=>es`
|
|
2456
|
+
`;var hf=function(t,e,i,o){var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};let df=class extends Ud{get hasCrossButton(){return this.cross&&(this.selection.count>0&&this.options.allowEmpty||""!==this.searchTerm)}get tree(){return this._tree||(this._tree=new af,this._tree.disableAutoload=!0,this._tree.model=this.adapter?null:this.model,this._tree.adapter=this.adapter,this._tree.selection=this.selection,this._tree.options=this.options,this._tree.maxHeight=this.maxHeight,this._tree.addEventListener("change",(t=>this._onChange(t))),this._tree.addEventListener("render",this._onTreeRender),this._tree.slot="inner-content"),this._tree}_onChange(t){this._autoHighlight=!1,this.selectedItems=null,this.selectedItems=t.component.selection.items,this.value=t.component.selection.serialize(),this.options.autoClose&&this.close(),this.dispatchEvent(new nf(t.type,{component:t.component,node:t.node}))}async open(){this.tree.parentElement!=this.dropdown&&this.dropdown.appendChild(this._tree),await super.open()}async willUpdate(t){this.buttonInput&&(this.options.search=!1),t.has("value")&&(this.selection.setItems(this.value),this.selectedItems=null,this.selectedItems=this.selection.items,this.isOpen&&this.tree&&(this._autoHighlight?this.tree.highlightFirstSelectedNode():this._autoHighlight=!0,this.tree.renderItems(!0))),this._tree&&(t.has("adapter")&&(this._tree.adapter=this.adapter),t.has("model")&&(this._tree.model=this.model)),t.has("adapter")&&this.adapter&&(this._firstOpen=!0,this.options=Xm(await this.adapter.getOptions(),this.options)),this._renderDropdown=!0}async filter(t){this.input&&(this.searchTerm=t),await this.updateComplete,this.input&&(this.input.value=t),await this.tree.updateComplete,this.tree.filter(t)}async clearFilter(){this.input&&(this.searchTerm=""),await this.updateComplete,this.input&&(this.input.value=""),await this.tree.updateComplete,this.tree.clearFilter()}focus(){this.buttonInput?this.input?.focus():super.focus()}constructor(){super(),this.options=Xm(),this.selection=new Ym(this.options),this.maxHeight=300,this.maxWidth=400,this.cross=!1,this.buttonInput=!1,this.preventInputEnter=!1,this.dynamicWidth=!1,this.selectedItems=new Map,this.searchTerm="",this._renderDropdown=!0,this._firstOpen=!0,this._autoHighlight=!0,this.originalWidth=0,this._debounceWidthUpdate=Y((()=>{this.dropdown&&this.dropdown.isConnected&&(Ft(this.dropdown),this.dynamicWidth&&this.adjustWidth())})),this._onTreeRender=()=>{this._debounceWidthUpdate()},this.tooltip=yt("og-tooltip"),this._onMouseOver=()=>{this.contentDiv&&this.contentDiv.scrollWidth>this.contentDiv.clientWidth&&(this.tooltip.parentElement||(document.body.appendChild(this.tooltip),this.tooltip.style.maxWidth="200px"),this.tooltip.content=this.getButtonContentHtml(),this.tooltip.attachTo(this.button,"bottom"))},this._onMouseOut=()=>{this.tooltip.deatach()},this._debounceFilter=Y((t=>{this.tree.filter(t),this.dispatchEvent(new nf("tree.filter"))}),300),this._onInput=async t=>{this.isOpen||await this.open();const e=t.target.value;this._debounceFilter(e),this.searchTerm=e},this._onInputKeyDown=t=>{switch(t.key){case"ArrowDown":t.preventDefault(),this.tree.list.moveDown();break;case"ArrowUp":t.preventDefault(),this.tree.list.moveUp();break;case"Enter":if(t.preventDefault(),this.preventInputEnter)return;this.tree.list.selectedIndex>-1&&(this.tree.list.select(this.tree.list.selectedIndex,_u.Enter),setTimeout((()=>this.input.focus()),100))}},this._onInputBlur=()=>this.input.value=this.getSelectionText(),this.render=()=>es`
|
|
2438
2457
|
${this.buttonInput?es`
|
|
2439
2458
|
<og-input
|
|
2440
2459
|
@input="${this._onInput}"
|
|
@@ -2514,7 +2533,7 @@
|
|
|
2514
2533
|
width: 100%;
|
|
2515
2534
|
background-color: var(--og-background-color);
|
|
2516
2535
|
outline: none;
|
|
2517
|
-
border:
|
|
2536
|
+
border: none;
|
|
2518
2537
|
color: var(--og-text-color);
|
|
2519
2538
|
}
|
|
2520
2539
|
`],mf([Rs("#searchInput")],vf.prototype,"searchInput",void 0),mf([Ss({type:Object})],vf.prototype,"tree",void 0),vf=mf([Cs("og-tree-search")],vf);let bf=class extends af{constructor(){super(),this._autoHide=!1,this._hideEvent=()=>{this.list.container?.isScrolling||(kt(this),document.body.removeEventListener("mousedown",this._hideEvent))}}connectedCallback(){super.connectedCallback()}async firstUpdated(){super.firstUpdated(),this.addEventListener("select",(()=>{this._autoHide&&kt(this)}))}async updateWidth(){await this.list.updateComplete;let t=0;this.list.items.forEach((e=>{let i=0;for(const t of e.children)i+=t.offsetWidth;t=Math.max(t,i,e.offsetWidth)})),Dt(this,{w:t})}async open(t,e="left"){this._autoHide=!0,this.parentElement!=document.body&&document.body.appendChild(this),xt(this),await this.updateWidth();const i=Ht(t,this.parentElement);jt(this,{t:i.top+t.offsetHeight,l:"left"==e?i.left:i.left+t.offsetWidth-this.offsetWidth}),Ft(this),this.list.select(0),this.list.focus(),document.body.addEventListener("mousedown",this._hideEvent)}async openAt(t,e){this._autoHide=!0,this.parentElement!=document.body&&document.body.appendChild(this),xt(this),await this.updateWidth(),jt(this,{l:t,t:e}),Ft(this),this.list.select(0),this.list.focus(),document.body.addEventListener("mousedown",this._hideEvent)}};function yf(t,e){const{years:i=0,months:o=0,weeks:n=0,days:r=0,hours:s=0,minutes:a=0,seconds:l=0}=e,c=re(t),h=o||i?so(c,o+12*i):c,d=1e3*(l+60*(a+60*s));return ae(t,(r||n?Mi(h,r+7*n):h).getTime()+d)}bf.styles=[fr`
|
|
@@ -3262,7 +3281,7 @@
|
|
|
3262
3281
|
<thead ${dd(this.theadRef)}></thead>
|
|
3263
3282
|
<tbody ${dd(this.tbodyRef)}></tbody>
|
|
3264
3283
|
</table>
|
|
3265
|
-
`,this.clearHeaderCache=()=>{this.resetFreezeLeft(),this.hCache=new Rx(this.model.columns.length,this.columnHeaderCount),this.hCache.disabled=!this.model.options.cellCache},this.clearBodyCache=()=>{this.bCache=new Rx(this.model.columns.length,this.model.rows.length),this.bCache.disabled=!this.model.options.cellCache},this.cellRenderSchedules=new WeakMap}willUpdate(){this._viewport=null,this._viewportSize=null,this.model&&(this.clearHeaderCache(),this.clearBodyCache())}updated(){this.model&&(this.createColumns(),this.createHeaderRows(),this.createBodyRows(),this.renderCells())}refresh(){this.clearHeaderCache(),this.clearBodyCache(),this.requestUpdate()}createColumns(){this._freezeLeft=null;const t=this.renderColCount;if(!this.cols||this.cols.length!=t){this.cols=new Array(t);for(let e=0;e<t;e++)this.cols[e]=yt("col"),this.cols.forEach((()=>this.colgroup.appendChild(this.cols[e])))}}createHeaderRows(){const t=this.columnHeaderCount,e=this.renderColCount;if(St(this.thead),!this.hRows||this.hRows.length!=t||!this.hRows[0]||this.hRows[0].children.length!=e){this.hRows=new Array(t);for(let i=0;i<t;i++){this.hRows[i]=yt("tr");for(let t=0;t<e;t++)this.hRows[i].appendChild(yt("th"))}}St(this.thead),this.hRows.forEach((t=>this.thead.appendChild(t)))}createBodyRows(){const t=this.renderRowCount,e=this.renderColCount,i=this.rowHeaderCount;if(!this.bRows||0==this.bRows.length||this.bRows.length!=t||this.bRows[0].children.length!=e)if(0==t&&this.grid.options.emptyPlaceholder)this.bRows=[yt("tr")],this.bRows[0].appendChild(yt("td"));else{this.bRows=new Array(t);for(let o=0;o<t;o++){this.bRows[o]=yt("tr");for(let t=0;t<i;t++)this.bRows[o].appendChild(yt("th"));for(let t=i;t<e;t++)this.bRows[o].appendChild(yt("td"))}}St(this.tbody),this.bRows.forEach((t=>this.tbody.appendChild(t)))}renderCells(t={vertical:!0,horizontal:!0}){this.table&&(t.vertical||t.horizontal)&&(this._viewport=null,t.horizontal&&this.renderHeader(),this.model.rows.length>0?(this.renderBody(),t.vertical&&this.renderRowTree()):this.model.options.emptyPlaceholder&&(this.renderEmptyBody(),this.table.appendChild(this.tbody)),this.dispatchEvent(new Vx("rendercells")))}renderEmptyBody(){const t=this.bRows[0].children[0];t.innerHTML="no data",t.className="empty-placeholder",t.colSpan=this.viewport.columns.length+this.rowHeaderCount}renderHeader(){let t;this.colMap.clear();const e=this.rowHeaderCount,i=this.viewport;this.model.hasRowTreeEnabled&&Dt(this.colgroup.children[0],{w:this.treeHeaderWidth},!0),this.model.options.rowNumbers&&Dt(this.colgroup.children[e-1],{w:zx.ROW_HEADER_WIDTH},!0);for(let o=0;o<i.columns.length;o++)t=i.columns[o],this.model.autofitColumns.has(t.index)&&(this.grid.rendering.autofitColumn(t.index,!1,!1),this.model.autofitColumns.delete(t.index)),this.colMap.set(t.index,o),Dt(this.colgroup.children[o+e],{w:t.width}),Pt(this.colgroup.children[o+e],{w:t.width}),Nt(this.colgroup.children[o+e],{w:t.width});let o=0;this.model.hasColumnTreeEnabled&&(this.renderHeaderRowTree(this.hRows[o],o),++o),this.model.options.colLetters&&(Dt(this.hRows[o],{h:this.model.options.rowHeight}),this.renderHeaderRowLetters(this.hRows[o],o),++o);for(let t=0;t<this.model.headerCount;t++)this.renderHeaderRowLabels(this.hRows[o+t],o+t,t);o+=this.model.headerCount,this.model.hasFilter&&(Dt(this.hRows[o],{h:this.model.options.rowHeight}),this.renderHeaderRowFilters(this.hRows[o],o))}renderHeaderRowLetters(t,e){let i,o;const n=this.viewport,r=e-this.columnHeaderCount;let s=0;if(Dt(t,{h:this.model.options.rowHeight}),(this.model.hasRowTree||this.model.options.rowNumbers)&&!this.model.hasColumnTreeEnabled){i=t.children[s],i.colSpan=this.rowHeaderCount,i.rowSpan=this.columnHeaderCount;const e=s-this.rowHeaderCount,o=this.model.options.levelButtonCell;(!o||r==o.r&&e==o.c)&&this.renderHeaderRowCornerCell(i),s++}for(let e=s;e<this.rowHeaderCount;e++)_t(t.children[e]),s++;for(let e=s;e<t.children.length;e++)o=e-s,i=t.children[e],i.className="hlabel",n.columns.length>o?(i.innerHTML=n.columns[o].address,i.c=n.columns[o].index,Mt(i)):_t(i)}renderHeaderRowTree(t,e){if(!this.model.hasColumnTreeEnabled)return;let i,o,n=0;const r=e-this.columnHeaderCount,s=this.viewport,a=this.model.options.rowNumbers,l=this.model.hasRowTreeEnabled;if(Dt(t,{h:this.treeHeaderHeight}),i=t.children[n],!i)return;i.rowSpan=a||l?this.columnHeaderCount:1,i.colSpan=this.rowHeaderCount;const c=n-this.rowHeaderCount,h=this.model.options.levelButtonCell;let d=null;(!h&&(a||l)||h&&r==h.r&&c==h.c)&&(d=c,this.renderHeaderRowCornerCell(i)),(a||l)&&(++n,l&&(i=t.children[n],i.innerHTML="",_t(i),++n));for(let r=n;r<t.children.length;r++)o=r-n,i=t.children[r],s.columns.length>o?(d!=r&&(i.innerHTML="",i.className="htree",this.renderHeaderRowTreeCell(t,e,s.columns[o],i)),Mt(i)):_t(i)}renderHeaderRowTreeCell(t,e,i,o){let n=this.hCache.get(i.index,e);if(!n){n=yt("div"),this.hCache.set(i.index,e,n);const t=i.width+1,o=this.treeHeaderHeight/this.model.maxColumnLevel;if(i.hasChildren){const e=new hu;e.addEventListener("toggle",(()=>this.grid.rendering.toggleColumn(i.index))),n.expander=e,n.appendChild(e),jt(e,{l:t/2-zx.EXPANDER_SIZE/2,t:i.level*o+o/2-zx.EXPANDER_SIZE/2}),n.expanderLine=this.createExpanderLine("h"),n.appendChild(n.expanderLine),jt(n.expanderLine,{l:this.model.options.columnTree.reversed?0:t/2,t:i.level*o+o/2}),Dt(n.expanderLine,{h:o/2,w:t/2+1})}if(i.hasParent){let e=i;for(;e.hasParent;){e=e.parent;const i=this.createExpanderLine("h");n.appendChild(i),Dt(i,{h:o/2,w:t-1}),jt(i,{l:0,t:e.level*o+o/2})}}}n.expander&&(n.expander.state=i.collapsed?"closed":"open"),o.appendChild(n)}createExpanderLine(t){const e=yt("div");return e.className=`${t}tree-line`,e}renderHeaderRowLabels(t,e,i){let o,n,r,s,a=0;const l=this.viewport,c=e-this.columnHeaderCount,h=this.model.options.levelButtonCell;let d;this.model.hasRowTreeEnabled&&(n=t.children[a],n.innerHTML="",this.model.hasColumnTreeEnabled||this.model.options.colLetters||i>0?_t(n):(n.rowSpan=this.columnHeaderCount,n.colSpan=this.rowHeaderCount,this.renderHeaderRowCornerCell(n)),++a),this.model.options.rowNumbers&&(n=t.children[a],n.innerHTML="",this.model.hasRowTreeEnabled||this.model.options.colLetters||this.model.hasColumnTreeEnabled||i>0?_t(n):(n.rowSpan=this.columnHeaderCount,n.colSpan=this.rowHeaderCount,this.renderHeaderRowCornerCell(n)),++a);for(let u=a;u<t.children.length;u++)if(s=u-a,n=t.children[u],n.className="hlabel",n.innerHTML="",l.columns.length>s)if(o=l.columns[s],r=o.header[i],r.height&&(d=Math.max(r.height,d||0)),n.colSpan=1,n.rowSpan=1,n.c=o.index,n.r=i,r?.hidden)if(s==this.freezeLeft){let t=o.prevVisible,r=0;for(;t&&t.header[i]?.hidden;)t=t.prevVisible,++r;t&&t.header[i].cs?(Mt(n),n.colSpan=t.header[i].cs-r-1,n.rowSpan=t.header[i].rs||1,this.renderHeaderRowLabelCell(n,t,e,i)):_t(n)}else _t(n);else{if(o.header&&o.header[i]){const t=o.header[i].cs||1;n.colSpan=t>1?o.calculateRealColspan(t):1,n.rowSpan=o.header[i].rs||1}Mt(n),this.renderHeaderRowLabelCell(n,o,e,i),h&&h.r==c&&h.c==o.index&&this.renderHeaderRowCornerCell(n)}else _t(n);Dt(t,{h:d??this.model.options.rowHeight})}renderHeaderRowLabelCell(t,e,i,o){let n=this.hCache.get(e.index,i);const r=e.header[o];if(n||(n=yt("div"),r?r.html?n.innerHTML=r.label??"":n.innerText=r.label??"":n.innerHTML="",r&&null!=r._style&&tC(n,bw(this.model.styles.get(r._style))),this.hCache.set(e.index,i,n)),this.model.options.columnHeaderTreeButtons&&e.hasChildren&&o==e.level){let t=n.expander;t||(t=new hu,t.addEventListener("toggle",(()=>this.grid.rendering.toggleColumn(e.index))),n.expander=t,n.prepend(t),jt(t,{l:4,t:4})),t.state=e.collapsed?"closed":"open"}e.sorting&&o==e.header.length-1&&(t.className+=" sort",n.sortingArrow||(n.sortingArrow=new Px,n.appendChild(n.sortingArrow),jt(n.sortingArrow,{t:0,r:5})),n.sortingArrow.sortSettings=this.model.sorting.get(e.index)),t.appendChild(n)}renderHeaderRowFilters(t,e){let i,o,n=0;const r=this.viewport;this.model.hasRowTreeEnabled&&(i=t.children[n],i.innerHTML="",this.model.columnHeaderCount>1?_t(i):i.colSpan=this.model.columnHeaderCount,++n),this.model.options.rowNumbers&&(i=t.children[n],i.innerHTML="",this.model.hasRowTreeEnabled||this.model.options.colLetters||this.model.hasColumnTreeEnabled||this.model.headerCount>0?_t(i):(i.rowSpan=this.columnHeaderCount,i.colSpan=this.rowHeaderCount,this.renderHeaderRowCornerCell(i)),++n);for(let s=n;s<t.children.length;s++)if(o=s-n,i=t.children[s],r.columns.length>o){Mt(i);const n=r.columns[o];n.hasFilter?this.renderHeaderRowFilterCell(t,e,n,i):i.innerHTML=""}else _t(i)}renderHeaderRowFilterCell(t,e,i,o){o.innerHTML="",o.className="filter",o.c=i.index;let n=this.hCache.get(i.index,e);n||(n=yt("div"),n.filter=yt("og-filter-label"),n.appendChild(n.filter),this.hCache.set(i.index,e,n));const r=this.grid.filtering.filter.get(i.index)?.term;n.filter.value=Array.isArray(r)?r.map((t=>t.value??t.key)).join(", "):r,o.appendChild(n)}renderHeaderRowCornerCell(t){this.cornerDiv=yt("div");const e=Math.max((this.treeHeaderWidth||zx.EXPANDER_SIZE+2)/(this.model.maxRowLevel+1),zx.EXPANDER_SIZE+2);if(this.model.hasRowTree)for(let t=0;t<=this.model.maxRowLevel;t++){const i=new du;i.level=t,this.cornerDiv.appendChild(i),jt(i,{l:t*e+e/2-zx.EXPANDER_SIZE/2,b:3}),i.addEventListener("mousedown",(t=>t.stopPropagation())),i.addEventListener("toggle",(t=>{this.model.columns.filter((t=>t.levelButtons)).forEach((t=>this.bCache.deleteColumn(t.index))),this.grid.rendering.setRowExpandLevel(t.level)}))}if(this.model.hasColumnTree){const i=(this.model.hasColumnTree?this.treeHeaderHeight:t.clientHeight)/(this.model.maxColumnLevel+1),o=15*this.model.maxColumnLevel+20<=t.clientHeight;for(let t=0;t<=this.model.maxColumnLevel;t++){const n=new du;n.level=t,this.cornerDiv.appendChild(n),jt(n,o?{t:t*i+i/2-zx.EXPANDER_SIZE/2,r:3}:{r:t*e+e/2-zx.EXPANDER_SIZE/2,b:3}),n.addEventListener("mousedown",(t=>t.stopPropagation())),n.addEventListener("toggle",(t=>{this.grid.rendering.setColumnExpandLevel(t.level)}))}}St(t),t.appendChild(this.cornerDiv)}renderBody(){let t,e,i,o,n,r,s,a;const l=this.freezeLeft||0,c=(this.freezeTop,this.rowHeaderCount),h=this.model.merges,d=this.model.options.rowNumbers,u=this.viewport,p=this.viewportRange;if(!p)return;const g=new Rv(this.colOffset+l,this.rowOffset,p.c2,p.r2);this.rowMap.clear();for(let l=0;l<this.bRows.length;l++)if(t=this.bRows[l],l<u.rows.length){i=u.rows[l],o=i.index,this.model.autofitRows.has(o)&&(this.grid.rendering.autofitRow(o,!1,!1),this.model.autofitRows.delete(o)),Dt(t,{h:i.height}),i.height<this.model.options.rowHeight&&Bt(t,i.height),this.rowMap.set(o,l),d&&(e=t.children[c-1],e.className="vlabel",e.r=o,e.c=-1,e.innerHTML=`<div>${Iv(o)}</div>`);for(let l=c;l<t.children.length;l++)if(e=t.children[l],l-c<u.columns.length){if(r=u.columns[l-c],n=r.index,e.r=o,e.c=n,s=i.cell(n),a=s.address,h.getMergeState(a)==xx.HIDDEN){const t=h.hiddenCells.get(s.address),i=g.intersect(new Rv(t.c,t.r,t.c+t.cs-1,t.r+t.rs-1));if(!i||s.c!=i.c1||s.r!=i.r1){_t(e);continue}s=this.model.rows[t.r].cell(t.c),e.colSpan=i.size.columns,e.rowSpan=i.size.rows,e.c=s.c,e.r=s.r}else e.colSpan=s.colspan,e.rowSpan=s.rowspan;Mt(e),this.renderBodyCell(s,e)}else _t(e);t.style.display="table-row",t.className=i.filterState>1?"filtered":""}else t.style.display="none"}scheduleRenderBodyCell(t,e){this.cellRenderSchedules.has(e)&&(window.clearTimeout(this.cellRenderSchedules.get(e)),this.cellRenderSchedules.delete(e)),this.cellRenderSchedules.set(e,window.setTimeout((()=>this.renderBodyCell(t,e))))}fixCellBorders(t,e){"none"==e.bottom?.style&&(t.style.borderBottomColor="transparent"),"none"==e.top?.style&&(t.style.borderTop="transparent"),"none"==e.right?.style&&(t.style.borderRight="transparent"),"none"==e.left?.style&&(t.style.borderLeft="transparent")}renderBodyCell(t,e){const i=!e;if(e=e||this.getCellByCellModel(t)){let o=i?null:this.bCache.get(t.c,t.r);if(o||(o=yt("div"),hC(t).call(this,o,t),this.bCache.set(t.c,t.r,o)),this.renderAll){const i=t.composedStyle;i&&this.fixCellBorders(e,i)}St(e),e.appendChild(o)}else this.bCache.delete(t.c,t.r)}mergeBodyCells(t){let e;const i=new Set;for(const o of t)if(e=this.bRows[o.r].cells[o.c],e&&!i.has(e))for(let t=o.r;t<o.r+o.rs;t++)for(let n=o.c;n<o.c+o.cs;n++)e=this.bRows[t].cells[n],e&&(t==o.r&&n==o.c?(e.colSpan=o.cs,e.rowSpan=o.rs):(i.add(e),_t(e)))}renderRowTree(){if(!this.model.hasRowTreeEnabled)return;let t;const e=this.viewport,i=-this.rowHeaderCount;for(let o=0;o<this.bRows.length;o++)t=this.bRows[o].children[0],t.innerHTML="",o<e.rows.length&&(t.className="vtree",this.renderRowTreeCell(i,e.rows[o],t))}renderRowTreeCell(t,e,i){let o=this.bCache.get(t,e.index);if(!o){o=yt("div"),this.bCache.set(t,e.index,o);const n=e.height+1,r=this.treeHeaderWidth/this.model.maxRowLevel;if(e.hasChildren){const t=new hu;t.addEventListener("toggle",(()=>this.grid.rendering.toggleRow(e.index))),i.parentElement.expander=t,o.expander=t,o.appendChild(t),jt(t,{t:n/2-zx.EXPANDER_SIZE/2,l:e.level*r+r/2-zx.EXPANDER_SIZE/2});const s=this.createExpanderLine("v");o.appendChild(s),jt(s,{t:this.model.options.rowTree.reversed?0:n/2,l:e.level*r+r/2}),Dt(s,{w:r/2,h:n/2+1})}if(e.hasParent){let t=e;for(;t.hasParent;){t=t.parent;const e=this.createExpanderLine("v");o.appendChild(e),Dt(e,{w:r/2,h:n+2}),jt(e,{t:-1,l:t.level*r+r/2})}}}o.expander&&(o.expander.state=e.collapsed?"closed":"open"),i.appendChild(o)}};Bx.styles=[Dx],jx([Ss({type:Object})],Bx.prototype,"model",void 0),jx([Ss({type:Number,hasChanged:()=>!1})],Bx.prototype,"rowOffset",void 0),jx([Ss({type:Number,hasChanged:()=>!1})],Bx.prototype,"colOffset",void 0),jx([Ss({type:Number,reflect:!0})],Bx.prototype,"zoom",void 0),jx([Ss({type:Boolean,reflect:!0})],Bx.prototype,"nogrid",void 0),jx([Ss({type:Boolean,reflect:!0})],Bx.prototype,"renderAll",void 0),Bx=jx([Cs("og-table")],Bx);const Fx=["F5","F12"];class Wx extends Event{get selection(){return this.grid.selecting.selection}get activeCell(){return this.selection.activeCell}constructor(t,e){super(`grid.${t}`,{bubbles:!0,composed:!0}),Object.assign(this,e),this.cell&&(this.row=this.cell.row,this.column=this.cell.column)}}class Ux extends Wx{constructor(t){super("edit",t)}}class Gx extends Nu{constructor(t,e,i){super(`grid.${t}`,i),this.grid=e}}class Yx extends Gx{constructor(t,e,i,o){super(t,e,o),this.column=i}}class qx extends Gx{constructor(t,e,i,o){super(t,e,o),this.row=i}}class Zx{get model(){return this.grid.model}get selection(){return this.grid.selection}get table(){return this.grid.table}constructor(t){this.grid=t,this.clickDisabled=!1,this.editDisabled=!1,this.clicked=!1,this.startOffset={x:0,y:0},this.suspendClick=()=>this.clickDisabled=!0,this.resumeClick=(t=!1)=>{this.isSliding||(t?setTimeout((()=>this.clickDisabled=!1),100):this.clickDisabled=!1)},this._onKeyDown=t=>{switch(Fx.includes(t.key)||t.preventDefault(),t.key){case"Tab":t.preventDefault(),this.grid.selecting.shiftActiveCell(t.shiftKey?-1:1,!0);break;case"ArrowRight":this.grid.selecting.debounceMoveSelector(1,0);break;case"ArrowLeft":this.grid.selecting.debounceMoveSelector(-1,0);break;case"ArrowDown":this.grid.selecting.debounceMoveSelector(0,1);break;case"ArrowUp":this.grid.selecting.debounceMoveSelector(0,-1);break;case"PageUp":this.grid.selecting.debounceMoveSelector(0,-this.table.viewport.rows.length);break;case"PageDown":this.grid.selecting.debounceMoveSelector(0,this.table.viewport.rows.length);break;case"Home":this.grid.selecting.debounceMoveSelector(-this.selection.range.c1,t.ctrlKey?-this.selection.range.r1:0);break;case"End":this.grid.selecting.debounceMoveSelector(this.model.gridRange.c2-this.selection.range.c1,t.ctrlKey?this.model.gridRange.r2-this.selection.range.r1:0);break;case"Enter":this.grid.selecting.enter();break;case"Escape":this.grid.selecting.hideCopySelector();break;case"c":case"C":t.ctrlKey&&this.grid.editing.copySelection();break;case"v":case"V":t.ctrlKey&&this.grid.editing.paste();break;case"z":case"Z":if(!this.grid.options.undoRedo)return;t.ctrlKey&&this.grid.editing.undo();break;case"y":case"Y":if(!this.grid.options.undoRedo)return;t.ctrlKey&&this.grid.editing.redo();break;case"F2":t.preventDefault(),this.grid.editing.startEdit();break;case"Delete":t.preventDefault(),this.grid.objects.delete(),this.grid.editing.clearSelection();break;case"Backspace":t.preventDefault(),this.grid.editing.clearSelection()}1!=t.key.length||t.ctrlKey||this.grid.editing.startEdit(t.key)},this._onMouseMove=t=>{let e=!0;const i=this.grid.hSizer,o=this.grid.vSizer,{offsetX:n,offsetY:r}=t;let s=this.model.options.scrolling.scrollbarVisibilityTreshold;s<=0&&(s=Math.max(this.grid.clientWidth,this.grid.clientHeight)),n>this.grid.clientWidth-s?this.grid.vSlider.show():this.grid.vSlider.hide(),r>this.grid.clientHeight-s?this.grid.hSlider.show():this.grid.hSlider.hide();const[a,l]=this.table.findNearestTableCellByOffset(n,r);if(l&&"TH"==l.tagName&&(this.model.options.columnResize&&!i.resizing&&l.classList.contains("hlabel")?l.offsetWidth-t.offsetX+l.offsetLeft<zx.RESIZE_TRESHOLD?(i.snap(l,this.grid),this.grid.rendering.currentResizedColumn=this.model.columns[l.c]):kt(i):this.model.options.rowResize&&!o.resizing&&l.classList.contains("vlabel")&&(l.offsetHeight-t.offsetY+l.offsetTop<zx.RESIZE_TRESHOLD?(o.snap(l,this.grid),this.grid.rendering.currentResizedRow=this.model.rows[l.r]):kt(o))),a&&"TH"==a.tagName)this.grid.selecting.isSelecting&&(this.suspendClick(),this.grid.selecting.updateSelecting(a.c,a.r));else{if(a&&"TD"==a.tagName)if(this.grid.selecting.isSelectorOperationActive||this.grid.selecting.isFormulaSelectorOperationActive){const{top:e,left:i}=Ht(a,this.grid);this.grid.rendering.autoscroll({x:i-this.table.totalHeaderWidth+t.offsetX-a.offsetLeft,y:e-this.table.thead.clientHeight+t.offsetY-a.offsetTop}),this.grid.selecting.isSelecting&&this.suspendClick(),this.grid.selecting.updateSelecting(a.c,a.r)}else{const t=this.model.rows[a.r]?.cell(a.c);t&&t.hasTooltip&&(e=!1,this.grid.tooltip.attachToCell(a,t)),t&&t.hasComment&&(e=!1,this.grid.comment.attachedTo!==a&&this.grid.comment.attachTo(a,t))}e&&(this.grid.tooltip.deatach(),this.grid.comment.deatach(this.model.options.comments.hideTimeout)),kt(i),kt(o)}},this._onMouseDown=t=>{if(1&t.buttons){this.grid.setPointerCapture(t.pointerId),this.startOffset={x:t.offsetX,y:t.offsetY};for(const e of t.composedPath()){if("TD"==e.tagName){const t=e;this.grid.selecting.startCellSelecting(new Rv(t.c,t.r));break}if("TH"==e.tagName){const t=e;e.matches(".sort")?this.grid.sorting.sort(t.c):t.classList.contains("filter")?this.grid.filtering.openFilter(this.model.columns[t.c],t):t.classList.contains("hlabel")?this.grid.selecting.startColumnSelecting(t.c):t.classList.contains("vlabel")&&this.grid.selecting.startRowSelecting(t.r);break}}}},this._onMouseUp=t=>{if(0!=t.buttons)return;const e=Math.abs(this.startOffset.x-t.offsetX),i=Math.abs(this.startOffset.y-t.offsetY);Math.sqrt(Math.pow(e,2)+Math.pow(i,2))<this.model.options.events.click.mouseMoveTreshold&&this.resumeClick(),this.grid.releasePointerCapture(t.pointerId),this.grid.selecting.stopSelectOperations()},this._onClick=t=>{if(this.clickDisabled)return;if(this.grid.clientHeight-t.offsetY<this.grid.hSlider.offsetHeight)return;if(this.grid.clientWidth-t.offsetX<this.grid.vSlider.offsetWidth)return;const e=this.table.findTableCellByOffset(t.offsetX,t.offsetY),i="TD"==e?.tagName?this.model.rows[e.r]?.cell(e.c):null;this.grid.dispatchEvent(new Wx("click",{grid:this.grid,cell:i}))},this._onContextMenu=t=>{t.preventDefault();for(const e of t.composedPath())if("TD"==e.tagName){const i=e;this.grid.menus.openCellMenu(this.model.rows[i.r].cell(i.c),{x:t.pageX,y:t.pageY})}else if("TH"==e.tagName){const i=e;i.classList.contains("hlabel")?this.grid.menus.openColumnMenu(this.model.columns[i.c],{x:t.pageX,y:t.pageY}):i.classList.contains("vlabel")&&this.grid.menus.openRowMenu(this.model.rows[i.r],{x:t.pageX,y:t.pageY})}},this._onVerticalSlide=t=>{this.table.rowOffset=Math.min(t.value,this.model.visibleRows.length-1),this.grid.rendering.requireVerticalUpdate=!0,this.grid.rendering.renderCells()},this._onHorizontalSlide=t=>{this.table.colOffset=Math.min(t.value,this.model.visibleColumns.length-1),this.grid.rendering.requireHorizontalUpdate=!0,this.grid.rendering.renderCells()},this._onSlideStart=()=>{this.suspendClick()},this._onSlideStop=()=>{this.resumeClick(!0)},this._denbounceHorizontalScroll=Y((t=>this.grid.rendering.scrollHorizontalByPixels(t)),50),this._onWheel=t=>{t.ctrlKey||(0!=t.deltaY&&this.grid.rendering.scrollVerticalByPixels(t.deltaY),0!=t.deltaX&&this._denbounceHorizontalScroll(Math.sign(t.deltaX)*Math.min(100,Math.abs(t.deltaX))))},this._onTouchStart=t=>{this.grid.rendering.touchStartX=t.touches[0],this.grid.rendering.touchStartY=t.touches[0]},this._onTouchEnd=t=>{this.grid.rendering.touchStartX=t.touches[0],this.grid.rendering.touchStartY=t.touches[0]},this._onTouchMove=t=>{const e=this.grid.rendering;if(e.touchStartY){const i=e.touchStartY.clientY-t.touches[0].clientY;Math.abs(i)>this.model.options.rowHeight&&this.table.viewport.rows.length>0&&(e.scrollVerticalByPixels(i),e.touchStartY=t.touches[0])}if(e.touchStartX){const i=e.touchStartX.clientX-t.touches[0].clientX;Math.abs(i)>this.model.options.columnWidth&&this.table.viewport.columns.length>0&&(e.scrollHorizontalByPixels(i),e.touchStartX=t.touches[0])}},this._onHorizontalResizeStart=()=>{this.grid.rendering.resizing=!0,this.grid.rendering.currentResizedColumnWidth=this.grid.rendering.currentResizedColumn.width},this._onHorizontalResizeStop=t=>{this.suspendClick(),this.grid.rendering.resizing=!1,this.table.clearHeaderCache(),this.table.renderCells({horizontal:!0}),this.grid.dispatchEvent(new Yx("column.resize",this.grid,this.grid.rendering.currentResizedColumn,t))},this._onHorizontalResize=t=>{const e=this.grid.rendering;e.currentResizedColumn.width=e.currentResizedColumnWidth+t.deltaX,Dt(this.table.getColumnByModelIndex(e.currentResizedColumn.index),{w:e.currentResizedColumn.width},!0),this.grid.selecting.updateSelector()},this._onVerticalResizeStart=()=>{this.grid.rendering.resizing=!0,this.grid.rendering.currentResizedRowHeight=this.grid.rendering.currentResizedRow.height},this._onVerticalResizeStop=t=>{this.suspendClick(),this.grid.rendering.resizing=!1,this.table.clearBodyCache(),this.table.renderCells({vertical:!0}),this.grid.dispatchEvent(new qx("row.resize",this.grid,this.grid.rendering.currentResizedRow,t))},this._onVerticalResize=t=>{const e=this.grid.rendering;e.currentResizedRow.height=e.currentResizedRowHeight+t.deltaY,Dt(this.table.getRowByModelIndex(e.currentResizedRow.index),{h:e.currentResizedRow.height},!1),this.grid.selecting.updateSelector()},this._onCommentCommit=t=>{this.grid.model.comments.set(t.cell.address,t.items),t.cell.invalidateStyle(),this.grid.rendering.updateCells([t.cell])},this._onAutofill=t=>{if(this.suspendClick(),this.grid.selection.range.equals(t.selector.autofillRange))return;const{cells:e,oldValues:i}=rw(this.model,this.grid.selection.range,t.selector.autofillRange,t.selector.autofillDirection);this.grid.rendering.updateCells(e,!0),this.grid.selection.setRange(this.grid.selection.range.unite(t.selector.autofillRange)),this.grid.selecting.updateSelector(),this.grid.dispatchEvent(new Ux({grid:this.grid,editType:"autofill",cells:e,oldValues:i,newValues:e.map((t=>t.value2))}))},this._onEdit=t=>{if(t.fromHistory)return;const e=[],i=[],o=this.model.names.rangeMap;let n=[],r=[],s=[],a=[];switch(t.editType){case"value":n=t.newValues,r=t.newProps,s=t.oldValues,a=t.oldProps,t.cells.forEach((t=>{const n=t.address;e.push(n),i.push(o.get(n))}));break;case"insert_column":case"insert_row":t.newValues.forEach((t=>{const r=t.address;e.push(r),i.push(o.get(r)),n.push(t.getSourceData())}))}this.grid.history.push({type:t.editType,addresses:e,names:i,oldValues:s,oldProps:a,newValues:n,newProps:r})},this._onSelectorMove=t=>{this.suspendClick(),this.selection.setRange(t.toRange),t.fromRange.isRow?this.grid.editing.moveRows({index:t.fromRange.r1,count:t.fromRange.size.rows,targetIndex:t.toRange.r1}):t.fromRange.isColumn?this.grid.editing.moveColumns({index:t.fromRange.c1,count:t.fromRange.size.columns,targetIndex:t.toRange.c1}):console.log(t)},this._onMouseLeave=()=>{this.grid.rendering.hideSliders()},this.debounceHideSliders=Y((()=>this.grid.rendering.hideSliders()),1e3,{isImmediate:!1}),this._onRender=()=>{const t=this.grid;t.selecting.updateSelectors(),t.dispatchEvent(new Wx("render",{grid:this.grid})),t.adapter&&t.options.pageSize&&t.rendering.isLastRowInViewport()&&t.rendering.loadNextPage(),t.rendering.updateSliderVisibility(),this.model.options.scrolling.scrollbarVisibilityTreshold>0&&this.debounceHideSliders()},this._onHorizontalSizerDblClick=t=>{t.stopPropagation(),this.editDisabled=!0,this.grid.rendering.autofitColumn(this.grid.rendering.currentResizedColumn.index),this.grid.dispatchEvent(new Yx("column.resize",this.grid,this.grid.rendering.currentResizedColumn,t))},this._onVerticalSizerDblClick=t=>{t.stopPropagation(),this.editDisabled=!0,this.grid.rendering.autofitRow(this.grid.rendering.currentResizedRow.index),this.grid.dispatchEvent(new qx("row.resize",this.grid,this.grid.rendering.currentResizedRow,t))},this._onDblClick=()=>{this.editDisabled?this.editDisabled=!1:this.grid.editing.startEdit()}}get isSliding(){return this.grid.hSlider.sliding||this.grid.vSlider.sliding}async init(){await this.grid.updateComplete,await this.table.updateComplete;const t=this.grid;t.addEventListener("wheel",this._onWheel,{passive:!0}),t.addEventListener("touchstart",this._onTouchStart,{passive:!0}),t.addEventListener("touchend",this._onTouchEnd,{passive:!0}),t.addEventListener("touchmove",this._onTouchMove,{passive:!0}),t.hSizer.addEventListener("resizestart",this._onHorizontalResizeStart),t.hSizer.addEventListener("resizestop",this._onHorizontalResizeStop),t.hSizer.addEventListener("resize",this._onHorizontalResize),t.hSizer.addEventListener("dblclick",this._onHorizontalSizerDblClick),t.vSizer.addEventListener("resizestart",this._onVerticalResizeStart),t.vSizer.addEventListener("resizestop",this._onVerticalResizeStop),t.vSizer.addEventListener("resize",this._onVerticalResize),t.vSizer.addEventListener("dblclick",this._onVerticalSizerDblClick),t.comment.addEventListener("comment.commit",this._onCommentCommit),t.addEventListener("keydown",this._onKeyDown),t.addEventListener("click",this._onClick),t.addEventListener("contextmenu",this._onContextMenu),t.addEventListener("toggle",(()=>t.rendering.debounceCalculateViewport())),t.addEventListener("pointerup",this._onMouseUp),t.addEventListener("pointerdown",this._onMouseDown);const e=Y(this._onMouseMove,20,{maxWait:50,isImmediate:!0});t.addEventListener("pointermove",e),t.addEventListener("mouseleave",this._onMouseLeave),t.table.addEventListener("rendercells",this._onRender),t.selector.addEventListener("grid.selector.autofill",this._onAutofill),t.selector.addEventListener("grid.selector.move",this._onSelectorMove),t.addEventListener("dblclick",this._onDblClick),t.addEventListener("grid.edit",this._onEdit)}}class Xx{get vScrolling(){return this._vScrolling}get hScrolling(){return this._hScrolling}get model(){return this.grid.model}get selection(){return this.grid.selection}get table(){return this.grid.table}constructor(t){this.grid=t,this.requireVerticalUpdate=!0,this.requireHorizontalUpdate=!1,this.resizing=!1,this._vScrolling=!0,this._hScrolling=!0,this.debounceRenderCells=Y(this.renderCells,50,{isImmediate:!1,maxWait:100}),this.debounceCalculateViewport=Y(this.calculateViewport,200)}isLastRowInViewport(){const t=this.grid.table.viewport.rows,e=this.model.visibleRows;return t[t.length-1]==e[e.length-1]}renderCells(t){t=t||{vertical:this.requireVerticalUpdate,horizontal:this.requireHorizontalUpdate},this.grid.comment.deatach(),this.grid.table.renderCells(t),this.requireHorizontalUpdate=!1,this.requireVerticalUpdate=!1,this.debounceCalculateViewport(),this.grid.objects.updatePostions()}renderAll(t=!1){this.grid.group?this.grid.group.grids.forEach((e=>e.rendering.render(t))):this.render(t)}async render(t=!1){this.grid.table&&this.model&&(this.grid.table.clearHeaderCache(),this.grid.table.clearBodyCache(),this.grid.table.isConnected&&(t&&(this.grid.table.requestUpdate(),await this.grid.table.updateComplete),this.grid.table.renderCells({horizontal:!0,vertical:!0}),this.calculateViewport()))}updateRange(t,e=!1){for(const i of this.model.getRangeIterator(t))this.updateCells([i],e)}updateCell(t,e=!1){this.updateCells([t],e)}updateSpilledCells(t){let e;t.prevSpillRange&&(e=new Set,this.model.getRangeIterator(t.prevSpillRange).forEach((t=>e.add(t)))),t.spillRange&&(e=e||new Set,this.model.getRangeIterator(t.spillRange).forEach((t=>e.add(t)))),e?.size>0&&this.updateCells(e)}updateCells(t,e=!1){if(e)for(const e of t)e.invalidateStyle(),e.invalidateValue(),this.model.calculations.clearDependecies(e).evaluate(e),this.updateSpilledCells(e);const i=this.grid.table;for(const e of t)i.renderBodyCell(e);e&&(this.model.calculations.invalidateDependants(t).forEach(((t,e)=>{t?this.grid.group.getGrid(t)?.table.renderBodyCell(e):i.renderBodyCell(e),this.updateSpilledCells(e)})),this.grid.dispatchGridEvent("calculate",{cells:Array.from(t)}))}updateHeaders(){this.model.indexVisibleColumns(),this.table.clearHeaderCache(),this.table.createHeaderRows(),this.table.renderHeader()}calculateViewport(t=!1){this.grid.logger.info("calculate viwport"),this.updateCells(this.model.calculateViewport(),t)}updateSliders(){const t=this.table.viewportSize;this.grid.vSlider.maxValue=this.model.visibleRows.length,this.grid.vSlider.pageSize=t.h/this.model.options.rowHeight,this.grid.vSlider.value=this.table.rowOffset,this.grid.hSlider.maxValue=this.model.visibleColumns.length,this.grid.hSlider.pageSize=t.w/this.model.options.columnWidth,this.grid.hSlider.value=this.table.colOffset}isVerticalScrollingEnabled(){return!1!==this.grid.options.scrolling.verticalOverscroll||this.table.viewport.rows.length<this.model.visibleRows.length}isHorizontalScrollingEnabled(){return!1!==this.grid.options.scrolling.horizontalOverscroll||this.table.viewport.columns.length<this.model.visibleColumns.length}updateSliderVisibility(){this._vScrolling=this.isVerticalScrollingEnabled(),this._vScrolling?(this.grid.vSlider.show(),xt(this.grid.vSlider)):(this.grid.vSlider.hide(),kt(this.grid.vSlider)),this._hScrolling=this.isHorizontalScrollingEnabled(),this._hScrolling?(this.grid.hSlider.show(),xt(this.grid.hSlider)):(this.grid.hSlider.hide(),kt(this.grid.hSlider))}hideSliders(){this.grid.vSlider.hide(),this.grid.hSlider.hide()}scrollVerticalByPixels(t){if(!this.vScrolling)return;let e,i=this.table.rowOffset,o=0,n=0;if(t>0){for(;o<t&&i+n<this.model.visibleRows.length;)o+=this.model.visibleRows[i+n++].height+2;i+=n}else if(t<0){for(t=Math.abs(t);o<t&&i+n>=0;)e=this.model.visibleRows[Math.min(this.model.visibleRows.length-1,i+n--)],o+=(e?e.height:0)+2;i+=n}i>=this.model.visibleRows.length&&(i=this.model.visibleRows.length-1),this.requireVerticalUpdate=!0,this.table.rowOffset=Math.max(0,i),this.debounceRenderCells(),this.updateSliders()}scrollHorizontalByPixels(t){if(!this.hScrolling)return;let e=this.table.colOffset,i=0,o=0;if(t>0){for(;i<t&&e+o<this.model.visibleColumns.length;)i+=this.model.visibleColumns[e+o++].width+2;e+=o}else if(t<0){for(t=Math.abs(t);i<t&&e+o>=0;)i+=this.model.visibleColumns[Math.min(this.model.visibleColumns.length-1,e+o--)].width+2;e+=o}e>=this.model.visibleColumns.length&&(e=this.model.visibleColumns.length-1),this.requireHorizontalUpdate=!0,this.table.colOffset=Math.max(0,e),this.debounceRenderCells(),this.updateSliders()}updateCellSelectionRange(){const t=this.table;for(const e of this.model.getRangeIterator(this.selection.range,!1))t.renderBodyCell(e)}getAdapterRequestFilters(){return{offset:0,filter:this.grid.filtering?.filter?Array.from(this.grid.filtering.filter.settings.values()):null,order:this.grid.model?.sorting?.settings}}async toggleRow(t,e=!0){const i=this.model.rows[t];if(i.isLoaded||i.isPartialyLoaded)i.toggleCollapse(!1,this.model.options.unhideRowAfterExpand),this.table.renderCells({vertical:!0});else if(this.grid.adapter){const e=this.table.getRowByModelIndex(t);e&&e.expander&&(e.expander.state="waiting"),i.collapsed=!1;const o=Object.assign(this.getAdapterRequestFilters(),{parent:{r:i.index,props:i.properties}}),[n]=await Promise.all([this.grid.adapter.getRows(o)]);this.model.insertRowData(i,0,n),o.rows=n;const[r]=await Promise.all([this.grid.adapter.getCells(o)]);r?.map((t=>this.model.getCellByCoords(t.r,t.c)?.update(t))),this.table.requestUpdate()}this.updateSliders(),e&&this.grid.dispatchEvent(new Wx("row.toggle",{grid:this.grid,row:i}))}toggleColumn(t,e=!0){const i=this.model.columns[t];i.toggleCollapse(!1,this.model.options.unhideColumnAfterExpand),this.table.renderCells({horizontal:!0}),this.updateSliders(),e&&this.grid.dispatchEvent(new Wx("column.toggle",{grid:this.grid,column:i}))}setRowExpandLevel(t){this.model.setRowExpandLevel(t),this.table.rowOffset=0,this.table.renderCells({vertical:!0}),this.updateSliders(),this.grid.dispatchEvent(new Wx("row.toggle",{grid:this.grid}))}setColumnExpandLevel(t){this.model.setColumnExpandLevel(t),this.table.colOffset=0,this.table.renderCells({horizontal:!0}),this.updateSliders(),this.grid.dispatchEvent(new Wx("column.toggle",{grid:this.grid}))}async exportHTML(){const t=yt("div");kt(t),document.body.appendChild(t);const e=yt("og-table");e.grid=this.grid,e.model=this.model,e.renderAll=!0,t.appendChild(e),await e.updateComplete;const i=this.model.options?.print?.rowBreaks,o=e.table,n=i&&i.length>0;if(n){const t=o.querySelector("colgroup"),n=[...o.tBodies[0].rows],r=this.model.options?.print?.rowTitles?Rv.fromA1(this.model.options?.print?.rowTitles):null,s=r?Array.from({length:r.r2-r.r1+1},((t,i)=>n[e.rowMap.get(r.r1+i)])):[];for(let o=0;o<i.length;o++){const r=yt("table");r.appendChild(t.cloneNode(!0));const a=yt("tbody");r.appendChild(a);const l=e.rowMap.get(i[o]),c=o<i.length-1?e.rowMap.get(i[o+1]):this.model.visibleRows.length-1;s.forEach((t=>a.appendChild(t.cloneNode(!0))));for(let t=l;t<=c;t++)a.appendChild(n[t]);e.shadowRoot.appendChild(r)}t.cloneNode(!0)}const r=`\n\t\t\t<style>\n\t\t\t\thtml {\n\t\t\t\t\t${_a(Ta().themes.get("light")).cssText}\n\t\t\t\t}\n\t\t\t\t${n?"table {break-after: page}":""}\n\t\t\t\t${Bx.styles.map((t=>t.cssText)).join("\n")}\n\t\t\t</style>\n\n\t\t`,s=r+e.shadowRoot.innerHTML.replace(/<!---->/g,"");return t.remove(),s}stopAutoscroll(){this.autoscrollTimer&&window.clearInterval(this.autoscrollTimer)}startAutoscroll(){this.stopAutoscroll(),this.autoscrollTimer=window.setInterval((()=>{if(0==this.autoscrollValue)return this.stopAutoscroll();const t=Math.pow(this.autoscrollValue,lv.AUTOSCROLL_RATIO);switch(this.autoscrollDirection){case"down":this.scrollVerticalByPixels(t);break;case"up":this.scrollVerticalByPixels(-t);break;case"left":this.scrollHorizontalByPixels(-t);break;case"right":this.scrollHorizontalByPixels(t)}}),lv.AUTOSCROLL_INTERVAL)}autoscroll(t){const{x:e,y:i}=t,o=this.table.clientWidth/this.table.zoom-this.table.totalHeaderWidth,n=this.table.clientHeight/this.table.zoom-this.table.totalHeaderHeight;let r,s=0;e<lv.AUTOSCROLL_TRESHOLD&&e<i&&e<n-i?(r="left",s=lv.AUTOSCROLL_TRESHOLD-e):o-e<lv.AUTOSCROLL_TRESHOLD&&o-e<i&&o-e<n-i?(r="right",s=lv.AUTOSCROLL_TRESHOLD-o+e):i<lv.AUTOSCROLL_TRESHOLD?(r="up",s=lv.AUTOSCROLL_TRESHOLD-i):n-i<lv.AUTOSCROLL_TRESHOLD&&(r="down",s=lv.AUTOSCROLL_TRESHOLD-n+i),this.autoscrollDirection=r,this.autoscrollValue=s,this.stopAutoscroll(),s>0&&this.startAutoscroll()}async load(t){t=t||this.getAdapterRequestFilters();const e=t.parent?.r??null,i=null!=e?this.model.rows[e]:this.model.rowRoot,[o]=await Promise.all([this.grid.adapter.getRows(t)]);o.length>0&&null===e&&this.model.insertRowData(i,t.offset,o);const[n]=await Promise.all([this.grid.adapter.getCells(t)]);n?.map((t=>this.model.getCellByCoords(t.r,t.c)?.update(t))),this.table.requestUpdate(),o.length>=this.model.options.pageSize?i.count=1/0:i.count=i.children.length,this.grid.logger.info(`loaded ${o.length} rows`),this.grid.loading=!1,this.grid.dispatchEvent(new Wx("afterLoad",{grid:this.grid}))}async loadNextPage(t=null,e=!1){if(this.grid.loading)return;const i=null!=t?this.model.rows[t]:this.model.rowRoot;if(!e&&i.isLoaded)return;this.grid.dispatchEvent(new Wx("beforeLoad",{grid:this.grid})),this.grid.loading=!0;const o=this.model.rows.length;this.grid.logger.info(`loading rows offset = ${o}`),await this.load(Object.assign(this.getAdapterRequestFilters(),{offset:o,parent:{r:t,props:null}}))}get totalSize(){return{width:this.table.totalHeaderWidth+this.model.visibleColumns.reduce(((t,e)=>t+e.width),0),height:this.table.thead.offsetHeight+this.model.visibleRows.reduce(((t,e)=>t+e.height),0)}}autofitColumn(t,e=!1,i=!0){const o="number"==typeof t?this.model.columns[t]:t,n=this.autofitDiv??(this.autofitDiv=yt("div"));n.style.position="absolute",n.style.zIndex="100000",jt(n,{l:-1e3,t:-1e3}),this.grid.shadowRoot.appendChild(n);let r=0;for(const t of this.model.getRangeIterator(Rv.fromA1(o.address),!!e)){const e=hC(t).call(this.table,n,t)||n;e.style.width="auto",r=Math.max(r,e.offsetWidth)}o.width=r+10,i&&this.table.renderCells({horizontal:!0})}autofitColumns(t=!1){this.model.columns.forEach((e=>this.autofitColumn(e,t,!1))),this.table.renderCells({horizontal:!0})}autofitRow(t,e=!1,i=!0){const o="number"==typeof t?this.model.rows[t]:t,n=this.autofitDiv??(this.autofitDiv=yt("div"));n.style.position="absolute",n.style.zIndex="100000",jt(n,{l:-1e3,t:-1e3}),this.grid.shadowRoot.appendChild(n);let r=0;for(const t of this.model.getRangeIterator(Rv.fromA1(o.address),!!e)){const e=hC(t).call(this.table,n,t)||n;e.style.height="auto",r=Math.max(r,e.offsetHeight)}o.height=r+8,i&&this.table.renderCells({vertical:!0})}autofitRows(t=!1){this.model.rows.forEach((e=>this.autofitRow(e,t,!1))),this.table.renderCells({vertical:!0})}scrollTo(t,e=0){let i;i=Q(t)?Rv.fromA1(t):new Rv(e,t),this.table.rowOffset=i.r1,this.table.colOffset=i.c1,this.requireVerticalUpdate=!0,this.requireHorizontalUpdate=!0,this.debounceRenderCells(),this.updateSliders()}}class Qx{get model(){return this.grid.model}get selection(){return this.grid.editing.isFormulaMode?this.formulaSelection:this.grid.selection}get selector(){return this.grid.editing.isFormulaMode?this.grid.formulaSelector:this.grid.selector}get formulaSelection(){return this._formulaSelection}get events(){return this.grid.events}get table(){return this.grid.table}get isSelecting(){return this.isCellSelecting||this.columnSelecting||this.rowSelecting}get isCellSelecting(){return this.selector.isSelecting}get isAutofilling(){return this.selector.isAutofilling}get isMoving(){return this.selector.isMoving}get isSelectorOperationActive(){return this.selector.isSelectorOperationActive}get isFormulaSelectorOperationActive(){if(!this.grid.editing.isFormulaMode)return!1;for(const t of this.formulaSelectors.values())if(t.isSelectorOperationActive)return!0;return!1}get activeCell(){const{c:t,r:e}=this.selection.activeCellCoords;return this.model.rows[e]?.cell(t)}constructor(t){this.grid=t,this.columnSelecting=!1,this.rowSelecting=!1,this._formulaSelection=new Ex(0,0,0,0),this.formulaSelectors=new Map,this.debounceMoveSelector=Y(((t,e)=>this.moveSelector(t,e)),10)}moveToSelection(){const t=new Rv(this.selection.range.c1,this.selection.range.r1);this.table.viewportRange.contains(t)}select(t,e=!1){this.selection.setRange(t),this.updateSelector(),e&&this.grid.dispatchEvent(new Wx("select",{grid:this.grid}))}startCellSelecting(t){this.grid.style.cursor="cell",this.startSelectingRange=t.clone(),this.select(t,!0),this.selector.startSelecting(t)}startColumnSelecting(t){this.columnSelecting=!0;const e=new Rv(t,null,t,null);this.startSelectingRange=e.clone(),this.select(e,!0)}startRowSelecting(t){this.rowSelecting=!0;const e=new Rv(null,t,null,t);this.startSelectingRange=e.clone(),this.select(e,!0)}updateSelecting(t,e){const i=this.model.options.selecting.multiSelect;(this.isCellSelecting||this.rowSelecting)&&(i||(this.selection.range.r1=e),this.selection.range.r2=e),(this.isCellSelecting||this.columnSelecting)&&(i||(this.selection.range.c1=t),this.selection.range.c2=t),this.grid.editing.isFormulaMode?(this.updateFormulaSelector(),this.formulaSelectors.forEach((i=>i.updateMovingOperations(t,e)))):(this.updateSelector(),this.hideFormulaSelector(),this.selector.updateMovingOperations(t,e))}stopSelecting(){this.grid.rendering.stopAutoscroll(),this.isSelecting&&!this.selection.range.equals(this.startSelectingRange)&&this.grid.dispatchEvent(new Wx("select",{grid:this.grid})),this.columnSelecting=!1,this.rowSelecting=!1,this.startSelectingRange=null,this.selector.stopSelectorOperations()}highlightSelection(){const t=this.selection.range,[e,i]=[Math.min(t.c1,t.c2),Math.max(t.c1,t.c2)],[o,n]=[Math.min(t.r1,t.r2),Math.max(t.r1,t.r2)],r=i-e+1,s=n-o+1;this.table.highlightColHeaderCells(r<1/0?Array.from(new Array(r),((t,i)=>i+e)):[]),this.table.highlightRowHeaderCells(s<1/0?Array.from(new Array(s),((t,e)=>e+o)):[])}updateSelector(t=!0){this.model.options.selecting.enabled?(this.showSelector(t),this.highlightSelection()):this.hideSelector(),this.grid.editing.isFormulaMode||this.grid.editing.endEdit()}showSelector(t=!0){this.selector&&(this.selector.show(),this.selector.select(this.selection.range,t))}hideSelector(){this.selector.hide()}moveSelector(t,e){if(this.selection.move(t,e,this.model.columns.length,this.model.rows.length),0!=e&&!this.model.rows[this.selection.range.r1].visible){const t=e>0?this.model.rows[this.selection.range.r1].nextVisible:this.model.rows[this.selection.range.r1].prevVisible;t&&(this.selection.range.r1=t.index,this.selection.range.r2=t.index)}if(0!=t&&!this.model.columns[this.selection.range.c1].visible){const e=t>0?this.model.columns[this.selection.range.c1].nextVisible:this.model.columns[this.selection.range.c1].prevVisible;e&&(this.selection.range.c1=e.index,this.selection.range.c2=e.index)}this.selector.selection=this.selection.range,this.selector.updatePosition();const i={c:0,r:0};(e>0&&this.selector.offsetTop+this.selector.offsetHeight>this.grid.clientHeight||e<0&&this.selector.offsetTop<this.table.totalHeaderHeight-1||e>=this.table.viewport.rows.length)&&(i.r+=e),(t>0&&this.selector.offsetLeft+this.selector.offsetWidth>this.grid.clientWidth||t<0&&this.selector.offsetLeft<this.table.totalHeaderWidth-1)&&(i.c+=t),0==i.c&&0==i.r||(this.table.colOffset=Math.max(0,this.table.colOffset+i.c),this.table.rowOffset=Math.min(Math.max(0,this.table.rowOffset+i.r),this.model.visibleRows.length-1),this.table.renderCells({horizontal:0!=i.c,vertical:0!=i.r}),this.grid.rendering.updateSliders()),this.grid.editing.isFormulaMode||this.grid.editing.endEdit(),this.highlightSelection(),this.grid.dispatchEvent(new Wx("select",{grid:this.grid}))}shiftActiveCell(t,e=!1){this.selection.moveActiveCell(t,0),this.selector.updatePosition(),e&&this.grid.dispatchEvent(new Wx("select",{grid:this.grid}))}updateFormulaSelector(t=!0){this.grid.editing.isFormulaMode?this.showFormulaSelector(t):this.hideFormulaSelector()}showFormulaSelector(t=!0){this.grid.formulaSelector.show(),this.grid.formulaSelector?.select(this.formulaSelection.range,t)}hideFormulaSelector(){this.grid.formulaSelector.hide()}updateFormulaSelectors(){this.formulaSelectors.forEach((t=>t.updatePosition()))}highlightColorItem(t){const e=Ex.fromRange(Rv.fromA1(t.address)),i=yt("og-selector");this.grid.shadowRoot.appendChild(i),i.addEventListener("grid.selector.move",(t=>this.select(t.selector.selection.clone()))),i.addEventListener("grid.selector.resize",(t=>this.select(t.selector.selection.clone()))),i.grid=this.grid,i.color=t.color,i.subselector=!1,i.movable=!0,i.resizable=!0,i.index=t.tokenIndex,this.formulaSelectors.set(t.tokenIndex,i),i.select(e.range.clone(),!1),i.show()}highlightFormula(t){this.removeFormulaHighlight(),this.formulaSelectors.clear();const e=new Set;t.colors.forEach((t=>{if(null==t.sheet||t.sheet==this.model.name)this.highlightColorItem(t);else if(this.grid.group){const i=this.grid.group.getGrid(t.sheet);if(!i)return;e.has(i)||(e.add(i),i.selecting.removeFormulaHighlight()),i.isConnected&&i.selecting.highlightColorItem(t)}}))}removeFormulaHighlight(){this.formulaSelectors?.forEach((t=>Et(t))),this.formulaSelectors.clear()}updateCopySelector(){this.grid.copySelector.isVisible&&this.grid.copySelector.updatePosition()}showCopySelector(){this.grid.copySelector.show(),this.grid.copySelector?.select(this.selection.range.clone(),!1)}hideCopySelector(){this.grid.copySelector.hide()}updateSelectors(){this.updateSelector(!1),this.updateCopySelector(),this.updateFormulaSelectors()}stopSelectOperations(){this.stopSelecting(),this.formulaSelectors.forEach((t=>t.stopSelectorOperations())),this.grid.style.removeProperty("cursor")}enter(){const t=this.grid.group;if(this.grid.editing.isFormulaMode&&t){const e=t.formulaModeGrid;e.editing.commitEdit(),t.activateGrid(e.model.name)}else this.debounceMoveSelector(0,1)}}class Kx extends Event{}class Jx extends xs{get isOpen(){return this._open}get isValid(){return this._valid}validate(){return this._valid=!0,this.activeCell&&(this._valid=aw(this.activeCellModel,this.getValue())),this.classList.toggle("invalid",!this._valid),this._valid}constructor(){super(),this.cancel=!1,this._open=!1,this._valid=!0,this.init()}getDisplayValue(){return null}init(){this.addEventListener("keydown",(t=>{"Enter"==t.key?this.close():"Escape"==t.key?(this.cancel=!0,this.close()):t.stopPropagation()}))}connectedCallback(){super.connectedCallback(),this.performUpdate()}alignWithCell(){if(!this.activeCell)return;const t=Ht(this.activeCell,this.grid);jt(this,{t:t.top*this.grid.zoom,l:t.left*this.grid.zoom}),Dt(this,{w:this.activeCell.offsetWidth,h:this.activeCell.offsetHeight})}open(t,e=null,i=!0){this._valid=!0,this.initialValue=e,this._open=!0,this.grid=t;const o=t.selecting.activeCell;return this.activeCellModel=o,this.activeCell=this.grid.table.getCellByModelIndex(o.c,o.r),this.grid.selector.hide(),xt(this),i&&this.alignWithCell(),this.activate(o),null!==e&&this.setValue(e),Qt(this,this.grid.zoom),this}commit(){this._open&&!this.cancel&&this.activeCellModel&&(this.grid.editing.updateCell(this.activeCellModel,{v:this.getValue(),dv:this.getDisplayValue()}),this.grid.rendering.updateCell(this.activeCellModel,!0)),this.cancel=!1}close(){this._open&&(this.deactivate(),kt(this),this.grid.table.renderBodyCell(this.activeCellModel),this.grid.selecting.showSelector(),this.grid.focus(),this._open=!1,this.grid.editing.endEdit()),this.cancel=!1}activate(t){this.activeCellModel=t,this.dispatchEvent(new Kx("activate"))}deactivate(){this.dispatchEvent(new Kx("deactivate"))}}Jx.baseStyles=fr`
|
|
3284
|
+
`,this.clearHeaderCache=()=>{this.resetFreezeLeft(),this.hCache=new Rx(this.model.columns.length,this.columnHeaderCount),this.hCache.disabled=!this.model.options.cellCache},this.clearBodyCache=()=>{this.bCache=new Rx(this.model.columns.length,this.model.rows.length),this.bCache.disabled=!this.model.options.cellCache},this.cellRenderSchedules=new WeakMap}willUpdate(){this._viewport=null,this._viewportSize=null,this.model&&(this.clearHeaderCache(),this.clearBodyCache())}updated(){this.model&&(this.createColumns(),this.createHeaderRows(),this.createBodyRows(),this.renderCells())}refresh(){this.clearHeaderCache(),this.clearBodyCache(),this.requestUpdate()}createColumns(){this._freezeLeft=null;const t=this.renderColCount;if(!this.cols||this.cols.length!=t){this.cols=new Array(t);for(let e=0;e<t;e++)this.cols[e]=yt("col"),this.cols.forEach((()=>this.colgroup.appendChild(this.cols[e])))}}createHeaderRows(){const t=this.columnHeaderCount,e=this.renderColCount;if(St(this.thead),!this.hRows||this.hRows.length!=t||!this.hRows[0]||this.hRows[0].children.length!=e){this.hRows=new Array(t);for(let i=0;i<t;i++){this.hRows[i]=yt("tr");for(let t=0;t<e;t++)this.hRows[i].appendChild(yt("th"))}}St(this.thead),this.hRows.forEach((t=>this.thead.appendChild(t)))}createBodyRows(){const t=this.renderRowCount,e=this.renderColCount,i=this.rowHeaderCount;if(!this.bRows||0==this.bRows.length||this.bRows.length!=t||this.bRows[0].children.length!=e)if(0==t&&this.grid.options.emptyPlaceholder)this.bRows=[yt("tr")],this.bRows[0].appendChild(yt("td"));else{this.bRows=new Array(t);for(let o=0;o<t;o++){this.bRows[o]=yt("tr");for(let t=0;t<i;t++)this.bRows[o].appendChild(yt("th"));for(let t=i;t<e;t++)this.bRows[o].appendChild(yt("td"))}}St(this.tbody),this.bRows.forEach((t=>this.tbody.appendChild(t)))}renderCells(t={vertical:!0,horizontal:!0}){this.table&&(t.vertical||t.horizontal)&&(this._viewport=null,t.horizontal&&this.renderHeader(),this.model.rows.length>0?(this.renderBody(),t.vertical&&this.renderRowTree()):this.model.options.emptyPlaceholder&&(this.renderEmptyBody(),this.table.appendChild(this.tbody)),this.dispatchEvent(new Vx("rendercells")))}renderEmptyBody(){const t=this.bRows[0].children[0];t.innerHTML="no data",t.className="empty-placeholder",t.colSpan=this.viewport.columns.length+this.rowHeaderCount}renderHeader(){let t;this.colMap.clear();const e=this.rowHeaderCount,i=this.viewport;this.model.hasRowTreeEnabled&&Dt(this.colgroup.children[0],{w:this.treeHeaderWidth},!0),this.model.options.rowNumbers&&Dt(this.colgroup.children[e-1],{w:zx.ROW_HEADER_WIDTH},!0);for(let o=0;o<i.columns.length;o++)t=i.columns[o],this.model.autofitColumns.has(t.index)&&(this.grid.rendering.autofitColumn(t.index,!1,!1),this.model.autofitColumns.delete(t.index)),this.colMap.set(t.index,o),Dt(this.colgroup.children[o+e],{w:t.width}),Pt(this.colgroup.children[o+e],{w:t.width}),Nt(this.colgroup.children[o+e],{w:t.width});let o=0;this.model.hasColumnTreeEnabled&&(this.renderHeaderRowTree(this.hRows[o],o),++o),this.model.options.colLetters&&(Dt(this.hRows[o],{h:this.model.options.rowHeight}),this.renderHeaderRowLetters(this.hRows[o],o),++o);for(let t=0;t<this.model.headerCount;t++)this.renderHeaderRowLabels(this.hRows[o+t],o+t,t);o+=this.model.headerCount,this.model.hasFilter&&(Dt(this.hRows[o],{h:this.model.options.rowHeight}),this.renderHeaderRowFilters(this.hRows[o],o))}renderHeaderRowLetters(t,e){let i,o;const n=this.viewport,r=e-this.columnHeaderCount;let s=0;if(Dt(t,{h:this.model.options.rowHeight}),(this.model.hasRowTree||this.model.options.rowNumbers)&&!this.model.hasColumnTreeEnabled){i=t.children[s],i.colSpan=this.rowHeaderCount,i.rowSpan=this.columnHeaderCount;const e=s-this.rowHeaderCount,o=this.model.options.levelButtonCell;(!o||r==o.r&&e==o.c)&&this.renderHeaderRowCornerCell(i),s++}for(let e=s;e<this.rowHeaderCount;e++)_t(t.children[e]),s++;for(let e=s;e<t.children.length;e++)o=e-s,i=t.children[e],i.className="hlabel",n.columns.length>o?(i.innerHTML=n.columns[o].address,i.c=n.columns[o].index,Mt(i)):_t(i)}renderHeaderRowTree(t,e){if(!this.model.hasColumnTreeEnabled)return;let i,o,n=0;const r=e-this.columnHeaderCount,s=this.viewport,a=this.model.options.rowNumbers,l=this.model.hasRowTreeEnabled;if(Dt(t,{h:this.treeHeaderHeight}),i=t.children[n],!i)return;i.rowSpan=a||l?this.columnHeaderCount:1,i.colSpan=this.rowHeaderCount;const c=n-this.rowHeaderCount,h=this.model.options.levelButtonCell;let d=null;(!h&&(a||l)||h&&r==h.r&&c==h.c)&&(d=c,this.renderHeaderRowCornerCell(i)),(a||l)&&++n;for(let r=n;r<t.children.length;r++)o=r-n,i=t.children[r],s.columns.length>o?(d!=r&&(i.innerHTML="",i.className="htree",this.renderHeaderRowTreeCell(t,e,s.columns[o],i)),Mt(i)):_t(i)}renderHeaderRowTreeCell(t,e,i,o){let n=this.hCache.get(i.index,e);if(!n){n=yt("div"),this.hCache.set(i.index,e,n);const t=i.width+1,o=this.treeHeaderHeight/this.model.maxColumnLevel;if(i.hasChildren){const e=new hu;e.addEventListener("toggle",(()=>this.grid.rendering.toggleColumn(i.index))),n.expander=e,n.appendChild(e),jt(e,{l:t/2-zx.EXPANDER_SIZE/2,t:i.level*o+o/2-zx.EXPANDER_SIZE/2}),n.expanderLine=this.createExpanderLine("h"),n.appendChild(n.expanderLine),jt(n.expanderLine,{l:this.model.options.columnTree.reversed?0:t/2,t:i.level*o+o/2}),Dt(n.expanderLine,{h:o/2,w:t/2+1})}if(i.hasParent){let e=i;for(;e.hasParent;){e=e.parent;const i=this.createExpanderLine("h");n.appendChild(i),Dt(i,{h:o/2,w:t-1}),jt(i,{l:0,t:e.level*o+o/2})}}}n.expander&&(n.expander.state=i.collapsed?"closed":"open"),o.appendChild(n)}createExpanderLine(t){const e=yt("div");return e.className=`${t}tree-line`,e}renderHeaderRowLabels(t,e,i){let o,n,r,s,a=0;const l=this.viewport,c=e-this.columnHeaderCount,h=this.model.options.levelButtonCell;let d;this.model.hasRowTreeEnabled&&(n=t.children[a],n.innerHTML="",this.model.hasColumnTreeEnabled||this.model.options.colLetters||i>0?_t(n):(n.rowSpan=this.columnHeaderCount,n.colSpan=this.rowHeaderCount,this.renderHeaderRowCornerCell(n)),++a),this.model.options.rowNumbers&&(n=t.children[a],n.innerHTML="",this.model.hasRowTreeEnabled||this.model.options.colLetters||this.model.hasColumnTreeEnabled||i>0?_t(n):(n.rowSpan=this.columnHeaderCount,n.colSpan=this.rowHeaderCount,this.renderHeaderRowCornerCell(n)),++a);for(let u=a;u<t.children.length;u++)if(s=u-a,n=t.children[u],n.className="hlabel",n.innerHTML="",l.columns.length>s)if(o=l.columns[s],r=o.header[i],r.height&&(d=Math.max(r.height,d||0)),n.colSpan=1,n.rowSpan=1,n.c=o.index,n.r=i,r?.hidden)if(s==this.freezeLeft){let t=o.prevVisible,r=0;for(;t&&t.header[i]?.hidden;)t=t.prevVisible,++r;t&&t.header[i].cs?(Mt(n),n.colSpan=t.header[i].cs-r-1,n.rowSpan=t.header[i].rs||1,this.renderHeaderRowLabelCell(n,t,e,i)):_t(n)}else _t(n);else{if(o.header&&o.header[i]){const t=o.header[i].cs||1;n.colSpan=t>1?o.calculateRealColspan(t):1,n.rowSpan=o.header[i].rs||1}Mt(n),this.renderHeaderRowLabelCell(n,o,e,i),h&&h.r==c&&h.c==o.index&&this.renderHeaderRowCornerCell(n)}else _t(n);Dt(t,{h:d??this.model.options.rowHeight})}renderHeaderRowLabelCell(t,e,i,o){let n=this.hCache.get(e.index,i);const r=e.header[o];if(n||(n=yt("div"),r?r.html?n.innerHTML=r.label??"":n.innerText=r.label??"":n.innerHTML="",r&&null!=r._style&&tC(n,bw(this.model.styles.get(r._style))),this.hCache.set(e.index,i,n)),this.model.options.columnHeaderTreeButtons&&e.hasChildren&&o==e.level){let t=n.expander;t||(t=new hu,t.addEventListener("toggle",(()=>this.grid.rendering.toggleColumn(e.index))),n.expander=t,n.prepend(t),jt(t,{l:4,t:4})),t.state=e.collapsed?"closed":"open"}e.sorting&&o==e.header.length-1&&(t.className+=" sort",n.sortingArrow||(n.sortingArrow=new Px,n.appendChild(n.sortingArrow),jt(n.sortingArrow,{t:0,r:5})),n.sortingArrow.sortSettings=this.model.sorting.get(e.index)),t.appendChild(n)}renderHeaderRowFilters(t,e){let i,o,n=0;const r=this.viewport;this.model.hasRowTreeEnabled&&(i=t.children[n],i.innerHTML="",this.model.columnHeaderCount>1?_t(i):i.colSpan=this.model.columnHeaderCount,++n),this.model.options.rowNumbers&&(i=t.children[n],i.innerHTML="",this.model.hasRowTreeEnabled||this.model.options.colLetters||this.model.hasColumnTreeEnabled||this.model.headerCount>0?_t(i):(i.rowSpan=this.columnHeaderCount,i.colSpan=this.rowHeaderCount,this.renderHeaderRowCornerCell(i)),++n);for(let s=n;s<t.children.length;s++)if(o=s-n,i=t.children[s],r.columns.length>o){Mt(i);const n=r.columns[o];n.hasFilter?this.renderHeaderRowFilterCell(t,e,n,i):i.innerHTML=""}else _t(i)}renderHeaderRowFilterCell(t,e,i,o){o.innerHTML="",o.className="filter",o.c=i.index;let n=this.hCache.get(i.index,e);n||(n=yt("div"),n.filter=yt("og-filter-label"),n.appendChild(n.filter),this.hCache.set(i.index,e,n));const r=this.grid.filtering.filter.get(i.index)?.term;n.filter.value=Array.isArray(r)?r.map((t=>t.value??t.key)).join(", "):r,o.appendChild(n)}renderHeaderRowCornerCell(t){this.cornerDiv=yt("div");const e=Math.max((this.treeHeaderWidth||zx.EXPANDER_SIZE+2)/(this.model.maxRowLevel+1),zx.EXPANDER_SIZE+2);if(this.model.hasRowTree)for(let t=0;t<=this.model.maxRowLevel;t++){const i=new du;i.level=t,this.cornerDiv.appendChild(i),jt(i,{l:t*e+e/2-zx.EXPANDER_SIZE/2,b:3}),i.addEventListener("mousedown",(t=>t.stopPropagation())),i.addEventListener("toggle",(t=>{this.model.columns.filter((t=>t.levelButtons)).forEach((t=>this.bCache.deleteColumn(t.index))),this.grid.rendering.setRowExpandLevel(t.level)}))}if(this.model.hasColumnTree){const i=(this.model.hasColumnTree?this.treeHeaderHeight:t.clientHeight)/(this.model.maxColumnLevel+1),o=15*this.model.maxColumnLevel+20<=t.clientHeight;for(let t=0;t<=this.model.maxColumnLevel;t++){const n=new du;n.level=t,this.cornerDiv.appendChild(n),jt(n,o?{t:t*i+i/2-zx.EXPANDER_SIZE/2,r:3}:{r:t*e+e/2-zx.EXPANDER_SIZE/2,b:3}),n.addEventListener("mousedown",(t=>t.stopPropagation())),n.addEventListener("toggle",(t=>{this.grid.rendering.setColumnExpandLevel(t.level)}))}}St(t),t.appendChild(this.cornerDiv)}renderBody(){let t,e,i,o,n,r,s,a;const l=this.freezeLeft||0,c=this.rowHeaderCount,h=this.model.merges,d=this.model.options.rowNumbers,u=this.viewport,p=this.viewportRange;if(!p)return;const g=new Rv(this.colOffset+l,this.rowOffset,p.c2,p.r2);this.rowMap.clear();for(let l=0;l<this.bRows.length;l++)if(t=this.bRows[l],l<u.rows.length){i=u.rows[l],o=i.index,this.model.autofitRows.has(o)&&(this.grid.rendering.autofitRow(o,!1,!1),this.model.autofitRows.delete(o)),Dt(t,{h:i.height}),i.height<this.model.options.rowHeight&&Bt(t,i.height),this.rowMap.set(o,l),d&&(e=t.children[c-1],e.className="vlabel",e.r=o,e.c=-1,e.innerHTML=`<div>${Iv(o)}</div>`);for(let l=c;l<t.children.length;l++)if(e=t.children[l],l-c<u.columns.length){if(r=u.columns[l-c],n=r.index,e.r=o,e.c=n,s=i.cell(n),a=s.address,h.getMergeState(a)==xx.HIDDEN){const t=h.hiddenCells.get(s.address),i=g.intersect(new Rv(t.c,t.r,t.c+t.cs-1,t.r+t.rs-1));if(!i||s.c!=i.c1||s.r!=i.r1){_t(e);continue}s=this.model.rows[t.r].cell(t.c),e.colSpan=i.size.columns,e.rowSpan=i.size.rows,e.c=s.c,e.r=s.r}else e.colSpan=s.colspan,e.rowSpan=s.rowspan;Mt(e),this.renderBodyCell(s,e)}else _t(e);t.style.display="table-row",t.className=i.filterState>1?"filtered":""}else t.style.display="none"}scheduleRenderBodyCell(t,e){this.cellRenderSchedules.has(e)&&(window.clearTimeout(this.cellRenderSchedules.get(e)),this.cellRenderSchedules.delete(e)),this.cellRenderSchedules.set(e,window.setTimeout((()=>this.renderBodyCell(t,e))))}fixCellBorders(t,e){"none"==e.bottom?.style&&(t.style.borderBottomColor="transparent"),"none"==e.top?.style&&(t.style.borderTop="transparent"),"none"==e.right?.style&&(t.style.borderRight="transparent"),"none"==e.left?.style&&(t.style.borderLeft="transparent")}renderBodyCell(t,e){const i=!e;if(e=e||this.getCellByCellModel(t)){let o=i?null:this.bCache.get(t.c,t.r);if(o||(o=yt("div"),hC(t).call(this,o,t),this.bCache.set(t.c,t.r,o)),this.renderAll){const i=t.composedStyle;i&&this.fixCellBorders(e,i)}St(e),e.appendChild(o)}else this.bCache.delete(t.c,t.r)}mergeBodyCells(t){let e;const i=new Set;for(const o of t)if(e=this.bRows[o.r].cells[o.c],e&&!i.has(e))for(let t=o.r;t<o.r+o.rs;t++)for(let n=o.c;n<o.c+o.cs;n++)e=this.bRows[t].cells[n],e&&(t==o.r&&n==o.c?(e.colSpan=o.cs,e.rowSpan=o.rs):(i.add(e),_t(e)))}renderRowTree(){if(!this.model.hasRowTreeEnabled)return;let t;const e=this.viewport,i=-this.rowHeaderCount;for(let o=0;o<this.bRows.length;o++)t=this.bRows[o].children[0],t.innerHTML="",o<e.rows.length&&(t.className="vtree",this.renderRowTreeCell(i,e.rows[o],t))}renderRowTreeCell(t,e,i){let o=this.bCache.get(t,e.index);if(!o){o=yt("div"),this.bCache.set(t,e.index,o);const n=e.height+1,r=this.treeHeaderWidth/this.model.maxRowLevel;if(e.hasChildren){const t=new hu;t.addEventListener("toggle",(()=>this.grid.rendering.toggleRow(e.index))),i.parentElement.expander=t,o.expander=t,o.appendChild(t),jt(t,{t:n/2-zx.EXPANDER_SIZE/2,l:e.level*r+r/2-zx.EXPANDER_SIZE/2});const s=this.createExpanderLine("v");o.appendChild(s),jt(s,{t:this.model.options.rowTree.reversed?0:n/2,l:e.level*r+r/2}),Dt(s,{w:r/2,h:n/2+1})}if(e.hasParent){let t=e;for(;t.hasParent;){t=t.parent;const e=this.createExpanderLine("v");o.appendChild(e),Dt(e,{w:r/2,h:n+2}),jt(e,{t:-1,l:t.level*r+r/2})}}}o.expander&&(o.expander.state=e.collapsed?"closed":"open"),i.appendChild(o)}};Bx.styles=[Dx],jx([Ss({type:Object})],Bx.prototype,"model",void 0),jx([Ss({type:Number,hasChanged:()=>!1})],Bx.prototype,"rowOffset",void 0),jx([Ss({type:Number,hasChanged:()=>!1})],Bx.prototype,"colOffset",void 0),jx([Ss({type:Number,reflect:!0})],Bx.prototype,"zoom",void 0),jx([Ss({type:Boolean,reflect:!0})],Bx.prototype,"nogrid",void 0),jx([Ss({type:Boolean,reflect:!0})],Bx.prototype,"renderAll",void 0),Bx=jx([Cs("og-table")],Bx);const Fx=["F5","F12"];class Wx extends Event{get selection(){return this.grid.selecting.selection}get activeCell(){return this.selection.activeCell}constructor(t,e){super(`grid.${t}`,{bubbles:!0,composed:!0}),Object.assign(this,e),this.cell&&(this.row=this.cell.row,this.column=this.cell.column)}}class Ux extends Wx{constructor(t){super("edit",t)}}class Gx extends Nu{constructor(t,e,i){super(`grid.${t}`,i),this.grid=e}}class Yx extends Gx{constructor(t,e,i,o){super(t,e,o),this.column=i}}class qx extends Gx{constructor(t,e,i,o){super(t,e,o),this.row=i}}class Zx{get model(){return this.grid.model}get selection(){return this.grid.selection}get table(){return this.grid.table}constructor(t){this.grid=t,this.clickDisabled=!1,this.editDisabled=!1,this.clicked=!1,this.startOffset={x:0,y:0},this.suspendClick=()=>this.clickDisabled=!0,this.resumeClick=(t=!1)=>{this.isSliding||(t?setTimeout((()=>this.clickDisabled=!1),100):this.clickDisabled=!1)},this._onKeyDown=t=>{switch(Fx.includes(t.key)||t.preventDefault(),t.key){case"Tab":t.preventDefault(),this.grid.selecting.shiftActiveCell(t.shiftKey?-1:1,!0);break;case"ArrowRight":this.grid.selecting.debounceMoveSelector(1,0);break;case"ArrowLeft":this.grid.selecting.debounceMoveSelector(-1,0);break;case"ArrowDown":this.grid.selecting.debounceMoveSelector(0,1);break;case"ArrowUp":this.grid.selecting.debounceMoveSelector(0,-1);break;case"PageUp":this.grid.selecting.debounceMoveSelector(0,-this.table.viewport.rows.length);break;case"PageDown":this.grid.selecting.debounceMoveSelector(0,this.table.viewport.rows.length);break;case"Home":this.grid.selecting.debounceMoveSelector(-this.selection.range.c1,t.ctrlKey?-this.selection.range.r1:0);break;case"End":this.grid.selecting.debounceMoveSelector(this.model.gridRange.c2-this.selection.range.c1,t.ctrlKey?this.model.gridRange.r2-this.selection.range.r1:0);break;case"Enter":this.grid.selecting.enter();break;case"Escape":this.grid.selecting.hideCopySelector();break;case"c":case"C":t.ctrlKey&&this.grid.editing.copySelection();break;case"v":case"V":t.ctrlKey&&this.grid.editing.paste();break;case"z":case"Z":if(!this.grid.options.undoRedo)return;t.ctrlKey&&this.grid.editing.undo();break;case"y":case"Y":if(!this.grid.options.undoRedo)return;t.ctrlKey&&this.grid.editing.redo();break;case"F2":t.preventDefault(),this.grid.editing.startEdit();break;case"Delete":t.preventDefault(),this.grid.objects.delete(),this.grid.editing.clearSelection();break;case"Backspace":t.preventDefault(),this.grid.editing.clearSelection()}1!=t.key.length||t.ctrlKey||this.grid.editing.startEdit(t.key)},this._onMouseMove=t=>{let e=!0;const i=this.grid.hSizer,o=this.grid.vSizer,{offsetX:n,offsetY:r}=t;let s=this.model.options.scrolling.scrollbarVisibilityTreshold;s<=0&&(s=Math.max(this.grid.clientWidth,this.grid.clientHeight)),n>this.grid.clientWidth-s?this.grid.vSlider.show():this.grid.vSlider.hide(),r>this.grid.clientHeight-s?this.grid.hSlider.show():this.grid.hSlider.hide();const[a,l]=this.table.findNearestTableCellByOffset(n,r);if(l&&"TH"==l.tagName&&(this.model.options.columnResize&&!i.resizing&&l.classList.contains("hlabel")?l.offsetWidth-t.offsetX+l.offsetLeft<zx.RESIZE_TRESHOLD?(i.snap(l,this.grid),this.grid.rendering.currentResizedColumn=this.model.columns[l.c]):kt(i):this.model.options.rowResize&&!o.resizing&&l.classList.contains("vlabel")&&(l.offsetHeight-t.offsetY+l.offsetTop<zx.RESIZE_TRESHOLD?(o.snap(l,this.grid),this.grid.rendering.currentResizedRow=this.model.rows[l.r]):kt(o))),a&&"TH"==a.tagName)this.grid.selecting.isSelecting&&(this.suspendClick(),this.grid.selecting.updateSelecting(a.c,a.r));else{if(a&&"TD"==a.tagName)if(this.grid.selecting.isSelectorOperationActive||this.grid.selecting.isFormulaSelectorOperationActive){const{top:e,left:i}=Ht(a,this.grid);this.grid.rendering.autoscroll({x:i-this.table.totalHeaderWidth+t.offsetX-a.offsetLeft,y:e-this.table.thead.clientHeight+t.offsetY-a.offsetTop}),this.grid.selecting.isSelecting&&this.suspendClick(),this.grid.selecting.updateSelecting(a.c,a.r)}else{const t=this.model.rows[a.r]?.cell(a.c);t&&t.hasTooltip&&(e=!1,this.grid.tooltip.attachToCell(a,t)),t&&t.hasComment&&(e=!1,this.grid.comment.attachedTo!==a&&this.grid.comment.attachTo(a,t))}e&&(this.grid.tooltip.deatach(),this.grid.comment.deatach(this.model.options.comments.hideTimeout)),kt(i),kt(o)}},this._onMouseDown=t=>{if(1&t.buttons){this.grid.setPointerCapture(t.pointerId),this.startOffset={x:t.offsetX,y:t.offsetY};for(const e of t.composedPath()){if("TD"==e.tagName){const t=e;this.grid.selecting.startCellSelecting(new Rv(t.c,t.r));break}if("TH"==e.tagName){const t=e;e.matches(".sort")?this.grid.sorting.sort(t.c):t.classList.contains("filter")?this.grid.filtering.openFilter(this.model.columns[t.c],t):t.classList.contains("hlabel")?this.grid.selecting.startColumnSelecting(t.c):t.classList.contains("vlabel")&&this.grid.selecting.startRowSelecting(t.r);break}}}},this._onMouseUp=t=>{if(0!=t.buttons)return;const e=Math.abs(this.startOffset.x-t.offsetX),i=Math.abs(this.startOffset.y-t.offsetY);Math.sqrt(Math.pow(e,2)+Math.pow(i,2))<this.model.options.events.click.mouseMoveTreshold&&this.resumeClick(),this.grid.releasePointerCapture(t.pointerId),this.grid.selecting.stopSelectOperations()},this._onClick=t=>{if(this.clickDisabled)return;if(this.grid.clientHeight-t.offsetY<this.grid.hSlider.offsetHeight)return;if(this.grid.clientWidth-t.offsetX<this.grid.vSlider.offsetWidth)return;const e=this.table.findTableCellByOffset(t.offsetX,t.offsetY),i="TD"==e?.tagName?this.model.rows[e.r]?.cell(e.c):null;this.grid.dispatchEvent(new Wx("click",{grid:this.grid,cell:i}))},this._onContextMenu=t=>{t.preventDefault();for(const e of t.composedPath())if("TD"==e.tagName){const i=e;this.grid.menus.openCellMenu(this.model.rows[i.r].cell(i.c),{x:t.pageX,y:t.pageY})}else if("TH"==e.tagName){const i=e;i.classList.contains("hlabel")?this.grid.menus.openColumnMenu(this.model.columns[i.c],{x:t.pageX,y:t.pageY}):i.classList.contains("vlabel")&&this.grid.menus.openRowMenu(this.model.rows[i.r],{x:t.pageX,y:t.pageY})}},this._onVerticalSlide=t=>{this.table.rowOffset=Math.min(t.value,this.model.visibleRows.length-1),this.grid.rendering.requireVerticalUpdate=!0,this.grid.rendering.renderCells()},this._onHorizontalSlide=t=>{this.table.colOffset=Math.min(t.value,this.model.visibleColumns.length-1),this.grid.rendering.requireHorizontalUpdate=!0,this.grid.rendering.renderCells()},this._onSlideStart=()=>{this.suspendClick()},this._onSlideStop=()=>{this.resumeClick(!0)},this._denbounceHorizontalScroll=Y((t=>this.grid.rendering.scrollHorizontalByPixels(t)),50),this._onWheel=t=>{t.ctrlKey||(0!=t.deltaY&&this.grid.rendering.scrollVerticalByPixels(t.deltaY),0!=t.deltaX&&this._denbounceHorizontalScroll(Math.sign(t.deltaX)*Math.min(100,Math.abs(t.deltaX))))},this._onTouchStart=t=>{this.grid.rendering.touchStartX=t.touches[0],this.grid.rendering.touchStartY=t.touches[0]},this._onTouchEnd=t=>{this.grid.rendering.touchStartX=t.touches[0],this.grid.rendering.touchStartY=t.touches[0]},this._onTouchMove=t=>{const e=this.grid.rendering;if(e.touchStartY){const i=e.touchStartY.clientY-t.touches[0].clientY;Math.abs(i)>this.model.options.rowHeight&&this.table.viewport.rows.length>0&&(e.scrollVerticalByPixels(i),e.touchStartY=t.touches[0])}if(e.touchStartX){const i=e.touchStartX.clientX-t.touches[0].clientX;Math.abs(i)>this.model.options.columnWidth&&this.table.viewport.columns.length>0&&(e.scrollHorizontalByPixels(i),e.touchStartX=t.touches[0])}},this._onHorizontalResizeStart=()=>{this.grid.rendering.resizing=!0,this.grid.rendering.currentResizedColumnWidth=this.grid.rendering.currentResizedColumn.width},this._onHorizontalResizeStop=t=>{this.suspendClick(),this.grid.rendering.resizing=!1,this.table.clearHeaderCache(),this.table.renderCells({horizontal:!0}),this.grid.dispatchEvent(new Yx("column.resize",this.grid,this.grid.rendering.currentResizedColumn,t))},this._onHorizontalResize=t=>{const e=this.grid.rendering;e.currentResizedColumn.width=e.currentResizedColumnWidth+t.deltaX,Dt(this.table.getColumnByModelIndex(e.currentResizedColumn.index),{w:e.currentResizedColumn.width},!0),this.grid.selecting.updateSelector()},this._onVerticalResizeStart=()=>{this.grid.rendering.resizing=!0,this.grid.rendering.currentResizedRowHeight=this.grid.rendering.currentResizedRow.height},this._onVerticalResizeStop=t=>{this.suspendClick(),this.grid.rendering.resizing=!1,this.table.clearBodyCache(),this.table.renderCells({vertical:!0}),this.grid.dispatchEvent(new qx("row.resize",this.grid,this.grid.rendering.currentResizedRow,t))},this._onVerticalResize=t=>{const e=this.grid.rendering;e.currentResizedRow.height=e.currentResizedRowHeight+t.deltaY,Dt(this.table.getRowByModelIndex(e.currentResizedRow.index),{h:e.currentResizedRow.height},!1),this.grid.selecting.updateSelector()},this._onCommentCommit=t=>{this.grid.model.comments.set(t.cell.address,t.items),t.cell.invalidateStyle(),this.grid.rendering.updateCells([t.cell])},this._onAutofill=t=>{if(this.suspendClick(),this.grid.selection.range.equals(t.selector.autofillRange))return;const{cells:e,oldValues:i}=rw(this.model,this.grid.selection.range,t.selector.autofillRange,t.selector.autofillDirection);this.grid.rendering.updateCells(e,!0),this.grid.selection.setRange(this.grid.selection.range.unite(t.selector.autofillRange)),this.grid.selecting.updateSelector(),this.grid.dispatchEvent(new Ux({grid:this.grid,editType:"autofill",cells:e,oldValues:i,newValues:e.map((t=>t.value2))}))},this._onEdit=t=>{if(t.fromHistory)return;const e=[],i=[],o=this.model.names.rangeMap;let n=[],r=[],s=[],a=[];switch(t.editType){case"value":n=t.newValues,r=t.newProps,s=t.oldValues,a=t.oldProps,t.cells.forEach((t=>{const n=t.address;e.push(n),i.push(o.get(n))}));break;case"insert_column":case"insert_row":t.newValues.forEach((t=>{const r=t.address;e.push(r),i.push(o.get(r)),n.push(t.getSourceData())}))}this.grid.history.push({type:t.editType,addresses:e,names:i,oldValues:s,oldProps:a,newValues:n,newProps:r})},this._onSelectorMove=t=>{this.suspendClick(),this.selection.setRange(t.toRange),t.fromRange.isRow?this.grid.editing.moveRows({index:t.fromRange.r1,count:t.fromRange.size.rows,targetIndex:t.toRange.r1}):t.fromRange.isColumn?this.grid.editing.moveColumns({index:t.fromRange.c1,count:t.fromRange.size.columns,targetIndex:t.toRange.c1}):console.log(t)},this._onMouseLeave=()=>{this.grid.rendering.hideSliders()},this.debounceHideSliders=Y((()=>this.grid.rendering.hideSliders()),1e3,{isImmediate:!1}),this._onRender=()=>{const t=this.grid;t.selecting.updateSelectors(),t.dispatchEvent(new Wx("render",{grid:this.grid})),t.adapter&&t.options.pageSize&&t.rendering.isLastRowInViewport()&&t.rendering.loadNextPage(),t.rendering.updateSliderVisibility(),this.model.options.scrolling.scrollbarVisibilityTreshold>0&&this.debounceHideSliders()},this._onHorizontalSizerDblClick=t=>{t.stopPropagation(),this.editDisabled=!0,this.grid.rendering.autofitColumn(this.grid.rendering.currentResizedColumn.index),this.grid.dispatchEvent(new Yx("column.resize",this.grid,this.grid.rendering.currentResizedColumn,t))},this._onVerticalSizerDblClick=t=>{t.stopPropagation(),this.editDisabled=!0,this.grid.rendering.autofitRow(this.grid.rendering.currentResizedRow.index),this.grid.dispatchEvent(new qx("row.resize",this.grid,this.grid.rendering.currentResizedRow,t))},this._onDblClick=()=>{this.editDisabled?this.editDisabled=!1:this.grid.editing.startEdit()}}get isSliding(){return this.grid.hSlider.sliding||this.grid.vSlider.sliding}async init(){await this.grid.updateComplete,await this.table.updateComplete;const t=this.grid;t.addEventListener("wheel",this._onWheel,{passive:!0}),t.addEventListener("touchstart",this._onTouchStart,{passive:!0}),t.addEventListener("touchend",this._onTouchEnd,{passive:!0}),t.addEventListener("touchmove",this._onTouchMove,{passive:!0}),t.hSizer.addEventListener("resizestart",this._onHorizontalResizeStart),t.hSizer.addEventListener("resizestop",this._onHorizontalResizeStop),t.hSizer.addEventListener("resize",this._onHorizontalResize),t.hSizer.addEventListener("dblclick",this._onHorizontalSizerDblClick),t.vSizer.addEventListener("resizestart",this._onVerticalResizeStart),t.vSizer.addEventListener("resizestop",this._onVerticalResizeStop),t.vSizer.addEventListener("resize",this._onVerticalResize),t.vSizer.addEventListener("dblclick",this._onVerticalSizerDblClick),t.comment.addEventListener("comment.commit",this._onCommentCommit),t.addEventListener("keydown",this._onKeyDown),t.addEventListener("click",this._onClick),t.addEventListener("contextmenu",this._onContextMenu),t.addEventListener("toggle",(()=>t.rendering.debounceCalculateViewport())),t.addEventListener("pointerup",this._onMouseUp),t.addEventListener("pointerdown",this._onMouseDown);const e=Y(this._onMouseMove,20,{maxWait:50,isImmediate:!0});t.addEventListener("pointermove",e),t.addEventListener("mouseleave",this._onMouseLeave),t.table.addEventListener("rendercells",this._onRender),t.selector.addEventListener("grid.selector.autofill",this._onAutofill),t.selector.addEventListener("grid.selector.move",this._onSelectorMove),t.addEventListener("dblclick",this._onDblClick),t.addEventListener("grid.edit",this._onEdit)}}class Xx{get vScrolling(){return this._vScrolling}get hScrolling(){return this._hScrolling}get model(){return this.grid.model}get selection(){return this.grid.selection}get table(){return this.grid.table}constructor(t){this.grid=t,this.requireVerticalUpdate=!0,this.requireHorizontalUpdate=!1,this.resizing=!1,this._vScrolling=!0,this._hScrolling=!0,this.debounceRenderCells=Y(this.renderCells,50,{isImmediate:!1,maxWait:100}),this.debounceCalculateViewport=Y(this.calculateViewport,200)}isLastRowInViewport(){const t=this.grid.table.viewport.rows,e=this.model.visibleRows;return t[t.length-1]==e[e.length-1]}renderCells(t){t=t||{vertical:this.requireVerticalUpdate,horizontal:this.requireHorizontalUpdate},this.grid.comment.deatach(),this.grid.table.renderCells(t),this.requireHorizontalUpdate=!1,this.requireVerticalUpdate=!1,this.debounceCalculateViewport(),this.grid.objects.updatePostions()}renderAll(t=!1){this.grid.group?this.grid.group.grids.forEach((e=>e.rendering.render(t))):this.render(t)}async render(t=!1){this.grid.table&&this.model&&(this.grid.table.clearHeaderCache(),this.grid.table.clearBodyCache(),this.grid.table.isConnected&&(t&&(this.grid.table.requestUpdate(),await this.grid.table.updateComplete),this.grid.table.renderCells({horizontal:!0,vertical:!0}),this.calculateViewport()))}updateRange(t,e=!1){for(const i of this.model.getRangeIterator(t))this.updateCells([i],e)}updateCell(t,e=!1){this.updateCells([t],e)}updateSpilledCells(t){let e;t.prevSpillRange&&(e=new Set,this.model.getRangeIterator(t.prevSpillRange).forEach((t=>e.add(t)))),t.spillRange&&(e=e||new Set,this.model.getRangeIterator(t.spillRange).forEach((t=>e.add(t)))),e?.size>0&&this.updateCells(e)}updateCells(t,e=!1){if(e)for(const e of t)e.invalidateStyle(),e.invalidateValue(),this.model.calculations.clearDependecies(e).evaluate(e),this.updateSpilledCells(e);const i=this.grid.table;for(const e of t)i.renderBodyCell(e);e&&(this.model.calculations.invalidateDependants(t).forEach(((t,e)=>{t?this.grid.group.getGrid(t)?.table.renderBodyCell(e):i.renderBodyCell(e),this.updateSpilledCells(e)})),this.grid.dispatchGridEvent("calculate",{cells:Array.from(t)}))}updateHeaders(){this.model.indexVisibleColumns(),this.table.clearHeaderCache(),this.table.createHeaderRows(),this.table.renderHeader()}calculateViewport(t=!1){this.grid.logger.info("calculate viwport"),this.updateCells(this.model.calculateViewport(),t)}updateSliders(){const t=this.table.viewportSize;this.grid.vSlider.maxValue=this.model.visibleRows.length,this.grid.vSlider.pageSize=t.h/this.model.options.rowHeight,this.grid.vSlider.value=this.table.rowOffset,this.grid.hSlider.maxValue=this.model.visibleColumns.length,this.grid.hSlider.pageSize=t.w/this.model.options.columnWidth,this.grid.hSlider.value=this.table.colOffset}isVerticalScrollingEnabled(){return!1!==this.grid.options.scrolling.verticalOverscroll||this.table.viewport.rows.length<this.model.visibleRows.length}isHorizontalScrollingEnabled(){return!1!==this.grid.options.scrolling.horizontalOverscroll||this.table.viewport.columns.length<this.model.visibleColumns.length}updateSliderVisibility(){this._vScrolling=this.isVerticalScrollingEnabled(),this._vScrolling?(this.grid.vSlider.show(),xt(this.grid.vSlider)):(this.grid.vSlider.hide(),kt(this.grid.vSlider)),this._hScrolling=this.isHorizontalScrollingEnabled(),this._hScrolling?(this.grid.hSlider.show(),xt(this.grid.hSlider)):(this.grid.hSlider.hide(),kt(this.grid.hSlider))}hideSliders(){this.grid.vSlider.hide(),this.grid.hSlider.hide()}scrollVerticalByPixels(t){if(!this.vScrolling)return;let e,i=this.table.rowOffset,o=0,n=0;if(t>0){for(;o<t&&i+n<this.model.visibleRows.length;)o+=this.model.visibleRows[i+n++].height+2;i+=n}else if(t<0){for(t=Math.abs(t);o<t&&i+n>=0;)e=this.model.visibleRows[Math.min(this.model.visibleRows.length-1,i+n--)],o+=(e?e.height:0)+2;i+=n}i>=this.model.visibleRows.length&&(i=this.model.visibleRows.length-1),this.requireVerticalUpdate=!0,this.table.rowOffset=Math.max(0,i),this.debounceRenderCells(),this.updateSliders()}scrollHorizontalByPixels(t){if(!this.hScrolling)return;let e=this.table.colOffset,i=0,o=0;if(t>0){for(;i<t&&e+o<this.model.visibleColumns.length;)i+=this.model.visibleColumns[e+o++].width+2;e+=o}else if(t<0){for(t=Math.abs(t);i<t&&e+o>=0;)i+=this.model.visibleColumns[Math.min(this.model.visibleColumns.length-1,e+o--)].width+2;e+=o}e>=this.model.visibleColumns.length&&(e=this.model.visibleColumns.length-1),this.requireHorizontalUpdate=!0,this.table.colOffset=Math.max(0,e),this.debounceRenderCells(),this.updateSliders()}updateCellSelectionRange(){const t=this.table;for(const e of this.model.getRangeIterator(this.selection.range,!1))t.renderBodyCell(e)}getAdapterRequestFilters(){return{offset:0,filter:this.grid.filtering?.filter?Array.from(this.grid.filtering.filter.settings.values()):null,order:this.grid.model?.sorting?.settings}}async toggleRow(t,e=!0){const i=this.model.rows[t];if(i.isLoaded||i.isPartialyLoaded)i.toggleCollapse(!1,this.model.options.unhideRowAfterExpand),this.table.renderCells({vertical:!0});else if(this.grid.adapter){const e=this.table.getRowByModelIndex(t);e&&e.expander&&(e.expander.state="waiting"),i.collapsed=!1;const o=Object.assign(this.getAdapterRequestFilters(),{parent:{r:i.index,props:i.properties}}),[n]=await Promise.all([this.grid.adapter.getRows(o)]);this.model.insertRowData(i,0,n),o.rows=n;const[r]=await Promise.all([this.grid.adapter.getCells(o)]);r?.map((t=>this.model.getCellByCoords(t.r,t.c)?.update(t))),this.table.requestUpdate()}this.updateSliders(),e&&this.grid.dispatchEvent(new Wx("row.toggle",{grid:this.grid,row:i}))}toggleColumn(t,e=!0){const i=this.model.columns[t];i.toggleCollapse(!1,this.model.options.unhideColumnAfterExpand),this.table.renderCells({horizontal:!0}),this.updateSliders(),e&&this.grid.dispatchEvent(new Wx("column.toggle",{grid:this.grid,column:i}))}setRowExpandLevel(t){this.model.setRowExpandLevel(t),this.table.rowOffset=0,this.table.renderCells({vertical:!0}),this.updateSliders(),this.grid.dispatchEvent(new Wx("row.toggle",{grid:this.grid}))}setColumnExpandLevel(t){this.model.setColumnExpandLevel(t),this.table.colOffset=0,this.table.renderCells({horizontal:!0}),this.updateSliders(),this.grid.dispatchEvent(new Wx("column.toggle",{grid:this.grid}))}async exportHTML(){const t=yt("div");kt(t),document.body.appendChild(t);const e=yt("og-table");e.grid=this.grid,e.model=this.model,e.renderAll=!0,t.appendChild(e),await e.updateComplete;const i=this.model.options?.print?.rowBreaks,o=e.table,n=i&&i.length>0;if(n){const t=o.querySelector("colgroup"),n=[...o.tBodies[0].rows],r=this.model.options?.print?.rowTitles?Rv.fromA1(this.model.options?.print?.rowTitles):null,s=r?Array.from({length:r.r2-r.r1+1},((t,i)=>n[e.rowMap.get(r.r1+i)])):[];for(let o=0;o<i.length;o++){const r=yt("table");r.appendChild(t.cloneNode(!0));const a=yt("tbody");r.appendChild(a);const l=e.rowMap.get(i[o]),c=o<i.length-1?e.rowMap.get(i[o+1]):this.model.visibleRows.length-1;s.forEach((t=>a.appendChild(t.cloneNode(!0))));for(let t=l;t<=c;t++)a.appendChild(n[t]);e.shadowRoot.appendChild(r)}t.cloneNode(!0)}const r=`\n\t\t\t<style>\n\t\t\t\thtml {\n\t\t\t\t\t${_a(Ta().themes.get("light")).cssText}\n\t\t\t\t}\n\t\t\t\t${n?"table {break-after: page}":""}\n\t\t\t\t${Bx.styles.map((t=>t.cssText)).join("\n")}\n\t\t\t</style>\n\n\t\t`,s=r+e.shadowRoot.innerHTML.replace(/<!---->/g,"");return t.remove(),s}stopAutoscroll(){this.autoscrollTimer&&window.clearInterval(this.autoscrollTimer)}startAutoscroll(){this.stopAutoscroll(),this.autoscrollTimer=window.setInterval((()=>{if(0==this.autoscrollValue)return this.stopAutoscroll();const t=Math.pow(this.autoscrollValue,lv.AUTOSCROLL_RATIO);switch(this.autoscrollDirection){case"down":this.scrollVerticalByPixels(t);break;case"up":this.scrollVerticalByPixels(-t);break;case"left":this.scrollHorizontalByPixels(-t);break;case"right":this.scrollHorizontalByPixels(t)}}),lv.AUTOSCROLL_INTERVAL)}autoscroll(t){const{x:e,y:i}=t,o=this.table.clientWidth/this.table.zoom-this.table.totalHeaderWidth,n=this.table.clientHeight/this.table.zoom-this.table.totalHeaderHeight;let r,s=0;e<lv.AUTOSCROLL_TRESHOLD&&e<i&&e<n-i?(r="left",s=lv.AUTOSCROLL_TRESHOLD-e):o-e<lv.AUTOSCROLL_TRESHOLD&&o-e<i&&o-e<n-i?(r="right",s=lv.AUTOSCROLL_TRESHOLD-o+e):i<lv.AUTOSCROLL_TRESHOLD?(r="up",s=lv.AUTOSCROLL_TRESHOLD-i):n-i<lv.AUTOSCROLL_TRESHOLD&&(r="down",s=lv.AUTOSCROLL_TRESHOLD-n+i),this.autoscrollDirection=r,this.autoscrollValue=s,this.stopAutoscroll(),s>0&&this.startAutoscroll()}async load(t){t=t||this.getAdapterRequestFilters();const e=t.parent?.r??null,i=null!=e?this.model.rows[e]:this.model.rowRoot,[o]=await Promise.all([this.grid.adapter.getRows(t)]);o.length>0&&null===e&&this.model.insertRowData(i,t.offset,o);const[n]=await Promise.all([this.grid.adapter.getCells(t)]);n?.map((t=>this.model.getCellByCoords(t.r,t.c)?.update(t))),this.table.requestUpdate(),o.length>=this.model.options.pageSize?i.count=1/0:i.count=i.children.length,this.grid.logger.info(`loaded ${o.length} rows`),this.grid.loading=!1,this.grid.dispatchEvent(new Wx("afterLoad",{grid:this.grid}))}async loadNextPage(t=null,e=!1){if(this.grid.loading)return;const i=null!=t?this.model.rows[t]:this.model.rowRoot;if(!e&&i.isLoaded)return;this.grid.dispatchEvent(new Wx("beforeLoad",{grid:this.grid})),this.grid.loading=!0;const o=this.model.rows.length;this.grid.logger.info(`loading rows offset = ${o}`),await this.load(Object.assign(this.getAdapterRequestFilters(),{offset:o,parent:{r:t,props:null}}))}get totalSize(){return{width:this.table.totalHeaderWidth+this.model.visibleColumns.reduce(((t,e)=>t+e.width),0),height:this.table.thead.offsetHeight+this.model.visibleRows.reduce(((t,e)=>t+e.height),0)}}autofitColumn(t,e=!1,i=!0){const o="number"==typeof t?this.model.columns[t]:t,n=this.autofitDiv??(this.autofitDiv=yt("div"));n.style.position="absolute",n.style.zIndex="100000",jt(n,{l:-1e3,t:-1e3}),this.grid.shadowRoot.appendChild(n);let r=0;for(const t of this.model.getRangeIterator(Rv.fromA1(o.address),!!e)){const e=hC(t).call(this.table,n,t)||n;e.style.width="auto",r=Math.max(r,e.offsetWidth)}o.width=r+10,i&&this.table.renderCells({horizontal:!0})}autofitColumns(t=!1){this.model.columns.forEach((e=>this.autofitColumn(e,t,!1))),this.table.renderCells({horizontal:!0})}autofitRow(t,e=!1,i=!0){const o="number"==typeof t?this.model.rows[t]:t,n=this.autofitDiv??(this.autofitDiv=yt("div"));n.style.position="absolute",n.style.zIndex="100000",jt(n,{l:-1e3,t:-1e3}),this.grid.shadowRoot.appendChild(n);let r=0;for(const t of this.model.getRangeIterator(Rv.fromA1(o.address),!!e)){const e=hC(t).call(this.table,n,t)||n;e.style.height="auto",r=Math.max(r,e.offsetHeight)}o.height=r+8,i&&this.table.renderCells({vertical:!0})}autofitRows(t=!1){this.model.rows.forEach((e=>this.autofitRow(e,t,!1))),this.table.renderCells({vertical:!0})}scrollTo(t,e=0){let i;i=Q(t)?Rv.fromA1(t):new Rv(e,t),this.table.rowOffset=i.r1,this.table.colOffset=i.c1,this.requireVerticalUpdate=!0,this.requireHorizontalUpdate=!0,this.debounceRenderCells(),this.updateSliders()}}class Qx{get model(){return this.grid.model}get selection(){return this.grid.editing.isFormulaMode?this.formulaSelection:this.grid.selection}get selector(){return this.grid.editing.isFormulaMode?this.grid.formulaSelector:this.grid.selector}get formulaSelection(){return this._formulaSelection}get events(){return this.grid.events}get table(){return this.grid.table}get isSelecting(){return this.isCellSelecting||this.columnSelecting||this.rowSelecting}get isCellSelecting(){return this.selector.isSelecting}get isAutofilling(){return this.selector.isAutofilling}get isMoving(){return this.selector.isMoving}get isSelectorOperationActive(){return this.selector.isSelectorOperationActive}get isFormulaSelectorOperationActive(){if(!this.grid.editing.isFormulaMode)return!1;for(const t of this.formulaSelectors.values())if(t.isSelectorOperationActive)return!0;return!1}get activeCell(){const{c:t,r:e}=this.selection.activeCellCoords;return this.model.rows[e]?.cell(t)}constructor(t){this.grid=t,this.columnSelecting=!1,this.rowSelecting=!1,this._formulaSelection=new Ex(0,0,0,0),this.formulaSelectors=new Map,this.debounceMoveSelector=Y(((t,e)=>this.moveSelector(t,e)),10)}moveToSelection(){const t=new Rv(this.selection.range.c1,this.selection.range.r1);this.table.viewportRange.contains(t)}select(t,e=!1){this.selection.setRange(t),this.updateSelector(),e&&this.grid.dispatchEvent(new Wx("select",{grid:this.grid}))}startCellSelecting(t){this.grid.style.cursor="cell",this.startSelectingRange=t.clone(),this.select(t,!0),this.selector.startSelecting(t)}startColumnSelecting(t){this.columnSelecting=!0;const e=new Rv(t,null,t,null);this.startSelectingRange=e.clone(),this.select(e,!0)}startRowSelecting(t){this.rowSelecting=!0;const e=new Rv(null,t,null,t);this.startSelectingRange=e.clone(),this.select(e,!0)}updateSelecting(t,e){const i=this.model.options.selecting.multiSelect;(this.isCellSelecting||this.rowSelecting)&&(i||(this.selection.range.r1=e),this.selection.range.r2=e),(this.isCellSelecting||this.columnSelecting)&&(i||(this.selection.range.c1=t),this.selection.range.c2=t),this.grid.editing.isFormulaMode?(this.updateFormulaSelector(),this.formulaSelectors.forEach((i=>i.updateMovingOperations(t,e)))):(this.updateSelector(),this.hideFormulaSelector(),this.selector.updateMovingOperations(t,e))}stopSelecting(){this.grid.rendering.stopAutoscroll(),this.isSelecting&&!this.selection.range.equals(this.startSelectingRange)&&this.grid.dispatchEvent(new Wx("select",{grid:this.grid})),this.columnSelecting=!1,this.rowSelecting=!1,this.startSelectingRange=null,this.selector.stopSelectorOperations()}highlightSelection(){const t=this.selection.range,[e,i]=[Math.min(t.c1,t.c2),Math.max(t.c1,t.c2)],[o,n]=[Math.min(t.r1,t.r2),Math.max(t.r1,t.r2)],r=i-e+1,s=n-o+1;this.table.highlightColHeaderCells(r<1/0?Array.from(new Array(r),((t,i)=>i+e)):[]),this.table.highlightRowHeaderCells(s<1/0?Array.from(new Array(s),((t,e)=>e+o)):[])}updateSelector(t=!0){this.model.options.selecting.enabled?(this.showSelector(t),this.highlightSelection()):this.hideSelector(),this.grid.editing.isFormulaMode||this.grid.editing.endEdit()}showSelector(t=!0){this.selector&&(this.selector.show(),this.selector.select(this.selection.range,t))}hideSelector(){this.selector.hide()}moveSelector(t,e){if(this.selection.move(t,e,this.model.columns.length,this.model.rows.length),0!=e&&!this.model.rows[this.selection.range.r1].visible){const t=e>0?this.model.rows[this.selection.range.r1].nextVisible:this.model.rows[this.selection.range.r1].prevVisible;t&&(this.selection.range.r1=t.index,this.selection.range.r2=t.index)}if(0!=t&&!this.model.columns[this.selection.range.c1].visible){const e=t>0?this.model.columns[this.selection.range.c1].nextVisible:this.model.columns[this.selection.range.c1].prevVisible;e&&(this.selection.range.c1=e.index,this.selection.range.c2=e.index)}this.selector.selection=this.selection.range,this.selector.updatePosition();const i={c:0,r:0};(e>0&&this.selector.offsetTop+this.selector.offsetHeight>this.grid.clientHeight||e<0&&this.selector.offsetTop<this.table.totalHeaderHeight-1||e>=this.table.viewport.rows.length)&&(i.r+=e),(t>0&&this.selector.offsetLeft+this.selector.offsetWidth>this.grid.clientWidth||t<0&&this.selector.offsetLeft<this.table.totalHeaderWidth-1)&&(i.c+=t),0==i.c&&0==i.r||(this.table.colOffset=Math.max(0,this.table.colOffset+i.c),this.table.rowOffset=Math.min(Math.max(0,this.table.rowOffset+i.r),this.model.visibleRows.length-1),this.table.renderCells({horizontal:0!=i.c,vertical:0!=i.r}),this.grid.rendering.updateSliders()),this.grid.editing.isFormulaMode||this.grid.editing.endEdit(),this.highlightSelection(),this.grid.dispatchEvent(new Wx("select",{grid:this.grid}))}shiftActiveCell(t,e=!1){this.selection.moveActiveCell(t,0),this.selector.updatePosition(),e&&this.grid.dispatchEvent(new Wx("select",{grid:this.grid}))}updateFormulaSelector(t=!0){this.grid.editing.isFormulaMode?this.showFormulaSelector(t):this.hideFormulaSelector()}showFormulaSelector(t=!0){this.grid.formulaSelector.show(),this.grid.formulaSelector?.select(this.formulaSelection.range,t)}hideFormulaSelector(){this.grid.formulaSelector.hide()}updateFormulaSelectors(){this.formulaSelectors.forEach((t=>t.updatePosition()))}highlightColorItem(t){const e=Ex.fromRange(Rv.fromA1(t.address)),i=yt("og-selector");this.grid.shadowRoot.appendChild(i),i.addEventListener("grid.selector.move",(t=>this.select(t.selector.selection.clone()))),i.addEventListener("grid.selector.resize",(t=>this.select(t.selector.selection.clone()))),i.grid=this.grid,i.color=t.color,i.subselector=!1,i.movable=!0,i.resizable=!0,i.index=t.tokenIndex,this.formulaSelectors.set(t.tokenIndex,i),i.select(e.range.clone(),!1),i.show()}highlightFormula(t){this.removeFormulaHighlight(),this.formulaSelectors.clear();const e=new Set;t.colors.forEach((t=>{if(null==t.sheet||t.sheet==this.model.name)this.highlightColorItem(t);else if(this.grid.group){const i=this.grid.group.getGrid(t.sheet);if(!i)return;e.has(i)||(e.add(i),i.selecting.removeFormulaHighlight()),i.isConnected&&i.selecting.highlightColorItem(t)}}))}removeFormulaHighlight(){this.formulaSelectors?.forEach((t=>Et(t))),this.formulaSelectors.clear()}updateCopySelector(){this.grid.copySelector.isVisible&&this.grid.copySelector.updatePosition()}showCopySelector(){this.grid.copySelector.show(),this.grid.copySelector?.select(this.selection.range.clone(),!1)}hideCopySelector(){this.grid.copySelector.hide()}updateSelectors(){this.updateSelector(!1),this.updateCopySelector(),this.updateFormulaSelectors()}stopSelectOperations(){this.stopSelecting(),this.formulaSelectors.forEach((t=>t.stopSelectorOperations())),this.grid.style.removeProperty("cursor")}enter(){const t=this.grid.group;if(this.grid.editing.isFormulaMode&&t){const e=t.formulaModeGrid;e.editing.commitEdit(),t.activateGrid(e.model.name)}else this.debounceMoveSelector(0,1)}}class Kx extends Event{}class Jx extends xs{get isOpen(){return this._open}get isValid(){return this._valid}validate(){return this._valid=!0,this.activeCell&&(this._valid=aw(this.activeCellModel,this.getValue())),this.classList.toggle("invalid",!this._valid),this._valid}constructor(){super(),this.cancel=!1,this._open=!1,this._valid=!0,this.init()}getDisplayValue(){return null}init(){this.addEventListener("keydown",(t=>{"Enter"==t.key?this.close():"Escape"==t.key?(this.cancel=!0,this.close()):t.stopPropagation()}))}connectedCallback(){super.connectedCallback(),this.performUpdate()}alignWithCell(){if(!this.activeCell)return;const t=Ht(this.activeCell,this.grid);jt(this,{t:t.top*this.grid.zoom,l:t.left*this.grid.zoom}),Dt(this,{w:this.activeCell.offsetWidth,h:this.activeCell.offsetHeight})}open(t,e=null,i=!0){this._valid=!0,this.initialValue=e,this._open=!0,this.grid=t;const o=t.selecting.activeCell;return this.activeCellModel=o,this.activeCell=this.grid.table.getCellByModelIndex(o.c,o.r),this.grid.selector.hide(),xt(this),i&&this.alignWithCell(),this.activate(o),null!==e&&this.setValue(e),Qt(this,this.grid.zoom),this}commit(){this._open&&!this.cancel&&this.activeCellModel&&(this.grid.editing.updateCell(this.activeCellModel,{v:this.getValue(),dv:this.getDisplayValue()}),this.grid.rendering.updateCell(this.activeCellModel,!0)),this.cancel=!1}close(){this._open&&(this.deactivate(),kt(this),this.grid.table.renderBodyCell(this.activeCellModel),this.grid.selecting.showSelector(),this.grid.focus(),this._open=!1,this.grid.editing.endEdit()),this.cancel=!1}activate(t){this.activeCellModel=t,this.dispatchEvent(new Kx("activate"))}deactivate(){this.dispatchEvent(new Kx("deactivate"))}}Jx.baseStyles=fr`
|
|
3266
3285
|
* { box-sizing: border-box }
|
|
3267
3286
|
|
|
3268
3287
|
:host {
|
|
@@ -8473,4 +8492,4 @@ milkdown-block-handle {
|
|
|
8473
8492
|
`:null}
|
|
8474
8493
|
</div>
|
|
8475
8494
|
</og-panel>
|
|
8476
|
-
`:null,this.addEventListener("mousedown",(t=>t.stopPropagation()))}getTypeIndex(t){const e=this.types.findIndex((e=>e.type==t.type&&e.grouping==(t.grouping||"standard")));return e>-1?e:null}updateModel(){if(this.editTitle=!1,!this.model)return;this.titleInput&&(this.model.title=this.titleInput.value);const t=this.types[this.typeList.value];this.model.type=t.type,this.model.grouping=t.grouping,this.model.categoriesRange=this.categoryRangeInput?.value?Rv.fromA1(this.categoryRangeInput.value):null,this.model.seriesRange=this.seriesRangeInput?.value?Rv.fromA1(this.seriesRangeInput.value):null,this.model.dataRange=Rv.fromA1(this.dataRangeInput.value),this.dispatchEvent(new qn({value:this.model}))}async updated(){this.editTitle&&this.titleInput&&(await this.titleInput.updateComplete,this.titleInput.focus(),this.titleInput.selectAll())}};nR.styles=[iR],oR([Ss({type:Object})],nR.prototype,"model",void 0),oR([Es()],nR.prototype,"editTitle",void 0),oR([Rs("#title")],nR.prototype,"titleInput",void 0),oR([Rs("#type")],nR.prototype,"typeList",void 0),oR([Rs("#dataRange")],nR.prototype,"dataRangeInput",void 0),oR([Rs("#seriesRange")],nR.prototype,"seriesRangeInput",void 0),oR([Rs("#categoryRange")],nR.prototype,"categoryRangeInput",void 0),nR=oR([Cs("og-plugin-chart-form")],nR);const rR=Ta().themes.get("dark");Object.assign(rR.definition,{"highcharts-title-font-size":"16px","highcharts-subtitle-font-size":"14px","highcharts-color-0":"#2caffe","highcharts-color-1":"#544fc5","highcharts-color-2":"#00e272","highcharts-color-3":"#fe6a35","highcharts-color-4":"#6b8abc","highcharts-color-5":"#d568fb","highcharts-color-6":"#2ee0ca","highcharts-color-7":"#fa4b42","highcharts-color-8":"#feb56a","highcharts-color-9":"#91e8e1","highcharts-background-color":"rgb(48, 48, 48)","highcharts-neutral-color-100":"rgb(255, 255, 255)","highcharts-neutral-color-80":"rgb(214, 214, 214)","highcharts-neutral-color-60":"rgb(173, 173, 173)","highcharts-neutral-color-40":"rgb(133, 133, 133)","highcharts-neutral-color-20":"rgb(92, 92, 92)","highcharts-neutral-color-10":"rgb(71, 71, 71)","highcharts-neutral-color-5":"rgb(61, 61, 61)","highcharts-neutral-color-3":"rgb(57, 57, 57)","highcharts-highlight-color-100":"rgb(122, 167, 255)","highcharts-highlight-color-80":"rgb(108, 144, 214)","highcharts-highlight-color-60":"rgb(94, 121, 173)","highcharts-highlight-color-20":"rgb(65, 74, 92)","highcharts-highlight-color-10":"rgb(58, 63, 71)"});const sR=Ta().themes.get("light");Object.assign(sR.definition,{"highcharts-title-font-size":"16px","chart-background-color":"#2a2a2b","highcharts-color-0":"#2caffe","highcharts-color-1":"#544fc5","highcharts-color-2":"#00e272","highcharts-color-3":"#fe6a35","highcharts-color-4":"#6b8abc","highcharts-color-5":"#d568fb","highcharts-color-6":"#2ee0ca","highcharts-color-7":"#fa4b42","highcharts-color-8":"#feb56a","highcharts-color-9":"#91e8e1","highcharts-background-color":"#ffffff","highcharts-neutral-color-100":"#000000","highcharts-neutral-color-80":"#333333","highcharts-neutral-color-60":"#666666","highcharts-neutral-color-40":"#999999","highcharts-neutral-color-20":"#cccccc","highcharts-neutral-color-10":"#e6e6e6","highcharts-neutral-color-5":"#f2f2f2","highcharts-neutral-color-3":"#f7f7f7","highcharts-highlight-color-100":"#0022ff","highcharts-highlight-color-80":"#334eff","highcharts-highlight-color-60":"#667aff","highcharts-highlight-color-20":"#ccd3ff","highcharts-highlight-color-10":"#e6e9ff","highcharts-positive-color":"#06b535","highcharts-negative-color":"#f21313","highcharts-annotation-color-0":"rgba(130, 170, 255, 0.4)","highcharts-annotation-color-1":"rgba(139, 191, 216, 0.4)","highcharts-annotation-color-2":"rgba(150, 216, 192, 0.4)","highcharts-annotation-color-3":"rgba(156, 229, 161, 0.4)","highcharts-annotation-color-4":"rgba(162, 241, 130, 0.4)","highcharts-annotation-color-5":"rgba(169, 255, 101, 0.4)"});var aR=i(2439),lR=i(8022),cR=i(6158),hR=i(127),dR=i(4505),uR=i(8659),pR=i(397),gR=i(930),mR=i(9723),fR=i(6343),vR=i(4582),bR=i(6127),yR=i(8238),wR=i(7362),xR=i(452),kR=i(5390),CR=i(3368),MR=i(6288),_R=i(7513),SR=i(1386),ER=i(5764),zR=i(1261),RR=i(3071),IR=i(3285),LR=i(2356),HR=i(6780),TR=i(8542),AR=i(8385),OR=i(1025),$R=i(2034),DR=i(8113),NR=i(1821),PR=i(7212),jR=i(2583),VR=i(5360),BR=i(2377),FR=i(2864),WR=i(7998),UR=i(4101),GR=i(7813),YR=i(5037),qR=i(7005),ZR=i(9626),XR=i(9517),QR=i(1504),KR=i(3838),JR=i(4935),tI=i(7699),eI=i(3322),iI=i(5757),oI=i(536),nI=i(1673),rI=i(8736),sI=i(196),aI=i(5133),lI=i(6092),cI=i(791),hI=i(5927),dI=i(1802),uI=i(9511),pI=i(6267),gI=i(1072),mI=i(4331),fI=i(8644),vI=i(2704),bI=i(2419),yI=i(6363),wI=i(5236),xI=i(3499),kI=i(3811),CI=i(1953),MI=i(4729),_I=i(8964),SI=i(8540),EI=i(8752),zI=i(8783),RI=i(8270),II=i(7261),LI=i(9231),HI=i(4555),TI=i(5293),AI=i(6981),OI=i(5268),$I=i(2680),DI=i(789),NI=i(4373),PI=i(436),jI=i(8573),VI=i(1808),BI=i(3247),FI=i(5143),WI=i(2415),UI=i(2561),GI=i(5726),YI=i(7436),qI=i(4201),ZI=i(8248),XI=i(6433),QI=i(2698),KI=i(979),JI=i(9358),tL=i(9176),eL=i(1239),iL=i(4218),oL=i(8377),nL=i(3740),rL=i(5379),sL=i(9974),aL=i(8955),lL=i(3559),cL=i(809),hL=i(8014),dL=i(8265),uL=i(3300),pL=i(8724),gL=i(8033),mL=i(7700),fL=i(5741),vL=i(3478),bL=i(512),yL=i(499),wL=i(8680),xL=i(9646),kL=i(9432),CL=i(2841),ML=i(75),_L=i(9256),SL=i(444),EL=i(5633),zL=i(3788),RL=i(3573),IL=i(9948),LL=i(1836),HL=i(7029),TL=i(8532),AL=i(6639),OL=i(1633),$L=i(9805),DL=i(2171),NL=i(875),PL=i(9595),jL=i(3894),VL=i(2803),BL=i(7765),FL=i(8804),WL=i(8654),UL=i(257),GL=i(5844),YL=i(9651),qL=i(760),ZL=i(9518),XL=i(4585),QL=i(1769),KL=i(643),JL=i(5156),tH=i(822),eH=i(8249),iH=i(3434),oH=i(9314),nH=i(3093),rH=i(7721),sH=i(588),aH=i(7645),lH=i(7148),cH=i(6795),hH=i(7047),dH=i(9428),uH=i(1879),pH=i(9779),gH=i(2476),mH=i(9648),fH=i(2896),vH=i(6817),bH=i(5196),yH=i(2762),wH=i(5981),xH=i(9014),kH=i(2611),CH=i(7946),MH=i(6301),_H=i(8020),SH=i(3987),EH=i(3192),zH=i(8796),RH=i(2489),IH=i(7324),LH=i(6069),HH=i(4155),TH=i(6977),AH=i(8055),OH=i(2653),$H=i(9492),DH=i(4334),NH=i(6804),PH=i(9954),jH=i(2211),VH=i(5211),BH=i(1519),FH=i(6204),WH=i(5501),UH=i(5244),GH=i(9742),YH=i(1552),qH=i(1330),ZH=i(2596),XH=i(5184),QH=i(7675),KH=i(1513),JH=i(9396),tT=i(7673),eT=i(244),iT=i(1187),oT=i(1736),nT=i(4390),rT=i(7106),sT=i(2096),aT=i(9991),lT=i(5629),cT=i(3386),hT=i(6651),dT=i(1684),uT=i(3849),pT=i(2582),gT=i(8569),mT=i(2955),fT=i(9100),vT=i(7381),bT=i(9190),yT=i(4071),wT=i(8e3),xT=i(4633),kT=i(4374),CT=i(486),MT=i(3680),_T=i(9999),ST=i(2830),ET=i(5255),zT=i(6021),RT=i(2214),IT=i(8497),LT=i(2052),HT=i(5327),TT=i(8701),AT=i(8722),OT=i(7325),$T=i(2445);const DT=[aR.mw,lR.mw,cR.mw,hR.mw,dR.mw,uR.mw,pR.mw,gR.mw,mR.mw,vR.mw,fR.mw,bR.mw,yR.mw,wR.mw,xR.mw,kR.mw,CR.mw,MR.mw,_R.mw,SR.mw,ER.mw,zR.mw,RR.mw,IR.mw,LR.mw,HR.mw,TR.mw,AR.mw,OR.mw,DR.mw,NR.mw,PR.mw,jR.mw,VR.mw,BR.mw,FR.mw,WR.mw,UR.mw,GR.mw,YR.mw,qR.mw,ZR.mw,QR.mw,XR.mw,KR.mw,JR.mw,tI.mw,eI.mw,iI.mw,oI.mw,nI.mw,rI.mw,sI.mw,aI.mw,lI.mw,cI.mw,dI.mw,uI.mw,pI.mw,gI.mw,mI.mw,fI.mw,vI.mw,bI.mw,yI.mw,wI.mw,xI.mw,kI.mw,CI.mw,MI.mw,_I.mw,SI.mw,EI.mw,zI.mw,RI.mw,hI.mw,II.mw,LI.mw,HI.mw,TI.mw,AI.mw,OI.mw,$I.mw,DI.mw,NI.mw,PI.mw,jI.mw,VI.mw,BI.mw,FI.mw,WI.mw,UI.mw,GI.mw,YI.mw,qI.mw,ZI.mw,XI.mw,QI.mw,KI.mw,JI.mw,tL.mw,eL.mw,iL.mw,oL.mw,nL.mw,rL.mw,sL.mw,aL.mw,lL.mw,cL.mw,hL.mw,dL.mw,uL.mw,pL.mw,gL.mw,mL.mw,fL.mw,$R.mw,vL.mw,bL.mw,yL.mw,wL.mw,xL.mw,kL.mw,CL.mw,ML.mw,_L.mw,SL.mw,EL.mw,zL.mw,RL.mw,IL.mw,HL.mw,LL.mw,AL.mw,TL.mw,OL.mw,$L.mw,DL.mw,NL.mw,PL.mw,jL.mw,VL.mw,BL.mw,FL.mw,qL.mw,ZL.mw,XL.mw,QL.mw,KL.mw,JL.mw,tH.mw,iH.mw,oH.mw,nH.mw,cH.mw,hH.mw,dH.mw,uH.mw,pH.mw,gH.mw,mH.mw,fH.mw,WL.mw,UL.mw,YL.mw,GL.mw,vH.mw,bH.mw,yH.mw,wH.mw,xH.mw,kH.mw,CH.mw,MH.mw,rH.mw,sH.mw,aH.mw,lH.mw,SH.mw,EH.mw,zH.mw,RH.mw,IH.mw,LH.mw,HH.mw,TH.mw,AH.mw,OH.mw,$H.mw,DH.mw,NH.mw,PH.mw,jH.mw,VH.mw,BH.mw,FH.mw,WH.mw,_H.mw,UH.mw,GH.mw,YH.mw,qH.mw,ZH.mw,XH.mw,QH.mw,KH.mw,JH.mw,tT.mw,eT.mw,iT.mw,oT.mw,nT.mw,rT.mw,sT.mw,aT.mw,lT.mw,cT.mw,hT.mw,dT.mw,uT.mw,pT.mw,gT.mw,mT.mw,fT.mw,vT.mw,bT.mw,yT.mw,wT.mw,xT.mw,kT.mw,CT.mw,MT.mw,_T.mw,ST.mw,ET.mw,zT.mw,RT.mw,IT.mw,LT.mw,eH.mw,HT.mw,TT.mw,AT.mw,OT.mw,$T.mw],NT={xlsx:V,charts:B},PT={name:"@omegagrid/bundle",version:"0.6.
|
|
8495
|
+
`:null,this.addEventListener("mousedown",(t=>t.stopPropagation()))}getTypeIndex(t){const e=this.types.findIndex((e=>e.type==t.type&&e.grouping==(t.grouping||"standard")));return e>-1?e:null}updateModel(){if(this.editTitle=!1,!this.model)return;this.titleInput&&(this.model.title=this.titleInput.value);const t=this.types[this.typeList.value];this.model.type=t.type,this.model.grouping=t.grouping,this.model.categoriesRange=this.categoryRangeInput?.value?Rv.fromA1(this.categoryRangeInput.value):null,this.model.seriesRange=this.seriesRangeInput?.value?Rv.fromA1(this.seriesRangeInput.value):null,this.model.dataRange=Rv.fromA1(this.dataRangeInput.value),this.dispatchEvent(new qn({value:this.model}))}async updated(){this.editTitle&&this.titleInput&&(await this.titleInput.updateComplete,this.titleInput.focus(),this.titleInput.selectAll())}};nR.styles=[iR],oR([Ss({type:Object})],nR.prototype,"model",void 0),oR([Es()],nR.prototype,"editTitle",void 0),oR([Rs("#title")],nR.prototype,"titleInput",void 0),oR([Rs("#type")],nR.prototype,"typeList",void 0),oR([Rs("#dataRange")],nR.prototype,"dataRangeInput",void 0),oR([Rs("#seriesRange")],nR.prototype,"seriesRangeInput",void 0),oR([Rs("#categoryRange")],nR.prototype,"categoryRangeInput",void 0),nR=oR([Cs("og-plugin-chart-form")],nR);const rR=Ta().themes.get("dark");Object.assign(rR.definition,{"highcharts-title-font-size":"16px","highcharts-subtitle-font-size":"14px","highcharts-color-0":"#2caffe","highcharts-color-1":"#544fc5","highcharts-color-2":"#00e272","highcharts-color-3":"#fe6a35","highcharts-color-4":"#6b8abc","highcharts-color-5":"#d568fb","highcharts-color-6":"#2ee0ca","highcharts-color-7":"#fa4b42","highcharts-color-8":"#feb56a","highcharts-color-9":"#91e8e1","highcharts-background-color":"rgb(48, 48, 48)","highcharts-neutral-color-100":"rgb(255, 255, 255)","highcharts-neutral-color-80":"rgb(214, 214, 214)","highcharts-neutral-color-60":"rgb(173, 173, 173)","highcharts-neutral-color-40":"rgb(133, 133, 133)","highcharts-neutral-color-20":"rgb(92, 92, 92)","highcharts-neutral-color-10":"rgb(71, 71, 71)","highcharts-neutral-color-5":"rgb(61, 61, 61)","highcharts-neutral-color-3":"rgb(57, 57, 57)","highcharts-highlight-color-100":"rgb(122, 167, 255)","highcharts-highlight-color-80":"rgb(108, 144, 214)","highcharts-highlight-color-60":"rgb(94, 121, 173)","highcharts-highlight-color-20":"rgb(65, 74, 92)","highcharts-highlight-color-10":"rgb(58, 63, 71)"});const sR=Ta().themes.get("light");Object.assign(sR.definition,{"highcharts-title-font-size":"16px","chart-background-color":"#2a2a2b","highcharts-color-0":"#2caffe","highcharts-color-1":"#544fc5","highcharts-color-2":"#00e272","highcharts-color-3":"#fe6a35","highcharts-color-4":"#6b8abc","highcharts-color-5":"#d568fb","highcharts-color-6":"#2ee0ca","highcharts-color-7":"#fa4b42","highcharts-color-8":"#feb56a","highcharts-color-9":"#91e8e1","highcharts-background-color":"#ffffff","highcharts-neutral-color-100":"#000000","highcharts-neutral-color-80":"#333333","highcharts-neutral-color-60":"#666666","highcharts-neutral-color-40":"#999999","highcharts-neutral-color-20":"#cccccc","highcharts-neutral-color-10":"#e6e6e6","highcharts-neutral-color-5":"#f2f2f2","highcharts-neutral-color-3":"#f7f7f7","highcharts-highlight-color-100":"#0022ff","highcharts-highlight-color-80":"#334eff","highcharts-highlight-color-60":"#667aff","highcharts-highlight-color-20":"#ccd3ff","highcharts-highlight-color-10":"#e6e9ff","highcharts-positive-color":"#06b535","highcharts-negative-color":"#f21313","highcharts-annotation-color-0":"rgba(130, 170, 255, 0.4)","highcharts-annotation-color-1":"rgba(139, 191, 216, 0.4)","highcharts-annotation-color-2":"rgba(150, 216, 192, 0.4)","highcharts-annotation-color-3":"rgba(156, 229, 161, 0.4)","highcharts-annotation-color-4":"rgba(162, 241, 130, 0.4)","highcharts-annotation-color-5":"rgba(169, 255, 101, 0.4)"});var aR=i(2439),lR=i(8022),cR=i(6158),hR=i(127),dR=i(4505),uR=i(8659),pR=i(397),gR=i(930),mR=i(9723),fR=i(6343),vR=i(4582),bR=i(6127),yR=i(8238),wR=i(7362),xR=i(452),kR=i(5390),CR=i(3368),MR=i(6288),_R=i(7513),SR=i(1386),ER=i(5764),zR=i(1261),RR=i(3071),IR=i(3285),LR=i(2356),HR=i(6780),TR=i(8542),AR=i(8385),OR=i(1025),$R=i(2034),DR=i(8113),NR=i(1821),PR=i(7212),jR=i(2583),VR=i(5360),BR=i(2377),FR=i(2864),WR=i(7998),UR=i(4101),GR=i(7813),YR=i(5037),qR=i(7005),ZR=i(9626),XR=i(9517),QR=i(1504),KR=i(3838),JR=i(4935),tI=i(7699),eI=i(3322),iI=i(5757),oI=i(536),nI=i(1673),rI=i(8736),sI=i(196),aI=i(5133),lI=i(6092),cI=i(791),hI=i(5927),dI=i(1802),uI=i(9511),pI=i(6267),gI=i(1072),mI=i(4331),fI=i(8644),vI=i(2704),bI=i(2419),yI=i(6363),wI=i(5236),xI=i(3499),kI=i(3811),CI=i(1953),MI=i(4729),_I=i(8964),SI=i(8540),EI=i(8752),zI=i(8783),RI=i(8270),II=i(7261),LI=i(9231),HI=i(4555),TI=i(5293),AI=i(6981),OI=i(5268),$I=i(2680),DI=i(789),NI=i(4373),PI=i(436),jI=i(8573),VI=i(1808),BI=i(3247),FI=i(5143),WI=i(2415),UI=i(2561),GI=i(5726),YI=i(7436),qI=i(4201),ZI=i(8248),XI=i(6433),QI=i(2698),KI=i(979),JI=i(9358),tL=i(9176),eL=i(1239),iL=i(4218),oL=i(8377),nL=i(3740),rL=i(5379),sL=i(9974),aL=i(8955),lL=i(3559),cL=i(809),hL=i(8014),dL=i(8265),uL=i(3300),pL=i(8724),gL=i(8033),mL=i(7700),fL=i(5741),vL=i(3478),bL=i(512),yL=i(499),wL=i(8680),xL=i(9646),kL=i(9432),CL=i(2841),ML=i(75),_L=i(9256),SL=i(444),EL=i(5633),zL=i(3788),RL=i(3573),IL=i(9948),LL=i(1836),HL=i(7029),TL=i(8532),AL=i(6639),OL=i(1633),$L=i(9805),DL=i(2171),NL=i(875),PL=i(9595),jL=i(3894),VL=i(2803),BL=i(7765),FL=i(8804),WL=i(8654),UL=i(257),GL=i(5844),YL=i(9651),qL=i(760),ZL=i(9518),XL=i(4585),QL=i(1769),KL=i(643),JL=i(5156),tH=i(822),eH=i(8249),iH=i(3434),oH=i(9314),nH=i(3093),rH=i(7721),sH=i(588),aH=i(7645),lH=i(7148),cH=i(6795),hH=i(7047),dH=i(9428),uH=i(1879),pH=i(9779),gH=i(2476),mH=i(9648),fH=i(2896),vH=i(6817),bH=i(5196),yH=i(2762),wH=i(5981),xH=i(9014),kH=i(2611),CH=i(7946),MH=i(6301),_H=i(8020),SH=i(3987),EH=i(3192),zH=i(8796),RH=i(2489),IH=i(7324),LH=i(6069),HH=i(4155),TH=i(6977),AH=i(8055),OH=i(2653),$H=i(9492),DH=i(4334),NH=i(6804),PH=i(9954),jH=i(2211),VH=i(5211),BH=i(1519),FH=i(6204),WH=i(5501),UH=i(5244),GH=i(9742),YH=i(1552),qH=i(1330),ZH=i(2596),XH=i(5184),QH=i(7675),KH=i(1513),JH=i(9396),tT=i(7673),eT=i(244),iT=i(1187),oT=i(1736),nT=i(4390),rT=i(7106),sT=i(2096),aT=i(9991),lT=i(5629),cT=i(3386),hT=i(6651),dT=i(1684),uT=i(3849),pT=i(2582),gT=i(8569),mT=i(2955),fT=i(9100),vT=i(7381),bT=i(9190),yT=i(4071),wT=i(8e3),xT=i(4633),kT=i(4374),CT=i(486),MT=i(3680),_T=i(9999),ST=i(2830),ET=i(5255),zT=i(6021),RT=i(2214),IT=i(8497),LT=i(2052),HT=i(5327),TT=i(8701),AT=i(8722),OT=i(7325),$T=i(2445);const DT=[aR.mw,lR.mw,cR.mw,hR.mw,dR.mw,uR.mw,pR.mw,gR.mw,mR.mw,vR.mw,fR.mw,bR.mw,yR.mw,wR.mw,xR.mw,kR.mw,CR.mw,MR.mw,_R.mw,SR.mw,ER.mw,zR.mw,RR.mw,IR.mw,LR.mw,HR.mw,TR.mw,AR.mw,OR.mw,DR.mw,NR.mw,PR.mw,jR.mw,VR.mw,BR.mw,FR.mw,WR.mw,UR.mw,GR.mw,YR.mw,qR.mw,ZR.mw,QR.mw,XR.mw,KR.mw,JR.mw,tI.mw,eI.mw,iI.mw,oI.mw,nI.mw,rI.mw,sI.mw,aI.mw,lI.mw,cI.mw,dI.mw,uI.mw,pI.mw,gI.mw,mI.mw,fI.mw,vI.mw,bI.mw,yI.mw,wI.mw,xI.mw,kI.mw,CI.mw,MI.mw,_I.mw,SI.mw,EI.mw,zI.mw,RI.mw,hI.mw,II.mw,LI.mw,HI.mw,TI.mw,AI.mw,OI.mw,$I.mw,DI.mw,NI.mw,PI.mw,jI.mw,VI.mw,BI.mw,FI.mw,WI.mw,UI.mw,GI.mw,YI.mw,qI.mw,ZI.mw,XI.mw,QI.mw,KI.mw,JI.mw,tL.mw,eL.mw,iL.mw,oL.mw,nL.mw,rL.mw,sL.mw,aL.mw,lL.mw,cL.mw,hL.mw,dL.mw,uL.mw,pL.mw,gL.mw,mL.mw,fL.mw,$R.mw,vL.mw,bL.mw,yL.mw,wL.mw,xL.mw,kL.mw,CL.mw,ML.mw,_L.mw,SL.mw,EL.mw,zL.mw,RL.mw,IL.mw,HL.mw,LL.mw,AL.mw,TL.mw,OL.mw,$L.mw,DL.mw,NL.mw,PL.mw,jL.mw,VL.mw,BL.mw,FL.mw,qL.mw,ZL.mw,XL.mw,QL.mw,KL.mw,JL.mw,tH.mw,iH.mw,oH.mw,nH.mw,cH.mw,hH.mw,dH.mw,uH.mw,pH.mw,gH.mw,mH.mw,fH.mw,WL.mw,UL.mw,YL.mw,GL.mw,vH.mw,bH.mw,yH.mw,wH.mw,xH.mw,kH.mw,CH.mw,MH.mw,rH.mw,sH.mw,aH.mw,lH.mw,SH.mw,EH.mw,zH.mw,RH.mw,IH.mw,LH.mw,HH.mw,TH.mw,AH.mw,OH.mw,$H.mw,DH.mw,NH.mw,PH.mw,jH.mw,VH.mw,BH.mw,FH.mw,WH.mw,_H.mw,UH.mw,GH.mw,YH.mw,qH.mw,ZH.mw,XH.mw,QH.mw,KH.mw,JH.mw,tT.mw,eT.mw,iT.mw,oT.mw,nT.mw,rT.mw,sT.mw,aT.mw,lT.mw,cT.mw,hT.mw,dT.mw,uT.mw,pT.mw,gT.mw,mT.mw,fT.mw,vT.mw,bT.mw,yT.mw,wT.mw,xT.mw,kT.mw,CT.mw,MT.mw,_T.mw,ST.mw,ET.mw,zT.mw,RT.mw,IT.mw,LT.mw,eH.mw,HT.mw,TT.mw,AT.mw,OT.mw,$T.mw],NT={xlsx:V,charts:B},PT={name:"@omegagrid/bundle",version:"0.6.135"};Ta().activate("light"),Jh.styleDefault="fal",td.add(...DT)})(),window.Omegagrid=o})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omegagrid/bundle",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.135",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Distribution package for Omegagrid library",
|
|
6
6
|
"main": "omegagrid.js",
|
|
@@ -19,23 +19,23 @@
|
|
|
19
19
|
"@fortawesome/fontawesome-svg-core": "6.4.2",
|
|
20
20
|
"@fortawesome/pro-light-svg-icons": "6.4.2",
|
|
21
21
|
"@fortawesome/pro-solid-svg-icons": "6.4.2",
|
|
22
|
-
"@omegagrid/bucket": "^0.6.
|
|
23
|
-
"@omegagrid/calendar": "^0.6.
|
|
24
|
-
"@omegagrid/code": "^0.6.
|
|
25
|
-
"@omegagrid/commands": "^0.6.
|
|
26
|
-
"@omegagrid/core": "^0.6.
|
|
27
|
-
"@omegagrid/dialog": "^0.6.
|
|
28
|
-
"@omegagrid/editor": "^0.6.
|
|
29
|
-
"@omegagrid/form": "^0.6.
|
|
30
|
-
"@omegagrid/grid": "^0.6.
|
|
31
|
-
"@omegagrid/localize": "^0.6.
|
|
32
|
-
"@omegagrid/markdown": "^0.6.
|
|
33
|
-
"@omegagrid/plugin-charts": "^0.6.
|
|
34
|
-
"@omegagrid/plugin-xlsx": "^0.6.
|
|
35
|
-
"@omegagrid/statusbar": "^0.6.
|
|
36
|
-
"@omegagrid/tabs": "^0.6.
|
|
37
|
-
"@omegagrid/toolbar": "^0.6.
|
|
38
|
-
"@omegagrid/tree": "^0.6.
|
|
22
|
+
"@omegagrid/bucket": "^0.6.135",
|
|
23
|
+
"@omegagrid/calendar": "^0.6.135",
|
|
24
|
+
"@omegagrid/code": "^0.6.135",
|
|
25
|
+
"@omegagrid/commands": "^0.6.135",
|
|
26
|
+
"@omegagrid/core": "^0.6.135",
|
|
27
|
+
"@omegagrid/dialog": "^0.6.135",
|
|
28
|
+
"@omegagrid/editor": "^0.6.135",
|
|
29
|
+
"@omegagrid/form": "^0.6.135",
|
|
30
|
+
"@omegagrid/grid": "^0.6.135",
|
|
31
|
+
"@omegagrid/localize": "^0.6.135",
|
|
32
|
+
"@omegagrid/markdown": "^0.6.135",
|
|
33
|
+
"@omegagrid/plugin-charts": "^0.6.135",
|
|
34
|
+
"@omegagrid/plugin-xlsx": "^0.6.135",
|
|
35
|
+
"@omegagrid/statusbar": "^0.6.135",
|
|
36
|
+
"@omegagrid/tabs": "^0.6.135",
|
|
37
|
+
"@omegagrid/toolbar": "^0.6.135",
|
|
38
|
+
"@omegagrid/tree": "^0.6.135",
|
|
39
39
|
"lit": "^3.1.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|