vxe-table 3.21.4 → 3.21.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/style.css +1 -1
- package/es/table/module/export/mixin.js +3 -3
- package/es/table/src/cell.js +8 -7
- package/es/table/src/columnInfo.js +1 -4
- package/es/table/src/methods.js +152 -22
- package/es/table/src/util.js +47 -2
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +87 -38
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/export/mixin.js +3 -3
- package/lib/table/module/export/mixin.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/methods.js +17 -14
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/util.js +57 -6
- 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/mixin.ts +3 -3
- package/packages/table/src/cell.ts +8 -7
- package/packages/table/src/columnInfo.ts +1 -5
- package/packages/table/src/methods.ts +157 -22
- package/packages/table/src/util.ts +63 -4
- /package/es/{iconfont.1779936730544.ttf → iconfont.1780293000244.ttf} +0 -0
- /package/es/{iconfont.1779936730544.woff → iconfont.1780293000244.woff} +0 -0
- /package/es/{iconfont.1779936730544.woff2 → iconfont.1780293000244.woff2} +0 -0
- /package/lib/{iconfont.1779936730544.ttf → iconfont.1780293000244.ttf} +0 -0
- /package/lib/{iconfont.1779936730544.woff → iconfont.1780293000244.woff} +0 -0
- /package/lib/{iconfont.1779936730544.woff2 → iconfont.1780293000244.woff2} +0 -0
package/lib/table/src/util.js
CHANGED
|
@@ -20,6 +20,7 @@ exports.encodeRowid = encodeRowid;
|
|
|
20
20
|
exports.getCalcHeight = getCalcHeight;
|
|
21
21
|
exports.getCellRestHeight = getCellRestHeight;
|
|
22
22
|
exports.getCellValue = getCellValue;
|
|
23
|
+
exports.getColReMaxWidth = getColReMaxWidth;
|
|
23
24
|
exports.getColReMinWidth = getColReMinWidth;
|
|
24
25
|
exports.getColumnList = getColumnList;
|
|
25
26
|
exports.getFirstChildColumn = getFirstChildColumn;
|
|
@@ -118,6 +119,7 @@ function createInternalData() {
|
|
|
118
119
|
// 数据集(仅可视)
|
|
119
120
|
visibleDataRowIdData: {},
|
|
120
121
|
keepUpdateFieldMaps: {},
|
|
122
|
+
headerFullDataColData: {},
|
|
121
123
|
footerFullDataRowData: {},
|
|
122
124
|
// 渲染中缓存数据
|
|
123
125
|
sourceDataRowIdData: {},
|
|
@@ -792,7 +794,10 @@ function toFilters(filters, colid) {
|
|
|
792
794
|
}
|
|
793
795
|
return filters;
|
|
794
796
|
}
|
|
795
|
-
|
|
797
|
+
/**
|
|
798
|
+
* 列宽拖动最大宽度
|
|
799
|
+
*/
|
|
800
|
+
function getColReMaxWidth(params) {
|
|
796
801
|
const {
|
|
797
802
|
$table,
|
|
798
803
|
column,
|
|
@@ -800,9 +805,52 @@ function getColReMinWidth(params) {
|
|
|
800
805
|
} = params;
|
|
801
806
|
const internalData = $table;
|
|
802
807
|
const {
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
808
|
+
elemStore
|
|
809
|
+
} = internalData;
|
|
810
|
+
const resizableOpts = $table.computeResizableOpts;
|
|
811
|
+
const columnOpts = $table.computeColumnOpts;
|
|
812
|
+
const {
|
|
813
|
+
maxWidth: reMaxWidth
|
|
814
|
+
} = resizableOpts;
|
|
815
|
+
const colMaxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
816
|
+
// 如果自定义调整宽度逻辑
|
|
817
|
+
if (reMaxWidth) {
|
|
818
|
+
const customMaxWidth = _xeUtils.default.isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
|
|
819
|
+
if (customMaxWidth !== 'auto') {
|
|
820
|
+
return Math.max(1, _xeUtils.default.toNumber(customMaxWidth));
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
const minTitleWidth = _xeUtils.default.floor((_xeUtils.default.toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8);
|
|
824
|
+
const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize((0, _dom.queryElement)(cell, '.vxe-cell'));
|
|
825
|
+
const mWidth = minTitleWidth + paddingLeftRight;
|
|
826
|
+
// 如果设置最小宽
|
|
827
|
+
if (colMaxWidth) {
|
|
828
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
829
|
+
if (bodyScrollElem) {
|
|
830
|
+
if ((0, _dom.isScale)(colMaxWidth)) {
|
|
831
|
+
const bodyWidth = bodyScrollElem.clientWidth - 1;
|
|
832
|
+
const meanWidth = bodyWidth / 100;
|
|
833
|
+
return Math.max(mWidth, Math.floor(_xeUtils.default.toInteger(colMaxWidth) * meanWidth));
|
|
834
|
+
} else if ((0, _dom.isPx)(colMaxWidth)) {
|
|
835
|
+
return Math.max(mWidth, _xeUtils.default.toInteger(colMaxWidth));
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
return -1;
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* 列宽拖动最小宽度
|
|
843
|
+
*/
|
|
844
|
+
function getColReMinWidth(params) {
|
|
845
|
+
const {
|
|
846
|
+
$table,
|
|
847
|
+
column,
|
|
848
|
+
cell
|
|
849
|
+
} = params;
|
|
850
|
+
const tableProps = $table;
|
|
851
|
+
const internalData = $table;
|
|
852
|
+
const resizableOpts = $table.computeResizableOpts;
|
|
853
|
+
const columnOpts = $table.computeColumnOpts;
|
|
806
854
|
const {
|
|
807
855
|
minWidth
|
|
808
856
|
} = resizableOpts;
|
|
@@ -817,9 +865,12 @@ function getColReMinWidth(params) {
|
|
|
817
865
|
elemStore
|
|
818
866
|
} = internalData;
|
|
819
867
|
const {
|
|
820
|
-
showHeaderOverflow
|
|
821
|
-
|
|
868
|
+
showHeaderOverflow: allColumnHeaderOverflow
|
|
869
|
+
} = tableProps;
|
|
870
|
+
const {
|
|
871
|
+
showHeaderOverflow
|
|
822
872
|
} = column;
|
|
873
|
+
const colMinWidth = column.minWidth || columnOpts.minWidth;
|
|
823
874
|
const headOverflow = _xeUtils.default.isUndefined(showHeaderOverflow) || _xeUtils.default.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
824
875
|
const showEllipsis = headOverflow === 'ellipsis';
|
|
825
876
|
const showTitle = headOverflow === 'title';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.assembleColumn=assembleColumn,exports.clearTableAllStatus=clearTableAllStatus,exports.clearTableDefaultStatus=clearTableDefaultStatus,exports.colToVisible=colToVisible,exports.convertHeaderColumnToRows=void 0,exports.convertHeaderToGridRows=convertHeaderToGridRows,exports.createColumn=createColumn,exports.createHandleGetRowId=createHandleGetRowId,exports.createHandleUpdateRowId=createHandleUpdateRowId,exports.createInternalData=createInternalData,exports.createReactData=createReactData,exports.createRowId=createRowId,exports.destroyColumn=destroyColumn,exports.encodeRowid=encodeRowid,exports.getCalcHeight=getCalcHeight,exports.getCellRestHeight=getCellRestHeight,exports.getCellValue=getCellValue,exports.getColReMinWidth=getColReMinWidth,exports.getColumnList=getColumnList,exports.getFirstChildColumn=getFirstChildColumn,exports.getLastChildColumn=getLastChildColumn,exports.getRefElem=getRefElem,exports.getRootColumn=getRootColumn,exports.getRowUniqueId=getRowUniqueId,exports.getRowid=getRowid,exports.getRowkey=getRowkey,exports.handleFieldOrColumn=handleFieldOrColumn,exports.handleRowidOrRow=handleRowidOrRow,exports.hasDeepKey=hasDeepKey,exports.isColumnInfo=isColumnInfo,exports.restoreScrollLocation=restoreScrollLocation,exports.rowToVisible=rowToVisible,exports.setCellValue=setCellValue,exports.toFilters=toFilters,exports.toTreePathSeq=toTreePathSeq;var _xeUtils=_interopRequireDefault(require("xe-utils")),_columnInfo=require("./columnInfo"),_dom=require("../../ui/src/dom"),_log=require("../../ui/src/log"),_utils=require("../../ui/src/utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function createInternalData(){return{tZindex:0,currKeyField:"",isCurrDeepKey:!1,elemStore:{},scrollXStore:{preloadSize:0,offsetSize:0,visibleSize:0,visibleStartIndex:0,visibleEndIndex:0,startIndex:0,endIndex:0},scrollYStore:{preloadSize:0,offsetSize:0,visibleSize:0,visibleStartIndex:0,visibleEndIndex:0,startIndex:0,endIndex:0},tableWidth:0,tableHeight:0,customHeight:0,customMinHeight:0,customMaxHeight:0,hoverRow:null,lastScrollLeft:0,lastScrollTop:0,radioReserveRow:null,checkboxReserveRowMap:{},rowExpandedReserveRowMap:{},treeExpandedReserveRowMap:{},treeIndeterminateRowMaps:{},tableFullData:[],afterFullData:[],afterTreeFullData:[],afterGroupFullData:[],afterFullRowMaps:{},tableFullTreeData:[],tableFullGroupData:[],tableSynchData:[],tableSourceData:[],collectColumn:[],tableFullColumn:[],visibleColumn:[],fullAllDataRowIdData:{},fullDataRowIdData:{},visibleDataRowIdData:{},keepUpdateFieldMaps:{},footerFullDataRowData:{},sourceDataRowIdData:{},fullColumnIdData:{},fullColumnFieldData:{},currentRow:null,mergeHeaderList:[],mergeHeaderMaps:{},mergeHeaderCellMaps:{},mergeHeaderRowMaps:{},mergeHeaderColMaps:{},mergeBodyList:[],mergeBodyMaps:{},mergeBodyCellMaps:{},mergeBodyRowMaps:{},mergeBodyColMaps:{},mergeFooterList:[],mergeFooterMaps:{},mergeFooterCellMaps:{},mergeFooterRowMaps:{},mergeFooterColMaps:{},rowExpandedMaps:{},rowExpandLazyLoadedMaps:{},rowGroupExpandedMaps:{},treeExpandedMaps:{},treeExpandLazyLoadedMaps:{},selectCheckboxMaps:{},pendingRowMaps:{},insertRowMaps:{},removeRowMaps:{},cvCacheMaps:{},tHeaderHeight:0,tBodyHeight:0,tFooterHeight:0,stackHistoryStore:{undoStacks:[],redoStacks:[]},teleportToWrapperElem:null,popupToWrapperElem:null,customPopupToElem:null,lastSTime:0,inited:!1,tooltipTimeout:null,initStatus:!1,isActivated:!1}}function createReactData(){return{updateColFlag:0,staticColumns:[],tableGroupColumn:[],tableColumn:[],tableData:[],scrollXLoad:!1,scrollYLoad:!1,overflowY:!0,overflowX:!1,scrollbarWidth:0,scrollbarHeight:0,rowHeight:0,parentHeight:0,isGroup:!1,isAllOverflow:!1,isAllSelected:!1,isIndeterminate:!1,currentColumn:null,selectRadioRow:null,footerTableData:[],rowGroupColumn:null,expandColumn:null,checkboxColumn:null,radioColumn:null,treeNodeColumn:null,hasFixedColumn:!1,upDataFlag:0,reColumnFlag:0,initStore:{filter:!1,import:!1,export:!1,custom:!1},customStore:{btnEl:null,isAll:!1,isIndeterminate:!1,activeBtn:!1,activeWrapper:!1,visible:!1,maxHeight:null,popupStyle:{},oldSortMaps:{},oldFixedMaps:{},oldVisibleMaps:{}},customColumnList:[],filterStore:{isAllSelected:!1,isIndeterminate:!1,style:null,column:null,visible:!1,maxHeight:null},columnStore:{leftList:[],centerList:[],rightList:[],resizeList:[],pxList:[],pxMinList:[],autoMinList:[],scaleList:[],scaleMinList:[],autoList:[],remainList:[]},ctxMenuStore:{selected:null,visible:!1,showChild:!1,selectChild:null,list:[],style:null},editStore:{indexs:{columns:[]},titles:{columns:[]},selected:{row:null,column:null},copyed:{cut:!1,rows:[],columns:[]},actived:{row:null,column:null},focused:{row:null,column:null}},tooltipStore:{row:null,column:null,content:"",visible:!1,type:null,currOpts:{}},validStore:{visible:!1},validErrorMaps:{},importStore:{inited:!1,file:null,type:"",modeList:[],typeList:[],filename:"",visible:!1},importParams:{mode:"",types:null,message:!0},exportStore:{inited:!1,name:"",modeList:[],typeList:[],columns:[],isPrint:!1,hasFooter:!1,hasMerge:!1,hasTree:!1,hasRowGroup:!1,hasColgroup:!1,visible:!1},exportParams:{filename:"",sheetName:"",mode:"",type:"",isColgroup:!1,isMerge:!1,isTreeAllExpanded:!1,isRowGroupAllExpanded:!1,useStyle:!1,original:!1,message:!0,isHeader:!1,isTitle:!1,isFooter:!1},visiblwRowsFlag:1,isRowGroupStatus:!1,rowGroupList:[],aggHandleFields:[],aggHandleAggColumns:[],rowGroupExpandedFlag:1,rowExpandedFlag:1,treeExpandedFlag:1,updateCheckboxFlag:1,pendingRowFlag:1,insertRowFlag:1,removeRowFlag:1,mergeHeadFlag:1,mergeBodyFlag:1,mergeFootFlag:1,rowHeightStore:{large:52,default:48,medium:44,small:40,mini:36},scrollVMLoading:!1,scrollYHeight:0,scrollYTop:0,isScrollYBig:!1,scrollXLeft:0,scrollXWidth:0,isScrollXBig:!1,lazScrollLoading:!1,rowExpandHeightFlag:1,calcCellHeightFlag:1,resizeHeightFlag:1,resizeWidthFlag:1,isCustomStatus:!1,isCustomDragStatus:!0,ctPopupFlag:1,isCrossDragRow:!1,dragRow:null,isCrossDragCol:!1,dragCol:null,dragTipText:"",isDragResize:!1,isRowLoading:!1,isColLoading:!1}}let getAllConvertColumns=(e,l)=>{let t=[];return e.forEach(e=>{e.parentId=l?l.id:null,e.visible&&(e.children&&e.children.length&&e.children.some(e=>e.visible)?(t.push(e),t.push(...getAllConvertColumns(e.children,e))):t.push(e))}),t},convertHeaderColumnToRows=e=>{let l=1,o=(t,e)=>{if(e&&(t.level=e.level+1,l<t.level)&&(l=t.level),t.children&&t.children.length&&t.children.some(e=>e.visible)){let l=0;t.children.forEach(e=>{e.visible&&(o(e,t),l+=e.colSpan)}),t.colSpan=l}else t.colSpan=1},t=(e.forEach(e=>{e.level=1,o(e)}),[]);for(let e=0;e<l;e++)t.push([]);return getAllConvertColumns(e).forEach(e=>{e.children&&e.children.length&&e.children.some(e=>e.visible)?e.rowSpan=1:e.rowSpan=l-e.level+1,t[e.level-1].push(e)}),t};function convertHeaderToGridRows(l){var t=l.length,i=l[0].reduce((e,l)=>e+l.colSpan,0),n=[],a=[];for(let e=0;e<t;e++){var o=[],r=[];for(let e=0;e<i;e++)o.push(!1),r.push("");n.push(o),a.push(r)}for(let r=0;r<t;r++){let e=0;for(var u of l[r]){var{colSpan:s,rowSpan:d}=u;let o=-1;for(let t=e;t<=i-s;t++){let l=!0;for(let e=0;e<s;e++)if(n[r][t+e]){l=!1;break}if(l){o=t;break}}if(-1===o){for(let t=0;t<=i-s;t++){let l=!0;for(let e=0;e<s;e++)if(n[r][t+e]){l=!1;break}if(l){o=t;break}}if(-1===o)break}for(let l=r;l<r+d;l++)for(let e=o;e<o+s;e++)n[l][e]=!0,a[l][e]=u;e=o+s}}return a}function restoreScrollLocation(e,l,t){var o=e;return l||t?(o.intoRunScroll=!1,o.inVirtualScroll=!1,o.inWheelScroll=!1,o.inHeaderScroll=!1,o.inBodyScroll=!1,o.inFooterScroll=!1,o.scrollRenderType="",e.scrollTo(l,t)):e.clearScroll()}function toTreePathSeq(e){return e.map((e,l)=>l%2==0?Number(e)+1:".").join("")}function getRowUniqueId(){return _xeUtils.default.uniqueId("row_")}function createRowId(e,l,t){e=e.createKeyMethod;return e?""+e({row:l,keyField:t}):getRowUniqueId()}function hasDeepKey(e){return-1<e.indexOf(".")}function getRowkey(e){e=e.currKeyField;return e}function getRowid(e,l){var{isCurrDeepKey:e,currKeyField:t}=e;return l?encodeRowid((e?getDeepRowIdByKey:getFastRowIdByKey)(l,t)):""}function createHandleUpdateRowId(e){let{isCurrDeepKey:l,currKeyField:t}=e,o=e.computeRowOpts,r=l?updateDeepRowKey:updateFastRowKey;return{rowKey:t,handleUpdateRowId(e){return e?r(o,e,t):""}}}function createHandleGetRowId(e){let{isCurrDeepKey:l,currKeyField:t}=e,o=l?getDeepRowIdByKey:getFastRowIdByKey;return{rowKey:t,handleGetRowId(e){return e?encodeRowid(o(e,t)):""}}}function encodeRowid(e){return _xeUtils.default.eqNull(e)?"":encodeURIComponent(e)}function getDeepRowIdByKey(e,l){return _xeUtils.default.get(e,l)}function updateDeepRowKey(e,l,t){let o=encodeRowid(getDeepRowIdByKey(l,t));return(0,_utils.eqEmptyValue)(o)&&(e=createRowId(e,l,t),o=""+e,_xeUtils.default.set(l,t,o)),o}function getFastRowIdByKey(e,l){return e[l]}function updateFastRowKey(e,l,t){let o=encodeRowid(getFastRowIdByKey(l,t));return(0,_utils.eqEmptyValue)(o)&&(e=createRowId(e,l,t),o=""+e,l[t]=e),o}function getPaddingLeftRightSize(e){return e?(e=getComputedStyle(e),_xeUtils.default.toNumber(e.paddingLeft)+_xeUtils.default.toNumber(e.paddingRight)):0}function getElementMarginAndWidth(e){var l,t;return e?(t=getComputedStyle(e),l=_xeUtils.default.toNumber(t.marginLeft),t=_xeUtils.default.toNumber(t.marginRight),e.offsetWidth+l+t):0}function getCalcHeight(e){return"unset"!==e&&e||0}function handleFieldOrColumn(e,l){return l?_xeUtils.default.isString(l)||_xeUtils.default.isNumber(l)?e.getColumnByField(""+l):l:null}function handleRowidOrRow(e,l){return l?(l=_xeUtils.default.isString(l)||_xeUtils.default.isNumber(l)?l:getRowid(e,l),e.getRowById(l)):null}function getCellRestHeight(e,l,t,o){return e.resizeHeight||l.height||t.height||e.height||o}function assembleColumn(e){var l=e.$xeTable,t=l.staticColumns,{$el:e,$xeColumn:o,columnConfig:r}=e,i=o?o.columnConfig:null;i?("vxe-table-column"===o.$options._componentTag?(0,_log.errLog)("vxe.error.groupTag",[`<vxe-table-colgroup title=${o.title} ...>`,`<vxe-table-column title=${o.title} ...>`]):"vxe-column"===o.$options._componentTag&&(0,_log.warnLog)("vxe.error.groupTag",[`<vxe-colgroup title=${o.title} ...>`,`<vxe-column title=${o.title} ...>`]),i.children||(i.children=[]),r.defaultParentId=i.id,i.children.splice(_xeUtils.default.arrayIndexOf(o.$el.children,e),0,r)):t.splice(_xeUtils.default.arrayIndexOf(l.$refs.hideColumn.children,e),0,r)}function destroyColumn(e){var l=e.$xeTable.staticColumns;let t=e.columnConfig;e=_xeUtils.default.findTree(l,e=>e===t);e&&e.items.splice(e.index,1)}function getRootColumn(e,l){var t=e.fullColumnIdData;if(!l)return null;let o=l.parentId;for(;t[o];){let e=t[o].column;if(!(o=e.parentId))return e}return l}function toFilters(e,i){return e&&(_xeUtils.default.isArray(e)?e.map(({label:e,value:l,data:t,resetValue:o,checked:r})=>({label:e,value:l,data:t,resetValue:o,checked:!!r,_checked:!!r,_colId:i})):[])}function getColReMinWidth(e){var{$table:l,column:t,cell:o}=e,r=l,{showHeaderOverflow:l,resizableOpts:i}=l,i=i.minWidth;if(i){e=_xeUtils.default.isFunction(i)?i(e):i;if("auto"!==e)return Math.max(1,_xeUtils.default.toNumber(e))}var n,a,u,s,i=r.elemStore,{showHeaderOverflow:e,minWidth:r}=t,t=_xeUtils.default.isUndefined(e)||_xeUtils.default.isNull(e)?l:e,l="title"===t||(!0===t||"tooltip"===t)||"ellipsis"===t;let d=_xeUtils.default.floor(1.8*(_xeUtils.default.toNumber(getComputedStyle(o).fontSize)||14))+(getPaddingLeftRightSize(o)+getPaddingLeftRightSize((0,_dom.queryElement)(o,".vxe-cell")));if(l&&(e=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--drag-handle")),t=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--checkbox")),l=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--required-icon")),n=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--edit-icon")),a=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell-title-prefix-icon")),u=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell-title-suffix-icon")),s=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--sort")),o=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--filter")),d+=e+t+l+n+a+u+o+s),r){e=getRefElem(i["main-body-scroll"]);if(e){if((0,_dom.isScale)(r))return t=(e.clientWidth-1)/100,Math.max(d,Math.floor(_xeUtils.default.toInteger(r)*t));if((0,_dom.isPx)(r))return Math.max(d,_xeUtils.default.toInteger(r))}}return d}function getFirstChildColumn(e){var l=e.children;return l&&l.length?getFirstChildColumn(_xeUtils.default.first(l)):e}function getLastChildColumn(e){var l=e.children;return l&&l.length?getFirstChildColumn(_xeUtils.default.last(l)):e}function getCellValue(e,l){return l?_xeUtils.default.get(e,l.field):null}function setCellValue(e,l,t){l&&_xeUtils.default.set(e,l.field,t)}function getRefElem(e){return e?e.$el||e:null}function clearTableDefaultStatus(e){var l=e,t=(e.initStatus=!1,[e.clearSort(),e.clearCurrentRow(),e.clearCurrentColumn(),e.clearRadioRow(),e.clearRadioReserve(),e.clearCheckboxRow(),e.clearCheckboxReserve(),e.clearRowExpand(),e.clearTreeExpand(),e.clearTreeExpandReserve(),e.clearPendingRow()]);return e.clearFilter&&t.push(e.clearFilter()),e.clearSelected&&(l.keyboardConfig||l.mouseConfig)&&t.push(e.clearSelected()),e.clearCellAreas&&l.mouseConfig&&t.push(e.clearCellAreas(),e.clearCopyCellArea()),Promise.all(t).then(()=>e.clearScroll())}function clearTableAllStatus(e){return e.clearFilter&&e.clearFilter(),clearTableDefaultStatus(e)}function isColumnInfo(e){return e instanceof _columnInfo.ColumnInfo}function getColumnList(e){let l=[];return e.forEach(e=>{l.push(...e.children&&e.children.length?getColumnList(e.children):[e])}),l}function createColumn(e,l,t){return isColumnInfo(l)?l:new _columnInfo.ColumnInfo(e,l,t)}function rowToVisible(e,l){var{scrollYLoad:t,scrollYTop:o,isAllOverflow:r}=e,{elemStore:i,afterFullData:n,fullAllDataRowIdData:a,isResizeCellHeight:u}=e,s=e.computeRowOpts,d=e.computeCellOpts,c=e.computeDefaultRowHeight,m=e.computeLeftFixedWidth,g=e.computeRightFixedWidth,i=getRefElem(i["main-body-scroll"]),p=getRowid(e,l);if(i){var f=i.clientHeight,h=i.scrollTop,i=i.querySelector(`[rowid="${p}"]`);if(i){var o=i.offsetTop+(t?o:0),i=i.clientHeight;if(o<h||h+f<o)return e.scrollTo(null,o);if(f+h<=o+i)return e.scrollTo(null,h+i)}else if(t)return u||d.height||s.height||!r?(i=(o=a[p]||{}).resizeHeight||d.height||s.height||o.height||c,(t=o.oTop)<h?e.scrollTo(null,t-m-1):e.scrollTo(null,t+i-(f-g-1))):e.scrollTo(null,(e.findRowIndexOf(n,l)-1)*c)}return Promise.resolve()}function colToVisible(t,o,r,l){var{scrollXLoad:i,scrollXLeft:n}=t,{elemStore:a,visibleColumn:u}=t,s=t.computeLeftFixedWidth,d=t.computeRightFixedWidth,a=getRefElem(a["main-body-scroll"]);if(!r.fixed&&a){var c=a.clientWidth,m=a.scrollLeft;let e=null;if(l&&(l=getRowid(t,l),e=a.querySelector(`[rowid="${l}"] .`+r.id)),e=e||a.querySelector("."+r.id)){l=e.offsetLeft+(i?n:0),a=e.clientWidth;if(o||!(l<=m+s&&m+s<l+a)&&!(m+s<=l&&l<m+c-d)){if(l<m+s)return t.scrollTo(l-s-1);if(c-d<l+a-m)return t.scrollTo(l+a-(c-d-1))}}else if(i){let l=0;n=r.renderWidth;for(let e=0;e<u.length;e++){var g=u[e];if(g===r||g.id===r.id)break;l+=g.renderWidth}if(o||!(l<=m+s&&l+n>m+s)&&!(l>=m+s&&l<m+c-d))return l<m?t.scrollTo(l-s-1):t.scrollTo(l+n-(c-d-1))}}return Promise.resolve()}exports.convertHeaderColumnToRows=convertHeaderColumnToRows;
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.assembleColumn=assembleColumn,exports.clearTableAllStatus=clearTableAllStatus,exports.clearTableDefaultStatus=clearTableDefaultStatus,exports.colToVisible=colToVisible,exports.convertHeaderColumnToRows=void 0,exports.convertHeaderToGridRows=convertHeaderToGridRows,exports.createColumn=createColumn,exports.createHandleGetRowId=createHandleGetRowId,exports.createHandleUpdateRowId=createHandleUpdateRowId,exports.createInternalData=createInternalData,exports.createReactData=createReactData,exports.createRowId=createRowId,exports.destroyColumn=destroyColumn,exports.encodeRowid=encodeRowid,exports.getCalcHeight=getCalcHeight,exports.getCellRestHeight=getCellRestHeight,exports.getCellValue=getCellValue,exports.getColReMaxWidth=getColReMaxWidth,exports.getColReMinWidth=getColReMinWidth,exports.getColumnList=getColumnList,exports.getFirstChildColumn=getFirstChildColumn,exports.getLastChildColumn=getLastChildColumn,exports.getRefElem=getRefElem,exports.getRootColumn=getRootColumn,exports.getRowUniqueId=getRowUniqueId,exports.getRowid=getRowid,exports.getRowkey=getRowkey,exports.handleFieldOrColumn=handleFieldOrColumn,exports.handleRowidOrRow=handleRowidOrRow,exports.hasDeepKey=hasDeepKey,exports.isColumnInfo=isColumnInfo,exports.restoreScrollLocation=restoreScrollLocation,exports.rowToVisible=rowToVisible,exports.setCellValue=setCellValue,exports.toFilters=toFilters,exports.toTreePathSeq=toTreePathSeq;var _xeUtils=_interopRequireDefault(require("xe-utils")),_columnInfo=require("./columnInfo"),_dom=require("../../ui/src/dom"),_log=require("../../ui/src/log"),_utils=require("../../ui/src/utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function createInternalData(){return{tZindex:0,currKeyField:"",isCurrDeepKey:!1,elemStore:{},scrollXStore:{preloadSize:0,offsetSize:0,visibleSize:0,visibleStartIndex:0,visibleEndIndex:0,startIndex:0,endIndex:0},scrollYStore:{preloadSize:0,offsetSize:0,visibleSize:0,visibleStartIndex:0,visibleEndIndex:0,startIndex:0,endIndex:0},tableWidth:0,tableHeight:0,customHeight:0,customMinHeight:0,customMaxHeight:0,hoverRow:null,lastScrollLeft:0,lastScrollTop:0,radioReserveRow:null,checkboxReserveRowMap:{},rowExpandedReserveRowMap:{},treeExpandedReserveRowMap:{},treeIndeterminateRowMaps:{},tableFullData:[],afterFullData:[],afterTreeFullData:[],afterGroupFullData:[],afterFullRowMaps:{},tableFullTreeData:[],tableFullGroupData:[],tableSynchData:[],tableSourceData:[],collectColumn:[],tableFullColumn:[],visibleColumn:[],fullAllDataRowIdData:{},fullDataRowIdData:{},visibleDataRowIdData:{},keepUpdateFieldMaps:{},headerFullDataColData:{},footerFullDataRowData:{},sourceDataRowIdData:{},fullColumnIdData:{},fullColumnFieldData:{},currentRow:null,mergeHeaderList:[],mergeHeaderMaps:{},mergeHeaderCellMaps:{},mergeHeaderRowMaps:{},mergeHeaderColMaps:{},mergeBodyList:[],mergeBodyMaps:{},mergeBodyCellMaps:{},mergeBodyRowMaps:{},mergeBodyColMaps:{},mergeFooterList:[],mergeFooterMaps:{},mergeFooterCellMaps:{},mergeFooterRowMaps:{},mergeFooterColMaps:{},rowExpandedMaps:{},rowExpandLazyLoadedMaps:{},rowGroupExpandedMaps:{},treeExpandedMaps:{},treeExpandLazyLoadedMaps:{},selectCheckboxMaps:{},pendingRowMaps:{},insertRowMaps:{},removeRowMaps:{},cvCacheMaps:{},tHeaderHeight:0,tBodyHeight:0,tFooterHeight:0,stackHistoryStore:{undoStacks:[],redoStacks:[]},teleportToWrapperElem:null,popupToWrapperElem:null,customPopupToElem:null,lastSTime:0,inited:!1,tooltipTimeout:null,initStatus:!1,isActivated:!1}}function createReactData(){return{updateColFlag:0,staticColumns:[],tableGroupColumn:[],tableColumn:[],tableData:[],scrollXLoad:!1,scrollYLoad:!1,overflowY:!0,overflowX:!1,scrollbarWidth:0,scrollbarHeight:0,rowHeight:0,parentHeight:0,isGroup:!1,isAllOverflow:!1,isAllSelected:!1,isIndeterminate:!1,currentColumn:null,selectRadioRow:null,footerTableData:[],rowGroupColumn:null,expandColumn:null,checkboxColumn:null,radioColumn:null,treeNodeColumn:null,hasFixedColumn:!1,upDataFlag:0,reColumnFlag:0,initStore:{filter:!1,import:!1,export:!1,custom:!1},customStore:{btnEl:null,isAll:!1,isIndeterminate:!1,activeBtn:!1,activeWrapper:!1,visible:!1,maxHeight:null,popupStyle:{},oldSortMaps:{},oldFixedMaps:{},oldVisibleMaps:{}},customColumnList:[],filterStore:{isAllSelected:!1,isIndeterminate:!1,style:null,column:null,visible:!1,maxHeight:null},columnStore:{leftList:[],centerList:[],rightList:[],resizeList:[],pxList:[],pxMinList:[],autoMinList:[],scaleList:[],scaleMinList:[],autoList:[],remainList:[]},ctxMenuStore:{selected:null,visible:!1,showChild:!1,selectChild:null,list:[],style:null},editStore:{indexs:{columns:[]},titles:{columns:[]},selected:{row:null,column:null},copyed:{cut:!1,rows:[],columns:[]},actived:{row:null,column:null},focused:{row:null,column:null}},tooltipStore:{row:null,column:null,content:"",visible:!1,type:null,currOpts:{}},validStore:{visible:!1},validErrorMaps:{},importStore:{inited:!1,file:null,type:"",modeList:[],typeList:[],filename:"",visible:!1},importParams:{mode:"",types:null,message:!0},exportStore:{inited:!1,name:"",modeList:[],typeList:[],columns:[],isPrint:!1,hasFooter:!1,hasMerge:!1,hasTree:!1,hasRowGroup:!1,hasColgroup:!1,visible:!1},exportParams:{filename:"",sheetName:"",mode:"",type:"",isColgroup:!1,isMerge:!1,isTreeAllExpanded:!1,isRowGroupAllExpanded:!1,useStyle:!1,original:!1,message:!0,isHeader:!1,isTitle:!1,isFooter:!1},visiblwRowsFlag:1,isRowGroupStatus:!1,rowGroupList:[],aggHandleFields:[],aggHandleAggColumns:[],rowGroupExpandedFlag:1,rowExpandedFlag:1,treeExpandedFlag:1,updateCheckboxFlag:1,pendingRowFlag:1,insertRowFlag:1,removeRowFlag:1,mergeHeadFlag:1,mergeBodyFlag:1,mergeFootFlag:1,rowHeightStore:{large:52,default:48,medium:44,small:40,mini:36},scrollVMLoading:!1,scrollYHeight:0,scrollYTop:0,isScrollYBig:!1,scrollXLeft:0,scrollXWidth:0,isScrollXBig:!1,lazScrollLoading:!1,rowExpandHeightFlag:1,calcCellHeightFlag:1,resizeHeightFlag:1,resizeWidthFlag:1,isCustomStatus:!1,isCustomDragStatus:!0,ctPopupFlag:1,isCrossDragRow:!1,dragRow:null,isCrossDragCol:!1,dragCol:null,dragTipText:"",isDragResize:!1,isRowLoading:!1,isColLoading:!1}}let getAllConvertColumns=(e,t)=>{let l=[];return e.forEach(e=>{e.parentId=t?t.id:null,e.visible&&(e.children&&e.children.length&&e.children.some(e=>e.visible)?(l.push(e),l.push(...getAllConvertColumns(e.children,e))):l.push(e))}),l},convertHeaderColumnToRows=e=>{let t=1,o=(l,e)=>{if(e&&(l.level=e.level+1,t<l.level)&&(t=l.level),l.children&&l.children.length&&l.children.some(e=>e.visible)){let t=0;l.children.forEach(e=>{e.visible&&(o(e,l),t+=e.colSpan)}),l.colSpan=t}else l.colSpan=1},l=(e.forEach(e=>{e.level=1,o(e)}),[]);for(let e=0;e<t;e++)l.push([]);return getAllConvertColumns(e).forEach(e=>{e.children&&e.children.length&&e.children.some(e=>e.visible)?e.rowSpan=1:e.rowSpan=t-e.level+1,l[e.level-1].push(e)}),l};function convertHeaderToGridRows(t){var l=t.length,i=t[0].reduce((e,t)=>e+t.colSpan,0),n=[],a=[];for(let e=0;e<l;e++){var o=[],r=[];for(let e=0;e<i;e++)o.push(!1),r.push("");n.push(o),a.push(r)}for(let r=0;r<l;r++){let e=0;for(var u of t[r]){var{colSpan:s,rowSpan:d}=u;let o=-1;for(let l=e;l<=i-s;l++){let t=!0;for(let e=0;e<s;e++)if(n[r][l+e]){t=!1;break}if(t){o=l;break}}if(-1===o){for(let l=0;l<=i-s;l++){let t=!0;for(let e=0;e<s;e++)if(n[r][l+e]){t=!1;break}if(t){o=l;break}}if(-1===o)break}for(let t=r;t<r+d;t++)for(let e=o;e<o+s;e++)n[t][e]=!0,a[t][e]=u;e=o+s}}return a}function restoreScrollLocation(e,t,l){var o=e;return t||l?(o.intoRunScroll=!1,o.inVirtualScroll=!1,o.inWheelScroll=!1,o.inHeaderScroll=!1,o.inBodyScroll=!1,o.inFooterScroll=!1,o.scrollRenderType="",e.scrollTo(t,l)):e.clearScroll()}function toTreePathSeq(e){return e.map((e,t)=>t%2==0?Number(e)+1:".").join("")}function getRowUniqueId(){return _xeUtils.default.uniqueId("row_")}function createRowId(e,t,l){e=e.createKeyMethod;return e?""+e({row:t,keyField:l}):getRowUniqueId()}function hasDeepKey(e){return-1<e.indexOf(".")}function getRowkey(e){e=e.currKeyField;return e}function getRowid(e,t){var{isCurrDeepKey:e,currKeyField:l}=e;return t?encodeRowid((e?getDeepRowIdByKey:getFastRowIdByKey)(t,l)):""}function createHandleUpdateRowId(e){let{isCurrDeepKey:t,currKeyField:l}=e,o=e.computeRowOpts,r=t?updateDeepRowKey:updateFastRowKey;return{rowKey:l,handleUpdateRowId(e){return e?r(o,e,l):""}}}function createHandleGetRowId(e){let{isCurrDeepKey:t,currKeyField:l}=e,o=t?getDeepRowIdByKey:getFastRowIdByKey;return{rowKey:l,handleGetRowId(e){return e?encodeRowid(o(e,l)):""}}}function encodeRowid(e){return _xeUtils.default.eqNull(e)?"":encodeURIComponent(e)}function getDeepRowIdByKey(e,t){return _xeUtils.default.get(e,t)}function updateDeepRowKey(e,t,l){let o=encodeRowid(getDeepRowIdByKey(t,l));return(0,_utils.eqEmptyValue)(o)&&(e=createRowId(e,t,l),o=""+e,_xeUtils.default.set(t,l,o)),o}function getFastRowIdByKey(e,t){return e[t]}function updateFastRowKey(e,t,l){let o=encodeRowid(getFastRowIdByKey(t,l));return(0,_utils.eqEmptyValue)(o)&&(e=createRowId(e,t,l),o=""+e,t[l]=e),o}function getPaddingLeftRightSize(e){return e?(e=getComputedStyle(e),_xeUtils.default.toNumber(e.paddingLeft)+_xeUtils.default.toNumber(e.paddingRight)):0}function getElementMarginAndWidth(e){var t,l;return e?(l=getComputedStyle(e),t=_xeUtils.default.toNumber(l.marginLeft),l=_xeUtils.default.toNumber(l.marginRight),e.offsetWidth+t+l):0}function getCalcHeight(e){return"unset"!==e&&e||0}function handleFieldOrColumn(e,t){return t?_xeUtils.default.isString(t)||_xeUtils.default.isNumber(t)?e.getColumnByField(""+t):t:null}function handleRowidOrRow(e,t){return t?(t=_xeUtils.default.isString(t)||_xeUtils.default.isNumber(t)?t:getRowid(e,t),e.getRowById(t)):null}function getCellRestHeight(e,t,l,o){return e.resizeHeight||t.height||l.height||e.height||o}function assembleColumn(e){var t=e.$xeTable,l=t.staticColumns,{$el:e,$xeColumn:o,columnConfig:r}=e,i=o?o.columnConfig:null;i?("vxe-table-column"===o.$options._componentTag?(0,_log.errLog)("vxe.error.groupTag",[`<vxe-table-colgroup title=${o.title} ...>`,`<vxe-table-column title=${o.title} ...>`]):"vxe-column"===o.$options._componentTag&&(0,_log.warnLog)("vxe.error.groupTag",[`<vxe-colgroup title=${o.title} ...>`,`<vxe-column title=${o.title} ...>`]),i.children||(i.children=[]),r.defaultParentId=i.id,i.children.splice(_xeUtils.default.arrayIndexOf(o.$el.children,e),0,r)):l.splice(_xeUtils.default.arrayIndexOf(t.$refs.hideColumn.children,e),0,r)}function destroyColumn(e){var t=e.$xeTable.staticColumns;let l=e.columnConfig;e=_xeUtils.default.findTree(t,e=>e===l);e&&e.items.splice(e.index,1)}function getRootColumn(e,t){var l=e.fullColumnIdData;if(!t)return null;let o=t.parentId;for(;l[o];){let e=l[o].column;if(!(o=e.parentId))return e}return t}function toFilters(e,i){return e&&(_xeUtils.default.isArray(e)?e.map(({label:e,value:t,data:l,resetValue:o,checked:r})=>({label:e,value:t,data:l,resetValue:o,checked:!!r,_checked:!!r,_colId:i})):[])}function getColReMaxWidth(e){var{$table:t,column:l,cell:o}=e,r=t.elemStore,i=t.computeResizableOpts.maxWidth,l=l.maxWidth||t.computeColumnOpts.maxWidth;if(i){t=_xeUtils.default.isFunction(i)?i(e):i;if("auto"!==t)return Math.max(1,_xeUtils.default.toNumber(t))}e=_xeUtils.default.floor(1.8*(_xeUtils.default.toNumber(getComputedStyle(o).fontSize)||14))+(getPaddingLeftRightSize(o)+getPaddingLeftRightSize((0,_dom.queryElement)(o,".vxe-cell")));if(l){i=getRefElem(r["main-body-scroll"]);if(i){if((0,_dom.isScale)(l))return t=(i.clientWidth-1)/100,Math.max(e,Math.floor(_xeUtils.default.toInteger(l)*t));if((0,_dom.isPx)(l))return Math.max(e,_xeUtils.default.toInteger(l))}}return-1}function getColReMinWidth(e){var{$table:t,column:l,cell:o}=e,r=t,i=t,n=t.computeResizableOpts,t=t.computeColumnOpts,n=n.minWidth;if(n){e=_xeUtils.default.isFunction(n)?n(e):n;if("auto"!==e)return Math.max(1,_xeUtils.default.toNumber(e))}var a,u,s,n=i.elemStore,e=r.showHeaderOverflow,i=l.showHeaderOverflow,r=l.minWidth||t.minWidth,l=_xeUtils.default.isUndefined(i)||_xeUtils.default.isNull(i)?e:i,t="title"===l||(!0===l||"tooltip"===l)||"ellipsis"===l;let d=_xeUtils.default.floor(1.8*(_xeUtils.default.toNumber(getComputedStyle(o).fontSize)||14))+(getPaddingLeftRightSize(o)+getPaddingLeftRightSize((0,_dom.queryElement)(o,".vxe-cell")));if(t&&(e=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--drag-handle")),i=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--checkbox")),l=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--required-icon")),t=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--edit-icon")),a=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell-title-prefix-icon")),u=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell-title-suffix-icon")),s=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--sort")),o=getElementMarginAndWidth((0,_dom.queryElement)(o,".vxe-cell--filter")),d+=e+i+l+t+a+u+o+s),r){e=getRefElem(n["main-body-scroll"]);if(e){if((0,_dom.isScale)(r))return i=(e.clientWidth-1)/100,Math.max(d,Math.floor(_xeUtils.default.toInteger(r)*i));if((0,_dom.isPx)(r))return Math.max(d,_xeUtils.default.toInteger(r))}}return d}function getFirstChildColumn(e){var t=e.children;return t&&t.length?getFirstChildColumn(_xeUtils.default.first(t)):e}function getLastChildColumn(e){var t=e.children;return t&&t.length?getFirstChildColumn(_xeUtils.default.last(t)):e}function getCellValue(e,t){return t?_xeUtils.default.get(e,t.field):null}function setCellValue(e,t,l){t&&_xeUtils.default.set(e,t.field,l)}function getRefElem(e){return e?e.$el||e:null}function clearTableDefaultStatus(e){var t=e,l=(e.initStatus=!1,[e.clearSort(),e.clearCurrentRow(),e.clearCurrentColumn(),e.clearRadioRow(),e.clearRadioReserve(),e.clearCheckboxRow(),e.clearCheckboxReserve(),e.clearRowExpand(),e.clearTreeExpand(),e.clearTreeExpandReserve(),e.clearPendingRow()]);return e.clearFilter&&l.push(e.clearFilter()),e.clearSelected&&(t.keyboardConfig||t.mouseConfig)&&l.push(e.clearSelected()),e.clearCellAreas&&t.mouseConfig&&l.push(e.clearCellAreas(),e.clearCopyCellArea()),Promise.all(l).then(()=>e.clearScroll())}function clearTableAllStatus(e){return e.clearFilter&&e.clearFilter(),clearTableDefaultStatus(e)}function isColumnInfo(e){return e instanceof _columnInfo.ColumnInfo}function getColumnList(e){let t=[];return e.forEach(e=>{t.push(...e.children&&e.children.length?getColumnList(e.children):[e])}),t}function createColumn(e,t,l){return isColumnInfo(t)?t:new _columnInfo.ColumnInfo(e,t,l)}function rowToVisible(e,t){var{scrollYLoad:l,scrollYTop:o,isAllOverflow:r}=e,{elemStore:i,afterFullData:n,fullAllDataRowIdData:a,isResizeCellHeight:u}=e,s=e.computeRowOpts,d=e.computeCellOpts,c=e.computeDefaultRowHeight,m=e.computeLeftFixedWidth,g=e.computeRightFixedWidth,i=getRefElem(i["main-body-scroll"]),p=getRowid(e,t);if(i){var f=i.clientHeight,h=i.scrollTop,i=i.querySelector(`[rowid="${p}"]`);if(i){var o=i.offsetTop+(l?o:0),i=i.clientHeight;if(o<h||h+f<o)return e.scrollTo(null,o);if(f+h<=o+i)return e.scrollTo(null,h+i)}else if(l)return u||d.height||s.height||!r?(i=(o=a[p]||{}).resizeHeight||d.height||s.height||o.height||c,(l=o.oTop)<h?e.scrollTo(null,l-m-1):e.scrollTo(null,l+i-(f-g-1))):e.scrollTo(null,(e.findRowIndexOf(n,t)-1)*c)}return Promise.resolve()}function colToVisible(l,o,r,t){var{scrollXLoad:i,scrollXLeft:n}=l,{elemStore:a,visibleColumn:u}=l,s=l.computeLeftFixedWidth,d=l.computeRightFixedWidth,a=getRefElem(a["main-body-scroll"]);if(!r.fixed&&a){var c=a.clientWidth,m=a.scrollLeft;let e=null;if(t&&(t=getRowid(l,t),e=a.querySelector(`[rowid="${t}"] .`+r.id)),e=e||a.querySelector("."+r.id)){t=e.offsetLeft+(i?n:0),a=e.clientWidth;if(o||!(t<=m+s&&m+s<t+a)&&!(m+s<=t&&t<m+c-d)){if(t<m+s)return l.scrollTo(t-s-1);if(c-d<t+a-m)return l.scrollTo(t+a-(c-d-1))}}else if(i){let t=0;n=r.renderWidth;for(let e=0;e<u.length;e++){var g=u[e];if(g===r||g.id===r.id)break;t+=g.renderWidth}if(o||!(t<=m+s&&t+n>m+s)&&!(t>=m+s&&t<m+c-d))return t<m?l.scrollTo(t-s-1):l.scrollTo(t+n-(c-d-1))}}return Promise.resolve()}exports.convertHeaderColumnToRows=convertHeaderColumnToRows;
|
package/lib/ui/index.js
CHANGED
|
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "VxeUI", {
|
|
|
13
13
|
exports.version = exports.validators = exports.use = exports.t = exports.setup = exports.setTheme = exports.setLanguage = exports.setIcon = exports.setI18n = exports.setConfig = exports.saveFile = exports.renderer = exports.readFile = exports.print = exports.modal = exports.menus = exports.log = exports.interceptor = exports.globalResize = exports.globalEvents = exports.getTheme = exports.getIcon = exports.getI18n = exports.getConfig = exports.formats = exports.default = exports.config = exports.commands = exports.clipboard = exports._t = void 0;
|
|
14
14
|
var _core = require("@vxe-ui/core");
|
|
15
15
|
var _utils = require("./src/utils");
|
|
16
|
-
const version = exports.version = "3.21.
|
|
16
|
+
const version = exports.version = "3.21.6";
|
|
17
17
|
_core.VxeUI.version = version;
|
|
18
18
|
_core.VxeUI.tableVersion = version;
|
|
19
19
|
_core.VxeUI.setConfig({
|
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.globalResize=exports.globalEvents=exports.getTheme=exports.getIcon=exports.getI18n=exports.getConfig=exports.formats=exports.default=exports.config=exports.commands=exports.clipboard=exports._t=void 0;var _core=require("@vxe-ui/core"),_utils=require("./src/utils");let version=exports.version="3.21.
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.VXETable=void 0,Object.defineProperty(exports,"VxeUI",{enumerable:!0,get:function(){return _core.VxeUI}}),exports.version=exports.validators=exports.use=exports.t=exports.setup=exports.setTheme=exports.setLanguage=exports.setIcon=exports.setI18n=exports.setConfig=exports.saveFile=exports.renderer=exports.readFile=exports.print=exports.modal=exports.menus=exports.log=exports.interceptor=exports.globalResize=exports.globalEvents=exports.getTheme=exports.getIcon=exports.getI18n=exports.getConfig=exports.formats=exports.default=exports.config=exports.commands=exports.clipboard=exports._t=void 0;var _core=require("@vxe-ui/core"),_utils=require("./src/utils");let version=exports.version="3.21.6",iconPrefix=(_core.VxeUI.version=version,_core.VxeUI.tableVersion=version,_core.VxeUI.setConfig({emptyCell:" ",table:{fit:!0,showHeader:!0,animat:!0,delayHover:250,autoResize:!0,padding:!0,resizeConfig:{},resizableConfig:{dragMode:"auto",showDragTip:!0,isSyncAutoHeight:!0,isSyncAutoWidth:!0,minHeight:18},currentRowConfig:{strict:!0},currentColumnConfig:{strict:!0},radioConfig:{strict:!0},rowDragConfig:{showIcon:!0,animation:!0,showGuidesStatus:!0,showDragTip:!0},columnDragConfig:{showIcon:!0,animation:!0,showGuidesStatus:!0,showDragTip:!0},checkboxConfig:{strict:!0},tooltipConfig:{enterable:!0,defaultPlacement:"top"},headerTooltipConfig:{enterable:!0},footerTooltipConfig:{enterable:!0},validConfig:{showErrorMessage:!0,autoClear:!0,autoPos:!0,message:"inline",msgMode:"single",theme:"beautify"},columnConfig:{autoOptions:{isCalcHeader:!0,isCalcBody:!0,isCalcFooter:!0},maxFixedSize:4},cellConfig:{padding:!0},headerCellConfig:{height:"unset"},footerCellConfig:{height:"unset"},menuConfig:{destroyOnClose:!0},customConfig:{allowVisible:!0,allowResizable:!0,allowFixed:!0,allowSort:!0,showSortDragButton:!0,showFooter:!0,placement:"top-right",storeOptions:{visible:!0,resizable:!0,sort:!0,fixed:!0},modalOptions:{showMaximize:!0,mask:!0,lockView:!0,resize:!0,escClosable:!0},drawerOptions:{mask:!0,lockView:!0,escClosable:!0,resize:!0}},sortConfig:{showIcon:!0,allowClear:!0,allowBtn:!0,iconLayout:"vertical"},filterConfig:{destroyOnClose:!0,multiple:!0,showIcon:!0,maxHeight:280},floatingFilterConfig:{},aggregateConfig:{padding:!0,placement:"left",rowField:"id",parentField:"_X_ROW_PARENT_KEY",childrenField:"_X_ROW_CHILDREN",mapChildrenField:"_X_ROW_CHILD_LIST",indent:20,showIcon:!0,maxGroupSize:4,showAggFuncTitle:!0},treeConfig:{padding:!0,rowField:"id",parentField:"parentId",childrenField:"children",hasChildField:"hasChild",mapChildrenField:"_X_ROW_CHILD",indent:20,showIcon:!0,showRootLine:!0},expandConfig:{showIcon:!0,mode:"fixed"},editConfig:{showIcon:!0,showAsterisk:!0,autoFocus:!0},importConfig:{_typeMaps:{csv:1,html:1,xml:1,txt:1}},exportConfig:{_typeMaps:{csv:1,html:1,xml:1,txt:1}},printConfig:{},mouseConfig:{extension:!0},keyboardConfig:{isAll:!0,isEsc:!0},areaConfig:{autoClear:!0,selectCellByHeader:!0,selectCellByBody:!0,extendDirection:{top:!0,left:!0,bottom:!0,right:!0}},clipConfig:{isCopy:!0,isCut:!0,isPaste:!0},fnrConfig:{isFind:!0,isReplace:!0},virtualXConfig:{gt:24,preSize:0,oSize:0},virtualYConfig:{gt:100,preSize:1,oSize:0},scrollbarConfig:{x:{visible:!0},y:{visible:!0}},undoRedoHistoryConfig:{stackSize:50}},grid:{formConfig:{enabled:!0},pagerConfig:{enabled:!0},toolbarConfig:{enabled:!0},proxyConfig:{enabled:!0,autoLoad:!0,showLoading:!0,showResponseMsg:!0,showActionMsg:!0,response:{list:"list",result:"result",total:"page.total",footerData:"footerData",message:"message"}}},toolbar:{},gantt:{}}),"vxe-table-icon-"),setTheme=(_core.VxeUI.setIcon({TABLE_SORT_ASC:iconPrefix+"caret-up",TABLE_SORT_DESC:iconPrefix+"caret-down",TABLE_FILTER_NONE:iconPrefix+"funnel",TABLE_FILTER_MATCH:iconPrefix+"funnel",TABLE_EDIT:iconPrefix+"edit",TABLE_TITLE_PREFIX:iconPrefix+"question-circle-fill",TABLE_TITLE_SUFFIX:iconPrefix+"question-circle-fill",TABLE_TREE_LOADED:iconPrefix+"spinner roll",TABLE_TREE_OPEN:iconPrefix+"caret-right rotate90",TABLE_TREE_CLOSE:iconPrefix+"caret-right",TABLE_EXPAND_LOADED:iconPrefix+"spinner roll",TABLE_EXPAND_OPEN:iconPrefix+"arrow-right rotate90",TABLE_EXPAND_CLOSE:iconPrefix+"arrow-right",TABLE_CHECKBOX_CHECKED:iconPrefix+"checkbox-checked-fill",TABLE_CHECKBOX_UNCHECKED:iconPrefix+"checkbox-unchecked",TABLE_CHECKBOX_INDETERMINATE:iconPrefix+"checkbox-indeterminate-fill",TABLE_CHECKBOX_DISABLED_UNCHECKED:iconPrefix+"checkbox-unchecked-fill",TABLE_RADIO_CHECKED:iconPrefix+"radio-checked-fill",TABLE_RADIO_UNCHECKED:iconPrefix+"radio-unchecked",TABLE_RADIO_DISABLED_UNCHECKED:iconPrefix+"radio-unchecked-fill",TABLE_CUSTOM_SORT:iconPrefix+"drag-handle",TABLE_MENU_OPTIONS:iconPrefix+"arrow-right",TABLE_MENU_OPTION_LOADING:iconPrefix+"repeat roll",TABLE_DRAG_ROW:iconPrefix+"drag-handle",TABLE_DRAG_COLUMN:iconPrefix+"drag-handle",TABLE_DRAG_STATUS_ROW:iconPrefix+"sort",TABLE_DRAG_STATUS_SUB_ROW:iconPrefix+"add-sub",TABLE_DRAG_STATUS_AGG_GROUP:iconPrefix+"grouping",TABLE_DRAG_STATUS_AGG_VALUES:iconPrefix+"values",TABLE_DRAG_STATUS_COLUMN:iconPrefix+"swap",TABLE_DRAG_DISABLED:iconPrefix+"no-drop",TABLE_ROW_GROUP_OPEN:iconPrefix+"arrow-right rotate90",TABLE_ROW_GROUP_CLOSE:iconPrefix+"arrow-right",TABLE_AGGREGATE_GROUPING:iconPrefix+"grouping",TABLE_AGGREGATE_VALUES:iconPrefix+"values",TABLE_AGGREGATE_SORT:iconPrefix+"drag-handle",TABLE_AGGREGATE_DELETE:iconPrefix+"close",TOOLBAR_TOOLS_REFRESH:iconPrefix+"repeat",TOOLBAR_TOOLS_REFRESH_LOADING:iconPrefix+"repeat roll",TOOLBAR_TOOLS_IMPORT:iconPrefix+"upload",TOOLBAR_TOOLS_EXPORT:iconPrefix+"download",TOOLBAR_TOOLS_PRINT:iconPrefix+"print",TOOLBAR_TOOLS_FULLSCREEN:iconPrefix+"fullscreen",TOOLBAR_TOOLS_MINIMIZE:iconPrefix+"minimize",TOOLBAR_TOOLS_CUSTOM:iconPrefix+"custom-column",TOOLBAR_TOOLS_FIXED_LEFT:iconPrefix+"fixed-left",TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE:iconPrefix+"fixed-left-fill",TOOLBAR_TOOLS_FIXED_RIGHT:iconPrefix+"fixed-right",TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE:iconPrefix+"fixed-right-fill"}),exports.setTheme=_core.VxeUI.setTheme),getTheme=exports.getTheme=_core.VxeUI.getTheme,setConfig=exports.setConfig=_core.VxeUI.setConfig,getConfig=exports.getConfig=_core.VxeUI.getConfig,setIcon=exports.setIcon=_core.VxeUI.setIcon,getIcon=exports.getIcon=_core.VxeUI.getIcon,setLanguage=exports.setLanguage=_core.VxeUI.setLanguage,setI18n=exports.setI18n=_core.VxeUI.setI18n,getI18n=exports.getI18n=_core.VxeUI.getI18n,globalEvents=exports.globalEvents=_core.VxeUI.globalEvents,globalResize=exports.globalResize=_core.VxeUI.globalResize,renderer=exports.renderer=_core.VxeUI.renderer,validators=exports.validators=_core.VxeUI.validators,menus=exports.menus=_core.VxeUI.menus,formats=exports.formats=_core.VxeUI.formats,commands=exports.commands=_core.VxeUI.commands,interceptor=exports.interceptor=_core.VxeUI.interceptor,clipboard=exports.clipboard=_core.VxeUI.clipboard,log=exports.log=_core.VxeUI.log,use=exports.use=_core.VxeUI.use,setup=e=>_core.VxeUI.setConfig(e),config=(exports.setup=setup,_core.VxeUI.setup=setup,e=>_core.VxeUI.setConfig(e)),t=(exports.config=config,_core.VxeUI.config=config,(e,o)=>_core.VxeUI.getI18n(e,o)),_t=(exports.t=t,_core.VxeUI.t=t,(e,o)=>(0,_utils.getFuncText)(e,o)),VXETable=(exports._t=_t,_core.VxeUI._t=_t,exports.VXETable=_core.VxeUI),saveFile=e=>_core.VxeUI.saveFile(e),readFile=(exports.saveFile=saveFile,e=>_core.VxeUI.readFile(e)),print=(exports.readFile=readFile,e=>_core.VxeUI.print(e)),modal=(exports.print=print,exports.modal={get(e){return _core.VxeUI.modal.get(e)},close(e){return _core.VxeUI.modal.close(e)},open(e){return _core.VxeUI.modal.open(e)},alert(e,o,r){return _core.VxeUI.modal.alert(e,o,r)},confirm(e,o,r){return _core.VxeUI.modal.confirm(e,o,r)},message(e,o){return _core.VxeUI.modal.message(e,o)},notification(e,o,r){return _core.VxeUI.modal.notification(e,o,r)}});var _default=exports.default=_core.VxeUI;
|
package/lib/ui/src/log.js
CHANGED
|
@@ -8,6 +8,6 @@ var _core = require("@vxe-ui/core");
|
|
|
8
8
|
const {
|
|
9
9
|
log
|
|
10
10
|
} = _core.VxeUI;
|
|
11
|
-
const version = `table v${"3.21.
|
|
11
|
+
const version = `table v${"3.21.6"}`;
|
|
12
12
|
const warnLog = exports.warnLog = log.create('warn', version);
|
|
13
13
|
const errLog = exports.errLog = log.create('error', version);
|
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 v3.21.
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core");let log=_core.VxeUI.log,version="table v3.21.6",warnLog=exports.warnLog=log.create("warn",version),errLog=exports.errLog=log.create("error",version);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxe-table",
|
|
3
|
-
"version": "3.21.
|
|
3
|
+
"version": "3.21.6",
|
|
4
4
|
"description": "A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "npm install --legacy-peer-deps",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"vue-i18n": "^8.15.1",
|
|
69
69
|
"vue-router": "^3.5.1",
|
|
70
70
|
"vue-template-compiler": "2.6.14",
|
|
71
|
-
"vxe-pc-ui": "3.14.
|
|
71
|
+
"vxe-pc-ui": "3.14.26"
|
|
72
72
|
},
|
|
73
73
|
"vetur": {
|
|
74
74
|
"tags": "helper/vetur/tags.json",
|
|
@@ -370,7 +370,7 @@ function getBooleanValue (cellValue: any) {
|
|
|
370
370
|
function getHeaderTitle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions, column: VxeTableDefines.ColumnInfo) {
|
|
371
371
|
const columnOpts = $xeTable.computeColumnOpts
|
|
372
372
|
const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod
|
|
373
|
-
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ?
|
|
373
|
+
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ? $xeTable.getHeaderCellLabel(column) : column.field) || '')
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
function getFooterCellValue ($xeTable: any, opts: VxeTablePropTypes.ExportHandleOptions, row: any, column: VxeTableDefines.ColumnInfo) {
|
|
@@ -946,12 +946,12 @@ function handleImport ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, c
|
|
|
946
946
|
const tableTitleMaps: Record<string, VxeTableDefines.ColumnInfo> = {}
|
|
947
947
|
tableFullColumn.forEach((column) => {
|
|
948
948
|
const field = column.field
|
|
949
|
-
const title =
|
|
949
|
+
const title = $xeTable.getHeaderCellLabel(column)
|
|
950
950
|
if (field) {
|
|
951
951
|
tableFieldMaps[field] = column
|
|
952
952
|
}
|
|
953
953
|
if (title) {
|
|
954
|
-
tableTitleMaps[
|
|
954
|
+
tableTitleMaps[title] = column
|
|
955
955
|
}
|
|
956
956
|
})
|
|
957
957
|
const tableConf = {
|
|
@@ -379,7 +379,7 @@ export const Cell = {
|
|
|
379
379
|
return getSlotVNs(renderTitleContent(h, params, rtHeader.call($table, h, renderOpts, params))) as VNode[]
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
return renderTitleContent(h, params,
|
|
382
|
+
return renderTitleContent(h, params, $table.getHeaderCellLabel(column))
|
|
383
383
|
},
|
|
384
384
|
renderDefaultHeader (h: CreateElement, params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
385
385
|
return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params))
|
|
@@ -391,7 +391,7 @@ export const Cell = {
|
|
|
391
391
|
const tableInternalData = $table as unknown as TableInternalData
|
|
392
392
|
const { isRowGroupStatus } = tableReactData
|
|
393
393
|
const { editConfig } = tableProps
|
|
394
|
-
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc
|
|
394
|
+
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column
|
|
395
395
|
const isEnableEdit = editConfig && isEnableConf(editConfig)
|
|
396
396
|
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
|
|
397
397
|
const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null
|
|
@@ -464,8 +464,9 @@ export const Cell = {
|
|
|
464
464
|
return renderCellBaseVNs(h, params, $table.callSlot(defaultSlot, params, h))
|
|
465
465
|
}
|
|
466
466
|
const renderOpts = editRenderOpts || cellRenderOpts
|
|
467
|
-
//
|
|
468
|
-
|
|
467
|
+
// 如果是编辑表格:renderTableCell > formatter
|
|
468
|
+
// 如果是查看表格:renderTableDefault > formatter
|
|
469
|
+
if (renderOpts) {
|
|
469
470
|
const compConf = renderer.get(renderOpts.name)
|
|
470
471
|
if (compConf) {
|
|
471
472
|
const renderFn = editRenderOpts ? (compConf.renderTableCell || compConf.renderCell) : (compConf.renderTableDefault || compConf.renderDefault)
|
|
@@ -640,7 +641,7 @@ export const Cell = {
|
|
|
640
641
|
renderSeqHeader (h: CreateElement, params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
641
642
|
const { $table, column } = params
|
|
642
643
|
const { slots } = column
|
|
643
|
-
return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, params, slots && slots.header ? $table.callSlot(slots.header, params, h) :
|
|
644
|
+
return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, params, slots && slots.header ? $table.callSlot(slots.header, params, h) : $table.getHeaderCellLabel(column)))
|
|
644
645
|
},
|
|
645
646
|
renderSeqCell (h: CreateElement, params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
646
647
|
const { $table, column } = params
|
|
@@ -675,7 +676,7 @@ export const Cell = {
|
|
|
675
676
|
: [
|
|
676
677
|
h('span', {
|
|
677
678
|
class: 'vxe-radio--label'
|
|
678
|
-
}, titleSlot ? $table.callSlot(titleSlot, params, h) :
|
|
679
|
+
}, titleSlot ? $table.callSlot(titleSlot, params, h) : $table.getHeaderCellLabel(column))
|
|
679
680
|
])
|
|
680
681
|
)
|
|
681
682
|
},
|
|
@@ -751,7 +752,7 @@ export const Cell = {
|
|
|
751
752
|
const titleSlot = slots ? slots.title : null
|
|
752
753
|
const checkboxOpts = $table.computeCheckboxOpts
|
|
753
754
|
const { checkStrictly, showHeader, headerTitle } = checkboxOpts
|
|
754
|
-
const colTitle =
|
|
755
|
+
const colTitle = $table.getHeaderCellLabel(column)
|
|
755
756
|
const ons: Record<string, any> = {}
|
|
756
757
|
if (!isHidden) {
|
|
757
758
|
ons.click = (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
|
|
|
@@ -29,10 +29,6 @@ export class ColumnInfo {
|
|
|
29
29
|
|
|
30
30
|
const filters = toFilters(_vm.filters, colId)
|
|
31
31
|
|
|
32
|
-
if (headerFormatter) {
|
|
33
|
-
errLog('vxe.error.notProp', ['header-formatter'])
|
|
34
|
-
}
|
|
35
|
-
|
|
36
32
|
const types = ['seq', 'checkbox', 'radio', 'expand', 'html']
|
|
37
33
|
if (_vm.type && types.indexOf(_vm.type) === -1) {
|
|
38
34
|
warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')])
|
|
@@ -3,7 +3,7 @@ import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollLe
|
|
|
3
3
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils'
|
|
4
4
|
import { VxeUI } from '../../ui'
|
|
5
5
|
import Cell from './cell'
|
|
6
|
-
import { getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight, getLastChildColumn } from './util'
|
|
6
|
+
import { getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight, getLastChildColumn } from './util'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
8
|
import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from '../../ui/src/anime'
|
|
9
9
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
@@ -2418,6 +2418,7 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
2418
2418
|
if (!xHandleEl) {
|
|
2419
2419
|
return
|
|
2420
2420
|
}
|
|
2421
|
+
const columnOpts = $xeTable.computeColumnOpts
|
|
2421
2422
|
let tWidth = 0
|
|
2422
2423
|
const minCellWidth = 40 // 列宽最少限制 40px
|
|
2423
2424
|
const bodyWidth = bodyWrapperElem.clientWidth
|
|
@@ -2426,53 +2427,92 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
2426
2427
|
const { fit } = props
|
|
2427
2428
|
const { columnStore } = reactData
|
|
2428
2429
|
const { resizeList, pxMinList, autoMinList, pxList, scaleList, scaleMinList, autoList, remainList } = columnStore
|
|
2430
|
+
|
|
2431
|
+
const parseColumnMaxWidth = (column: VxeTableDefines.ColumnInfo) => {
|
|
2432
|
+
const maxWidth = column.maxWidth || columnOpts.maxWidth
|
|
2433
|
+
if (maxWidth && maxWidth !== 'auto') {
|
|
2434
|
+
if (isScale(maxWidth)) {
|
|
2435
|
+
return Math.floor(XEUtils.toInteger(maxWidth) * meanWidth)
|
|
2436
|
+
}
|
|
2437
|
+
return XEUtils.toInteger(maxWidth)
|
|
2438
|
+
}
|
|
2439
|
+
return 0
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2429
2442
|
// 最小宽
|
|
2430
2443
|
pxMinList.forEach((column) => {
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2444
|
+
let miWidth = XEUtils.toInteger(column.minWidth)
|
|
2445
|
+
const mxWidth = parseColumnMaxWidth(column)
|
|
2446
|
+
if (mxWidth) {
|
|
2447
|
+
miWidth = Math.min(miWidth, mxWidth)
|
|
2448
|
+
}
|
|
2449
|
+
tWidth += miWidth
|
|
2450
|
+
column.renderWidth = miWidth
|
|
2434
2451
|
})
|
|
2435
2452
|
// 最小自适应
|
|
2436
2453
|
autoMinList.forEach((column) => {
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2454
|
+
let caWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
|
|
2455
|
+
const mxWidth = parseColumnMaxWidth(column)
|
|
2456
|
+
if (mxWidth) {
|
|
2457
|
+
caWidth = Math.min(caWidth, mxWidth)
|
|
2458
|
+
}
|
|
2459
|
+
tWidth += caWidth
|
|
2460
|
+
column.renderWidth = caWidth
|
|
2440
2461
|
})
|
|
2441
2462
|
// 最小百分比
|
|
2442
2463
|
scaleMinList.forEach((column) => {
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2464
|
+
let smWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth)
|
|
2465
|
+
const mxWidth = parseColumnMaxWidth(column)
|
|
2466
|
+
if (mxWidth) {
|
|
2467
|
+
smWidth = Math.min(smWidth, mxWidth)
|
|
2468
|
+
}
|
|
2469
|
+
tWidth += smWidth
|
|
2470
|
+
column.renderWidth = smWidth
|
|
2446
2471
|
})
|
|
2447
2472
|
// 固定百分比
|
|
2448
2473
|
scaleList.forEach((column) => {
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2474
|
+
let sfWidth = Math.floor(XEUtils.toInteger(column.width) * meanWidth)
|
|
2475
|
+
const mxWidth = parseColumnMaxWidth(column)
|
|
2476
|
+
if (mxWidth) {
|
|
2477
|
+
sfWidth = Math.min(sfWidth, mxWidth)
|
|
2478
|
+
}
|
|
2479
|
+
tWidth += sfWidth
|
|
2480
|
+
column.renderWidth = sfWidth
|
|
2452
2481
|
})
|
|
2453
2482
|
// 固定宽
|
|
2454
2483
|
pxList.forEach((column) => {
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2484
|
+
let pWidth = XEUtils.toInteger(column.width)
|
|
2485
|
+
const mxWidth = parseColumnMaxWidth(column)
|
|
2486
|
+
if (mxWidth) {
|
|
2487
|
+
pWidth = Math.min(pWidth, mxWidth)
|
|
2488
|
+
}
|
|
2489
|
+
tWidth += pWidth
|
|
2490
|
+
column.renderWidth = pWidth
|
|
2458
2491
|
})
|
|
2459
2492
|
// 自适应宽
|
|
2460
2493
|
autoList.forEach((column) => {
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2494
|
+
let aWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth))
|
|
2495
|
+
const mxWidth = parseColumnMaxWidth(column)
|
|
2496
|
+
if (mxWidth) {
|
|
2497
|
+
aWidth = Math.min(aWidth, mxWidth)
|
|
2498
|
+
}
|
|
2499
|
+
tWidth += aWidth
|
|
2500
|
+
column.renderWidth = aWidth
|
|
2464
2501
|
})
|
|
2502
|
+
|
|
2465
2503
|
// 调整了列宽
|
|
2466
2504
|
resizeList.forEach((column) => {
|
|
2467
2505
|
const width = XEUtils.toInteger(column.resizeWidth)
|
|
2468
2506
|
tWidth += width
|
|
2469
2507
|
column.renderWidth = width
|
|
2470
2508
|
})
|
|
2509
|
+
|
|
2510
|
+
const zoomColumnList = scaleMinList.concat(pxMinList).concat(autoMinList).filter(column => !parseColumnMaxWidth(column))
|
|
2471
2511
|
remainWidth -= tWidth
|
|
2472
|
-
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (
|
|
2512
|
+
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (zoomColumnList.length + remainList.length)) : 0
|
|
2473
2513
|
if (fit) {
|
|
2474
2514
|
if (remainWidth > 0) {
|
|
2475
|
-
|
|
2515
|
+
zoomColumnList.forEach((column) => {
|
|
2476
2516
|
tWidth += meanWidth
|
|
2477
2517
|
column.renderWidth += meanWidth
|
|
2478
2518
|
})
|
|
@@ -2490,8 +2530,9 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
2490
2530
|
/**
|
|
2491
2531
|
* 偏移量算法
|
|
2492
2532
|
* 如果所有列足够放的情况下,从最后动态列开始分配
|
|
2533
|
+
* 排除已设置 max-width
|
|
2493
2534
|
*/
|
|
2494
|
-
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList)
|
|
2535
|
+
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList).filter(column => !parseColumnMaxWidth(column))
|
|
2495
2536
|
let dynamicSize = dynamicList.length - 1
|
|
2496
2537
|
if (dynamicSize > 0) {
|
|
2497
2538
|
let i = bodyWidth - tWidth
|
|
@@ -3931,6 +3972,7 @@ function handleInitColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
3931
3972
|
loadScrollXData($xeTable)
|
|
3932
3973
|
}
|
|
3933
3974
|
})
|
|
3975
|
+
$xeTable.clearHeaderFormatterCache()
|
|
3934
3976
|
$xeTable.clearMergeCells()
|
|
3935
3977
|
$xeTable.clearMergeFooterItems()
|
|
3936
3978
|
$xeTable.handleTableData(true)
|
|
@@ -5626,6 +5668,89 @@ const tableMethods: any = {
|
|
|
5626
5668
|
}
|
|
5627
5669
|
return $xeTable.$nextTick()
|
|
5628
5670
|
},
|
|
5671
|
+
getHeaderCellLabel (fieldOrColumn: string | VxeTableDefines.ColumnInfo) {
|
|
5672
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5673
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
5674
|
+
|
|
5675
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
5676
|
+
if (!column) {
|
|
5677
|
+
return null
|
|
5678
|
+
}
|
|
5679
|
+
const { headerFormatter } = column
|
|
5680
|
+
const _columnIndex = $xeTable.getVTColumnIndex(column)
|
|
5681
|
+
let cellLabel = column.getTitle()
|
|
5682
|
+
if (headerFormatter) {
|
|
5683
|
+
let formatData: Record<string, VxeTableDefines.RowCacheFormatObj> | undefined
|
|
5684
|
+
const { headerFullDataColData } = internalData
|
|
5685
|
+
const colid = column.id
|
|
5686
|
+
let colRest = headerFullDataColData[colid]
|
|
5687
|
+
if (!colRest) {
|
|
5688
|
+
colRest = headerFullDataColData[colid] = {}
|
|
5689
|
+
}
|
|
5690
|
+
const formatObj = colRest.formatObj
|
|
5691
|
+
if (formatObj && formatObj.value === cellLabel) {
|
|
5692
|
+
return formatObj.label
|
|
5693
|
+
}
|
|
5694
|
+
const headFormatParams = {
|
|
5695
|
+
$table: $xeTable,
|
|
5696
|
+
cellTitle: cellLabel,
|
|
5697
|
+
cellValue: cellLabel,
|
|
5698
|
+
column,
|
|
5699
|
+
_columnIndex,
|
|
5700
|
+
columnIndex: $xeTable.getColumnIndex(column)
|
|
5701
|
+
}
|
|
5702
|
+
if (XEUtils.isString(headerFormatter)) {
|
|
5703
|
+
const gFormatOpts = formats.get(headerFormatter)
|
|
5704
|
+
const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null
|
|
5705
|
+
cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams) : '')
|
|
5706
|
+
} else if (XEUtils.isArray(headerFormatter)) {
|
|
5707
|
+
const gFormatOpts = formats.get(headerFormatter[0])
|
|
5708
|
+
const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null
|
|
5709
|
+
cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams, ...headerFormatter.slice(1)) : '')
|
|
5710
|
+
} else {
|
|
5711
|
+
cellLabel = XEUtils.toValueString(headerFormatter(headFormatParams))
|
|
5712
|
+
}
|
|
5713
|
+
if (formatData) {
|
|
5714
|
+
colRest.formatObj = { value: cellLabel, label: cellLabel }
|
|
5715
|
+
}
|
|
5716
|
+
}
|
|
5717
|
+
return cellLabel
|
|
5718
|
+
},
|
|
5719
|
+
updateHeaderCellLabel (fieldOrColumn: string | VxeTableDefines.ColumnInfo) {
|
|
5720
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5721
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
5722
|
+
|
|
5723
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn)
|
|
5724
|
+
if (!column) {
|
|
5725
|
+
return ''
|
|
5726
|
+
}
|
|
5727
|
+
const { headerFullDataColData } = internalData
|
|
5728
|
+
const colid = column.id
|
|
5729
|
+
const colRest = headerFullDataColData[colid]
|
|
5730
|
+
if (colRest) {
|
|
5731
|
+
colRest.formatObj = undefined
|
|
5732
|
+
}
|
|
5733
|
+
return $xeTable.getHeaderCellLabel(column)
|
|
5734
|
+
},
|
|
5735
|
+
clearHeaderFormatterCache (isUpdate?: boolean) {
|
|
5736
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5737
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
5738
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
5739
|
+
|
|
5740
|
+
const { tableColumn } = reactData
|
|
5741
|
+
const { headerFullDataColData } = internalData
|
|
5742
|
+
XEUtils.each(headerFullDataColData, (colRest: VxeTableDefines.HeaderColCacheItem) => {
|
|
5743
|
+
if (colRest.formatObj) {
|
|
5744
|
+
colRest.formatObj = undefined
|
|
5745
|
+
}
|
|
5746
|
+
})
|
|
5747
|
+
if (isUpdate) {
|
|
5748
|
+
tableColumn.forEach(column => {
|
|
5749
|
+
$xeTable.getHeaderCellLabel(column)
|
|
5750
|
+
})
|
|
5751
|
+
}
|
|
5752
|
+
return $xeTable.$nextTick()
|
|
5753
|
+
},
|
|
5629
5754
|
getFooterCellLabel (row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo) {
|
|
5630
5755
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5631
5756
|
const reactData = $xeTable as unknown as TableReactData
|
|
@@ -6689,6 +6814,7 @@ const tableMethods: any = {
|
|
|
6689
6814
|
const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth
|
|
6690
6815
|
|
|
6691
6816
|
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth // 列之间的最小间距
|
|
6817
|
+
const maxInterval = getColReMaxWidth(cellParams) // 列之间的最大间距
|
|
6692
6818
|
const dragMinLeft = isRightFixed ? 0 : (cellRect.x - tableRect.x + dragBtnWidth + minInterval)
|
|
6693
6819
|
const dragMaxLeft = cellRect.x - tableRect.x + cell.clientWidth - minInterval
|
|
6694
6820
|
|
|
@@ -6730,6 +6856,10 @@ const tableMethods: any = {
|
|
|
6730
6856
|
}
|
|
6731
6857
|
|
|
6732
6858
|
dragLeft = Math.max(left, dragMinLeft)
|
|
6859
|
+
// 最大宽
|
|
6860
|
+
if (maxInterval > 1) {
|
|
6861
|
+
dragLeft = Math.min(dragLeft, maxInterval + dragMinLeft - minInterval)
|
|
6862
|
+
}
|
|
6733
6863
|
|
|
6734
6864
|
const resizeBarLeft = Math.max(1, dragLeft)
|
|
6735
6865
|
resizeBarElem.style.left = `${resizeBarLeft}px`
|
|
@@ -6817,6 +6947,7 @@ const tableMethods: any = {
|
|
|
6817
6947
|
const cell = dragBtnElem.parentNode as HTMLTableCellElement
|
|
6818
6948
|
const cellParams = Object.assign(params, { cell, $table: $xeTable })
|
|
6819
6949
|
const colMinWidth = getColReMinWidth(cellParams)
|
|
6950
|
+
const colMaxWidth = getColReMaxWidth(cellParams)
|
|
6820
6951
|
|
|
6821
6952
|
el.setAttribute('data-calc-col', 'Y')
|
|
6822
6953
|
let resizeWidth = calcColumnAutoWidth($xeTable, resizeColumn, el)
|
|
@@ -6825,6 +6956,9 @@ const tableMethods: any = {
|
|
|
6825
6956
|
resizeWidth = Math.max(resizeWidth, colRest.width)
|
|
6826
6957
|
}
|
|
6827
6958
|
resizeWidth = Math.max(colMinWidth, resizeWidth)
|
|
6959
|
+
if (colMaxWidth > 1) {
|
|
6960
|
+
resizeWidth = Math.min(colMaxWidth, resizeWidth)
|
|
6961
|
+
}
|
|
6828
6962
|
const resizeParams = { ...params, resizeWidth, resizeColumn }
|
|
6829
6963
|
reactData.isDragResize = false
|
|
6830
6964
|
internalData._lastResizeTime = Date.now()
|
|
@@ -12876,6 +13010,7 @@ const tableMethods: any = {
|
|
|
12876
13010
|
footData = visibleColumn.length ? footerMethod({ columns: visibleColumn, data: afterFullData, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }) : []
|
|
12877
13011
|
}
|
|
12878
13012
|
reactData.footerTableData = footData
|
|
13013
|
+
$xeTable.clearFooterFormatterCache()
|
|
12879
13014
|
$xeTable.handleUpdateFooterMerge()
|
|
12880
13015
|
$xeTable.dispatchEvent('footer-data-change', {
|
|
12881
13016
|
visibleColumn: internalData.visibleColumn,
|