vxe-table 3.21.5 → 3.21.6

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.
@@ -20,6 +20,7 @@ exports.encodeRowid = encodeRowid;
20
20
  exports.getCalcHeight = getCalcHeight;
21
21
  exports.getCellRestHeight = getCellRestHeight;
22
22
  exports.getCellValue = getCellValue;
23
+ exports.getColReMaxWidth = getColReMaxWidth;
23
24
  exports.getColReMinWidth = getColReMinWidth;
24
25
  exports.getColumnList = getColumnList;
25
26
  exports.getFirstChildColumn = getFirstChildColumn;
@@ -793,7 +794,10 @@ function toFilters(filters, colid) {
793
794
  }
794
795
  return filters;
795
796
  }
796
- function getColReMinWidth(params) {
797
+ /**
798
+ * 列宽拖动最大宽度
799
+ */
800
+ function getColReMaxWidth(params) {
797
801
  const {
798
802
  $table,
799
803
  column,
@@ -801,9 +805,52 @@ function getColReMinWidth(params) {
801
805
  } = params;
802
806
  const internalData = $table;
803
807
  const {
804
- showHeaderOverflow: allColumnHeaderOverflow,
805
- resizableOpts
806
- } = $table;
808
+ elemStore
809
+ } = internalData;
810
+ const resizableOpts = $table.computeResizableOpts;
811
+ const columnOpts = $table.computeColumnOpts;
812
+ const {
813
+ maxWidth: reMaxWidth
814
+ } = resizableOpts;
815
+ const colMaxWidth = column.maxWidth || columnOpts.maxWidth;
816
+ // 如果自定义调整宽度逻辑
817
+ if (reMaxWidth) {
818
+ const customMaxWidth = _xeUtils.default.isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
819
+ if (customMaxWidth !== 'auto') {
820
+ return Math.max(1, _xeUtils.default.toNumber(customMaxWidth));
821
+ }
822
+ }
823
+ const minTitleWidth = _xeUtils.default.floor((_xeUtils.default.toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8);
824
+ const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize((0, _dom.queryElement)(cell, '.vxe-cell'));
825
+ const mWidth = minTitleWidth + paddingLeftRight;
826
+ // 如果设置最小宽
827
+ if (colMaxWidth) {
828
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
829
+ if (bodyScrollElem) {
830
+ if ((0, _dom.isScale)(colMaxWidth)) {
831
+ const bodyWidth = bodyScrollElem.clientWidth - 1;
832
+ const meanWidth = bodyWidth / 100;
833
+ return Math.max(mWidth, Math.floor(_xeUtils.default.toInteger(colMaxWidth) * meanWidth));
834
+ } else if ((0, _dom.isPx)(colMaxWidth)) {
835
+ return Math.max(mWidth, _xeUtils.default.toInteger(colMaxWidth));
836
+ }
837
+ }
838
+ }
839
+ return -1;
840
+ }
841
+ /**
842
+ * 列宽拖动最小宽度
843
+ */
844
+ function getColReMinWidth(params) {
845
+ const {
846
+ $table,
847
+ column,
848
+ cell
849
+ } = params;
850
+ const tableProps = $table;
851
+ const internalData = $table;
852
+ const resizableOpts = $table.computeResizableOpts;
853
+ const columnOpts = $table.computeColumnOpts;
807
854
  const {
808
855
  minWidth
809
856
  } = resizableOpts;
@@ -818,9 +865,12 @@ function getColReMinWidth(params) {
818
865
  elemStore
819
866
  } = internalData;
820
867
  const {
821
- showHeaderOverflow,
822
- minWidth: colMinWidth
868
+ showHeaderOverflow: allColumnHeaderOverflow
869
+ } = tableProps;
870
+ const {
871
+ showHeaderOverflow
823
872
  } = column;
873
+ const colMinWidth = column.minWidth || columnOpts.minWidth;
824
874
  const headOverflow = _xeUtils.default.isUndefined(showHeaderOverflow) || _xeUtils.default.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
825
875
  const showEllipsis = headOverflow === 'ellipsis';
826
876
  const showTitle = headOverflow === 'title';
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.assembleColumn=assembleColumn,exports.clearTableAllStatus=clearTableAllStatus,exports.clearTableDefaultStatus=clearTableDefaultStatus,exports.colToVisible=colToVisible,exports.convertHeaderColumnToRows=void 0,exports.convertHeaderToGridRows=convertHeaderToGridRows,exports.createColumn=createColumn,exports.createHandleGetRowId=createHandleGetRowId,exports.createHandleUpdateRowId=createHandleUpdateRowId,exports.createInternalData=createInternalData,exports.createReactData=createReactData,exports.createRowId=createRowId,exports.destroyColumn=destroyColumn,exports.encodeRowid=encodeRowid,exports.getCalcHeight=getCalcHeight,exports.getCellRestHeight=getCellRestHeight,exports.getCellValue=getCellValue,exports.getColReMinWidth=getColReMinWidth,exports.getColumnList=getColumnList,exports.getFirstChildColumn=getFirstChildColumn,exports.getLastChildColumn=getLastChildColumn,exports.getRefElem=getRefElem,exports.getRootColumn=getRootColumn,exports.getRowUniqueId=getRowUniqueId,exports.getRowid=getRowid,exports.getRowkey=getRowkey,exports.handleFieldOrColumn=handleFieldOrColumn,exports.handleRowidOrRow=handleRowidOrRow,exports.hasDeepKey=hasDeepKey,exports.isColumnInfo=isColumnInfo,exports.restoreScrollLocation=restoreScrollLocation,exports.rowToVisible=rowToVisible,exports.setCellValue=setCellValue,exports.toFilters=toFilters,exports.toTreePathSeq=toTreePathSeq;var _xeUtils=_interopRequireDefault(require("xe-utils")),_columnInfo=require("./columnInfo"),_dom=require("../../ui/src/dom"),_log=require("../../ui/src/log"),_utils=require("../../ui/src/utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function createInternalData(){return{tZindex:0,currKeyField:"",isCurrDeepKey:!1,elemStore:{},scrollXStore:{preloadSize:0,offsetSize:0,visibleSize:0,visibleStartIndex:0,visibleEndIndex:0,startIndex:0,endIndex:0},scrollYStore:{preloadSize:0,offsetSize:0,visibleSize:0,visibleStartIndex:0,visibleEndIndex:0,startIndex:0,endIndex:0},tableWidth:0,tableHeight:0,customHeight:0,customMinHeight:0,customMaxHeight:0,hoverRow:null,lastScrollLeft:0,lastScrollTop:0,radioReserveRow:null,checkboxReserveRowMap:{},rowExpandedReserveRowMap:{},treeExpandedReserveRowMap:{},treeIndeterminateRowMaps:{},tableFullData:[],afterFullData:[],afterTreeFullData:[],afterGroupFullData:[],afterFullRowMaps:{},tableFullTreeData:[],tableFullGroupData:[],tableSynchData:[],tableSourceData:[],collectColumn:[],tableFullColumn:[],visibleColumn:[],fullAllDataRowIdData:{},fullDataRowIdData:{},visibleDataRowIdData:{},keepUpdateFieldMaps:{},headerFullDataColData:{},footerFullDataRowData:{},sourceDataRowIdData:{},fullColumnIdData:{},fullColumnFieldData:{},currentRow:null,mergeHeaderList:[],mergeHeaderMaps:{},mergeHeaderCellMaps:{},mergeHeaderRowMaps:{},mergeHeaderColMaps:{},mergeBodyList:[],mergeBodyMaps:{},mergeBodyCellMaps:{},mergeBodyRowMaps:{},mergeBodyColMaps:{},mergeFooterList:[],mergeFooterMaps:{},mergeFooterCellMaps:{},mergeFooterRowMaps:{},mergeFooterColMaps:{},rowExpandedMaps:{},rowExpandLazyLoadedMaps:{},rowGroupExpandedMaps:{},treeExpandedMaps:{},treeExpandLazyLoadedMaps:{},selectCheckboxMaps:{},pendingRowMaps:{},insertRowMaps:{},removeRowMaps:{},cvCacheMaps:{},tHeaderHeight:0,tBodyHeight:0,tFooterHeight:0,stackHistoryStore:{undoStacks:[],redoStacks:[]},teleportToWrapperElem:null,popupToWrapperElem:null,customPopupToElem:null,lastSTime:0,inited:!1,tooltipTimeout:null,initStatus:!1,isActivated:!1}}function createReactData(){return{updateColFlag:0,staticColumns:[],tableGroupColumn:[],tableColumn:[],tableData:[],scrollXLoad:!1,scrollYLoad:!1,overflowY:!0,overflowX:!1,scrollbarWidth:0,scrollbarHeight:0,rowHeight:0,parentHeight:0,isGroup:!1,isAllOverflow:!1,isAllSelected:!1,isIndeterminate:!1,currentColumn:null,selectRadioRow:null,footerTableData:[],rowGroupColumn:null,expandColumn:null,checkboxColumn:null,radioColumn:null,treeNodeColumn:null,hasFixedColumn:!1,upDataFlag:0,reColumnFlag:0,initStore:{filter:!1,import:!1,export:!1,custom:!1},customStore:{btnEl:null,isAll:!1,isIndeterminate:!1,activeBtn:!1,activeWrapper:!1,visible:!1,maxHeight:null,popupStyle:{},oldSortMaps:{},oldFixedMaps:{},oldVisibleMaps:{}},customColumnList:[],filterStore:{isAllSelected:!1,isIndeterminate:!1,style:null,column:null,visible:!1,maxHeight:null},columnStore:{leftList:[],centerList:[],rightList:[],resizeList:[],pxList:[],pxMinList:[],autoMinList:[],scaleList:[],scaleMinList:[],autoList:[],remainList:[]},ctxMenuStore:{selected:null,visible:!1,showChild:!1,selectChild:null,list:[],style:null},editStore:{indexs:{columns:[]},titles:{columns:[]},selected:{row:null,column:null},copyed:{cut:!1,rows:[],columns:[]},actived:{row:null,column:null},focused:{row:null,column:null}},tooltipStore:{row:null,column:null,content:"",visible:!1,type:null,currOpts:{}},validStore:{visible:!1},validErrorMaps:{},importStore:{inited:!1,file:null,type:"",modeList:[],typeList:[],filename:"",visible:!1},importParams:{mode:"",types:null,message:!0},exportStore:{inited:!1,name:"",modeList:[],typeList:[],columns:[],isPrint:!1,hasFooter:!1,hasMerge:!1,hasTree:!1,hasRowGroup:!1,hasColgroup:!1,visible:!1},exportParams:{filename:"",sheetName:"",mode:"",type:"",isColgroup:!1,isMerge:!1,isTreeAllExpanded:!1,isRowGroupAllExpanded:!1,useStyle:!1,original:!1,message:!0,isHeader:!1,isTitle:!1,isFooter:!1},visiblwRowsFlag:1,isRowGroupStatus:!1,rowGroupList:[],aggHandleFields:[],aggHandleAggColumns:[],rowGroupExpandedFlag:1,rowExpandedFlag:1,treeExpandedFlag:1,updateCheckboxFlag:1,pendingRowFlag:1,insertRowFlag:1,removeRowFlag:1,mergeHeadFlag:1,mergeBodyFlag:1,mergeFootFlag:1,rowHeightStore:{large:52,default:48,medium:44,small:40,mini:36},scrollVMLoading:!1,scrollYHeight:0,scrollYTop:0,isScrollYBig:!1,scrollXLeft:0,scrollXWidth:0,isScrollXBig:!1,lazScrollLoading:!1,rowExpandHeightFlag:1,calcCellHeightFlag:1,resizeHeightFlag:1,resizeWidthFlag:1,isCustomStatus:!1,isCustomDragStatus:!0,ctPopupFlag:1,isCrossDragRow:!1,dragRow:null,isCrossDragCol:!1,dragCol:null,dragTipText:"",isDragResize:!1,isRowLoading:!1,isColLoading:!1}}let getAllConvertColumns=(e,l)=>{let t=[];return e.forEach(e=>{e.parentId=l?l.id:null,e.visible&&(e.children&&e.children.length&&e.children.some(e=>e.visible)?(t.push(e),t.push(...getAllConvertColumns(e.children,e))):t.push(e))}),t},convertHeaderColumnToRows=e=>{let l=1,o=(t,e)=>{if(e&&(t.level=e.level+1,l<t.level)&&(l=t.level),t.children&&t.children.length&&t.children.some(e=>e.visible)){let l=0;t.children.forEach(e=>{e.visible&&(o(e,t),l+=e.colSpan)}),t.colSpan=l}else t.colSpan=1},t=(e.forEach(e=>{e.level=1,o(e)}),[]);for(let e=0;e<l;e++)t.push([]);return getAllConvertColumns(e).forEach(e=>{e.children&&e.children.length&&e.children.some(e=>e.visible)?e.rowSpan=1:e.rowSpan=l-e.level+1,t[e.level-1].push(e)}),t};function convertHeaderToGridRows(l){var t=l.length,i=l[0].reduce((e,l)=>e+l.colSpan,0),n=[],a=[];for(let e=0;e<t;e++){var o=[],r=[];for(let e=0;e<i;e++)o.push(!1),r.push("");n.push(o),a.push(r)}for(let r=0;r<t;r++){let e=0;for(var u of l[r]){var{colSpan:s,rowSpan:d}=u;let o=-1;for(let t=e;t<=i-s;t++){let l=!0;for(let e=0;e<s;e++)if(n[r][t+e]){l=!1;break}if(l){o=t;break}}if(-1===o){for(let t=0;t<=i-s;t++){let l=!0;for(let e=0;e<s;e++)if(n[r][t+e]){l=!1;break}if(l){o=t;break}}if(-1===o)break}for(let l=r;l<r+d;l++)for(let e=o;e<o+s;e++)n[l][e]=!0,a[l][e]=u;e=o+s}}return a}function restoreScrollLocation(e,l,t){var o=e;return l||t?(o.intoRunScroll=!1,o.inVirtualScroll=!1,o.inWheelScroll=!1,o.inHeaderScroll=!1,o.inBodyScroll=!1,o.inFooterScroll=!1,o.scrollRenderType="",e.scrollTo(l,t)):e.clearScroll()}function toTreePathSeq(e){return e.map((e,l)=>l%2==0?Number(e)+1:".").join("")}function getRowUniqueId(){return _xeUtils.default.uniqueId("row_")}function createRowId(e,l,t){e=e.createKeyMethod;return e?""+e({row:l,keyField:t}):getRowUniqueId()}function hasDeepKey(e){return-1<e.indexOf(".")}function getRowkey(e){e=e.currKeyField;return e}function getRowid(e,l){var{isCurrDeepKey:e,currKeyField:t}=e;return l?encodeRowid((e?getDeepRowIdByKey:getFastRowIdByKey)(l,t)):""}function createHandleUpdateRowId(e){let{isCurrDeepKey:l,currKeyField:t}=e,o=e.computeRowOpts,r=l?updateDeepRowKey:updateFastRowKey;return{rowKey:t,handleUpdateRowId(e){return e?r(o,e,t):""}}}function createHandleGetRowId(e){let{isCurrDeepKey:l,currKeyField:t}=e,o=l?getDeepRowIdByKey:getFastRowIdByKey;return{rowKey:t,handleGetRowId(e){return e?encodeRowid(o(e,t)):""}}}function encodeRowid(e){return _xeUtils.default.eqNull(e)?"":encodeURIComponent(e)}function getDeepRowIdByKey(e,l){return _xeUtils.default.get(e,l)}function updateDeepRowKey(e,l,t){let o=encodeRowid(getDeepRowIdByKey(l,t));return(0,_utils.eqEmptyValue)(o)&&(e=createRowId(e,l,t),o=""+e,_xeUtils.default.set(l,t,o)),o}function getFastRowIdByKey(e,l){return e[l]}function updateFastRowKey(e,l,t){let o=encodeRowid(getFastRowIdByKey(l,t));return(0,_utils.eqEmptyValue)(o)&&(e=createRowId(e,l,t),o=""+e,l[t]=e),o}function getPaddingLeftRightSize(e){return e?(e=getComputedStyle(e),_xeUtils.default.toNumber(e.paddingLeft)+_xeUtils.default.toNumber(e.paddingRight)):0}function getElementMarginAndWidth(e){var l,t;return e?(t=getComputedStyle(e),l=_xeUtils.default.toNumber(t.marginLeft),t=_xeUtils.default.toNumber(t.marginRight),e.offsetWidth+l+t):0}function getCalcHeight(e){return"unset"!==e&&e||0}function handleFieldOrColumn(e,l){return l?_xeUtils.default.isString(l)||_xeUtils.default.isNumber(l)?e.getColumnByField(""+l):l:null}function handleRowidOrRow(e,l){return l?(l=_xeUtils.default.isString(l)||_xeUtils.default.isNumber(l)?l:getRowid(e,l),e.getRowById(l)):null}function getCellRestHeight(e,l,t,o){return e.resizeHeight||l.height||t.height||e.height||o}function assembleColumn(e){var l=e.$xeTable,t=l.staticColumns,{$el:e,$xeColumn:o,columnConfig:r}=e,i=o?o.columnConfig:null;i?("vxe-table-column"===o.$options._componentTag?(0,_log.errLog)("vxe.error.groupTag",[`<vxe-table-colgroup title=${o.title} ...>`,`<vxe-table-column title=${o.title} ...>`]):"vxe-column"===o.$options._componentTag&&(0,_log.warnLog)("vxe.error.groupTag",[`<vxe-colgroup title=${o.title} ...>`,`<vxe-column title=${o.title} ...>`]),i.children||(i.children=[]),r.defaultParentId=i.id,i.children.splice(_xeUtils.default.arrayIndexOf(o.$el.children,e),0,r)):t.splice(_xeUtils.default.arrayIndexOf(l.$refs.hideColumn.children,e),0,r)}function destroyColumn(e){var l=e.$xeTable.staticColumns;let t=e.columnConfig;e=_xeUtils.default.findTree(l,e=>e===t);e&&e.items.splice(e.index,1)}function getRootColumn(e,l){var t=e.fullColumnIdData;if(!l)return null;let o=l.parentId;for(;t[o];){let e=t[o].column;if(!(o=e.parentId))return e}return l}function toFilters(e,i){return e&&(_xeUtils.default.isArray(e)?e.map(({label:e,value:l,data:t,resetValue:o,checked:r})=>({label:e,value:l,data:t,resetValue:o,checked:!!r,_checked:!!r,_colId:i})):[])}function getColReMinWidth(e){var{$table:l,column:t,cell:o}=e,r=l,{showHeaderOverflow:l,resizableOpts:i}=l,i=i.minWidth;if(i){e=_xeUtils.default.isFunction(i)?i(e):i;if("auto"!==e)return Math.max(1,_xeUtils.default.toNumber(e))}var n,a,u,s,i=r.elemStore,{showHeaderOverflow:e,minWidth:r}=t,t=_xeUtils.default.isUndefined(e)||_xeUtils.default.isNull(e)?l:e,l="title"===t||(!0===t||"tooltip"===t)||"ellipsis"===t;let d=_xeUtils.default.floor(1.8*(_xeUtils.default.toNumber(getComputedStyle(o).fontSize)||14))+(getPaddingLeftRightSize(o)+getPaddingLeftRightSize((0,_dom.queryElement)(o,".vxe-cell")));if(l&&(e=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--drag-handle")),t=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--checkbox")),l=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--required-icon")),n=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--edit-icon")),a=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell-title-prefix-icon")),u=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell-title-suffix-icon")),s=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--sort")),o=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--filter")),d+=e+t+l+n+a+u+o+s),r){e=getRefElem(i["main-body-scroll"]);if(e){if((0,_dom.isScale)(r))return t=(e.clientWidth-1)/100,Math.max(d,Math.floor(_xeUtils.default.toInteger(r)*t));if((0,_dom.isPx)(r))return Math.max(d,_xeUtils.default.toInteger(r))}}return d}function getFirstChildColumn(e){var l=e.children;return l&&l.length?getFirstChildColumn(_xeUtils.default.first(l)):e}function getLastChildColumn(e){var l=e.children;return l&&l.length?getFirstChildColumn(_xeUtils.default.last(l)):e}function getCellValue(e,l){return l?_xeUtils.default.get(e,l.field):null}function setCellValue(e,l,t){l&&_xeUtils.default.set(e,l.field,t)}function getRefElem(e){return e?e.$el||e:null}function clearTableDefaultStatus(e){var l=e,t=(e.initStatus=!1,[e.clearSort(),e.clearCurrentRow(),e.clearCurrentColumn(),e.clearRadioRow(),e.clearRadioReserve(),e.clearCheckboxRow(),e.clearCheckboxReserve(),e.clearRowExpand(),e.clearTreeExpand(),e.clearTreeExpandReserve(),e.clearPendingRow()]);return e.clearFilter&&t.push(e.clearFilter()),e.clearSelected&&(l.keyboardConfig||l.mouseConfig)&&t.push(e.clearSelected()),e.clearCellAreas&&l.mouseConfig&&t.push(e.clearCellAreas(),e.clearCopyCellArea()),Promise.all(t).then(()=>e.clearScroll())}function clearTableAllStatus(e){return e.clearFilter&&e.clearFilter(),clearTableDefaultStatus(e)}function isColumnInfo(e){return e instanceof _columnInfo.ColumnInfo}function getColumnList(e){let l=[];return e.forEach(e=>{l.push(...e.children&&e.children.length?getColumnList(e.children):[e])}),l}function createColumn(e,l,t){return isColumnInfo(l)?l:new _columnInfo.ColumnInfo(e,l,t)}function rowToVisible(e,l){var{scrollYLoad:t,scrollYTop:o,isAllOverflow:r}=e,{elemStore:i,afterFullData:n,fullAllDataRowIdData:a,isResizeCellHeight:u}=e,s=e.computeRowOpts,d=e.computeCellOpts,c=e.computeDefaultRowHeight,m=e.computeLeftFixedWidth,g=e.computeRightFixedWidth,i=getRefElem(i["main-body-scroll"]),p=getRowid(e,l);if(i){var f=i.clientHeight,h=i.scrollTop,i=i.querySelector(`[rowid="${p}"]`);if(i){var o=i.offsetTop+(t?o:0),i=i.clientHeight;if(o<h||h+f<o)return e.scrollTo(null,o);if(f+h<=o+i)return e.scrollTo(null,h+i)}else if(t)return u||d.height||s.height||!r?(i=(o=a[p]||{}).resizeHeight||d.height||s.height||o.height||c,(t=o.oTop)<h?e.scrollTo(null,t-m-1):e.scrollTo(null,t+i-(f-g-1))):e.scrollTo(null,(e.findRowIndexOf(n,l)-1)*c)}return Promise.resolve()}function colToVisible(t,o,r,l){var{scrollXLoad:i,scrollXLeft:n}=t,{elemStore:a,visibleColumn:u}=t,s=t.computeLeftFixedWidth,d=t.computeRightFixedWidth,a=getRefElem(a["main-body-scroll"]);if(!r.fixed&&a){var c=a.clientWidth,m=a.scrollLeft;let e=null;if(l&&(l=getRowid(t,l),e=a.querySelector(`[rowid="${l}"] .`+r.id)),e=e||a.querySelector("."+r.id)){l=e.offsetLeft+(i?n:0),a=e.clientWidth;if(o||!(l<=m+s&&m+s<l+a)&&!(m+s<=l&&l<m+c-d)){if(l<m+s)return t.scrollTo(l-s-1);if(c-d<l+a-m)return t.scrollTo(l+a-(c-d-1))}}else if(i){let l=0;n=r.renderWidth;for(let e=0;e<u.length;e++){var g=u[e];if(g===r||g.id===r.id)break;l+=g.renderWidth}if(o||!(l<=m+s&&l+n>m+s)&&!(l>=m+s&&l<m+c-d))return l<m?t.scrollTo(l-s-1):t.scrollTo(l+n-(c-d-1))}}return Promise.resolve()}exports.convertHeaderColumnToRows=convertHeaderColumnToRows;
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.assembleColumn=assembleColumn,exports.clearTableAllStatus=clearTableAllStatus,exports.clearTableDefaultStatus=clearTableDefaultStatus,exports.colToVisible=colToVisible,exports.convertHeaderColumnToRows=void 0,exports.convertHeaderToGridRows=convertHeaderToGridRows,exports.createColumn=createColumn,exports.createHandleGetRowId=createHandleGetRowId,exports.createHandleUpdateRowId=createHandleUpdateRowId,exports.createInternalData=createInternalData,exports.createReactData=createReactData,exports.createRowId=createRowId,exports.destroyColumn=destroyColumn,exports.encodeRowid=encodeRowid,exports.getCalcHeight=getCalcHeight,exports.getCellRestHeight=getCellRestHeight,exports.getCellValue=getCellValue,exports.getColReMaxWidth=getColReMaxWidth,exports.getColReMinWidth=getColReMinWidth,exports.getColumnList=getColumnList,exports.getFirstChildColumn=getFirstChildColumn,exports.getLastChildColumn=getLastChildColumn,exports.getRefElem=getRefElem,exports.getRootColumn=getRootColumn,exports.getRowUniqueId=getRowUniqueId,exports.getRowid=getRowid,exports.getRowkey=getRowkey,exports.handleFieldOrColumn=handleFieldOrColumn,exports.handleRowidOrRow=handleRowidOrRow,exports.hasDeepKey=hasDeepKey,exports.isColumnInfo=isColumnInfo,exports.restoreScrollLocation=restoreScrollLocation,exports.rowToVisible=rowToVisible,exports.setCellValue=setCellValue,exports.toFilters=toFilters,exports.toTreePathSeq=toTreePathSeq;var _xeUtils=_interopRequireDefault(require("xe-utils")),_columnInfo=require("./columnInfo"),_dom=require("../../ui/src/dom"),_log=require("../../ui/src/log"),_utils=require("../../ui/src/utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function createInternalData(){return{tZindex:0,currKeyField:"",isCurrDeepKey:!1,elemStore:{},scrollXStore:{preloadSize:0,offsetSize:0,visibleSize:0,visibleStartIndex:0,visibleEndIndex:0,startIndex:0,endIndex:0},scrollYStore:{preloadSize:0,offsetSize:0,visibleSize:0,visibleStartIndex:0,visibleEndIndex:0,startIndex:0,endIndex:0},tableWidth:0,tableHeight:0,customHeight:0,customMinHeight:0,customMaxHeight:0,hoverRow:null,lastScrollLeft:0,lastScrollTop:0,radioReserveRow:null,checkboxReserveRowMap:{},rowExpandedReserveRowMap:{},treeExpandedReserveRowMap:{},treeIndeterminateRowMaps:{},tableFullData:[],afterFullData:[],afterTreeFullData:[],afterGroupFullData:[],afterFullRowMaps:{},tableFullTreeData:[],tableFullGroupData:[],tableSynchData:[],tableSourceData:[],collectColumn:[],tableFullColumn:[],visibleColumn:[],fullAllDataRowIdData:{},fullDataRowIdData:{},visibleDataRowIdData:{},keepUpdateFieldMaps:{},headerFullDataColData:{},footerFullDataRowData:{},sourceDataRowIdData:{},fullColumnIdData:{},fullColumnFieldData:{},currentRow:null,mergeHeaderList:[],mergeHeaderMaps:{},mergeHeaderCellMaps:{},mergeHeaderRowMaps:{},mergeHeaderColMaps:{},mergeBodyList:[],mergeBodyMaps:{},mergeBodyCellMaps:{},mergeBodyRowMaps:{},mergeBodyColMaps:{},mergeFooterList:[],mergeFooterMaps:{},mergeFooterCellMaps:{},mergeFooterRowMaps:{},mergeFooterColMaps:{},rowExpandedMaps:{},rowExpandLazyLoadedMaps:{},rowGroupExpandedMaps:{},treeExpandedMaps:{},treeExpandLazyLoadedMaps:{},selectCheckboxMaps:{},pendingRowMaps:{},insertRowMaps:{},removeRowMaps:{},cvCacheMaps:{},tHeaderHeight:0,tBodyHeight:0,tFooterHeight:0,stackHistoryStore:{undoStacks:[],redoStacks:[]},teleportToWrapperElem:null,popupToWrapperElem:null,customPopupToElem:null,lastSTime:0,inited:!1,tooltipTimeout:null,initStatus:!1,isActivated:!1}}function createReactData(){return{updateColFlag:0,staticColumns:[],tableGroupColumn:[],tableColumn:[],tableData:[],scrollXLoad:!1,scrollYLoad:!1,overflowY:!0,overflowX:!1,scrollbarWidth:0,scrollbarHeight:0,rowHeight:0,parentHeight:0,isGroup:!1,isAllOverflow:!1,isAllSelected:!1,isIndeterminate:!1,currentColumn:null,selectRadioRow:null,footerTableData:[],rowGroupColumn:null,expandColumn:null,checkboxColumn:null,radioColumn:null,treeNodeColumn:null,hasFixedColumn:!1,upDataFlag:0,reColumnFlag:0,initStore:{filter:!1,import:!1,export:!1,custom:!1},customStore:{btnEl:null,isAll:!1,isIndeterminate:!1,activeBtn:!1,activeWrapper:!1,visible:!1,maxHeight:null,popupStyle:{},oldSortMaps:{},oldFixedMaps:{},oldVisibleMaps:{}},customColumnList:[],filterStore:{isAllSelected:!1,isIndeterminate:!1,style:null,column:null,visible:!1,maxHeight:null},columnStore:{leftList:[],centerList:[],rightList:[],resizeList:[],pxList:[],pxMinList:[],autoMinList:[],scaleList:[],scaleMinList:[],autoList:[],remainList:[]},ctxMenuStore:{selected:null,visible:!1,showChild:!1,selectChild:null,list:[],style:null},editStore:{indexs:{columns:[]},titles:{columns:[]},selected:{row:null,column:null},copyed:{cut:!1,rows:[],columns:[]},actived:{row:null,column:null},focused:{row:null,column:null}},tooltipStore:{row:null,column:null,content:"",visible:!1,type:null,currOpts:{}},validStore:{visible:!1},validErrorMaps:{},importStore:{inited:!1,file:null,type:"",modeList:[],typeList:[],filename:"",visible:!1},importParams:{mode:"",types:null,message:!0},exportStore:{inited:!1,name:"",modeList:[],typeList:[],columns:[],isPrint:!1,hasFooter:!1,hasMerge:!1,hasTree:!1,hasRowGroup:!1,hasColgroup:!1,visible:!1},exportParams:{filename:"",sheetName:"",mode:"",type:"",isColgroup:!1,isMerge:!1,isTreeAllExpanded:!1,isRowGroupAllExpanded:!1,useStyle:!1,original:!1,message:!0,isHeader:!1,isTitle:!1,isFooter:!1},visiblwRowsFlag:1,isRowGroupStatus:!1,rowGroupList:[],aggHandleFields:[],aggHandleAggColumns:[],rowGroupExpandedFlag:1,rowExpandedFlag:1,treeExpandedFlag:1,updateCheckboxFlag:1,pendingRowFlag:1,insertRowFlag:1,removeRowFlag:1,mergeHeadFlag:1,mergeBodyFlag:1,mergeFootFlag:1,rowHeightStore:{large:52,default:48,medium:44,small:40,mini:36},scrollVMLoading:!1,scrollYHeight:0,scrollYTop:0,isScrollYBig:!1,scrollXLeft:0,scrollXWidth:0,isScrollXBig:!1,lazScrollLoading:!1,rowExpandHeightFlag:1,calcCellHeightFlag:1,resizeHeightFlag:1,resizeWidthFlag:1,isCustomStatus:!1,isCustomDragStatus:!0,ctPopupFlag:1,isCrossDragRow:!1,dragRow:null,isCrossDragCol:!1,dragCol:null,dragTipText:"",isDragResize:!1,isRowLoading:!1,isColLoading:!1}}let getAllConvertColumns=(e,t)=>{let l=[];return e.forEach(e=>{e.parentId=t?t.id:null,e.visible&&(e.children&&e.children.length&&e.children.some(e=>e.visible)?(l.push(e),l.push(...getAllConvertColumns(e.children,e))):l.push(e))}),l},convertHeaderColumnToRows=e=>{let t=1,o=(l,e)=>{if(e&&(l.level=e.level+1,t<l.level)&&(t=l.level),l.children&&l.children.length&&l.children.some(e=>e.visible)){let t=0;l.children.forEach(e=>{e.visible&&(o(e,l),t+=e.colSpan)}),l.colSpan=t}else l.colSpan=1},l=(e.forEach(e=>{e.level=1,o(e)}),[]);for(let e=0;e<t;e++)l.push([]);return getAllConvertColumns(e).forEach(e=>{e.children&&e.children.length&&e.children.some(e=>e.visible)?e.rowSpan=1:e.rowSpan=t-e.level+1,l[e.level-1].push(e)}),l};function convertHeaderToGridRows(t){var l=t.length,i=t[0].reduce((e,t)=>e+t.colSpan,0),n=[],a=[];for(let e=0;e<l;e++){var o=[],r=[];for(let e=0;e<i;e++)o.push(!1),r.push("");n.push(o),a.push(r)}for(let r=0;r<l;r++){let e=0;for(var u of t[r]){var{colSpan:s,rowSpan:d}=u;let o=-1;for(let l=e;l<=i-s;l++){let t=!0;for(let e=0;e<s;e++)if(n[r][l+e]){t=!1;break}if(t){o=l;break}}if(-1===o){for(let l=0;l<=i-s;l++){let t=!0;for(let e=0;e<s;e++)if(n[r][l+e]){t=!1;break}if(t){o=l;break}}if(-1===o)break}for(let t=r;t<r+d;t++)for(let e=o;e<o+s;e++)n[t][e]=!0,a[t][e]=u;e=o+s}}return a}function restoreScrollLocation(e,t,l){var o=e;return t||l?(o.intoRunScroll=!1,o.inVirtualScroll=!1,o.inWheelScroll=!1,o.inHeaderScroll=!1,o.inBodyScroll=!1,o.inFooterScroll=!1,o.scrollRenderType="",e.scrollTo(t,l)):e.clearScroll()}function toTreePathSeq(e){return e.map((e,t)=>t%2==0?Number(e)+1:".").join("")}function getRowUniqueId(){return _xeUtils.default.uniqueId("row_")}function createRowId(e,t,l){e=e.createKeyMethod;return e?""+e({row:t,keyField:l}):getRowUniqueId()}function hasDeepKey(e){return-1<e.indexOf(".")}function getRowkey(e){e=e.currKeyField;return e}function getRowid(e,t){var{isCurrDeepKey:e,currKeyField:l}=e;return t?encodeRowid((e?getDeepRowIdByKey:getFastRowIdByKey)(t,l)):""}function createHandleUpdateRowId(e){let{isCurrDeepKey:t,currKeyField:l}=e,o=e.computeRowOpts,r=t?updateDeepRowKey:updateFastRowKey;return{rowKey:l,handleUpdateRowId(e){return e?r(o,e,l):""}}}function createHandleGetRowId(e){let{isCurrDeepKey:t,currKeyField:l}=e,o=t?getDeepRowIdByKey:getFastRowIdByKey;return{rowKey:l,handleGetRowId(e){return e?encodeRowid(o(e,l)):""}}}function encodeRowid(e){return _xeUtils.default.eqNull(e)?"":encodeURIComponent(e)}function getDeepRowIdByKey(e,t){return _xeUtils.default.get(e,t)}function updateDeepRowKey(e,t,l){let o=encodeRowid(getDeepRowIdByKey(t,l));return(0,_utils.eqEmptyValue)(o)&&(e=createRowId(e,t,l),o=""+e,_xeUtils.default.set(t,l,o)),o}function getFastRowIdByKey(e,t){return e[t]}function updateFastRowKey(e,t,l){let o=encodeRowid(getFastRowIdByKey(t,l));return(0,_utils.eqEmptyValue)(o)&&(e=createRowId(e,t,l),o=""+e,t[l]=e),o}function getPaddingLeftRightSize(e){return e?(e=getComputedStyle(e),_xeUtils.default.toNumber(e.paddingLeft)+_xeUtils.default.toNumber(e.paddingRight)):0}function getElementMarginAndWidth(e){var t,l;return e?(l=getComputedStyle(e),t=_xeUtils.default.toNumber(l.marginLeft),l=_xeUtils.default.toNumber(l.marginRight),e.offsetWidth+t+l):0}function getCalcHeight(e){return"unset"!==e&&e||0}function handleFieldOrColumn(e,t){return t?_xeUtils.default.isString(t)||_xeUtils.default.isNumber(t)?e.getColumnByField(""+t):t:null}function handleRowidOrRow(e,t){return t?(t=_xeUtils.default.isString(t)||_xeUtils.default.isNumber(t)?t:getRowid(e,t),e.getRowById(t)):null}function getCellRestHeight(e,t,l,o){return e.resizeHeight||t.height||l.height||e.height||o}function assembleColumn(e){var t=e.$xeTable,l=t.staticColumns,{$el:e,$xeColumn:o,columnConfig:r}=e,i=o?o.columnConfig:null;i?("vxe-table-column"===o.$options._componentTag?(0,_log.errLog)("vxe.error.groupTag",[`<vxe-table-colgroup title=${o.title} ...>`,`<vxe-table-column title=${o.title} ...>`]):"vxe-column"===o.$options._componentTag&&(0,_log.warnLog)("vxe.error.groupTag",[`<vxe-colgroup title=${o.title} ...>`,`<vxe-column title=${o.title} ...>`]),i.children||(i.children=[]),r.defaultParentId=i.id,i.children.splice(_xeUtils.default.arrayIndexOf(o.$el.children,e),0,r)):l.splice(_xeUtils.default.arrayIndexOf(t.$refs.hideColumn.children,e),0,r)}function destroyColumn(e){var t=e.$xeTable.staticColumns;let l=e.columnConfig;e=_xeUtils.default.findTree(t,e=>e===l);e&&e.items.splice(e.index,1)}function getRootColumn(e,t){var l=e.fullColumnIdData;if(!t)return null;let o=t.parentId;for(;l[o];){let e=l[o].column;if(!(o=e.parentId))return e}return t}function toFilters(e,i){return e&&(_xeUtils.default.isArray(e)?e.map(({label:e,value:t,data:l,resetValue:o,checked:r})=>({label:e,value:t,data:l,resetValue:o,checked:!!r,_checked:!!r,_colId:i})):[])}function getColReMaxWidth(e){var{$table:t,column:l,cell:o}=e,r=t.elemStore,i=t.computeResizableOpts.maxWidth,l=l.maxWidth||t.computeColumnOpts.maxWidth;if(i){t=_xeUtils.default.isFunction(i)?i(e):i;if("auto"!==t)return Math.max(1,_xeUtils.default.toNumber(t))}e=_xeUtils.default.floor(1.8*(_xeUtils.default.toNumber(getComputedStyle(o).fontSize)||14))+(getPaddingLeftRightSize(o)+getPaddingLeftRightSize((0,_dom.queryElement)(o,".vxe-cell")));if(l){i=getRefElem(r["main-body-scroll"]);if(i){if((0,_dom.isScale)(l))return t=(i.clientWidth-1)/100,Math.max(e,Math.floor(_xeUtils.default.toInteger(l)*t));if((0,_dom.isPx)(l))return Math.max(e,_xeUtils.default.toInteger(l))}}return-1}function getColReMinWidth(e){var{$table:t,column:l,cell:o}=e,r=t,i=t,n=t.computeResizableOpts,t=t.computeColumnOpts,n=n.minWidth;if(n){e=_xeUtils.default.isFunction(n)?n(e):n;if("auto"!==e)return Math.max(1,_xeUtils.default.toNumber(e))}var a,u,s,n=i.elemStore,e=r.showHeaderOverflow,i=l.showHeaderOverflow,r=l.minWidth||t.minWidth,l=_xeUtils.default.isUndefined(i)||_xeUtils.default.isNull(i)?e:i,t="title"===l||(!0===l||"tooltip"===l)||"ellipsis"===l;let d=_xeUtils.default.floor(1.8*(_xeUtils.default.toNumber(getComputedStyle(o).fontSize)||14))+(getPaddingLeftRightSize(o)+getPaddingLeftRightSize((0,_dom.queryElement)(o,".vxe-cell")));if(t&&(e=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--drag-handle")),i=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--checkbox")),l=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--required-icon")),t=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--edit-icon")),a=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell-title-prefix-icon")),u=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell-title-suffix-icon")),s=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--sort")),o=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--filter")),d+=e+i+l+t+a+u+o+s),r){e=getRefElem(n["main-body-scroll"]);if(e){if((0,_dom.isScale)(r))return i=(e.clientWidth-1)/100,Math.max(d,Math.floor(_xeUtils.default.toInteger(r)*i));if((0,_dom.isPx)(r))return Math.max(d,_xeUtils.default.toInteger(r))}}return d}function getFirstChildColumn(e){var t=e.children;return t&&t.length?getFirstChildColumn(_xeUtils.default.first(t)):e}function getLastChildColumn(e){var t=e.children;return t&&t.length?getFirstChildColumn(_xeUtils.default.last(t)):e}function getCellValue(e,t){return t?_xeUtils.default.get(e,t.field):null}function setCellValue(e,t,l){t&&_xeUtils.default.set(e,t.field,l)}function getRefElem(e){return e?e.$el||e:null}function clearTableDefaultStatus(e){var t=e,l=(e.initStatus=!1,[e.clearSort(),e.clearCurrentRow(),e.clearCurrentColumn(),e.clearRadioRow(),e.clearRadioReserve(),e.clearCheckboxRow(),e.clearCheckboxReserve(),e.clearRowExpand(),e.clearTreeExpand(),e.clearTreeExpandReserve(),e.clearPendingRow()]);return e.clearFilter&&l.push(e.clearFilter()),e.clearSelected&&(t.keyboardConfig||t.mouseConfig)&&l.push(e.clearSelected()),e.clearCellAreas&&t.mouseConfig&&l.push(e.clearCellAreas(),e.clearCopyCellArea()),Promise.all(l).then(()=>e.clearScroll())}function clearTableAllStatus(e){return e.clearFilter&&e.clearFilter(),clearTableDefaultStatus(e)}function isColumnInfo(e){return e instanceof _columnInfo.ColumnInfo}function getColumnList(e){let t=[];return e.forEach(e=>{t.push(...e.children&&e.children.length?getColumnList(e.children):[e])}),t}function createColumn(e,t,l){return isColumnInfo(t)?t:new _columnInfo.ColumnInfo(e,t,l)}function rowToVisible(e,t){var{scrollYLoad:l,scrollYTop:o,isAllOverflow:r}=e,{elemStore:i,afterFullData:n,fullAllDataRowIdData:a,isResizeCellHeight:u}=e,s=e.computeRowOpts,d=e.computeCellOpts,c=e.computeDefaultRowHeight,m=e.computeLeftFixedWidth,g=e.computeRightFixedWidth,i=getRefElem(i["main-body-scroll"]),p=getRowid(e,t);if(i){var f=i.clientHeight,h=i.scrollTop,i=i.querySelector(`[rowid="${p}"]`);if(i){var o=i.offsetTop+(l?o:0),i=i.clientHeight;if(o<h||h+f<o)return e.scrollTo(null,o);if(f+h<=o+i)return e.scrollTo(null,h+i)}else if(l)return u||d.height||s.height||!r?(i=(o=a[p]||{}).resizeHeight||d.height||s.height||o.height||c,(l=o.oTop)<h?e.scrollTo(null,l-m-1):e.scrollTo(null,l+i-(f-g-1))):e.scrollTo(null,(e.findRowIndexOf(n,t)-1)*c)}return Promise.resolve()}function colToVisible(l,o,r,t){var{scrollXLoad:i,scrollXLeft:n}=l,{elemStore:a,visibleColumn:u}=l,s=l.computeLeftFixedWidth,d=l.computeRightFixedWidth,a=getRefElem(a["main-body-scroll"]);if(!r.fixed&&a){var c=a.clientWidth,m=a.scrollLeft;let e=null;if(t&&(t=getRowid(l,t),e=a.querySelector(`[rowid="${t}"] .`+r.id)),e=e||a.querySelector("."+r.id)){t=e.offsetLeft+(i?n:0),a=e.clientWidth;if(o||!(t<=m+s&&m+s<t+a)&&!(m+s<=t&&t<m+c-d)){if(t<m+s)return l.scrollTo(t-s-1);if(c-d<t+a-m)return l.scrollTo(t+a-(c-d-1))}}else if(i){let t=0;n=r.renderWidth;for(let e=0;e<u.length;e++){var g=u[e];if(g===r||g.id===r.id)break;t+=g.renderWidth}if(o||!(t<=m+s&&t+n>m+s)&&!(t>=m+s&&t<m+c-d))return t<m?l.scrollTo(t-s-1):l.scrollTo(t+n-(c-d-1))}}return Promise.resolve()}exports.convertHeaderColumnToRows=convertHeaderColumnToRows;
package/lib/ui/index.js CHANGED
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "VxeUI", {
13
13
  exports.version = exports.validators = exports.use = exports.t = exports.setup = exports.setTheme = exports.setLanguage = exports.setIcon = exports.setI18n = exports.setConfig = exports.saveFile = exports.renderer = exports.readFile = exports.print = exports.modal = exports.menus = exports.log = exports.interceptor = exports.globalResize = exports.globalEvents = exports.getTheme = exports.getIcon = exports.getI18n = exports.getConfig = exports.formats = exports.default = exports.config = exports.commands = exports.clipboard = exports._t = void 0;
14
14
  var _core = require("@vxe-ui/core");
15
15
  var _utils = require("./src/utils");
16
- const version = exports.version = "3.21.5";
16
+ const version = exports.version = "3.21.6";
17
17
  _core.VxeUI.version = version;
18
18
  _core.VxeUI.tableVersion = version;
19
19
  _core.VxeUI.setConfig({
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.VXETable=void 0,Object.defineProperty(exports,"VxeUI",{enumerable:!0,get:function(){return _core.VxeUI}}),exports.version=exports.validators=exports.use=exports.t=exports.setup=exports.setTheme=exports.setLanguage=exports.setIcon=exports.setI18n=exports.setConfig=exports.saveFile=exports.renderer=exports.readFile=exports.print=exports.modal=exports.menus=exports.log=exports.interceptor=exports.globalResize=exports.globalEvents=exports.getTheme=exports.getIcon=exports.getI18n=exports.getConfig=exports.formats=exports.default=exports.config=exports.commands=exports.clipboard=exports._t=void 0;var _core=require("@vxe-ui/core"),_utils=require("./src/utils");let version=exports.version="3.21.5",iconPrefix=(_core.VxeUI.version=version,_core.VxeUI.tableVersion=version,_core.VxeUI.setConfig({emptyCell:" ",table:{fit:!0,showHeader:!0,animat:!0,delayHover:250,autoResize:!0,padding:!0,resizeConfig:{},resizableConfig:{dragMode:"auto",showDragTip:!0,isSyncAutoHeight:!0,isSyncAutoWidth:!0,minHeight:18},currentRowConfig:{strict:!0},currentColumnConfig:{strict:!0},radioConfig:{strict:!0},rowDragConfig:{showIcon:!0,animation:!0,showGuidesStatus:!0,showDragTip:!0},columnDragConfig:{showIcon:!0,animation:!0,showGuidesStatus:!0,showDragTip:!0},checkboxConfig:{strict:!0},tooltipConfig:{enterable:!0,defaultPlacement:"top"},headerTooltipConfig:{enterable:!0},footerTooltipConfig:{enterable:!0},validConfig:{showErrorMessage:!0,autoClear:!0,autoPos:!0,message:"inline",msgMode:"single",theme:"beautify"},columnConfig:{autoOptions:{isCalcHeader:!0,isCalcBody:!0,isCalcFooter:!0},maxFixedSize:4},cellConfig:{padding:!0},headerCellConfig:{height:"unset"},footerCellConfig:{height:"unset"},menuConfig:{destroyOnClose:!0},customConfig:{allowVisible:!0,allowResizable:!0,allowFixed:!0,allowSort:!0,showSortDragButton:!0,showFooter:!0,placement:"top-right",storeOptions:{visible:!0,resizable:!0,sort:!0,fixed:!0},modalOptions:{showMaximize:!0,mask:!0,lockView:!0,resize:!0,escClosable:!0},drawerOptions:{mask:!0,lockView:!0,escClosable:!0,resize:!0}},sortConfig:{showIcon:!0,allowClear:!0,allowBtn:!0,iconLayout:"vertical"},filterConfig:{destroyOnClose:!0,multiple:!0,showIcon:!0,maxHeight:280},floatingFilterConfig:{},aggregateConfig:{padding:!0,placement:"left",rowField:"id",parentField:"_X_ROW_PARENT_KEY",childrenField:"_X_ROW_CHILDREN",mapChildrenField:"_X_ROW_CHILD_LIST",indent:20,showIcon:!0,maxGroupSize:4,showAggFuncTitle:!0},treeConfig:{padding:!0,rowField:"id",parentField:"parentId",childrenField:"children",hasChildField:"hasChild",mapChildrenField:"_X_ROW_CHILD",indent:20,showIcon:!0,showRootLine:!0},expandConfig:{showIcon:!0,mode:"fixed"},editConfig:{showIcon:!0,showAsterisk:!0,autoFocus:!0},importConfig:{_typeMaps:{csv:1,html:1,xml:1,txt:1}},exportConfig:{_typeMaps:{csv:1,html:1,xml:1,txt:1}},printConfig:{},mouseConfig:{extension:!0},keyboardConfig:{isAll:!0,isEsc:!0},areaConfig:{autoClear:!0,selectCellByHeader:!0,selectCellByBody:!0,extendDirection:{top:!0,left:!0,bottom:!0,right:!0}},clipConfig:{isCopy:!0,isCut:!0,isPaste:!0},fnrConfig:{isFind:!0,isReplace:!0},virtualXConfig:{gt:24,preSize:0,oSize:0},virtualYConfig:{gt:100,preSize:1,oSize:0},scrollbarConfig:{x:{visible:!0},y:{visible:!0}},undoRedoHistoryConfig:{stackSize:50}},grid:{formConfig:{enabled:!0},pagerConfig:{enabled:!0},toolbarConfig:{enabled:!0},proxyConfig:{enabled:!0,autoLoad:!0,showLoading:!0,showResponseMsg:!0,showActionMsg:!0,response:{list:"list",result:"result",total:"page.total",footerData:"footerData",message:"message"}}},toolbar:{},gantt:{}}),"vxe-table-icon-"),setTheme=(_core.VxeUI.setIcon({TABLE_SORT_ASC:iconPrefix+"caret-up",TABLE_SORT_DESC:iconPrefix+"caret-down",TABLE_FILTER_NONE:iconPrefix+"funnel",TABLE_FILTER_MATCH:iconPrefix+"funnel",TABLE_EDIT:iconPrefix+"edit",TABLE_TITLE_PREFIX:iconPrefix+"question-circle-fill",TABLE_TITLE_SUFFIX:iconPrefix+"question-circle-fill",TABLE_TREE_LOADED:iconPrefix+"spinner roll",TABLE_TREE_OPEN:iconPrefix+"caret-right rotate90",TABLE_TREE_CLOSE:iconPrefix+"caret-right",TABLE_EXPAND_LOADED:iconPrefix+"spinner roll",TABLE_EXPAND_OPEN:iconPrefix+"arrow-right rotate90",TABLE_EXPAND_CLOSE:iconPrefix+"arrow-right",TABLE_CHECKBOX_CHECKED:iconPrefix+"checkbox-checked-fill",TABLE_CHECKBOX_UNCHECKED:iconPrefix+"checkbox-unchecked",TABLE_CHECKBOX_INDETERMINATE:iconPrefix+"checkbox-indeterminate-fill",TABLE_CHECKBOX_DISABLED_UNCHECKED:iconPrefix+"checkbox-unchecked-fill",TABLE_RADIO_CHECKED:iconPrefix+"radio-checked-fill",TABLE_RADIO_UNCHECKED:iconPrefix+"radio-unchecked",TABLE_RADIO_DISABLED_UNCHECKED:iconPrefix+"radio-unchecked-fill",TABLE_CUSTOM_SORT:iconPrefix+"drag-handle",TABLE_MENU_OPTIONS:iconPrefix+"arrow-right",TABLE_MENU_OPTION_LOADING:iconPrefix+"repeat roll",TABLE_DRAG_ROW:iconPrefix+"drag-handle",TABLE_DRAG_COLUMN:iconPrefix+"drag-handle",TABLE_DRAG_STATUS_ROW:iconPrefix+"sort",TABLE_DRAG_STATUS_SUB_ROW:iconPrefix+"add-sub",TABLE_DRAG_STATUS_AGG_GROUP:iconPrefix+"grouping",TABLE_DRAG_STATUS_AGG_VALUES:iconPrefix+"values",TABLE_DRAG_STATUS_COLUMN:iconPrefix+"swap",TABLE_DRAG_DISABLED:iconPrefix+"no-drop",TABLE_ROW_GROUP_OPEN:iconPrefix+"arrow-right rotate90",TABLE_ROW_GROUP_CLOSE:iconPrefix+"arrow-right",TABLE_AGGREGATE_GROUPING:iconPrefix+"grouping",TABLE_AGGREGATE_VALUES:iconPrefix+"values",TABLE_AGGREGATE_SORT:iconPrefix+"drag-handle",TABLE_AGGREGATE_DELETE:iconPrefix+"close",TOOLBAR_TOOLS_REFRESH:iconPrefix+"repeat",TOOLBAR_TOOLS_REFRESH_LOADING:iconPrefix+"repeat roll",TOOLBAR_TOOLS_IMPORT:iconPrefix+"upload",TOOLBAR_TOOLS_EXPORT:iconPrefix+"download",TOOLBAR_TOOLS_PRINT:iconPrefix+"print",TOOLBAR_TOOLS_FULLSCREEN:iconPrefix+"fullscreen",TOOLBAR_TOOLS_MINIMIZE:iconPrefix+"minimize",TOOLBAR_TOOLS_CUSTOM:iconPrefix+"custom-column",TOOLBAR_TOOLS_FIXED_LEFT:iconPrefix+"fixed-left",TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE:iconPrefix+"fixed-left-fill",TOOLBAR_TOOLS_FIXED_RIGHT:iconPrefix+"fixed-right",TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE:iconPrefix+"fixed-right-fill"}),exports.setTheme=_core.VxeUI.setTheme),getTheme=exports.getTheme=_core.VxeUI.getTheme,setConfig=exports.setConfig=_core.VxeUI.setConfig,getConfig=exports.getConfig=_core.VxeUI.getConfig,setIcon=exports.setIcon=_core.VxeUI.setIcon,getIcon=exports.getIcon=_core.VxeUI.getIcon,setLanguage=exports.setLanguage=_core.VxeUI.setLanguage,setI18n=exports.setI18n=_core.VxeUI.setI18n,getI18n=exports.getI18n=_core.VxeUI.getI18n,globalEvents=exports.globalEvents=_core.VxeUI.globalEvents,globalResize=exports.globalResize=_core.VxeUI.globalResize,renderer=exports.renderer=_core.VxeUI.renderer,validators=exports.validators=_core.VxeUI.validators,menus=exports.menus=_core.VxeUI.menus,formats=exports.formats=_core.VxeUI.formats,commands=exports.commands=_core.VxeUI.commands,interceptor=exports.interceptor=_core.VxeUI.interceptor,clipboard=exports.clipboard=_core.VxeUI.clipboard,log=exports.log=_core.VxeUI.log,use=exports.use=_core.VxeUI.use,setup=e=>_core.VxeUI.setConfig(e),config=(exports.setup=setup,_core.VxeUI.setup=setup,e=>_core.VxeUI.setConfig(e)),t=(exports.config=config,_core.VxeUI.config=config,(e,o)=>_core.VxeUI.getI18n(e,o)),_t=(exports.t=t,_core.VxeUI.t=t,(e,o)=>(0,_utils.getFuncText)(e,o)),VXETable=(exports._t=_t,_core.VxeUI._t=_t,exports.VXETable=_core.VxeUI),saveFile=e=>_core.VxeUI.saveFile(e),readFile=(exports.saveFile=saveFile,e=>_core.VxeUI.readFile(e)),print=(exports.readFile=readFile,e=>_core.VxeUI.print(e)),modal=(exports.print=print,exports.modal={get(e){return _core.VxeUI.modal.get(e)},close(e){return _core.VxeUI.modal.close(e)},open(e){return _core.VxeUI.modal.open(e)},alert(e,o,r){return _core.VxeUI.modal.alert(e,o,r)},confirm(e,o,r){return _core.VxeUI.modal.confirm(e,o,r)},message(e,o){return _core.VxeUI.modal.message(e,o)},notification(e,o,r){return _core.VxeUI.modal.notification(e,o,r)}});var _default=exports.default=_core.VxeUI;
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.VXETable=void 0,Object.defineProperty(exports,"VxeUI",{enumerable:!0,get:function(){return _core.VxeUI}}),exports.version=exports.validators=exports.use=exports.t=exports.setup=exports.setTheme=exports.setLanguage=exports.setIcon=exports.setI18n=exports.setConfig=exports.saveFile=exports.renderer=exports.readFile=exports.print=exports.modal=exports.menus=exports.log=exports.interceptor=exports.globalResize=exports.globalEvents=exports.getTheme=exports.getIcon=exports.getI18n=exports.getConfig=exports.formats=exports.default=exports.config=exports.commands=exports.clipboard=exports._t=void 0;var _core=require("@vxe-ui/core"),_utils=require("./src/utils");let version=exports.version="3.21.6",iconPrefix=(_core.VxeUI.version=version,_core.VxeUI.tableVersion=version,_core.VxeUI.setConfig({emptyCell:" ",table:{fit:!0,showHeader:!0,animat:!0,delayHover:250,autoResize:!0,padding:!0,resizeConfig:{},resizableConfig:{dragMode:"auto",showDragTip:!0,isSyncAutoHeight:!0,isSyncAutoWidth:!0,minHeight:18},currentRowConfig:{strict:!0},currentColumnConfig:{strict:!0},radioConfig:{strict:!0},rowDragConfig:{showIcon:!0,animation:!0,showGuidesStatus:!0,showDragTip:!0},columnDragConfig:{showIcon:!0,animation:!0,showGuidesStatus:!0,showDragTip:!0},checkboxConfig:{strict:!0},tooltipConfig:{enterable:!0,defaultPlacement:"top"},headerTooltipConfig:{enterable:!0},footerTooltipConfig:{enterable:!0},validConfig:{showErrorMessage:!0,autoClear:!0,autoPos:!0,message:"inline",msgMode:"single",theme:"beautify"},columnConfig:{autoOptions:{isCalcHeader:!0,isCalcBody:!0,isCalcFooter:!0},maxFixedSize:4},cellConfig:{padding:!0},headerCellConfig:{height:"unset"},footerCellConfig:{height:"unset"},menuConfig:{destroyOnClose:!0},customConfig:{allowVisible:!0,allowResizable:!0,allowFixed:!0,allowSort:!0,showSortDragButton:!0,showFooter:!0,placement:"top-right",storeOptions:{visible:!0,resizable:!0,sort:!0,fixed:!0},modalOptions:{showMaximize:!0,mask:!0,lockView:!0,resize:!0,escClosable:!0},drawerOptions:{mask:!0,lockView:!0,escClosable:!0,resize:!0}},sortConfig:{showIcon:!0,allowClear:!0,allowBtn:!0,iconLayout:"vertical"},filterConfig:{destroyOnClose:!0,multiple:!0,showIcon:!0,maxHeight:280},floatingFilterConfig:{},aggregateConfig:{padding:!0,placement:"left",rowField:"id",parentField:"_X_ROW_PARENT_KEY",childrenField:"_X_ROW_CHILDREN",mapChildrenField:"_X_ROW_CHILD_LIST",indent:20,showIcon:!0,maxGroupSize:4,showAggFuncTitle:!0},treeConfig:{padding:!0,rowField:"id",parentField:"parentId",childrenField:"children",hasChildField:"hasChild",mapChildrenField:"_X_ROW_CHILD",indent:20,showIcon:!0,showRootLine:!0},expandConfig:{showIcon:!0,mode:"fixed"},editConfig:{showIcon:!0,showAsterisk:!0,autoFocus:!0},importConfig:{_typeMaps:{csv:1,html:1,xml:1,txt:1}},exportConfig:{_typeMaps:{csv:1,html:1,xml:1,txt:1}},printConfig:{},mouseConfig:{extension:!0},keyboardConfig:{isAll:!0,isEsc:!0},areaConfig:{autoClear:!0,selectCellByHeader:!0,selectCellByBody:!0,extendDirection:{top:!0,left:!0,bottom:!0,right:!0}},clipConfig:{isCopy:!0,isCut:!0,isPaste:!0},fnrConfig:{isFind:!0,isReplace:!0},virtualXConfig:{gt:24,preSize:0,oSize:0},virtualYConfig:{gt:100,preSize:1,oSize:0},scrollbarConfig:{x:{visible:!0},y:{visible:!0}},undoRedoHistoryConfig:{stackSize:50}},grid:{formConfig:{enabled:!0},pagerConfig:{enabled:!0},toolbarConfig:{enabled:!0},proxyConfig:{enabled:!0,autoLoad:!0,showLoading:!0,showResponseMsg:!0,showActionMsg:!0,response:{list:"list",result:"result",total:"page.total",footerData:"footerData",message:"message"}}},toolbar:{},gantt:{}}),"vxe-table-icon-"),setTheme=(_core.VxeUI.setIcon({TABLE_SORT_ASC:iconPrefix+"caret-up",TABLE_SORT_DESC:iconPrefix+"caret-down",TABLE_FILTER_NONE:iconPrefix+"funnel",TABLE_FILTER_MATCH:iconPrefix+"funnel",TABLE_EDIT:iconPrefix+"edit",TABLE_TITLE_PREFIX:iconPrefix+"question-circle-fill",TABLE_TITLE_SUFFIX:iconPrefix+"question-circle-fill",TABLE_TREE_LOADED:iconPrefix+"spinner roll",TABLE_TREE_OPEN:iconPrefix+"caret-right rotate90",TABLE_TREE_CLOSE:iconPrefix+"caret-right",TABLE_EXPAND_LOADED:iconPrefix+"spinner roll",TABLE_EXPAND_OPEN:iconPrefix+"arrow-right rotate90",TABLE_EXPAND_CLOSE:iconPrefix+"arrow-right",TABLE_CHECKBOX_CHECKED:iconPrefix+"checkbox-checked-fill",TABLE_CHECKBOX_UNCHECKED:iconPrefix+"checkbox-unchecked",TABLE_CHECKBOX_INDETERMINATE:iconPrefix+"checkbox-indeterminate-fill",TABLE_CHECKBOX_DISABLED_UNCHECKED:iconPrefix+"checkbox-unchecked-fill",TABLE_RADIO_CHECKED:iconPrefix+"radio-checked-fill",TABLE_RADIO_UNCHECKED:iconPrefix+"radio-unchecked",TABLE_RADIO_DISABLED_UNCHECKED:iconPrefix+"radio-unchecked-fill",TABLE_CUSTOM_SORT:iconPrefix+"drag-handle",TABLE_MENU_OPTIONS:iconPrefix+"arrow-right",TABLE_MENU_OPTION_LOADING:iconPrefix+"repeat roll",TABLE_DRAG_ROW:iconPrefix+"drag-handle",TABLE_DRAG_COLUMN:iconPrefix+"drag-handle",TABLE_DRAG_STATUS_ROW:iconPrefix+"sort",TABLE_DRAG_STATUS_SUB_ROW:iconPrefix+"add-sub",TABLE_DRAG_STATUS_AGG_GROUP:iconPrefix+"grouping",TABLE_DRAG_STATUS_AGG_VALUES:iconPrefix+"values",TABLE_DRAG_STATUS_COLUMN:iconPrefix+"swap",TABLE_DRAG_DISABLED:iconPrefix+"no-drop",TABLE_ROW_GROUP_OPEN:iconPrefix+"arrow-right rotate90",TABLE_ROW_GROUP_CLOSE:iconPrefix+"arrow-right",TABLE_AGGREGATE_GROUPING:iconPrefix+"grouping",TABLE_AGGREGATE_VALUES:iconPrefix+"values",TABLE_AGGREGATE_SORT:iconPrefix+"drag-handle",TABLE_AGGREGATE_DELETE:iconPrefix+"close",TOOLBAR_TOOLS_REFRESH:iconPrefix+"repeat",TOOLBAR_TOOLS_REFRESH_LOADING:iconPrefix+"repeat roll",TOOLBAR_TOOLS_IMPORT:iconPrefix+"upload",TOOLBAR_TOOLS_EXPORT:iconPrefix+"download",TOOLBAR_TOOLS_PRINT:iconPrefix+"print",TOOLBAR_TOOLS_FULLSCREEN:iconPrefix+"fullscreen",TOOLBAR_TOOLS_MINIMIZE:iconPrefix+"minimize",TOOLBAR_TOOLS_CUSTOM:iconPrefix+"custom-column",TOOLBAR_TOOLS_FIXED_LEFT:iconPrefix+"fixed-left",TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE:iconPrefix+"fixed-left-fill",TOOLBAR_TOOLS_FIXED_RIGHT:iconPrefix+"fixed-right",TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE:iconPrefix+"fixed-right-fill"}),exports.setTheme=_core.VxeUI.setTheme),getTheme=exports.getTheme=_core.VxeUI.getTheme,setConfig=exports.setConfig=_core.VxeUI.setConfig,getConfig=exports.getConfig=_core.VxeUI.getConfig,setIcon=exports.setIcon=_core.VxeUI.setIcon,getIcon=exports.getIcon=_core.VxeUI.getIcon,setLanguage=exports.setLanguage=_core.VxeUI.setLanguage,setI18n=exports.setI18n=_core.VxeUI.setI18n,getI18n=exports.getI18n=_core.VxeUI.getI18n,globalEvents=exports.globalEvents=_core.VxeUI.globalEvents,globalResize=exports.globalResize=_core.VxeUI.globalResize,renderer=exports.renderer=_core.VxeUI.renderer,validators=exports.validators=_core.VxeUI.validators,menus=exports.menus=_core.VxeUI.menus,formats=exports.formats=_core.VxeUI.formats,commands=exports.commands=_core.VxeUI.commands,interceptor=exports.interceptor=_core.VxeUI.interceptor,clipboard=exports.clipboard=_core.VxeUI.clipboard,log=exports.log=_core.VxeUI.log,use=exports.use=_core.VxeUI.use,setup=e=>_core.VxeUI.setConfig(e),config=(exports.setup=setup,_core.VxeUI.setup=setup,e=>_core.VxeUI.setConfig(e)),t=(exports.config=config,_core.VxeUI.config=config,(e,o)=>_core.VxeUI.getI18n(e,o)),_t=(exports.t=t,_core.VxeUI.t=t,(e,o)=>(0,_utils.getFuncText)(e,o)),VXETable=(exports._t=_t,_core.VxeUI._t=_t,exports.VXETable=_core.VxeUI),saveFile=e=>_core.VxeUI.saveFile(e),readFile=(exports.saveFile=saveFile,e=>_core.VxeUI.readFile(e)),print=(exports.readFile=readFile,e=>_core.VxeUI.print(e)),modal=(exports.print=print,exports.modal={get(e){return _core.VxeUI.modal.get(e)},close(e){return _core.VxeUI.modal.close(e)},open(e){return _core.VxeUI.modal.open(e)},alert(e,o,r){return _core.VxeUI.modal.alert(e,o,r)},confirm(e,o,r){return _core.VxeUI.modal.confirm(e,o,r)},message(e,o){return _core.VxeUI.modal.message(e,o)},notification(e,o,r){return _core.VxeUI.modal.notification(e,o,r)}});var _default=exports.default=_core.VxeUI;
package/lib/ui/src/log.js CHANGED
@@ -8,6 +8,6 @@ var _core = require("@vxe-ui/core");
8
8
  const {
9
9
  log
10
10
  } = _core.VxeUI;
11
- const version = `table v${"3.21.5"}`;
11
+ const version = `table v${"3.21.6"}`;
12
12
  const warnLog = exports.warnLog = log.create('warn', version);
13
13
  const errLog = exports.errLog = log.create('error', version);
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core");let log=_core.VxeUI.log,version="table v3.21.5",warnLog=exports.warnLog=log.create("warn",version),errLog=exports.errLog=log.create("error",version);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core");let log=_core.VxeUI.log,version="table v3.21.6",warnLog=exports.warnLog=log.create("warn",version),errLog=exports.errLog=log.create("error",version);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-table",
3
- "version": "3.21.5",
3
+ "version": "3.21.6",
4
4
  "description": "A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.",
5
5
  "scripts": {
6
6
  "update": "npm install --legacy-peer-deps",
@@ -68,7 +68,7 @@
68
68
  "vue-i18n": "^8.15.1",
69
69
  "vue-router": "^3.5.1",
70
70
  "vue-template-compiler": "2.6.14",
71
- "vxe-pc-ui": "3.14.25"
71
+ "vxe-pc-ui": "3.14.26"
72
72
  },
73
73
  "vetur": {
74
74
  "tags": "helper/vetur/tags.json",
@@ -3,7 +3,7 @@ import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollLe
3
3
  import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
4
4
  import { VxeUI } from '../../ui'
5
5
  import Cell from './cell'
6
- import { getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight, getLastChildColumn } from './util'
6
+ import { getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight, getLastChildColumn } from './util'
7
7
  import { getSlotVNs } from '../../ui/src/vn'
8
8
  import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from '../../ui/src/anime'
9
9
  import { warnLog, errLog } from '../../ui/src/log'
@@ -2418,6 +2418,7 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
2418
2418
  if (!xHandleEl) {
2419
2419
  return
2420
2420
  }
2421
+ const columnOpts = $xeTable.computeColumnOpts
2421
2422
  let tWidth = 0
2422
2423
  const minCellWidth = 40 // 列宽最少限制 40px
2423
2424
  const bodyWidth = bodyWrapperElem.clientWidth
@@ -2426,53 +2427,92 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
2426
2427
  const { fit } = props
2427
2428
  const { columnStore } = reactData
2428
2429
  const { resizeList, pxMinList, autoMinList, pxList, scaleList, scaleMinList, autoList, remainList } = columnStore
2430
+
2431
+ const parseColumnMaxWidth = (column: VxeTableDefines.ColumnInfo) => {
2432
+ const maxWidth = column.maxWidth || columnOpts.maxWidth
2433
+ if (maxWidth && maxWidth !== 'auto') {
2434
+ if (isScale(maxWidth)) {
2435
+ return Math.floor(XEUtils.toInteger(maxWidth) * meanWidth)
2436
+ }
2437
+ return XEUtils.toInteger(maxWidth)
2438
+ }
2439
+ return 0
2440
+ }
2441
+
2429
2442
  // 最小宽
2430
2443
  pxMinList.forEach((column) => {
2431
- const minWidth = XEUtils.toInteger(column.minWidth)
2432
- tWidth += minWidth
2433
- column.renderWidth = minWidth
2444
+ let miWidth = XEUtils.toInteger(column.minWidth)
2445
+ const mxWidth = parseColumnMaxWidth(column)
2446
+ if (mxWidth) {
2447
+ miWidth = Math.min(miWidth, mxWidth)
2448
+ }
2449
+ tWidth += miWidth
2450
+ column.renderWidth = miWidth
2434
2451
  })
2435
2452
  // 最小自适应
2436
2453
  autoMinList.forEach((column) => {
2437
- const scaleWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
2438
- tWidth += scaleWidth
2439
- column.renderWidth = scaleWidth
2454
+ let caWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
2455
+ const mxWidth = parseColumnMaxWidth(column)
2456
+ if (mxWidth) {
2457
+ caWidth = Math.min(caWidth, mxWidth)
2458
+ }
2459
+ tWidth += caWidth
2460
+ column.renderWidth = caWidth
2440
2461
  })
2441
2462
  // 最小百分比
2442
2463
  scaleMinList.forEach((column) => {
2443
- const scaleWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth)
2444
- tWidth += scaleWidth
2445
- column.renderWidth = scaleWidth
2464
+ let smWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth)
2465
+ const mxWidth = parseColumnMaxWidth(column)
2466
+ if (mxWidth) {
2467
+ smWidth = Math.min(smWidth, mxWidth)
2468
+ }
2469
+ tWidth += smWidth
2470
+ column.renderWidth = smWidth
2446
2471
  })
2447
2472
  // 固定百分比
2448
2473
  scaleList.forEach((column) => {
2449
- const scaleWidth = Math.floor(XEUtils.toInteger(column.width) * meanWidth)
2450
- tWidth += scaleWidth
2451
- column.renderWidth = scaleWidth
2474
+ let sfWidth = Math.floor(XEUtils.toInteger(column.width) * meanWidth)
2475
+ const mxWidth = parseColumnMaxWidth(column)
2476
+ if (mxWidth) {
2477
+ sfWidth = Math.min(sfWidth, mxWidth)
2478
+ }
2479
+ tWidth += sfWidth
2480
+ column.renderWidth = sfWidth
2452
2481
  })
2453
2482
  // 固定宽
2454
2483
  pxList.forEach((column) => {
2455
- const width = XEUtils.toInteger(column.width)
2456
- tWidth += width
2457
- column.renderWidth = width
2484
+ let pWidth = XEUtils.toInteger(column.width)
2485
+ const mxWidth = parseColumnMaxWidth(column)
2486
+ if (mxWidth) {
2487
+ pWidth = Math.min(pWidth, mxWidth)
2488
+ }
2489
+ tWidth += pWidth
2490
+ column.renderWidth = pWidth
2458
2491
  })
2459
2492
  // 自适应宽
2460
2493
  autoList.forEach((column) => {
2461
- const width = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
2462
- tWidth += width
2463
- column.renderWidth = width
2494
+ let aWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
2495
+ const mxWidth = parseColumnMaxWidth(column)
2496
+ if (mxWidth) {
2497
+ aWidth = Math.min(aWidth, mxWidth)
2498
+ }
2499
+ tWidth += aWidth
2500
+ column.renderWidth = aWidth
2464
2501
  })
2502
+
2465
2503
  // 调整了列宽
2466
2504
  resizeList.forEach((column) => {
2467
2505
  const width = XEUtils.toInteger(column.resizeWidth)
2468
2506
  tWidth += width
2469
2507
  column.renderWidth = width
2470
2508
  })
2509
+
2510
+ const zoomColumnList = scaleMinList.concat(pxMinList).concat(autoMinList).filter(column => !parseColumnMaxWidth(column))
2471
2511
  remainWidth -= tWidth
2472
- meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0
2512
+ meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (zoomColumnList.length + remainList.length)) : 0
2473
2513
  if (fit) {
2474
2514
  if (remainWidth > 0) {
2475
- scaleMinList.concat(pxMinList).concat(autoMinList).forEach((column) => {
2515
+ zoomColumnList.forEach((column) => {
2476
2516
  tWidth += meanWidth
2477
2517
  column.renderWidth += meanWidth
2478
2518
  })
@@ -2490,8 +2530,9 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
2490
2530
  /**
2491
2531
  * 偏移量算法
2492
2532
  * 如果所有列足够放的情况下,从最后动态列开始分配
2533
+ * 排除已设置 max-width
2493
2534
  */
2494
- const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList)
2535
+ const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList).filter(column => !parseColumnMaxWidth(column))
2495
2536
  let dynamicSize = dynamicList.length - 1
2496
2537
  if (dynamicSize > 0) {
2497
2538
  let i = bodyWidth - tWidth
@@ -6773,6 +6814,7 @@ const tableMethods: any = {
6773
6814
  const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth
6774
6815
 
6775
6816
  const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth // 列之间的最小间距
6817
+ const maxInterval = getColReMaxWidth(cellParams) // 列之间的最大间距
6776
6818
  const dragMinLeft = isRightFixed ? 0 : (cellRect.x - tableRect.x + dragBtnWidth + minInterval)
6777
6819
  const dragMaxLeft = cellRect.x - tableRect.x + cell.clientWidth - minInterval
6778
6820
 
@@ -6814,6 +6856,10 @@ const tableMethods: any = {
6814
6856
  }
6815
6857
 
6816
6858
  dragLeft = Math.max(left, dragMinLeft)
6859
+ // 最大宽
6860
+ if (maxInterval > 1) {
6861
+ dragLeft = Math.min(dragLeft, maxInterval + dragMinLeft - minInterval)
6862
+ }
6817
6863
 
6818
6864
  const resizeBarLeft = Math.max(1, dragLeft)
6819
6865
  resizeBarElem.style.left = `${resizeBarLeft}px`
@@ -6901,6 +6947,7 @@ const tableMethods: any = {
6901
6947
  const cell = dragBtnElem.parentNode as HTMLTableCellElement
6902
6948
  const cellParams = Object.assign(params, { cell, $table: $xeTable })
6903
6949
  const colMinWidth = getColReMinWidth(cellParams)
6950
+ const colMaxWidth = getColReMaxWidth(cellParams)
6904
6951
 
6905
6952
  el.setAttribute('data-calc-col', 'Y')
6906
6953
  let resizeWidth = calcColumnAutoWidth($xeTable, resizeColumn, el)
@@ -6909,6 +6956,9 @@ const tableMethods: any = {
6909
6956
  resizeWidth = Math.max(resizeWidth, colRest.width)
6910
6957
  }
6911
6958
  resizeWidth = Math.max(colMinWidth, resizeWidth)
6959
+ if (colMaxWidth > 1) {
6960
+ resizeWidth = Math.min(colMaxWidth, resizeWidth)
6961
+ }
6912
6962
  const resizeParams = { ...params, resizeWidth, resizeColumn }
6913
6963
  reactData.isDragResize = false
6914
6964
  internalData._lastResizeTime = Date.now()
@@ -775,10 +775,66 @@ export function toFilters (filters: any, colid?: string) {
775
775
  return filters
776
776
  }
777
777
 
778
- export function getColReMinWidth (params: any) {
778
+ /**
779
+ * 列宽拖动最大宽度
780
+ */
781
+ export function getColReMaxWidth (params: {
782
+ $table: VxeTableConstructor & VxeTablePrivateMethods;
783
+ column: VxeTableDefines.ColumnInfo;
784
+ columnIndex: number;
785
+ $columnIndex: number;
786
+ $rowIndex: number;
787
+ cell: HTMLTableCellElement;
788
+ }) {
789
+ const { $table, column, cell } = params
790
+ const internalData = $table as unknown as TableInternalData
791
+ const { elemStore } = internalData
792
+ const resizableOpts = $table.computeResizableOpts
793
+ const columnOpts = $table.computeColumnOpts
794
+ const { maxWidth: reMaxWidth } = resizableOpts
795
+ const colMaxWidth = column.maxWidth || columnOpts.maxWidth
796
+ // 如果自定义调整宽度逻辑
797
+ if (reMaxWidth) {
798
+ const customMaxWidth = XEUtils.isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth
799
+ if (customMaxWidth !== 'auto') {
800
+ return Math.max(1, XEUtils.toNumber(customMaxWidth))
801
+ }
802
+ }
803
+ const minTitleWidth = XEUtils.floor((XEUtils.toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8)
804
+ const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryElement(cell, '.vxe-cell'))
805
+ const mWidth = minTitleWidth + paddingLeftRight
806
+ // 如果设置最小宽
807
+ if (colMaxWidth) {
808
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
809
+ if (bodyScrollElem) {
810
+ if (isScale(colMaxWidth)) {
811
+ const bodyWidth = bodyScrollElem.clientWidth - 1
812
+ const meanWidth = bodyWidth / 100
813
+ return Math.max(mWidth, Math.floor(XEUtils.toInteger(colMaxWidth) * meanWidth))
814
+ } else if (isPx(colMaxWidth)) {
815
+ return Math.max(mWidth, XEUtils.toInteger(colMaxWidth))
816
+ }
817
+ }
818
+ }
819
+ return -1
820
+ }
821
+
822
+ /**
823
+ * 列宽拖动最小宽度
824
+ */
825
+ export function getColReMinWidth (params: {
826
+ $table: VxeTableConstructor & VxeTablePrivateMethods;
827
+ column: VxeTableDefines.ColumnInfo;
828
+ columnIndex: number;
829
+ $columnIndex: number;
830
+ $rowIndex: number;
831
+ cell: HTMLTableCellElement;
832
+ }) {
779
833
  const { $table, column, cell } = params
780
- const internalData = $table
781
- const { showHeaderOverflow: allColumnHeaderOverflow, resizableOpts } = $table
834
+ const tableProps = $table
835
+ const internalData = $table as unknown as TableInternalData
836
+ const resizableOpts = $table.computeResizableOpts
837
+ const columnOpts = $table.computeColumnOpts
782
838
  const { minWidth } = resizableOpts
783
839
  // 如果自定义调整宽度逻辑
784
840
  if (minWidth) {
@@ -788,7 +844,9 @@ export function getColReMinWidth (params: any) {
788
844
  }
789
845
  }
790
846
  const { elemStore } = internalData
791
- const { showHeaderOverflow, minWidth: colMinWidth } = column
847
+ const { showHeaderOverflow: allColumnHeaderOverflow } = tableProps
848
+ const { showHeaderOverflow } = column
849
+ const colMinWidth = column.minWidth || columnOpts.minWidth
792
850
  const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow
793
851
  const showEllipsis = headOverflow === 'ellipsis'
794
852
  const showTitle = headOverflow === 'title'