holyes-table 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -39,9 +39,24 @@
39
39
 
40
40
  ### 安装
41
41
 
42
- ```bash
43
- pnpm i holyes-table
44
- ```
42
+ 1. 安装组件
43
+
44
+ ```bash
45
+ pnpm i holyes-table
46
+ ```
47
+
48
+ 2. 引入样式
49
+
50
+ ```bash
51
+ import 'holyes-table/style.css'
52
+ ```
53
+
54
+ 3. 引入组件
55
+
56
+ ```bash
57
+ // main.ts
58
+ import HolyesTable from "holyes-table"
59
+ ```
45
60
 
46
61
  ### 简单示例
47
62
 
@@ -0,0 +1 @@
1
+ (function(){let e=e=>{let t=0;switch(!0){case!e:case typeof e!=`string`:return t;default:break}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r>=19968&&r<=40959||r>=12352&&r<=12543||r>=44032&&r<=55215?t+=2:t+=1}return t};self.onmessage=t=>{let{tempData:n,commonStyles:r,itemStyles:i,divLineHeight:a,cellMinHeight:o,keyNames:s,isNoAutoWrap:c,columns:l,treeConfig:u,defaultTreeConfig:d,prepare:f,layout:p}=t.data,m=0,h=[],g=new Map,_=e=>{e.slots?.default&&!e.slots?.defaultHeight&&(g.has(e.field)||(console.error(`表格设置了插槽,插槽高度defaultHeight不能为空,否则会导致高度计算错误`,e.field),g.set(e.field,1))),(e.slots.defaultType==`tag`||e.slots.defaultType==`buttons`)&&(e.slots.defaultHeight||(e.slots.defaultHeight=30))},v=u?.childrenField||d.childrenField,y=(t,n)=>{t[v]?.length&&t[v].forEach(e=>{y(e,n+1)});let g=o,b=[],x=0;if(c)for(let e of l)_(e),x=Math.max(x,e.slots?.defaultHeight||0),g=Math.max(g,a);else{for(let r of l){(r.slots?.default||r.slots?.defaultType)&&(_(r),x=Math.max(x,r.slots?.defaultHeight||0));let i=Math.max(r.minWidth||30,r.width||0),a=t[r.field]||``;r.treeNode&&u?.isOpenTree&&(u?.showIcon&&(a+=`图`),u?.indent&&(i-=(u?.indent||d.indent||20)*n));let o=e(a)/i;testLength:for(let e=0;e<3;e++)if((b[e]?.density||0)<o){b[e]={field:r.field,tempWidth:i,density:o,tempText:a};break testLength}}for(let e of b){let t=e.tempWidth,{height:n}=p(f(e.tempText,`${i.fontWeight} ${i.fontSize} ${r}`),t,a);g=Math.max(g,n)}}h.push({pretextHeight:Math.max(g,x)+1,id:t[s.id]}),n==0&&(m+=Math.max(g,x)+1)};for(let e of n)y(e,0);self.postMessage({tempItemHeights:m,heightDatas:h}),self.close()}})();