vxe-table 4.15.0 → 4.15.1
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/custom/hook.js +7 -0
- package/es/table/module/custom/panel.js +1 -1
- package/es/table/src/table.js +31 -10
- package/es/ui/index.js +2 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +16 -6
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/hook.js +9 -0
- package/lib/table/module/custom/hook.min.js +1 -1
- package/lib/table/module/custom/panel.js +1 -1
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/src/table.js +3 -3
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +2 -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 +1 -1
- package/packages/table/module/custom/hook.ts +7 -0
- package/packages/table/module/custom/panel.ts +1 -1
- package/packages/table/src/table.ts +31 -10
- package/packages/ui/index.ts +1 -0
- /package/es/{iconfont.1753928735749.ttf → iconfont.1754358078563.ttf} +0 -0
- /package/es/{iconfont.1753928735749.woff → iconfont.1754358078563.woff} +0 -0
- /package/es/{iconfont.1753928735749.woff2 → iconfont.1754358078563.woff2} +0 -0
- /package/lib/{iconfont.1753928735749.ttf → iconfont.1754358078563.ttf} +0 -0
- /package/lib/{iconfont.1753928735749.woff → iconfont.1754358078563.woff} +0 -0
- /package/lib/{iconfont.1753928735749.woff2 → iconfont.1754358078563.woff2} +0 -0
|
@@ -149,6 +149,9 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
|
|
|
149
149
|
$xeTable.handleUpdateAggData();
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
+
if (allowSort) {
|
|
153
|
+
internalData.collectColumn = customColumnList;
|
|
154
|
+
}
|
|
152
155
|
return $xeTable.saveCustomStore('confirm');
|
|
153
156
|
};
|
|
154
157
|
const cancelCustom = () => {
|
|
@@ -249,6 +252,12 @@ _ui.VxeUI.hooks.add('tableCustomModule', {
|
|
|
249
252
|
return (0, _vue.nextTick)();
|
|
250
253
|
};
|
|
251
254
|
const customMethods = {
|
|
255
|
+
getCustomVisible() {
|
|
256
|
+
const {
|
|
257
|
+
customStore
|
|
258
|
+
} = reactData;
|
|
259
|
+
return customStore.visible;
|
|
260
|
+
},
|
|
252
261
|
openCustom,
|
|
253
262
|
closeCustom,
|
|
254
263
|
toggleCustom,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _vue=require("vue"),_ui=require("../../../ui"),_xeUtils=_interopRequireDefault(require("xe-utils")),_util=require("../../src/util");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let tableCustomMethodKeys=["openCustom","closeCustom","toggleCustom","saveCustom","cancelCustom","resetCustom","toggleCustomAllCheckbox","setCustomAllCheckbox"];_ui.VxeUI.hooks.add("tableCustomModule",{setupTable(c){let{reactData:m,internalData:
|
|
1
|
+
var _vue=require("vue"),_ui=require("../../../ui"),_xeUtils=_interopRequireDefault(require("xe-utils")),_util=require("../../src/util");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let tableCustomMethodKeys=["openCustom","closeCustom","toggleCustom","saveCustom","cancelCustom","resetCustom","toggleCustomAllCheckbox","setCustomAllCheckbox"];_ui.VxeUI.hooks.add("tableCustomModule",{setupTable(c){let{reactData:m,internalData:b}=c,{computeCustomOpts:v,computeRowGroupFields:o}=c.getComputeMaps(),r=c.getRefMaps().refElem,l=c.xeGrid,i=()=>{var e=m.customStore,t=r.value;let l=0;t&&(l=t.clientHeight-28),e.maxHeight=Math.max(88,l)},s=()=>{var{initStore:e,customStore:t}=m;return t.visible=!0,e.custom=!0,u(),n(),i(),(0,_vue.nextTick)().then(()=>i())},u=()=>{var e=m.customStore,t=b.collectColumn;if(e.visible){let l={},r={},i={};_xeUtils.default.eachTree(t,e=>{var t=e.getKey();e.renderFixed=e.fixed,e.renderVisible=e.visible,e.renderResizeWidth=e.renderWidth,l[t]=e.renderSortNumber,r[t]=e.fixed,i[t]=e.visible}),e.oldSortMaps=l,e.oldFixedMaps=r,e.oldVisibleMaps=i,m.customColumnList=t.slice(0)}},a=()=>{var e=m.customStore,t=v.value;return e.visible&&(e.visible=!1,t.immediate||c.handleCustom()),(0,_vue.nextTick)()};let t=e=>{var t=m.customStore,l=m.customColumnList,r=v.value;let{checkMethod:i,visibleMethod:s}=r,o=!!e;return r.immediate?(_xeUtils.default.eachTree(l,e=>{s&&!s({$table:c,column:e})||i&&!i({$table:c,column:e})||(e.visible=o,e.renderVisible=o,e.halfVisible=!1)}),t.isAll=o,m.isCustomStatus=!0,c.handleCustom(),c.saveCustomStore("update:visible")):(_xeUtils.default.eachTree(l,e=>{s&&!s({$table:c,column:e})||i&&!i({$table:c,column:e})||(e.renderVisible=o,e.halfVisible=!1)}),t.isAll=o),c.checkCustomStatus(),(0,_vue.nextTick)()};var e={getCustomVisible(){var e=m.customStore;return e.visible},openCustom:s,closeCustom:a,toggleCustom:()=>{var e=m.customStore;return(e.visible?a:s)()},saveCustom:()=>{let{customColumnList:e,aggHandleFields:l,rowGroupList:t}=m;let{allowVisible:s,allowSort:o,allowFixed:u,allowResizable:a,allowGroup:n,allowValues:d}=v.value;return _xeUtils.default.eachTree(e,(e,t,l,r,i)=>{i?e.fixed=i.fixed:(o&&(e.renderSortNumber=t+1),u&&(e.fixed=e.renderFixed)),a&&e.renderVisible&&(!e.children||e.children.length)&&e.renderResizeWidth!==e.renderWidth&&(e.resizeWidth=e.renderResizeWidth,e.renderWidth=e.renderResizeWidth),s&&(e.visible=e.renderVisible),n&&d&&(e.aggFunc=e.renderAggFn)}),m.isCustomStatus=!0,n&&c.handlePivotTableAggregateData&&(t.length!==l.length||t.some((e,t)=>e.field!==l[t])?l.length?c.setRowGroups(l):c.clearRowGroups():d&&c.handleUpdateAggData()),o&&(b.collectColumn=e),c.saveCustomStore("confirm")},cancelCustom:()=>{var{customColumnList:e,customStore:t}=m;let{oldSortMaps:i,oldFixedMaps:s,oldVisibleMaps:o}=t,{allowVisible:u,allowSort:a,allowFixed:n,allowResizable:d}=v.value;return _xeUtils.default.eachTree(e,e=>{var t=e.getKey(),l=!!o[t],r=s[t]||"";u&&(e.renderVisible=l,e.visible=l),n&&(e.renderFixed=r,e.fixed=r),a&&(e.renderSortNumber=i[t]||0),d&&(e.renderResizeWidth=e.renderWidth)},{children:"children"}),(0,_vue.nextTick)()},resetCustom(e){let t=m.rowGroupList;var l=b.collectColumn;let r=v.value.checkMethod,i=Object.assign({visible:!0,resizable:!0===e,fixed:!0===e,sort:!0===e,aggFunc:!0===e},e),s=[];return _xeUtils.default.eachTree(l,e=>{i.resizable&&(e.resizeWidth=0),i.fixed&&(e.fixed=e.defaultFixed),i.sort&&(e.renderSortNumber=e.sortNumber,e.parentId=e.defaultParentId),r&&!r({$table:c,column:e})||(e.visible=e.defaultVisible),i.aggFunc&&(e.aggFunc=e.defaultAggFunc,e.renderAggFn=e.defaultAggFunc),e.renderResizeWidth=e.renderWidth,s.push(e)}),i.sort&&(e=_xeUtils.default.toArrayTree(_xeUtils.default.orderBy(s,"renderSortNumber"),{key:"id",parentKey:"parentId",children:"children"}),b.collectColumn=e,b.tableFullColumn=(0,_util.getColumnList)(e)),m.isCustomStatus=!1,c.handleCustom().then(()=>{var e;i.aggFunc&&c.handlePivotTableAggregateData&&(((e=o.value)||t).length?e&&e.length?c.setRowGroups(e):c.clearRowGroups():c.handleUpdateAggData()),c.saveCustomStore("reset")})},toggleCustomAllCheckbox(){var e=m.customStore,e=!e.isAll;return t(e)},setCustomAllCheckbox:t};let n=()=>{var e=m.customStore,t=b.collectColumn;let l=v.value.checkMethod;e.isAll=t.every(e=>!!l&&!l({$table:c,column:e})||e.renderVisible),e.isIndeterminate=!e.isAll&&t.some(e=>(!l||l({$table:c,column:e}))&&(e.renderVisible||e.halfVisible))},d=(e,t)=>{(l||c).dispatchEvent("custom",{type:e},t)};var h={checkCustomStatus:n,emitCustomEvent:d,triggerCustomEvent(e){var t=c.reactData.customStore;t.visible?(a(),d("close",e)):(t.btnEl=e.target,s(),d("open",e))},customOpenEvent(e){var t=c.reactData.customStore;t.visible||(t.activeBtn=!0,t.btnEl=e.target,c.openCustom(),c.emitCustomEvent("open",e))},customCloseEvent(e){var t=c.reactData.customStore;t.visible&&(t.activeBtn=!1,c.closeCustom(),c.emitCustomEvent("close",e))},handleUpdateCustomColumn:u};return Object.assign(Object.assign({},e),h)},setupGrid(e){return e.extendTableMethods(tableCustomMethodKeys)}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../../ui/src/comp"),_ui=require("../../../ui"),_utils=require("../../../ui/src/utils"),_dom=require("../../../ui/src/dom"),_log=require("../../../ui/src/log"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let{getI18n,getIcon,renderEmptyElement}=_ui.VxeUI;var _default=exports.default=(0,_comp.defineVxeComponent)({name:"TableCustomPanel",props:{customStore:{type:Object,default:()=>({})}},setup(L,t){var e=_xeUtils.default.uniqueId();let M=_ui.VxeUI.getComponent("VxeModal"),R=_ui.VxeUI.getComponent("VxeDrawer"),H=_ui.VxeUI.getComponent("VxeButton"),G=_ui.VxeUI.getComponent("VxeNumberInput"),z=_ui.VxeUI.getComponent("VxeRadioGroup"),P=(0,_vue.inject)("$xeTable",{}),{props:W,reactData:K,internalData:r}=P,{computeCustomOpts:$,computeColumnDragOpts:X,computeColumnOpts:ue,computeIsMaxFixedColumn:q,computeResizableOpts:de}=P.getComputeMaps(),y=(0,_vue.ref)(),j=(0,_vue.ref)(),Y=(0,_vue.ref)(),u=(0,_vue.ref)(),d=(0,_vue.ref)(),f=(0,_vue.reactive)({dragCol:null,dragGroupField:null,dragAggFnCol:null,dragTipText:""}),T={},a={refElem:y,refBodyWrapperElem:j,refCustomBodyElem:Y,refDragLineElem:u,refDragTipElem:d},i={},S=e=>{var t=L.customStore;t.activeWrapper=!0,P.customOpenEvent(e)},k=e=>{let t=L.customStore;t.activeWrapper=!1,setTimeout(()=>{t.activeBtn||t.activeWrapper||P.customCloseEvent(e)},300)},Z=({$event:e})=>{K.isCustomStatus=!0,P.saveCustom(),P.closeCustom(),P.emitCustomEvent("confirm",e)},J=({$event:e})=>{P.closeCustom(),P.emitCustomEvent("close",e)},Q=({$event:e})=>{P.cancelCustom(),P.closeCustom(),P.emitCustomEvent("cancel",e)},l=e=>{P.resetCustom(!0),P.closeCustom(),P.emitCustomEvent("reset",e)},ee=({$event:t})=>{_ui.VxeUI.modal?_ui.VxeUI.modal.confirm({content:getI18n("vxe.custom.cstmConfirmRestore"),className:"vxe-table--ignore-clear",escClosable:!0}).then(e=>{"confirm"===e&&l(t)}):l(t)},o=t=>{var e=K.customColumnList,e=_xeUtils.default.findTree(e,e=>e===t);e&&e.parent&&(e=e.parent,e.children)&&e.children.length&&(e.renderVisible=e.children.every(e=>e.renderVisible),e.halfVisible=!e.renderVisible&&e.children.some(e=>e.renderVisible||e.halfVisible),o(e))},te=(e,t)=>{let l=!e.renderVisible;$.value.immediate?(_xeUtils.default.eachTree([e],e=>{e.visible=l,e.renderVisible=l,e.halfVisible=!1}),K.isCustomStatus=!0,P.handleCustom(),P.saveCustomStore("update:visible")):_xeUtils.default.eachTree([e],e=>{e.renderVisible=l,e.halfVisible=!1}),o(e),P.checkCustomStatus(),P.dispatchEvent("custom-visible-change",{column:e,checked:l},t)},ce=e=>{$.value.immediate&&e.renderResizeWidth!==e.renderWidth&&(e.resizeWidth=e.renderResizeWidth,e.renderWidth=e.renderResizeWidth,K.isCustomStatus=!0,P.handleCustom(),P.saveCustomStore("update:width"))},le=(e,t,l)=>{var o=q.value;let a=null;$.value.immediate?(e.renderFixed===t?(a="",_xeUtils.default.eachTree([e],e=>{e.fixed="",e.renderFixed=""})):o&&!e.renderFixed||(a=t,_xeUtils.default.eachTree([e],e=>{e.fixed=t,e.renderFixed=t})),K.isCustomStatus=!0,P.handleCustom(),P.saveCustomStore("update:fixed")):e.renderFixed===t?(a="",_xeUtils.default.eachTree([e],e=>{e.renderFixed=""})):o&&!e.renderFixed||(a=t,_xeUtils.default.eachTree([e],e=>{e.renderFixed=t})),null!==!a&&P.dispatchEvent("custom-fixed-change",{column:e,fixed:a},l)},oe=e=>{var t=K.customStore,t=!t.isAll;P.toggleCustomAllCheckbox(),P.dispatchEvent("custom-visible-all",{checked:t},e)},c=(e,t,l,o)=>{var a,i,s,r,n=j.value;n&&(r=Y.value)&&(a=T.prevDragToChild,i=n.getBoundingClientRect(),r=r.getBoundingClientRect(),s=u.value,t?s&&(l?(t=t.getBoundingClientRect(),s.style.display="block",s.style.left=Math.max(0,r.x-i.x)+"px",s.style.top=Math.max(1,t.y+n.scrollTop-i.y)+"px",s.style.height=t.height+"px",s.style.width=t.width+"px",s.setAttribute("drag-pos",o),s.setAttribute("drag-to-child",a?"y":"n")):s.style.display=""):s&&(s.style.display="node"),r=d.value)&&(r.style.display="block",r.style.top=Math.min(n.clientHeight+n.scrollTop-r.clientHeight,e.clientY+n.scrollTop-i.y)+"px",r.style.left=Math.min(n.clientWidth+n.scrollLeft-r.clientWidth,e.clientX+n.scrollLeft-i.x)+"px",r.setAttribute("drag-status",l?a?"sub":"normal":"disabled"))},n=()=>{var e=f.dragCol,t=X.value.tooltipMethod;let l="";l=t?""+(t({$table:P,column:e})||""):getI18n("vxe.custom.cstmDragTarget",[e&&"html"!==e.type?e.getTitle():""]),f.dragTipText=l},s=()=>{var e=d.value,t=u.value;e&&(e.style.display=""),t&&(t.style.display="")},ae=e=>{var e=e.currentTarget.parentElement.parentElement.parentElement,t=e.getAttribute("colid"),t=P.getColumnById(t);e.draggable=!0,f.dragCol=t,f.dragGroupField=null,f.dragAggFnCol=null,n(),(0,_dom.addClass)(e,"active--drag-origin")},ie=e=>{e=e.currentTarget.parentElement.parentElement.parentElement;s(),e.draggable=!1,f.dragCol=null,f.dragGroupField=null,(f.dragAggFnCol=null,_dom.removeClass)(e,"active--drag-origin")},se=e=>{e.dataTransfer&&e.dataTransfer.setDragImage((0,_dom.getTpImg)(),0,0),T.prevDragGroupField=null,T.prevDragAggFnColid=null},re=d=>{let c=W.mouseConfig,m=K.customColumnList,v=r.collectColumn;let p=$.value.immediate;var e=d.currentTarget;let{isCrossDrag:g,isSelfToChildDrag:x,isToChildDrag:h,dragEndMethod:t}=X.value;var l=f.dragCol;let{prevDragCol:o,prevDragGroupField:a,prevDragAggFnColid:i,prevDragPos:_,prevDragToChild:b}=T,C="bottom"===_?1:0;if(a||i)P.handlePivotTableAggregatePanelDragendEvent&&P.handlePivotTableAggregatePanelDragendEvent(d);else if(o&&l&&o!==l){let n=l,u=o;Promise.resolve(!t||t({oldColumn:n,newColumn:u,dragColumn:n,dragPos:_,dragToChild:!!b,offsetIndex:C})).then(a=>{if(a){let e=-1,t=-1,l={},o=(_xeUtils.default.eachTree([n],e=>{l[e.id]=e}),!1);if(p){if(n.parentId&&u.parentId){if(!g)return;if(l[u.id]&&(o=!0,!g||!x))return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.message({status:"error",content:getI18n("vxe.error.treeDragChild")}))}else if(n.parentId){if(!g)return}else if(u.parentId){if(!g)return;if(l[u.id]&&(o=!0,!g||!x))return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.message({status:"error",content:getI18n("vxe.error.treeDragChild")}))}var i,s,r,a=_xeUtils.default.findTree(v,e=>e.id===n.id),a=(o&&g&&x?a&&({items:i,index:r}=a,(s=n.children||[]).forEach(e=>{e.parentId=n.parentId}),i.splice(r,1,...s),n.children=[]):a&&({items:i,index:r,parent:s}=a,i.splice(r,1),s||(e=r)),_xeUtils.default.findTree(v,e=>e.id===u.id));a&&({items:i,index:s,parent:r}=a,g&&h&&b?(n.parentId=u.id,u.children=(u.children||[]).concat([n])):(n.parentId=u.parentId,i.splice(s+C,0,n)),r||(t=s)),_xeUtils.default.eachTree(v,(e,t,l,o,a)=>{a||(e.renderSortNumber=t+1)})}else e=_xeUtils.default.findIndexOf(m,e=>e.id===n.id),m.splice(e,1),t=_xeUtils.default.findIndexOf(m,e=>e.id===u.id),m.splice(t+C,0,n);c&&(P.clearSelected&&P.clearSelected(),P.clearCellAreas)&&(P.clearCellAreas(),P.clearCopyCellArea()),P.dispatchEvent("column-dragend",{oldColumn:n,newColumn:u,dragColumn:n,dragPos:_,offsetIndex:C,_index:{newIndex:t,oldIndex:e}},d),p&&(K.customColumnList=v.slice(0),P.handleColDragSwapColumn())}}).catch(()=>{})}s(),f.dragCol=null,f.dragGroupField=null,f.dragAggFnCol=null,T.prevDragGroupField=null,T.prevDragAggFnColid=null,e.draggable=!1,e.removeAttribute("drag-pos"),(0,_dom.removeClass)(e,"active--drag-target"),(0,_dom.removeClass)(e,"active--drag-origin")},ne=e=>{var t,l=$.value.immediate,{isCrossDrag:o,isToChildDrag:a}=X.value,i=e.currentTarget,s=(0,_dom.hasControlKey)(e),r=i.getAttribute("colid"),r=P.getColumnById(r),n=f.dragCol;T.prevDragGroupField=null,T.prevDragAggFnColid=null,r&&(o||1===r.level)&&(e.preventDefault(),t=e.clientY-i.getBoundingClientRect().y<i.clientHeight/2?"top":"bottom",!n||n.id===r.id||!o&&1<r.level||!l&&1<r.level||r.renderFixed?c(e,i,!1,t):(T.prevDragToChild=!!(o&&a&&s&&l),T.prevDragCol=r,T.prevDragPos=t,c(e,i,!0,t)))},me=()=>{var e=f.dragTipText,t=X.value;return(0,_vue.h)("div",{},[(0,_vue.h)("div",{ref:u,class:["vxe-table-custom-popup--drag-line",{"is--guides":t.showGuidesStatus}]}),(0,_vue.h)("div",{ref:d,class:"vxe-table-custom-popup--drag-tip"},[(0,_vue.h)("div",{class:"vxe-table-custom-popup--drag-tip-wrapper"},[(0,_vue.h)("div",{class:"vxe-table-custom-popup--drag-tip-status"},[(0,_vue.h)("span",{class:["vxe-table-custom-popup--drag-tip-normal-status",getIcon().TABLE_DRAG_STATUS_ROW]}),(0,_vue.h)("span",{class:["vxe-table-custom-popup--drag-tip-sub-status",getIcon().TABLE_DRAG_STATUS_SUB_ROW]}),(0,_vue.h)("span",{class:["vxe-table-custom-popup--drag-tip-group-status",getIcon().TABLE_DRAG_STATUS_AGG_GROUP]}),(0,_vue.h)("span",{class:["vxe-table-custom-popup--drag-tip-values-status",getIcon().TABLE_DRAG_STATUS_AGG_VALUES]}),(0,_vue.h)("span",{class:["vxe-table-custom-popup--drag-tip-disabled-status",getIcon().TABLE_DRAG_DISABLED]})]),(0,_vue.h)("div",{class:"vxe-table-custom-popup--drag-tip-content"},""+(e||""))])])])};(0,_vue.nextTick)(()=>{var e=$.value.mode;M||"modal"!==e||(0,_log.errLog)("vxe.error.reqComp",["vxe-modal"]),R||"drawer"!==e||(0,_log.errLog)("vxe.error.reqComp",["vxe-drawer"]),H||(0,_log.errLog)("vxe.error.reqComp",["vxe-button"]),G||(0,_log.errLog)("vxe.error.reqComp",["vxe-number-input"]),z||(0,_log.errLog)("vxe.error.reqComp",["vxe-radio-group"])});e={xID:e,props:L,context:t,reactData:f,internalData:T,xeTable:P,getRefMaps:()=>a,getComputeMaps:()=>i,renderVN:()=>{var e=$.value;return(["modal","drawer","popup"].includes(""+e.mode)?()=>{var e=P.xeGrid;let t=L.customStore,{treeConfig:l,rowGroupConfig:o,aggregateConfig:a,resizable:d}=W,{isCustomStatus:i,customColumnList:s}=K,r=$.value,c=r.immediate;var n=X.value;let{mode:u,modalOptions:m,drawerOptions:v,allowVisible:p,allowSort:g,allowFixed:x,allowResizable:h,checkMethod:_,visibleMethod:b}=r,C=ue.value,f=C.maxFixedSize,{minWidth:T,maxWidth:I}=de.value;var E=Object.assign({},m),V=Object.assign({},v);let A=q.value,U=n.isCrossDrag;n=r.slots||{};let D=n.header,y=n.top,S=n.bottom,k=n.default,F=n.footer,B=[],w=t.isAll,O=t.isIndeterminate,N={$table:P,$grid:e,columns:s,isAllChecked:w,isAllIndeterminate:O,isCustomStatus:i};_xeUtils.default.eachTree(s,(o,a,e,t,i)=>{if(!b||b({$table:P,column:o})){let e=0,t=0;h&&(a={$table:P,column:o,columnIndex:a,$columnIndex:a,$rowIndex:-1},T&&(e=_xeUtils.default.toNumber(_xeUtils.default.isFunction(T)?T(a):T)),I)&&(t=_xeUtils.default.toNumber(_xeUtils.default.isFunction(I)?I(a):I));var a=o.renderVisible,s=o.halfVisible,r=(0,_utils.formatText)(o.getTitle(),1),n=o.children&&o.children.length;let l=!!_&&!_({$table:P,column:o});var u=!a;B.push((0,_vue.h)("tr",{key:o.id,colid:o.id,class:["vxe-table-custom-popup--row level--"+o.level,{"is--group":n}],onDragstart:se,onDragend:re,onDragover:ne},[p?(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--visible"},[(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":a,"is--indeterminate":s,"is--disabled":l}],title:getI18n("vxe.custom.setting.colVisible"),onClick:e=>{l||te(o,e)}},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",s?getIcon().TABLE_CHECKBOX_INDETERMINATE:a?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]})])]):(0,_vue.createCommentVNode)(),(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--name"},[(0,_vue.h)("div",{class:"vxe-table-custom-popup--name"},[g?U&&c||1===o.level?(0,_vue.h)("div",Object.assign({class:["vxe-table-custom-popup--column-sort-btn",{"is--disabled":l||u||o.renderFixed}],title:getI18n("vxe.custom.setting.sortHelpTip")},l||u||o.renderFixed?{}:{onMousedown:ae,onMouseup:ie}),[(0,_vue.h)("i",{class:getIcon().TABLE_CUSTOM_SORT})]):(0,_vue.h)("div",{class:"vxe-table-custom-popup--column-sort-placeholder"}):(0,_vue.createCommentVNode)(),"html"===o.type?(0,_vue.h)("div",{key:"1",class:"vxe-table-custom-popup--title",innerHTML:r}):(0,_vue.h)("div",{key:"0",class:"vxe-table-custom-popup--title",title:r},r)])]),h?(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--resizable"},[o.children&&o.children.length||!(_xeUtils.default.isBoolean(o.resizable)?o.resizable:C.resizable||d)?(0,_vue.h)("span","-"):G?(0,_vue.h)(G,{type:"integer",immediate:!1,disabled:l||u,modelValue:o.renderResizeWidth,min:e||void 0,max:t||void 0,"onUpdate:modelValue"(e){e=Math.max(0,Number(e));o.renderResizeWidth=e},onChange(){ce(o)}}):(0,_vue.createCommentVNode)()]):(0,_vue.createCommentVNode)(),x?(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--fixed"},[i?(0,_vue.h)("span","-"):z?(0,_vue.h)(z,{modelValue:o.renderFixed||"",type:"button",size:"mini",disabled:l||u,options:[{label:getI18n("vxe.custom.setting.fixedLeft"),value:"left",disabled:l||u||A},{label:getI18n("vxe.custom.setting.fixedUnset"),value:"",disabled:l||u},{label:getI18n("vxe.custom.setting.fixedRight"),value:"right",disabled:l||u||A}],onChange({label:e,$event:t}){le(o,e,t)}}):(0,_vue.createCommentVNode)()]):(0,_vue.createCommentVNode)()]))}});n={default:()=>(0,_vue.h)("div",{ref:j,class:"vxe-table-custom-popup--body-wrapper"},k?P.callSlot(k,N):[(0,_vue.h)("div",{ref:Y,class:"vxe-table-custom-popup--handle-wrapper"},[y?(0,_vue.h)("div",{class:"vxe-table-custom-popup--table-top"},P.callSlot(y,N)):renderEmptyElement(P),(0,_vue.h)("div",{class:"vxe-table-custom-popup--table-wrapper"},[(0,_vue.h)("table",{},[(0,_vue.h)("colgroup",{},[p?(0,_vue.h)("col",{class:"vxe-table-custom-popup--table-col-seq"}):(0,_vue.createCommentVNode)(),(0,_vue.h)("col",{class:"vxe-table-custom-popup--table-col-title"}),h?(0,_vue.h)("col",{class:"vxe-table-custom-popup--table-col-width"}):(0,_vue.createCommentVNode)(),x?(0,_vue.h)("col",{class:"vxe-table-custom-popup--table-col-fixed"}):(0,_vue.createCommentVNode)()]),(0,_vue.h)("thead",{},[(0,_vue.h)("tr",{},[p?(0,_vue.h)("th",{},[(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":w,"is--indeterminate":O}],title:getI18n("vxe.table.allTitle"),onClick:oe},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",O?getIcon().TABLE_CHECKBOX_INDETERMINATE:w?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]}),(0,_vue.h)("span",{class:"vxe-checkbox--label"},getI18n("vxe.toolbar.customAll"))])]):(0,_vue.createCommentVNode)(),(0,_vue.h)("th",{},getI18n("vxe.custom.setting.colTitle")),h?(0,_vue.h)("th",{},getI18n("vxe.custom.setting.colResizable")):(0,_vue.createCommentVNode)(),x?(0,_vue.h)("th",{},getI18n("vxe.custom.setting."+(f?"colFixedMax":"colFixed"),[f])):(0,_vue.createCommentVNode)()])]),(0,_vue.h)(_vue.TransitionGroup,{class:"vxe-table-custom--panel-list",tag:"tbody",name:"vxe-table-custom--list"},{default:()=>B})])]),S?(0,_vue.h)("div",{class:"vxe-table-custom-popup--table-bottom"},P.callSlot(S,N)):renderEmptyElement(P),me()]),!l&&(a||o)&&P.getPivotTableAggregatePopupPanel?(0,_vue.h)(P.getPivotTableAggregatePopupPanel(),{customStore:t}):renderEmptyElement(P)]),footer:()=>F?P.callSlot(F,N):(0,_vue.h)("div",{class:"vxe-table-custom-popup--footer"},[H?(0,_vue.h)(H,{content:r.resetButtonText||getI18n("vxe.custom.cstmRestore"),disabled:!i,onClick:ee}):(0,_vue.createCommentVNode)(),c?H?(0,_vue.h)(H,{content:r.closeButtonText||getI18n("vxe.table.customClose"),onClick:J}):(0,_vue.createCommentVNode)():H?(0,_vue.h)(H,{content:r.cancelButtonText||getI18n("vxe.table.customCancel"),onClick:Q}):(0,_vue.createCommentVNode)(),!c&&H?(0,_vue.h)(H,{status:"primary",content:r.confirmButtonText||getI18n("vxe.custom.cstmConfirm"),onClick:Z}):(0,_vue.createCommentVNode)()])};return D&&(n.header=()=>P.callSlot(D,N)),"drawer"===u?R?(0,_vue.h)(R,{key:"drawer",className:["vxe-table-custom-drawer-wrapper","vxe-table--ignore-clear",V.className||""].join(" "),modelValue:t.visible,title:V.title||getI18n("vxe.custom.cstmTitle"),width:V.width||Math.min(880,Math.floor(.6*document.documentElement.clientWidth)),position:V.position,resize:!!V.resize,escClosable:!!V.escClosable,maskClosable:!!V.maskClosable,destroyOnClose:!0,showFooter:!0,"onUpdate:modelValue"(e){t.visible=e}},n):(0,_vue.createCommentVNode)():M?(0,_vue.h)(M,{key:"modal",className:["vxe-table-custom-modal-wrapper","vxe-table--ignore-clear",E.className||""].join(" "),modelValue:t.visible,title:E.title||getI18n("vxe.custom.cstmTitle"),width:E.width||Math.min(880,document.documentElement.clientWidth),minWidth:E.minWidth||700,height:E.height||Math.min(680,document.documentElement.clientHeight),minHeight:E.minHeight||400,showZoom:E.showZoom,showMaximize:E.showMaximize,showMinimize:E.showMinimize,mask:E.mask,lockView:E.lockView,resize:E.resize,escClosable:!!E.escClosable,maskClosable:!!E.maskClosable,destroyOnClose:!0,showFooter:!0,"onUpdate:modelValue"(e){t.visible=e}},n):(0,_vue.createCommentVNode)()}:()=>{var e=P.xeGrid,t=P.props,l=L.customStore,{treeConfig:t,rowGroupConfig:o,aggregateConfig:a}=t,{isCustomStatus:i,customColumnList:s}=K,r=$.value;let d=r.immediate;var n=X.value,u=l.maxHeight;let{checkMethod:c,visibleMethod:m,allowVisible:v,allowSort:p,allowFixed:g,trigger:x,placement:h}=r,_=q.value,b=n.isCrossDrag;var n=r.slots||{},C=n.header,f=n.top,T=n.bottom,I=n.default,n=n.footer;let E=[];var V={},A=l.isAll,D=l.isIndeterminate,e=("hover"===x&&(V.onMouseenter=S,V.onMouseleave=k),{$table:P,$grid:e,columns:s,isAllChecked:A,isAllIndeterminate:D,isCustomStatus:i});return _xeUtils.default.eachTree(s,(l,e,t,o,a)=>{if(!m||m({$table:P,column:l})){var i=l.renderVisible,s=l.halfVisible,r=l.children&&l.children.length,n=(0,_utils.formatText)(l.getTitle(),1);let t=!!c&&!c({$table:P,column:l});var u=!i;E.push((0,_vue.h)("li",{key:l.id,colid:l.id,class:["vxe-table-custom--option","level--"+l.level,{"is--hidden":t||u,"is--group":r}],onDragstart:se,onDragend:re,onDragover:ne},[v?(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":i,"is--indeterminate":s,"is--disabled":t}],title:getI18n("vxe.custom.setting.colVisible"),onClick:e=>{t||te(l,e)}},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",s?getIcon().TABLE_CHECKBOX_INDETERMINATE:i?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]})]):(0,_vue.createCommentVNode)(),(0,_vue.h)("div",{class:"vxe-table-custom--name-option"},[p&&(b&&d||1===l.level)?(0,_vue.h)("div",{class:"vxe-table-custom--sort-option"},[(0,_vue.h)("span",Object.assign({class:["vxe-table-custom--sort-btn",{"is--disabled":t||u||l.renderFixed}],title:getI18n("vxe.custom.setting.sortHelpTip")},t||u||l.renderFixed?{}:{onMousedown:ae,onMouseup:ie}),[(0,_vue.h)("i",{class:getIcon().TABLE_CUSTOM_SORT})])]):(0,_vue.createCommentVNode)(),"html"===l.type?(0,_vue.h)("div",{key:"1",class:"vxe-table-custom--checkbox-label",innerHTML:n}):(0,_vue.h)("div",{key:"0",class:"vxe-table-custom--checkbox-label"},n)]),!a&&g?(0,_vue.h)("div",{class:"vxe-table-custom--fixed-option"},[H?(0,_vue.h)(H,{mode:"text",icon:"left"===l.renderFixed?getIcon().TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE:getIcon().TOOLBAR_TOOLS_FIXED_LEFT,status:"left"===l.renderFixed?"primary":"",disabled:t||u||_&&!l.renderFixed,title:getI18n("left"===l.renderFixed?"vxe.toolbar.cancelFixed":"vxe.toolbar.fixedLeft"),onClick:({$event:e})=>{le(l,"left",e)}}):(0,_vue.createCommentVNode)(),H?(0,_vue.h)(H,{mode:"text",icon:"right"===l.renderFixed?getIcon().TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE:getIcon().TOOLBAR_TOOLS_FIXED_RIGHT,status:"right"===l.renderFixed?"primary":"",disabled:t||u||_&&!l.renderFixed,title:getI18n("right"===l.renderFixed?"vxe.toolbar.cancelFixed":"vxe.toolbar.fixedRight"),onClick:({$event:e})=>{le(l,"right",e)}}):(0,_vue.createCommentVNode)()]):(0,_vue.createCommentVNode)()]))}}),(0,_vue.h)("div",{ref:y,key:"simple",class:["vxe-table-custom-wrapper","placement--"+h,{"is--active":l.visible}],style:u&&!["left","right"].includes(h||"")?{maxHeight:u+"px"}:{}},l.visible?[(0,_vue.h)("div",{ref:j,class:"vxe-table-custom-simple--body-wrapper"},[!t&&(a||o)&&P.getPivotTableAggregateSimplePanel?(0,_vue.h)(P.getPivotTableAggregateSimplePanel(),{customStore:l}):renderEmptyElement(P),(0,_vue.h)("div",{ref:Y,class:"vxe-table-custom--handle-wrapper"},[(0,_vue.h)("div",{class:"vxe-table-custom--header"},C?P.callSlot(C,e):[(0,_vue.h)("ul",{class:"vxe-table-custom--panel-list"},[(0,_vue.h)("li",{class:"vxe-table-custom--option"},[v?(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":A,"is--indeterminate":D}],title:getI18n("vxe.table.allTitle"),onClick:oe},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",D?getIcon().TABLE_CHECKBOX_INDETERMINATE:A?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]}),(0,_vue.h)("span",{class:"vxe-checkbox--label"},getI18n("vxe.toolbar.customAll"))]):(0,_vue.h)("span",{class:"vxe-checkbox--label"},getI18n("vxe.table.customTitle"))])])]),(0,_vue.h)("div",{class:"vxe-table-custom--body"},[f?(0,_vue.h)("div",{class:"vxe-table-custom--panel-top"},P.callSlot(f,e)):renderEmptyElement(P),I?(0,_vue.h)("div",{class:"vxe-table-custom--panel-body"},P.callSlot(I,e)):(0,_vue.h)(_vue.TransitionGroup,Object.assign({class:"vxe-table-custom--panel-list",name:"vxe-table-custom--list",tag:"ul"},V),{default:()=>E}),T?(0,_vue.h)("div",{class:"vxe-table-custom--panel-bottom"},P.callSlot(T,e)):renderEmptyElement(P)]),r.showFooter?(0,_vue.h)("div",{class:"vxe-table-custom--footer"},n?P.callSlot(n,e):[(0,_vue.h)("div",{class:"vxe-table-custom--footer-buttons"},[H?(0,_vue.h)(H,{mode:"text",content:r.resetButtonText||getI18n("vxe.table.customRestore"),disabled:!i,onClick:ee}):(0,_vue.createCommentVNode)(),d?H?(0,_vue.h)(H,{mode:"text",content:r.closeButtonText||getI18n("vxe.table.customClose"),onClick:J}):(0,_vue.createCommentVNode)():H?(0,_vue.h)(H,{mode:"text",content:r.cancelButtonText||getI18n("vxe.table.customCancel"),onClick:Q}):(0,_vue.createCommentVNode)(),!d&&H?(0,_vue.h)(H,{mode:"text",status:"primary",content:r.confirmButtonText||getI18n("vxe.table.customConfirm"),onClick:Z}):(0,_vue.createCommentVNode)()])]):null]),me()])]:[])})()}};return(0,_vue.provide)("$xeTableCustomPanel",e),e},render(){return this.renderVN()}});
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../../ui/src/comp"),_ui=require("../../../ui"),_utils=require("../../../ui/src/utils"),_dom=require("../../../ui/src/dom"),_log=require("../../../ui/src/log"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let{getI18n,getIcon,renderEmptyElement}=_ui.VxeUI;var _default=exports.default=(0,_comp.defineVxeComponent)({name:"TableCustomPanel",props:{customStore:{type:Object,default:()=>({})}},setup(L,t){var e=_xeUtils.default.uniqueId();let M=_ui.VxeUI.getComponent("VxeModal"),R=_ui.VxeUI.getComponent("VxeDrawer"),H=_ui.VxeUI.getComponent("VxeButton"),G=_ui.VxeUI.getComponent("VxeNumberInput"),z=_ui.VxeUI.getComponent("VxeRadioGroup"),P=(0,_vue.inject)("$xeTable",{}),{props:W,reactData:K,internalData:r}=P,{computeCustomOpts:$,computeColumnDragOpts:X,computeColumnOpts:ue,computeIsMaxFixedColumn:q,computeResizableOpts:de}=P.getComputeMaps(),y=(0,_vue.ref)(),j=(0,_vue.ref)(),Y=(0,_vue.ref)(),u=(0,_vue.ref)(),d=(0,_vue.ref)(),f=(0,_vue.reactive)({dragCol:null,dragGroupField:null,dragAggFnCol:null,dragTipText:""}),T={},a={refElem:y,refBodyWrapperElem:j,refCustomBodyElem:Y,refDragLineElem:u,refDragTipElem:d},i={},S=e=>{var t=L.customStore;t.activeWrapper=!0,P.customOpenEvent(e)},k=e=>{let t=L.customStore;t.activeWrapper=!1,setTimeout(()=>{t.activeBtn||t.activeWrapper||P.customCloseEvent(e)},300)},Z=({$event:e})=>{K.isCustomStatus=!0,P.saveCustom(),P.closeCustom(),P.emitCustomEvent("confirm",e)},J=({$event:e})=>{P.closeCustom(),P.emitCustomEvent("close",e)},Q=({$event:e})=>{P.cancelCustom(),P.closeCustom(),P.emitCustomEvent("cancel",e)},l=e=>{P.resetCustom(!0),P.closeCustom(),P.emitCustomEvent("reset",e)},ee=({$event:t})=>{_ui.VxeUI.modal?_ui.VxeUI.modal.confirm({content:getI18n("vxe.custom.cstmConfirmRestore"),className:"vxe-table--ignore-clear",escClosable:!0}).then(e=>{"confirm"===e&&l(t)}):l(t)},o=t=>{var e=K.customColumnList,e=_xeUtils.default.findTree(e,e=>e===t);e&&e.parent&&(e=e.parent,e.children)&&e.children.length&&(e.renderVisible=e.children.every(e=>e.renderVisible),e.halfVisible=!e.renderVisible&&e.children.some(e=>e.renderVisible||e.halfVisible),o(e))},te=(e,t)=>{let l=!e.renderVisible;$.value.immediate?(_xeUtils.default.eachTree([e],e=>{e.visible=l,e.renderVisible=l,e.halfVisible=!1}),K.isCustomStatus=!0,P.handleCustom(),P.saveCustomStore("update:visible")):_xeUtils.default.eachTree([e],e=>{e.renderVisible=l,e.halfVisible=!1}),o(e),P.checkCustomStatus(),P.dispatchEvent("custom-visible-change",{column:e,checked:l},t)},ce=e=>{$.value.immediate&&e.renderResizeWidth!==e.renderWidth&&(e.resizeWidth=e.renderResizeWidth,e.renderWidth=e.renderResizeWidth,K.isCustomStatus=!0,P.handleCustom(),P.saveCustomStore("update:width"))},le=(e,t,l)=>{var o=q.value;let a=null;$.value.immediate?(e.renderFixed===t?(a="",_xeUtils.default.eachTree([e],e=>{e.fixed="",e.renderFixed=""})):o&&!e.renderFixed||(a=t,_xeUtils.default.eachTree([e],e=>{e.fixed=t,e.renderFixed=t})),K.isCustomStatus=!0,P.handleCustom(),P.saveCustomStore("update:fixed")):e.renderFixed===t?(a="",_xeUtils.default.eachTree([e],e=>{e.renderFixed=""})):o&&!e.renderFixed||(a=t,_xeUtils.default.eachTree([e],e=>{e.renderFixed=t})),null!==a&&P.dispatchEvent("custom-fixed-change",{column:e,fixed:a},l)},oe=e=>{var t=K.customStore,t=!t.isAll;P.toggleCustomAllCheckbox(),P.dispatchEvent("custom-visible-all",{checked:t},e)},c=(e,t,l,o)=>{var a,i,s,r,n=j.value;n&&(r=Y.value)&&(a=T.prevDragToChild,i=n.getBoundingClientRect(),r=r.getBoundingClientRect(),s=u.value,t?s&&(l?(t=t.getBoundingClientRect(),s.style.display="block",s.style.left=Math.max(0,r.x-i.x)+"px",s.style.top=Math.max(1,t.y+n.scrollTop-i.y)+"px",s.style.height=t.height+"px",s.style.width=t.width+"px",s.setAttribute("drag-pos",o),s.setAttribute("drag-to-child",a?"y":"n")):s.style.display=""):s&&(s.style.display="node"),r=d.value)&&(r.style.display="block",r.style.top=Math.min(n.clientHeight+n.scrollTop-r.clientHeight,e.clientY+n.scrollTop-i.y)+"px",r.style.left=Math.min(n.clientWidth+n.scrollLeft-r.clientWidth,e.clientX+n.scrollLeft-i.x)+"px",r.setAttribute("drag-status",l?a?"sub":"normal":"disabled"))},n=()=>{var e=f.dragCol,t=X.value.tooltipMethod;let l="";l=t?""+(t({$table:P,column:e})||""):getI18n("vxe.custom.cstmDragTarget",[e&&"html"!==e.type?e.getTitle():""]),f.dragTipText=l},s=()=>{var e=d.value,t=u.value;e&&(e.style.display=""),t&&(t.style.display="")},ae=e=>{var e=e.currentTarget.parentElement.parentElement.parentElement,t=e.getAttribute("colid"),t=P.getColumnById(t);e.draggable=!0,f.dragCol=t,f.dragGroupField=null,f.dragAggFnCol=null,n(),(0,_dom.addClass)(e,"active--drag-origin")},ie=e=>{e=e.currentTarget.parentElement.parentElement.parentElement;s(),e.draggable=!1,f.dragCol=null,f.dragGroupField=null,(f.dragAggFnCol=null,_dom.removeClass)(e,"active--drag-origin")},se=e=>{e.dataTransfer&&e.dataTransfer.setDragImage((0,_dom.getTpImg)(),0,0),T.prevDragGroupField=null,T.prevDragAggFnColid=null},re=d=>{let c=W.mouseConfig,m=K.customColumnList,v=r.collectColumn;let p=$.value.immediate;var e=d.currentTarget;let{isCrossDrag:g,isSelfToChildDrag:x,isToChildDrag:h,dragEndMethod:t}=X.value;var l=f.dragCol;let{prevDragCol:o,prevDragGroupField:a,prevDragAggFnColid:i,prevDragPos:_,prevDragToChild:b}=T,C="bottom"===_?1:0;if(a||i)P.handlePivotTableAggregatePanelDragendEvent&&P.handlePivotTableAggregatePanelDragendEvent(d);else if(o&&l&&o!==l){let n=l,u=o;Promise.resolve(!t||t({oldColumn:n,newColumn:u,dragColumn:n,dragPos:_,dragToChild:!!b,offsetIndex:C})).then(a=>{if(a){let e=-1,t=-1,l={},o=(_xeUtils.default.eachTree([n],e=>{l[e.id]=e}),!1);if(p){if(n.parentId&&u.parentId){if(!g)return;if(l[u.id]&&(o=!0,!g||!x))return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.message({status:"error",content:getI18n("vxe.error.treeDragChild")}))}else if(n.parentId){if(!g)return}else if(u.parentId){if(!g)return;if(l[u.id]&&(o=!0,!g||!x))return void(_ui.VxeUI.modal&&_ui.VxeUI.modal.message({status:"error",content:getI18n("vxe.error.treeDragChild")}))}var i,s,r,a=_xeUtils.default.findTree(v,e=>e.id===n.id),a=(o&&g&&x?a&&({items:i,index:r}=a,(s=n.children||[]).forEach(e=>{e.parentId=n.parentId}),i.splice(r,1,...s),n.children=[]):a&&({items:i,index:r,parent:s}=a,i.splice(r,1),s||(e=r)),_xeUtils.default.findTree(v,e=>e.id===u.id));a&&({items:i,index:s,parent:r}=a,g&&h&&b?(n.parentId=u.id,u.children=(u.children||[]).concat([n])):(n.parentId=u.parentId,i.splice(s+C,0,n)),r||(t=s)),_xeUtils.default.eachTree(v,(e,t,l,o,a)=>{a||(e.renderSortNumber=t+1)})}else e=_xeUtils.default.findIndexOf(m,e=>e.id===n.id),m.splice(e,1),t=_xeUtils.default.findIndexOf(m,e=>e.id===u.id),m.splice(t+C,0,n);c&&(P.clearSelected&&P.clearSelected(),P.clearCellAreas)&&(P.clearCellAreas(),P.clearCopyCellArea()),P.dispatchEvent("column-dragend",{oldColumn:n,newColumn:u,dragColumn:n,dragPos:_,offsetIndex:C,_index:{newIndex:t,oldIndex:e}},d),p&&(K.customColumnList=v.slice(0),P.handleColDragSwapColumn())}}).catch(()=>{})}s(),f.dragCol=null,f.dragGroupField=null,f.dragAggFnCol=null,T.prevDragGroupField=null,T.prevDragAggFnColid=null,e.draggable=!1,e.removeAttribute("drag-pos"),(0,_dom.removeClass)(e,"active--drag-target"),(0,_dom.removeClass)(e,"active--drag-origin")},ne=e=>{var t,l=$.value.immediate,{isCrossDrag:o,isToChildDrag:a}=X.value,i=e.currentTarget,s=(0,_dom.hasControlKey)(e),r=i.getAttribute("colid"),r=P.getColumnById(r),n=f.dragCol;T.prevDragGroupField=null,T.prevDragAggFnColid=null,r&&(o||1===r.level)&&(e.preventDefault(),t=e.clientY-i.getBoundingClientRect().y<i.clientHeight/2?"top":"bottom",!n||n.id===r.id||!o&&1<r.level||!l&&1<r.level||r.renderFixed?c(e,i,!1,t):(T.prevDragToChild=!!(o&&a&&s&&l),T.prevDragCol=r,T.prevDragPos=t,c(e,i,!0,t)))},me=()=>{var e=f.dragTipText,t=X.value;return(0,_vue.h)("div",{},[(0,_vue.h)("div",{ref:u,class:["vxe-table-custom-popup--drag-line",{"is--guides":t.showGuidesStatus}]}),(0,_vue.h)("div",{ref:d,class:"vxe-table-custom-popup--drag-tip"},[(0,_vue.h)("div",{class:"vxe-table-custom-popup--drag-tip-wrapper"},[(0,_vue.h)("div",{class:"vxe-table-custom-popup--drag-tip-status"},[(0,_vue.h)("span",{class:["vxe-table-custom-popup--drag-tip-normal-status",getIcon().TABLE_DRAG_STATUS_ROW]}),(0,_vue.h)("span",{class:["vxe-table-custom-popup--drag-tip-sub-status",getIcon().TABLE_DRAG_STATUS_SUB_ROW]}),(0,_vue.h)("span",{class:["vxe-table-custom-popup--drag-tip-group-status",getIcon().TABLE_DRAG_STATUS_AGG_GROUP]}),(0,_vue.h)("span",{class:["vxe-table-custom-popup--drag-tip-values-status",getIcon().TABLE_DRAG_STATUS_AGG_VALUES]}),(0,_vue.h)("span",{class:["vxe-table-custom-popup--drag-tip-disabled-status",getIcon().TABLE_DRAG_DISABLED]})]),(0,_vue.h)("div",{class:"vxe-table-custom-popup--drag-tip-content"},""+(e||""))])])])};(0,_vue.nextTick)(()=>{var e=$.value.mode;M||"modal"!==e||(0,_log.errLog)("vxe.error.reqComp",["vxe-modal"]),R||"drawer"!==e||(0,_log.errLog)("vxe.error.reqComp",["vxe-drawer"]),H||(0,_log.errLog)("vxe.error.reqComp",["vxe-button"]),G||(0,_log.errLog)("vxe.error.reqComp",["vxe-number-input"]),z||(0,_log.errLog)("vxe.error.reqComp",["vxe-radio-group"])});e={xID:e,props:L,context:t,reactData:f,internalData:T,xeTable:P,getRefMaps:()=>a,getComputeMaps:()=>i,renderVN:()=>{var e=$.value;return(["modal","drawer","popup"].includes(""+e.mode)?()=>{var e=P.xeGrid;let t=L.customStore,{treeConfig:l,rowGroupConfig:o,aggregateConfig:a,resizable:d}=W,{isCustomStatus:i,customColumnList:s}=K,r=$.value,c=r.immediate;var n=X.value;let{mode:u,modalOptions:m,drawerOptions:v,allowVisible:p,allowSort:g,allowFixed:x,allowResizable:h,checkMethod:_,visibleMethod:b}=r,C=ue.value,f=C.maxFixedSize,{minWidth:T,maxWidth:I}=de.value;var E=Object.assign({},m),V=Object.assign({},v);let A=q.value,U=n.isCrossDrag;n=r.slots||{};let D=n.header,y=n.top,S=n.bottom,k=n.default,F=n.footer,B=[],w=t.isAll,O=t.isIndeterminate,N={$table:P,$grid:e,columns:s,isAllChecked:w,isAllIndeterminate:O,isCustomStatus:i};_xeUtils.default.eachTree(s,(o,a,e,t,i)=>{if(!b||b({$table:P,column:o})){let e=0,t=0;h&&(a={$table:P,column:o,columnIndex:a,$columnIndex:a,$rowIndex:-1},T&&(e=_xeUtils.default.toNumber(_xeUtils.default.isFunction(T)?T(a):T)),I)&&(t=_xeUtils.default.toNumber(_xeUtils.default.isFunction(I)?I(a):I));var a=o.renderVisible,s=o.halfVisible,r=(0,_utils.formatText)(o.getTitle(),1),n=o.children&&o.children.length;let l=!!_&&!_({$table:P,column:o});var u=!a;B.push((0,_vue.h)("tr",{key:o.id,colid:o.id,class:["vxe-table-custom-popup--row level--"+o.level,{"is--group":n}],onDragstart:se,onDragend:re,onDragover:ne},[p?(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--visible"},[(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":a,"is--indeterminate":s,"is--disabled":l}],title:getI18n("vxe.custom.setting.colVisible"),onClick:e=>{l||te(o,e)}},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",s?getIcon().TABLE_CHECKBOX_INDETERMINATE:a?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]})])]):(0,_vue.createCommentVNode)(),(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--name"},[(0,_vue.h)("div",{class:"vxe-table-custom-popup--name"},[g?U&&c||1===o.level?(0,_vue.h)("div",Object.assign({class:["vxe-table-custom-popup--column-sort-btn",{"is--disabled":l||u||o.renderFixed}],title:getI18n("vxe.custom.setting.sortHelpTip")},l||u||o.renderFixed?{}:{onMousedown:ae,onMouseup:ie}),[(0,_vue.h)("i",{class:getIcon().TABLE_CUSTOM_SORT})]):(0,_vue.h)("div",{class:"vxe-table-custom-popup--column-sort-placeholder"}):(0,_vue.createCommentVNode)(),"html"===o.type?(0,_vue.h)("div",{key:"1",class:"vxe-table-custom-popup--title",innerHTML:r}):(0,_vue.h)("div",{key:"0",class:"vxe-table-custom-popup--title",title:r},r)])]),h?(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--resizable"},[o.children&&o.children.length||!(_xeUtils.default.isBoolean(o.resizable)?o.resizable:C.resizable||d)?(0,_vue.h)("span","-"):G?(0,_vue.h)(G,{type:"integer",immediate:!1,disabled:l||u,modelValue:o.renderResizeWidth,min:e||void 0,max:t||void 0,"onUpdate:modelValue"(e){e=Math.max(0,Number(e));o.renderResizeWidth=e},onChange(){ce(o)}}):(0,_vue.createCommentVNode)()]):(0,_vue.createCommentVNode)(),x?(0,_vue.h)("td",{class:"vxe-table-custom-popup--column-item col--fixed"},[i?(0,_vue.h)("span","-"):z?(0,_vue.h)(z,{modelValue:o.renderFixed||"",type:"button",size:"mini",disabled:l||u,options:[{label:getI18n("vxe.custom.setting.fixedLeft"),value:"left",disabled:l||u||A},{label:getI18n("vxe.custom.setting.fixedUnset"),value:"",disabled:l||u},{label:getI18n("vxe.custom.setting.fixedRight"),value:"right",disabled:l||u||A}],onChange({label:e,$event:t}){le(o,e,t)}}):(0,_vue.createCommentVNode)()]):(0,_vue.createCommentVNode)()]))}});n={default:()=>(0,_vue.h)("div",{ref:j,class:"vxe-table-custom-popup--body-wrapper"},k?P.callSlot(k,N):[(0,_vue.h)("div",{ref:Y,class:"vxe-table-custom-popup--handle-wrapper"},[y?(0,_vue.h)("div",{class:"vxe-table-custom-popup--table-top"},P.callSlot(y,N)):renderEmptyElement(P),(0,_vue.h)("div",{class:"vxe-table-custom-popup--table-wrapper"},[(0,_vue.h)("table",{},[(0,_vue.h)("colgroup",{},[p?(0,_vue.h)("col",{class:"vxe-table-custom-popup--table-col-seq"}):(0,_vue.createCommentVNode)(),(0,_vue.h)("col",{class:"vxe-table-custom-popup--table-col-title"}),h?(0,_vue.h)("col",{class:"vxe-table-custom-popup--table-col-width"}):(0,_vue.createCommentVNode)(),x?(0,_vue.h)("col",{class:"vxe-table-custom-popup--table-col-fixed"}):(0,_vue.createCommentVNode)()]),(0,_vue.h)("thead",{},[(0,_vue.h)("tr",{},[p?(0,_vue.h)("th",{},[(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":w,"is--indeterminate":O}],title:getI18n("vxe.table.allTitle"),onClick:oe},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",O?getIcon().TABLE_CHECKBOX_INDETERMINATE:w?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]}),(0,_vue.h)("span",{class:"vxe-checkbox--label"},getI18n("vxe.toolbar.customAll"))])]):(0,_vue.createCommentVNode)(),(0,_vue.h)("th",{},getI18n("vxe.custom.setting.colTitle")),h?(0,_vue.h)("th",{},getI18n("vxe.custom.setting.colResizable")):(0,_vue.createCommentVNode)(),x?(0,_vue.h)("th",{},getI18n("vxe.custom.setting."+(f?"colFixedMax":"colFixed"),[f])):(0,_vue.createCommentVNode)()])]),(0,_vue.h)(_vue.TransitionGroup,{class:"vxe-table-custom--panel-list",tag:"tbody",name:"vxe-table-custom--list"},{default:()=>B})])]),S?(0,_vue.h)("div",{class:"vxe-table-custom-popup--table-bottom"},P.callSlot(S,N)):renderEmptyElement(P),me()]),!l&&(a||o)&&P.getPivotTableAggregatePopupPanel?(0,_vue.h)(P.getPivotTableAggregatePopupPanel(),{customStore:t}):renderEmptyElement(P)]),footer:()=>F?P.callSlot(F,N):(0,_vue.h)("div",{class:"vxe-table-custom-popup--footer"},[H?(0,_vue.h)(H,{content:r.resetButtonText||getI18n("vxe.custom.cstmRestore"),disabled:!i,onClick:ee}):(0,_vue.createCommentVNode)(),c?H?(0,_vue.h)(H,{content:r.closeButtonText||getI18n("vxe.table.customClose"),onClick:J}):(0,_vue.createCommentVNode)():H?(0,_vue.h)(H,{content:r.cancelButtonText||getI18n("vxe.table.customCancel"),onClick:Q}):(0,_vue.createCommentVNode)(),!c&&H?(0,_vue.h)(H,{status:"primary",content:r.confirmButtonText||getI18n("vxe.custom.cstmConfirm"),onClick:Z}):(0,_vue.createCommentVNode)()])};return D&&(n.header=()=>P.callSlot(D,N)),"drawer"===u?R?(0,_vue.h)(R,{key:"drawer",className:["vxe-table-custom-drawer-wrapper","vxe-table--ignore-clear",V.className||""].join(" "),modelValue:t.visible,title:V.title||getI18n("vxe.custom.cstmTitle"),width:V.width||Math.min(880,Math.floor(.6*document.documentElement.clientWidth)),position:V.position,resize:!!V.resize,escClosable:!!V.escClosable,maskClosable:!!V.maskClosable,destroyOnClose:!0,showFooter:!0,"onUpdate:modelValue"(e){t.visible=e}},n):(0,_vue.createCommentVNode)():M?(0,_vue.h)(M,{key:"modal",className:["vxe-table-custom-modal-wrapper","vxe-table--ignore-clear",E.className||""].join(" "),modelValue:t.visible,title:E.title||getI18n("vxe.custom.cstmTitle"),width:E.width||Math.min(880,document.documentElement.clientWidth),minWidth:E.minWidth||700,height:E.height||Math.min(680,document.documentElement.clientHeight),minHeight:E.minHeight||400,showZoom:E.showZoom,showMaximize:E.showMaximize,showMinimize:E.showMinimize,mask:E.mask,lockView:E.lockView,resize:E.resize,escClosable:!!E.escClosable,maskClosable:!!E.maskClosable,destroyOnClose:!0,showFooter:!0,"onUpdate:modelValue"(e){t.visible=e}},n):(0,_vue.createCommentVNode)()}:()=>{var e=P.xeGrid,t=P.props,l=L.customStore,{treeConfig:t,rowGroupConfig:o,aggregateConfig:a}=t,{isCustomStatus:i,customColumnList:s}=K,r=$.value;let d=r.immediate;var n=X.value,u=l.maxHeight;let{checkMethod:c,visibleMethod:m,allowVisible:v,allowSort:p,allowFixed:g,trigger:x,placement:h}=r,_=q.value,b=n.isCrossDrag;var n=r.slots||{},C=n.header,f=n.top,T=n.bottom,I=n.default,n=n.footer;let E=[];var V={},A=l.isAll,D=l.isIndeterminate,e=("hover"===x&&(V.onMouseenter=S,V.onMouseleave=k),{$table:P,$grid:e,columns:s,isAllChecked:A,isAllIndeterminate:D,isCustomStatus:i});return _xeUtils.default.eachTree(s,(l,e,t,o,a)=>{if(!m||m({$table:P,column:l})){var i=l.renderVisible,s=l.halfVisible,r=l.children&&l.children.length,n=(0,_utils.formatText)(l.getTitle(),1);let t=!!c&&!c({$table:P,column:l});var u=!i;E.push((0,_vue.h)("li",{key:l.id,colid:l.id,class:["vxe-table-custom--option","level--"+l.level,{"is--hidden":t||u,"is--group":r}],onDragstart:se,onDragend:re,onDragover:ne},[v?(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":i,"is--indeterminate":s,"is--disabled":t}],title:getI18n("vxe.custom.setting.colVisible"),onClick:e=>{t||te(l,e)}},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",s?getIcon().TABLE_CHECKBOX_INDETERMINATE:i?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]})]):(0,_vue.createCommentVNode)(),(0,_vue.h)("div",{class:"vxe-table-custom--name-option"},[p&&(b&&d||1===l.level)?(0,_vue.h)("div",{class:"vxe-table-custom--sort-option"},[(0,_vue.h)("span",Object.assign({class:["vxe-table-custom--sort-btn",{"is--disabled":t||u||l.renderFixed}],title:getI18n("vxe.custom.setting.sortHelpTip")},t||u||l.renderFixed?{}:{onMousedown:ae,onMouseup:ie}),[(0,_vue.h)("i",{class:getIcon().TABLE_CUSTOM_SORT})])]):(0,_vue.createCommentVNode)(),"html"===l.type?(0,_vue.h)("div",{key:"1",class:"vxe-table-custom--checkbox-label",innerHTML:n}):(0,_vue.h)("div",{key:"0",class:"vxe-table-custom--checkbox-label"},n)]),!a&&g?(0,_vue.h)("div",{class:"vxe-table-custom--fixed-option"},[H?(0,_vue.h)(H,{mode:"text",icon:"left"===l.renderFixed?getIcon().TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE:getIcon().TOOLBAR_TOOLS_FIXED_LEFT,status:"left"===l.renderFixed?"primary":"",disabled:t||u||_&&!l.renderFixed,title:getI18n("left"===l.renderFixed?"vxe.toolbar.cancelFixed":"vxe.toolbar.fixedLeft"),onClick:({$event:e})=>{le(l,"left",e)}}):(0,_vue.createCommentVNode)(),H?(0,_vue.h)(H,{mode:"text",icon:"right"===l.renderFixed?getIcon().TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE:getIcon().TOOLBAR_TOOLS_FIXED_RIGHT,status:"right"===l.renderFixed?"primary":"",disabled:t||u||_&&!l.renderFixed,title:getI18n("right"===l.renderFixed?"vxe.toolbar.cancelFixed":"vxe.toolbar.fixedRight"),onClick:({$event:e})=>{le(l,"right",e)}}):(0,_vue.createCommentVNode)()]):(0,_vue.createCommentVNode)()]))}}),(0,_vue.h)("div",{ref:y,key:"simple",class:["vxe-table-custom-wrapper","placement--"+h,{"is--active":l.visible}],style:u&&!["left","right"].includes(h||"")?{maxHeight:u+"px"}:{}},l.visible?[(0,_vue.h)("div",{ref:j,class:"vxe-table-custom-simple--body-wrapper"},[!t&&(a||o)&&P.getPivotTableAggregateSimplePanel?(0,_vue.h)(P.getPivotTableAggregateSimplePanel(),{customStore:l}):renderEmptyElement(P),(0,_vue.h)("div",{ref:Y,class:"vxe-table-custom--handle-wrapper"},[(0,_vue.h)("div",{class:"vxe-table-custom--header"},C?P.callSlot(C,e):[(0,_vue.h)("ul",{class:"vxe-table-custom--panel-list"},[(0,_vue.h)("li",{class:"vxe-table-custom--option"},[v?(0,_vue.h)("div",{class:["vxe-table-custom--checkbox-option",{"is--checked":A,"is--indeterminate":D}],title:getI18n("vxe.table.allTitle"),onClick:oe},[(0,_vue.h)("span",{class:["vxe-checkbox--icon",D?getIcon().TABLE_CHECKBOX_INDETERMINATE:A?getIcon().TABLE_CHECKBOX_CHECKED:getIcon().TABLE_CHECKBOX_UNCHECKED]}),(0,_vue.h)("span",{class:"vxe-checkbox--label"},getI18n("vxe.toolbar.customAll"))]):(0,_vue.h)("span",{class:"vxe-checkbox--label"},getI18n("vxe.table.customTitle"))])])]),(0,_vue.h)("div",{class:"vxe-table-custom--body"},[f?(0,_vue.h)("div",{class:"vxe-table-custom--panel-top"},P.callSlot(f,e)):renderEmptyElement(P),I?(0,_vue.h)("div",{class:"vxe-table-custom--panel-body"},P.callSlot(I,e)):(0,_vue.h)(_vue.TransitionGroup,Object.assign({class:"vxe-table-custom--panel-list",name:"vxe-table-custom--list",tag:"ul"},V),{default:()=>E}),T?(0,_vue.h)("div",{class:"vxe-table-custom--panel-bottom"},P.callSlot(T,e)):renderEmptyElement(P)]),r.showFooter?(0,_vue.h)("div",{class:"vxe-table-custom--footer"},n?P.callSlot(n,e):[(0,_vue.h)("div",{class:"vxe-table-custom--footer-buttons"},[H?(0,_vue.h)(H,{mode:"text",content:r.resetButtonText||getI18n("vxe.table.customRestore"),disabled:!i,onClick:ee}):(0,_vue.createCommentVNode)(),d?H?(0,_vue.h)(H,{mode:"text",content:r.closeButtonText||getI18n("vxe.table.customClose"),onClick:J}):(0,_vue.createCommentVNode)():H?(0,_vue.h)(H,{mode:"text",content:r.cancelButtonText||getI18n("vxe.table.customCancel"),onClick:Q}):(0,_vue.createCommentVNode)(),!d&&H?(0,_vue.h)(H,{mode:"text",status:"primary",content:r.confirmButtonText||getI18n("vxe.table.customConfirm"),onClick:Z}):(0,_vue.createCommentVNode)()])]):null]),me()])]:[])})()}};return(0,_vue.provide)("$xeTableCustomPanel",e),e},render(){return this.renderVN()}});
|
package/lib/table/src/table.js
CHANGED
|
@@ -79,7 +79,7 @@ removeRowMaps:{},cvCacheMaps:{},inited:false,tooltipTimeout:null,initStatus:fals
|
|
|
79
79
|
* @deprecated
|
|
80
80
|
*/const computeSXOpts=(0,_vue.computed)(()=>{const virtualXOpts=computeVirtualXOpts.value;return virtualXOpts;});const computeScrollXThreshold=(0,_vue.computed)(()=>{const virtualXOpts=computeVirtualXOpts.value;const{threshold}=virtualXOpts;if(threshold){return _xeUtils.default.toNumber(threshold);}return 0;});/**
|
|
81
81
|
* @deprecated
|
|
82
|
-
*/const computeSYOpts=(0,_vue.computed)(()=>{const virtualYOpts=computeVirtualYOpts.value;return virtualYOpts;});const computeVirtualXOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.virtualXConfig
|
|
82
|
+
*/const computeSYOpts=(0,_vue.computed)(()=>{const virtualYOpts=computeVirtualYOpts.value;return virtualYOpts;});const computeVirtualXOpts=(0,_vue.computed)(()=>{const{virtualXConfig}=props;if(virtualXConfig){return Object.assign({},getConfig().table.virtualXConfig,virtualXConfig);}return Object.assign({},getConfig().table.virtualXConfig,getConfig().table.scrollX,props.scrollX);});const computeVirtualYOpts=(0,_vue.computed)(()=>{const{virtualYConfig}=props;if(virtualYConfig){return Object.assign({},getConfig().table.virtualYConfig,virtualYConfig);}return Object.assign({},getConfig().table.virtualYConfig,getConfig().table.scrollY,props.scrollY);});const computeScrollbarOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.scrollbarConfig,props.scrollbarConfig);});const computeScrollbarXToTop=(0,_vue.computed)(()=>{const scrollbarOpts=computeScrollbarOpts.value;return!!(scrollbarOpts.x&&scrollbarOpts.x.position==='top');});const computeScrollbarYToLeft=(0,_vue.computed)(()=>{const scrollbarOpts=computeScrollbarOpts.value;return!!(scrollbarOpts.y&&scrollbarOpts.y.position==='left');});const computeScrollYThreshold=(0,_vue.computed)(()=>{const virtualYOpts=computeVirtualYOpts.value;const{threshold}=virtualYOpts;if(threshold){return _xeUtils.default.toNumber(threshold);}return 0;});const computeRowHeightMaps=(0,_vue.computed)(()=>{return reactData.rowHeightStore;});const computeDefaultRowHeight=(0,_vue.computed)(()=>{const vSize=computeSize.value;const rowHeightMaps=computeRowHeightMaps.value;return rowHeightMaps[vSize||'default']||18;});const computeColumnOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.columnConfig,props.columnConfig);});const computeCurrentColumnOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.currentColumnConfig,props.currentColumnConfig);});const computeCellOpts=(0,_vue.computed)(()=>{const cellOpts=Object.assign({},getConfig().table.cellConfig,props.cellConfig);if(cellOpts.height){cellOpts.height=_xeUtils.default.toNumber(cellOpts.height);}return cellOpts;});const computeHeaderCellOpts=(0,_vue.computed)(()=>{const headerCellOpts=Object.assign({},getConfig().table.headerCellConfig,props.headerCellConfig);const cellOpts=computeCellOpts.value;headerCellOpts.height=_xeUtils.default.toNumber((0,_util.getCalcHeight)(headerCellOpts.height||cellOpts.height));return headerCellOpts;});const computeFooterCellOpts=(0,_vue.computed)(()=>{const footerCellOpts=Object.assign({},getConfig().table.footerCellConfig,props.footerCellConfig);const cellOpts=computeCellOpts.value;footerCellOpts.height=_xeUtils.default.toNumber((0,_util.getCalcHeight)(footerCellOpts.height||cellOpts.height));return footerCellOpts;});const computeRowOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.rowConfig,props.rowConfig);});const computeAggregateOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.aggregateConfig||getConfig().table.rowGroupConfig,props.aggregateConfig||props.rowGroupConfig);});const computeRowGroupOpts=(0,_vue.computed)(()=>{return computeAggregateOpts.value;});const computeCurrentRowOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.currentRowConfig,props.currentRowConfig);});const computeRowDragOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.rowDragConfig,props.rowDragConfig);});const computeColumnDragOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.columnDragConfig,props.columnDragConfig);});const computeResizeOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.resizeConfig,props.resizeConfig);});const computeResizableOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.resizableConfig,props.resizableConfig);});const computeSeqOpts=(0,_vue.computed)(()=>{return Object.assign({startIndex:0},getConfig().table.seqConfig,props.seqConfig);});const computeRadioOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.radioConfig,props.radioConfig);});const computeCheckboxOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.checkboxConfig,props.checkboxConfig);});const computeTooltipOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().tooltip,getConfig().table.tooltipConfig,props.tooltipConfig);});const computeTableTipConfig=(0,_vue.computed)(()=>{const{tooltipStore}=reactData;const tooltipOpts=computeTooltipOpts.value;return Object.assign({},tooltipOpts,tooltipStore.currOpts);});const computeValidTipConfig=(0,_vue.computed)(()=>{const tooltipOpts=computeTooltipOpts.value;return Object.assign({},tooltipOpts);});const computeEditOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.editConfig,props.editConfig);});const computeSortOpts=(0,_vue.computed)(()=>{return Object.assign({orders:['asc','desc',null]},getConfig().table.sortConfig,props.sortConfig);});const computeFilterOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.filterConfig,props.filterConfig);});const computeMouseOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.mouseConfig,props.mouseConfig);});const computeAreaOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.areaConfig,props.areaConfig);});const computeKeyboardOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.keyboardConfig,props.keyboardConfig);});const computeClipOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.clipConfig,props.clipConfig);});const computeFNROpts=(0,_vue.computed)(()=>{const fnrOpts=computeFnrOpts.value;return fnrOpts;});const computeFnrOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.fnrConfig,props.fnrConfig);});const computeMenuOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.menuConfig,props.menuConfig);});const computeLeftFixedWidth=(0,_vue.computed)(()=>{const{columnStore}=reactData;const{leftList}=columnStore;let leftWidth=0;for(let i=0;i<leftList.length;i++){const column=leftList[i];leftWidth+=column.renderWidth;}return leftWidth;});const computeRightFixedWidth=(0,_vue.computed)(()=>{const{columnStore}=reactData;const{rightList}=columnStore;let leftWidth=0;for(let i=0;i<rightList.length;i++){const column=rightList[i];leftWidth+=column.renderWidth;}return leftWidth;});const computeHeaderMenu=(0,_vue.computed)(()=>{const menuOpts=computeMenuOpts.value;const headerOpts=menuOpts.header;return headerOpts&&headerOpts.options?headerOpts.options:[];});const computeBodyMenu=(0,_vue.computed)(()=>{const menuOpts=computeMenuOpts.value;const bodyOpts=menuOpts.body;return bodyOpts&&bodyOpts.options?bodyOpts.options:[];});const computeFooterMenu=(0,_vue.computed)(()=>{const menuOpts=computeMenuOpts.value;const footerOpts=menuOpts.footer;return footerOpts&&footerOpts.options?footerOpts.options:[];});const computeIsMenu=(0,_vue.computed)(()=>{const menuOpts=computeMenuOpts.value;const headerMenu=computeHeaderMenu.value;const bodyMenu=computeBodyMenu.value;const footerMenu=computeFooterMenu.value;return!!(props.menuConfig&&(0,_utils.isEnableConf)(menuOpts)&&(headerMenu.length||bodyMenu.length||footerMenu.length));});const computeMenuList=(0,_vue.computed)(()=>{const{ctxMenuStore}=reactData;const rest=[];ctxMenuStore.list.forEach(list=>{list.forEach(item=>{rest.push(item);});});return rest;});const computeExportOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.exportConfig,props.exportConfig);});const computeImportOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.importConfig,props.importConfig);});const computePrintOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.printConfig,props.printConfig);});const computeExpandOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.expandConfig,props.expandConfig);});const computeTreeOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.treeConfig,props.treeConfig);});const computeEmptyOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.emptyRender,props.emptyRender);});const computeLoadingOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.loadingConfig,props.loadingConfig);});const computeCellOffsetWidth=(0,_vue.computed)(()=>{return props.border?Math.max(2,Math.ceil(reactData.scrollbarWidth/reactData.tableColumn.length)):1;});const computeCustomOpts=(0,_vue.computed)(()=>{return Object.assign({},getConfig().table.customConfig,props.customConfig);});const computeTableRowExpandedList=(0,_vue.computed)(()=>{const{tableData,rowExpandedFlag,expandColumn,rowGroupExpandedFlag,treeExpandedFlag}=reactData;const{visibleDataRowIdData,rowExpandedMaps}=internalData;const expandList=[];if(tableData.length&&expandColumn&&rowExpandedFlag&&rowGroupExpandedFlag&&treeExpandedFlag){_xeUtils.default.each(rowExpandedMaps,(row,rowid)=>{if(visibleDataRowIdData[rowid]){expandList.push(row);}});}return expandList;});const computeAutoWidthColumnList=(0,_vue.computed)(()=>{const{visibleColumn}=internalData;const{tableColumn}=reactData;return tableColumn.length||visibleColumn.length?visibleColumn.filter(column=>column.width==='auto'||column.minWidth==='auto'):[];});const computeFixedColumnSize=(0,_vue.computed)(()=>{const{tableColumn}=reactData;const{collectColumn}=internalData;let fixedSize=0;// 只判断第一层
|
|
83
83
|
if(tableColumn.length&&collectColumn.length){collectColumn.forEach(column=>{if(column.renderFixed){fixedSize++;}});}return fixedSize;});const computeIsMaxFixedColumn=(0,_vue.computed)(()=>{const fixedColumnSize=computeFixedColumnSize.value;const columnOpts=computeColumnOpts.value;const{maxFixedSize}=columnOpts;if(maxFixedSize){return fixedColumnSize>=maxFixedSize;}return false;});const computeTableBorder=(0,_vue.computed)(()=>{const{border}=props;if(border===true){return'full';}if(border){return border;}return'default';});const computeIsAllCheckboxDisabled=(0,_vue.computed)(()=>{const{treeConfig}=props;const{tableData}=reactData;const{tableFullData}=internalData;const checkboxOpts=computeCheckboxOpts.value;const{strict,checkMethod}=checkboxOpts;if(strict){if(tableData.length||tableFullData.length){if(checkMethod){if(treeConfig){// 暂时不支持树形结构
|
|
84
84
|
}// 如果所有行都被禁用
|
|
85
85
|
return tableFullData.every(row=>!checkMethod({$table:$xeTable,row}));}return false;}return true;}return false;});const computeVirtualScrollBars=(0,_vue.computed)(()=>{const{overflowX,scrollXLoad,overflowY,scrollYLoad}=reactData;return{x:overflowX&&scrollXLoad,y:overflowY&&scrollYLoad};});const computeRowGroupFields=(0,_vue.computed)(()=>{const rowGroupOpts=computeRowGroupOpts.value;return rowGroupOpts.groupFields;});const computeRowGroupColumns=(0,_vue.computed)(()=>{const{rowGroupList}=reactData;const{fullColumnFieldData}=internalData;const rgColumns=[];rowGroupList.forEach(aggConf=>{const colRest=fullColumnFieldData[aggConf.field];if(colRest){rgColumns.push(colRest.column);}});return rgColumns;});const refMaps={refElem,refTooltip,refValidTooltip,refTableFilter,refTableCustom,refTableMenu,refTableHeader,refTableBody,refTableFooter,refTableLeftHeader,refTableLeftBody,refTableLeftFooter,refTableRightHeader,refTableRightBody,refTableRightFooter,refLeftContainer,refRightContainer,refColResizeBar,refRowResizeBar,refScrollXVirtualElem,refScrollYVirtualElem,refScrollXHandleElem,refScrollYHandleElem,refScrollXSpaceElem,refScrollYSpaceElem};const computeMaps={computeSize,computeTableId,computeValidOpts,computeRowField,computeVirtualXOpts,computeVirtualYOpts,computeScrollbarOpts,computeScrollbarXToTop,computeScrollbarYToLeft,computeColumnOpts,computeCurrentColumnOpts,computeScrollXThreshold,computeScrollYThreshold,computeRowHeightMaps,computeDefaultRowHeight,computeCellOpts,computeHeaderCellOpts,computeFooterCellOpts,computeRowOpts,computeAggregateOpts,computeRowGroupOpts,computeCurrentRowOpts,computeRowDragOpts,computeColumnDragOpts,computeResizeOpts,computeResizableOpts,computeSeqOpts,computeRadioOpts,computeCheckboxOpts,computeTooltipOpts,computeEditOpts,computeSortOpts,computeFilterOpts,computeMouseOpts,computeAreaOpts,computeKeyboardOpts,computeClipOpts,computeFnrOpts,computeHeaderMenu,computeBodyMenu,computeFooterMenu,computeIsMenu,computeMenuList,computeMenuOpts,computeExportOpts,computeImportOpts,computePrintOpts,computeExpandOpts,computeTreeOpts,computeEmptyOpts,computeLoadingOpts,computeCellOffsetWidth,computeCustomOpts,computeLeftFixedWidth,computeRightFixedWidth,computeFixedColumnSize,computeIsMaxFixedColumn,computeIsAllCheckboxDisabled,computeVirtualScrollBars,computeRowGroupFields,computeRowGroupColumns,computeFNROpts,computeSXOpts,computeSYOpts};const $xeTable={xID,props:props,context,reactData,internalData,getRefMaps:()=>refMaps,getComputeMaps:()=>computeMaps,xeGrid:$xeGrid,xegrid:$xeGrid};const eqCellValue=(row1,row2,field)=>{const val1=_xeUtils.default.get(row1,field);const val2=_xeUtils.default.get(row2,field);if((0,_utils.eqEmptyValue)(val1)&&(0,_utils.eqEmptyValue)(val2)){return true;}if(_xeUtils.default.isString(val1)||_xeUtils.default.isNumber(val1)){return''+val1===''+val2;}return _xeUtils.default.isEqual(val1,val2);};const handleKeyField=()=>{const keyField=computeRowField.value;internalData.currKeyField=keyField;internalData.isCurrDeepKey=(0,_util.hasDeepKey)(keyField);};const hangleStorageDefaultValue=(value,isAll)=>{return _xeUtils.default.isBoolean(value)?value:isAll;};const getNextSortOrder=column=>{const sortOpts=computeSortOpts.value;const{orders=[]}=sortOpts;const currOrder=column.order||null;const oIndex=orders.indexOf(currOrder)+1;return orders[oIndex<orders.length?oIndex:0];};const getCustomStorageMap=id=>{const version=getConfig().version;const rest=_xeUtils.default.toStringJSON(localStorage.getItem(customStorageKey)||'');const maps=rest&&rest._v===version?rest:{_v:version};return(id?maps[id]:maps)||{};};const setCustomStorageMap=(id,data)=>{const version=getConfig().version;const maps=getCustomStorageMap();maps[id]=data||undefined;maps._v=version;localStorage.setItem(customStorageKey,_xeUtils.default.toJSONString(maps));};const getRecoverRowMaps=keyMaps=>{const{fullAllDataRowIdData}=internalData;const restKeys={};_xeUtils.default.each(keyMaps,(row,rowid)=>{if(fullAllDataRowIdData[rowid]){restKeys[rowid]=row;}});return restKeys;};const handleReserveRow=reserveRowMap=>{const{fullDataRowIdData}=internalData;const reserveList=[];_xeUtils.default.each(reserveRowMap,(item,rowid)=>{if(fullDataRowIdData[rowid]&&$xeTable.findRowIndexOf(reserveList,fullDataRowIdData[rowid].row)===-1){reserveList.push(fullDataRowIdData[rowid].row);}});return reserveList;};const handleVirtualXVisible=()=>{const{isScrollXBig,scrollXWidth}=reactData;const{elemStore,visibleColumn,fullColumnIdData}=internalData;const leftFixedWidth=computeLeftFixedWidth.value;const rightFixedWidth=computeRightFixedWidth.value;const bodyScrollElem=(0,_util.getRefElem)(elemStore['main-body-scroll']);if(bodyScrollElem){const clientWidth=bodyScrollElem.clientWidth;let scrollLeft=bodyScrollElem.scrollLeft;if(isScrollXBig){scrollLeft=Math.ceil((scrollXWidth-clientWidth)*Math.min(1,scrollLeft/(maxXWidth-clientWidth)));}const startLeft=scrollLeft+leftFixedWidth;const endLeft=scrollLeft+clientWidth-rightFixedWidth;let leftIndex=0;let rightIndex=visibleColumn.length;while(leftIndex<rightIndex){const cIndex=Math.floor((leftIndex+rightIndex)/2);const column=visibleColumn[cIndex];const colid=column.id;const colRest=fullColumnIdData[colid]||{};if(colRest.oLeft<=startLeft){leftIndex=cIndex+1;}else{rightIndex=cIndex;}}let visibleSize=0;const toVisibleIndex=leftIndex===visibleColumn.length?leftIndex:Math.max(0,leftIndex<visibleColumn.length?leftIndex-2:0);for(let cIndex=toVisibleIndex,cLen=visibleColumn.length;cIndex<cLen;cIndex++){const column=visibleColumn[cIndex];const colid=column.id;const colRest=fullColumnIdData[colid]||{};visibleSize++;if(colRest.oLeft>endLeft||visibleSize>=60){break;}}return{toVisibleIndex:Math.max(0,toVisibleIndex),visibleSize:Math.max(1,visibleSize)};}return{toVisibleIndex:0,visibleSize:6};};const calcVarRowHeightConfig=(sizeKey,sizeEl)=>{const{rowHeightStore}=reactData;if(sizeEl&&sizeEl.clientHeight){rowHeightStore[sizeKey]=sizeEl.clientHeight;}};const computeRowHeight=()=>{const{isAllOverflow}=reactData;const tableHeader=refTableHeader.value;const tableBody=refTableBody.value;const tableBodyElem=tableBody?tableBody.$el:null;const defaultRowHeight=computeDefaultRowHeight.value;let rowHeight=0;if(isAllOverflow){if(tableBodyElem){const tableHeaderElem=tableHeader?tableHeader.$el:null;let firstTrElem;firstTrElem=tableBodyElem.querySelector('tr');if(!firstTrElem&&tableHeaderElem){firstTrElem=tableHeaderElem.querySelector('tr');}if(firstTrElem){rowHeight=firstTrElem.clientHeight;}}if(!rowHeight){rowHeight=defaultRowHeight;}}else{rowHeight=defaultRowHeight;}// 最低支持 18px 行高
|
|
@@ -92,7 +92,7 @@ if(isCustomSort&&sortData){allCols.forEach(column=>{const colKey=column.getKey()
|
|
|
92
92
|
*/const restoreCustomStorage=()=>{const{customConfig}=props;const tableId=computeTableId.value;const customOpts=computeCustomOpts.value;const{storage,restoreStore,storeOptions}=customOpts;const isAllCustom=storage===true;const storageOpts=isAllCustom?{}:Object.assign({},storage||{},storeOptions);const isCustomResizable=hangleStorageDefaultValue(storageOpts.resizable,isAllCustom);const isCustomVisible=hangleStorageDefaultValue(storageOpts.visible,isAllCustom);const isCustomFixed=hangleStorageDefaultValue(storageOpts.fixed,isAllCustom);const isCustomSort=hangleStorageDefaultValue(storageOpts.sort,isAllCustom);const isCustomAggGroup=hangleStorageDefaultValue(storageOpts.aggGroup,isAllCustom);const isCustomAggFunc=hangleStorageDefaultValue(storageOpts.aggFunc,isAllCustom);if(storage&&(customConfig?(0,_utils.isEnableConf)(customOpts):customOpts.enabled)&&(isCustomResizable||isCustomVisible||isCustomFixed||isCustomSort||isCustomAggGroup||isCustomAggFunc)){if(!tableId){(0,_log.errLog)('vxe.error.reqProp',['id']);return;}const storeData=getCustomStorageMap(tableId);if(restoreStore){return Promise.resolve(restoreStore({$table:$xeTable,id:tableId,type:'restore',storeData})).then(storeData=>{if(!storeData){return;}return handleCustomRestore(storeData);}).catch(e=>e);}else{return handleCustomRestore(storeData);}}};/**
|
|
93
93
|
* 更新数据列的 Map
|
|
94
94
|
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
95
|
-
*/const cacheColumnMap=()=>{const{tableFullColumn,collectColumn}=internalData;const
|
|
95
|
+
*/const cacheColumnMap=()=>{const{tableFullColumn,collectColumn}=internalData;const fullColIdData=internalData.fullColumnIdData={};const fullColFieldData=internalData.fullColumnFieldData={};const mouseOpts=computeMouseOpts.value;const expandOpts=computeExpandOpts.value;const columnOpts=computeColumnOpts.value;const columnDragOpts=computeColumnDragOpts.value;const virtualYOpts=computeVirtualYOpts.value;const{isCrossDrag,isSelfToChildDrag}=columnDragOpts;const customOpts=computeCustomOpts.value;const{storage}=customOpts;const rowOpts=computeRowOpts.value;const isGroup=collectColumn.some(_utils.hasChildrenList);let isAllOverflow=!!props.showOverflow;let rowGroupColumn;let expandColumn;let treeNodeColumn;let checkboxColumn;let radioColumn;let htmlColumn;let hasFixed;const handleFunc=(column,index,items,path,parentColumn)=>{const{id:colid,field,fixed,type,treeNode,rowGroupNode}=column;const rest={$index:-1,_index:-1,column,colid,index,items,parent:parentColumn||null,width:0,oLeft:0};if(field){if(fullColFieldData[field]){(0,_log.errLog)('vxe.error.colRepet',['field',field]);}fullColFieldData[field]=rest;}else{if(storage&&!type||columnOpts.drag&&(isCrossDrag||isSelfToChildDrag)){(0,_log.errLog)('vxe.error.reqProp',[`${column.getTitle()||type||''} -> column.field=?`]);}}if(!hasFixed&&fixed){hasFixed=fixed;}if(!htmlColumn&&type==='html'){htmlColumn=column;}if(treeNode){if(treeNodeColumn){(0,_log.warnLog)('vxe.error.colRepet',['tree-node',treeNode]);}if(!treeNodeColumn){treeNodeColumn=column;}}if(rowGroupNode){if(treeNodeColumn){(0,_log.warnLog)('vxe.error.colRepet',['row-group-node',rowGroupNode]);}if(!rowGroupColumn){rowGroupColumn=column;}}if(type==='expand'){if(expandColumn){(0,_log.warnLog)('vxe.error.colRepet',['type',type]);}if(!expandColumn){expandColumn=column;}}if(type==='checkbox'){if(checkboxColumn){(0,_log.warnLog)('vxe.error.colRepet',['type',type]);}if(!checkboxColumn){checkboxColumn=column;}}else if(type==='radio'){if(radioColumn){(0,_log.warnLog)('vxe.error.colRepet',['type',type]);}if(!radioColumn){radioColumn=column;}}if(isAllOverflow&&column.showOverflow===false){isAllOverflow=false;}if(fullColIdData[colid]){(0,_log.errLog)('vxe.error.colRepet',['colId',colid]);}fullColIdData[colid]=rest;};if(isGroup){_xeUtils.default.eachTree(collectColumn,(column,index,items,path,parentColumn,nodes)=>{column.level=nodes.length;handleFunc(column,index,items,path,parentColumn);});}else{tableFullColumn.forEach(handleFunc);}if(expandColumn&&expandOpts.mode!=='fixed'&&virtualYOpts.enabled){(0,_log.warnLog)('vxe.error.notConflictProp',['column.type="expand','virtual-y-config.enabled=false']);}if(expandColumn&&expandOpts.mode!=='fixed'&&mouseOpts.area){(0,_log.errLog)('vxe.error.errConflicts',['mouse-config.area','column.type=expand']);}if(htmlColumn){if(!columnOpts.useKey){(0,_log.errLog)('vxe.error.notSupportProp',['column.type=html','column-config.useKey=false','column-config.useKey=true']);}if(!rowOpts.useKey){(0,_log.errLog)('vxe.error.notSupportProp',['column.type=html','row-config.useKey=false','row-config.useKey=true']);}}reactData.isGroup=isGroup;reactData.rowGroupColumn=rowGroupColumn;reactData.treeNodeColumn=treeNodeColumn;reactData.expandColumn=expandColumn;reactData.isAllOverflow=isAllOverflow;};const updateHeight=()=>{internalData.customHeight=calcTableHeight('height');internalData.customMinHeight=calcTableHeight('minHeight');internalData.customMaxHeight=calcTableHeight('maxHeight');// 如果启用虚拟滚动,默认高度
|
|
96
96
|
if(reactData.scrollYLoad&&!(internalData.customHeight||internalData.customMinHeight)){internalData.customHeight=300;}};const calcColumnAutoWidth=(column,wrapperEl)=>{const columnOpts=computeColumnOpts.value;const{autoOptions}=columnOpts;const{isCalcHeader,isCalcBody,isCalcFooter}=autoOptions||{};const querySelections=[];if(isCalcHeader){querySelections.push(`.vxe-header-cell--wrapper[colid="${column.id}"]`);}if(isCalcBody){querySelections.push(`.vxe-body-cell--wrapper[colid="${column.id}"]`);}if(isCalcFooter){querySelections.push(`.vxe-footer-cell--wrapper[colid="${column.id}"]`);}const cellElemList=querySelections.length?wrapperEl.querySelectorAll(querySelections.join(',')):[];let leftRightPadding=0;const firstCellEl=cellElemList[0];if(firstCellEl&&firstCellEl.parentElement){const cellStyle=getComputedStyle(firstCellEl.parentElement);leftRightPadding=Math.ceil(_xeUtils.default.toNumber(cellStyle.paddingLeft)+_xeUtils.default.toNumber(cellStyle.paddingRight));}let colWidth=column.renderAutoWidth-leftRightPadding;for(let i=0;i<cellElemList.length;i++){const celEl=cellElemList[i];colWidth=Math.max(colWidth,celEl?Math.ceil(celEl.scrollWidth)+4:0);}return colWidth+leftRightPadding;};const calcCellWidth=()=>{const autoWidthColumnList=computeAutoWidthColumnList.value;const{fullColumnIdData}=internalData;const el=refElem.value;if(el){el.setAttribute('data-calc-col','Y');autoWidthColumnList.forEach(column=>{const colid=column.id;const colRest=fullColumnIdData[colid];const colWidth=calcColumnAutoWidth(column,el);if(colRest){colRest.width=Math.max(colWidth,colRest.width);}column.renderAutoWidth=colWidth;});$xeTable.analyColumnWidth();el.removeAttribute('data-calc-col');}};/**
|
|
97
97
|
* 列宽算法,计算单元格列宽,动态分配可用剩余空间
|
|
98
98
|
* 支持 px、%、固定 混合分配
|
|
@@ -263,7 +263,7 @@ tableFullColumn.forEach(column=>{if(column.visible){if(column.fixed==='left'){le
|
|
|
263
263
|
// }
|
|
264
264
|
if(props.spanMethod){(0,_log.warnLog)('vxe.error.scrollErrProp',['span-method']);}if(props.footerSpanMethod){(0,_log.warnLog)('vxe.error.scrollErrProp',['footer-span-method']);}if(isReset){const{visibleSize}=handleVirtualXVisible();scrollXStore.startIndex=0;scrollXStore.endIndex=visibleSize;scrollXStore.visibleSize=visibleSize;scrollXStore.visibleStartIndex=0;scrollXStore.visibleEndIndex=visibleSize;}}// 如果列被显示/隐藏,则清除合并状态
|
|
265
265
|
// 如果列被设置为固定,则清除合并状态
|
|
266
|
-
if(visibleColumn.length!==internalData.visibleColumn.length||!internalData.visibleColumn.every((column,index)=>column===visibleColumn[index])){$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();}visibleColumn.forEach((column,index)=>{const colid=column.id;const colRest=fullColumnIdData[colid];if(colRest){colRest._index=index;}});handleTableColumn();handleUpdateAggValues();if(isReset){updateColumnOffsetLeft();return $xeTable.updateFooter().then(()=>{return $xeTable.recalculate();}).then(()=>{$xeTable.updateCellAreas();return $xeTable.recalculate();});}return $xeTable.updateFooter();};const initColumnHierarchy=()=>{const{collectColumn}=internalData;let sortIndex=1;_xeUtils.default.eachTree(collectColumn,(column,index,items,path,parentColumn)=>{const parentId=parentColumn?parentColumn.id:null;column.parentId=parentId;column.defaultParentId=parentId;column.sortNumber=sortIndex;column.renderSortNumber=sortIndex;sortIndex++;});};const handleInitColumn=collectColumn=>{const expandOpts=computeExpandOpts.value;internalData.collectColumn=collectColumn;const tableFullColumn=(0,_util.getColumnList)(collectColumn);internalData.tableFullColumn=tableFullColumn;reactData.isColLoading=true;initColumnHierarchy();return Promise.resolve(restoreCustomStorage()).then(()=>{const{scrollXLoad,scrollYLoad,expandColumn}=reactData;cacheColumnMap();parseColumns(true).then(()=>{if(reactData.scrollXLoad){loadScrollXData();}});$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();$xeTable.handleTableData(true);$xeTable.handleAggregateSummaryData();if((scrollXLoad||scrollYLoad)&&expandColumn&&expandOpts.mode!=='fixed'){(0,_log.warnLog)('vxe.error.scrollErrProp',['column.type=expand']);}return(0,_vue.nextTick)().then(()=>{if($xeToolbar){$xeToolbar.syncUpdate({collectColumn:internalData.collectColumn,$table:$xeTable});}if($xeTable.handleUpdateCustomColumn){$xeTable.handleUpdateCustomColumn();}reactData.isColLoading=false;return handleLazyRecalculate(false,true,true);});});};const updateScrollXStatus=fullColumn=>{const virtualXOpts=computeVirtualXOpts.value;const allCols=fullColumn||internalData.tableFullColumn;// 如果gt为0,则总是启用
|
|
266
|
+
if(visibleColumn.length!==internalData.visibleColumn.length||!internalData.visibleColumn.every((column,index)=>column===visibleColumn[index])){$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();}visibleColumn.forEach((column,index)=>{const colid=column.id;const colRest=fullColumnIdData[colid];if(colRest){colRest._index=index;}});handleTableColumn();handleUpdateAggValues();if(isReset){updateColumnOffsetLeft();return $xeTable.updateFooter().then(()=>{return $xeTable.recalculate();}).then(()=>{$xeTable.updateCellAreas();return $xeTable.recalculate();});}return $xeTable.updateFooter();};const initColumnHierarchy=()=>{const{collectColumn}=internalData;const fullColIdData={};const fullColFieldData={};let sortIndex=1;_xeUtils.default.eachTree(collectColumn,(column,index,items,path,parentColumn)=>{const{id:colid,field}=column;const parentId=parentColumn?parentColumn.id:null;const rest={$index:-1,_index:-1,column,colid,index,items,parent:parentColumn||null,width:0,oLeft:0};column.parentId=parentId;column.defaultParentId=parentId;column.sortNumber=sortIndex;column.renderSortNumber=sortIndex;sortIndex++;if(field){if(fullColFieldData[field]){(0,_log.errLog)('vxe.error.colRepet',['field',field]);}fullColFieldData[field]=rest;}fullColIdData[colid]=rest;});internalData.fullColumnIdData=fullColIdData;internalData.fullColumnFieldData=fullColFieldData;};const handleInitColumn=collectColumn=>{const expandOpts=computeExpandOpts.value;internalData.collectColumn=collectColumn;const tableFullColumn=(0,_util.getColumnList)(collectColumn);internalData.tableFullColumn=tableFullColumn;reactData.isColLoading=true;initColumnHierarchy();return Promise.resolve(restoreCustomStorage()).then(()=>{const{scrollXLoad,scrollYLoad,expandColumn}=reactData;cacheColumnMap();parseColumns(true).then(()=>{if(reactData.scrollXLoad){loadScrollXData();}});$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();$xeTable.handleTableData(true);$xeTable.handleAggregateSummaryData();if((scrollXLoad||scrollYLoad)&&expandColumn&&expandOpts.mode!=='fixed'){(0,_log.warnLog)('vxe.error.scrollErrProp',['column.type=expand']);}return(0,_vue.nextTick)().then(()=>{if($xeToolbar){$xeToolbar.syncUpdate({collectColumn:internalData.collectColumn,$table:$xeTable});}if($xeTable.handleUpdateCustomColumn){$xeTable.handleUpdateCustomColumn();}reactData.isColLoading=false;return handleLazyRecalculate(false,true,true);});});};const updateScrollXStatus=fullColumn=>{const virtualXOpts=computeVirtualXOpts.value;const allCols=fullColumn||internalData.tableFullColumn;// 如果gt为0,则总是启用
|
|
267
267
|
const scrollXLoad=!!virtualXOpts.enabled&&virtualXOpts.gt>-1&&(virtualXOpts.gt===0||virtualXOpts.gt<allCols.length);reactData.scrollXLoad=scrollXLoad;return scrollXLoad;};const updateScrollYStatus=fullData=>{const{treeConfig}=props;const virtualYOpts=computeVirtualYOpts.value;const treeOpts=computeTreeOpts.value;const{transform}=treeOpts;const allList=fullData||internalData.tableFullData;// 如果gt为0,则总是启用
|
|
268
268
|
const scrollYLoad=(transform||!treeConfig)&&!!virtualYOpts.enabled&&virtualYOpts.gt>-1&&(virtualYOpts.gt===0||virtualYOpts.gt<allList.length);reactData.scrollYLoad=scrollYLoad;return scrollYLoad;};/**
|
|
269
269
|
* 展开与收起树节点
|