vxe-table 4.14.8 → 4.14.9

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.
@@ -1 +1 @@
1
- var _vue=require("vue"),_ui=require("../../../ui"),_xeUtils=_interopRequireDefault(require("xe-utils"));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:i}=c,{computeCustomOpts:v,computeRowGroupFields:o}=c.getComputeMaps(),r=c.getRefMaps().refElem,l=c.xeGrid,s=()=>{var e=m.customStore,t=r.value;let l=0;t&&(l=t.clientHeight-28),e.maxHeight=Math.max(88,l)},a=()=>{var{initStore:e,customStore:t}=m;return t.visible=!0,e.custom=!0,u(),d(),s(),(0,_vue.nextTick)().then(()=>s())},u=()=>{var e=m.customStore,t=i.collectColumn;if(e.visible){let l={},r={},s={};_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,s[t]=e.visible}),e.oldSortMaps=l,e.oldFixedMaps=r,e.oldVisibleMaps=s,m.customColumnList=t.slice(0)}},n=()=>{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:s,visibleMethod:i}=r,o=!!e;return r.immediate?(_xeUtils.default.eachTree(l,e=>{i&&!i({$table:c,column:e})||s&&!s({$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=>{i&&!i({$table:c,column:e})||s&&!s({$table:c,column:e})||(e.renderVisible=o,e.halfVisible=!1)}),t.isAll=o),c.checkCustomStatus(),(0,_vue.nextTick)()};var e={openCustom:a,closeCustom:n,toggleCustom:()=>{var e=m.customStore;return(e.visible?n:a)()},saveCustom:()=>{let{customColumnList:e,aggHandleFields:l,rowGroupList:t}=m;let{allowVisible:i,allowSort:o,allowFixed:a,allowResizable:u,allowGroup:n,allowValues:d}=v.value;return _xeUtils.default.eachTree(e,(e,t,l,r,s)=>{s?e.fixed=s.fixed:(o&&(e.renderSortNumber=t+1),a&&(e.fixed=e.renderFixed)),u&&e.renderVisible&&(!e.children||e.children.length)&&e.renderResizeWidth!==e.renderWidth&&(e.resizeWidth=e.renderResizeWidth,e.renderWidth=e.renderResizeWidth),i&&(e.visible=e.renderVisible),n&&d&&(e.aggFunc=e.renderAggFn)}),m.isCustomStatus=!0,c.saveCustomStore("confirm").then(()=>{n&&d&&c.handlePivotTableAggregateData&&(t.length!==l.length||t.some((e,t)=>e.field!==l[t])?l.length?c.setRowGroups(l):c.clearRowGroups():c.handleUpdateAggData())})},cancelCustom:()=>{var{customColumnList:e,customStore:t}=m;let{oldSortMaps:s,oldFixedMaps:i,oldVisibleMaps:o}=t,{allowVisible:a,allowSort:u,allowFixed:n,allowResizable:d}=v.value;return _xeUtils.default.eachTree(e,e=>{var t=e.getKey(),l=!!o[t],r=i[t]||"";a&&(e.renderVisible=l,e.visible=l),n&&(e.renderFixed=r,e.fixed=r),u&&(e.renderSortNumber=s[t]||0),d&&(e.renderResizeWidth=e.renderWidth)},{children:"children"}),(0,_vue.nextTick)()},resetCustom(e){let t=m.rowGroupList;var l=i.collectColumn;let r=v.value.checkMethod,s=Object.assign({visible:!0,resizable:!0===e,fixed:!0===e,sort:!0===e,aggFunc:!0===e},e);return _xeUtils.default.eachTree(l,e=>{s.resizable&&(e.resizeWidth=0),s.fixed&&(e.fixed=e.defaultFixed),s.sort&&(e.renderSortNumber=e.sortNumber),r&&!r({$table:c,column:e})||(e.visible=e.defaultVisible),s.aggFunc&&(e.aggFunc=e.defaultAggFunc,e.renderAggFn=e.defaultAggFunc),e.renderResizeWidth=e.renderWidth}),m.isCustomStatus=!1,c.saveCustomStore("reset"),c.handleCustom().then(()=>{var e;s.aggFunc&&c.handlePivotTableAggregateData&&(((e=o.value)||t).length?e&&e.length?c.setRowGroups(e):c.clearRowGroups():c.handleUpdateAggData())})},toggleCustomAllCheckbox(){var e=m.customStore,e=!e.isAll;return t(e)},setCustomAllCheckbox:t};let d=()=>{var e=m.customStore,t=i.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))},b=(e,t)=>{(l||c).dispatchEvent("custom",{type:e},t)};var h={checkCustomStatus:d,emitCustomEvent:b,triggerCustomEvent(e){var t=c.reactData.customStore;t.visible?(n(),b("close",e)):(t.btnEl=e.target,a(),b("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
+ var _vue=require("vue"),_ui=require("../../../ui"),_xeUtils=_interopRequireDefault(require("xe-utils"));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:i}=c,{computeCustomOpts:v,computeRowGroupFields:o}=c.getComputeMaps(),r=c.getRefMaps().refElem,l=c.xeGrid,s=()=>{var e=m.customStore,t=r.value;let l=0;t&&(l=t.clientHeight-28),e.maxHeight=Math.max(88,l)},a=()=>{var{initStore:e,customStore:t}=m;return t.visible=!0,e.custom=!0,u(),d(),s(),(0,_vue.nextTick)().then(()=>s())},u=()=>{var e=m.customStore,t=i.collectColumn;if(e.visible){let l={},r={},s={};_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,s[t]=e.visible}),e.oldSortMaps=l,e.oldFixedMaps=r,e.oldVisibleMaps=s,m.customColumnList=t.slice(0)}},n=()=>{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:s,visibleMethod:i}=r,o=!!e;return r.immediate?(_xeUtils.default.eachTree(l,e=>{i&&!i({$table:c,column:e})||s&&!s({$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=>{i&&!i({$table:c,column:e})||s&&!s({$table:c,column:e})||(e.renderVisible=o,e.halfVisible=!1)}),t.isAll=o),c.checkCustomStatus(),(0,_vue.nextTick)()};var e={openCustom:a,closeCustom:n,toggleCustom:()=>{var e=m.customStore;return(e.visible?n:a)()},saveCustom:()=>{let{customColumnList:e,aggHandleFields:l,rowGroupList:t}=m;let{allowVisible:i,allowSort:o,allowFixed:a,allowResizable:u,allowGroup:n,allowValues:d}=v.value;return _xeUtils.default.eachTree(e,(e,t,l,r,s)=>{s?e.fixed=s.fixed:(o&&(e.renderSortNumber=t+1),a&&(e.fixed=e.renderFixed)),u&&e.renderVisible&&(!e.children||e.children.length)&&e.renderResizeWidth!==e.renderWidth&&(e.resizeWidth=e.renderResizeWidth,e.renderWidth=e.renderResizeWidth),i&&(e.visible=e.renderVisible),n&&d&&(e.aggFunc=e.renderAggFn)}),m.isCustomStatus=!0,c.saveCustomStore("confirm").then(()=>{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())})},cancelCustom:()=>{var{customColumnList:e,customStore:t}=m;let{oldSortMaps:s,oldFixedMaps:i,oldVisibleMaps:o}=t,{allowVisible:a,allowSort:u,allowFixed:n,allowResizable:d}=v.value;return _xeUtils.default.eachTree(e,e=>{var t=e.getKey(),l=!!o[t],r=i[t]||"";a&&(e.renderVisible=l,e.visible=l),n&&(e.renderFixed=r,e.fixed=r),u&&(e.renderSortNumber=s[t]||0),d&&(e.renderResizeWidth=e.renderWidth)},{children:"children"}),(0,_vue.nextTick)()},resetCustom(e){let t=m.rowGroupList;var l=i.collectColumn;let r=v.value.checkMethod,s=Object.assign({visible:!0,resizable:!0===e,fixed:!0===e,sort:!0===e,aggFunc:!0===e},e);return _xeUtils.default.eachTree(l,e=>{s.resizable&&(e.resizeWidth=0),s.fixed&&(e.fixed=e.defaultFixed),s.sort&&(e.renderSortNumber=e.sortNumber),r&&!r({$table:c,column:e})||(e.visible=e.defaultVisible),s.aggFunc&&(e.aggFunc=e.defaultAggFunc,e.renderAggFn=e.defaultAggFunc),e.renderResizeWidth=e.renderWidth}),m.isCustomStatus=!1,c.saveCustomStore("reset"),c.handleCustom().then(()=>{var e;s.aggFunc&&c.handlePivotTableAggregateData&&(((e=o.value)||t).length?e&&e.length?c.setRowGroups(e):c.clearRowGroups():c.handleUpdateAggData())})},toggleCustomAllCheckbox(){var e=m.customStore,e=!e.isAll;return t(e)},setCustomAllCheckbox:t};let d=()=>{var e=m.customStore,t=i.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))},b=(e,t)=>{(l||c).dispatchEvent("custom",{type:e},t)};var h={checkCustomStatus:d,emitCustomEvent:b,triggerCustomEvent(e){var t=c.reactData.customStore;t.visible?(n(),b("close",e)):(t.btnEl=e.target,a(),b("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)}});
@@ -245,7 +245,7 @@ const getColumnList=columns=>{const result=[];columns.forEach(column=>{result.pu
245
245
  // const rowOpts = computeRowOpts.value
246
246
  const leftList=[];const centerList=[];const rightList=[];const{isGroup,columnStore}=reactData;const{collectColumn,tableFullColumn,scrollXStore,fullColumnIdData}=internalData;// 如果是分组表头,如果子列全部被隐藏,则根列也隐藏
247
247
  if(isGroup){const leftGroupList=[];const centerGroupList=[];const rightGroupList=[];_xeUtils.default.eachTree(collectColumn,(column,index,items,path,parentColumn)=>{const isColGroup=(0,_utils.hasChildrenList)(column);// 如果是分组,必须按组设置固定列,不允许给子列设置固定
248
- if(parentColumn&&parentColumn.fixed){column.fixed=parentColumn.fixed;}if(parentColumn&&column.fixed!==parentColumn.fixed){(0,_log.errLog)('vxe.error.groupFixed');}if(isColGroup){column.visible=!!_xeUtils.default.findTree(column.children,subColumn=>(0,_utils.hasChildrenList)(subColumn)?false:subColumn.visible);}else if(column.visible){if(column.fixed==='left'){leftList.push(column);}else if(column.fixed==='right'){rightList.push(column);}else{centerList.push(column);}}});collectColumn.forEach(column=>{if(column.visible){if(column.fixed==='left'){leftGroupList.push(column);}else if(column.fixed==='right'){rightGroupList.push(column);}else{centerGroupList.push(column);}}});reactData.tableGroupColumn=leftGroupList.concat(centerGroupList).concat(rightGroupList);}else{// 重新分配列
248
+ if(parentColumn&&parentColumn.fixed){column.fixed=parentColumn.fixed;}if(parentColumn&&(column.fixed||'')!==(parentColumn.fixed||'')){(0,_log.errLog)('vxe.error.groupFixed');}if(isColGroup){column.visible=!!_xeUtils.default.findTree(column.children,subColumn=>(0,_utils.hasChildrenList)(subColumn)?false:subColumn.visible);}else if(column.visible){if(column.fixed==='left'){leftList.push(column);}else if(column.fixed==='right'){rightList.push(column);}else{centerList.push(column);}}});collectColumn.forEach(column=>{if(column.visible){if(column.fixed==='left'){leftGroupList.push(column);}else if(column.fixed==='right'){rightGroupList.push(column);}else{centerGroupList.push(column);}}});reactData.tableGroupColumn=leftGroupList.concat(centerGroupList).concat(rightGroupList);}else{// 重新分配列
249
249
  tableFullColumn.forEach(column=>{if(column.visible){if(column.fixed==='left'){leftList.push(column);}else if(column.fixed==='right'){rightList.push(column);}else{centerList.push(column);}}});}const visibleColumn=leftList.concat(centerList).concat(rightList);internalData.visibleColumn=visibleColumn;updateColumnOffsetLeft();const sXLoad=updateScrollXStatus();reactData.hasFixedColumn=leftList.length>0||rightList.length>0;Object.assign(columnStore,{leftList,centerList,rightList});if(sXLoad){// if (showOverflow) {
250
250
  // if (!rowOpts.height) {
251
251
  // const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)