@soei/flyweight 0.3.11 → 0.3.13
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/Flyweight.cjs +1 -1
- package/Flyweight.js +150 -148
- package/README.md +8 -1
- package/package.json +1 -1
- package/style.css +1 -1
- package/vue2/index.cjs +1 -1
- package/vue2/index.js +132 -130
- package/vue2/style.css +1 -1
package/Flyweight.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@soei/util"),r=require("vue"),p=require("@soei/tools"),he=require("@soei/picker");let ae=/(\d+|[+\-\*/]|%)/g,V={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t,i)=>parseFloat(e)/100*i},j=(e,t)=>{let i;if(i=a.runer("match",e,ae)){let l=i.length,o,n=0,s,c=[];for(;l--;)n=i.shift(),n in V?(o&&c.push(o),n==="%"&&(c.length=2),s=n):+n&&c.push(+n),c.length==2&&(c.push(t),o=V[s].apply(null,c),c.length=0);+o||(o=+c.pop()),e=o>>0}return e},q={},S=(e,t)=>(e+"").replace(/\w+\((.*)\)/g,"$1").replace(q[t]||(q[t]=new RegExp("(?=\\s+|^)(\\d+)(?:\\.\\d{1,})?(?!(?:\\.)*\\d|%|\\w)","g")),"$1px");const P=(e,t)=>{const i=e.__vccOpts||e;for(const[l,o]of t)i[l]=o;return i};let D=e=>e==null||e==null,ce=(...e)=>{console.info("::::FLYWEIGHT",...e)};const ue={name:"Flyweight",props:{flys:{type:Array,default:()=>[]},width:{type:[String,Number],default:0},height:{type:[String,Number],default:100},w:{type:[Number,String]},h:{type:[Number,String]},offset:{type:Array,default:()=>[0,0]},lazy:{type:Number,default:100},view:{type:Object,default:()=>({id:0})},index:{type:Number,default:0},top:{type:[String,Number],default:0},left:{type:[String,Number],default:0},auto:{type:[Boolean,String],default:!1},space:{type:Object,default:()=>null},padding:{type:Boolean,default:!1}},computed:{flyweight(){return this.$refs.flyweight||""},style(){var e=this.w,t=this.h,i=this.Size,l={};return a.merge(l,{"--width":S(this.realW),"--height":S(this.realH),"--flyweight-content":S(i)},t&&{"--flyweight-h":S(t)},e&&l,{"--flyweight-w":S(e)},"mix"),l}},data(){return{flyweights:[],actice:!1,Size:null,column:1,row:1,expand:10,count:0,task:[],realW:0,realH:0}},watch:{flys(e){this.count=e.length,this.rebuild();let t=this.task.shift();t&&this.$nextTick(()=>{this.setview(t)})},view:{handler(e){this.setview(e)},immediate:!0,deep:!0},index(e){this.setindex(e)},top(e){this.flyweight.scrollTop=e},left(e){this.flyweight.scrollLeft=e}},mounted(){this.flyweights=[],this.$set||(this.$set=(e,t,i)=>{e[t]=i}),this.setindex(this.index);try{new ResizeObserver(()=>{this.rebuild(),this.$emit("resize")}).observe(this.flyweight)}catch(e){ce(e)}this.scrollx=a.runer("hasAttribute",this.flyweight,"scroll-x"),this.BoxRule="clientHeight=>height,clientWidth=>width",this.direction=this.scrollx?"scrollLeft":"scrollTop"},methods:{exec:S,trigger(e,t){a.isArray(e)||(e=e&&t?[[e,t]]:[]),e.length&&this.lazyrun(()=>{a.each(e,(i,l)=>{this.$emit(l[0],D(l[1])?!0:l[1])})})},cheackflys(e){if(!this.flys.length)return e&&this.task.push(e),!0},setview(e){a.runer([this.cheackflys,t=>{t=t||{};let i=t.index||a.each(this.flys,(l,o,n,s)=>{if(o[n]==s)return l},t.picker,t.id);D(i)||this.setindex(i)}],this,e)},setindex(e){a.runer([this.cheackflys,({index:t})=>{this.selectIndex=t,this.$nextTick(()=>{let i=t/this.column>>0,l=this.expand;(this.flyweight[this.direction]/l>>0)+this.row-i-1>0||(this.flyweight[this.direction]=i*l,this.scroll())})}],this,{index:e})},lazyrun(e,t){clearTimeout(this.time),this.time=setTimeout(()=>{a.runer(e)},t||this.lazy)},run(e){let t=[],i=a.runer(this.direction,e.target),l={offset:i,top:i,width:this.realW,height:this.realH,index:i/this.expand>>0};a.merge(l,this.space),e.from||t.push(["onscroll",l]);let o=!1;a.each(this.flyweights,(n,s,c,h,d,f,g,y,u)=>{if(c=n/d>>0,y=c+h*(+(c<f%h)+(f/h>>0)),u=y*d+n%d,u>=this.count){o||(t.push(["onend"]),o=!0);return}s.index=y,s.i=u,s.data=this.flys[u];let v=[y*this.expand+s.x,s.space];g&&v.reverse(),s.top=v[0],s.left=v[1]},null,this.row,this.column,l.index,this.scrollx),this.trigger(t),t=null},scroll(e){this.run(e||{target:this.flyweight,from:"space"})},rebuild(){let e=this.count||this.flys.length,t=this.flyweights;if(!e)return t.length=e;this.count=e;let i=this.scrollx,l=this.flyweight,o=a.picker(l,this.BoxRule);this.$nextTick(()=>{let n=/true/.test(this.auto),[s,c]=this.offset,h=o.width,d=o.height,f=(j(this.width,h)||h)+s,g=j(this.height,d)+c,y=[h/f>>0||1,d/g>>0||1];i&&y.reverse();let[u,v]=y,x=this.padding,T,k=0,m,b;i?(m=f,f-=s,b=$=>$*(g-c)+($+1)*c):(n?(f=(h-s*(u+2*x-1))/u,T=!x*s,k=x*s):(T=0,k=(h%f+s*u)/(u+1)>>0,f-=s),b=$=>$*(f+T)+($+1)*k,m=g),this.row=v+2,this.column=u,this.realH=g-c,this.realW=f,this.expand=m,this.Size=Math.ceil(e/u)*m;let _=Math.min(e,u*this.row),w=_-1,N;for(;_-- >0;)N=w-_,this.$set(t,N,{x:s,y:c,width:f,height:g-c,space:b(N%u),data:{}});t.length=w+1;let z=[];d/m>w/u&&z.push(["onend"]),this.flyweight&&(this.flyweight[this.direction]=0),this.$nextTick(()=>{this.setindex(this.selectIndex||0),this.scroll()}),z.push(["update:space",{row:(w/u>>0)+1,column:u,showrow:this.row,showcolumn:this.column}]),this.trigger(z)})}}},de={class:"flyweight-all"};function fe(e,t,i,l,o,n){return r.openBlock(),r.createElementBlock("div",{ref:"flyweight",class:r.normalizeClass(["flyweight",{"flyweight-active":o.actice}]),style:r.normalizeStyle(n.style),onScroll:t[0]||(t[0]=(...s)=>n.scroll&&n.scroll(...s))},[r.createElementVNode("div",de,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(o.flyweights,(s,c)=>(r.openBlock(),r.createElementBlock("div",{key:c,style:r.normalizeStyle({top:s.top+"px",left:s.left+"px"})},[r.renderSlot(e.$slots,"default",r.mergeProps({ref_for:!0},s),void 0,!0)],4))),128))]),o.flyweights.length?r.renderSlot(e.$slots,"end",{key:0},void 0,!0):r.createCommentVNode("",!0)],38)}const K=P(ue,[["render",fe],["__scopeId","data-v-35b94e9b"]]);function H(e,t){return t&&(e=e.replace(/[a-z]/g,"")),e.toLowerCase()}let Q={close:{handler(e){this.change(e)},deep:!0},offset:{handler(e){this.margin(e)},deep:!0}},pe=["BackGround","BordeR","Height","Width","Top","Right","Bottom","Left"],Z={};a.each(pe,(e,t,i)=>{e=H(t),Z["--"+H(t,!0)]=e,i[e]=function(){this.trigger++}},Q);const ge={name:"Card",props:{offset:{type:[String,Array],default:()=>[0,0,0,0]},background:{type:String,default:""},border:{type:String,default:"1px"},height:{type:String,default:"100%"},width:{type:String,default:"100%"},show:{type:String,default:""},close:{type:Object,default:null},title:{type:String,default:""}},data(){return{closecss:{},trigger:0,default:{top:"0px",right:"0px",bottom:"0px",left:"0px",height:"100%",width:"100%",background:"",border:"1px"}}},computed:{style(){return this.tr()}},watch:Q,methods:{exec:S,isEmpty:a.isEmpty,isSimplyType:a.isSimplyType,tr(){let e={};return this.margin(this.offset),a.each(Z,(t,i)=>{this.css(e,t,i)}),e},tolower:H,css(e,t,i){let l=this[i]||this.default[i];!l||this.default[i]==l||(e[t]=S(l))},change(e){a.isSimplyType(e)||(this.closecss=a.picker(e,"color=>--s-card-close-color,size=>--s-close-width,bold=>--s-close-height,*"))},margin(e){a.merge(this,a.picker(a.isString(e)?e.split(/\s*(?:,|\s+)\s*/):e,"0=>top,1|0=>right,2|0=>bottom,3|1|0=>left",!0),!0)}},mounted(){this.change(this.close)}},ye={class:"card-title"},me=["title"],we={class:"card-content"};function be(e,t,i,l,o,n){return r.openBlock(),r.createElementBlock("div",{class:"card",key:o.trigger,style:r.normalizeStyle(n.isEmpty(n.style)?n.tr():n.style)},[r.renderSlot(e.$slots,"default",{},()=>[r.renderSlot(e.$slots,"title",{},()=>{var s;return[r.createElementVNode("div",ye,[r.createTextVNode(r.toDisplayString(i.show||i.title)+" ",1),r.createElementVNode("div",{class:r.normalizeClass(["card-close",{hide:n.isSimplyType(i.close)?!i.close:!1}]),style:r.normalizeStyle(o.closecss),onClick:t[0]||(t[0]=c=>e.$emit("close")),title:(s=i.close)==null?void 0:s.tips},null,14,me)])]},!0),r.renderSlot(e.$slots,"content",{},()=>[r.createElementVNode("div",we,[r.renderSlot(e.$slots,"inner",{},void 0,!0)])],!0)],!0)],4)}const ee=P(ge,[["render",be],["__scopeId","data-v-2008eeb3"]]),_e={name:"Stream",computed:{column(){let{columns:e,T:t}=this,i=e||t;return a.isEmpty(i)?[]:a.isArray(i)?i:[i]}},props:{bridge:{type:String,default:"slot"},type:{type:String,default:"div"},data:{type:Array,default:()=>[]},columns:{type:[Object,Array],default:()=>null},T:{type:[Array,Object],default:()=>null}},methods:{trigger(e){let t=e[this.bridge]||e.type;return(this.$slots||this.$scopedSlots)[t]?t:"default"}}};function Se(e,t,i,l,o,n){return r.openBlock(),r.createBlock(r.resolveDynamicComponent(i.type),r.normalizeProps(r.guardReactiveProps(e.$attrs)),{default:r.withCtx(()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(n.column,s=>r.renderSlot(e.$slots,n.trigger(s),r.mergeProps({key:s.type},{ref_for:!0},s))),128))]),_:3},16)}const te=P(_e,[["render",Se]]),G=/(?:\,|\|{2})/,U="px",X="";let ie=document.documentElement,Y,J=["s-left","s-top","s-right","s-bottom"],ve={left:0,top:1,right:2,bottom:3};const A=[];var xe=he(window,"Reflect.defineProperty|Object.defineProperty=>Proxy").Proxy;let R={},re=null;xe(R,"delay",{get(){return this._delay},set(e){re=ke(()=>{p.runer(A)},e),this._delay=e}});R.delay=60;function ke(e,t){let i=0;return function(){const l=Date.now();l-i>=t&&(i=l,p.runer(e,this,arguments))}}const L=()=>{re()};function $e(e){A.push(e)}const B=new ResizeObserver(L);B.observe(ie);function se(e){e.onresize||(A.push([se,null,e]),e.onresize=!0);var t=ie,i=t.clientHeight,l=p.isNil(e.offset)?15:e.offset,o=e.target,n=e.room,s=e.index,c=e.position,h=o.getBoundingClientRect(),d=n.offsetHeight+l,f=n.offsetWidth+l,g="3,0,2,1".split(G),y,u=(h.height==Y?h.bottom-h.top:h.height)>>0,v=(h.width==Y?h.right-h.left:h.width)>>0,x=t.clientWidth-f,T=i-d,k=[h.left-f,h.top-d,x-h.right,T-h.bottom];c&&(p.each(c.split(G),function(ne,M,C,oe){oe.push(C[M])},ve,y=[]),g.unshift.apply(g,y)),s=p.each(g,function(ne,M,C){if(C[M]>0)return M},k);var m=0,b=0,_=0;if(s!=null){var w=s==0||s==2,N=s==3||s==1;m=N?Math.min(h.left,x):s==2?h.right+l:k[0],d-=l*+w;var z=Math.max(h.top,0),$=Math.min(h.bottom,i),W=($-d+Math.min(i-d,z))/2;b=Math.max(w?W:s==3?h.top+u+l:Math.min(W,k[1]),0),N&&h.left>x&&(_=h.left-m-l+v/2)}let O=n.classList,E=e.css;O.remove(...J),O.add(J[s]),e.index=s,E.left=m+U,E.top=b+U;let F=E["--tips-arrow-top"]=w?Math.min(Math.max(b,z)-b,d-l):X,I=f-3*l;E["--tips-arrow"]=_>I-10||w&&(F+(d>50?15:0)>d||!F)?"hidden":"visible",E["--tips-arrow-left"]=_?Math.min(_,I):X}const Ne={name:"Tips",props:{visible:{type:[Boolean,String,Number],default:!0},content:{type:String,default:""},title:{type:[String,Number],default:""},position:{type:String,default:"top"},offset:{type:[String,Number],default:void 0},fontSize:{type:[String,Number],default:void 0},border:{type:[String,Number],default:void 0},color:{type:[String,Number],default:void 0},background:{type:[String,Number],default:void 0},static:{type:Boolean,default:!1},delay:{type:[String,Number],default:10},borderRadius:{type:[String,Number],default:10}},watch:{visible:function(e){e&&this.$nextTick(()=>{this.init()})}},data(){return{css:{}}},methods:{parent(e){let t=this.$el,i;for(;t&&(t=t.parentNode,t&&t.nodeType==1||(t=window,i=!0),p.runer(e,null,t,i),!i););},attr(e,t,i){return p.runer(e[i===void 0?"getAttribute":"setAttribute"],e,t,i)},init(){this.$el.nodeName!="#comment"&&se({onresize:!1,target:this.$el.parentNode,room:this.$el,position:this.position,css:this.css,offset:+this.offset>>0})},scrollListener(){this.static||this.parent((e,t,i)=>{t?p.runer(e.addEventListener,e,"scroll",L):(p.runer(B.observe,B,e),(e.offsetHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)&&(i=this.attr(e,"-tips-scroll"),i||(p.runer(e.addEventListener,e,"scroll",L),this.attr(e,"-tips-scroll","true"))))})}},mounted(){a.merge(this.css,a.picker(this.$props,"color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size,borderRadius=>--tips-border-radius")),this.css["--arrow-size"]=Math.sqrt(2*Math.pow((this.border||3)*2+2,2))/2>>0,this.init(),R.delay=+this.delay,$e(e=>{this.scrollListener()}),this.scrollListener()},unmounted(){this.parent(function(e,t){p.runer(e.removeEventListener,e,"scroll",L),p.runer(e.removeAttribute,e,"-tips-scroll",void 0),t||p.runer(B.unobserve,B,e)})}},ze=["static"],Te={class:"tips-title"};function Ee(e,t,i,l,o,n){return i.visible?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,class:"tips",style:i.static?null:o.css,static:i.static?"":null},e.$attrs),[r.renderSlot(e.$slots,"default",{},()=>[r.renderSlot(e.$slots,"title",{},()=>[r.createElementVNode("div",Te,r.toDisplayString(i.title),1)],!0),r.renderSlot(e.$slots,"content",{},()=>[r.createTextVNode(r.toDisplayString(i.content),1)],!0)],!0)],16,ze)):r.createCommentVNode("",!0)}const le=P(Ne,[["render",Ee],["__scopeId","data-v-8c83dee3"]]),Be=[K,ee,te,le],Me={install(e){Be.forEach(t=>{e.component("S"+t.name,t),e.component(t.name+"S",t)})}};exports.Card=ee;exports.Flyweight=K;exports.Stream=te;exports.Tips=le;exports.default=Me;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@soei/util"),r=require("vue"),p=require("@soei/tools"),ae=require("@soei/picker");let ce=/(\d+|[+\-\*/]|%)/g,j={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t,i)=>parseFloat(e)/100*i},D=(e,t)=>{let i;if(i=a.runer("match",e,ce)){let l=i.length,o,n=0,s,c=[];for(;l--;)n=i.shift(),n in j?(o&&c.push(o),n==="%"&&(c.length=2),s=n):+n&&c.push(+n),c.length==2&&(c.push(t),o=j[s].apply(null,c),c.length=0);+o||(o=+c.pop()),e=o>>0}return e},q={},S=(e,t)=>(e+"").replace(/\w+\((.*)\)/g,"$1").replace(q[t]||(q[t]=new RegExp("(?=\\s+|^)(\\d+)(?:\\.\\d{1,})?(?!(?:\\.)*\\d|%|\\w)","g")),"$1px");const L=(e,t)=>{const i=e.__vccOpts||e;for(const[l,o]of t)i[l]=o;return i};let G=e=>e==null||e==null,ue=(...e)=>{console.info("::::FLYWEIGHT",...e)};const de={name:"Flyweight",props:{flys:{type:Array,default:()=>[]},width:{type:[String,Number],default:0},height:{type:[String,Number],default:100},w:{type:[Number,String]},h:{type:[Number,String]},offset:{type:Array,default:()=>[0,0]},lazy:{type:Number,default:100},view:{type:Object,default:()=>({id:0})},index:{type:Number,default:0},top:{type:[String,Number],default:0},left:{type:[String,Number],default:0},auto:{type:[Boolean,String],default:!1},space:{type:Object,default:()=>null},padding:{type:Boolean,default:!1}},computed:{flyweight(){return this.$refs.flyweight||""},style(){var e=this.w,t=this.h,i=this.Size,l={};return a.merge(l,{"--width":S(this.realW),"--height":S(this.realH),"--flyweight-content":S(i)},t&&{"--flyweight-h":S(t)},e&&l,{"--flyweight-w":S(e)},"mix"),l}},data(){return{flyweights:[],actice:!1,Size:null,column:1,row:1,expand:10,count:0,task:[],realW:0,realH:0}},watch:{flys(e){this.count=e.length,this.rebuild();let t=this.task.shift();t&&this.$nextTick(()=>{this.setview(t)})},view:{handler(e){this.setview(e)},immediate:!0,deep:!0},index(e){this.setindex(e)},top(e){this.flyweight.scrollTop=e},left(e){this.flyweight.scrollLeft=e}},mounted(){this.flyweights=[],this.$set||(this.$set=(e,t,i)=>{e[t]=i}),this.setindex(this.index);try{new ResizeObserver(()=>{this.rebuild(),this.$emit("resize")}).observe(this.flyweight)}catch(e){ue(e)}this.scrollx=a.runer("hasAttribute",this.flyweight,"scroll-x"),this.BoxRule="clientHeight=>height,clientWidth=>width",this.direction=this.scrollx?"scrollLeft":"scrollTop"},methods:{exec:S,trigger(e,t){a.isArray(e)||(e=e&&t?[[e,t]]:[]),e.length&&this.lazyrun(()=>{a.each(e,(i,l)=>{this.$emit(l[0],G(l[1])?!0:l[1])})})},cheackflys(e){if(!this.flys.length)return e&&this.task.push(e),!0},setview(e){a.runer([this.cheackflys,t=>{t=t||{};let i=t.index||a.each(this.flys,(l,o,n,s)=>{if(o[n]==s)return l},t.picker,t.id);G(i)||this.setindex(i)}],this,e)},setindex(e){a.runer([this.cheackflys,({index:t})=>{this.selectIndex=t,this.$nextTick(()=>{let i=t/this.column>>0,l=this.expand;(this.flyweight[this.direction]/l>>0)+this.row-i-1>0||(this.flyweight[this.direction]=i*l,this.scroll())})}],this,{index:e})},lazyrun(e,t){clearTimeout(this.time),this.time=setTimeout(()=>{a.runer(e)},t||this.lazy)},run(e){let t=[],i=a.runer(this.direction,e.target),l={offset:i,top:i,width:this.realW,height:this.realH,index:i/this.expand>>0};a.merge(l,this.space),e.from||t.push(["onscroll",l]);let o=!1;a.each(this.flyweights,(n,s,c,h,d,f,g,y,u)=>{if(c=n/d>>0,y=c+h*(+(c<f%h)+(f/h>>0)),u=y*d+n%d,u>=this.count){o||(t.push(["onend"]),o=!0);return}s.index=y,s.i=u,s.data=this.flys[u];let v=[y*this.expand+s.x,s.space];g&&v.reverse(),s.top=v[0],s.left=v[1]},null,this.row,this.column,l.index,this.scrollx),this.trigger(t),t=null},scroll(e){this.run(e||{target:this.flyweight,from:"space"})},rebuild(){let e=this.count||this.flys.length,t=this.flyweights;if(!e)return t.length=e;this.count=e;let i=this.scrollx,l=this.flyweight,o=a.picker(l,this.BoxRule);this.$nextTick(()=>{let n=/true/.test(this.auto),[s,c]=this.offset,h=o.width,d=o.height,f=(D(this.width,h)||h)+s,g=D(this.height,d)+c,y=[h/f>>0||1,d/g>>0||1];i&&y.reverse();let[u,v]=y,x=this.padding,T,k=0,m,w;i?(m=f,f-=s,w=$=>$*(g-c)+($+1)*c):(n?(f=(h-s*(u+2*x-1))/u,T=!x*s,k=x*s):(T=0,k=(h%f+s*u)/(u+1)>>0,f-=s),w=$=>$*(f+T)+($+1)*k,m=g),this.row=v+2,this.column=u,this.realH=g-c,this.realW=f,this.expand=m,this.Size=Math.ceil(e/u)*m;let b=Math.min(e,u*this.row),_=b-1,N;for(;b-- >0;)N=_-b,this.$set(t,N,{x:s,y:c,width:f,height:g-c,space:w(N%u),data:{}});t.length=_+1;let z=[];d/m>_/u&&z.push(["onend"]),this.flyweight&&(this.flyweight[this.direction]=0),this.$nextTick(()=>{this.setindex(this.selectIndex||0),this.scroll()}),z.push(["update:space",{row:(_/u>>0)+1,column:u,showrow:this.row,showcolumn:this.column}]),this.trigger(z)})}}},fe={class:"flyweight-all"};function pe(e,t,i,l,o,n){return r.openBlock(),r.createElementBlock("div",{ref:"flyweight",class:r.normalizeClass(["flyweight",{"flyweight-active":o.actice}]),style:r.normalizeStyle(n.style),onScroll:t[0]||(t[0]=(...s)=>n.scroll&&n.scroll(...s))},[r.createElementVNode("div",fe,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(o.flyweights,(s,c)=>(r.openBlock(),r.createElementBlock("div",{key:c,style:r.normalizeStyle({top:s.top+"px",left:s.left+"px"})},[r.renderSlot(e.$slots,"default",r.mergeProps({ref_for:!0},s),void 0,!0)],4))),128))]),o.flyweights.length?r.renderSlot(e.$slots,"end",{key:0},void 0,!0):r.createCommentVNode("",!0)],38)}const Q=L(de,[["render",pe],["__scopeId","data-v-35b94e9b"]]);function W(e,t){return t&&(e=e.replace(/[a-z]/g,"")),e.toLowerCase()}let Z={close:{handler(e){this.change(e)},deep:!0},offset:{handler(e){this.margin(e)},deep:!0}},ge=["BackGround","BordeR","Height","Width","Top","Right","Bottom","Left"],ee={};a.each(ge,(e,t,i)=>{e=W(t),ee["--"+W(t,!0)]=e,i[e]=function(){this.trigger++}},Z);const ye={name:"Card",props:{offset:{type:[String,Array],default:()=>[0,0,0,0]},background:{type:String,default:""},border:{type:String,default:"1px"},height:{type:String,default:"100%"},width:{type:String,default:"100%"},show:{type:String,default:""},close:{type:Object,default:null},title:{type:String,default:""}},data(){return{closecss:{},trigger:0,default:{top:"0px",right:"0px",bottom:"0px",left:"0px",height:"100%",width:"100%",background:"",border:"1px"}}},computed:{style(){return this.tr()}},watch:Z,methods:{exec:S,isEmpty:a.isEmpty,isSimplyType:a.isSimplyType,tr(){let e={};return this.margin(this.offset),a.each(ee,(t,i)=>{this.css(e,t,i)}),e},tolower:W,css(e,t,i){let l=this[i]||this.default[i];!l||this.default[i]==l||(e[t]=S(l))},change(e){a.isSimplyType(e)||(this.closecss=a.picker(e,"color=>--s-card-close-color,size=>--s-close-width,bold=>--s-close-height,*"))},margin(e){a.merge(this,a.picker(a.isString(e)?e.split(/\s*(?:,|\s+)\s*/):e,"0=>top,1|0=>right,2|0=>bottom,3|1|0=>left",!0),!0)}},mounted(){this.change(this.close)}},me={class:"card-title"},_e=["title"],we={class:"card-content"};function be(e,t,i,l,o,n){return r.openBlock(),r.createElementBlock("div",{class:"card",key:o.trigger,style:r.normalizeStyle(n.isEmpty(n.style)?n.tr():n.style)},[r.renderSlot(e.$slots,"default",{},()=>[r.renderSlot(e.$slots,"title",{},()=>{var s;return[r.createElementVNode("div",me,[r.createTextVNode(r.toDisplayString(i.show||i.title)+" ",1),r.createElementVNode("div",{class:r.normalizeClass(["card-close",{hide:n.isSimplyType(i.close)?!i.close:!1}]),style:r.normalizeStyle(o.closecss),onClick:t[0]||(t[0]=c=>e.$emit("close")),title:(s=i.close)==null?void 0:s.tips},null,14,_e)])]},!0),r.renderSlot(e.$slots,"content",{},()=>[r.createElementVNode("div",we,[r.renderSlot(e.$slots,"inner",{},void 0,!0)])],!0)],!0)],4)}const te=L(ye,[["render",be],["__scopeId","data-v-85bce7b7"]]),Se={name:"Stream",computed:{component(){return this.$refs.component},column(){let{columns:e,T:t}=this,i=e||t;return a.isEmpty(i)?[]:a.isArray(i)?i:[i]}},props:{bridge:{type:String,default:"slot"},type:{type:String,default:"div"},columns:{type:[Object,Array],default:()=>null},T:{type:[Array,Object],default:()=>null}},mounted(){this.$.vnode.ref&&a.merge(this,{...this.component})},methods:{__trigger(e){let t=e[this.bridge]||e.type;return(this.$slots||this.$scopedSlots)[t]?t:"default"}}};function ve(e,t,i,l,o,n){return r.openBlock(),r.createBlock(r.resolveDynamicComponent(i.type),r.mergeProps({ref:"component"},e.$attrs),{default:r.withCtx(()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(n.column,s=>r.renderSlot(e.$slots,n.__trigger(s),r.mergeProps({key:s.type},{ref_for:!0},s))),128))]),_:3},16)}const ie=L(Se,[["render",ve]]),U=/(?:\,|\|{2})/,X="px",Y="";let re=document.documentElement,J,K=["s-left","s-top","s-right","s-bottom"],xe={left:0,top:1,right:2,bottom:3};const A=[];var ke=ae(window,"Reflect.defineProperty|Object.defineProperty=>Proxy").Proxy;let O={},se=null;ke(O,"delay",{get(){return this._delay},set(e){se=$e(()=>{p.runer(A)},e),this._delay=e}});O.delay=60;function $e(e,t){let i=0;return function(){const l=Date.now();l-i>=t&&(i=l,p.runer(e,this,arguments))}}const C=()=>{se()};function Ne(e){A.push(e)}const B=new ResizeObserver(C);B.observe(re);function le(e){e.onresize||(A.push([le,null,e]),e.onresize=!0);var t=re,i=t.clientHeight,l=p.isNil(e.offset)?15:e.offset,o=e.target,n=e.room,s=e.index,c=e.position,h=o.getBoundingClientRect(),d=n.offsetHeight+l,f=n.offsetWidth+l,g="3,0,2,1".split(U),y,u=(h.height==J?h.bottom-h.top:h.height)>>0,v=(h.width==J?h.right-h.left:h.width)>>0,x=t.clientWidth-f,T=i-d,k=[h.left-f,h.top-d,x-h.right,T-h.bottom];c&&(p.each(c.split(U),function(oe,M,H,he){he.push(H[M])},xe,y=[]),g.unshift.apply(g,y)),s=p.each(g,function(oe,M,H){if(H[M]>0)return M},k);var m=0,w=0,b=0;if(s!=null){var _=s==0||s==2,N=s==3||s==1;m=N?Math.min(h.left,x):s==2?h.right+l:k[0],d-=l*+_;var z=Math.max(h.top,0),$=Math.min(h.bottom,i),R=($-d+Math.min(i-d,z))/2;w=Math.max(_?R:s==3?h.top+u+l:Math.min(R,k[1]),0),N&&h.left>x&&(b=h.left-m-l+v/2)}let F=n.classList,E=e.css;F.remove(...K),F.add(K[s]),e.index=s,E.left=m+X,E.top=w+X;let I=E["--tips-arrow-top"]=_?Math.min(Math.max(w,z)-w,d-l):Y,V=f-3*l;E["--tips-arrow"]=b>V-10||_&&(I+(d>50?15:0)>d||!I)?"hidden":"visible",E["--tips-arrow-left"]=b?Math.min(b,V):Y}const P="data-tips-scroll",ze={name:"Tips",props:{visible:{type:[Boolean,String,Number],default:!0},content:{type:String,default:""},title:{type:[String,Number],default:""},position:{type:String,default:"top"},offset:{type:[String,Number],default:void 0},fontSize:{type:[String,Number],default:void 0},border:{type:[String,Number],default:void 0},color:{type:[String,Number],default:void 0},background:{type:[String,Number],default:void 0},static:{type:Boolean,default:!1},delay:{type:[String,Number],default:10},borderRadius:{type:[String,Number],default:10}},watch:{visible:function(e){e&&this.$nextTick(()=>{this.init()})}},data(){return{css:{}}},methods:{parent(e){let t=this.$el,i;for(;t&&(t=t.parentNode,t&&t.nodeType==1||(t=window,i=!0),p.runer(e,null,t,i),!i););},attr(e,t,i){return p.runer(e[i===void 0?"getAttribute":"setAttribute"],e,t,i)},init(){this.$el.nodeName!="#comment"&&le({onresize:!1,target:this.$el.parentNode,room:this.$el,position:this.position,css:this.css,offset:+this.offset>>0})},scrollListener(){this.static||this.parent((e,t,i)=>{t?p.runer(e.addEventListener,e,"scroll",C):(p.runer(B.observe,B,e),(e.offsetHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)&&(i=this.attr(e,P),i||(p.runer(e.addEventListener,e,"scroll",C),this.attr(e,P,"true"))))})}},mounted(){a.merge(this.css,a.picker(this.$props,"color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size,borderRadius=>--tips-border-radius")),this.css["--arrow-size"]=Math.sqrt(2*Math.pow((this.border||3)*2+2,2))/2>>0,this.init(),O.delay=+this.delay,Ne(e=>{this.scrollListener()}),this.scrollListener()},unmounted(){this.parent(function(e,t){p.runer(e.removeEventListener,e,"scroll",C),p.runer(e.removeAttribute,e,P,void 0),t||p.runer(B.unobserve,B,e)})}},Te=["static"],Ee={class:"tips-title"};function Be(e,t,i,l,o,n){return i.visible?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,class:"tips",style:i.static?null:o.css,static:i.static?"":null},e.$attrs),[r.renderSlot(e.$slots,"default",{},()=>[r.renderSlot(e.$slots,"title",{},()=>[r.createElementVNode("div",Ee,r.toDisplayString(i.title),1)],!0),r.renderSlot(e.$slots,"content",{},()=>[r.createTextVNode(r.toDisplayString(i.content),1)],!0)],!0)],16,Te)):r.createCommentVNode("",!0)}const ne=L(ze,[["render",Be],["__scopeId","data-v-e7d22ab3"]]),Me=[Q,te,ie,ne],Ce={install(e){Me.forEach(t=>{e.component("S"+t.name,t),e.component(t.name+"S",t)})}};exports.Card=te;exports.Flyweight=Q;exports.Stream=ie;exports.Tips=ne;exports.default=Ce;
|
package/Flyweight.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { runer as T, merge as B, isArray as
|
|
2
|
-
import { openBlock as
|
|
3
|
-
import { runer as p, isNil as
|
|
4
|
-
import
|
|
5
|
-
let
|
|
1
|
+
import { runer as T, merge as B, isArray as at, each as C, picker as O, isEmpty as dt, isSimplyType as Q, isString as St } from "@soei/util";
|
|
2
|
+
import { openBlock as N, createElementBlock as M, normalizeClass as ct, normalizeStyle as P, createElementVNode as W, Fragment as ut, renderList as ft, renderSlot as g, mergeProps as I, createCommentVNode as pt, createTextVNode as gt, toDisplayString as G, createBlock as $t, resolveDynamicComponent as Nt, withCtx as zt } from "vue";
|
|
3
|
+
import { runer as p, isNil as kt, each as Z } from "@soei/tools";
|
|
4
|
+
import Tt from "@soei/picker";
|
|
5
|
+
let Mt = /(\d+|[+\-\*/]|%)/g, tt = {
|
|
6
6
|
"+": (t, e) => t + e,
|
|
7
7
|
"-": (t, e) => t - e,
|
|
8
8
|
"*": (t, e) => t * e,
|
|
9
9
|
"/": (t, e) => t / e,
|
|
10
10
|
"%": (t, e, i) => parseFloat(t) / 100 * i
|
|
11
|
-
},
|
|
11
|
+
}, et = (t, e) => {
|
|
12
12
|
let i;
|
|
13
|
-
if (i = T("match", t,
|
|
13
|
+
if (i = T("match", t, Mt)) {
|
|
14
14
|
let r = i.length, n, l = 0, s, h = [];
|
|
15
15
|
for (; r--; )
|
|
16
|
-
l = i.shift(), l in
|
|
16
|
+
l = i.shift(), l in tt ? (n && h.push(n), l === "%" && (h.length = 2), s = l) : +l && h.push(+l), h.length == 2 && (h.push(e), n = tt[s].apply(null, h), h.length = 0);
|
|
17
17
|
+n || (n = +h.pop()), t = n >> 0;
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
|
-
},
|
|
20
|
+
}, it = {}, b = (t, e) => (t + "").replace(
|
|
21
21
|
/\w+\((.*)\)/g,
|
|
22
22
|
"$1"
|
|
23
23
|
).replace(
|
|
24
|
-
|
|
24
|
+
it[e] || (it[e] = new RegExp("(?=\\s+|^)(\\d+)(?:\\.\\d{1,})?(?!(?:\\.)*\\d|%|\\w)", "g")),
|
|
25
25
|
"$1px"
|
|
26
26
|
);
|
|
27
|
-
const
|
|
27
|
+
const j = (t, e) => {
|
|
28
28
|
const i = t.__vccOpts || t;
|
|
29
29
|
for (const [r, n] of e)
|
|
30
30
|
i[r] = n;
|
|
31
31
|
return i;
|
|
32
32
|
};
|
|
33
|
-
let
|
|
33
|
+
let st = (t) => t == null || t == null, Et = (...t) => {
|
|
34
34
|
console.info("::::FLYWEIGHT", ...t);
|
|
35
35
|
};
|
|
36
|
-
const
|
|
36
|
+
const Ht = {
|
|
37
37
|
name: "Flyweight",
|
|
38
38
|
props: {
|
|
39
39
|
flys: {
|
|
@@ -98,13 +98,13 @@ const Lt = {
|
|
|
98
98
|
style() {
|
|
99
99
|
var t = this.w, e = this.h, i = this.Size, r = {};
|
|
100
100
|
return B(r, {
|
|
101
|
-
"--width":
|
|
102
|
-
"--height":
|
|
103
|
-
"--flyweight-content":
|
|
101
|
+
"--width": b(this.realW),
|
|
102
|
+
"--height": b(this.realH),
|
|
103
|
+
"--flyweight-content": b(i)
|
|
104
104
|
}, e && {
|
|
105
|
-
"--flyweight-h":
|
|
105
|
+
"--flyweight-h": b(e)
|
|
106
106
|
}, t && r, {
|
|
107
|
-
"--flyweight-w":
|
|
107
|
+
"--flyweight-w": b(t)
|
|
108
108
|
}, "mix"), r;
|
|
109
109
|
}
|
|
110
110
|
},
|
|
@@ -156,17 +156,17 @@ const Lt = {
|
|
|
156
156
|
this.rebuild(), this.$emit("resize");
|
|
157
157
|
}).observe(this.flyweight);
|
|
158
158
|
} catch (t) {
|
|
159
|
-
|
|
159
|
+
Et(t);
|
|
160
160
|
}
|
|
161
161
|
this.scrollx = T("hasAttribute", this.flyweight, "scroll-x"), this.BoxRule = /* this.scrollx ? 'clientHeight=>width,clientWidth=>height' : */
|
|
162
162
|
"clientHeight=>height,clientWidth=>width", this.direction = this.scrollx ? "scrollLeft" : "scrollTop";
|
|
163
163
|
},
|
|
164
164
|
methods: {
|
|
165
|
-
exec:
|
|
165
|
+
exec: b,
|
|
166
166
|
trigger(t, e) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
this.$emit(r[0],
|
|
167
|
+
at(t) || (t = t && e ? [[t, e]] : []), t.length && this.lazyrun(() => {
|
|
168
|
+
C(t, (i, r) => {
|
|
169
|
+
this.$emit(r[0], st(r[1]) ? !0 : r[1]);
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
172
|
},
|
|
@@ -177,11 +177,11 @@ const Lt = {
|
|
|
177
177
|
setview(t) {
|
|
178
178
|
T([this.cheackflys, (e) => {
|
|
179
179
|
e = e || {};
|
|
180
|
-
let i = e.index ||
|
|
180
|
+
let i = e.index || C(this.flys, (r, n, l, s) => {
|
|
181
181
|
if (n[l] == s)
|
|
182
182
|
return r;
|
|
183
183
|
}, e.picker, e.id);
|
|
184
|
-
|
|
184
|
+
st(i) || this.setindex(i);
|
|
185
185
|
}], this, t);
|
|
186
186
|
},
|
|
187
187
|
setindex(t) {
|
|
@@ -209,11 +209,11 @@ const Lt = {
|
|
|
209
209
|
};
|
|
210
210
|
B(r, this.space), t.from || e.push(["onscroll", r]);
|
|
211
211
|
let n = !1;
|
|
212
|
-
|
|
212
|
+
C(
|
|
213
213
|
this.flyweights,
|
|
214
|
-
(l, s, h, o, d,
|
|
214
|
+
(l, s, h, o, d, c, u, f, a) => {
|
|
215
215
|
if (h = l / d >> 0, f = h + o * /* 偏移量, 如果超出顶部 + 1轮,排列到列队后, 否则保持在当前*/
|
|
216
|
-
(+(h <
|
|
216
|
+
(+(h < c % o) + (c / o >> 0)), a = f * d + l % d, a >= this.count) {
|
|
217
217
|
n || (e.push(["onend"]), n = !0);
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
@@ -224,7 +224,7 @@ const Lt = {
|
|
|
224
224
|
/* left */
|
|
225
225
|
s.space
|
|
226
226
|
];
|
|
227
|
-
|
|
227
|
+
u && v.reverse(), s.top = v[0], s.left = v[1];
|
|
228
228
|
},
|
|
229
229
|
null,
|
|
230
230
|
this.row,
|
|
@@ -242,23 +242,23 @@ const Lt = {
|
|
|
242
242
|
if (!t)
|
|
243
243
|
return e.length = t;
|
|
244
244
|
this.count = t;
|
|
245
|
-
let i = this.scrollx, r = this.flyweight, n =
|
|
245
|
+
let i = this.scrollx, r = this.flyweight, n = O(r, this.BoxRule);
|
|
246
246
|
this.$nextTick(() => {
|
|
247
|
-
let l = /true/.test(this.auto), [s, h] = this.offset, o = n.width, d = n.height,
|
|
247
|
+
let l = /true/.test(this.auto), [s, h] = this.offset, o = n.width, d = n.height, c = (et(this.width, o) || o) + s, u = et(this.height, d) + h, f = [o / c >> 0 || 1, d / u >> 0 || 1];
|
|
248
248
|
i && f.reverse();
|
|
249
|
-
let [a, v] = f, x = this.padding, E, S = 0, y,
|
|
250
|
-
i ? (y =
|
|
249
|
+
let [a, v] = f, x = this.padding, E, S = 0, y, _;
|
|
250
|
+
i ? (y = c, c -= s, _ = ($) => (
|
|
251
251
|
/* 计算top偏移量 */
|
|
252
|
-
$ * (
|
|
253
|
-
)) : (l ? (
|
|
254
|
-
let
|
|
255
|
-
for (;
|
|
256
|
-
|
|
252
|
+
$ * (u - h) + ($ + 1) * h
|
|
253
|
+
)) : (l ? (c = (o - s * (a + 2 * x - 1)) / a, E = !x * s, S = x * s) : (E = 0, S = (o % c + s * a) / (a + 1) >> 0, c -= s), _ = ($) => $ * (c + E) + ($ + 1) * S, y = u), this.row = v + 2, this.column = a, this.realH = u - h, this.realW = c, this.expand = y, this.Size = Math.ceil(t / a) * y;
|
|
254
|
+
let w = Math.min(t, a * this.row), m = w - 1, z;
|
|
255
|
+
for (; w-- > 0; )
|
|
256
|
+
z = m - w, this.$set(e, z, {
|
|
257
257
|
x: s,
|
|
258
258
|
y: h,
|
|
259
|
-
width:
|
|
260
|
-
height:
|
|
261
|
-
space:
|
|
259
|
+
width: c,
|
|
260
|
+
height: u - h,
|
|
261
|
+
space: _(z % a),
|
|
262
262
|
data: {}
|
|
263
263
|
});
|
|
264
264
|
e.length = m + 1;
|
|
@@ -274,35 +274,35 @@ const Lt = {
|
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
},
|
|
278
|
-
function
|
|
279
|
-
return
|
|
277
|
+
}, Lt = { class: "flyweight-all" };
|
|
278
|
+
function Ct(t, e, i, r, n, l) {
|
|
279
|
+
return N(), M("div", {
|
|
280
280
|
ref: "flyweight",
|
|
281
|
-
class:
|
|
281
|
+
class: ct(["flyweight", {
|
|
282
282
|
"flyweight-active": n.actice
|
|
283
283
|
}]),
|
|
284
|
-
style:
|
|
284
|
+
style: P(l.style),
|
|
285
285
|
onScroll: e[0] || (e[0] = (...s) => l.scroll && l.scroll(...s))
|
|
286
286
|
}, [
|
|
287
|
-
|
|
288
|
-
(
|
|
287
|
+
W("div", Lt, [
|
|
288
|
+
(N(!0), M(ut, null, ft(n.flyweights, (s, h) => (N(), M("div", {
|
|
289
289
|
key: h,
|
|
290
|
-
style:
|
|
290
|
+
style: P({
|
|
291
291
|
top: s.top + "px",
|
|
292
292
|
left: s.left + "px"
|
|
293
293
|
})
|
|
294
294
|
}, [
|
|
295
|
-
g(t.$slots, "default",
|
|
295
|
+
g(t.$slots, "default", I({ ref_for: !0 }, s), void 0, !0)
|
|
296
296
|
], 4))), 128))
|
|
297
297
|
]),
|
|
298
|
-
n.flyweights.length ? g(t.$slots, "end", { key: 0 }, void 0, !0) :
|
|
298
|
+
n.flyweights.length ? g(t.$slots, "end", { key: 0 }, void 0, !0) : pt("", !0)
|
|
299
299
|
], 38);
|
|
300
300
|
}
|
|
301
|
-
const Wt = /* @__PURE__ */
|
|
302
|
-
function
|
|
301
|
+
const Wt = /* @__PURE__ */ j(Ht, [["render", Ct], ["__scopeId", "data-v-35b94e9b"]]);
|
|
302
|
+
function U(t, e) {
|
|
303
303
|
return e && (t = t.replace(/[a-z]/g, "")), t.toLowerCase();
|
|
304
304
|
}
|
|
305
|
-
let
|
|
305
|
+
let yt = {
|
|
306
306
|
close: {
|
|
307
307
|
handler(t) {
|
|
308
308
|
this.change(t);
|
|
@@ -315,7 +315,7 @@ let gt = {
|
|
|
315
315
|
},
|
|
316
316
|
deep: !0
|
|
317
317
|
}
|
|
318
|
-
},
|
|
318
|
+
}, Bt = [
|
|
319
319
|
"BackGround",
|
|
320
320
|
"BordeR",
|
|
321
321
|
"Height",
|
|
@@ -324,17 +324,17 @@ let gt = {
|
|
|
324
324
|
"Right",
|
|
325
325
|
"Bottom",
|
|
326
326
|
"Left"
|
|
327
|
-
],
|
|
328
|
-
|
|
329
|
-
|
|
327
|
+
], mt = {};
|
|
328
|
+
C(
|
|
329
|
+
Bt,
|
|
330
330
|
(t, e, i) => {
|
|
331
|
-
t =
|
|
331
|
+
t = U(e), mt["--" + U(e, !0)] = t, i[t] = function() {
|
|
332
332
|
this.trigger++;
|
|
333
333
|
};
|
|
334
334
|
},
|
|
335
|
-
|
|
335
|
+
yt
|
|
336
336
|
);
|
|
337
|
-
const
|
|
337
|
+
const Rt = {
|
|
338
338
|
name: "Card",
|
|
339
339
|
// inheritAttrs: false,
|
|
340
340
|
props: {
|
|
@@ -393,24 +393,24 @@ const Bt = {
|
|
|
393
393
|
return this.tr();
|
|
394
394
|
}
|
|
395
395
|
},
|
|
396
|
-
watch:
|
|
396
|
+
watch: yt,
|
|
397
397
|
methods: {
|
|
398
|
-
exec:
|
|
399
|
-
isEmpty:
|
|
400
|
-
isSimplyType:
|
|
398
|
+
exec: b,
|
|
399
|
+
isEmpty: dt,
|
|
400
|
+
isSimplyType: Q,
|
|
401
401
|
tr() {
|
|
402
402
|
let t = {};
|
|
403
|
-
return this.margin(this.offset),
|
|
403
|
+
return this.margin(this.offset), C(mt, (e, i) => {
|
|
404
404
|
this.css(t, e, i);
|
|
405
405
|
}), t;
|
|
406
406
|
},
|
|
407
|
-
tolower:
|
|
407
|
+
tolower: U,
|
|
408
408
|
css(t, e, i) {
|
|
409
409
|
let r = this[i] || this.default[i];
|
|
410
|
-
!r || this.default[i] == r || (t[e] =
|
|
410
|
+
!r || this.default[i] == r || (t[e] = b(r));
|
|
411
411
|
},
|
|
412
412
|
change(t) {
|
|
413
|
-
|
|
413
|
+
Q(t) || (this.closecss = O(
|
|
414
414
|
t,
|
|
415
415
|
"color=>--s-card-close-color,size=>--s-close-width,bold=>--s-close-height,*"
|
|
416
416
|
));
|
|
@@ -418,8 +418,8 @@ const Bt = {
|
|
|
418
418
|
margin(t) {
|
|
419
419
|
B(
|
|
420
420
|
this,
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
O(
|
|
422
|
+
St(t) ? t.split(/\s*(?:,|\s+)\s*/) : t,
|
|
423
423
|
"0=>top,1|0=>right,2|0=>bottom,3|1|0=>left",
|
|
424
424
|
!0
|
|
425
425
|
),
|
|
@@ -430,22 +430,22 @@ const Bt = {
|
|
|
430
430
|
mounted() {
|
|
431
431
|
this.change(this.close);
|
|
432
432
|
}
|
|
433
|
-
},
|
|
434
|
-
function
|
|
435
|
-
return
|
|
433
|
+
}, At = { class: "card-title" }, Ot = ["title"], Pt = { class: "card-content" };
|
|
434
|
+
function It(t, e, i, r, n, l) {
|
|
435
|
+
return N(), M("div", {
|
|
436
436
|
class: "card",
|
|
437
437
|
key: n.trigger,
|
|
438
|
-
style:
|
|
438
|
+
style: P(l.isEmpty(l.style) ? l.tr() : l.style)
|
|
439
439
|
}, [
|
|
440
440
|
g(t.$slots, "default", {}, () => [
|
|
441
441
|
g(t.$slots, "title", {}, () => {
|
|
442
442
|
var s;
|
|
443
443
|
return [
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
class:
|
|
448
|
-
style:
|
|
444
|
+
W("div", At, [
|
|
445
|
+
gt(G(i.show || i.title) + " ", 1),
|
|
446
|
+
W("div", {
|
|
447
|
+
class: ct(["card-close", { hide: l.isSimplyType(i.close) ? !i.close : !1 }]),
|
|
448
|
+
style: P(n.closecss),
|
|
449
449
|
onClick: e[0] || (e[0] = (h) => t.$emit("close")),
|
|
450
450
|
title: (s = i.close) == null ? void 0 : s.tips
|
|
451
451
|
}, null, 14, Ot)
|
|
@@ -453,19 +453,22 @@ function jt(t, e, i, r, n, l) {
|
|
|
453
453
|
];
|
|
454
454
|
}, !0),
|
|
455
455
|
g(t.$slots, "content", {}, () => [
|
|
456
|
-
|
|
456
|
+
W("div", Pt, [
|
|
457
457
|
g(t.$slots, "inner", {}, void 0, !0)
|
|
458
458
|
])
|
|
459
459
|
], !0)
|
|
460
460
|
], !0)
|
|
461
461
|
], 4);
|
|
462
462
|
}
|
|
463
|
-
const
|
|
463
|
+
const jt = /* @__PURE__ */ j(Rt, [["render", It], ["__scopeId", "data-v-85bce7b7"]]), Ft = {
|
|
464
464
|
name: "Stream",
|
|
465
465
|
computed: {
|
|
466
|
+
component() {
|
|
467
|
+
return this.$refs.component;
|
|
468
|
+
},
|
|
466
469
|
column() {
|
|
467
470
|
let { columns: t, T: e } = this, i = t || e;
|
|
468
|
-
return
|
|
471
|
+
return dt(i) ? [] : at(i) ? i : [i];
|
|
469
472
|
}
|
|
470
473
|
},
|
|
471
474
|
props: {
|
|
@@ -478,10 +481,6 @@ const Ft = /* @__PURE__ */ I(Bt, [["render", jt], ["__scopeId", "data-v-2008eeb3
|
|
|
478
481
|
type: String,
|
|
479
482
|
default: "div"
|
|
480
483
|
},
|
|
481
|
-
data: {
|
|
482
|
-
type: Array,
|
|
483
|
-
default: () => []
|
|
484
|
-
},
|
|
485
484
|
columns: {
|
|
486
485
|
type: [Object, Array],
|
|
487
486
|
default: () => null
|
|
@@ -491,32 +490,35 @@ const Ft = /* @__PURE__ */ I(Bt, [["render", jt], ["__scopeId", "data-v-2008eeb3
|
|
|
491
490
|
default: () => null
|
|
492
491
|
}
|
|
493
492
|
},
|
|
493
|
+
mounted() {
|
|
494
|
+
this.$.vnode.ref && B(this, { ...this.component });
|
|
495
|
+
},
|
|
494
496
|
methods: {
|
|
495
|
-
|
|
497
|
+
__trigger(t) {
|
|
496
498
|
let e = t[this.bridge] || t.type;
|
|
497
499
|
return (this.$slots || this.$scopedSlots)[e] ? e : "default";
|
|
498
500
|
}
|
|
499
501
|
}
|
|
500
502
|
};
|
|
501
|
-
function
|
|
502
|
-
return
|
|
503
|
-
default:
|
|
504
|
-
(
|
|
503
|
+
function Dt(t, e, i, r, n, l) {
|
|
504
|
+
return N(), $t(Nt(i.type), I({ ref: "component" }, t.$attrs), {
|
|
505
|
+
default: zt(() => [
|
|
506
|
+
(N(!0), M(ut, null, ft(l.column, (s) => g(t.$slots, l.__trigger(s), I({
|
|
505
507
|
key: s.type
|
|
506
508
|
}, { ref_for: !0 }, s))), 128))
|
|
507
509
|
]),
|
|
508
510
|
_: 3
|
|
509
511
|
}, 16);
|
|
510
512
|
}
|
|
511
|
-
const
|
|
512
|
-
let
|
|
513
|
-
const
|
|
514
|
-
var
|
|
513
|
+
const Gt = /* @__PURE__ */ j(Ft, [["render", Dt]]), rt = /(?:\,|\|{2})/, lt = "px", nt = "";
|
|
514
|
+
let _t = document.documentElement, ot, ht = ["s-left", "s-top", "s-right", "s-bottom"], Ut = { left: 0, top: 1, right: 2, bottom: 3 };
|
|
515
|
+
const V = [];
|
|
516
|
+
var Vt = Tt(
|
|
515
517
|
window,
|
|
516
518
|
"Reflect.defineProperty|Object.defineProperty=>Proxy"
|
|
517
519
|
).Proxy;
|
|
518
|
-
let
|
|
519
|
-
|
|
520
|
+
let q = {}, wt = null;
|
|
521
|
+
Vt(q, "delay", {
|
|
520
522
|
/**
|
|
521
523
|
* 获取延迟时间值
|
|
522
524
|
* @returns {number} 返回当前实例的延迟时间属性值
|
|
@@ -525,13 +527,13 @@ qt(V, "delay", {
|
|
|
525
527
|
return this._delay;
|
|
526
528
|
},
|
|
527
529
|
set(t) {
|
|
528
|
-
wt =
|
|
529
|
-
p(
|
|
530
|
+
wt = qt(() => {
|
|
531
|
+
p(V);
|
|
530
532
|
}, t), this._delay = t;
|
|
531
533
|
}
|
|
532
534
|
});
|
|
533
|
-
|
|
534
|
-
function
|
|
535
|
+
q.delay = 60;
|
|
536
|
+
function qt(t, e) {
|
|
535
537
|
let i = 0;
|
|
536
538
|
return function() {
|
|
537
539
|
const r = Date.now();
|
|
@@ -541,16 +543,16 @@ function Xt(t, e) {
|
|
|
541
543
|
const A = () => {
|
|
542
544
|
wt();
|
|
543
545
|
};
|
|
544
|
-
function
|
|
545
|
-
|
|
546
|
+
function Xt(t) {
|
|
547
|
+
V.push(t);
|
|
546
548
|
}
|
|
547
549
|
const L = new ResizeObserver(A);
|
|
548
|
-
L.observe(
|
|
550
|
+
L.observe(_t);
|
|
549
551
|
function bt(t) {
|
|
550
|
-
t.onresize || (
|
|
551
|
-
var e =
|
|
552
|
+
t.onresize || (V.push([bt, null, t]), t.onresize = !0);
|
|
553
|
+
var e = _t, i = e.clientHeight, r = kt(t.offset) ? 15 : t.offset, n = t.target, l = t.room, s = t.index, h = t.position, o = n.getBoundingClientRect(), d = l.offsetHeight + r, c = l.offsetWidth + r, u = "3,0,2,1".split(rt), f, a = (o.height == ot ? o.bottom - o.top : o.height) >> 0, v = (o.width == ot ? o.right - o.left : o.width) >> 0, x = e.clientWidth - c, E = i - d, S = [
|
|
552
554
|
/* left: 0 */
|
|
553
|
-
o.left -
|
|
555
|
+
o.left - c,
|
|
554
556
|
/* top: 1 */
|
|
555
557
|
o.top - d,
|
|
556
558
|
/* right: 2 */
|
|
@@ -558,44 +560,44 @@ function bt(t) {
|
|
|
558
560
|
/* bottom: 3 */
|
|
559
561
|
E - o.bottom
|
|
560
562
|
];
|
|
561
|
-
h && (
|
|
562
|
-
h.split(
|
|
563
|
-
function(
|
|
564
|
-
|
|
563
|
+
h && (Z(
|
|
564
|
+
h.split(rt),
|
|
565
|
+
function(vt, R, F, xt) {
|
|
566
|
+
xt.push(F[R]);
|
|
565
567
|
},
|
|
566
|
-
|
|
568
|
+
Ut,
|
|
567
569
|
f = []
|
|
568
|
-
),
|
|
569
|
-
|
|
570
|
-
function(
|
|
571
|
-
if (
|
|
572
|
-
return
|
|
570
|
+
), u.unshift.apply(u, f)), s = Z(
|
|
571
|
+
u,
|
|
572
|
+
function(vt, R, F) {
|
|
573
|
+
if (F[R] > 0)
|
|
574
|
+
return R;
|
|
573
575
|
},
|
|
574
576
|
S
|
|
575
577
|
);
|
|
576
|
-
var y = 0,
|
|
578
|
+
var y = 0, _ = 0, w = 0;
|
|
577
579
|
if (s != null) {
|
|
578
|
-
var m = s == 0 || s == 2,
|
|
579
|
-
y =
|
|
580
|
+
var m = s == 0 || s == 2, z = s == 3 || s == 1;
|
|
581
|
+
y = z ? Math.min(o.left, x) : s == 2 ? o.right + r : S[0], d -= r * +m;
|
|
580
582
|
var k = Math.max(o.top, 0), $ = Math.min(
|
|
581
583
|
o.bottom,
|
|
582
584
|
i
|
|
583
|
-
),
|
|
584
|
-
|
|
585
|
-
m ?
|
|
585
|
+
), X = ($ - d + Math.min(i - d, k)) / 2;
|
|
586
|
+
_ = Math.max(
|
|
587
|
+
m ? X : s == 3 ? o.top + a + r : Math.min(X, S[1]),
|
|
586
588
|
0
|
|
587
|
-
),
|
|
589
|
+
), z && o.left > x && (w = o.left - y - r + v / 2);
|
|
588
590
|
}
|
|
589
|
-
let
|
|
590
|
-
|
|
591
|
-
let
|
|
591
|
+
let Y = l.classList, H = t.css;
|
|
592
|
+
Y.remove(...ht), Y.add(ht[s]), t.index = s, H.left = y + lt, H.top = _ + lt;
|
|
593
|
+
let J = H["--tips-arrow-top"] = m ? Math.min(
|
|
592
594
|
/* 底边距 */
|
|
593
|
-
Math.max(
|
|
595
|
+
Math.max(_, k) - _,
|
|
594
596
|
d - r
|
|
595
|
-
) :
|
|
596
|
-
H["--tips-arrow"] =
|
|
597
|
+
) : nt, K = c - 3 * r;
|
|
598
|
+
H["--tips-arrow"] = w > K - 10 || m && (J + (d > 50 ? 15 : 0) > d || !J) ? "hidden" : "visible", H["--tips-arrow-left"] = w ? Math.min(w, K) : nt;
|
|
597
599
|
}
|
|
598
|
-
const
|
|
600
|
+
const D = "data-tips-scroll", Yt = {
|
|
599
601
|
name: "Tips",
|
|
600
602
|
props: {
|
|
601
603
|
/* 是否显示 */
|
|
@@ -702,29 +704,29 @@ const Jt = {
|
|
|
702
704
|
},
|
|
703
705
|
scrollListener() {
|
|
704
706
|
this.static || this.parent((t, e, i) => {
|
|
705
|
-
e ? p(t.addEventListener, t, "scroll", A) : (p(L.observe, L, t), (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && (i = this.attr(t,
|
|
707
|
+
e ? p(t.addEventListener, t, "scroll", A) : (p(L.observe, L, t), (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && (i = this.attr(t, D), i || (p(t.addEventListener, t, "scroll", A), this.attr(t, D, "true"))));
|
|
706
708
|
});
|
|
707
709
|
}
|
|
708
710
|
},
|
|
709
711
|
mounted() {
|
|
710
712
|
B(
|
|
711
713
|
this.css,
|
|
712
|
-
|
|
714
|
+
O(
|
|
713
715
|
this.$props,
|
|
714
716
|
"color=>--tips-color,background=>--tips-background-color,border=>--tips-border-width,fontSize=>--tips-font-size,borderRadius=>--tips-border-radius"
|
|
715
717
|
)
|
|
716
|
-
), this.css["--arrow-size"] = Math.sqrt(2 * Math.pow((this.border || 3) * 2 + 2, 2)) / 2 >> 0, this.init(),
|
|
718
|
+
), this.css["--arrow-size"] = Math.sqrt(2 * Math.pow((this.border || 3) * 2 + 2, 2)) / 2 >> 0, this.init(), q.delay = +this.delay, Xt((t) => {
|
|
717
719
|
this.scrollListener();
|
|
718
720
|
}), this.scrollListener();
|
|
719
721
|
},
|
|
720
722
|
unmounted() {
|
|
721
723
|
this.parent(function(t, e) {
|
|
722
|
-
p(t.removeEventListener, t, "scroll", A), p(t.removeAttribute, t,
|
|
724
|
+
p(t.removeEventListener, t, "scroll", A), p(t.removeAttribute, t, D, void 0), e || p(L.unobserve, L, t);
|
|
723
725
|
});
|
|
724
726
|
}
|
|
725
|
-
},
|
|
726
|
-
function
|
|
727
|
-
return i.visible ? (
|
|
727
|
+
}, Jt = ["static"], Kt = { class: "tips-title" };
|
|
728
|
+
function Qt(t, e, i, r, n, l) {
|
|
729
|
+
return i.visible ? (N(), M("div", I({
|
|
728
730
|
key: 0,
|
|
729
731
|
class: "tips",
|
|
730
732
|
style: i.static ? null : n.css,
|
|
@@ -732,25 +734,25 @@ function Zt(t, e, i, r, n, l) {
|
|
|
732
734
|
}, t.$attrs), [
|
|
733
735
|
g(t.$slots, "default", {}, () => [
|
|
734
736
|
g(t.$slots, "title", {}, () => [
|
|
735
|
-
|
|
737
|
+
W("div", Kt, G(i.title), 1)
|
|
736
738
|
], !0),
|
|
737
739
|
g(t.$slots, "content", {}, () => [
|
|
738
|
-
|
|
740
|
+
gt(G(i.content), 1)
|
|
739
741
|
], !0)
|
|
740
742
|
], !0)
|
|
741
|
-
], 16,
|
|
743
|
+
], 16, Jt)) : pt("", !0);
|
|
742
744
|
}
|
|
743
|
-
const
|
|
745
|
+
const Zt = /* @__PURE__ */ j(Yt, [["render", Qt], ["__scopeId", "data-v-e7d22ab3"]]), te = [Wt, jt, Gt, Zt], le = {
|
|
744
746
|
install(t) {
|
|
745
|
-
|
|
747
|
+
te.forEach((e) => {
|
|
746
748
|
t.component("S" + e.name, e), t.component(e.name + "S", e);
|
|
747
749
|
});
|
|
748
750
|
}
|
|
749
751
|
};
|
|
750
752
|
export {
|
|
751
|
-
|
|
753
|
+
jt as Card,
|
|
752
754
|
Wt as Flyweight,
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
755
|
+
Gt as Stream,
|
|
756
|
+
Zt as Tips,
|
|
757
|
+
le as default
|
|
756
758
|
};
|