@sl-material/sl-table-sheet 1.4.1-beta0 → 1.4.1-beta1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sl-material/sl-table-sheet",
3
- "version": "1.4.1-beta0",
3
+ "version": "1.4.1-beta1",
4
4
  "description": "VTable 组件库 - 支持 npm 和 UMD",
5
5
  "main": "./sl-table-sheet.cjs.js",
6
6
  "module": "./sl-table-sheet.es.js",
@@ -601,7 +601,7 @@
601
601
  opacity: 0.8;
602
602
  transition: opacity 0.2s;
603
603
  margin-top:-3px;
604
- `,i.onmouseenter=()=>i.style.opacity="1",i.onmouseleave=()=>i.style.opacity="0.8",n.appendChild(i),document.body.appendChild(n);let c,f,o;const l=()=>{clearTimeout(c),clearTimeout(o),n.classList.remove("show"),f=setTimeout(()=>{clearTimeout(f),n.parentNode&&document.body.removeChild(n)},300)};i.onclick=l,o=setTimeout(()=>{clearTimeout(o),n.classList.add("show")},10),c=setTimeout(l,3e3)}setTableInstance(r){this.tableInstance=r,this.state.matches=[],this.state.currentIndex=0,this.clearResults()}setSelectedColumnsOnly(r){this.elements.selectedColumnsOnly&&(this.elements.selectedColumnsOnly.checked=r)}getSelectedColumnsOnly(){var r;return((r=this.elements.selectedColumnsOnly)==null?void 0:r.checked)||!1}setFindText(r){this.state.findText=r,this.elements.findInput&&(this.elements.findInput.value=r)}setReplaceText(r){this.state.replaceText=r,this.elements.replaceInput&&(this.elements.replaceInput.value=r)}destroy(){this.dialog&&(this.dialog.remove(),this.dialog=null)}}class m_{constructor(r,t){de(this,"customComponentContainers",new Map);de(this,"activeComponentKey",null);de(this,"justCreatedComponent",!1);de(this,"tableInstance",null);de(this,"container",null);de(this,"handleOutsideClick",r=>{if(this.justCreatedComponent||!this.activeComponentKey)return;const t=this.customComponentContainers.get(this.activeComponentKey);t&&!t.contains(r.target)&&this.closeActiveComponent()});this.tableInstance=r,this.container=t,this.bindOutsideClickHandler()}showComponent(r,t,a){var p;const{col:n,row:s}=a,i=this.tableInstance.getCellRect(n,s),c=this.tableInstance.getCellValue(n,s),f=(p=this.container)==null?void 0:p.getBoundingClientRect(),o=((f==null?void 0:f.left)||0)+i.left,l=((f==null?void 0:f.top)||0)+i.bottom,h=this.createComponentContainer(o,l,t),u={table:this.tableInstance,row:s,col:n,value:c,dataValue:a.dataValue,rect:i,setValue:x=>{this.tableInstance.changeCellValue(n,s,x),this.closeActiveComponent()},close:()=>{this.closeActiveComponent()}};try{const x=t.render(u);h.appendChild(x),document.body.appendChild(h)}catch(x){console.error("❌ 渲染组件时出错:",x);return}const d=`${r}-${n}-${s}`;this.customComponentContainers.set(d,h),this.activeComponentKey=d,t.onMount&&t.onMount(h,u),h.addEventListener("click",x=>{x.stopPropagation()}),this.justCreatedComponent=!0,setTimeout(()=>{this.justCreatedComponent=!1},100)}createComponentContainer(r,t,a){const n=document.createElement("div");return n.className="vtable-custom-component",n.style.position="fixed",n.style.zIndex="9999",n.style.left=`${r}px`,n.style.top=`${t}px`,n.style.backgroundColor="white",n.style.borderRadius="4px",n.style.boxShadow="0 2px 12px rgba(0, 0, 0, 0.15)",a.containerStyle&&Object.assign(n.style,a.containerStyle),n}closeActiveComponent(){if(!this.activeComponentKey)return;const r=this.customComponentContainers.get(this.activeComponentKey);r&&(r.remove(),this.customComponentContainers.delete(this.activeComponentKey)),this.activeComponentKey=null}bindOutsideClickHandler(){document.addEventListener("click",this.handleOutsideClick)}destroy(){this.closeActiveComponent(),this.customComponentContainers.clear(),document.removeEventListener("click",this.handleOutsideClick)}}class _0{constructor(r,t){de(this,"markedMap",null);de(this,"tableInstance",null);de(this,"markedCellsSet",null);de(this,"tooltipThrottle",null);this.tableInstance=r,this.markedMap=t||null,t&&t.size>0&&(this.markedCellsSet=new Set(t.keys()),this.tooltipThrottle=new Map)}handleCellMouseEnter(r){if(!this.markedCellsSet||!this.tableInstance)return;const{col:t,row:a}=r,n=this.tableInstance.columnHeaderLevelCount||1,s=a-n;if(s<0)return;const i=`${s}-${t}`;if(!this.markedCellsSet.has(i))return;const c=`${t}-${a}`,f=Date.now(),o=this.tooltipThrottle.get(c)||0;f-o<100||(this.tooltipThrottle.set(c,f),this.showTooltip(t,a,i))}showTooltip(r,t,a){const n=this.tableInstance.getVisibleCellRangeRelativeRect({col:r,row:t}),s=this.markedMap.get(a),i=this.tableInstance.getCellValue(r,t),c=s==null?void 0:s.comment,f=c?`${i}: ${c}`:`${i}`;this.tableInstance.showTooltip(r,t,{content:f,referencePosition:{rect:n,placement:"right"},className:"defineTooltip",disappearDelay:100,style:{bgColor:"black",color:"white",arrowMark:!0,padding:[5,11]}})}getMarkedMap(){return this.markedMap}setMarkedMap(r){this.markedMap=r}destroy(){this.markedMap=null,this.tableInstance=null}}class v_{static registerEditors(r){if(r){if(r.dateEditor!==!1){const t=new ci.DateInputEditor(r.dateEditor||{});ln.VTable.register.editor("dateEditor",t)}if(r.listEditor){const t=new ci.ListEditor(r.listEditor||{values:["技术中心","财务部"]});ln.VTable.register.editor("listEditor",t)}r.customEditors&&Object.entries(r.customEditors).forEach(([t,a])=>{ln.VTable.register.editor(t,a)})}}}class g_{constructor(r,t,a){de(this,"tableInstance");de(this,"config");de(this,"customComponentManager",null);de(this,"cellMarkManager",null);this.config=r,this.tableInstance=r.tableInstance,this.customComponentManager=t,this.cellMarkManager=a}bindEvents(){this.tableInstance&&(this.tableInstance.on("click_cell",r=>{var t,a;this.handleCellClick(r),(a=(t=this.config).onCellClick)==null||a.call(t,r)}),this.config.onCellChange&&this.tableInstance.on("change_cell_value",this.config.onCellChange),this.tableInstance.on("mouseenter_cell",r=>{var t;(t=this.cellMarkManager)==null||t.handleCellMouseEnter(r)}))}handleCellClick(r){var c,f,o;const{col:t}=r,n=(this.config.columns||[])[t];if(!(n!=null&&n.customComponent))return;const s=n.customComponent,i=(c=this.config.customComponents)==null?void 0:c[s];i!=null&&i.showOnClick&&((f=this.customComponentManager)==null||f.closeActiveComponent(),(o=this.customComponentManager)==null||o.showComponent(s,i,r))}on(r,t){var a;(a=this.tableInstance)==null||a.on(r,t)}off(r,t){var a;(a=this.tableInstance)==null||a.off(r,t)}destroy(){this.tableInstance&&(this.tableInstance.off("click_cell"),this.tableInstance.off("change_cell_value"),this.tableInstance.off("mouseenter_cell")),this.tableInstance=null,this.customComponentManager=null,this.cellMarkManager=null}}class w0{constructor(r,t){de(this,"sheetInstance");de(this,"tableInstance");de(this,"container",null);de(this,"config");de(this,"customComponentManager",null);de(this,"cellMarkManager",null);de(this,"eventManager",null);de(this,"lastWidth",0);de(this,"lastHeight",0);de(this,"resizeTimeout",null);this.config=r,this.cellMarkManager=new _0(null,t),this.init()}init(){const r=this.config.container;if(this.container=this.getContainer(r),!this.container)throw console.error("TableSheet: Container not found",{input:r}),new Error("Container not found");(this.container.offsetWidth===0||this.container.offsetHeight===0)&&console.warn("TableSheet: Container has zero dimensions",{width:this.container.offsetWidth,height:this.container.offsetHeight}),v_.registerEditors(this.config.editors),this.createSheet()}getContainer(r){return typeof r=="string"?document.getElementById(r)||document.querySelector(r):r}createSheet(){var c;const{columns:r=[],records:t=[],showFormulaBar:a=!0,sheets:n,options:s}=this.config,i={showFormulaBar:a,showSheetTab:!0,sheets:n||[{sheetKey:"sheet1",sheetTitle:"Sheet1",dragOrder:{dragHeaderMode:"all"},columns:r,data:t}],tooltip:{isShowOverflowTextTooltip:!0},autoFillWidth:!0,autoFillHeight:!0,progressiveMode:!0,VTablePluginModules:[{module:no.AddRowColumnPlugin,disabled:!0,moduleOptions:{addColumnEnable:!1,addRowEnable:!1}}],...s};console.info("[sl-table-sheet]","create--vtableConfig",i),this.sheetInstance=new ln.VTableSheet(this.container,i),this.tableInstance=(c=this.sheetInstance.getActiveSheet())==null?void 0:c.tableInstance,this.initManagers()}initManagers(){var r;this.customComponentManager=new m_(this.tableInstance,this.container),this.cellMarkManager=new _0(this.tableInstance,((r=this.cellMarkManager)==null?void 0:r.getMarkedMap())||void 0),this.eventManager=new g_({tableInstance:this.tableInstance,columns:this.config.columns,customComponents:this.config.customComponents,onCellClick:this.config.onCellClick,onCellChange:this.config.onCellChange},this.customComponentManager,this.cellMarkManager),this.eventManager.bindEvents()}changeCellValue(r,t,a){this.tableInstance&&this.tableInstance.changeCellValue(r,t,a)}getCellValue(r,t){var a;return(a=this.tableInstance)==null?void 0:a.getCellValue(r,t)}getSelectedCells(){var r;return(r=this.tableInstance)==null?void 0:r.getSelectedCellInfos()}updateData(r){var a;const t=(a=this.sheetInstance)==null?void 0:a.getActiveSheet();if(t)if(typeof t.updateRecords=="function")t.updateRecords(r);else if(typeof t.setData=="function")t.setData(r);else if(this.tableInstance)if(typeof this.tableInstance.updateOption=="function")try{this.tableInstance.updateOption({records:r})}catch(n){console.warn("tableInstance.updateOption 失败:",n)}else console.warn("无法更新数据:找不到合适的方法");else console.warn("无法更新数据:找不到合适的方法");else console.warn("无法获取活动工作表")}updateColumns(r){var a;const t=(a=this.sheetInstance)==null?void 0:a.getActiveSheet();if(t)if(typeof t.updateColumns=="function")t.updateColumns(r);else if(typeof t.setColumns=="function")t.setColumns(r);else if(this.tableInstance)if(typeof this.tableInstance.updateOption=="function")try{this.tableInstance.updateOption({columns:r})}catch(n){console.warn("tableInstance.updateOption 失败:",n)}else console.warn("无法更新列配置:找不到合适的方法");else console.warn("无法更新列配置:找不到合适的方法");else console.warn("无法获取活动工作表")}addRow(r,t){var n;const a=(n=this.sheetInstance)==null?void 0:n.getActiveSheet();a&&a.addRecord(r,t)}deleteRow(r){var a;const t=(a=this.sheetInstance)==null?void 0:a.getActiveSheet();t&&t.deleteRecord(r)}exportData(r="csv"){var t,a;return(a=(t=this.sheetInstance)==null?void 0:t.exportData)==null?void 0:a.call(t,r)}switchSheet(r){var t,a;(t=this.sheetInstance)==null||t.switchSheet(r),this.tableInstance=(a=this.sheetInstance.getActiveSheet())==null?void 0:a.tableInstance}getActiveSheet(){var r;return(r=this.sheetInstance)==null?void 0:r.getActiveSheet()}getAllSheets(){var r;return(r=this.sheetInstance)==null?void 0:r.getAllSheets()}refresh(){if(this.tableInstance&&this.tableInstance.option)try{this.tableInstance.updateOption(this.tableInstance.option)}catch(r){console.warn("刷新表格失败:",r);const t=this.tableInstance.container;t&&(t.style.display="none",setTimeout(()=>{t.style.display=""},0))}}setFrozenColCount(r){if(this.tableInstance)try{if(typeof this.tableInstance.setFrozenColCount=="function")this.tableInstance.setFrozenColCount(r);else if(typeof this.tableInstance.updateOption=="function"){const t=this.tableInstance.option||{};this.tableInstance.updateOption({...t,frozenColCount:r})}}catch(t){console.warn("设置冻结列失败:",t)}}resize(){if(!this.sheetInstance){console.warn("sheetInstance 不存在,无法 resize");return}const r=this.container;if(!r)return;const t=r.clientWidth,a=r.clientHeight;t===this.lastWidth&&a===this.lastHeight||(this.lastWidth=t,this.lastHeight=a,typeof this.sheetInstance.resize=="function"?this.sheetInstance.resize():console.warn("sheetInstance.resize 方法不可用"))}resizeDebounced(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.resize(),this.resizeTimeout=null},100)}getSheetInstance(){return this.sheetInstance}getTableInstance(){return this.tableInstance}setColumnCustomRender(r,t){var n;const a=(n=this.sheetInstance)==null?void 0:n.getActiveSheet();if(a){const s=a.columns||[],i=s.find(c=>c.field===r);i&&(i.customRender=t,a.updateColumns(s))}}getMarkedMap(){var r;return((r=this.cellMarkManager)==null?void 0:r.getMarkedMap())||null}getAllRecords(){if(!this.tableInstance)return[];const r=this.tableInstance.rowCount??0,t=this.tableInstance.colCount??0,a=this.tableInstance.columnHeaderLevelCount??1,n=[];for(let s=a;s<r;s++){const i=[];for(let c=0;c<t;c++)i.push(this.tableInstance.getCellValue(c,s));n.push(i)}return n}getColumns(){var r,t;return((t=(r=this.tableInstance)==null?void 0:r.options)==null?void 0:t.columns)||[]}on(r,t){var a;(a=this.eventManager)==null||a.on(r,t)}off(r,t){var a;(a=this.eventManager)==null||a.off(r,t)}destroy(){var r,t,a,n,s;(r=this.eventManager)==null||r.destroy(),(t=this.cellMarkManager)==null||t.destroy(),(a=this.customComponentManager)==null||a.destroy(),this.eventManager=null,this.cellMarkManager=null,this.customComponentManager=null,this.sheetInstance&&((s=(n=this.sheetInstance).destroy)==null||s.call(n),this.sheetInstance=null,this.tableInstance=null),this.container&&(this.container.innerHTML="")}}const __={toolbar:{title:"制表错误",unit:"条",total:"共 {total} 个错误项",hint:"请在错误项里查询对应的数据或在数据里进行搜索",buttons:{search:"查找/替换",freeze:{label:"冻结前",suffix:"列"},list:"仅显示错误列"}},dialog:{find:{label:"查找内容",placeholder:"请输入查找内容"},replace:{label:"替换为",placeholder:"请输入替换内容"},checkbox:{selectedOnly:"只替换选中列"},buttons:{close:"关闭",findPrev:"查找上一个",findNext:"查找下一个",replaceOne:"替换",replaceAll:"全部替换"},messages:{pleaseInputFind:"请输入查找内容",notConnected:"未连接表格实例",pleaseSelectColumns:"请先选中要搜索的列",noMatchFound:"未找到匹配内容",nothingToReplace:"没有可替换的内容",replacedOne:"已替换第 {index} 个匹配项",replacedAll:"已替换全部 {count} 个匹配项"},result:{found:"已找到 {count} 个结果"}},sheet:{defaultTitle:"Sheet1"}},w_={toolbar:{title:"製表錯誤",unit:"筆",total:"共 {total} 個錯誤項",hint:"請在錯誤項裡查詢對應的資料或在資料裡進行搜尋",buttons:{search:"尋找/取代",freeze:{label:"凍結前",suffix:"欄"},list:"僅顯示錯誤欄"}},dialog:{find:{label:"尋找內容",placeholder:"請輸入尋找內容"},replace:{label:"取代為",placeholder:"請輸入取代內容"},checkbox:{selectedOnly:"只取代選中欄"},buttons:{close:"關閉",findPrev:"尋找上一個",findNext:"尋找下一個",replaceOne:"取代",replaceAll:"全部取代"},messages:{pleaseInputFind:"請輸入尋找內容",notConnected:"未連接表格實例",pleaseSelectColumns:"請先選中要搜尋的欄",noMatchFound:"未找到符合內容",nothingToReplace:"沒有可取代的內容",replacedOne:"已取代第 {index} 個符合項",replacedAll:"已取代全部 {count} 個符合項"},result:{found:"已找到 {count} 個結果"}},sheet:{defaultTitle:"Sheet1"}},E_={toolbar:{title:"Table Errors",unit:"items",total:"Total {total} errors",hint:"Please search for the corresponding data in the error items or in the data",buttons:{search:"Find/Replace",freeze:{label:"Freeze first",suffix:"columns"},list:"Show error columns only"}},dialog:{find:{label:"Find content",placeholder:"Please enter content to find"},replace:{label:"Replace with",placeholder:"Please enter replacement content"},checkbox:{selectedOnly:"Replace selected columns only"},buttons:{close:"Close",findPrev:"Find Previous",findNext:"Find Next",replaceOne:"Replace",replaceAll:"Replace All"},messages:{pleaseInputFind:"Please enter content to find",notConnected:"Table instance not connected",pleaseSelectColumns:"Please select columns to search first",noMatchFound:"No matching content found",nothingToReplace:"Nothing to replace",replacedOne:"Replaced match #{index}",replacedAll:"Replaced all {count} matches"},result:{found:"Found {count} result(s)"}},sheet:{defaultTitle:"Sheet1"}},T_={"zh-CN":__,"en-US":E_,"zh-TW":w_};let k_="zh-CN";function S_(){return T_[k_]}function y_(e,r={}){return e.replace(/\{(\w+)\}/g,(t,a)=>r[a]!==void 0?String(r[a]):`{${a}}`)}function Jn(e,r){const t=S_(),a=e.split(".");let n=t;for(const s of a)if(n&&typeof n=="object"&&s in n)n=n[s];else return console.warn(`I18n message not found: ${e}`),e;return typeof n=="string"?y_(n,r||{}):(console.warn(`I18n message is not a string: ${e}`),e)}class F_{constructor(r){de(this,"container",null);de(this,"toolbarElement",null);de(this,"config");de(this,"elements",{});this.config={freezeCount:0,showErrorList:!1,buttons:{search:!0,freeze:!0,export:!0,refresh:!0,list:!1},...r},this.container=this.getContainer(this.config.container),this.createToolbar(),this.injectStyles()}getContainer(r){return Sn.getContainer(r)}createToolbar(){this.toolbarElement=document.createElement("div"),this.toolbarElement.className="sl-excel-toolbar";const r=this.createLeftSection(),t=this.createRightSection();this.toolbarElement.appendChild(r),this.toolbarElement.appendChild(t),this.container&&this.container.appendChild(this.toolbarElement)}createLeftSection(){const r=document.createElement("div");if(r.className="sl-excel-toolbar-left",this.config.leftSlot){const t=typeof this.config.leftSlot=="function"?this.config.leftSlot():this.config.leftSlot;t&&r.appendChild(t)}return r}createRightSection(){const r=document.createElement("div");r.className="sl-excel-toolbar-right";const{buttons:t}=this.config;if((t==null?void 0:t.search)!==!1){const a=this.createButton({text:Jn("toolbar.buttons.search"),onClick:()=>{var n,s;return(s=(n=this.config).onSearchClick)==null?void 0:s.call(n)}});r.appendChild(a)}if((t==null?void 0:t.freeze)!==!1){const a=this.createFreezeButton();r.appendChild(a)}return r}createButton(r){const t=document.createElement("button");return t.className=r.icon?"sl-excel-toolbar-btn sl-excel-toolbar-btn-icon":"sl-excel-toolbar-btn",t.textContent=r.text,r.title&&(t.title=r.title),r.onClick&&(t.onclick=r.onClick),t}createFreezeButton(){const r=document.createElement("div");r.className="sl-excel-freeze-selector";const t=document.createElement("span");t.className="sl-excel-freeze-label",t.textContent=Jn("toolbar.buttons.freeze.label");const a=document.createElement("div");a.className="sl-excel-freeze-input-wrapper";const n=document.createElement("input");n.type="number",n.className="sl-excel-freeze-input",n.min="0",n.max="100",n.value=String(this.config.freezeCount||0),this.elements.freezeSelect=n;const s=document.createElement("div");s.className="sl-excel-freeze-arrows";const i=document.createElement("button");i.className="sl-excel-freeze-arrow sl-excel-freeze-arrow-up",i.innerHTML="^",i.type="button";const c=document.createElement("button");c.className="sl-excel-freeze-arrow sl-excel-freeze-arrow-down",c.innerHTML="^",c.type="button",s.appendChild(i),s.appendChild(c);const f=document.createElement("span");f.className="sl-excel-freeze-suffix",f.textContent=Jn("toolbar.buttons.freeze.suffix");const o=l=>{var h,u;l<0&&(l=0),l>100&&(l=100),n.value=String(l),this.config.freezeCount=l,(u=(h=this.config).onFreezeChange)==null||u.call(h,l)};return i.onclick=l=>{l.preventDefault();const h=parseInt(n.value,10)||0;o(h+1)},c.onclick=l=>{l.preventDefault();const h=parseInt(n.value,10)||0;o(h-1)},n.oninput=()=>{let l=parseInt(n.value,10);(isNaN(l)||l<0)&&(l=0,n.value="0"),l>100&&(l=100,n.value="100"),this.config.freezeCount=l},n.onblur=()=>{var h,u;const l=parseInt(n.value,10)||0;(u=(h=this.config).onFreezeChange)==null||u.call(h,l)},n.onkeydown=l=>{l.key==="Enter"&&n.blur()},a.appendChild(n),a.appendChild(s),r.appendChild(t),r.appendChild(a),r.appendChild(f),r}injectStyles(){Sn.injectStyles(x_,u_)}updateFreezeCount(r){this.config.freezeCount=r,this.elements.freezeSelect&&(this.elements.freezeSelect.value=String(r))}updateShowErrorList(r){this.config.showErrorList=r,this.elements.errorListCheckbox&&(this.elements.errorListCheckbox.checked=r)}show(){this.toolbarElement&&(this.toolbarElement.style.display="flex")}hide(){this.toolbarElement&&(this.toolbarElement.style.display="none")}getElement(){return this.toolbarElement}setLeftSlot(r){var a;const t=(a=this.toolbarElement)==null?void 0:a.querySelector(".sl-toolbar-left");if(t&&(t.innerHTML="",r)){const n=typeof r=="function"?r():r;n&&t.appendChild(n)}}getLeftSection(){var r;return((r=this.toolbarElement)==null?void 0:r.querySelector(".sl-toolbar-left"))||null}destroy(){this.toolbarElement&&(this.toolbarElement.remove(),this.toolbarElement=null),this.elements={}}}class Zn{static processRecords(r,t){const a=new Map;return{displayRecords:r.map((s,i)=>Array.isArray(s)?this.processArrayRow(s,i,a):this.processObjectRow(s,i,t,a)),markedMap:a}}static processArrayRow(r,t,a){return r.map((n,s)=>n&&typeof n=="object"&&"value"in n?(n.isMarked&&a.set(`${t}-${s}`,{isMarked:!0,comment:n.comment||""}),n.value):n)}static processObjectRow(r,t,a,n){return a.map((s,i)=>{const c=s.field||s.key,f=r[c];return f&&typeof f=="object"&&"value"in f?(f.isMarked&&n.set(`${t}-${i}`,{isMarked:!0,comment:f.comment||""}),f.value):f})}}const C_=(e,r)=>({bgColor:"#FFEBEB",color:"#FF4D50",marked:{shape:"triangle",bgColor:"#FF4D50",size:8}}),E0={color:"#1D2129",fontSize:14,fontWeight:"400",bgColor:"#F9FAFB"},Qn={color:"#6B7280",fontSize:14,bgColor:"white"};class T0{static initColumns(r,t,a=1){const n=new Map;if(t.size>0)for(const[s]of t){const[i,c]=s.split("-"),f=parseInt(i,10),o=parseInt(c,10);n.has(o)||n.set(o,new Set),n.get(o).add(f)}return r.map((s,i)=>{const c=s.style,f={...s},o=n.get(i);if(!o||o.size===0)return f.style=c||(()=>Qn),f.headerStyle=E0,f;const l=new Map;return f.style=h=>{const u=h.row-a;if(u<0||!o.has(u))return c?c(h):Qn;const d=`${u}-${i}`;let p=l.get(d);return p||(p=C_(),l.set(d,p)),{...c?c(h):Qn,...p,bgColor:p.bgColor,color:p.color}},f.headerStyle=E0,f})}}class A_{constructor(r){de(this,"tableSheet",null);de(this,"findReplaceDialog",null);de(this,"toolbar",null);de(this,"sheetTabs",null);de(this,"container",null);de(this,"tableContainer",null);de(this,"toolbarContainer",null);de(this,"sheetTabsContainer",null);de(this,"loadingOverlay",null);de(this,"config");de(this,"multiSheetData",null);de(this,"timers",[]);de(this,"resizeObserver",null);de(this,"lastObservedWidth",0);de(this,"lastObservedHeight",0);this.config={showToolbar:!0,autoResize:!1,loading:{show:!0,text:"加载中..."},...r},this.init()}init(){if(this.container=this.getContainer(this.config.container),!this.container)throw new Error("Container not found");if(this.createLayout(),this.config.showToolbar&&this.createToolbar(),this.injectStyles(),this.createTable(),this.config.showSheets===!1&&this.container){this.container.classList.add("hide-native-sheet-tab");const r=setTimeout(()=>{this.container&&this.container.querySelectorAll(".vtable-sheet-tab-bar").forEach(n=>{n.style.display="none"});const t=this.timers.indexOf(r);t>-1&&this.timers.splice(t,1)},0);this.timers.push(r)}!this.config.showFormulaBar&&this.container&&this.container.classList.add("hide-formula-bar"),this.createFindReplaceDialog(),this.config.autoResize&&this.enableAutoResize()}getContainer(r){return typeof r=="string"?document.getElementById(r)||document.querySelector(r):r}createLayout(){this.container&&(this.container.innerHTML="",this.container.className="sl-table-sheet-wrapper",this.container.style.display="flex",this.container.style.flexDirection="column",this.config.showToolbar&&(this.toolbarContainer=document.createElement("div"),this.container.appendChild(this.toolbarContainer)),this.config.showTabs!==!1&&(this.sheetTabsContainer=document.createElement("div"),this.sheetTabsContainer.className="sl-sheet-tabs-container",this.container.appendChild(this.sheetTabsContainer)),this.tableContainer=document.createElement("div"),this.tableContainer.className="sl-table-container",this.tableContainer.style.flex="1",this.tableContainer.style.minHeight="0",this.tableContainer.style.overflow="hidden",this.container.appendChild(this.tableContainer),this.loadingOverlay=document.createElement("div"),this.loadingOverlay.className="sl-loading-overlay",this.loadingOverlay.innerHTML=`
604
+ `,i.onmouseenter=()=>i.style.opacity="1",i.onmouseleave=()=>i.style.opacity="0.8",n.appendChild(i),document.body.appendChild(n);let c,f,o;const l=()=>{clearTimeout(c),clearTimeout(o),n.classList.remove("show"),f=setTimeout(()=>{clearTimeout(f),n.parentNode&&document.body.removeChild(n)},300)};i.onclick=l,o=setTimeout(()=>{clearTimeout(o),n.classList.add("show")},10),c=setTimeout(l,3e3)}setTableInstance(r){this.tableInstance=r,this.state.matches=[],this.state.currentIndex=0,this.clearResults()}setSelectedColumnsOnly(r){this.elements.selectedColumnsOnly&&(this.elements.selectedColumnsOnly.checked=r)}getSelectedColumnsOnly(){var r;return((r=this.elements.selectedColumnsOnly)==null?void 0:r.checked)||!1}setFindText(r){this.state.findText=r,this.elements.findInput&&(this.elements.findInput.value=r)}setReplaceText(r){this.state.replaceText=r,this.elements.replaceInput&&(this.elements.replaceInput.value=r)}destroy(){this.dialog&&(this.dialog.remove(),this.dialog=null)}}class m_{constructor(r,t){de(this,"customComponentContainers",new Map);de(this,"activeComponentKey",null);de(this,"justCreatedComponent",!1);de(this,"tableInstance",null);de(this,"container",null);de(this,"handleOutsideClick",r=>{if(this.justCreatedComponent||!this.activeComponentKey)return;const t=this.customComponentContainers.get(this.activeComponentKey);t&&!t.contains(r.target)&&this.closeActiveComponent()});this.tableInstance=r,this.container=t,this.bindOutsideClickHandler()}showComponent(r,t,a){var p;const{col:n,row:s}=a,i=this.tableInstance.getCellRect(n,s),c=this.tableInstance.getCellValue(n,s),f=(p=this.container)==null?void 0:p.getBoundingClientRect(),o=((f==null?void 0:f.left)||0)+i.left,l=((f==null?void 0:f.top)||0)+i.bottom,h=this.createComponentContainer(o,l,t),u={table:this.tableInstance,row:s,col:n,value:c,dataValue:a.dataValue,rect:i,setValue:x=>{this.tableInstance.changeCellValue(n,s,x),this.closeActiveComponent()},close:()=>{this.closeActiveComponent()}};try{const x=t.render(u);h.appendChild(x),document.body.appendChild(h)}catch(x){console.error("❌ 渲染组件时出错:",x);return}const d=`${r}-${n}-${s}`;this.customComponentContainers.set(d,h),this.activeComponentKey=d,t.onMount&&t.onMount(h,u),h.addEventListener("click",x=>{x.stopPropagation()}),this.justCreatedComponent=!0,setTimeout(()=>{this.justCreatedComponent=!1},100)}createComponentContainer(r,t,a){const n=document.createElement("div");return n.className="vtable-custom-component",n.style.position="fixed",n.style.zIndex="9999",n.style.left=`${r}px`,n.style.top=`${t}px`,n.style.backgroundColor="white",n.style.borderRadius="4px",n.style.boxShadow="0 2px 12px rgba(0, 0, 0, 0.15)",a.containerStyle&&Object.assign(n.style,a.containerStyle),n}closeActiveComponent(){if(!this.activeComponentKey)return;const r=this.customComponentContainers.get(this.activeComponentKey);r&&(r.remove(),this.customComponentContainers.delete(this.activeComponentKey)),this.activeComponentKey=null}bindOutsideClickHandler(){document.addEventListener("click",this.handleOutsideClick)}destroy(){this.closeActiveComponent(),this.customComponentContainers.clear(),document.removeEventListener("click",this.handleOutsideClick)}}class _0{constructor(r,t){de(this,"markedMap",null);de(this,"tableInstance",null);de(this,"markedCellsSet",null);de(this,"tooltipThrottle",null);this.tableInstance=r,this.markedMap=t||null,t&&t.size>0&&(this.markedCellsSet=new Set(t.keys()),this.tooltipThrottle=new Map)}handleCellMouseEnter(r){if(!this.markedCellsSet||!this.tableInstance)return;const{col:t,row:a}=r,n=this.tableInstance.columnHeaderLevelCount||1,s=a-n;if(s<0)return;const i=`${s}-${t}`;if(!this.markedCellsSet.has(i))return;const c=`${t}-${a}`,f=Date.now(),o=this.tooltipThrottle.get(c)||0;f-o<100||(this.tooltipThrottle.set(c,f),this.showTooltip(t,a,i))}showTooltip(r,t,a){const n=this.tableInstance.getVisibleCellRangeRelativeRect({col:r,row:t}),s=this.markedMap.get(a),i=this.tableInstance.getCellValue(r,t),c=s==null?void 0:s.comment,f=c?`${i}: ${c}`:`${i}`;this.tableInstance.showTooltip(r,t,{content:f,referencePosition:{rect:n,placement:"right"},className:"defineTooltip",disappearDelay:100,style:{bgColor:"black",color:"white",arrowMark:!0,padding:[5,11]}})}getMarkedMap(){return this.markedMap}setMarkedMap(r){this.markedMap=r}destroy(){this.markedMap=null,this.tableInstance=null}}class v_{static registerEditors(r){if(r){if(r.dateEditor!==!1){const t=new ci.DateInputEditor(r.dateEditor||{});ln.VTable.register.editor("dateEditor",t)}if(r.listEditor){const t=new ci.ListEditor(r.listEditor||{values:["技术中心","财务部"]});ln.VTable.register.editor("listEditor",t)}r.customEditors&&Object.entries(r.customEditors).forEach(([t,a])=>{ln.VTable.register.editor(t,a)})}}}class g_{constructor(r,t,a){de(this,"tableInstance");de(this,"config");de(this,"customComponentManager",null);de(this,"cellMarkManager",null);this.config=r,this.tableInstance=r.tableInstance,this.customComponentManager=t,this.cellMarkManager=a}bindEvents(){this.tableInstance&&(this.tableInstance.on("click_cell",r=>{var t,a;this.handleCellClick(r),(a=(t=this.config).onCellClick)==null||a.call(t,r)}),this.config.onCellChange&&this.tableInstance.on("change_cell_value",this.config.onCellChange),this.tableInstance.on("mouseenter_cell",r=>{var t;(t=this.cellMarkManager)==null||t.handleCellMouseEnter(r)}))}handleCellClick(r){var c,f,o;const{col:t}=r,n=(this.config.columns||[])[t];if(!(n!=null&&n.customComponent))return;const s=n.customComponent,i=(c=this.config.customComponents)==null?void 0:c[s];i!=null&&i.showOnClick&&((f=this.customComponentManager)==null||f.closeActiveComponent(),(o=this.customComponentManager)==null||o.showComponent(s,i,r))}on(r,t){var a;(a=this.tableInstance)==null||a.on(r,t)}off(r,t){var a;(a=this.tableInstance)==null||a.off(r,t)}destroy(){this.tableInstance&&(this.tableInstance.off("click_cell"),this.tableInstance.off("change_cell_value"),this.tableInstance.off("mouseenter_cell")),this.tableInstance=null,this.customComponentManager=null,this.cellMarkManager=null}}class w0{constructor(r,t){de(this,"sheetInstance");de(this,"tableInstance");de(this,"container",null);de(this,"config");de(this,"customComponentManager",null);de(this,"cellMarkManager",null);de(this,"eventManager",null);de(this,"lastWidth",0);de(this,"lastHeight",0);de(this,"resizeTimeout",null);this.config=r,this.cellMarkManager=new _0(null,t),this.init()}init(){const r=this.config.container;if(this.container=this.getContainer(r),!this.container)throw console.error("TableSheet: Container not found",{input:r}),new Error("Container not found");(this.container.offsetWidth===0||this.container.offsetHeight===0)&&console.warn("TableSheet: Container has zero dimensions",{width:this.container.offsetWidth,height:this.container.offsetHeight}),v_.registerEditors(this.config.editors),this.createSheet()}getContainer(r){return typeof r=="string"?document.getElementById(r)||document.querySelector(r):r}createSheet(){var c;const{columns:r=[],records:t=[],showFormulaBar:a=!0,sheets:n,options:s}=this.config,i={showFormulaBar:a,showSheetTab:!0,sheets:n||[{sheetKey:"sheet1",sheetTitle:"Sheet1",dragOrder:{dragHeaderMode:"all"},columns:r,data:t}],tooltip:{isShowOverflowTextTooltip:!0},autoFillWidth:!0,autoFillHeight:!0,progressiveMode:!0,VTablePluginModules:[{module:no.AddRowColumnPlugin,disabled:!0,moduleOptions:{addColumnEnable:!1,addRowEnable:!1}}],...s};console.info("[sl-table-sheet]","create--vtableConfig",i),this.sheetInstance=new ln.VTableSheet(this.container,i),this.tableInstance=(c=this.sheetInstance.getActiveSheet())==null?void 0:c.tableInstance,this.initManagers()}initManagers(){var r;this.customComponentManager=new m_(this.tableInstance,this.container),this.cellMarkManager=new _0(this.tableInstance,((r=this.cellMarkManager)==null?void 0:r.getMarkedMap())||void 0),this.eventManager=new g_({tableInstance:this.tableInstance,columns:this.config.columns,customComponents:this.config.customComponents,onCellClick:this.config.onCellClick,onCellChange:this.config.onCellChange},this.customComponentManager,this.cellMarkManager),this.eventManager.bindEvents()}changeCellValue(r,t,a){this.tableInstance&&this.tableInstance.changeCellValue(r,t,a)}getCellValue(r,t){var a;return(a=this.tableInstance)==null?void 0:a.getCellValue(r,t)}getSelectedCells(){var r;return(r=this.tableInstance)==null?void 0:r.getSelectedCellInfos()}updateData(r){var a;const t=(a=this.sheetInstance)==null?void 0:a.getActiveSheet();if(t)if(typeof t.updateRecords=="function")t.updateRecords(r);else if(typeof t.setData=="function")t.setData(r);else if(this.tableInstance)if(typeof this.tableInstance.updateOption=="function")try{this.tableInstance.updateOption({records:r})}catch(n){console.warn("tableInstance.updateOption 失败:",n)}else console.warn("无法更新数据:找不到合适的方法");else console.warn("无法更新数据:找不到合适的方法");else console.warn("无法获取活动工作表")}updateColumns(r){var a;const t=(a=this.sheetInstance)==null?void 0:a.getActiveSheet();if(t)if(typeof t.updateColumns=="function")t.updateColumns(r);else if(typeof t.setColumns=="function")t.setColumns(r);else if(this.tableInstance)if(typeof this.tableInstance.updateOption=="function")try{this.tableInstance.updateOption({columns:r})}catch(n){console.warn("tableInstance.updateOption 失败:",n)}else console.warn("无法更新列配置:找不到合适的方法");else console.warn("无法更新列配置:找不到合适的方法");else console.warn("无法获取活动工作表")}addRow(r,t){var n;const a=(n=this.sheetInstance)==null?void 0:n.getActiveSheet();a&&a.addRecord(r,t)}deleteRow(r){var a;const t=(a=this.sheetInstance)==null?void 0:a.getActiveSheet();t&&t.deleteRecord(r)}exportData(r="csv"){var t,a;return(a=(t=this.sheetInstance)==null?void 0:t.exportData)==null?void 0:a.call(t,r)}switchSheet(r){var t,a;(t=this.sheetInstance)==null||t.switchSheet(r),this.tableInstance=(a=this.sheetInstance.getActiveSheet())==null?void 0:a.tableInstance}getActiveSheet(){var r;return(r=this.sheetInstance)==null?void 0:r.getActiveSheet()}getAllSheets(){var r;return(r=this.sheetInstance)==null?void 0:r.getAllSheets()}refresh(){if(this.tableInstance&&this.tableInstance.option)try{this.tableInstance.updateOption(this.tableInstance.option)}catch(r){console.warn("刷新表格失败:",r);const t=this.tableInstance.container;t&&(t.style.display="none",setTimeout(()=>{t.style.display=""},0))}}setFrozenColCount(r){if(this.tableInstance)try{if(typeof this.tableInstance.setFrozenColCount=="function")this.tableInstance.setFrozenColCount(r);else if(typeof this.tableInstance.updateOption=="function"){const t=this.tableInstance.option||{};this.tableInstance.updateOption({...t,frozenColCount:r})}}catch(t){console.warn("设置冻结列失败:",t)}}resize(){if(!this.sheetInstance){console.warn("sheetInstance 不存在,无法 resize");return}const r=this.container;if(!r)return;const t=r.clientWidth,a=r.clientHeight;t===this.lastWidth&&a===this.lastHeight||(this.lastWidth=t,this.lastHeight=a,typeof this.sheetInstance.resize=="function"?this.sheetInstance.resize():console.warn("sheetInstance.resize 方法不可用"))}resizeDebounced(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.resize(),this.resizeTimeout=null},100)}getSheetInstance(){return this.sheetInstance}getTableInstance(){return this.tableInstance}setColumnCustomRender(r,t){var n;const a=(n=this.sheetInstance)==null?void 0:n.getActiveSheet();if(a){const s=a.columns||[],i=s.find(c=>c.field===r);i&&(i.customRender=t,a.updateColumns(s))}}getMarkedMap(){var r;return((r=this.cellMarkManager)==null?void 0:r.getMarkedMap())||null}getAllRecords(){if(!this.tableInstance)return[];const r=this.tableInstance.rowCount??0,t=this.tableInstance.colCount??0,a=this.tableInstance.columnHeaderLevelCount??1,n=[];for(let s=a;s<r;s++){const i=[];for(let c=0;c<t;c++)i.push(this.tableInstance.getCellValue(c,s));n.push(i)}return n}getColumns(){var r,t;return((t=(r=this.tableInstance)==null?void 0:r.options)==null?void 0:t.columns)||[]}on(r,t){var a;(a=this.eventManager)==null||a.on(r,t)}off(r,t){var a;(a=this.eventManager)==null||a.off(r,t)}destroy(){var r,t,a,n,s;(r=this.eventManager)==null||r.destroy(),(t=this.cellMarkManager)==null||t.destroy(),(a=this.customComponentManager)==null||a.destroy(),this.eventManager=null,this.cellMarkManager=null,this.customComponentManager=null,this.sheetInstance&&((s=(n=this.sheetInstance).destroy)==null||s.call(n),this.sheetInstance=null,this.tableInstance=null),this.container&&(this.container.innerHTML="")}}const __={toolbar:{title:"制表错误",unit:"条",total:"共 {total} 个错误项",hint:"请在错误项里查询对应的数据或在数据里进行搜索",buttons:{search:"查找/替换",freeze:{label:"冻结前",suffix:"个列"},list:"仅显示错误列"}},dialog:{find:{label:"查找内容",placeholder:"请输入查找内容"},replace:{label:"替换为",placeholder:"请输入替换内容"},checkbox:{selectedOnly:"只替换选中列"},buttons:{close:"关闭",findPrev:"查找上一个",findNext:"查找下一个",replaceOne:"替换",replaceAll:"全部替换"},messages:{pleaseInputFind:"请输入查找内容",notConnected:"未连接表格实例",pleaseSelectColumns:"请先选中要搜索的列",noMatchFound:"未找到匹配内容",nothingToReplace:"没有可替换的内容",replacedOne:"已替换第 {index} 个匹配项",replacedAll:"已替换全部 {count} 个匹配项"},result:{found:"已找到 {count} 个结果"}},sheet:{defaultTitle:"Sheet1"}},w_={toolbar:{title:"製表錯誤",unit:"筆",total:"共 {total} 個錯誤項",hint:"請在錯誤項裡查詢對應的資料或在資料裡進行搜尋",buttons:{search:"尋找/取代",freeze:{label:"凍結前",suffix:"欄"},list:"僅顯示錯誤欄"}},dialog:{find:{label:"尋找內容",placeholder:"請輸入尋找內容"},replace:{label:"取代為",placeholder:"請輸入取代內容"},checkbox:{selectedOnly:"只取代選中欄"},buttons:{close:"關閉",findPrev:"尋找上一個",findNext:"尋找下一個",replaceOne:"取代",replaceAll:"全部取代"},messages:{pleaseInputFind:"請輸入尋找內容",notConnected:"未連接表格實例",pleaseSelectColumns:"請先選中要搜尋的欄",noMatchFound:"未找到符合內容",nothingToReplace:"沒有可取代的內容",replacedOne:"已取代第 {index} 個符合項",replacedAll:"已取代全部 {count} 個符合項"},result:{found:"已找到 {count} 個結果"}},sheet:{defaultTitle:"Sheet1"}},E_={toolbar:{title:"Table Errors",unit:"items",total:"Total {total} errors",hint:"Please search for the corresponding data in the error items or in the data",buttons:{search:"Find/Replace",freeze:{label:"Freeze first",suffix:"columns"},list:"Show error columns only"}},dialog:{find:{label:"Find content",placeholder:"Please enter content to find"},replace:{label:"Replace with",placeholder:"Please enter replacement content"},checkbox:{selectedOnly:"Replace selected columns only"},buttons:{close:"Close",findPrev:"Find Previous",findNext:"Find Next",replaceOne:"Replace",replaceAll:"Replace All"},messages:{pleaseInputFind:"Please enter content to find",notConnected:"Table instance not connected",pleaseSelectColumns:"Please select columns to search first",noMatchFound:"No matching content found",nothingToReplace:"Nothing to replace",replacedOne:"Replaced match #{index}",replacedAll:"Replaced all {count} matches"},result:{found:"Found {count} result(s)"}},sheet:{defaultTitle:"Sheet1"}},T_={"zh-CN":__,"en-US":E_,"zh-TW":w_};let k_="zh-CN";function S_(){return T_[k_]}function y_(e,r={}){return e.replace(/\{(\w+)\}/g,(t,a)=>r[a]!==void 0?String(r[a]):`{${a}}`)}function Jn(e,r){const t=S_(),a=e.split(".");let n=t;for(const s of a)if(n&&typeof n=="object"&&s in n)n=n[s];else return console.warn(`I18n message not found: ${e}`),e;return typeof n=="string"?y_(n,r||{}):(console.warn(`I18n message is not a string: ${e}`),e)}class F_{constructor(r){de(this,"container",null);de(this,"toolbarElement",null);de(this,"config");de(this,"elements",{});this.config={freezeCount:0,showErrorList:!1,buttons:{search:!0,freeze:!0,export:!0,refresh:!0,list:!1},...r},this.container=this.getContainer(this.config.container),this.createToolbar(),this.injectStyles()}getContainer(r){return Sn.getContainer(r)}createToolbar(){this.toolbarElement=document.createElement("div"),this.toolbarElement.className="sl-excel-toolbar";const r=this.createLeftSection(),t=this.createRightSection();this.toolbarElement.appendChild(r),this.toolbarElement.appendChild(t),this.container&&this.container.appendChild(this.toolbarElement)}createLeftSection(){const r=document.createElement("div");if(r.className="sl-excel-toolbar-left",this.config.leftSlot){const t=typeof this.config.leftSlot=="function"?this.config.leftSlot():this.config.leftSlot;t&&r.appendChild(t)}return r}createRightSection(){const r=document.createElement("div");r.className="sl-excel-toolbar-right";const{buttons:t}=this.config;if((t==null?void 0:t.search)!==!1){const a=this.createButton({text:Jn("toolbar.buttons.search"),onClick:()=>{var n,s;return(s=(n=this.config).onSearchClick)==null?void 0:s.call(n)}});r.appendChild(a)}if((t==null?void 0:t.freeze)!==!1){const a=this.createFreezeButton();r.appendChild(a)}return r}createButton(r){const t=document.createElement("button");return t.className=r.icon?"sl-excel-toolbar-btn sl-excel-toolbar-btn-icon":"sl-excel-toolbar-btn",t.textContent=r.text,r.title&&(t.title=r.title),r.onClick&&(t.onclick=r.onClick),t}createFreezeButton(){const r=document.createElement("div");r.className="sl-excel-freeze-selector";const t=document.createElement("span");t.className="sl-excel-freeze-label",t.textContent=Jn("toolbar.buttons.freeze.label");const a=document.createElement("div");a.className="sl-excel-freeze-input-wrapper";const n=document.createElement("input");n.type="number",n.className="sl-excel-freeze-input",n.min="0",n.max="100",n.value=String(this.config.freezeCount||0),this.elements.freezeSelect=n;const s=document.createElement("div");s.className="sl-excel-freeze-arrows";const i=document.createElement("button");i.className="sl-excel-freeze-arrow sl-excel-freeze-arrow-up",i.innerHTML="^",i.type="button";const c=document.createElement("button");c.className="sl-excel-freeze-arrow sl-excel-freeze-arrow-down",c.innerHTML="^",c.type="button",s.appendChild(i),s.appendChild(c);const f=document.createElement("span");f.className="sl-excel-freeze-suffix",f.textContent=Jn("toolbar.buttons.freeze.suffix");const o=l=>{var h,u;l<0&&(l=0),l>100&&(l=100),n.value=String(l),this.config.freezeCount=l,(u=(h=this.config).onFreezeChange)==null||u.call(h,l)};return i.onclick=l=>{l.preventDefault();const h=parseInt(n.value,10)||0;o(h+1)},c.onclick=l=>{l.preventDefault();const h=parseInt(n.value,10)||0;o(h-1)},n.oninput=()=>{let l=parseInt(n.value,10);(isNaN(l)||l<0)&&(l=0,n.value="0"),l>100&&(l=100,n.value="100"),this.config.freezeCount=l},n.onblur=()=>{var h,u;const l=parseInt(n.value,10)||0;(u=(h=this.config).onFreezeChange)==null||u.call(h,l)},n.onkeydown=l=>{l.key==="Enter"&&n.blur()},a.appendChild(n),a.appendChild(s),r.appendChild(t),r.appendChild(a),r.appendChild(f),r}injectStyles(){Sn.injectStyles(x_,u_)}updateFreezeCount(r){this.config.freezeCount=r,this.elements.freezeSelect&&(this.elements.freezeSelect.value=String(r))}updateShowErrorList(r){this.config.showErrorList=r,this.elements.errorListCheckbox&&(this.elements.errorListCheckbox.checked=r)}show(){this.toolbarElement&&(this.toolbarElement.style.display="flex")}hide(){this.toolbarElement&&(this.toolbarElement.style.display="none")}getElement(){return this.toolbarElement}setLeftSlot(r){var a;const t=(a=this.toolbarElement)==null?void 0:a.querySelector(".sl-toolbar-left");if(t&&(t.innerHTML="",r)){const n=typeof r=="function"?r():r;n&&t.appendChild(n)}}getLeftSection(){var r;return((r=this.toolbarElement)==null?void 0:r.querySelector(".sl-toolbar-left"))||null}destroy(){this.toolbarElement&&(this.toolbarElement.remove(),this.toolbarElement=null),this.elements={}}}class Zn{static processRecords(r,t){const a=new Map;return{displayRecords:r.map((s,i)=>Array.isArray(s)?this.processArrayRow(s,i,a):this.processObjectRow(s,i,t,a)),markedMap:a}}static processArrayRow(r,t,a){return r.map((n,s)=>n&&typeof n=="object"&&"value"in n?(n.isMarked&&a.set(`${t}-${s}`,{isMarked:!0,comment:n.comment||""}),n.value):n)}static processObjectRow(r,t,a,n){return a.map((s,i)=>{const c=s.field||s.key,f=r[c];return f&&typeof f=="object"&&"value"in f?(f.isMarked&&n.set(`${t}-${i}`,{isMarked:!0,comment:f.comment||""}),f.value):f})}}const C_=(e,r)=>({bgColor:"#FFEBEB",color:"#FF4D50",marked:{shape:"triangle",bgColor:"#FF4D50",size:8}}),E0={color:"#1D2129",fontSize:14,fontWeight:"400",bgColor:"#F9FAFB"},Qn={color:"#6B7280",fontSize:14,bgColor:"white"};class T0{static initColumns(r,t,a=1){const n=new Map;if(t.size>0)for(const[s]of t){const[i,c]=s.split("-"),f=parseInt(i,10),o=parseInt(c,10);n.has(o)||n.set(o,new Set),n.get(o).add(f)}return r.map((s,i)=>{const c=s.style,f={...s},o=n.get(i);if(!o||o.size===0)return f.style=c||(()=>Qn),f.headerStyle=E0,f;const l=new Map;return f.style=h=>{const u=h.row-a;if(u<0||!o.has(u))return c?c(h):Qn;const d=`${u}-${i}`;let p=l.get(d);return p||(p=C_(),l.set(d,p)),{...c?c(h):Qn,...p,bgColor:p.bgColor,color:p.color}},f.headerStyle=E0,f})}}class A_{constructor(r){de(this,"tableSheet",null);de(this,"findReplaceDialog",null);de(this,"toolbar",null);de(this,"sheetTabs",null);de(this,"container",null);de(this,"tableContainer",null);de(this,"toolbarContainer",null);de(this,"sheetTabsContainer",null);de(this,"loadingOverlay",null);de(this,"config");de(this,"multiSheetData",null);de(this,"timers",[]);de(this,"resizeObserver",null);de(this,"lastObservedWidth",0);de(this,"lastObservedHeight",0);this.config={showToolbar:!0,autoResize:!1,loading:{show:!0,text:"加载中..."},...r},this.init()}init(){if(this.container=this.getContainer(this.config.container),!this.container)throw new Error("Container not found");if(this.createLayout(),this.config.showToolbar&&this.createToolbar(),this.injectStyles(),this.createTable(),this.config.showSheets===!1&&this.container){this.container.classList.add("hide-native-sheet-tab");const r=setTimeout(()=>{this.container&&this.container.querySelectorAll(".vtable-sheet-tab-bar").forEach(n=>{n.style.display="none"});const t=this.timers.indexOf(r);t>-1&&this.timers.splice(t,1)},0);this.timers.push(r)}!this.config.showFormulaBar&&this.container&&this.container.classList.add("hide-formula-bar"),this.createFindReplaceDialog(),this.config.autoResize&&this.enableAutoResize()}getContainer(r){return typeof r=="string"?document.getElementById(r)||document.querySelector(r):r}createLayout(){this.container&&(this.container.innerHTML="",this.container.className="sl-table-sheet-wrapper",this.container.style.display="flex",this.container.style.flexDirection="column",this.config.showToolbar&&(this.toolbarContainer=document.createElement("div"),this.container.appendChild(this.toolbarContainer)),this.config.showTabs!==!1&&(this.sheetTabsContainer=document.createElement("div"),this.sheetTabsContainer.className="sl-sheet-tabs-container",this.container.appendChild(this.sheetTabsContainer)),this.tableContainer=document.createElement("div"),this.tableContainer.className="sl-table-container",this.tableContainer.style.flex="1",this.tableContainer.style.minHeight="0",this.tableContainer.style.overflow="hidden",this.container.appendChild(this.tableContainer),this.loadingOverlay=document.createElement("div"),this.loadingOverlay.className="sl-loading-overlay",this.loadingOverlay.innerHTML=`
605
605
  <div class="sl-loading-spinner">
