vxe-table 4.13.15 → 4.13.17
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 +2 -0
- package/es/style.css +1 -1
- package/es/table/src/table.js +8 -10
- package/es/ui/index.js +3 -3
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +8 -7
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/table.js +4 -3
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +3 -3
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +1 -1
- package/packages/table/src/table.ts +9 -9
- package/packages/ui/index.ts +2 -2
- /package/es/{iconfont.1745889641364.ttf → iconfont.1746324623861.ttf} +0 -0
- /package/es/{iconfont.1745889641364.woff → iconfont.1746324623861.woff} +0 -0
- /package/es/{iconfont.1745889641364.woff2 → iconfont.1746324623861.woff2} +0 -0
- /package/lib/{iconfont.1745889641364.ttf → iconfont.1746324623861.ttf} +0 -0
- /package/lib/{iconfont.1745889641364.woff → iconfont.1746324623861.woff} +0 -0
- /package/lib/{iconfont.1745889641364.woff2 → iconfont.1746324623861.woff2} +0 -0
package/lib/table/src/table.js
CHANGED
|
@@ -95,7 +95,8 @@ if(hasCustomSort){collectColumn=_xeUtils.default.orderBy(collectColumn,'renderSo
|
|
|
95
95
|
*/const restoreCustomStorage=()=>{const{customConfig}=props;const tableId=computeTableId.value;const customOpts=computeCustomOpts.value;const{storage,restoreStore}=customOpts;const isAllCustom=storage===true;const storageOpts=isAllCustom?{}:Object.assign({},storage||{});const isCustomResizable=isAllCustom||storageOpts.resizable;const isCustomVisible=isAllCustom||storageOpts.visible;const isCustomFixed=isAllCustom||storageOpts.fixed;const isCustomSort=isAllCustom||storageOpts.sort;if((customConfig?(0,_utils.isEnableConf)(customOpts):customOpts.enabled)&&(isCustomResizable||isCustomVisible||isCustomFixed||isCustomSort)){if(!tableId){(0,_log.errLog)('vxe.error.reqProp',['id']);return;}const storeData=getCustomStorageMap(tableId);if(restoreStore){return Promise.resolve(restoreStore({$table:$xeTable,id:tableId,type:'restore',storeData})).then(storeData=>{if(!storeData){return;}return handleCustomRestore(storeData);}).catch(e=>e);}else{return handleCustomRestore(storeData);}}};/**
|
|
96
96
|
* 更新数据列的 Map
|
|
97
97
|
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
98
|
-
*/const cacheColumnMap=()=>{const{tableFullColumn,collectColumn}=internalData;const fullColumnIdData=internalData.fullColumnIdData={};const fullColumnFieldData=internalData.fullColumnFieldData={};const mouseOpts=computeMouseOpts.value;const expandOpts=computeExpandOpts.value;const columnOpts=computeColumnOpts.value;const columnDragOpts=computeColumnDragOpts.value;const virtualYOpts=computeVirtualYOpts.value;const{isCrossDrag,isSelfToChildDrag}=columnDragOpts;const customOpts=computeCustomOpts.value;const{storage}=customOpts;const rowOpts=computeRowOpts.value;const isGroup=collectColumn.some(_utils.hasChildrenList);let isAllOverflow=!!props.showOverflow;let rowGroupColumn;let expandColumn;let treeNodeColumn;let checkboxColumn;let radioColumn;let htmlColumn;let hasFixed;const handleFunc=(column,index,items,path,parentColumn)=>{const{id:colid,field,fixed,type,treeNode,rowGroupNode}=column;const rest={$index:-1,_index:-1,column,colid,index,items,parent:parentColumn||null,width:0,oLeft:0};if(field){if(fullColumnFieldData[field]){(0,_log.errLog)('vxe.error.colRepet',['field',field]);}fullColumnFieldData[field]=rest;}else{if(storage&&!type||columnOpts.drag&&(isCrossDrag||isSelfToChildDrag)){(0,_log.errLog)('vxe.error.reqProp',[`${column.getTitle()||type||''} -> column.field=?`]);}}if(!hasFixed&&fixed){hasFixed=fixed;}if(!htmlColumn&&type==='html'){htmlColumn=column;}if(treeNode){if(treeNodeColumn){(0,_log.warnLog)('vxe.error.colRepet',['tree-node',treeNode]);}if(!treeNodeColumn){treeNodeColumn=column;}}if(rowGroupNode){if(treeNodeColumn){(0,_log.warnLog)('vxe.error.colRepet',['row-group-node',rowGroupNode]);}if(!rowGroupColumn){rowGroupColumn=column;}}if(type==='expand'){if(expandColumn){(0,_log.warnLog)('vxe.error.colRepet',['type',type]);}if(!expandColumn){expandColumn=column;}}if(type==='checkbox'){if(checkboxColumn){(0,_log.warnLog)('vxe.error.colRepet',['type',type]);}if(!checkboxColumn){checkboxColumn=column;}}else if(type==='radio'){if(radioColumn){(0,_log.warnLog)('vxe.error.colRepet',['type',type]);}if(!radioColumn){radioColumn=column;}}if(isAllOverflow&&column.showOverflow===false){isAllOverflow=false;}if(fullColumnIdData[colid]){(0,_log.errLog)('vxe.error.colRepet',['colId',colid]);}fullColumnIdData[colid]=rest;};if(isGroup){_xeUtils.default.eachTree(collectColumn,(column,index,items,path,parentColumn,nodes)=>{column.level=nodes.length;handleFunc(column,index,items,path,parentColumn);});}else{tableFullColumn.forEach(handleFunc);}if(expandColumn&&expandOpts.mode!=='fixed'&&virtualYOpts.enabled){(0,_log.warnLog)('vxe.error.notConflictProp',['column.type="expand','virtual-y-config.enabled=false']);}if(expandColumn&&expandOpts.mode!=='fixed'&&mouseOpts.area){(0,_log.errLog)('vxe.error.errConflicts',['mouse-config.area','column.type=expand']);}if(htmlColumn){if(!columnOpts.useKey){(0,_log.errLog)('vxe.error.reqProp',['column-config.useKey & column.type=html']);}if(!rowOpts.useKey){(0,_log.errLog)('vxe.error.reqProp',['row-config.useKey & column.type=html']);}}reactData.isGroup=isGroup;reactData.rowGroupColumn=rowGroupColumn;reactData.treeNodeColumn=treeNodeColumn;reactData.expandColumn=expandColumn;reactData.isAllOverflow=isAllOverflow;};const updateHeight=()=>{internalData.customHeight=calcTableHeight('height');internalData.customMinHeight=calcTableHeight('minHeight');internalData.customMaxHeight=calcTableHeight('maxHeight')
|
|
98
|
+
*/const cacheColumnMap=()=>{const{tableFullColumn,collectColumn}=internalData;const fullColumnIdData=internalData.fullColumnIdData={};const fullColumnFieldData=internalData.fullColumnFieldData={};const mouseOpts=computeMouseOpts.value;const expandOpts=computeExpandOpts.value;const columnOpts=computeColumnOpts.value;const columnDragOpts=computeColumnDragOpts.value;const virtualYOpts=computeVirtualYOpts.value;const{isCrossDrag,isSelfToChildDrag}=columnDragOpts;const customOpts=computeCustomOpts.value;const{storage}=customOpts;const rowOpts=computeRowOpts.value;const isGroup=collectColumn.some(_utils.hasChildrenList);let isAllOverflow=!!props.showOverflow;let rowGroupColumn;let expandColumn;let treeNodeColumn;let checkboxColumn;let radioColumn;let htmlColumn;let hasFixed;const handleFunc=(column,index,items,path,parentColumn)=>{const{id:colid,field,fixed,type,treeNode,rowGroupNode}=column;const rest={$index:-1,_index:-1,column,colid,index,items,parent:parentColumn||null,width:0,oLeft:0};if(field){if(fullColumnFieldData[field]){(0,_log.errLog)('vxe.error.colRepet',['field',field]);}fullColumnFieldData[field]=rest;}else{if(storage&&!type||columnOpts.drag&&(isCrossDrag||isSelfToChildDrag)){(0,_log.errLog)('vxe.error.reqProp',[`${column.getTitle()||type||''} -> column.field=?`]);}}if(!hasFixed&&fixed){hasFixed=fixed;}if(!htmlColumn&&type==='html'){htmlColumn=column;}if(treeNode){if(treeNodeColumn){(0,_log.warnLog)('vxe.error.colRepet',['tree-node',treeNode]);}if(!treeNodeColumn){treeNodeColumn=column;}}if(rowGroupNode){if(treeNodeColumn){(0,_log.warnLog)('vxe.error.colRepet',['row-group-node',rowGroupNode]);}if(!rowGroupColumn){rowGroupColumn=column;}}if(type==='expand'){if(expandColumn){(0,_log.warnLog)('vxe.error.colRepet',['type',type]);}if(!expandColumn){expandColumn=column;}}if(type==='checkbox'){if(checkboxColumn){(0,_log.warnLog)('vxe.error.colRepet',['type',type]);}if(!checkboxColumn){checkboxColumn=column;}}else if(type==='radio'){if(radioColumn){(0,_log.warnLog)('vxe.error.colRepet',['type',type]);}if(!radioColumn){radioColumn=column;}}if(isAllOverflow&&column.showOverflow===false){isAllOverflow=false;}if(fullColumnIdData[colid]){(0,_log.errLog)('vxe.error.colRepet',['colId',colid]);}fullColumnIdData[colid]=rest;};if(isGroup){_xeUtils.default.eachTree(collectColumn,(column,index,items,path,parentColumn,nodes)=>{column.level=nodes.length;handleFunc(column,index,items,path,parentColumn);});}else{tableFullColumn.forEach(handleFunc);}if(expandColumn&&expandOpts.mode!=='fixed'&&virtualYOpts.enabled){(0,_log.warnLog)('vxe.error.notConflictProp',['column.type="expand','virtual-y-config.enabled=false']);}if(expandColumn&&expandOpts.mode!=='fixed'&&mouseOpts.area){(0,_log.errLog)('vxe.error.errConflicts',['mouse-config.area','column.type=expand']);}if(htmlColumn){if(!columnOpts.useKey){(0,_log.errLog)('vxe.error.reqProp',['column-config.useKey & column.type=html']);}if(!rowOpts.useKey){(0,_log.errLog)('vxe.error.reqProp',['row-config.useKey & column.type=html']);}}reactData.isGroup=isGroup;reactData.rowGroupColumn=rowGroupColumn;reactData.treeNodeColumn=treeNodeColumn;reactData.expandColumn=expandColumn;reactData.isAllOverflow=isAllOverflow;};const updateHeight=()=>{internalData.customHeight=calcTableHeight('height');internalData.customMinHeight=calcTableHeight('minHeight');internalData.customMaxHeight=calcTableHeight('maxHeight');// 如果启用虚拟滚动,默认高度
|
|
99
|
+
if(reactData.scrollYLoad&&!(internalData.customHeight||internalData.customMinHeight)){internalData.customHeight=300;}};const calcColumnAutoWidth=(column,wrapperEl)=>{const cellElemList=wrapperEl.querySelectorAll(`.vxe-cell--wrapper[colid="${column.id}"]`);let leftRightPadding=0;const firstCellEl=cellElemList[0];if(firstCellEl&&firstCellEl.parentElement){const cellStyle=getComputedStyle(firstCellEl.parentElement);leftRightPadding=Math.ceil(_xeUtils.default.toNumber(cellStyle.paddingLeft)+_xeUtils.default.toNumber(cellStyle.paddingRight));}let colWidth=column.renderAutoWidth-leftRightPadding;for(let i=0;i<cellElemList.length;i++){const celEl=cellElemList[i];colWidth=Math.max(colWidth,celEl?Math.ceil(celEl.scrollWidth)+4:0);}return colWidth+leftRightPadding;};const calcCellWidth=()=>{const autoWidthColumnList=computeAutoWidthColumnList.value;const{fullColumnIdData}=internalData;const el=refElem.value;if(el){el.setAttribute('data-calc-col','Y');autoWidthColumnList.forEach(column=>{const colid=column.id;const colRest=fullColumnIdData[colid];const colWidth=calcColumnAutoWidth(column,el);if(colRest){colRest.width=Math.max(colWidth,colRest.width);}column.renderAutoWidth=colWidth;});$xeTable.analyColumnWidth();el.removeAttribute('data-calc-col');}};/**
|
|
99
100
|
* 列宽算法,计算单元格列宽,动态分配可用剩余空间
|
|
100
101
|
* 支持 px、%、固定 混合分配
|
|
101
102
|
* 支持动态列表调整分配
|
|
@@ -230,7 +231,7 @@ if(sYLoad){scrollYStore.endIndex=scrollYStore.visibleSize;}if(sYLoad){if(reactDa
|
|
|
230
231
|
// }
|
|
231
232
|
// }
|
|
232
233
|
// }
|
|
233
|
-
if(!(props.height||props.maxHeight)){(0,_log.errLog)('vxe.error.reqProp',['
|
|
234
|
+
if(!(props.height||props.maxHeight)){(0,_log.errLog)('vxe.error.reqProp',['height | max-height | virtual-y-config={enabled: false}']);}// if (!props.showOverflow) {
|
|
234
235
|
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
235
236
|
// }
|
|
236
237
|
if(props.spanMethod){(0,_log.errLog)('vxe.error.scrollErrProp',['table.span-method']);}}handleReserveStatus();$xeTable.checkSelectionStatus();return new Promise(resolve=>{(0,_vue.nextTick)().then(()=>handleRecalculateLayout(false)).then(()=>{calcCellHeight();updateRowOffsetTop();return handleRecalculateLayout(false);}).then(()=>{let targetScrollLeft=lastScrollLeft;let targetScrollTop=lastScrollTop;const virtualXOpts=computeVirtualXOpts.value;const virtualYOpts=computeVirtualYOpts.value;// 是否在更新数据之后自动滚动重置滚动条
|
|
@@ -419,7 +420,7 @@ if(!rowRest){return false;}const row=rowRest.row;const oRow=sourceDataRowIdData[
|
|
|
419
420
|
*/getData(rowIndex){const tableSynchData=props.data||internalData.tableSynchData;return _xeUtils.default.isUndefined(rowIndex)?tableSynchData.slice(0):tableSynchData[rowIndex];},/**
|
|
420
421
|
* 用于多选行,获取已选中的数据
|
|
421
422
|
*/getCheckboxRecords(isFull){const{treeConfig}=props;const{updateCheckboxFlag}=reactData;const{tableFullData,afterFullData,tableFullTreeData,fullDataRowIdData,afterFullRowMaps,selectCheckboxMaps}=internalData;const treeOpts=computeTreeOpts.value;const checkboxOpts=computeCheckboxOpts.value;const{transform,mapChildrenField}=treeOpts;const{checkField}=checkboxOpts;const childrenField=treeOpts.children||treeOpts.childrenField;let rowList=[];if(updateCheckboxFlag){if(checkField){if(treeConfig){// 如果开启 transform 默认就是完整数据
|
|
422
|
-
const currTableData=isFull?transform?tableFullTreeData:tableFullData:transform?tableFullTreeData:afterFullData;rowList=_xeUtils.default.filterTree(currTableData,row=>_xeUtils.default.get(row,checkField),{children:transform?mapChildrenField:childrenField});}else{const currTableData=isFull?tableFullData:afterFullData;rowList=currTableData.filter(row=>_xeUtils.default.get(row,checkField));}}else{_xeUtils.default.each(selectCheckboxMaps,(row,rowid)=>{if(
|
|
423
|
+
const currTableData=isFull?transform?tableFullTreeData:tableFullData:transform?tableFullTreeData:afterFullData;rowList=_xeUtils.default.filterTree(currTableData,row=>_xeUtils.default.get(row,checkField),{children:transform?mapChildrenField:childrenField});}else{const currTableData=isFull?tableFullData:afterFullData;rowList=currTableData.filter(row=>_xeUtils.default.get(row,checkField));}}else{const currMaps=isFull||treeConfig&&!transform?fullDataRowIdData:afterFullRowMaps;_xeUtils.default.each(selectCheckboxMaps,(row,rowid)=>{if(currMaps[rowid]){rowList.push(fullDataRowIdData[rowid].row);}});}}return rowList;},/**
|
|
423
424
|
* 只对 tree-config 有效,获取行的子级
|
|
424
425
|
*/getTreeRowChildren(rowOrRowid){const{treeConfig}=props;const{fullAllDataRowIdData}=internalData;const treeOpts=computeTreeOpts.value;const{transform,mapChildrenField}=treeOpts;const childrenField=treeOpts.children||treeOpts.childrenField;if(rowOrRowid&&treeConfig){let rowid;if(_xeUtils.default.isString(rowOrRowid)){rowid=rowOrRowid;}else{rowid=(0,_util.getRowid)($xeTable,rowOrRowid);}if(rowid){const rest=fullAllDataRowIdData[rowid];const row=rest?rest.row:null;if(row){return row[transform?mapChildrenField:childrenField]||[];}}}return[];},/**
|
|
425
426
|
* 只对 tree-config 有效,获取行的父级
|