holyes-table 1.0.2 → 1.0.4

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.
@@ -0,0 +1,11 @@
1
+ import { HolyesTableGetItemHeightOptions } from '../type';
2
+ export declare function usePretextTableGetItemHeight(): {
3
+ /** 获取每一行的高度 */
4
+ pretextTableGetItemHeight: (obj: HolyesTableGetItemHeightOptions) => Promise<{
5
+ tempItemHeights: number;
6
+ heightDatas: {
7
+ pretextHeight: number;
8
+ id: string;
9
+ }[];
10
+ }>;
11
+ };
@@ -1,6 +1,15 @@
1
1
  import { PropType } from 'vue';
2
2
  import { HolyesTableTreeConfig, HolyesTableFooterProps, HolyesTableColumnPropsType, HolyesTableExpandConfig } from './type';
3
3
  declare const _default: __VLS_WithSlots<import('vue').DefineComponent<import('vue').ExtractPropTypes<{
4
+ /** 全局样式 */
5
+ commonStyles: {
6
+ type: PropType<{
7
+ /** 滚动条高度, 默认是20px, 若调整过滚动条的样式, 则需要设置这里;
8
+ * 否则可能导致数据量少时还会显示垂直滚动条 */
9
+ scrollbarHeight?: number;
10
+ }>;
11
+ default: () => {};
12
+ };
4
13
  /** 表格列属性 */
5
14
  columns: {
6
15
  type: PropType<HolyesTableColumnPropsType[]>;
@@ -106,6 +115,15 @@ declare const _default: __VLS_WithSlots<import('vue').DefineComponent<import('vu
106
115
  resizableChange: (...args: any[]) => void;
107
116
  toggleRowExpand: (...args: any[]) => void;
108
117
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
118
+ /** 全局样式 */
119
+ commonStyles: {
120
+ type: PropType<{
121
+ /** 滚动条高度, 默认是20px, 若调整过滚动条的样式, 则需要设置这里;
122
+ * 否则可能导致数据量少时还会显示垂直滚动条 */
123
+ scrollbarHeight?: number;
124
+ }>;
125
+ default: () => {};
126
+ };
109
127
  /** 表格列属性 */
110
128
  columns: {
111
129
  type: PropType<HolyesTableColumnPropsType[]>;
@@ -199,6 +217,11 @@ declare const _default: __VLS_WithSlots<import('vue').DefineComponent<import('vu
199
217
  columns: HolyesTableColumnPropsType[];
200
218
  treeConfig: HolyesTableTreeConfig;
201
219
  expandConfig: HolyesTableExpandConfig;
220
+ commonStyles: {
221
+ /** 滚动条高度, 默认是20px, 若调整过滚动条的样式, 则需要设置这里;
222
+ * 否则可能导致数据量少时还会显示垂直滚动条 */
223
+ scrollbarHeight?: number;
224
+ };
202
225
  cellMinHeight: number;
203
226
  loading: boolean;
204
227
  loadingConfig: {
@@ -271,9 +271,7 @@ export type HolyesTableGetItemHeightOptions = {
271
271
  /** 每行的最小高度 */
272
272
  cellMinHeight: number;
273
273
  /** 预处理文本 */
274
- prepare: any;
275
274
  /** 布局文本 */
276
- layout: any;
277
275
  /** 行id的字段 */
278
276
  keyNames: HolyesTableKeyNames;
279
277
  /** 是否不自动换行 */
@@ -57,7 +57,7 @@ export declare const useHolyesTable: (dataObj: {
57
57
  fixedColumnsLeft: import('vue').Ref<string[], string[]>;
58
58
  fixedColumnsRight: import('vue').Ref<string[], string[]>;
59
59
  getGridStyles: () => void;
60
- divLineHeightOffset: number;
60
+ divLineHeightOffset: any;
61
61
  currentRow: import('vue').ShallowRef<any, any>;
62
62
  cellClick: (item: any, column: HolyesTableColumnPropsType) => void;
63
63
  headerClick: (column: any) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "holyes-table",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "合力思虚拟滚动表格组件",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.mjs",
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "scripts": {
20
20
  "dev": "vite",
21
- "build": "vue-tsc --noEmit && vite build",
21
+ "build": "vite build",
22
22
  "prepublishOnly": "pnpm run build",
23
23
  "登录npm": "npm login --registry https://registry.npmjs.org",
24
24
  "发布npm": "npm publish --registry https://registry.npmjs.org",
@@ -1 +0,0 @@
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()}})();