606
606
  <div class="sl-spinner"></div>
607
607
  <span class="sl-loading-text">加载中...</span>
@@ -25955,7 +25955,7 @@ const d_ = {
25955
25955
  search: "查找/替换",
25956
25956
  freeze: {
25957
25957
  label: "冻结前",
25958
- suffix: "列"
25958
+ suffix: "个列"
25959
25959
  },
25960
25960
  list: "仅显示错误列"
25961
25961
  }
@@ -420,7 +420,7 @@
420
420
  opacity: 0.8;
421
421
  transition: opacity 0.2s;
422
422
  margin-top:-3px;
423
- `,i.onmouseenter=()=>i.style.opacity="1",i.onmouseleave=()=>i.style.opacity="0.8",n.appendChild(i),document.body.appendChild(n);let c,f,o;const l=()=>{clearTimeout(c),clearTimeout(o),n.classList.remove("show"),f=setTimeout(()=>{clearTimeout(f),n.parentNode&&document.body.removeChild(n)},300)};i.onclick=l,o=setTimeout(()=>{clearTimeout(o),n.classList.add("show")},10),c=setTimeout(l,3e3)}setTableInstance(r){this.tableInstance=r,this.state.matches=[],this.state.currentIndex=0,this.clearResults()}setSelectedColumnsOnly(r){this.elements.selectedColumnsOnly&&(this.elements.selectedColumnsOnly.checked=r)}getSelectedColumnsOnly(){var r;return((r=this.elements.selectedColumnsOnly)==null?void 0:r.checked)||!1}setFindText(r){this.state.findText=r,this.elements.findInput&&(this.elements.findInput.value=r)}setReplaceText(r){this.state.replaceText=r,this.elements.replaceInput&&(this.elements.replaceInput.value=r)}destroy(){this.dialog&&(this.dialog.remove(),this.dialog=null)}}const $f={"zh-CN":{toolbar:{title:"制表错误",unit:"条",total:"共 {total} 个错误项",hint:"请在错误项里查询对应的数据或在数据里进行搜索",buttons:{search:"查找/替换",freeze:{label:"冻结前",suffix:"列"},list:"仅显示错误列"}},dialog:{find:{label:"查找内容",placeholder:"请输入查找内容"},replace:{label:"替换为",placeholder:"请输入替换内容"},checkbox:{selectedOnly:"只替换选中列"},buttons:{close:"关闭",findPrev:"查找上一个",findNext:"查找下一个",replaceOne:"替换",replaceAll:"全部替换"},messages:{pleaseInputFind:"请输入查找内容",notConnected:"未连接表格实例",pleaseSelectColumns:"请先选中要搜索的列",noMatchFound:"未找到匹配内容",nothingToReplace:"没有可替换的内容",replacedOne:"已替换第 {index} 个匹配项",replacedAll:"已替换全部 {count} 个匹配项"},result:{found:"已找到 {count} 个结果"}},sheet:{defaultTitle:"Sheet1"}},"en-US":{toolbar:{title:"Table Errors",unit:"items",total:"Total {total} errors",hint:"Please search for the corresponding data in the error items or in the data",buttons:{search:"Find/Replace",freeze:{label:"Freeze first",suffix:"columns"},list:"Show error columns only"}},dialog:{find:{label:"Find content",placeholder:"Please enter content to find"},replace:{label:"Replace with",placeholder:"Please enter replacement content"},checkbox:{selectedOnly:"Replace selected columns only"},buttons:{close:"Close",findPrev:"Find Previous",findNext:"Find Next",replaceOne:"Replace",replaceAll:"Replace All"},messages:{pleaseInputFind:"Please enter content to find",notConnected:"Table instance not connected",pleaseSelectColumns:"Please select columns to search first",noMatchFound:"No matching content found",nothingToReplace:"Nothing to replace",replacedOne:"Replaced match #{index}",replacedAll:"Replaced all {count} matches"},result:{found:"Found {count} result(s)"}},sheet:{defaultTitle:"Sheet1"}},"zh-TW":{toolbar:{title:"製表錯誤",unit:"筆",total:"共 {total} 個錯誤項",hint:"請在錯誤項裡查詢對應的資料或在資料裡進行搜尋",buttons:{search:"尋找/取代",freeze:{label:"凍結前",suffix:"欄"},list:"僅顯示錯誤欄"}},dialog:{find:{label:"尋找內容",placeholder:"請輸入尋找內容"},replace:{label:"取代為",placeholder:"請輸入取代內容"},checkbox:{selectedOnly:"只取代選中欄"},buttons:{close:"關閉",findPrev:"尋找上一個",findNext:"尋找下一個",replaceOne:"取代",replaceAll:"全部取代"},messages:{pleaseInputFind:"請輸入尋找內容",notConnected:"未連接表格實例",pleaseSelectColumns:"請先選中要搜尋的欄",noMatchFound:"未找到符合內容",nothingToReplace:"沒有可取代的內容",replacedOne:"已取代第 {index} 個符合項",replacedAll:"已取代全部 {count} 個符合項"},result:{found:"已找到 {count} 個結果"}},sheet:{defaultTitle:"Sheet1"}}};let jf="zh-CN";function Kf(){return $f[jf]}function Yf(e,r={}){return e.replace(/\{(\w+)\}/g,(t,a)=>r[a]!==void 0?String(r[a]):`{${a}}`)}function Bn(e,r){const t=Kf(),a=e.split(".");let n=t;for(const s of a)if(n&&typeof n=="object"&&s in n)n=n[s];else return console.warn(`I18n message not found: ${e}`),e;return typeof n=="string"?Yf(n,r||{}):(console.warn(`I18n message is not a string: ${e}`),e)}class qf{constructor(r){de(this,"container",null);de(this,"toolbarElement",null);de(this,"config");de(this,"elements",{});this.config={freezeCount:0,showErrorList:!1,buttons:{search:!0,freeze:!0,export:!0,refresh:!0,list:!1},...r},this.container=this.getContainer(this.config.container),this.createToolbar(),this.injectStyles()}getContainer(r){return en.getContainer(r)}createToolbar(){this.toolbarElement=document.createElement("div"),this.toolbarElement.className="sl-excel-toolbar";const r=this.createLeftSection(),t=this.createRightSection();this.toolbarElement.appendChild(r),this.toolbarElement.appendChild(t),this.container&&this.container.appendChild(this.toolbarElement)}createLeftSection(){const r=document.createElement("div");if(r.className="sl-excel-toolbar-left",this.config.leftSlot){const t=typeof this.config.leftSlot=="function"?this.config.leftSlot():this.config.leftSlot;t&&r.appendChild(t)}return r}createRightSection(){const r=document.createElement("div");r.className="sl-excel-toolbar-right";const{buttons:t}=this.config;if((t==null?void 0:t.search)!==!1){const a=this.createButton({text:Bn("toolbar.buttons.search"),onClick:()=>{var n,s;return(s=(n=this.config).onSearchClick)==null?void 0:s.call(n)}});r.appendChild(a)}if((t==null?void 0:t.freeze)!==!1){const a=this.createFreezeButton();r.appendChild(a)}return r}createButton(r){const t=document.createElement("button");return t.className=r.icon?"sl-excel-toolbar-btn sl-excel-toolbar-btn-icon":"sl-excel-toolbar-btn",t.textContent=r.text,r.title&&(t.title=r.title),r.onClick&&(t.onclick=r.onClick),t}createFreezeButton(){const r=document.createElement("div");r.className="sl-excel-freeze-selector";const t=document.createElement("span");t.className="sl-excel-freeze-label",t.textContent=Bn("toolbar.buttons.freeze.label");const a=document.createElement("div");a.className="sl-excel-freeze-input-wrapper";const n=document.createElement("input");n.type="number",n.className="sl-excel-freeze-input",n.min="0",n.max="100",n.value=String(this.config.freezeCount||0),this.elements.freezeSelect=n;const s=document.createElement("div");s.className="sl-excel-freeze-arrows";const i=document.createElement("button");i.className="sl-excel-freeze-arrow sl-excel-freeze-arrow-up",i.innerHTML="^",i.type="button";const c=document.createElement("button");c.className="sl-excel-freeze-arrow sl-excel-freeze-arrow-down",c.innerHTML="^",c.type="button",s.appendChild(i),s.appendChild(c);const f=document.createElement("span");f.className="sl-excel-freeze-suffix",f.textContent=Bn("toolbar.buttons.freeze.suffix");const o=l=>{var h,u;l<0&&(l=0),l>100&&(l=100),n.value=String(l),this.config.freezeCount=l,(u=(h=this.config).onFreezeChange)==null||u.call(h,l)};return i.onclick=l=>{l.preventDefault();const h=parseInt(n.value,10)||0;o(h+1)},c.onclick=l=>{l.preventDefault();const h=parseInt(n.value,10)||0;o(h-1)},n.oninput=()=>{let l=parseInt(n.value,10);(isNaN(l)||l<0)&&(l=0,n.value="0"),l>100&&(l=100,n.value="100"),this.config.freezeCount=l},n.onblur=()=>{var h,u;const l=parseInt(n.value,10)||0;(u=(h=this.config).onFreezeChange)==null||u.call(h,l)},n.onkeydown=l=>{l.key==="Enter"&&n.blur()},a.appendChild(n),a.appendChild(s),r.appendChild(t),r.appendChild(a),r.appendChild(f),r}injectStyles(){en.injectStyles(Vf,Hf)}updateFreezeCount(r){this.config.freezeCount=r,this.elements.freezeSelect&&(this.elements.freezeSelect.value=String(r))}updateShowErrorList(r){this.config.showErrorList=r,this.elements.errorListCheckbox&&(this.elements.errorListCheckbox.checked=r)}show(){this.toolbarElement&&(this.toolbarElement.style.display="flex")}hide(){this.toolbarElement&&(this.toolbarElement.style.display="none")}getElement(){return this.toolbarElement}setLeftSlot(r){var a;const t=(a=this.toolbarElement)==null?void 0:a.querySelector(".sl-toolbar-left");if(t&&(t.innerHTML="",r)){const n=typeof r=="function"?r():r;n&&t.appendChild(n)}}getLeftSection(){var r;return((r=this.toolbarElement)==null?void 0:r.querySelector(".sl-toolbar-left"))||null}destroy(){this.toolbarElement&&(this.toolbarElement.remove(),this.toolbarElement=null),this.elements={}}}class Jf{constructor(r){de(this,"container");de(this,"tabsElement",null);de(this,"sheets",[]);de(this,"activeIndex",0);de(this,"onTabChange");this.container=r.container,this.sheets=r.sheets,this.activeIndex=r.activeIndex??0,this.onTabChange=r.onTabChange,this.init()}init(){this.injectStyles(),this.render()}injectStyles(){const r="sl-sheet-tabs-styles";if(document.getElementById(r))return;const t=document.createElement("style");t.id=r,t.textContent=`
423
+ `,i.onmouseenter=()=>i.style.opacity="1",i.onmouseleave=()=>i.style.opacity="0.8",n.appendChild(i),document.body.appendChild(n);let c,f,o;const l=()=>{clearTimeout(c),clearTimeout(o),n.classList.remove("show"),f=setTimeout(()=>{clearTimeout(f),n.parentNode&&document.body.removeChild(n)},300)};i.onclick=l,o=setTimeout(()=>{clearTimeout(o),n.classList.add("show")},10),c=setTimeout(l,3e3)}setTableInstance(r){this.tableInstance=r,this.state.matches=[],this.state.currentIndex=0,this.clearResults()}setSelectedColumnsOnly(r){this.elements.selectedColumnsOnly&&(this.elements.selectedColumnsOnly.checked=r)}getSelectedColumnsOnly(){var r;return((r=this.elements.selectedColumnsOnly)==null?void 0:r.checked)||!1}setFindText(r){this.state.findText=r,this.elements.findInput&&(this.elements.findInput.value=r)}setReplaceText(r){this.state.replaceText=r,this.elements.replaceInput&&(this.elements.replaceInput.value=r)}destroy(){this.dialog&&(this.dialog.remove(),this.dialog=null)}}const $f={"zh-CN":{toolbar:{title:"制表错误",unit:"条",total:"共 {total} 个错误项",hint:"请在错误项里查询对应的数据或在数据里进行搜索",buttons:{search:"查找/替换",freeze:{label:"冻结前",suffix:"个列"},list:"仅显示错误列"}},dialog:{find:{label:"查找内容",placeholder:"请输入查找内容"},replace:{label:"替换为",placeholder:"请输入替换内容"},checkbox:{selectedOnly:"只替换选中列"},buttons:{close:"关闭",findPrev:"查找上一个",findNext:"查找下一个",replaceOne:"替换",replaceAll:"全部替换"},messages:{pleaseInputFind:"请输入查找内容",notConnected:"未连接表格实例",pleaseSelectColumns:"请先选中要搜索的列",noMatchFound:"未找到匹配内容",nothingToReplace:"没有可替换的内容",replacedOne:"已替换第 {index} 个匹配项",replacedAll:"已替换全部 {count} 个匹配项"},result:{found:"已找到 {count} 个结果"}},sheet:{defaultTitle:"Sheet1"}},"en-US":{toolbar:{title:"Table Errors",unit:"items",total:"Total {total} errors",hint:"Please search for the corresponding data in the error items or in the data",buttons:{search:"Find/Replace",freeze:{label:"Freeze first",suffix:"columns"},list:"Show error columns only"}},dialog:{find:{label:"Find content",placeholder:"Please enter content to find"},replace:{label:"Replace with",placeholder:"Please enter replacement content"},checkbox:{selectedOnly:"Replace selected columns only"},buttons:{close:"Close",findPrev:"Find Previous",findNext:"Find Next",replaceOne:"Replace",replaceAll:"Replace All"},messages:{pleaseInputFind:"Please enter content to find",notConnected:"Table instance not connected",pleaseSelectColumns:"Please select columns to search first",noMatchFound:"No matching content found",nothingToReplace:"Nothing to replace",replacedOne:"Replaced match #{index}",replacedAll:"Replaced all {count} matches"},result:{found:"Found {count} result(s)"}},sheet:{defaultTitle:"Sheet1"}},"zh-TW":{toolbar:{title:"製表錯誤",unit:"筆",total:"共 {total} 個錯誤項",hint:"請在錯誤項裡查詢對應的資料或在資料裡進行搜尋",buttons:{search:"尋找/取代",freeze:{label:"凍結前",suffix:"欄"},list:"僅顯示錯誤欄"}},dialog:{find:{label:"尋找內容",placeholder:"請輸入尋找內容"},replace:{label:"取代為",placeholder:"請輸入取代內容"},checkbox:{selectedOnly:"只取代選中欄"},buttons:{close:"關閉",findPrev:"尋找上一個",findNext:"尋找下一個",replaceOne:"取代",replaceAll:"全部取代"},messages:{pleaseInputFind:"請輸入尋找內容",notConnected:"未連接表格實例",pleaseSelectColumns:"請先選中要搜尋的欄",noMatchFound:"未找到符合內容",nothingToReplace:"沒有可取代的內容",replacedOne:"已取代第 {index} 個符合項",replacedAll:"已取代全部 {count} 個符合項"},result:{found:"已找到 {count} 個結果"}},sheet:{defaultTitle:"Sheet1"}}};let jf="zh-CN";function Kf(){return $f[jf]}function Yf(e,r={}){return e.replace(/\{(\w+)\}/g,(t,a)=>r[a]!==void 0?String(r[a]):`{${a}}`)}function Bn(e,r){const t=Kf(),a=e.split(".");let n=t;for(const s of a)if(n&&typeof n=="object"&&s in n)n=n[s];else return console.warn(`I18n message not found: ${e}`),e;return typeof n=="string"?Yf(n,r||{}):(console.warn(`I18n message is not a string: ${e}`),e)}class qf{constructor(r){de(this,"container",null);de(this,"toolbarElement",null);de(this,"config");de(this,"elements",{});this.config={freezeCount:0,showErrorList:!1,buttons:{search:!0,freeze:!0,export:!0,refresh:!0,list:!1},...r},this.container=this.getContainer(this.config.container),this.createToolbar(),this.injectStyles()}getContainer(r){return en.getContainer(r)}createToolbar(){this.toolbarElement=document.createElement("div"),this.toolbarElement.className="sl-excel-toolbar";const r=this.createLeftSection(),t=this.createRightSection();this.toolbarElement.appendChild(r),this.toolbarElement.appendChild(t),this.container&&this.container.appendChild(this.toolbarElement)}createLeftSection(){const r=document.createElement("div");if(r.className="sl-excel-toolbar-left",this.config.leftSlot){const t=typeof this.config.leftSlot=="function"?this.config.leftSlot():this.config.leftSlot;t&&r.appendChild(t)}return r}createRightSection(){const r=document.createElement("div");r.className="sl-excel-toolbar-right";const{buttons:t}=this.config;if((t==null?void 0:t.search)!==!1){const a=this.createButton({text:Bn("toolbar.buttons.search"),onClick:()=>{var n,s;return(s=(n=this.config).onSearchClick)==null?void 0:s.call(n)}});r.appendChild(a)}if((t==null?void 0:t.freeze)!==!1){const a=this.createFreezeButton();r.appendChild(a)}return r}createButton(r){const t=document.createElement("button");return t.className=r.icon?"sl-excel-toolbar-btn sl-excel-toolbar-btn-icon":"sl-excel-toolbar-btn",t.textContent=r.text,r.title&&(t.title=r.title),r.onClick&&(t.onclick=r.onClick),t}createFreezeButton(){const r=document.createElement("div");r.className="sl-excel-freeze-selector";const t=document.createElement("span");t.className="sl-excel-freeze-label",t.textContent=Bn("toolbar.buttons.freeze.label");const a=document.createElement("div");a.className="sl-excel-freeze-input-wrapper";const n=document.createElement("input");n.type="number",n.className="sl-excel-freeze-input",n.min="0",n.max="100",n.value=String(this.config.freezeCount||0),this.elements.freezeSelect=n;const s=document.createElement("div");s.className="sl-excel-freeze-arrows";const i=document.createElement("button");i.className="sl-excel-freeze-arrow sl-excel-freeze-arrow-up",i.innerHTML="^",i.type="button";const c=document.createElement("button");c.className="sl-excel-freeze-arrow sl-excel-freeze-arrow-down",c.innerHTML="^",c.type="button",s.appendChild(i),s.appendChild(c);const f=document.createElement("span");f.className="sl-excel-freeze-suffix",f.textContent=Bn("toolbar.buttons.freeze.suffix");const o=l=>{var h,u;l<0&&(l=0),l>100&&(l=100),n.value=String(l),this.config.freezeCount=l,(u=(h=this.config).onFreezeChange)==null||u.call(h,l)};return i.onclick=l=>{l.preventDefault();const h=parseInt(n.value,10)||0;o(h+1)},c.onclick=l=>{l.preventDefault();const h=parseInt(n.value,10)||0;o(h-1)},n.oninput=()=>{let l=parseInt(n.value,10);(isNaN(l)||l<0)&&(l=0,n.value="0"),l>100&&(l=100,n.value="100"),this.config.freezeCount=l},n.onblur=()=>{var h,u;const l=parseInt(n.value,10)||0;(u=(h=this.config).onFreezeChange)==null||u.call(h,l)},n.onkeydown=l=>{l.key==="Enter"&&n.blur()},a.appendChild(n),a.appendChild(s),r.appendChild(t),r.appendChild(a),r.appendChild(f),r}injectStyles(){en.injectStyles(Vf,Hf)}updateFreezeCount(r){this.config.freezeCount=r,this.elements.freezeSelect&&(this.elements.freezeSelect.value=String(r))}updateShowErrorList(r){this.config.showErrorList=r,this.elements.errorListCheckbox&&(this.elements.errorListCheckbox.checked=r)}show(){this.toolbarElement&&(this.toolbarElement.style.display="flex")}hide(){this.toolbarElement&&(this.toolbarElement.style.display="none")}getElement(){return this.toolbarElement}setLeftSlot(r){var a;const t=(a=this.toolbarElement)==null?void 0:a.querySelector(".sl-toolbar-left");if(t&&(t.innerHTML="",r)){const n=typeof r=="function"?r():r;n&&t.appendChild(n)}}getLeftSection(){var r;return((r=this.toolbarElement)==null?void 0:r.querySelector(".sl-toolbar-left"))||null}destroy(){this.toolbarElement&&(this.toolbarElement.remove(),this.toolbarElement=null),this.elements={}}}class Jf{constructor(r){de(this,"container");de(this,"tabsElement",null);de(this,"sheets",[]);de(this,"activeIndex",0);de(this,"onTabChange");this.container=r.container,this.sheets=r.sheets,this.activeIndex=r.activeIndex??0,this.onTabChange=r.onTabChange,this.init()}init(){this.injectStyles(),this.render()}injectStyles(){const r="sl-sheet-tabs-styles";if(document.getElementById(r))return;const t=document.createElement("style");t.id=r,t.textContent=`
424
424
  .sl-sheet-tabs-container{
425
425
  margin-top:16px;
426
426
  }