@senlinz/import-export 0.1.0-beta.6 → 0.1.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,20 +1,60 @@
1
1
  # @senlinz/import-export
2
+ example for import and export excel file
2
3
 
3
4
  ```html
4
5
  <!DOCTYPE html>
5
- <html dir="ltr" lang="en">
6
+ <html lang="en">
6
7
 
7
8
  <head>
8
- <meta charset="utf-8" />
9
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" />
10
- <title>Stencil Component Starter</title>
11
- <script type="module">
12
- import {ImexportTable} from './imexport-table.js';
13
- </script>
9
+ <meta charset="UTF-8">
10
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
+ <title>IMPORT-EXPORT-TEST</title>
14
12
  </head>
13
+ <button id="btnImport">Import</button>
14
+ <button id="btnExport">Export</button>
15
+ <button id="btnDownloadTemplate">Download Template</button>
16
+ <div id="importOutput"></div>
15
17
 
16
18
  <body>
17
- <imexport-table></imexport-table>
19
+ <script type="module">
20
+ import {
21
+ importExcel,
22
+ exportExcel,
23
+ downloadExcelTemplate } from 'https://cdn.jsdelivr.net/npm/@senlinz/import-export/+esm';
24
+
25
+ const excelInfo = {
26
+ name: 'TomAndJerry',
27
+ sheetName: 'sheet1',
28
+ columns: [
29
+ { key: 'name', name: 'Name', dataType: 0, width: 20, note: 'required' },
30
+ { key: 'age', name: 'Age', dataType: 1, width: 10 },
31
+ { key: 'category', name: 'Category', dataType: 0, allowedValues: ['Cat', 'Mouse'] }
32
+ ],
33
+ author: 'senlinz',
34
+ createTime: '2024-11-01T09:00:00'
35
+ };
36
+
37
+ btnImport.addEventListener('click', importClick);
38
+ btnExport.addEventListener('click', exportClick);
39
+ btnDownloadTemplate.addEventListener('click', downloadTemplateClick);
40
+
41
+ function exportClick() {
42
+ exportExcel(excelInfo, [
43
+ { name: 'Tom', age: 12, category: 'Cat' },
44
+ { name: 'Jerry', age: 13, category: 'Mouse' }
45
+ ]);
46
+ }
47
+
48
+ function importClick() {
49
+ importExcel(excelInfo).then(data => {
50
+ importOutput.innerText = JSON.stringify(data, null);
51
+ });
52
+ }
53
+
54
+ function downloadTemplateClick() {
55
+ downloadExcelTemplate(excelInfo);
56
+ }
57
+ </script>
18
58
  </body>
19
59
 
20
60
  </html>
@@ -1,2 +1,2 @@
1
- import{p as t,H as e,h as o}from"./p-ddbe189c.js";import{g as n,i,a as s,b as a,h as c,j as r,k as d,E as f,c as l,d as u,e as p,f as b}from"./p-199902a7.js";import{d as m}from"./p-dd1bf849.js";import{d as h}from"./p-f7586df1.js";import{d as x}from"./p-c9904f6a.js";let y=!1;async function w(t,e){const o=E(t),n=async function(t,e){const o=[],n={};for(const t of e)n[t.key]=t.dataType;for(const e of t.rows){const t={};for(const o of e.columns)n[o.key]!=d.Number?t[o.key]=o.value:t[o.key]=parseFloat(o.value);o.push(t)}return o}(a(o,e),t.columns);return n}async function k(t){const e=`${t.name}.xlsx`,o=await async function(t){return b(E(t))}(t);g(o,e)}function g(t,e,o="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"){var n;const i="senlinzImportExportDownload";null===(n=document.querySelector(`#${i}`))||void 0===n||n.remove();const s=document.createElement("a");s.id=i,s.download=e;const a=new Blob([t],{type:o});s.href=URL.createObjectURL(a),s.click()}function E(t){var e=t.columns.map((t=>{const e=new c(t.key,t.name,t.width);return t.dataType&&e.setDataType(t.dataType),t.note&&e.setNote(t.note),t.allowedValues&&e.setAllowedValues(t.allowedValues),e}));return new r(t.name,t.sheetName,e,t.author,function(t){if("string"==typeof t)return t;const e=t.getFullYear(),o=t.getMonth()+1,n=t.getDate(),i=t.getHours(),s=t.getMinutes(),a=t.getSeconds(),c=t=>t<10?`0${t}`:t.toString();return`${e}-${c(o)}-${c(n)} ${c(i)}:${c(s)}:${c(a)}`}(t.createTime))}async function D(t,e){const o=await async function(t,e){const o=E(t),n=e.map((t=>{const e=o.columns.map((e=>{const o=t[e.key];return new f(e.key,null==o?"":o.toString())}));return new l(e)})),i=new u(n);return p(o,i)}(t,e);g(o,`${t.name}.xlsx`)}const v={zh:{hideDefinition:"隐藏定义",showDefinition:"显示定义",downloadTemplate:"下载模板",exportExcel:"导出Excel",importExcel:"导入Excel",downloadDefinition:"下载定义",preview:"预览",dataSource:"数据源",hideDataSource:"隐藏数据源",showDataSource:"显示数据源"},en:{hideDefinition:"Hide Definition",showDefinition:"Show Definition",downloadTemplate:"Download Template",exportExcel:"Export Excel",importExcel:"Import Excel",downloadDefinition:"Download Definition",preview:"Preview",dataSource:"Data Source",hideDataSource:"Hide Data Source",showDataSource:"Show Data Source"}},S=t(class extends e{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.toggleDefinitionVisibility=()=>{this.showDefinition=!this.showDefinition},this.toggleDataSourceVisibility=()=>{this.showDataSource=!this.showDataSource},this.importExcelHandler=async t=>{const e=await(o=t,new Promise(((t,e)=>{var n;let i=document.querySelector("#senlinzImportExportInput");i||(null===(n=document.querySelector("#senlinzImportExportInput"))||void 0===n||n.remove(),i=document.createElement("input"),i.id="senlinzImportExportInput",i.style.display="none",i.type="file",i.accept=".xlsx,.xls,.xlsm,.xlsb,.xla,.xlam,.ods",i.addEventListener("change",(function(e){const n=e.target.files[0],i=new FileReader;i.onload=async()=>{const e=new Uint8Array(i.result),n=await w(o,e);t(n)},i.readAsArrayBuffer(n)})),document.body.appendChild(i));const s=document.createElement("button");s.textContent="Import Excel",s.style.display="none",s.addEventListener("click",(()=>{i.click()})),document.body.appendChild(s),s.click(),document.body.removeChild(s)})));var o;this.data=e},this.handleDataSourceChange=t=>{const e=t.target;try{this.data=JSON.parse(e.value)}catch(t){console.log(t)}},this.definition=void 0,this.culture="en",this.data=[],this.showDefinition=!0,this.showDataSource=!1}componentWillLoad(){!function(){if(!y){const t=n(Uint8Array.from(atob(i),(t=>t.charCodeAt(0))));s({module:t}),y=!0}}()}render(){const t=v[this.culture];return o("div",{key:"9b80914f0440e8f10960ffd58c7e20bc27beb9ae",class:"import-export-studio"},o("div",{key:"5f61a5605d2ba737169f0e0549e8078b80f2e128",class:"operation"},o("button",{key:"4ec2f3ff61487e91a0f508c65c57b061b5316bf6",type:"text",class:"studio-button",onClick:this.toggleDefinitionVisibility},this.showDefinition?t.hideDefinition:t.showDefinition),o("button",{key:"31e3970572332e77a4ee111096c13509053a71a0",type:"text",class:"studio-button",onClick:()=>{return t=this.definition,void g(JSON.stringify(t,null,2),`${t.name}-definition.json`,"application/json");var t}},t.downloadDefinition),o("button",{key:"8b062e1c105b0a67f8fbf6a85b2ff6e4cbfa0825",type:"text",class:"studio-button",onClick:()=>k(this.definition)},t.downloadTemplate),o("button",{key:"6ee2da16c955c8f4b4298f6a1da6987e2a1eda8a",type:"text",class:"studio-button",onClick:()=>D(this.definition,this.data)},t.exportExcel),o("button",{key:"ea7429bd2e8ed556c398c92a2264433b80d11d67",type:"text",class:"studio-button",onClick:()=>this.importExcelHandler(this.definition)},t.importExcel),o("button",{key:"9bbcb60005f3621b7b2212ebc7381206b8333743",type:"text",class:"studio-button",onClick:()=>this.toggleDataSourceVisibility()},this.showDataSource?t.hideDataSource:t.showDataSource)),o("div",{key:"8dc12abc11a572e4d57ba341eba5b82078790baf",class:"definition"},this.showDefinition&&o("import-export-definition",{key:"0e53a51e6fb268566d2a2982fec6df1d7c9fb548",definition:this.definition,culture:this.culture})),o("div",{key:"df601e00704f71e0dbb74cc74bafbaa59816be7e",class:"preview-table"},o("h3",{key:"469d94d10cc84788438fe5ee4ddfdf55b9e062f1"},t.preview),o("import-export-table",{key:"e0080482da9af16e16507f94f725f38c3bb460a0",definition:this.definition,data:this.data})),this.showDataSource&&o("div",{key:"40025966896deee2003402bef85c812071d302d9",class:"data-source"},o("h3",{key:"b69b787b893065dfd25b45e7e9a453c7823f7c8c"},t.dataSource),o("p",{key:"ac27bb80c702815decdf847c9b34adde399d1832"},JSON.stringify(this.data,null,2))))}static get style(){return".import-export-studio{font-family:Arial, sans-serif;padding:10px;background-color:#f9f9f9}.studio-button{background:linear-gradient(to right, #4caf50, #549757);color:white;border:none;padding:8px 16px;margin-right:8px;text-decoration:none;display:inline-block;font-size:16px;margin:0;cursor:pointer;border-radius:6px;transition:background-color 0.3s}.toggle-definition-button:hover{background:linear-gradient(to right, #45a049, #2d9231)}.operation{display:flex;gap:10px;align-items:center;margin-bottom:10px}.definition{margin-bottom:10px}.data-source textarea{width:100%;height:50%}"}},[1,"import-export-studio",{definition:[16],culture:[1],data:[16],showDefinition:[32],showDataSource:[32]}]);function $(){if("undefined"==typeof customElements)return;["import-export-studio","editable-cell","import-export-definition","import-export-table"].forEach((t=>{switch(t){case"import-export-studio":customElements.get(t)||customElements.define(t,S);break;case"editable-cell":customElements.get(t)||m();break;case"import-export-definition":customElements.get(t)||h();break;case"import-export-table":customElements.get(t)||x()}}))}$();const I=S,j=$;export{I as ImportExportStudio,j as defineCustomElement};
1
+ import{p as t,H as e,h as o}from"./p-ddbe189c.js";import{g as n,i,a as s,b as a,h as c,j as r,k as d,E as f,c as l,d as u,e as p,f as b}from"./p-3c6b6bbf.js";import{d as m}from"./p-dd1bf849.js";import{d as h}from"./p-f7586df1.js";import{d as x}from"./p-c9904f6a.js";let y=!1;async function w(t,e){const o=E(t),n=async function(t,e){const o=[],n={};for(const t of e)n[t.key]=t.dataType;for(const e of t.rows){const t={};for(const o of e.columns)n[o.key]!=d.Number?t[o.key]=o.value:t[o.key]=parseFloat(o.value);o.push(t)}return o}(a(o,e),t.columns);return n}async function k(t){const e=`${t.name}.xlsx`,o=await async function(t){return b(E(t))}(t);g(o,e)}function g(t,e,o="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"){var n;const i="senlinzImportExportDownload";null===(n=document.querySelector(`#${i}`))||void 0===n||n.remove();const s=document.createElement("a");s.id=i,s.download=e;const a=new Blob([t],{type:o});s.href=URL.createObjectURL(a),s.click()}function E(t){var e,o=t.columns.map((t=>{const e=new c(t.key,t.name,t.width);return t.dataType&&e.setDataType(t.dataType),t.note&&e.setNote(t.note),t.allowedValues&&e.setAllowedValues(t.allowedValues),e}));return new r(t.name,t.sheetName,o,t.author,function(t){if("string"==typeof t)return t;const e=t.getFullYear(),o=t.getMonth()+1,n=t.getDate(),i=t.getHours(),s=t.getMinutes(),a=t.getSeconds(),c=t=>t<10?`0${t}`:t.toString();return`${e}-${c(o)}-${c(n)} ${c(i)}:${c(s)}:${c(a)}`}(null!==(e=t.createTime)&&void 0!==e?e:new Date))}async function D(t,e){const o=await async function(t,e){const o=E(t),n=e.map((t=>{const e=o.columns.map((e=>{const o=t[e.key];return new f(e.key,null==o?"":o.toString())}));return new l(e)})),i=new u(n);return p(o,i)}(t,e);g(o,`${t.name}.xlsx`)}const v={zh:{hideDefinition:"隐藏定义",showDefinition:"显示定义",downloadTemplate:"下载模板",exportExcel:"导出Excel",importExcel:"导入Excel",downloadDefinition:"下载定义",preview:"预览",dataSource:"数据源",hideDataSource:"隐藏数据源",showDataSource:"显示数据源"},en:{hideDefinition:"Hide Definition",showDefinition:"Show Definition",downloadTemplate:"Download Template",exportExcel:"Export Excel",importExcel:"Import Excel",downloadDefinition:"Download Definition",preview:"Preview",dataSource:"Data Source",hideDataSource:"Hide Data Source",showDataSource:"Show Data Source"}},S=t(class extends e{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.toggleDefinitionVisibility=()=>{this.showDefinition=!this.showDefinition},this.toggleDataSourceVisibility=()=>{this.showDataSource=!this.showDataSource},this.importExcelHandler=async t=>{const e=await(o=t,new Promise(((t,e)=>{var n;let i=document.querySelector("#senlinzImportExportInput");i||(null===(n=document.querySelector("#senlinzImportExportInput"))||void 0===n||n.remove(),i=document.createElement("input"),i.id="senlinzImportExportInput",i.style.display="none",i.type="file",i.accept=".xlsx,.xls,.xlsm,.xlsb,.xla,.xlam,.ods",i.addEventListener("change",(function(e){const n=e.target.files[0],i=new FileReader;i.onload=async()=>{const e=new Uint8Array(i.result),n=await w(o,e);t(n)},i.readAsArrayBuffer(n)})),document.body.appendChild(i));const s=document.createElement("button");s.textContent="Import Excel",s.style.display="none",s.addEventListener("click",(()=>{i.click()})),document.body.appendChild(s),s.click(),document.body.removeChild(s)})));var o;this.data=e},this.handleDataSourceChange=t=>{const e=t.target;try{this.data=JSON.parse(e.value)}catch(t){console.log(t)}},this.definition=void 0,this.culture="en",this.data=[],this.showDefinition=!0,this.showDataSource=!1}componentWillLoad(){!function(){if(!y){const t=n(Uint8Array.from(atob(i),(t=>t.charCodeAt(0))));s({module:t}),y=!0}}()}render(){const t=v[this.culture];return o("div",{key:"9b80914f0440e8f10960ffd58c7e20bc27beb9ae",class:"import-export-studio"},o("div",{key:"5f61a5605d2ba737169f0e0549e8078b80f2e128",class:"operation"},o("button",{key:"4ec2f3ff61487e91a0f508c65c57b061b5316bf6",type:"text",class:"studio-button",onClick:this.toggleDefinitionVisibility},this.showDefinition?t.hideDefinition:t.showDefinition),o("button",{key:"31e3970572332e77a4ee111096c13509053a71a0",type:"text",class:"studio-button",onClick:()=>{return t=this.definition,void g(JSON.stringify(t,null,2),`${t.name}-definition.json`,"application/json");var t}},t.downloadDefinition),o("button",{key:"8b062e1c105b0a67f8fbf6a85b2ff6e4cbfa0825",type:"text",class:"studio-button",onClick:()=>k(this.definition)},t.downloadTemplate),o("button",{key:"6ee2da16c955c8f4b4298f6a1da6987e2a1eda8a",type:"text",class:"studio-button",onClick:()=>D(this.definition,this.data)},t.exportExcel),o("button",{key:"ea7429bd2e8ed556c398c92a2264433b80d11d67",type:"text",class:"studio-button",onClick:()=>this.importExcelHandler(this.definition)},t.importExcel),o("button",{key:"9bbcb60005f3621b7b2212ebc7381206b8333743",type:"text",class:"studio-button",onClick:()=>this.toggleDataSourceVisibility()},this.showDataSource?t.hideDataSource:t.showDataSource)),o("div",{key:"8dc12abc11a572e4d57ba341eba5b82078790baf",class:"definition"},this.showDefinition&&o("import-export-definition",{key:"0e53a51e6fb268566d2a2982fec6df1d7c9fb548",definition:this.definition,culture:this.culture})),o("div",{key:"df601e00704f71e0dbb74cc74bafbaa59816be7e",class:"preview-table"},o("h3",{key:"469d94d10cc84788438fe5ee4ddfdf55b9e062f1"},t.preview),o("import-export-table",{key:"e0080482da9af16e16507f94f725f38c3bb460a0",definition:this.definition,data:this.data})),this.showDataSource&&o("div",{key:"40025966896deee2003402bef85c812071d302d9",class:"data-source"},o("h3",{key:"b69b787b893065dfd25b45e7e9a453c7823f7c8c"},t.dataSource),o("p",{key:"ac27bb80c702815decdf847c9b34adde399d1832"},JSON.stringify(this.data,null,2))))}static get style(){return".import-export-studio{font-family:Arial, sans-serif;padding:10px;background-color:#f9f9f9}.studio-button{background:linear-gradient(to right, #4caf50, #549757);color:white;border:none;padding:8px 16px;margin-right:8px;text-decoration:none;display:inline-block;font-size:16px;margin:0;cursor:pointer;border-radius:6px;transition:background-color 0.3s}.toggle-definition-button:hover{background:linear-gradient(to right, #45a049, #2d9231)}.operation{display:flex;gap:10px;align-items:center;margin-bottom:10px}.definition{margin-bottom:10px}.data-source textarea{width:100%;height:50%}"}},[1,"import-export-studio",{definition:[16],culture:[1],data:[16],showDefinition:[32],showDataSource:[32]}]);function $(){if("undefined"==typeof customElements)return;["import-export-studio","editable-cell","import-export-definition","import-export-table"].forEach((t=>{switch(t){case"import-export-studio":customElements.get(t)||customElements.define(t,S);break;case"editable-cell":customElements.get(t)||m();break;case"import-export-definition":customElements.get(t)||h();break;case"import-export-table":customElements.get(t)||x()}}))}$();const I=S,j=$;export{I as ImportExportStudio,j as defineCustomElement};
2
2
  //# sourceMappingURL=import-export-studio.js.map
