vxe-table 4.19.5 → 4.19.7
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/dist/all.esm.js +126 -33
- package/dist/style.css +1 -1
- package/es/style.css +1 -1
- package/es/table/src/body.js +11 -11
- package/es/table/src/emits.js +1 -0
- package/es/table/src/group.js +3 -0
- package/es/table/src/table.js +68 -17
- package/es/table/src/util.js +27 -8
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +68 -40
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/body.js +11 -11
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/emits.js +1 -1
- package/lib/table/src/emits.min.js +1 -1
- package/lib/table/src/group.js +3 -0
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/table.js +19 -16
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +30 -7
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- 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 +2 -2
- package/packages/table/src/body.ts +13 -13
- package/packages/table/src/emits.ts +1 -0
- package/packages/table/src/group.ts +4 -0
- package/packages/table/src/table.ts +73 -18
- package/packages/table/src/util.ts +26 -8
- /package/es/{iconfont.1780200147870.ttf → iconfont.1780638747281.ttf} +0 -0
- /package/es/{iconfont.1780200147870.woff → iconfont.1780638747281.woff} +0 -0
- /package/es/{iconfont.1780200147870.woff2 → iconfont.1780638747281.woff2} +0 -0
- /package/lib/{iconfont.1780200147870.ttf → iconfont.1780638747281.ttf} +0 -0
- /package/lib/{iconfont.1780200147870.woff → iconfont.1780638747281.woff} +0 -0
- /package/lib/{iconfont.1780200147870.woff2 → iconfont.1780638747281.woff2} +0 -0
package/lib/table/src/util.js
CHANGED
|
@@ -759,20 +759,27 @@ function getCalcHeight(height) {
|
|
|
759
759
|
}
|
|
760
760
|
/**
|
|
761
761
|
* 列宽拖动最大宽度
|
|
762
|
-
* @param params
|
|
763
|
-
* @returns
|
|
764
762
|
*/
|
|
765
763
|
function getColReMaxWidth(params) {
|
|
766
764
|
const {
|
|
767
|
-
$table
|
|
765
|
+
$table,
|
|
766
|
+
column,
|
|
767
|
+
cell
|
|
768
768
|
} = params;
|
|
769
|
+
const internalData = $table.internalData;
|
|
769
770
|
const {
|
|
771
|
+
elemStore
|
|
772
|
+
} = internalData;
|
|
773
|
+
const {
|
|
774
|
+
computeColumnOpts,
|
|
770
775
|
computeResizableOpts
|
|
771
776
|
} = $table.getComputeMaps();
|
|
772
777
|
const resizableOpts = computeResizableOpts.value;
|
|
778
|
+
const columnOpts = computeColumnOpts.value;
|
|
773
779
|
const {
|
|
774
780
|
maxWidth: reMaxWidth
|
|
775
781
|
} = resizableOpts;
|
|
782
|
+
const colMaxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
776
783
|
// 如果自定义调整宽度逻辑
|
|
777
784
|
if (reMaxWidth) {
|
|
778
785
|
const customMaxWidth = _xeUtils.default.isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
|
|
@@ -780,12 +787,26 @@ function getColReMaxWidth(params) {
|
|
|
780
787
|
return Math.max(1, _xeUtils.default.toNumber(customMaxWidth));
|
|
781
788
|
}
|
|
782
789
|
}
|
|
790
|
+
const minTitleWidth = _xeUtils.default.floor((_xeUtils.default.toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8);
|
|
791
|
+
const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize((0, _dom.queryElement)(cell, '.vxe-cell'));
|
|
792
|
+
const mWidth = minTitleWidth + paddingLeftRight;
|
|
793
|
+
// 如果设置最小宽
|
|
794
|
+
if (colMaxWidth) {
|
|
795
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
796
|
+
if (bodyScrollElem) {
|
|
797
|
+
if ((0, _dom.isScale)(colMaxWidth)) {
|
|
798
|
+
const bodyWidth = bodyScrollElem.clientWidth - 1;
|
|
799
|
+
const meanWidth = bodyWidth / 100;
|
|
800
|
+
return Math.max(mWidth, Math.floor(_xeUtils.default.toInteger(colMaxWidth) * meanWidth));
|
|
801
|
+
} else if ((0, _dom.isPx)(colMaxWidth)) {
|
|
802
|
+
return Math.max(mWidth, _xeUtils.default.toInteger(colMaxWidth));
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
783
806
|
return -1;
|
|
784
807
|
}
|
|
785
808
|
/**
|
|
786
809
|
* 列宽拖动最小宽度
|
|
787
|
-
* @param params
|
|
788
|
-
* @returns
|
|
789
810
|
*/
|
|
790
811
|
function getColReMinWidth(params) {
|
|
791
812
|
const {
|
|
@@ -796,9 +817,11 @@ function getColReMinWidth(params) {
|
|
|
796
817
|
const tableProps = $table.props;
|
|
797
818
|
const internalData = $table.internalData;
|
|
798
819
|
const {
|
|
820
|
+
computeColumnOpts,
|
|
799
821
|
computeResizableOpts
|
|
800
822
|
} = $table.getComputeMaps();
|
|
801
823
|
const resizableOpts = computeResizableOpts.value;
|
|
824
|
+
const columnOpts = computeColumnOpts.value;
|
|
802
825
|
const {
|
|
803
826
|
minWidth: reMinWidth
|
|
804
827
|
} = resizableOpts;
|
|
@@ -816,9 +839,9 @@ function getColReMinWidth(params) {
|
|
|
816
839
|
showHeaderOverflow: allColumnHeaderOverflow
|
|
817
840
|
} = tableProps;
|
|
818
841
|
const {
|
|
819
|
-
showHeaderOverflow
|
|
820
|
-
minWidth: colMinWidth
|
|
842
|
+
showHeaderOverflow
|
|
821
843
|
} = column;
|
|
844
|
+
const colMinWidth = column.minWidth || columnOpts.minWidth;
|
|
822
845
|
const headOverflow = _xeUtils.default.isUndefined(showHeaderOverflow) || _xeUtils.default.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
823
846
|
const showEllipsis = headOverflow === 'ellipsis';
|
|
824
847
|
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.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,exports.watchColumn=watchColumn;var _vue=require("vue"),_xeUtils=_interopRequireDefault(require("xe-utils")),_columnInfo=require("./columnInfo"),_dom=require("../../ui/src/dom"),_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),a=[],n=[];for(let e=0;e<l;e++){var o=[],r=[];for(let e=0;e<i;e++)o.push(!1),r.push("");a.push(o),n.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(a[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(a[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++)a[t][e]=!0,n[t][e]=u;e=o+s}}return n}function restoreScrollLocation(e,t,l){var o=e.internalData;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 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.internalData.currKeyField;return e}function getRowid(e,t){var{isCurrDeepKey:e,currKeyField:l}=e.internalData;return t?encodeRowid((e?getDeepRowIdByKey:getFastRowIdByKey)(t,l)):""}function createHandleUpdateRowId(e){let{isCurrDeepKey:t,currKeyField:l}=e.internalData;e=e.getComputeMaps().computeRowOpts;let o=e.value,r=t?updateDeepRowKey:updateFastRowKey;return{rowKey:l,handleUpdateRowId(e){return e?r(o,e,l):""}}}function createHandleGetRowId(e){let{isCurrDeepKey:t,currKeyField:l}=e.internalData,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 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 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 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 toTreePathSeq(e){return e.map((e,t)=>t%2==0?Number(e)+1:".").join("")}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){if(e){e=e.value;if(e)return e.$el||e}return null}function getCalcHeight(e){return"unset"!==e&&e||0}function getColReMaxWidth(e){var t=e.$table,t=t.getComputeMaps().computeResizableOpts,t=t.value.maxWidth;if(t){e=_xeUtils.default.isFunction(t)?t(e):t;if("auto"!==e)return Math.max(1,_xeUtils.default.toNumber(e))}return-1}function getColReMinWidth(e){var{$table:t,column:l,cell:o}=e,r=t.props,i=t.internalData,t=t.getComputeMaps().computeResizableOpts,t=t.value.minWidth;if(t){e=_xeUtils.default.isFunction(t)?t(e):t;if("auto"!==e)return Math.max(1,_xeUtils.default.toNumber(e))}var a,n,u,s,t=i.elemStore,e=r.showHeaderOverflow,{showHeaderOverflow:i,minWidth:r}=l,l=_xeUtils.default.isUndefined(i)||_xeUtils.default.isNull(i)?e:i,e="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(e&&(i=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--drag-handle")),l=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--checkbox")),e=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--required-icon")),a=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--edit-icon")),n=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+=i+l+e+a+n+u+o+s),r){i=getRefElem(t["main-body-scroll"]);if(i){if((0,_dom.isScale)(r))return l=(i.clientWidth-1)/100,Math.max(d,Math.floor(_xeUtils.default.toInteger(r)*l));if((0,_dom.isPx)(r))return Math.max(d,_xeUtils.default.toInteger(r))}}return d}function isColumnInfo(e){return e&&(e.constructor===_columnInfo.ColumnInfo||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:(0,_vue.reactive)(new _columnInfo.ColumnInfo(e,t,l))}function watchColumn(l,e,o){Object.keys(e).forEach(t=>{(0,_vue.watch)(()=>e[t],e=>{o.update(t,e),l&&("filters"===t?(l.setFilter(o,e),l.handleUpdateDataQueue()):["visible","fixed","width","minWidth","maxWidth"].includes(t)&&l.handleRefreshColumnQueue())})})}function assembleColumn(e,t,l,o){var e=e.reactData,r=e.staticColumns,i=t.parentNode,o=o?o.columnConfig:null,a=o?o.children:r;i&&a&&(l.defaultParentId=o?o.id:null,a.splice(_xeUtils.default.arrayIndexOf(i.children,t),0,l),e.staticColumns=r.slice(0))}function destroyColumn(e,t){var e=e.reactData,l=e.staticColumns,o=_xeUtils.default.findTree(l,e=>e.id===t.id,{children:"children"});o&&o.items.splice(o.index,1),e.staticColumns=l.slice(0)}function getRootColumn(e,t){var e=e.internalData,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 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 clearTableDefaultStatus(e){var{props:t,internalData:l}=e,l=(l.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 rowToVisible(e,t){var l=e.reactData,o=e.internalData,{computeLeftFixedWidth:r,computeRightFixedWidth:i,computeRowOpts:a,computeCellOpts:n,computeDefaultRowHeight:u}=e.getComputeMaps(),{scrollYLoad:l,scrollYTop:s,isAllOverflow:d}=l,{elemStore:o,afterFullData:c,fullAllDataRowIdData:p,isResizeCellHeight:m}=o,a=a.value,n=n.value,u=u.value,r=r.value,i=i.value,o=getRefElem(o["main-body-scroll"]),g=getRowid(e,t);if(o){var f=o.clientHeight,h=o.scrollTop,o=o.querySelector(`[rowid="${g}"]`);if(o){var s=o.offsetTop+(l?s:0),o=o.clientHeight;if(s<h||h+f<s)return e.scrollTo(null,s);if(f+h<=s+o)return e.scrollTo(null,h+o)}else if(l)return m||n.height||a.height||!d?(o=(s=p[g]||{}).resizeHeight||n.height||a.height||s.height||u,(l=s.oTop)<h?e.scrollTo(null,l-r-1):e.scrollTo(null,l+o-(f-i-1))):e.scrollTo(null,(e.findRowIndexOf(c,t)-1)*u)}return Promise.resolve()}function colToVisible(l,o,r,t){var i=l.reactData,a=l.internalData,{computeLeftFixedWidth:n,computeRightFixedWidth:u}=l.getComputeMaps(),{scrollXLoad:i,scrollXLeft:s}=i,{elemStore:a,visibleColumn:d}=a,n=n.value,u=u.value,a=getRefElem(a["main-body-scroll"]);if(!r.fixed&&a){var c=a.clientWidth,p=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?s:0),a=e.clientWidth;if(o||!(t<=p+n&&p+n<t+a)&&!(p+n<=t&&t<p+c-u)){if(t<p+n)return l.scrollTo(t-n-1);if(c-u<t+a-p)return l.scrollTo(t+a-(c-u-1))}}else if(i){let t=0;s=r.renderWidth;for(let e=0;e<d.length;e++){var m=d[e];if(m===r||m.id===r.id)break;t+=m.renderWidth}if(o||!(t<=p+n&&t+s>p+n)&&!(t>=p+n&&t<p+c-u))return t<p?l.scrollTo(t-n-1):l.scrollTo(t+s-(c-u-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,exports.watchColumn=watchColumn;var _vue=require("vue"),_xeUtils=_interopRequireDefault(require("xe-utils")),_columnInfo=require("./columnInfo"),_dom=require("../../ui/src/dom"),_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),a=[],n=[];for(let e=0;e<l;e++){var o=[],r=[];for(let e=0;e<i;e++)o.push(!1),r.push("");a.push(o),n.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(a[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(a[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++)a[t][e]=!0,n[t][e]=u;e=o+s}}return n}function restoreScrollLocation(e,t,l){var o=e.internalData;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 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.internalData.currKeyField;return e}function getRowid(e,t){var{isCurrDeepKey:e,currKeyField:l}=e.internalData;return t?encodeRowid((e?getDeepRowIdByKey:getFastRowIdByKey)(t,l)):""}function createHandleUpdateRowId(e){let{isCurrDeepKey:t,currKeyField:l}=e.internalData;e=e.getComputeMaps().computeRowOpts;let o=e.value,r=t?updateDeepRowKey:updateFastRowKey;return{rowKey:l,handleUpdateRowId(e){return e?r(o,e,l):""}}}function createHandleGetRowId(e){let{isCurrDeepKey:t,currKeyField:l}=e.internalData,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 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 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 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 toTreePathSeq(e){return e.map((e,t)=>t%2==0?Number(e)+1:".").join("")}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){if(e){e=e.value;if(e)return e.$el||e}return null}function getCalcHeight(e){return"unset"!==e&&e||0}function getColReMaxWidth(e){var{$table:t,column:l,cell:o}=e,r=t.internalData.elemStore,{computeColumnOpts:t,computeResizableOpts:i}=t.getComputeMaps(),i=i.value,t=t.value,i=i.maxWidth,l=l.maxWidth||t.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.props,i=t.internalData,{computeColumnOpts:t,computeResizableOpts:a}=t.getComputeMaps(),a=a.value,t=t.value,a=a.minWidth;if(a){e=_xeUtils.default.isFunction(a)?a(e):a;if("auto"!==e)return Math.max(1,_xeUtils.default.toNumber(e))}var n,u,s,a=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")),n=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+n+u+o+s),r){e=getRefElem(a["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 isColumnInfo(e){return e&&(e.constructor===_columnInfo.ColumnInfo||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:(0,_vue.reactive)(new _columnInfo.ColumnInfo(e,t,l))}function watchColumn(l,e,o){Object.keys(e).forEach(t=>{(0,_vue.watch)(()=>e[t],e=>{o.update(t,e),l&&("filters"===t?(l.setFilter(o,e),l.handleUpdateDataQueue()):["visible","fixed","width","minWidth","maxWidth"].includes(t)&&l.handleRefreshColumnQueue())})})}function assembleColumn(e,t,l,o){var e=e.reactData,r=e.staticColumns,i=t.parentNode,o=o?o.columnConfig:null,a=o?o.children:r;i&&a&&(l.defaultParentId=o?o.id:null,a.splice(_xeUtils.default.arrayIndexOf(i.children,t),0,l),e.staticColumns=r.slice(0))}function destroyColumn(e,t){var e=e.reactData,l=e.staticColumns,o=_xeUtils.default.findTree(l,e=>e.id===t.id,{children:"children"});o&&o.items.splice(o.index,1),e.staticColumns=l.slice(0)}function getRootColumn(e,t){var e=e.internalData,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 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 clearTableDefaultStatus(e){var{props:t,internalData:l}=e,l=(l.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 rowToVisible(e,t){var l=e.reactData,o=e.internalData,{computeLeftFixedWidth:r,computeRightFixedWidth:i,computeRowOpts:a,computeCellOpts:n,computeDefaultRowHeight:u}=e.getComputeMaps(),{scrollYLoad:l,scrollYTop:s,isAllOverflow:d}=l,{elemStore:o,afterFullData:c,fullAllDataRowIdData:m,isResizeCellHeight:p}=o,a=a.value,n=n.value,u=u.value,r=r.value,i=i.value,o=getRefElem(o["main-body-scroll"]),f=getRowid(e,t);if(o){var g=o.clientHeight,h=o.scrollTop,o=o.querySelector(`[rowid="${f}"]`);if(o){var s=o.offsetTop+(l?s:0),o=o.clientHeight;if(s<h||h+g<s)return e.scrollTo(null,s);if(g+h<=s+o)return e.scrollTo(null,h+o)}else if(l)return p||n.height||a.height||!d?(o=(s=m[f]||{}).resizeHeight||n.height||a.height||s.height||u,(l=s.oTop)<h?e.scrollTo(null,l-r-1):e.scrollTo(null,l+o-(g-i-1))):e.scrollTo(null,(e.findRowIndexOf(c,t)-1)*u)}return Promise.resolve()}function colToVisible(l,o,r,t){var i=l.reactData,a=l.internalData,{computeLeftFixedWidth:n,computeRightFixedWidth:u}=l.getComputeMaps(),{scrollXLoad:i,scrollXLeft:s}=i,{elemStore:a,visibleColumn:d}=a,n=n.value,u=u.value,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?s:0),a=e.clientWidth;if(o||!(t<=m+n&&m+n<t+a)&&!(m+n<=t&&t<m+c-u)){if(t<m+n)return l.scrollTo(t-n-1);if(c-u<t+a-m)return l.scrollTo(t+a-(c-u-1))}}else if(i){let t=0;s=r.renderWidth;for(let e=0;e<d.length;e++){var p=d[e];if(p===r||p.id===r.id)break;t+=p.renderWidth}if(o||!(t<=m+n&&t+s>m+n)&&!(t>=m+n&&t<m+c-u))return t<m?l.scrollTo(t-n-1):l.scrollTo(t+s-(c-u-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.hooks = 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 = "4.19.
|
|
16
|
+
const version = exports.version = "4.19.7";
|
|
17
17
|
_core.VxeUI.version = version;
|
|
18
18
|
_core.VxeUI.tableVersion = version;
|
|
19
19
|
_core.VxeUI.setConfig({
|
package/lib/ui/index.min.js
CHANGED
|
@@ -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.hooks=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="4.19.
|
|
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.hooks=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="4.19.7",iconPrefix=(_core.VxeUI.version=version,_core.VxeUI.tableVersion=version,_core.VxeUI.setConfig({emptyCell:" ",table:{fit:!0,showHeader:!0,animat:!0,delayHover:250,autoResize:!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:1,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,hooks=exports.hooks=_core.VxeUI.hooks,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${"4.19.
|
|
11
|
+
const version = `table v${"4.19.7"}`;
|
|
12
12
|
const warnLog = exports.warnLog = log.create('warn', version);
|
|
13
13
|
const errLog = exports.errLog = log.create('error', version);
|
package/lib/ui/src/log.min.js
CHANGED
|
@@ -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 v4.19.
|
|
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 v4.19.7",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": "4.19.
|
|
3
|
+
"version": "4.19.7",
|
|
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",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"typescript": "~4.7.4",
|
|
70
70
|
"vue": "3.4.27",
|
|
71
71
|
"vue-router": "~4.5.1",
|
|
72
|
-
"vxe-pc-ui": "4.14.
|
|
72
|
+
"vxe-pc-ui": "4.14.29"
|
|
73
73
|
},
|
|
74
74
|
"vetur": {
|
|
75
75
|
"tags": "helper/vetur/tags.json",
|
|
@@ -376,23 +376,11 @@ export default defineVxeComponent({
|
|
|
376
376
|
}, column.renderCell(cellParams))
|
|
377
377
|
)
|
|
378
378
|
}
|
|
379
|
-
tdVNs.push(
|
|
380
|
-
h('div', {
|
|
381
|
-
key: 'tc',
|
|
382
|
-
class: ['vxe-cell', {
|
|
383
|
-
'c--title': showTitle,
|
|
384
|
-
'c--tooltip': showTooltip,
|
|
385
|
-
'c--ellipsis': showEllipsis
|
|
386
|
-
}],
|
|
387
|
-
style: tcStyle,
|
|
388
|
-
title: showTitle ? $xeTable.getCellLabel(row, column) : null
|
|
389
|
-
}, clVNs)
|
|
390
|
-
)
|
|
391
379
|
if (showValidTip && errorValidItem) {
|
|
392
380
|
const errRule = errorValidItem.rule
|
|
393
381
|
const validSlot = slots ? slots.valid : null
|
|
394
382
|
const validParams = { ...cellParams, ...errorValidItem, rule: errorValidItem }
|
|
395
|
-
|
|
383
|
+
clVNs.push(
|
|
396
384
|
h('div', {
|
|
397
385
|
key: 'tcv',
|
|
398
386
|
class: ['vxe-cell--valid-error-tip', getPropClass(validOpts.className, validParams)],
|
|
@@ -416,6 +404,18 @@ export default defineVxeComponent({
|
|
|
416
404
|
])
|
|
417
405
|
)
|
|
418
406
|
}
|
|
407
|
+
tdVNs.push(
|
|
408
|
+
h('div', {
|
|
409
|
+
key: 'tc',
|
|
410
|
+
class: ['vxe-cell', {
|
|
411
|
+
'c--title': showTitle,
|
|
412
|
+
'c--tooltip': showTooltip,
|
|
413
|
+
'c--ellipsis': showEllipsis
|
|
414
|
+
}],
|
|
415
|
+
style: tcStyle,
|
|
416
|
+
title: showTitle ? $xeTable.getCellLabel(row, column) : null
|
|
417
|
+
}, clVNs)
|
|
418
|
+
)
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
let showAreaRowStatus = false
|
|
@@ -19,11 +19,15 @@ export default defineVxeComponent({
|
|
|
19
19
|
const columnConfig = Cell.createColumn($xeTable, props)
|
|
20
20
|
const columnSlots: {
|
|
21
21
|
header?: Slot
|
|
22
|
+
title?: Slot
|
|
22
23
|
} = {}
|
|
23
24
|
|
|
24
25
|
if (slots.header) {
|
|
25
26
|
columnSlots.header = slots.header
|
|
26
27
|
}
|
|
28
|
+
if (slots.title) {
|
|
29
|
+
columnSlots.title = slots.title
|
|
30
|
+
}
|
|
27
31
|
|
|
28
32
|
columnConfig.slots = columnSlots
|
|
29
33
|
columnConfig.children = []
|
|
@@ -4,7 +4,7 @@ import XEUtils from 'xe-utils'
|
|
|
4
4
|
import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollTopTo, wheelScrollLeftTo, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey, checkTargetElement, hasEventInputTarget } from '../../ui/src/dom'
|
|
5
5
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
|
|
6
6
|
import { VxeUI } from '../../ui'
|
|
7
|
-
import { createReactData, createInternalData, getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight, getLastChildColumn } from './util'
|
|
7
|
+
import { createReactData, createInternalData, getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight, getLastChildColumn } from './util'
|
|
8
8
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
9
9
|
import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from '../../ui/src/anime'
|
|
10
10
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
@@ -1962,6 +1962,7 @@ export default defineVxeComponent({
|
|
|
1962
1962
|
if (!xHandleEl) {
|
|
1963
1963
|
return
|
|
1964
1964
|
}
|
|
1965
|
+
const columnOpts = computeColumnOpts.value
|
|
1965
1966
|
let tWidth = 0
|
|
1966
1967
|
const minCellWidth = 40 // 列宽最少限制 40px
|
|
1967
1968
|
const bodyWidth = bodyWrapperElem.clientWidth
|
|
@@ -1970,53 +1971,92 @@ export default defineVxeComponent({
|
|
|
1970
1971
|
const { fit } = props
|
|
1971
1972
|
const { columnStore } = reactData
|
|
1972
1973
|
const { resizeList, pxMinList, autoMinList, pxList, scaleList, scaleMinList, autoList, remainList } = columnStore
|
|
1974
|
+
|
|
1975
|
+
const parseColumnMaxWidth = (column: VxeTableDefines.ColumnInfo) => {
|
|
1976
|
+
const maxWidth = column.maxWidth || columnOpts.maxWidth
|
|
1977
|
+
if (maxWidth && maxWidth !== 'auto') {
|
|
1978
|
+
if (isScale(maxWidth)) {
|
|
1979
|
+
return Math.floor(XEUtils.toInteger(maxWidth) * meanWidth)
|
|
1980
|
+
}
|
|
1981
|
+
return XEUtils.toInteger(maxWidth)
|
|
1982
|
+
}
|
|
1983
|
+
return 0
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1973
1986
|
// 最小宽
|
|
1974
1987
|
pxMinList.forEach((column) => {
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1988
|
+
let miWidth = XEUtils.toInteger(column.minWidth)
|
|
1989
|
+
const mxWidth = parseColumnMaxWidth(column)
|
|
1990
|
+
if (mxWidth) {
|
|
1991
|
+
miWidth = Math.min(miWidth, mxWidth)
|
|
1992
|
+
}
|
|
1993
|
+
tWidth += miWidth
|
|
1994
|
+
column.renderWidth = miWidth
|
|
1978
1995
|
})
|
|
1979
1996
|
// 最小自适应
|
|
1980
1997
|
autoMinList.forEach((column) => {
|
|
1981
|
-
|
|
1998
|
+
let caWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
|
|
1999
|
+
const mxWidth = parseColumnMaxWidth(column)
|
|
2000
|
+
if (mxWidth) {
|
|
2001
|
+
caWidth = Math.min(caWidth, mxWidth)
|
|
2002
|
+
}
|
|
1982
2003
|
tWidth += caWidth
|
|
1983
2004
|
column.renderWidth = caWidth
|
|
1984
2005
|
})
|
|
1985
2006
|
// 最小百分比
|
|
1986
2007
|
scaleMinList.forEach((column) => {
|
|
1987
|
-
|
|
2008
|
+
let smWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth)
|
|
2009
|
+
const mxWidth = parseColumnMaxWidth(column)
|
|
2010
|
+
if (mxWidth) {
|
|
2011
|
+
smWidth = Math.min(smWidth, mxWidth)
|
|
2012
|
+
}
|
|
1988
2013
|
tWidth += smWidth
|
|
1989
2014
|
column.renderWidth = smWidth
|
|
1990
2015
|
})
|
|
1991
2016
|
// 固定百分比
|
|
1992
2017
|
scaleList.forEach((column) => {
|
|
1993
|
-
|
|
2018
|
+
let sfWidth = Math.floor(XEUtils.toInteger(column.width) * meanWidth)
|
|
2019
|
+
const mxWidth = parseColumnMaxWidth(column)
|
|
2020
|
+
if (mxWidth) {
|
|
2021
|
+
sfWidth = Math.min(sfWidth, mxWidth)
|
|
2022
|
+
}
|
|
1994
2023
|
tWidth += sfWidth
|
|
1995
2024
|
column.renderWidth = sfWidth
|
|
1996
2025
|
})
|
|
1997
2026
|
// 固定宽
|
|
1998
2027
|
pxList.forEach((column) => {
|
|
1999
|
-
|
|
2028
|
+
let pWidth = XEUtils.toInteger(column.width)
|
|
2029
|
+
const mxWidth = parseColumnMaxWidth(column)
|
|
2030
|
+
if (mxWidth) {
|
|
2031
|
+
pWidth = Math.min(pWidth, mxWidth)
|
|
2032
|
+
}
|
|
2000
2033
|
tWidth += pWidth
|
|
2001
2034
|
column.renderWidth = pWidth
|
|
2002
2035
|
})
|
|
2003
2036
|
// 自适应宽
|
|
2004
2037
|
autoList.forEach((column) => {
|
|
2005
|
-
|
|
2038
|
+
let aWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
|
|
2039
|
+
const mxWidth = parseColumnMaxWidth(column)
|
|
2040
|
+
if (mxWidth) {
|
|
2041
|
+
aWidth = Math.min(aWidth, mxWidth)
|
|
2042
|
+
}
|
|
2006
2043
|
tWidth += aWidth
|
|
2007
2044
|
column.renderWidth = aWidth
|
|
2008
2045
|
})
|
|
2046
|
+
|
|
2009
2047
|
// 调整了列宽
|
|
2010
2048
|
resizeList.forEach((column) => {
|
|
2011
2049
|
const reWidth = XEUtils.toInteger(column.resizeWidth)
|
|
2012
2050
|
tWidth += reWidth
|
|
2013
2051
|
column.renderWidth = reWidth
|
|
2014
2052
|
})
|
|
2053
|
+
|
|
2054
|
+
const zoomColumnList = scaleMinList.concat(pxMinList).concat(autoMinList).filter(column => !parseColumnMaxWidth(column))
|
|
2015
2055
|
remainWidth -= tWidth
|
|
2016
|
-
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (
|
|
2056
|
+
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (zoomColumnList.length + remainList.length)) : 0
|
|
2017
2057
|
if (fit) {
|
|
2018
2058
|
if (remainWidth > 0) {
|
|
2019
|
-
|
|
2059
|
+
zoomColumnList.forEach((column) => {
|
|
2020
2060
|
tWidth += meanWidth
|
|
2021
2061
|
column.renderWidth += meanWidth
|
|
2022
2062
|
})
|
|
@@ -2034,8 +2074,9 @@ export default defineVxeComponent({
|
|
|
2034
2074
|
/**
|
|
2035
2075
|
* 偏移量算法
|
|
2036
2076
|
* 如果所有列足够放的情况下,从最后动态列开始分配
|
|
2077
|
+
* 排除已设置 max-width
|
|
2037
2078
|
*/
|
|
2038
|
-
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList)
|
|
2079
|
+
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList).filter(column => !parseColumnMaxWidth(column))
|
|
2039
2080
|
let dynamicSize = dynamicList.length - 1
|
|
2040
2081
|
if (dynamicSize > 0) {
|
|
2041
2082
|
let i = bodyWidth - tWidth
|
|
@@ -2529,7 +2570,7 @@ export default defineVxeComponent({
|
|
|
2529
2570
|
}
|
|
2530
2571
|
|
|
2531
2572
|
let yScrollbarVisible = overflowY ? 'visible' : 'hidden'
|
|
2532
|
-
if ((scrollbarYConf.visible === 'hidden' || scrollbarYConf.visible === false) || ($xeGanttView && !scrollbarYToLeft)) {
|
|
2573
|
+
if ((scrollbarYConf.visible === 'hidden' || scrollbarYConf.visible === false) || (($xeGantt && $xeGanttView && $xeGantt.reactData.showRightView) && !scrollbarYToLeft)) {
|
|
2533
2574
|
osbWidth = 0
|
|
2534
2575
|
yScrollbarVisible = 'hidden'
|
|
2535
2576
|
} else if (scrollbarYConf.visible === 'visible') {
|
|
@@ -3871,6 +3912,7 @@ export default defineVxeComponent({
|
|
|
3871
3912
|
updateStyle()
|
|
3872
3913
|
}).then(() => {
|
|
3873
3914
|
computeScrollLoad()
|
|
3915
|
+
syncGanttScrollYStatus()
|
|
3874
3916
|
}).then(() => {
|
|
3875
3917
|
const virtualYOpts = computeVirtualYOpts.value
|
|
3876
3918
|
// 是否启用了虚拟滚动
|
|
@@ -3933,6 +3975,7 @@ export default defineVxeComponent({
|
|
|
3933
3975
|
reactData.isRowLoading = false
|
|
3934
3976
|
handleRecalculateStyle(false, false, false)
|
|
3935
3977
|
updateTreeLineStyle()
|
|
3978
|
+
syncGanttScrollYStatus()
|
|
3936
3979
|
|
|
3937
3980
|
// 如果是自动行高,特殊情况需调用 recalculate 手动刷新
|
|
3938
3981
|
if (!props.showOverflow) {
|
|
@@ -4257,9 +4300,15 @@ export default defineVxeComponent({
|
|
|
4257
4300
|
return scrollXLoad
|
|
4258
4301
|
}
|
|
4259
4302
|
|
|
4303
|
+
const syncGanttScrollYStatus = () => {
|
|
4304
|
+
const $xeGanttView = internalData.xeGanttView
|
|
4305
|
+
if ($xeGanttView && $xeGanttView.handleUpdateSYStatus) {
|
|
4306
|
+
$xeGanttView.handleUpdateSYStatus(reactData.scrollYLoad)
|
|
4307
|
+
}
|
|
4308
|
+
}
|
|
4309
|
+
|
|
4260
4310
|
const updateScrollYStatus = (fullData?: any[]) => {
|
|
4261
4311
|
const { treeConfig } = props
|
|
4262
|
-
const $xeGanttView = internalData.xeGanttView
|
|
4263
4312
|
const virtualYOpts = computeVirtualYOpts.value
|
|
4264
4313
|
const treeOpts = computeTreeOpts.value
|
|
4265
4314
|
const { transform } = treeOpts
|
|
@@ -4267,9 +4316,7 @@ export default defineVxeComponent({
|
|
|
4267
4316
|
// 如果gt为0,则总是启用
|
|
4268
4317
|
const scrollYLoad = (transform || !treeConfig) && !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length)
|
|
4269
4318
|
reactData.scrollYLoad = scrollYLoad
|
|
4270
|
-
|
|
4271
|
-
$xeGanttView.handleUpdateSYStatus(scrollYLoad)
|
|
4272
|
-
}
|
|
4319
|
+
syncGanttScrollYStatus()
|
|
4273
4320
|
return scrollYLoad
|
|
4274
4321
|
}
|
|
4275
4322
|
|
|
@@ -9553,6 +9600,7 @@ export default defineVxeComponent({
|
|
|
9553
9600
|
const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth
|
|
9554
9601
|
|
|
9555
9602
|
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth // 列之间的最小间距
|
|
9603
|
+
const maxInterval = getColReMaxWidth(cellParams) // 列之间的最大间距
|
|
9556
9604
|
const dragMinLeft = isRightFixed ? 0 : (cellRect.x - tableRect.x + dragBtnWidth + minInterval)
|
|
9557
9605
|
const dragMaxLeft = cellRect.x - tableRect.x + cell.clientWidth - minInterval
|
|
9558
9606
|
|
|
@@ -9594,7 +9642,10 @@ export default defineVxeComponent({
|
|
|
9594
9642
|
}
|
|
9595
9643
|
|
|
9596
9644
|
dragLeft = Math.max(left, dragMinLeft)
|
|
9597
|
-
|
|
9645
|
+
// 最大宽
|
|
9646
|
+
if (maxInterval > 1) {
|
|
9647
|
+
dragLeft = Math.min(dragLeft, maxInterval + dragMinLeft - minInterval)
|
|
9648
|
+
}
|
|
9598
9649
|
const resizeBarLeft = Math.max(1, dragLeft)
|
|
9599
9650
|
resizeBarElem.style.left = `${resizeBarLeft}px`
|
|
9600
9651
|
resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`
|
|
@@ -9677,6 +9728,7 @@ export default defineVxeComponent({
|
|
|
9677
9728
|
const cell = dragBtnElem.parentNode as HTMLTableCellElement
|
|
9678
9729
|
const cellParams = Object.assign(params, { cell, $table: $xeTable })
|
|
9679
9730
|
const colMinWidth = getColReMinWidth(cellParams)
|
|
9731
|
+
const colMaxWidth = getColReMaxWidth(cellParams)
|
|
9680
9732
|
|
|
9681
9733
|
el.setAttribute('data-calc-col', 'Y')
|
|
9682
9734
|
let resizeWidth = calcColumnAutoWidth(resizeColumn, el)
|
|
@@ -9685,6 +9737,9 @@ export default defineVxeComponent({
|
|
|
9685
9737
|
resizeWidth = Math.max(resizeWidth, colRest.width)
|
|
9686
9738
|
}
|
|
9687
9739
|
resizeWidth = Math.max(colMinWidth, resizeWidth)
|
|
9740
|
+
if (colMaxWidth > 1) {
|
|
9741
|
+
resizeWidth = Math.min(colMaxWidth, resizeWidth)
|
|
9742
|
+
}
|
|
9688
9743
|
const resizeParams = { ...params, resizeWidth, resizeColumn }
|
|
9689
9744
|
reactData.isDragResize = false
|
|
9690
9745
|
internalData._lastResizeTime = Date.now()
|
|
@@ -751,8 +751,6 @@ export function getCalcHeight (height: number | 'unset' | undefined | null) {
|
|
|
751
751
|
|
|
752
752
|
/**
|
|
753
753
|
* 列宽拖动最大宽度
|
|
754
|
-
* @param params
|
|
755
|
-
* @returns
|
|
756
754
|
*/
|
|
757
755
|
export function getColReMaxWidth (params: {
|
|
758
756
|
$table: VxeTableConstructor & VxeTablePrivateMethods;
|
|
@@ -762,10 +760,14 @@ export function getColReMaxWidth (params: {
|
|
|
762
760
|
$rowIndex: number;
|
|
763
761
|
cell: HTMLTableCellElement;
|
|
764
762
|
}) {
|
|
765
|
-
const { $table } = params
|
|
766
|
-
const
|
|
763
|
+
const { $table, column, cell } = params
|
|
764
|
+
const internalData = $table.internalData
|
|
765
|
+
const { elemStore } = internalData
|
|
766
|
+
const { computeColumnOpts, computeResizableOpts } = $table.getComputeMaps()
|
|
767
767
|
const resizableOpts = computeResizableOpts.value
|
|
768
|
+
const columnOpts = computeColumnOpts.value
|
|
768
769
|
const { maxWidth: reMaxWidth } = resizableOpts
|
|
770
|
+
const colMaxWidth = column.maxWidth || columnOpts.maxWidth
|
|
769
771
|
// 如果自定义调整宽度逻辑
|
|
770
772
|
if (reMaxWidth) {
|
|
771
773
|
const customMaxWidth = XEUtils.isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth
|
|
@@ -773,13 +775,27 @@ export function getColReMaxWidth (params: {
|
|
|
773
775
|
return Math.max(1, XEUtils.toNumber(customMaxWidth))
|
|
774
776
|
}
|
|
775
777
|
}
|
|
778
|
+
const minTitleWidth = XEUtils.floor((XEUtils.toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8)
|
|
779
|
+
const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryElement(cell, '.vxe-cell'))
|
|
780
|
+
const mWidth = minTitleWidth + paddingLeftRight
|
|
781
|
+
// 如果设置最小宽
|
|
782
|
+
if (colMaxWidth) {
|
|
783
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
784
|
+
if (bodyScrollElem) {
|
|
785
|
+
if (isScale(colMaxWidth)) {
|
|
786
|
+
const bodyWidth = bodyScrollElem.clientWidth - 1
|
|
787
|
+
const meanWidth = bodyWidth / 100
|
|
788
|
+
return Math.max(mWidth, Math.floor(XEUtils.toInteger(colMaxWidth) * meanWidth))
|
|
789
|
+
} else if (isPx(colMaxWidth)) {
|
|
790
|
+
return Math.max(mWidth, XEUtils.toInteger(colMaxWidth))
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
776
794
|
return -1
|
|
777
795
|
}
|
|
778
796
|
|
|
779
797
|
/**
|
|
780
798
|
* 列宽拖动最小宽度
|
|
781
|
-
* @param params
|
|
782
|
-
* @returns
|
|
783
799
|
*/
|
|
784
800
|
export function getColReMinWidth (params: {
|
|
785
801
|
$table: VxeTableConstructor & VxeTablePrivateMethods;
|
|
@@ -792,8 +808,9 @@ export function getColReMinWidth (params: {
|
|
|
792
808
|
const { $table, column, cell } = params
|
|
793
809
|
const tableProps = $table.props
|
|
794
810
|
const internalData = $table.internalData
|
|
795
|
-
const { computeResizableOpts } = $table.getComputeMaps()
|
|
811
|
+
const { computeColumnOpts, computeResizableOpts } = $table.getComputeMaps()
|
|
796
812
|
const resizableOpts = computeResizableOpts.value
|
|
813
|
+
const columnOpts = computeColumnOpts.value
|
|
797
814
|
const { minWidth: reMinWidth } = resizableOpts
|
|
798
815
|
// 如果自定义调整宽度逻辑
|
|
799
816
|
if (reMinWidth) {
|
|
@@ -804,7 +821,8 @@ export function getColReMinWidth (params: {
|
|
|
804
821
|
}
|
|
805
822
|
const { elemStore } = internalData
|
|
806
823
|
const { showHeaderOverflow: allColumnHeaderOverflow } = tableProps
|
|
807
|
-
const { showHeaderOverflow
|
|
824
|
+
const { showHeaderOverflow } = column
|
|
825
|
+
const colMinWidth = column.minWidth || columnOpts.minWidth
|
|
808
826
|
const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow
|
|
809
827
|
const showEllipsis = headOverflow === 'ellipsis'
|
|
810
828
|
const showTitle = headOverflow === 'title'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|