@sc-guode/yzl-components 0.0.14 → 0.0.15

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/index.mjs CHANGED
@@ -586,8 +586,8 @@ class wv {
586
586
  var u, r;
587
587
  const o = this.config.fileName || `${((u = this.vm.$route) == null ? void 0 : u.name) || "export"}_${nm().format("YYYYMMDD_HHmm")}`;
588
588
  if (((r = c == null ? void 0 : c.config) == null ? void 0 : r.responseType) === "arraybuffer" && c.status === 200) {
589
- let e = "data:image/png;base64," + btoa(new Uint8Array(c.data).reduce((D, I) => D + String.fromCharCode(I), ""));
590
- mh.exports.saveAs(e, o);
589
+ const e = new Blob([c.data]);
590
+ mh.exports.saveAs(e, `${o}.xlsx`);
591
591
  } else if (c != null && c.success) {
592
592
  let e;
593
593
  if (c.data instanceof Blob) {
package/index.umd.js CHANGED
@@ -4,7 +4,7 @@
4
4
  3. \u89E3\u51B3\u65B9\u6848\uFF1A\u4FDD\u7559\u4EFB\u610F\u4E00\u79CD\u6A21\u5F0F\u5373\u53EF`),new Error("\u68C0\u6D4B\u5230\u51B2\u7A81\u7684\u6E32\u67D3\u6A21\u5F0F\u914D\u7F6E");this.enableVirtualScroll&&(this.renderQueue=[...g],this.currentChunk=0,this.updateVisibleData())},immediate:!0},"pageInfo.page"(g){this.enableVirtualScroll&&(this.currentChunk=0,this.renderQueue=[...this.data],this.updateVisibleData())}},methods:{initVirtualScroll(){if(!this.enableVirtualScroll){console.warn("Virtual scroll is disabled");return}if(!this.enableVirtualScroll)return;const g=this.$refs.tableContainer;if(!g){console.error("Table container ref not found");return}const c=g==null?void 0:g.querySelector(".el-table__body-wrapper");c&&(setTimeout(()=>{this.scrollContainerHeight=c.clientHeight},0),c.addEventListener("scroll",this.handleVirtualScroll),this.$once("hook:beforeDestroy",()=>{c.removeEventListener("scroll",this.handleVirtualScroll)}))},handleVirtualScroll(g){var e;if(!this.firstRowHeight){const D=(e=this.$refs.tableContainer)==null?void 0:e.querySelector(".el-table__row");D&&(this.firstRowHeight=Math.round(D.getBoundingClientRect().height*10)/10)}const c=this.chunkSize*this.firstRowHeight,{scrollTop:o}=g.target,r=(this.currentChunk+1)*c-c*.5;o>r&&(this.currentChunk++,this.updateVisibleData())},async updateVisibleData(){const g=(this.currentChunk+1)*this.chunkSize;this.visibleData=this.renderQueue.slice(0,g),this.$nextTick(()=>{var c;(c=this.$refs.yzlTable)==null||c.doLayout()})}}},Sm={props:{enableDeferRender:{type:Boolean,default:!1},deferChunkSize:{type:Number,default:50}},data(){return{chunkBuffer:[],renderedData:[]}},watch:{data:{handler(g){if(this.enableVirtualScroll&&this.enableDeferRender)throw console.error(`[YzlTable Error] \u6E32\u67D3\u6A21\u5F0F\u51B2\u7A81\uFF1A
5
5
  1. enableVirtualScroll \u548C enableDeferRender \u4E0D\u80FD\u540C\u65F6\u542F\u7528
6
6
  2. \u5F53\u524D\u503C\uFF1AenableVirtualScroll=${this.enableVirtualScroll}, enableDeferRender=${this.enableDeferRender}
7
- 3. \u89E3\u51B3\u65B9\u6848\uFF1A\u4FDD\u7559\u4EFB\u610F\u4E00\u79CD\u6A21\u5F0F\u5373\u53EF`),new Error("\u68C0\u6D4B\u5230\u51B2\u7A81\u7684\u6E32\u67D3\u6A21\u5F0F\u914D\u7F6E");this.enableDeferRender&&(this.chunkBuffer=[...g],this.renderedData=[],this.processChunk())},immediate:!0},"pageInfo.page"(g){this.enableDeferRender&&(this.chunkBuffer=[...this.data],this.renderedData=[],this.processChunk())}},methods:{processChunk(){const g=this.chunkBuffer.splice(0,this.deferChunkSize);this.renderedData.push(...g),this.chunkBuffer.length>0?requestAnimationFrame(this.processChunk):this.$nextTick(()=>{var c;(c=this.$refs.yzlTable)==null||c.doLayout()})}}};var Pl={exports:{}};(function(g,c){(function(o,u){u()})(ha,function(){function o(M,H){return typeof H>"u"?H={autoBom:!1}:typeof H!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),H={autoBom:!H}),H.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(M.type)?new Blob(["\uFEFF",M],{type:M.type}):M}function u(M,H,X){var ie=new XMLHttpRequest;ie.open("GET",M),ie.responseType="blob",ie.onload=function(){k(ie.response,H,X)},ie.onerror=function(){console.error("could not download file")},ie.send()}function r(M){var H=new XMLHttpRequest;H.open("HEAD",M,!1);try{H.send()}catch{}return 200<=H.status&&299>=H.status}function e(M){try{M.dispatchEvent(new MouseEvent("click"))}catch{var H=document.createEvent("MouseEvents");H.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),M.dispatchEvent(H)}}var D=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ha=="object"&&ha.global===ha?ha:void 0,I=D.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),k=D.saveAs||(typeof window!="object"||window!==D?function(){}:"download"in HTMLAnchorElement.prototype&&!I?function(M,H,X){var ie=D.URL||D.webkitURL,R=document.createElement("a");H=H||M.name||"download",R.download=H,R.rel="noopener",typeof M=="string"?(R.href=M,R.origin===location.origin?e(R):r(R.href)?u(M,H,X):e(R,R.target="_blank")):(R.href=ie.createObjectURL(M),setTimeout(function(){ie.revokeObjectURL(R.href)},4e4),setTimeout(function(){e(R)},0))}:"msSaveOrOpenBlob"in navigator?function(M,H,X){if(H=H||M.name||"download",typeof M!="string")navigator.msSaveOrOpenBlob(o(M,X),H);else if(r(M))u(M,H,X);else{var ie=document.createElement("a");ie.href=M,ie.target="_blank",setTimeout(function(){e(ie)})}}:function(M,H,X,ie){if(ie=ie||open("","_blank"),ie&&(ie.document.title=ie.document.body.innerText="downloading..."),typeof M=="string")return u(M,H,X);var R=M.type==="application/octet-stream",Y=/constructor/i.test(D.HTMLElement)||D.safari,re=/CriOS\/[\d]+/.test(navigator.userAgent);if((re||R&&Y||I)&&typeof FileReader<"u"){var we=new FileReader;we.onloadend=function(){var $e=we.result;$e=re?$e:$e.replace(/^data:[^;]*;/,"data:attachment/file;"),ie?ie.location.href=$e:location=$e,ie=null},we.readAsDataURL(M)}else{var De=D.URL||D.webkitURL,ft=De.createObjectURL(M);ie?ie.location=ft:location.href=ft,ie=null,setTimeout(function(){De.revokeObjectURL(ft)},4e4)}});D.saveAs=k.saveAs=k,g.exports=k})})(Pl);class Am{constructor(c,o){this.vm=c,this.config=o}async execute(c){try{const o=await this.handleRequest(c);return this.handleResponse(o),!0}catch(o){return this.handleError(o),!1}}async handleRequest(c){const{onSearch:o=!0,onPages:u=!1}=this.config,{model:r,pageInfo:e}=this.vm,D=o?Object.entries({...r}).filter(([M,H])=>H!=null&&H!==""&&!M.startsWith("_")&&M!=="pageInfo"&&M!=="data").reduce((M,[H,X])=>(M[H]=typeof X=="object"?JSON.parse(JSON.stringify(X)):X,M),{}):{},I=u&&e?{page:e.page,size:e.size}:{},k={...c,...D,...I};if(typeof this.config.api=="function")return this.config.api(k)}handleResponse(c){var u,r;const o=this.config.fileName||`${((u=this.vm.$route)==null?void 0:u.name)||"export"}_${w2().format("YYYYMMDD_HHmm")}`;if(((r=c==null?void 0:c.config)==null?void 0:r.responseType)==="arraybuffer"&&c.status===200){let e="data:image/png;base64,"+btoa(new Uint8Array(c.data).reduce((D,I)=>D+String.fromCharCode(I),""));Pl.exports.saveAs(e,o)}else if(c!=null&&c.success){let e;if(c.data instanceof Blob){const D=c.data.type||"application/octet-stream",I=new Blob([c.data],{type:D});Pl.exports.saveAs(URL.createObjectURL(I),o),e=typeof c.data=="string"?c.data:"\u6587\u4EF6\u4E0B\u8F7D\u6210\u529F"}else e=typeof c.data=="string"?c.data:"\u64CD\u4F5C\u6210\u529F";this.vm.$message.success(e)}else this.handleError({message:(c==null?void 0:c.data)||"\u64CD\u4F5C\u5931\u8D25",response:c})}handleError(c){console.error("[ExportHelper]",c),this.vm.$message.error(c.message||"\u5BFC\u51FA\u5931\u8D25")}}/**!
7
+ 3. \u89E3\u51B3\u65B9\u6848\uFF1A\u4FDD\u7559\u4EFB\u610F\u4E00\u79CD\u6A21\u5F0F\u5373\u53EF`),new Error("\u68C0\u6D4B\u5230\u51B2\u7A81\u7684\u6E32\u67D3\u6A21\u5F0F\u914D\u7F6E");this.enableDeferRender&&(this.chunkBuffer=[...g],this.renderedData=[],this.processChunk())},immediate:!0},"pageInfo.page"(g){this.enableDeferRender&&(this.chunkBuffer=[...this.data],this.renderedData=[],this.processChunk())}},methods:{processChunk(){const g=this.chunkBuffer.splice(0,this.deferChunkSize);this.renderedData.push(...g),this.chunkBuffer.length>0?requestAnimationFrame(this.processChunk):this.$nextTick(()=>{var c;(c=this.$refs.yzlTable)==null||c.doLayout()})}}};var Pl={exports:{}};(function(g,c){(function(o,u){u()})(ha,function(){function o(M,H){return typeof H>"u"?H={autoBom:!1}:typeof H!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),H={autoBom:!H}),H.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(M.type)?new Blob(["\uFEFF",M],{type:M.type}):M}function u(M,H,X){var ie=new XMLHttpRequest;ie.open("GET",M),ie.responseType="blob",ie.onload=function(){k(ie.response,H,X)},ie.onerror=function(){console.error("could not download file")},ie.send()}function r(M){var H=new XMLHttpRequest;H.open("HEAD",M,!1);try{H.send()}catch{}return 200<=H.status&&299>=H.status}function e(M){try{M.dispatchEvent(new MouseEvent("click"))}catch{var H=document.createEvent("MouseEvents");H.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),M.dispatchEvent(H)}}var D=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ha=="object"&&ha.global===ha?ha:void 0,I=D.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),k=D.saveAs||(typeof window!="object"||window!==D?function(){}:"download"in HTMLAnchorElement.prototype&&!I?function(M,H,X){var ie=D.URL||D.webkitURL,R=document.createElement("a");H=H||M.name||"download",R.download=H,R.rel="noopener",typeof M=="string"?(R.href=M,R.origin===location.origin?e(R):r(R.href)?u(M,H,X):e(R,R.target="_blank")):(R.href=ie.createObjectURL(M),setTimeout(function(){ie.revokeObjectURL(R.href)},4e4),setTimeout(function(){e(R)},0))}:"msSaveOrOpenBlob"in navigator?function(M,H,X){if(H=H||M.name||"download",typeof M!="string")navigator.msSaveOrOpenBlob(o(M,X),H);else if(r(M))u(M,H,X);else{var ie=document.createElement("a");ie.href=M,ie.target="_blank",setTimeout(function(){e(ie)})}}:function(M,H,X,ie){if(ie=ie||open("","_blank"),ie&&(ie.document.title=ie.document.body.innerText="downloading..."),typeof M=="string")return u(M,H,X);var R=M.type==="application/octet-stream",Y=/constructor/i.test(D.HTMLElement)||D.safari,re=/CriOS\/[\d]+/.test(navigator.userAgent);if((re||R&&Y||I)&&typeof FileReader<"u"){var we=new FileReader;we.onloadend=function(){var $e=we.result;$e=re?$e:$e.replace(/^data:[^;]*;/,"data:attachment/file;"),ie?ie.location.href=$e:location=$e,ie=null},we.readAsDataURL(M)}else{var De=D.URL||D.webkitURL,ft=De.createObjectURL(M);ie?ie.location=ft:location.href=ft,ie=null,setTimeout(function(){De.revokeObjectURL(ft)},4e4)}});D.saveAs=k.saveAs=k,g.exports=k})})(Pl);class Am{constructor(c,o){this.vm=c,this.config=o}async execute(c){try{const o=await this.handleRequest(c);return this.handleResponse(o),!0}catch(o){return this.handleError(o),!1}}async handleRequest(c){const{onSearch:o=!0,onPages:u=!1}=this.config,{model:r,pageInfo:e}=this.vm,D=o?Object.entries({...r}).filter(([M,H])=>H!=null&&H!==""&&!M.startsWith("_")&&M!=="pageInfo"&&M!=="data").reduce((M,[H,X])=>(M[H]=typeof X=="object"?JSON.parse(JSON.stringify(X)):X,M),{}):{},I=u&&e?{page:e.page,size:e.size}:{},k={...c,...D,...I};if(typeof this.config.api=="function")return this.config.api(k)}handleResponse(c){var u,r;const o=this.config.fileName||`${((u=this.vm.$route)==null?void 0:u.name)||"export"}_${w2().format("YYYYMMDD_HHmm")}`;if(((r=c==null?void 0:c.config)==null?void 0:r.responseType)==="arraybuffer"&&c.status===200){const e=new Blob([c.data]);Pl.exports.saveAs(e,`${o}.xlsx`)}else if(c!=null&&c.success){let e;if(c.data instanceof Blob){const D=c.data.type||"application/octet-stream",I=new Blob([c.data],{type:D});Pl.exports.saveAs(URL.createObjectURL(I),o),e=typeof c.data=="string"?c.data:"\u6587\u4EF6\u4E0B\u8F7D\u6210\u529F"}else e=typeof c.data=="string"?c.data:"\u64CD\u4F5C\u6210\u529F";this.vm.$message.success(e)}else this.handleError({message:(c==null?void 0:c.data)||"\u64CD\u4F5C\u5931\u8D25",response:c})}handleError(c){console.error("[ExportHelper]",c),this.vm.$message.error(c.message||"\u5BFC\u51FA\u5931\u8D25")}}/**!
8
8
  * Sortable 1.15.6
9
9
  * @author RubaXa <trash@rubaxa.org>
10
10
  * @author owenm <owen23355@gmail.com>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sc-guode/yzl-components",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "基于vue,vite搭建的三川国德云智联组件库",
5
5
  "main": "index.umd.js",
6
6
  "module": "index.mjs",