vxe-table 4.19.4 → 4.19.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.
- package/dist/all.esm.js +188 -31
- package/dist/style.css +1 -1
- package/es/style.css +1 -1
- package/es/table/module/export/hook.js +3 -3
- package/es/table/src/cell.js +8 -7
- package/es/table/src/columnInfo.js +1 -4
- package/es/table/src/emits.js +1 -0
- package/es/table/src/table.js +135 -12
- package/es/table/src/util.js +28 -8
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +65 -43
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/export/hook.js +3 -3
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/src/cell.js +8 -8
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/columnInfo.js +1 -5
- package/lib/table/src/columnInfo.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/table.js +17 -14
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +31 -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/module/export/hook.ts +3 -3
- package/packages/table/src/cell.ts +8 -7
- package/packages/table/src/columnInfo.ts +1 -5
- package/packages/table/src/emits.ts +1 -0
- package/packages/table/src/table.ts +137 -13
- package/packages/table/src/util.ts +27 -8
- /package/es/{iconfont.1779936744129.ttf → iconfont.1780293024194.ttf} +0 -0
- /package/es/{iconfont.1779936744129.woff → iconfont.1780293024194.woff} +0 -0
- /package/es/{iconfont.1779936744129.woff2 → iconfont.1780293024194.woff2} +0 -0
- /package/lib/{iconfont.1779936744129.ttf → iconfont.1780293024194.ttf} +0 -0
- /package/lib/{iconfont.1779936744129.woff → iconfont.1780293024194.woff} +0 -0
- /package/lib/{iconfont.1779936744129.woff2 → iconfont.1780293024194.woff2} +0 -0
package/lib/table/src/util.js
CHANGED
|
@@ -120,6 +120,7 @@ function createInternalData() {
|
|
|
120
120
|
// 数据集(仅可视)
|
|
121
121
|
visibleDataRowIdData: {},
|
|
122
122
|
keepUpdateFieldMaps: {},
|
|
123
|
+
headerFullDataColData: {},
|
|
123
124
|
footerFullDataRowData: {},
|
|
124
125
|
// 渲染中缓存数据
|
|
125
126
|
sourceDataRowIdData: {},
|
|
@@ -758,20 +759,27 @@ function getCalcHeight(height) {
|
|
|
758
759
|
}
|
|
759
760
|
/**
|
|
760
761
|
* 列宽拖动最大宽度
|
|
761
|
-
* @param params
|
|
762
|
-
* @returns
|
|
763
762
|
*/
|
|
764
763
|
function getColReMaxWidth(params) {
|
|
765
764
|
const {
|
|
766
|
-
$table
|
|
765
|
+
$table,
|
|
766
|
+
column,
|
|
767
|
+
cell
|
|
767
768
|
} = params;
|
|
769
|
+
const internalData = $table.internalData;
|
|
768
770
|
const {
|
|
771
|
+
elemStore
|
|
772
|
+
} = internalData;
|
|
773
|
+
const {
|
|
774
|
+
computeColumnOpts,
|
|
769
775
|
computeResizableOpts
|
|
770
776
|
} = $table.getComputeMaps();
|
|
771
777
|
const resizableOpts = computeResizableOpts.value;
|
|
778
|
+
const columnOpts = computeColumnOpts.value;
|
|
772
779
|
const {
|
|
773
780
|
maxWidth: reMaxWidth
|
|
774
781
|
} = resizableOpts;
|
|
782
|
+
const colMaxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
775
783
|
// 如果自定义调整宽度逻辑
|
|
776
784
|
if (reMaxWidth) {
|
|
777
785
|
const customMaxWidth = _xeUtils.default.isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
|
|
@@ -779,12 +787,26 @@ function getColReMaxWidth(params) {
|
|
|
779
787
|
return Math.max(1, _xeUtils.default.toNumber(customMaxWidth));
|
|
780
788
|
}
|
|
781
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
|
+
}
|
|
782
806
|
return -1;
|
|
783
807
|
}
|
|
784
808
|
/**
|
|
785
809
|
* 列宽拖动最小宽度
|
|
786
|
-
* @param params
|
|
787
|
-
* @returns
|
|
788
810
|
*/
|
|
789
811
|
function getColReMinWidth(params) {
|
|
790
812
|
const {
|
|
@@ -795,9 +817,11 @@ function getColReMinWidth(params) {
|
|
|
795
817
|
const tableProps = $table.props;
|
|
796
818
|
const internalData = $table.internalData;
|
|
797
819
|
const {
|
|
820
|
+
computeColumnOpts,
|
|
798
821
|
computeResizableOpts
|
|
799
822
|
} = $table.getComputeMaps();
|
|
800
823
|
const resizableOpts = computeResizableOpts.value;
|
|
824
|
+
const columnOpts = computeColumnOpts.value;
|
|
801
825
|
const {
|
|
802
826
|
minWidth: reMinWidth
|
|
803
827
|
} = resizableOpts;
|
|
@@ -815,9 +839,9 @@ function getColReMinWidth(params) {
|
|
|
815
839
|
showHeaderOverflow: allColumnHeaderOverflow
|
|
816
840
|
} = tableProps;
|
|
817
841
|
const {
|
|
818
|
-
showHeaderOverflow
|
|
819
|
-
minWidth: colMinWidth
|
|
842
|
+
showHeaderOverflow
|
|
820
843
|
} = column;
|
|
844
|
+
const colMinWidth = column.minWidth || columnOpts.minWidth;
|
|
821
845
|
const headOverflow = _xeUtils.default.isUndefined(showHeaderOverflow) || _xeUtils.default.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
822
846
|
const showEllipsis = headOverflow === 'ellipsis';
|
|
823
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:{},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.6";
|
|
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.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,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.6"}`;
|
|
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.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": "4.19.
|
|
3
|
+
"version": "4.19.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",
|
|
@@ -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.26"
|
|
73
73
|
},
|
|
74
74
|
"vetur": {
|
|
75
75
|
"tags": "helper/vetur/tags.json",
|
|
@@ -326,7 +326,7 @@ hooks.add('tableExportModule', {
|
|
|
326
326
|
function getHeaderTitle (opts: VxeTablePropTypes.ExportHandleOptions, column: VxeTableDefines.ColumnInfo) {
|
|
327
327
|
const columnOpts = computeColumnOpts.value
|
|
328
328
|
const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod
|
|
329
|
-
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ?
|
|
329
|
+
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ? $xeTable.getHeaderCellLabel(column) : column.field) || '')
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
const toBooleanValue = (cellValue: any) => {
|
|
@@ -994,12 +994,12 @@ hooks.add('tableExportModule', {
|
|
|
994
994
|
const tableTitleMaps: Record<string, VxeTableDefines.ColumnInfo> = {}
|
|
995
995
|
tableFullColumn.forEach((column) => {
|
|
996
996
|
const field = column.field
|
|
997
|
-
const title =
|
|
997
|
+
const title = $xeTable.getHeaderCellLabel(column)
|
|
998
998
|
if (field) {
|
|
999
999
|
tableFieldMaps[field] = column
|
|
1000
1000
|
}
|
|
1001
1001
|
if (title) {
|
|
1002
|
-
tableTitleMaps[
|
|
1002
|
+
tableTitleMaps[title] = column
|
|
1003
1003
|
}
|
|
1004
1004
|
})
|
|
1005
1005
|
const tableConf = {
|
|
@@ -387,7 +387,7 @@ export const Cell = {
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
return renderTitleContent(params,
|
|
390
|
+
return renderTitleContent(params, $table.getHeaderCellLabel(column))
|
|
391
391
|
},
|
|
392
392
|
renderDefaultHeader (params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
393
393
|
return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params))
|
|
@@ -399,7 +399,7 @@ export const Cell = {
|
|
|
399
399
|
const tableInternalData = $table.internalData
|
|
400
400
|
const { isRowGroupStatus } = tableReactData
|
|
401
401
|
const { editConfig } = tableProps
|
|
402
|
-
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc
|
|
402
|
+
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column
|
|
403
403
|
const isEnableEdit = editConfig && isEnableConf(editConfig)
|
|
404
404
|
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
|
|
405
405
|
const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null
|
|
@@ -473,8 +473,9 @@ export const Cell = {
|
|
|
473
473
|
return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params))
|
|
474
474
|
}
|
|
475
475
|
const renderOpts = editRenderOpts || cellRenderOpts
|
|
476
|
-
//
|
|
477
|
-
|
|
476
|
+
// 如果是编辑表格:renderTableCell > formatter
|
|
477
|
+
// 如果是查看表格:renderTableDefault > formatter
|
|
478
|
+
if (renderOpts) {
|
|
478
479
|
const compConf = renderer.get(renderOpts.name)
|
|
479
480
|
if (compConf) {
|
|
480
481
|
const renderFn = editRenderOpts ? (compConf.renderTableCell || compConf.renderCell) : (compConf.renderTableDefault || compConf.renderDefault)
|
|
@@ -650,7 +651,7 @@ export const Cell = {
|
|
|
650
651
|
const { $table, column } = params
|
|
651
652
|
const { slots } = column
|
|
652
653
|
const headerSlot = slots ? slots.header : null
|
|
653
|
-
return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) :
|
|
654
|
+
return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) : $table.getHeaderCellLabel(column)))
|
|
654
655
|
},
|
|
655
656
|
renderSeqCell (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
656
657
|
const { $table, column } = params
|
|
@@ -687,7 +688,7 @@ export const Cell = {
|
|
|
687
688
|
: [
|
|
688
689
|
h('span', {
|
|
689
690
|
class: 'vxe-radio--label'
|
|
690
|
-
}, titleSlot ? $table.callSlot(titleSlot, params) :
|
|
691
|
+
}, titleSlot ? $table.callSlot(titleSlot, params) : $table.getHeaderCellLabel(column))
|
|
691
692
|
])
|
|
692
693
|
)
|
|
693
694
|
},
|
|
@@ -765,7 +766,7 @@ export const Cell = {
|
|
|
765
766
|
const titleSlot = slots ? slots.title : null
|
|
766
767
|
const checkboxOpts = computeCheckboxOpts.value
|
|
767
768
|
const { checkStrictly, showHeader, headerTitle } = checkboxOpts
|
|
768
|
-
const colTitle =
|
|
769
|
+
const colTitle = $table.getHeaderCellLabel(column)
|
|
769
770
|
const ons: Record<string, any> = {}
|
|
770
771
|
if (!isHidden) {
|
|
771
772
|
ons.onClick = (evnt: MouseEvent) => {
|
|
@@ -16,7 +16,7 @@ export class ColumnInfo {
|
|
|
16
16
|
const $xeGantt = $xeTable.xeGantt
|
|
17
17
|
const $xeGGWrapper = $xeGrid || $xeGantt
|
|
18
18
|
|
|
19
|
-
const { field, editRender, filterRender
|
|
19
|
+
const { field, editRender, filterRender } = _vm
|
|
20
20
|
|
|
21
21
|
const colId = _vm.colId || XEUtils.uniqueId('col_')
|
|
22
22
|
|
|
@@ -28,10 +28,6 @@ export class ColumnInfo {
|
|
|
28
28
|
|
|
29
29
|
const filters = toFilters(_vm.filters, colId)
|
|
30
30
|
|
|
31
|
-
if (headerFormatter) {
|
|
32
|
-
errLog('vxe.error.notProp', ['header-formatter'])
|
|
33
|
-
}
|
|
34
|
-
|
|
35
31
|
const types = ['seq', 'checkbox', 'radio', 'expand', 'html']
|
|
36
32
|
if (_vm.type && types.indexOf(_vm.type) === -1) {
|
|
37
33
|
warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')])
|
|
@@ -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
|
|
@@ -4218,6 +4259,7 @@ export default defineVxeComponent({
|
|
|
4218
4259
|
loadScrollXData()
|
|
4219
4260
|
}
|
|
4220
4261
|
})
|
|
4262
|
+
$xeTable.clearHeaderFormatterCache()
|
|
4221
4263
|
$xeTable.clearMergeCells()
|
|
4222
4264
|
$xeTable.clearMergeFooterItems()
|
|
4223
4265
|
$xeTable.handleTableData(true)
|
|
@@ -5473,6 +5515,79 @@ export default defineVxeComponent({
|
|
|
5473
5515
|
}
|
|
5474
5516
|
return nextTick()
|
|
5475
5517
|
},
|
|
5518
|
+
getHeaderCellLabel (fieldOrColumn) {
|
|
5519
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
5520
|
+
if (!column) {
|
|
5521
|
+
return null
|
|
5522
|
+
}
|
|
5523
|
+
const { headerFormatter } = column
|
|
5524
|
+
const _columnIndex = $xeTable.getVTColumnIndex(column)
|
|
5525
|
+
let cellLabel = column.getTitle()
|
|
5526
|
+
if (headerFormatter) {
|
|
5527
|
+
let formatData: Record<string, VxeTableDefines.RowCacheFormatObj> | undefined
|
|
5528
|
+
const { headerFullDataColData } = internalData
|
|
5529
|
+
const colid = column.id
|
|
5530
|
+
let colRest = headerFullDataColData[colid]
|
|
5531
|
+
if (!colRest) {
|
|
5532
|
+
colRest = headerFullDataColData[colid] = {}
|
|
5533
|
+
}
|
|
5534
|
+
const formatObj = colRest.formatObj
|
|
5535
|
+
if (formatObj && formatObj.value === cellLabel) {
|
|
5536
|
+
return formatObj.label
|
|
5537
|
+
}
|
|
5538
|
+
const headFormatParams = {
|
|
5539
|
+
$table: $xeTable,
|
|
5540
|
+
cellTitle: cellLabel,
|
|
5541
|
+
cellValue: cellLabel,
|
|
5542
|
+
column,
|
|
5543
|
+
_columnIndex,
|
|
5544
|
+
columnIndex: $xeTable.getColumnIndex(column)
|
|
5545
|
+
}
|
|
5546
|
+
if (XEUtils.isString(headerFormatter)) {
|
|
5547
|
+
const gFormatOpts = formats.get(headerFormatter)
|
|
5548
|
+
const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null
|
|
5549
|
+
cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams) : '')
|
|
5550
|
+
} else if (XEUtils.isArray(headerFormatter)) {
|
|
5551
|
+
const gFormatOpts = formats.get(headerFormatter[0])
|
|
5552
|
+
const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null
|
|
5553
|
+
cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams, ...headerFormatter.slice(1)) : '')
|
|
5554
|
+
} else {
|
|
5555
|
+
cellLabel = XEUtils.toValueString(headerFormatter(headFormatParams))
|
|
5556
|
+
}
|
|
5557
|
+
if (formatData) {
|
|
5558
|
+
colRest.formatObj = { value: cellLabel, label: cellLabel }
|
|
5559
|
+
}
|
|
5560
|
+
}
|
|
5561
|
+
return cellLabel
|
|
5562
|
+
},
|
|
5563
|
+
updateHeaderCellLabel (fieldOrColumn) {
|
|
5564
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
5565
|
+
if (!column) {
|
|
5566
|
+
return ''
|
|
5567
|
+
}
|
|
5568
|
+
const { headerFullDataColData } = internalData
|
|
5569
|
+
const colid = column.id
|
|
5570
|
+
const colRest = headerFullDataColData[colid]
|
|
5571
|
+
if (colRest) {
|
|
5572
|
+
colRest.formatObj = undefined
|
|
5573
|
+
}
|
|
5574
|
+
return $xeTable.getHeaderCellLabel(column)
|
|
5575
|
+
},
|
|
5576
|
+
clearHeaderFormatterCache (isUpdate) {
|
|
5577
|
+
const { tableColumn } = reactData
|
|
5578
|
+
const { headerFullDataColData } = internalData
|
|
5579
|
+
XEUtils.each(headerFullDataColData, (colRest: VxeTableDefines.HeaderColCacheItem) => {
|
|
5580
|
+
if (colRest.formatObj) {
|
|
5581
|
+
colRest.formatObj = undefined
|
|
5582
|
+
}
|
|
5583
|
+
})
|
|
5584
|
+
if (isUpdate) {
|
|
5585
|
+
tableColumn.forEach(column => {
|
|
5586
|
+
$xeTable.getHeaderCellLabel(column)
|
|
5587
|
+
})
|
|
5588
|
+
}
|
|
5589
|
+
return nextTick()
|
|
5590
|
+
},
|
|
5476
5591
|
getFooterCellLabel (row, fieldOrColumn) {
|
|
5477
5592
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
5478
5593
|
if (!column) {
|
|
@@ -7670,6 +7785,7 @@ export default defineVxeComponent({
|
|
|
7670
7785
|
footData = visibleColumn.length ? footerMethod({ columns: visibleColumn, data: afterFullData, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }) : []
|
|
7671
7786
|
}
|
|
7672
7787
|
reactData.footerTableData = footData
|
|
7788
|
+
$xeTable.clearFooterFormatterCache()
|
|
7673
7789
|
$xeTable.handleUpdateFooterMerge()
|
|
7674
7790
|
$xeTable.dispatchEvent('footer-data-change', {
|
|
7675
7791
|
visibleColumn: internalData.visibleColumn,
|
|
@@ -9478,6 +9594,7 @@ export default defineVxeComponent({
|
|
|
9478
9594
|
const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth
|
|
9479
9595
|
|
|
9480
9596
|
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth // 列之间的最小间距
|
|
9597
|
+
const maxInterval = getColReMaxWidth(cellParams) // 列之间的最大间距
|
|
9481
9598
|
const dragMinLeft = isRightFixed ? 0 : (cellRect.x - tableRect.x + dragBtnWidth + minInterval)
|
|
9482
9599
|
const dragMaxLeft = cellRect.x - tableRect.x + cell.clientWidth - minInterval
|
|
9483
9600
|
|
|
@@ -9519,7 +9636,10 @@ export default defineVxeComponent({
|
|
|
9519
9636
|
}
|
|
9520
9637
|
|
|
9521
9638
|
dragLeft = Math.max(left, dragMinLeft)
|
|
9522
|
-
|
|
9639
|
+
// 最大宽
|
|
9640
|
+
if (maxInterval > 1) {
|
|
9641
|
+
dragLeft = Math.min(dragLeft, maxInterval + dragMinLeft - minInterval)
|
|
9642
|
+
}
|
|
9523
9643
|
const resizeBarLeft = Math.max(1, dragLeft)
|
|
9524
9644
|
resizeBarElem.style.left = `${resizeBarLeft}px`
|
|
9525
9645
|
resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`
|
|
@@ -9602,6 +9722,7 @@ export default defineVxeComponent({
|
|
|
9602
9722
|
const cell = dragBtnElem.parentNode as HTMLTableCellElement
|
|
9603
9723
|
const cellParams = Object.assign(params, { cell, $table: $xeTable })
|
|
9604
9724
|
const colMinWidth = getColReMinWidth(cellParams)
|
|
9725
|
+
const colMaxWidth = getColReMaxWidth(cellParams)
|
|
9605
9726
|
|
|
9606
9727
|
el.setAttribute('data-calc-col', 'Y')
|
|
9607
9728
|
let resizeWidth = calcColumnAutoWidth(resizeColumn, el)
|
|
@@ -9610,6 +9731,9 @@ export default defineVxeComponent({
|
|
|
9610
9731
|
resizeWidth = Math.max(resizeWidth, colRest.width)
|
|
9611
9732
|
}
|
|
9612
9733
|
resizeWidth = Math.max(colMinWidth, resizeWidth)
|
|
9734
|
+
if (colMaxWidth > 1) {
|
|
9735
|
+
resizeWidth = Math.min(colMaxWidth, resizeWidth)
|
|
9736
|
+
}
|
|
9613
9737
|
const resizeParams = { ...params, resizeWidth, resizeColumn }
|
|
9614
9738
|
reactData.isDragResize = false
|
|
9615
9739
|
internalData._lastResizeTime = Date.now()
|