@sc-guode/yzl-components 0.0.21 → 0.0.22
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 +1 -1
- package/index.umd.js +1 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -585,7 +585,7 @@ class wv {
|
|
|
585
585
|
createBall(c, o) {
|
|
586
586
|
let u = document.createElement("div");
|
|
587
587
|
u.style.position = "absolute", u.style.left = c + "px", u.style.top = o + "px", u.style.width = "20px", u.style.height = "20px", u.style.borderRadius = "50%", u.style.backgroundColor = "#02b6fd", u.style.transition = "left 1s linear, top 1s cubic-bezier(0.5, -0.5, 1, 1)", u.style.zIndex = "9999", document.body.appendChild(u), setTimeout(() => {
|
|
588
|
-
let r = document.querySelector(".navbar .user-area .
|
|
588
|
+
let r = document.querySelector(".navbar .user-area .pointer:nth-of-type(2)") || document.querySelector(".head-right");
|
|
589
589
|
u.style.left = r.offsetLeft + r.offsetWidth / 2 + "px", u.style.top = r.offsetTop + "px";
|
|
590
590
|
}, 0), u.ontransitionend = function() {
|
|
591
591
|
this.remove();
|
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 A=(e=this.$refs.tableContainer)==null?void 0:e.querySelector(".el-table__row");A&&(this.firstRowHeight=Math.round(A.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 A=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ha=="object"&&ha.global===ha?ha:void 0,I=A.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),k=A.saveAs||(typeof window!="object"||window!==A?function(){}:"download"in HTMLAnchorElement.prototype&&!I?function(M,H,X){var ie=A.URL||A.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(A.HTMLElement)||A.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=A.URL||A.webkitURL,ft=De.createObjectURL(M);ie?ie.location=ft:location.href=ft,ie=null,setTimeout(function(){De.revokeObjectURL(ft)},4e4)}});A.saveAs=k.saveAs=k,g.exports=k})})(Pl);class Am{constructor(c,o){this.vm=c,this.config=o}async execute(c,o){try{const u=await this.handleRequest(c);return this.handleResponse(u,o),!0}catch(u){return this.handleError(u),!1}}async handleRequest(c){const{onSearch:o=!0,onPages:u=!1}=this.config,{model:r,pageInfo:e}=this.vm,A=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,...A,...I};if(typeof this.config.api=="function")return this.config.api(k)}createBall(c,o){let u=document.createElement("div");u.style.position="absolute",u.style.left=c+"px",u.style.top=o+"px",u.style.width="20px",u.style.height="20px",u.style.borderRadius="50%",u.style.backgroundColor="#02b6fd",u.style.transition="left 1s linear, top 1s cubic-bezier(0.5, -0.5, 1, 1)",u.style.zIndex="9999",document.body.appendChild(u),setTimeout(()=>{let r=document.querySelector(".navbar .user-area .
|
|
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 A=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ha=="object"&&ha.global===ha?ha:void 0,I=A.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),k=A.saveAs||(typeof window!="object"||window!==A?function(){}:"download"in HTMLAnchorElement.prototype&&!I?function(M,H,X){var ie=A.URL||A.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(A.HTMLElement)||A.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=A.URL||A.webkitURL,ft=De.createObjectURL(M);ie?ie.location=ft:location.href=ft,ie=null,setTimeout(function(){De.revokeObjectURL(ft)},4e4)}});A.saveAs=k.saveAs=k,g.exports=k})})(Pl);class Am{constructor(c,o){this.vm=c,this.config=o}async execute(c,o){try{const u=await this.handleRequest(c);return this.handleResponse(u,o),!0}catch(u){return this.handleError(u),!1}}async handleRequest(c){const{onSearch:o=!0,onPages:u=!1}=this.config,{model:r,pageInfo:e}=this.vm,A=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,...A,...I};if(typeof this.config.api=="function")return this.config.api(k)}createBall(c,o){let u=document.createElement("div");u.style.position="absolute",u.style.left=c+"px",u.style.top=o+"px",u.style.width="20px",u.style.height="20px",u.style.borderRadius="50%",u.style.backgroundColor="#02b6fd",u.style.transition="left 1s linear, top 1s cubic-bezier(0.5, -0.5, 1, 1)",u.style.zIndex="9999",document.body.appendChild(u),setTimeout(()=>{let r=document.querySelector(".navbar .user-area .pointer:nth-of-type(2)")||document.querySelector(".head-right");u.style.left=r.offsetLeft+r.offsetWidth/2+"px",u.style.top=r.offsetTop+"px"},0),u.ontransitionend=function(){this.remove()}}handleResponse(c,o){var r,e;const u=this.config.fileName||`${((r=this.vm.$route)==null?void 0:r.name)||"export"}_${w2().format("YYYYMMDD_HHmm")}`;if(((e=c==null?void 0:c.config)==null?void 0:e.responseType)==="arraybuffer"&&c.status===200){const A=new Blob([c.data]);Pl.exports.saveAs(A,`${u}.xlsx`)}else if(c!=null&&c.success){let A;if(c.data instanceof Blob){const I=c.data.type||"application/octet-stream",k=new Blob([c.data],{type:I});Pl.exports.saveAs(URL.createObjectURL(k),u),A=typeof c.data=="string"?c.data:"\u6587\u4EF6\u4E0B\u8F7D\u6210\u529F",this.vm.$message.success(A)}else{A="\u5BFC\u51FA\u4EFB\u52A1\u521B\u5EFA\u6210\u529F\uFF0C\u8BF7\u81F3\u4E0B\u8F7D\u4E2D\u5FC3\u67E5\u770B\u3002",this.vm.$message.success(A);const{pageX:I,pageY:k}=o;this.createBall(I,k)}}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>
|