@@ -1,2 +1,2 @@
1
- export{g as getAssetPath,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-ddbe189c.js";import{g as n,i as t,a as o,b as e,E as c,c as r,d as u,e as l,f as i,h as f,j as m,k as p}from"./p-199902a7.js";let x=!1;async function d(n,t){const o=I(n),s=async function(n,t){const o=[],e={};for(const n of t)e[n.key]=n.dataType;for(const t of n.rows){const n={};for(const o of t.columns)e[o.key]!=p.Number?n[o.key]=o.value:n[o.key]=parseFloat(o.value);o.push(n)}return o}(e(o,t),n.columns);return s}async function w(n,t){const o=I(n),e=t.map((n=>{const t=o.columns.map((t=>{const o=n[t.key];return new c(t.key,null==o?"":o.toString())}));return new r(t)})),s=new u(e);return l(o,s)}async function E(n){return i(I(n))}async function y(n){const t=`${n.name}.xlsx`;$(await E(n),t)}function $(n,t,o="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"){var e;const s="senlinzImportExportDownload";null===(e=document.querySelector(`#${s}`))||void 0===e||e.remove();const c=document.createElement("a");c.id=s,c.download=t;const r=new Blob([n],{type:o});c.href=URL.createObjectURL(r),c.click()}function I(n){var t=n.columns.map((n=>{const t=new f(n.key,n.name,n.width);return n.dataType&&t.setDataType(n.dataType),n.note&&t.setNote(n.note),n.allowedValues&&t.setAllowedValues(n.allowedValues),t}));return new m(n.name,n.sheetName,t,n.author,function(n){if("string"==typeof n)return n;const t=n.getFullYear(),o=n.getMonth()+1,e=n.getDate(),s=n.getHours(),c=n.getMinutes(),r=n.getSeconds(),a=n=>n<10?`0${n}`:n.toString();return`${t}-${a(o)}-${a(e)} ${a(s)}:${a(c)}:${a(r)}`}(n.createTime))}function h(n){return new Promise(((t,o)=>{var e;let s=document.querySelector("#senlinzImportExportInput");s||(null===(e=document.querySelector("#senlinzImportExportInput"))||void 0===e||e.remove(),s=document.createElement("input"),s.id="senlinzImportExportInput",s.style.display="none",s.type="file",s.accept=".xlsx,.xls,.xlsm,.xlsb,.xla,.xlam,.ods",s.addEventListener("change",(function(o){const e=o.target.files[0],s=new FileReader;s.onload=async()=>{const o=new Uint8Array(s.result),e=await d(n,o);t(e)},s.readAsArrayBuffer(e)})),document.body.appendChild(s));const c=document.createElement("button");c.textContent="Import Excel",c.style.display="none",c.addEventListener("click",(()=>{s.click()})),document.body.appendChild(c),c.click(),document.body.removeChild(c)}))}async function v(n,t){$(await w(n,t),`${n.name}.xlsx`)}function z(){return function(){if(!x){const e=n(Uint8Array.from(atob(t),(n=>n.charCodeAt(0))));o({module:e}),x=!0}}(),{importExcel:h,exportExcel:v,downloadExcelTemplate:y,fromExcel:d,toExcel:w,generateExcelTemplate:E}}export{z as getUtils};
1
+ export{g as getAssetPath,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-ddbe189c.js";import{g as n,i as t,a as o,b as e,E as c,c as r,d as u,e as l,f as i,h as f,j as p,k as m}from"./p-3c6b6bbf.js";let x=!1;function d(){if(!x){const e=n(Uint8Array.from(atob(t),(n=>n.charCodeAt(0))));o({module:e}),x=!0}}async function w(n,t){const o=v(n),s=async function(n,t){const o=[],e={};for(const n of t)e[n.key]=n.dataType;for(const t of n.rows){const n={};for(const o of t.columns)e[o.key]!=m.Number?n[o.key]=o.value:n[o.key]=parseFloat(o.value);o.push(n)}return o}(e(o,t),n.columns);return s}async function E(n,t){const o=v(n),e=t.map((n=>{const t=o.columns.map((t=>{const o=n[t.key];return new c(t.key,null==o?"":o.toString())}));return new r(t)})),s=new u(e);return l(o,s)}async function y(n){return i(v(n))}async function $(n){const t=`${n.name}.xlsx`;I(await y(n),t)}function I(n,t,o="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"){var e;const s="senlinzImportExportDownload";null===(e=document.querySelector(`#${s}`))||void 0===e||e.remove();const c=document.createElement("a");c.id=s,c.download=t;const r=new Blob([n],{type:o});c.href=URL.createObjectURL(r),c.click()}function v(n){var t,o=n.columns.map((n=>{const t=new f(n.key,n.name,n.width);return n.dataType&&t.setDataType(n.dataType),n.note&&t.setNote(n.note),n.allowedValues&&t.setAllowedValues(n.allowedValues),t}));return new p(n.name,n.sheetName,o,n.author,function(n){if("string"==typeof n)return n;const t=n.getFullYear(),o=n.getMonth()+1,e=n.getDate(),s=n.getHours(),c=n.getMinutes(),r=n.getSeconds(),a=n=>n<10?`0${n}`:n.toString();return`${t}-${a(o)}-${a(e)} ${a(s)}:${a(c)}:${a(r)}`}(null!==(t=n.createTime)&&void 0!==t?t:new Date))}function h(n){return new Promise(((t,o)=>{var e;let s=document.querySelector("#senlinzImportExportInput");s||(null===(e=document.querySelector("#senlinzImportExportInput"))||void 0===e||e.remove(),s=document.createElement("input"),s.id="senlinzImportExportInput",s.style.display="none",s.type="file",s.accept=".xlsx,.xls,.xlsm,.xlsb,.xla,.xlam,.ods",s.addEventListener("change",(function(o){const e=o.target.files[0],s=new FileReader;s.onload=async()=>{const o=new Uint8Array(s.result),e=await w(n,o);t(e)},s.readAsArrayBuffer(e)})),document.body.appendChild(s));const c=document.createElement("button");c.textContent="Import Excel",c.style.display="none",c.addEventListener("click",(()=>{s.click()})),document.body.appendChild(c),c.click(),document.body.removeChild(c)}))}async function z(n,t){I(await E(n,t),`${n.name}.xlsx`)}function A(){return d(),{importExcel:h,exportExcel:z,downloadExcelTemplate:$,fromExcel:w,toExcel:E,generateExcelTemplate:y}}function P(n){return d(),h(n)}function U(n,t){return d(),z(n,t)}function j(n){return d(),$(n)}export{j as downloadExcelTemplate,U as exportExcel,A as getUtils,P as importExcel};
2
2
  //# sourceMappingURL=index.js.map