@soei/flyweight 0.2.10 → 0.2.11
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 +1 -1
- package/README.md +3 -2
- package/package.json +1 -1
- package/vue2/index.cjs +1 -1
- package/vue2/index.js +1 -1
package/Flyweight.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@soei/util"),i=require("vue");let F=/(\d+|[+\-\*/]|%)/g,B={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t,s)=>parseFloat(e)/100*s},N=(e,t)=>{let s;if(s=h.runer("match",e,F)){let n=s.length,l,o=0,r,a=[];for(;n--;)o=s.shift(),o in B?(l&&a.push(l),o==="%"&&(a.length=2),r=o):+o&&a.push(+o),a.length==2&&(a.push(t),l=B[r].apply(null,a),a.length=0);+l||(l=+a.pop()),e=l>>0}return e},$=e=>(e+"").replace(/\w+\((.*)\)/g,"$1").replace(/(?=\s+|^)(\d+(\.\d+)*)(?!(?:\.)*\d|%|\w)/g,"$1px");const C=(e,t)=>{const s=e.__vccOpts||e;for(const[n,l]of t)s[n]=l;return s};let E=e=>e==null||e==null,A=(...e)=>{console.info("::::FLYWEIGHT",...e)};const I={name:"Flyweight",props:{flys:{type:Array,default:()=>[]},width:{type:Number,default:0},height:{type:Number,default:100},offset:{type:Array,default:()=>[0,0]},lazy:{type:Number,default:100},view:{type:Object,default:()=>({id:0})},index:{type:Number,default:0},top:{type:Number,default:!1},left:{type:Number,default:!1},auto:{type:[Boolean,String],default:!1},space:{type:Object,default:()=>null},padding:{type:Boolean,default:!1}},computed:{flyweight(){return this.$refs.flyweight||""}},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,s)=>{e[t]=s}),this.setindex(this.index);try{new ResizeObserver(()=>{this.rebuild(),this.$emit("resize")}).observe(this.flyweight)}catch(e){A(e)}this.scrollx=h.runer("hasAttribute",this.flyweight,"scroll-x"),this.BoxRule="clientHeight=>height,clientWidth=>width",this.direction=this.scrollx?"scrollLeft":"scrollTop"},methods:{exec:$,trigger(e,t){this.lazyrun(()=>{h.isArray(e)||(e=[[e,t]]),h.each(e,(s,n)=>{this.$emit(n[0],E(n[1])?!0:n[1])})})},cheackflys(e){if(!this.flys.length)return e&&this.task.push(e),!0},setview(e){h.runer([this.cheackflys,t=>{t=t||{};let s=t.index||h.each(this.flys,(n,l,o,r)=>{if(l[o]==r)return n},t.picker,t.id);E(s)||this.setindex(s)}],this,e)},setindex(e){h.runer([this.cheackflys,({index:t})=>{this.selectIndex=t,this.$nextTick(()=>{let s=t/this.column>>0,n=this.expand;(this.flyweight[this.direction]/n>>0)+this.row-s-1>0||(this.flyweight[this.direction]=s*n,this.scroll())})}],this,{index:e})},lazyrun(e,t){clearTimeout(this.time),this.time=setTimeout(()=>{h.runer(e)},t||this.lazy)},run(e){let t=[],s=h.runer(this.direction,e.target),n={offset:s,top:s,width:this.realW,height:this.realH,index:s/this.expand>>0};h.merge(n,this.space),e.from||t.push(["onscroll",n]);let l=!1;h.each(this.flyweights,(o,r,a,u,f,d,p,g,c)=>{if(a=o/f>>0,g=a+u*(+(a<d%u)+(d/u>>0)),c=g*f+o%f,c>=this.count){l||(t.push(["onend"]),l=!0);return}r.index=g,r.i=c,r.data=this.flys[c];let y=[g*this.expand+r.x,r.space];p&&y.reverse(),r.top=y[0],r.left=y[1]},null,this.row,this.column,n.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 s=this.scrollx,n=this.flyweight,l=h.picker(n,this.BoxRule);this.$nextTick(()=>{let o=/true/.test(this.auto),[r,a]=this.offset,u=l.width,f=l.height,d=(N(this.width,u)||u)+r,p=N(this.height,f)+a,g=[u/d>>0||1,f/p>>0||1];s&&g.reverse();let[c,y]=g,_=this.padding,S,k=0,m,b;s?(m=d,d-=r,b=w=>w*(p-a)+(w+1)*a):(o?(d=(u-r*(c+2*_-1))/c,S=!_*r,k=_*r):(S=0,k=(u%d+r*c)/(c+1)>>0,d-=r),b=w=>w*(d+S)+(w+1)*k,m=p),this.row=y+2,this.column=c,this.realH=p-a,this.realW=d,this.expand=m,this.Size=Math.ceil(e/c)*m;let v=Math.min(e,c*this.row),x=v-1,z;for(;v-- >0;)z=x-v,this.$set(t,z,{x:r,y:a,width:d,height:p-a,space:b(z%c),data:{}});t.length=x+1;let T=[];f/m>x/c&&T.push(["onend"]),this.flyweight&&(this.flyweight[this.direction]=0),this.$nextTick(()=>{this.setindex(this.selectIndex||0),this.scroll()}),T.push(["update:space",{row:(x/c>>0)+1,column:c,showrow:this.row,showcolumn:this.column}]),this.trigger(T)})}}},R={class:"flyweight-all"};function V(e,t,s,n,l,o){return i.openBlock(),i.createElementBlock("div",{ref:"flyweight",class:i.normalizeClass(["flyweight",{"flyweight-active":l.actice}]),style:i.normalizeStyle({"--width":o.exec(l.realW),"--height":o.exec(l.realH),"--flyweight-content":o.exec(l.Size)}),onScroll:t[0]||(t[0]=(...r)=>o.scroll&&o.scroll(...r))},[i.createElementVNode("div",R,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.flyweights,(r,a)=>(i.openBlock(),i.createElementBlock("div",{key:a,style:i.normalizeStyle({top:r.top+"px",left:r.left+"px"})},[i.renderSlot(e.$slots,"default",i.mergeProps({ref_for:!0},r),void 0,!0)],4))),128))]),l.flyweights.length?i.renderSlot(e.$slots,"end",{key:0},void 0,!0):i.createCommentVNode("",!0)],38)}const H=C(I,[["render",V],["__scopeId","data-v-8f29f044"]]);const W={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:{},style:{},default:{top:"0px",right:"0px",bottom:"0px",left:"0px",height:"100%",width:"100%",background:"",border:"1px"}}},computed:{style(){let e={};return this.margin(this.offset),h.each(["BackGround","BordeR","Height","Width","Top","Right","Bottom","Left"],(t,s)=>{this.css(e,s)}),e}},watch:{close:{handler(e){this.change(e)},deep:!0},offset:{handler(e){this.margin(e)},deep:!0}},methods:{exec:$,isEmpty:h.isEmpty,isSimplyType:h.isSimplyType,tolower(e,t){return t&&(e=e.replace(/[a-z]/g,"")),e.toLowerCase()},css(e,t){let s=this.tolower(t),n=this[s]||this.default[s];!n||this.default[s]==n||(e["--"+this.tolower(t,!0)]=$(n))},change(e){h.isSimplyType(e)||(this.closecss=h.picker(e,"color=>--s-card-close-color,*"))},margin(e){h.merge(this,h.picker(h.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)}},j={class:"card-title"},M={class:"card-content"};function q(e,t,s,n,l,o){return i.openBlock(),i.createElementBlock("div",{class:"card",style:i.normalizeStyle(o.style)},[i.renderSlot(e.$slots,"default",{},()=>[i.renderSlot(e.$slots,"title",{},()=>[i.createElementVNode("div",j,[i.createTextVNode(i.toDisplayString(s.show||s.title)+" ",1),i.createElementVNode("div",{class:i.normalizeClass(["card-close",{hide:o.isSimplyType(s.close)?!s.close:!1}]),style:i.normalizeStyle(l.closecss),onClick:t[0]||(t[0]=r=>e.$emit("close"))},null,6)])],!0),i.renderSlot(e.$slots,"content",{},()=>[i.createElementVNode("div",M,[i.renderSlot(e.$slots,"inner",{},void 0,!0)])],!0)],!0)],4)}const L=C(W,[["render",q],["__scopeId","data-v-def66c95"]]),O={name:"Stream",props:{type:{type:String,default:"div"},data:{type:Array,default:()=>
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@soei/util"),i=require("vue");let F=/(\d+|[+\-\*/]|%)/g,B={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t,s)=>parseFloat(e)/100*s},N=(e,t)=>{let s;if(s=h.runer("match",e,F)){let n=s.length,l,o=0,r,a=[];for(;n--;)o=s.shift(),o in B?(l&&a.push(l),o==="%"&&(a.length=2),r=o):+o&&a.push(+o),a.length==2&&(a.push(t),l=B[r].apply(null,a),a.length=0);+l||(l=+a.pop()),e=l>>0}return e},$=e=>(e+"").replace(/\w+\((.*)\)/g,"$1").replace(/(?=\s+|^)(\d+(\.\d+)*)(?!(?:\.)*\d|%|\w)/g,"$1px");const C=(e,t)=>{const s=e.__vccOpts||e;for(const[n,l]of t)s[n]=l;return s};let E=e=>e==null||e==null,A=(...e)=>{console.info("::::FLYWEIGHT",...e)};const I={name:"Flyweight",props:{flys:{type:Array,default:()=>[]},width:{type:Number,default:0},height:{type:Number,default:100},offset:{type:Array,default:()=>[0,0]},lazy:{type:Number,default:100},view:{type:Object,default:()=>({id:0})},index:{type:Number,default:0},top:{type:Number,default:!1},left:{type:Number,default:!1},auto:{type:[Boolean,String],default:!1},space:{type:Object,default:()=>null},padding:{type:Boolean,default:!1}},computed:{flyweight(){return this.$refs.flyweight||""}},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,s)=>{e[t]=s}),this.setindex(this.index);try{new ResizeObserver(()=>{this.rebuild(),this.$emit("resize")}).observe(this.flyweight)}catch(e){A(e)}this.scrollx=h.runer("hasAttribute",this.flyweight,"scroll-x"),this.BoxRule="clientHeight=>height,clientWidth=>width",this.direction=this.scrollx?"scrollLeft":"scrollTop"},methods:{exec:$,trigger(e,t){this.lazyrun(()=>{h.isArray(e)||(e=[[e,t]]),h.each(e,(s,n)=>{this.$emit(n[0],E(n[1])?!0:n[1])})})},cheackflys(e){if(!this.flys.length)return e&&this.task.push(e),!0},setview(e){h.runer([this.cheackflys,t=>{t=t||{};let s=t.index||h.each(this.flys,(n,l,o,r)=>{if(l[o]==r)return n},t.picker,t.id);E(s)||this.setindex(s)}],this,e)},setindex(e){h.runer([this.cheackflys,({index:t})=>{this.selectIndex=t,this.$nextTick(()=>{let s=t/this.column>>0,n=this.expand;(this.flyweight[this.direction]/n>>0)+this.row-s-1>0||(this.flyweight[this.direction]=s*n,this.scroll())})}],this,{index:e})},lazyrun(e,t){clearTimeout(this.time),this.time=setTimeout(()=>{h.runer(e)},t||this.lazy)},run(e){let t=[],s=h.runer(this.direction,e.target),n={offset:s,top:s,width:this.realW,height:this.realH,index:s/this.expand>>0};h.merge(n,this.space),e.from||t.push(["onscroll",n]);let l=!1;h.each(this.flyweights,(o,r,a,u,f,d,p,g,c)=>{if(a=o/f>>0,g=a+u*(+(a<d%u)+(d/u>>0)),c=g*f+o%f,c>=this.count){l||(t.push(["onend"]),l=!0);return}r.index=g,r.i=c,r.data=this.flys[c];let y=[g*this.expand+r.x,r.space];p&&y.reverse(),r.top=y[0],r.left=y[1]},null,this.row,this.column,n.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 s=this.scrollx,n=this.flyweight,l=h.picker(n,this.BoxRule);this.$nextTick(()=>{let o=/true/.test(this.auto),[r,a]=this.offset,u=l.width,f=l.height,d=(N(this.width,u)||u)+r,p=N(this.height,f)+a,g=[u/d>>0||1,f/p>>0||1];s&&g.reverse();let[c,y]=g,_=this.padding,S,k=0,m,b;s?(m=d,d-=r,b=w=>w*(p-a)+(w+1)*a):(o?(d=(u-r*(c+2*_-1))/c,S=!_*r,k=_*r):(S=0,k=(u%d+r*c)/(c+1)>>0,d-=r),b=w=>w*(d+S)+(w+1)*k,m=p),this.row=y+2,this.column=c,this.realH=p-a,this.realW=d,this.expand=m,this.Size=Math.ceil(e/c)*m;let v=Math.min(e,c*this.row),x=v-1,z;for(;v-- >0;)z=x-v,this.$set(t,z,{x:r,y:a,width:d,height:p-a,space:b(z%c),data:{}});t.length=x+1;let T=[];f/m>x/c&&T.push(["onend"]),this.flyweight&&(this.flyweight[this.direction]=0),this.$nextTick(()=>{this.setindex(this.selectIndex||0),this.scroll()}),T.push(["update:space",{row:(x/c>>0)+1,column:c,showrow:this.row,showcolumn:this.column}]),this.trigger(T)})}}},R={class:"flyweight-all"};function V(e,t,s,n,l,o){return i.openBlock(),i.createElementBlock("div",{ref:"flyweight",class:i.normalizeClass(["flyweight",{"flyweight-active":l.actice}]),style:i.normalizeStyle({"--width":o.exec(l.realW),"--height":o.exec(l.realH),"--flyweight-content":o.exec(l.Size)}),onScroll:t[0]||(t[0]=(...r)=>o.scroll&&o.scroll(...r))},[i.createElementVNode("div",R,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.flyweights,(r,a)=>(i.openBlock(),i.createElementBlock("div",{key:a,style:i.normalizeStyle({top:r.top+"px",left:r.left+"px"})},[i.renderSlot(e.$slots,"default",i.mergeProps({ref_for:!0},r),void 0,!0)],4))),128))]),l.flyweights.length?i.renderSlot(e.$slots,"end",{key:0},void 0,!0):i.createCommentVNode("",!0)],38)}const H=C(I,[["render",V],["__scopeId","data-v-8f29f044"]]);const W={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:{},style:{},default:{top:"0px",right:"0px",bottom:"0px",left:"0px",height:"100%",width:"100%",background:"",border:"1px"}}},computed:{style(){let e={};return this.margin(this.offset),h.each(["BackGround","BordeR","Height","Width","Top","Right","Bottom","Left"],(t,s)=>{this.css(e,s)}),e}},watch:{close:{handler(e){this.change(e)},deep:!0},offset:{handler(e){this.margin(e)},deep:!0}},methods:{exec:$,isEmpty:h.isEmpty,isSimplyType:h.isSimplyType,tolower(e,t){return t&&(e=e.replace(/[a-z]/g,"")),e.toLowerCase()},css(e,t){let s=this.tolower(t),n=this[s]||this.default[s];!n||this.default[s]==n||(e["--"+this.tolower(t,!0)]=$(n))},change(e){h.isSimplyType(e)||(this.closecss=h.picker(e,"color=>--s-card-close-color,*"))},margin(e){h.merge(this,h.picker(h.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)}},j={class:"card-title"},M={class:"card-content"};function q(e,t,s,n,l,o){return i.openBlock(),i.createElementBlock("div",{class:"card",style:i.normalizeStyle(o.style)},[i.renderSlot(e.$slots,"default",{},()=>[i.renderSlot(e.$slots,"title",{},()=>[i.createElementVNode("div",j,[i.createTextVNode(i.toDisplayString(s.show||s.title)+" ",1),i.createElementVNode("div",{class:i.normalizeClass(["card-close",{hide:o.isSimplyType(s.close)?!s.close:!1}]),style:i.normalizeStyle(l.closecss),onClick:t[0]||(t[0]=r=>e.$emit("close"))},null,6)])],!0),i.renderSlot(e.$slots,"content",{},()=>[i.createElementVNode("div",M,[i.renderSlot(e.$slots,"inner",{},void 0,!0)])],!0)],!0)],4)}const L=C(W,[["render",q],["__scopeId","data-v-def66c95"]]),O={name:"Stream",props:{type:{type:String,default:"div"},data:{type:Array,default:()=>[]},T:{type:Array,default:()=>[]}},render(e){return e(this.type,{props:{data:this.data}},this._l(this.T,(t,s)=>{let n=h.picker(t,"slot|name|type=>name").name,l=h.picker(this,h.format("$scopedSlots.?|$slots.?|$scopedSlots.default=>?",n));return h.merge(t,{index:s}),h.runer(n,l,t)}))}},G=[H,L,O],P={install(e){G.forEach(t=>{e.component("S"+t.name,t),e.component(t.name+"S",t)})}};exports.Card=L;exports.Flyweight=H;exports.Stream=O;exports.default=P;
|
package/Flyweight.js
CHANGED
package/README.md
CHANGED
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
<Stream
|
|
70
70
|
class="form"
|
|
71
71
|
:T="[
|
|
72
|
+
/* slot|name|type=>name 插槽名称 */
|
|
72
73
|
{ type: 'name', label: '输入框' },
|
|
73
74
|
{ type: 'state', label: '选择任务', data: [{label, value}, ...] },
|
|
74
75
|
{ type: 'state', label: '选择事件', data: [{label, value}, ...] },
|
|
@@ -87,11 +88,11 @@
|
|
|
87
88
|
</el-select>
|
|
88
89
|
</div>
|
|
89
90
|
</template>
|
|
90
|
-
<template #default="{
|
|
91
|
+
<template #default="{ type, label, index }">
|
|
91
92
|
<div class="form_item">
|
|
92
93
|
<el-input
|
|
93
94
|
size="mini"
|
|
94
|
-
v-model="search[
|
|
95
|
+
v-model="search[type]"
|
|
95
96
|
:placeholder="label"
|
|
96
97
|
></el-input>
|
|
97
98
|
</div>
|
package/package.json
CHANGED
package/vue2/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("@soei/util");let B=/(\d+|[+\-\*/]|%)/g,z={"+":(t,e)=>t+e,"-":(t,e)=>t-e,"*":(t,e)=>t*e,"/":(t,e)=>t/e,"%":(t,e,s)=>parseFloat(t)/100*s},R=(t,e)=>{let s;if(s=r.runer("match",t,B)){let i=s.length,l,c=0,n,o=[];for(;i--;)c=s.shift(),c in z?(l&&o.push(l),c==="%"&&(o.length=2),n=c):+c&&o.push(+c),o.length==2&&(o.push(e),l=z[n].apply(null,o),o.length=0);+l||(l=+o.pop()),t=l>>0}return t},T=t=>(t+"").replace(/\w+\((.*)\)/g,"$1").replace(/(?=\s+|^)(\d+(\.\d+)*)(?!(?:\.)*\d|%|\w)/g,"$1px");function C(t,e,s,i,l,c,n,o){var h=typeof t=="function"?t.options:t;e&&(h.render=e,h.staticRenderFns=s,h._compiled=!0),i&&(h.functional=!0),c&&(h._scopeId="data-v-"+c);var f;if(n?(f=function(u){u=u||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!u&&typeof __VUE_SSR_CONTEXT__<"u"&&(u=__VUE_SSR_CONTEXT__),l&&l.call(this,u),u&&u._registeredComponents&&u._registeredComponents.add(n)},h._ssrRegister=f):l&&(f=o?function(){l.call(this,(h.functional?this.parent:this).$root.$options.shadowRoot)}:l),f)if(h.functional){h._injectStyles=f;var d=h.render;h.render=function(a,g){return f.call(g),d(a,g)}}else{var p=h.beforeCreate;h.beforeCreate=p?[].concat(p,f):[f]}return{exports:t,options:h}}let F=t=>t==null||t==null,L=(...t)=>{console.info("::::FLYWEIGHT",...t)};const W={name:"Flyweight",props:{flys:{type:Array,default:()=>[]},width:{type:Number,default:0},height:{type:Number,default:100},offset:{type:Array,default:()=>[0,0]},lazy:{type:Number,default:100},view:{type:Object,default:()=>({id:0})},index:{type:Number,default:0},top:{type:Number,default:!1},left:{type:Number,default:!1},auto:{type:[Boolean,String],default:!1},space:{type:Object,default:()=>null},padding:{type:Boolean,default:!1}},computed:{flyweight(){return this.$refs.flyweight||""}},data(){return{flyweights:[],actice:!1,Size:null,column:1,row:1,expand:10,count:0,task:[],realW:0,realH:0}},watch:{flys(t){this.count=t.length,this.rebuild();let e=this.task.shift();e&&this.$nextTick(()=>{this.setview(e)})},view:{handler(t){this.setview(t)},immediate:!0,deep:!0},index(t){this.setindex(t)},top(t){this.flyweight.scrollTop=t},left(t){this.flyweight.scrollLeft=t}},mounted(){this.flyweights=[],this.$set||(this.$set=(t,e,s)=>{t[e]=s}),this.setindex(this.index);try{new ResizeObserver(()=>{this.rebuild(),this.$emit("resize")}).observe(this.flyweight)}catch(t){L(t)}this.scrollx=r.runer("hasAttribute",this.flyweight,"scroll-x"),this.BoxRule="clientHeight=>height,clientWidth=>width",this.direction=this.scrollx?"scrollLeft":"scrollTop"},methods:{exec:T,trigger(t,e){this.lazyrun(()=>{r.isArray(t)||(t=[[t,e]]),r.each(t,(s,i)=>{this.$emit(i[0],F(i[1])?!0:i[1])})})},cheackflys(t){if(!this.flys.length)return t&&this.task.push(t),!0},setview(t){r.runer([this.cheackflys,e=>{e=e||{};let s=e.index||r.each(this.flys,(i,l,c,n)=>{if(l[c]==n)return i},e.picker,e.id);F(s)||this.setindex(s)}],this,t)},setindex(t){r.runer([this.cheackflys,({index:e})=>{this.selectIndex=e,this.$nextTick(()=>{let s=e/this.column>>0,i=this.expand;(this.flyweight[this.direction]/i>>0)+this.row-s-1>0||(this.flyweight[this.direction]=s*i,this.scroll())})}],this,{index:t})},lazyrun(t,e){clearTimeout(this.time),this.time=setTimeout(()=>{r.runer(t)},e||this.lazy)},run(t){let e=[],s=r.runer(this.direction,t.target),i={offset:s,top:s,width:this.realW,height:this.realH,index:s/this.expand>>0};r.merge(i,this.space),t.from||e.push(["onscroll",i]);let l=!1;r.each(this.flyweights,(c,n,o,h,f,d,p,u,a)=>{if(o=c/f>>0,u=o+h*(+(o<d%h)+(d/h>>0)),a=u*f+c%f,a>=this.count){l||(e.push(["onend"]),l=!0);return}n.index=u,n.i=a,n.data=this.flys[a];let g=[u*this.expand+n.x,n.space];p&&g.reverse(),n.top=g[0],n.left=g[1]},null,this.row,this.column,i.index,this.scrollx),this.trigger(e),e=null},scroll(t){this.run(t||{target:this.flyweight,from:"space"})},rebuild(){let t=this.count||this.flys.length,e=this.flyweights;if(!t)return e.length=t;this.count=t;let s=this.scrollx,i=this.flyweight,l=r.picker(i,this.BoxRule);this.$nextTick(()=>{let c=/true/.test(this.auto),[n,o]=this.offset,h=l.width,f=l.height,d=(R(this.width,h)||h)+n,p=R(this.height,f)+o,u=[h/d>>0||1,f/p>>0||1];s&&u.reverse();let[a,g]=u,w=this.padding,x,v=0,y,$;s?(y=d,d-=n,$=_=>_*(p-o)+(_+1)*o):(c?(d=(h-n*(a+2*w-1))/a,x=!w*n,v=w*n):(x=0,v=(h%d+n*a)/(a+1)>>0,d-=n),$=_=>_*(d+x)+(_+1)*v,y=p),this.row=g+2,this.column=a,this.realH=p-o,this.realW=d,this.expand=y,this.Size=Math.ceil(t/a)*y;let b=Math.min(t,a*this.row),m=b-1,S;for(;b-- >0;)S=m-b,this.$set(e,S,{x:n,y:o,width:d,height:p-o,space:$(S%a),data:{}});e.length=m+1;let k=[];f/y>m/a&&k.push(["onend"]),this.flyweight&&(this.flyweight[this.direction]=0),this.$nextTick(()=>{this.setindex(this.selectIndex||0),this.scroll()}),k.push(["update:space",{row:(m/a>>0)+1,column:a,showrow:this.row,showcolumn:this.column}]),this.trigger(k)})}}};var A=function(){var e=this,s=e._self._c;return s("div",{ref:"flyweight",staticClass:"flyweight",class:{"flyweight-active":e.actice},style:{"--width":e.exec(e.realW),"--height":e.exec(e.realH),"--flyweight-content":e.exec(e.Size)},on:{scroll:e.scroll}},[s("div",{staticClass:"flyweight-all"},e._l(e.flyweights,function(i,l){return s("div",{key:l,style:{top:i.top+"px",left:i.left+"px"}},[e._t("default",null,null,i)],2)}),0),e.flyweights.length?e._t("end"):e._e()],2)},E=[],I=C(W,A,E,!1,null,"05373fe1",null,null);const N=I.exports;const M={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:{},style:{},default:{top:"0px",right:"0px",bottom:"0px",left:"0px",height:"100%",width:"100%",background:"",border:"1px"}}},computed:{style(){let t={};return this.margin(this.offset),r.each(["BackGround","BordeR","Height","Width","Top","Right","Bottom","Left"],(e,s)=>{this.css(t,s)}),t}},watch:{close:{handler(t){this.change(t)},deep:!0},offset:{handler(t){this.margin(t)},deep:!0}},methods:{exec:T,isEmpty:r.isEmpty,isSimplyType:r.isSimplyType,tolower(t,e){return e&&(t=t.replace(/[a-z]/g,"")),t.toLowerCase()},css(t,e){let s=this.tolower(e),i=this[s]||this.default[s];!i||this.default[s]==i||(t["--"+this.tolower(e,!0)]=T(i))},change(t){r.isSimplyType(t)||(this.closecss=r.picker(t,"color=>--s-card-close-color,*"))},margin(t){r.merge(this,r.picker(r.isString(t)?t.split(/\s*(?:,|\s+)\s*/):t,"0=>top,1|0=>right,2|0=>bottom,3|1|0=>left",!0),!0)}},mounted(){this.change(this.close)}};var U=function(){var e=this,s=e._self._c;return s("div",{staticClass:"card",style:e.style},[e._t("default",function(){return[e._t("title",function(){return[s("div",{staticClass:"card-title"},[e._v(" "+e._s(e.show||e.title)+" "),s("div",{staticClass:"card-close",class:{hide:e.isSimplyType(e.close)?!e.close:!1},style:e.closecss,on:{click:function(i){return e.$emit("close")}}})])]}),e._t("content",function(){return[s("div",{staticClass:"card-content"},[e._t("inner")],2)]})]})],2)},X=[],j=C(M,U,X,!1,null,"b762d0c1",null,null);const O=j.exports,G={name:"Stream",props:{type:{type:String,default:"div"},data:{type:Array,default:()=>
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("@soei/util");let B=/(\d+|[+\-\*/]|%)/g,z={"+":(t,e)=>t+e,"-":(t,e)=>t-e,"*":(t,e)=>t*e,"/":(t,e)=>t/e,"%":(t,e,s)=>parseFloat(t)/100*s},R=(t,e)=>{let s;if(s=r.runer("match",t,B)){let i=s.length,l,c=0,n,o=[];for(;i--;)c=s.shift(),c in z?(l&&o.push(l),c==="%"&&(o.length=2),n=c):+c&&o.push(+c),o.length==2&&(o.push(e),l=z[n].apply(null,o),o.length=0);+l||(l=+o.pop()),t=l>>0}return t},T=t=>(t+"").replace(/\w+\((.*)\)/g,"$1").replace(/(?=\s+|^)(\d+(\.\d+)*)(?!(?:\.)*\d|%|\w)/g,"$1px");function C(t,e,s,i,l,c,n,o){var h=typeof t=="function"?t.options:t;e&&(h.render=e,h.staticRenderFns=s,h._compiled=!0),i&&(h.functional=!0),c&&(h._scopeId="data-v-"+c);var f;if(n?(f=function(u){u=u||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!u&&typeof __VUE_SSR_CONTEXT__<"u"&&(u=__VUE_SSR_CONTEXT__),l&&l.call(this,u),u&&u._registeredComponents&&u._registeredComponents.add(n)},h._ssrRegister=f):l&&(f=o?function(){l.call(this,(h.functional?this.parent:this).$root.$options.shadowRoot)}:l),f)if(h.functional){h._injectStyles=f;var d=h.render;h.render=function(a,g){return f.call(g),d(a,g)}}else{var p=h.beforeCreate;h.beforeCreate=p?[].concat(p,f):[f]}return{exports:t,options:h}}let F=t=>t==null||t==null,L=(...t)=>{console.info("::::FLYWEIGHT",...t)};const W={name:"Flyweight",props:{flys:{type:Array,default:()=>[]},width:{type:Number,default:0},height:{type:Number,default:100},offset:{type:Array,default:()=>[0,0]},lazy:{type:Number,default:100},view:{type:Object,default:()=>({id:0})},index:{type:Number,default:0},top:{type:Number,default:!1},left:{type:Number,default:!1},auto:{type:[Boolean,String],default:!1},space:{type:Object,default:()=>null},padding:{type:Boolean,default:!1}},computed:{flyweight(){return this.$refs.flyweight||""}},data(){return{flyweights:[],actice:!1,Size:null,column:1,row:1,expand:10,count:0,task:[],realW:0,realH:0}},watch:{flys(t){this.count=t.length,this.rebuild();let e=this.task.shift();e&&this.$nextTick(()=>{this.setview(e)})},view:{handler(t){this.setview(t)},immediate:!0,deep:!0},index(t){this.setindex(t)},top(t){this.flyweight.scrollTop=t},left(t){this.flyweight.scrollLeft=t}},mounted(){this.flyweights=[],this.$set||(this.$set=(t,e,s)=>{t[e]=s}),this.setindex(this.index);try{new ResizeObserver(()=>{this.rebuild(),this.$emit("resize")}).observe(this.flyweight)}catch(t){L(t)}this.scrollx=r.runer("hasAttribute",this.flyweight,"scroll-x"),this.BoxRule="clientHeight=>height,clientWidth=>width",this.direction=this.scrollx?"scrollLeft":"scrollTop"},methods:{exec:T,trigger(t,e){this.lazyrun(()=>{r.isArray(t)||(t=[[t,e]]),r.each(t,(s,i)=>{this.$emit(i[0],F(i[1])?!0:i[1])})})},cheackflys(t){if(!this.flys.length)return t&&this.task.push(t),!0},setview(t){r.runer([this.cheackflys,e=>{e=e||{};let s=e.index||r.each(this.flys,(i,l,c,n)=>{if(l[c]==n)return i},e.picker,e.id);F(s)||this.setindex(s)}],this,t)},setindex(t){r.runer([this.cheackflys,({index:e})=>{this.selectIndex=e,this.$nextTick(()=>{let s=e/this.column>>0,i=this.expand;(this.flyweight[this.direction]/i>>0)+this.row-s-1>0||(this.flyweight[this.direction]=s*i,this.scroll())})}],this,{index:t})},lazyrun(t,e){clearTimeout(this.time),this.time=setTimeout(()=>{r.runer(t)},e||this.lazy)},run(t){let e=[],s=r.runer(this.direction,t.target),i={offset:s,top:s,width:this.realW,height:this.realH,index:s/this.expand>>0};r.merge(i,this.space),t.from||e.push(["onscroll",i]);let l=!1;r.each(this.flyweights,(c,n,o,h,f,d,p,u,a)=>{if(o=c/f>>0,u=o+h*(+(o<d%h)+(d/h>>0)),a=u*f+c%f,a>=this.count){l||(e.push(["onend"]),l=!0);return}n.index=u,n.i=a,n.data=this.flys[a];let g=[u*this.expand+n.x,n.space];p&&g.reverse(),n.top=g[0],n.left=g[1]},null,this.row,this.column,i.index,this.scrollx),this.trigger(e),e=null},scroll(t){this.run(t||{target:this.flyweight,from:"space"})},rebuild(){let t=this.count||this.flys.length,e=this.flyweights;if(!t)return e.length=t;this.count=t;let s=this.scrollx,i=this.flyweight,l=r.picker(i,this.BoxRule);this.$nextTick(()=>{let c=/true/.test(this.auto),[n,o]=this.offset,h=l.width,f=l.height,d=(R(this.width,h)||h)+n,p=R(this.height,f)+o,u=[h/d>>0||1,f/p>>0||1];s&&u.reverse();let[a,g]=u,w=this.padding,x,v=0,y,$;s?(y=d,d-=n,$=_=>_*(p-o)+(_+1)*o):(c?(d=(h-n*(a+2*w-1))/a,x=!w*n,v=w*n):(x=0,v=(h%d+n*a)/(a+1)>>0,d-=n),$=_=>_*(d+x)+(_+1)*v,y=p),this.row=g+2,this.column=a,this.realH=p-o,this.realW=d,this.expand=y,this.Size=Math.ceil(t/a)*y;let b=Math.min(t,a*this.row),m=b-1,S;for(;b-- >0;)S=m-b,this.$set(e,S,{x:n,y:o,width:d,height:p-o,space:$(S%a),data:{}});e.length=m+1;let k=[];f/y>m/a&&k.push(["onend"]),this.flyweight&&(this.flyweight[this.direction]=0),this.$nextTick(()=>{this.setindex(this.selectIndex||0),this.scroll()}),k.push(["update:space",{row:(m/a>>0)+1,column:a,showrow:this.row,showcolumn:this.column}]),this.trigger(k)})}}};var A=function(){var e=this,s=e._self._c;return s("div",{ref:"flyweight",staticClass:"flyweight",class:{"flyweight-active":e.actice},style:{"--width":e.exec(e.realW),"--height":e.exec(e.realH),"--flyweight-content":e.exec(e.Size)},on:{scroll:e.scroll}},[s("div",{staticClass:"flyweight-all"},e._l(e.flyweights,function(i,l){return s("div",{key:l,style:{top:i.top+"px",left:i.left+"px"}},[e._t("default",null,null,i)],2)}),0),e.flyweights.length?e._t("end"):e._e()],2)},E=[],I=C(W,A,E,!1,null,"05373fe1",null,null);const N=I.exports;const M={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:{},style:{},default:{top:"0px",right:"0px",bottom:"0px",left:"0px",height:"100%",width:"100%",background:"",border:"1px"}}},computed:{style(){let t={};return this.margin(this.offset),r.each(["BackGround","BordeR","Height","Width","Top","Right","Bottom","Left"],(e,s)=>{this.css(t,s)}),t}},watch:{close:{handler(t){this.change(t)},deep:!0},offset:{handler(t){this.margin(t)},deep:!0}},methods:{exec:T,isEmpty:r.isEmpty,isSimplyType:r.isSimplyType,tolower(t,e){return e&&(t=t.replace(/[a-z]/g,"")),t.toLowerCase()},css(t,e){let s=this.tolower(e),i=this[s]||this.default[s];!i||this.default[s]==i||(t["--"+this.tolower(e,!0)]=T(i))},change(t){r.isSimplyType(t)||(this.closecss=r.picker(t,"color=>--s-card-close-color,*"))},margin(t){r.merge(this,r.picker(r.isString(t)?t.split(/\s*(?:,|\s+)\s*/):t,"0=>top,1|0=>right,2|0=>bottom,3|1|0=>left",!0),!0)}},mounted(){this.change(this.close)}};var U=function(){var e=this,s=e._self._c;return s("div",{staticClass:"card",style:e.style},[e._t("default",function(){return[e._t("title",function(){return[s("div",{staticClass:"card-title"},[e._v(" "+e._s(e.show||e.title)+" "),s("div",{staticClass:"card-close",class:{hide:e.isSimplyType(e.close)?!e.close:!1},style:e.closecss,on:{click:function(i){return e.$emit("close")}}})])]}),e._t("content",function(){return[s("div",{staticClass:"card-content"},[e._t("inner")],2)]})]})],2)},X=[],j=C(M,U,X,!1,null,"b762d0c1",null,null);const O=j.exports,G={name:"Stream",props:{type:{type:String,default:"div"},data:{type:Array,default:()=>[]},T:{type:Array,default:()=>[]}},render(t){return t(this.type,{props:{data:this.data}},this._l(this.T,(e,s)=>{let i=r.picker(e,"slot|name|type=>name").name,l=r.picker(this,r.format("$scopedSlots.?|$slots.?|$scopedSlots.default=>?",i));return r.merge(e,{index:s}),r.runer(i,l,e)}))}},V=null,q=null;var P=C(G,V,q,!1,null,null,null,null);const H=P.exports,Y=[N,O,H],D={install(t){Y.forEach(e=>{t.component("S"+e.name,e),t.component(e.name+"S",e)})}};exports.Card=O;exports.Flyweight=N;exports.Stream=H;exports.default=D;
|