vxe-table 3.9.0-rc.9 → 3.9.0
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/README.md +1 -1
- package/es/grid/src/grid.js +120 -66
- package/es/grid/style.css +0 -1
- package/es/grid/style.min.css +1 -1
- package/es/index.esm.js +22 -3
- package/es/locale/lang/en-US.js +2 -1
- package/es/locale/lang/es-ES.js +2 -1
- package/es/locale/lang/hu-HU.js +2 -1
- package/es/locale/lang/ja-JP.js +2 -1
- package/es/locale/lang/ko-KR.js +2 -1
- package/es/locale/lang/pt-BR.js +2 -1
- package/es/locale/lang/ru-RU.js +2 -1
- package/es/locale/lang/uk-UA.js +2 -1
- package/es/locale/lang/vi-VN.js +2 -1
- package/es/locale/lang/zh-CHT.js +2 -1
- package/es/locale/lang/zh-CN.js +2 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/panel.js +183 -173
- package/es/table/module/edit/mixin.js +33 -24
- package/es/table/module/export/export-panel.js +32 -4
- package/es/table/module/export/import-panel.js +25 -6
- package/es/table/module/export/mixin.js +11 -11
- package/es/table/module/menu/mixin.js +2 -2
- package/es/table/module/validator/mixin.js +4 -4
- package/es/table/render/index.js +17 -11
- package/es/table/src/body.js +1 -0
- package/es/table/src/columnInfo.js +3 -3
- package/es/table/src/methods.js +54 -42
- package/es/table/src/props.js +65 -15
- package/es/table/src/table.js +91 -57
- package/es/table/src/util.js +3 -2
- package/es/table/style.css +37 -48
- package/es/table/style.min.css +1 -1
- package/es/toolbar/src/toolbar.js +21 -7
- package/es/toolbar/style.css +0 -1
- package/es/toolbar/style.min.css +1 -1
- package/es/ui/index.js +5 -3
- package/es/ui/src/log.js +1 -1
- package/es/vxe-grid/style.css +0 -1
- package/es/vxe-grid/style.min.css +1 -1
- package/es/vxe-table/style.css +37 -48
- package/es/vxe-table/style.min.css +1 -1
- package/es/vxe-toolbar/style.css +0 -1
- package/es/vxe-toolbar/style.min.css +1 -1
- package/lib/colgroup/index.js +3 -3
- package/lib/colgroup/index.min.js +1 -1
- package/lib/column/index.js +3 -3
- package/lib/column/index.min.js +1 -1
- package/lib/components.js +9 -11
- package/lib/components.min.js +1 -1
- package/lib/grid/index.js +3 -3
- package/lib/grid/index.min.js +1 -1
- package/lib/grid/src/grid.js +581 -491
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/grid/style/style.css +0 -1
- package/lib/grid/style/style.min.css +1 -1
- package/lib/index.common.js +3 -4
- package/lib/index.umd.js +9174 -17260
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/en-US.js +2 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +2 -1
- package/lib/locale/lang/es-ES.js +2 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +2 -1
- package/lib/locale/lang/hu-HU.js +2 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +2 -1
- package/lib/locale/lang/ja-JP.js +2 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +2 -1
- package/lib/locale/lang/ko-KR.js +2 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +2 -1
- package/lib/locale/lang/pt-BR.js +2 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +2 -1
- package/lib/locale/lang/ru-RU.js +2 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +2 -1
- package/lib/locale/lang/uk-UA.js +2 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +2 -1
- package/lib/locale/lang/vi-VN.js +2 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +2 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +2 -1
- package/lib/locale/lang/zh-CN.js +2 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +2 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/index.js +4 -4
- package/lib/table/index.min.js +1 -1
- package/lib/table/module/custom/mixin.js +53 -44
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/custom/panel.js +310 -239
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/mixin.js +436 -371
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/export-panel.js +136 -106
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/import-panel.js +75 -54
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/export/mixin.js +592 -597
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/export/util.js +6 -4
- package/lib/table/module/export/util.min.js +1 -1
- package/lib/table/module/filter/mixin.js +147 -118
- package/lib/table/module/filter/mixin.min.js +1 -1
- package/lib/table/module/filter/panel.js +86 -65
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +163 -151
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/module/menu/mixin.js +125 -114
- package/lib/table/module/menu/mixin.min.js +1 -1
- package/lib/table/module/menu/panel.js +36 -34
- package/lib/table/module/menu/panel.min.js +1 -1
- package/lib/table/module/validator/mixin.js +225 -214
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/render/index.js +401 -297
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +411 -349
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +470 -344
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +10 -10
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +46 -55
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +157 -132
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/group.js +1 -1
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/header.js +170 -153
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +2758 -2478
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +33 -74
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +465 -424
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +143 -131
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +37 -48
- package/lib/table/style/style.min.css +1 -1
- package/lib/toolbar/index.js +3 -3
- package/lib/toolbar/index.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +332 -284
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/toolbar/style/style.css +0 -1
- package/lib/toolbar/style/style.min.css +1 -1
- package/lib/ui/index.js +50 -41
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/comp.js +2 -3
- package/lib/ui/src/comp.min.js +1 -1
- package/lib/ui/src/dom.js +29 -28
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +6 -4
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/utils.js +7 -7
- package/lib/v-x-e-table/index.js +3 -4
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/vxe-colgroup/index.js +3 -4
- package/lib/vxe-colgroup/index.min.js +1 -1
- package/lib/vxe-column/index.js +3 -4
- package/lib/vxe-column/index.min.js +1 -1
- package/lib/vxe-grid/index.js +3 -4
- package/lib/vxe-grid/index.min.js +1 -1
- package/lib/vxe-grid/style/style.css +0 -1
- package/lib/vxe-grid/style/style.min.css +1 -1
- package/lib/vxe-table/index.js +3 -4
- package/lib/vxe-table/index.min.js +1 -1
- package/lib/vxe-table/style/style.css +37 -48
- package/lib/vxe-table/style/style.min.css +1 -1
- package/lib/vxe-toolbar/index.js +3 -4
- package/lib/vxe-toolbar/index.min.js +1 -1
- package/lib/vxe-toolbar/style/style.css +0 -1
- package/lib/vxe-toolbar/style/style.min.css +1 -1
- package/lib/vxe-ui/index.js +3 -4
- package/lib/vxe-ui/index.min.js +1 -1
- package/lib/vxe-v-x-e-table/index.js +3 -4
- package/lib/vxe-v-x-e-table/index.min.js +1 -1
- package/package.json +5 -4
- package/packages/grid/src/grid.ts +127 -65
- package/packages/locale/lang/en-US.ts +2 -1
- package/packages/locale/lang/es-ES.ts +2 -1
- package/packages/locale/lang/hu-HU.ts +2 -1
- package/packages/locale/lang/ja-JP.ts +2 -1
- package/packages/locale/lang/ko-KR.ts +2 -1
- package/packages/locale/lang/pt-BR.ts +2 -1
- package/packages/locale/lang/ru-RU.ts +2 -1
- package/packages/locale/lang/uk-UA.ts +2 -1
- package/packages/locale/lang/vi-VN.ts +2 -1
- package/packages/locale/lang/zh-CHT.ts +2 -1
- package/packages/locale/lang/zh-CN.ts +2 -1
- package/packages/table/module/custom/panel.ts +186 -175
- package/packages/table/module/edit/mixin.ts +32 -23
- package/packages/table/module/export/export-panel.ts +36 -4
- package/packages/table/module/export/import-panel.ts +29 -6
- package/packages/table/module/export/mixin.ts +11 -11
- package/packages/table/module/menu/mixin.ts +2 -2
- package/packages/table/module/validator/mixin.ts +4 -4
- package/packages/table/render/index.ts +20 -11
- package/packages/table/src/body.ts +1 -0
- package/packages/table/src/columnInfo.ts +3 -3
- package/packages/table/src/methods.ts +53 -42
- package/packages/table/src/props.ts +68 -15
- package/packages/table/src/table.ts +99 -54
- package/packages/table/src/util.ts +3 -2
- package/packages/toolbar/src/toolbar.ts +21 -7
- package/packages/ui/index.ts +3 -1
- package/styles/components/table.scss +82 -17
- package/types/all.d.ts +1 -0
- /package/es/{iconfont.1726453742001.ttf → iconfont.1728348263835.ttf} +0 -0
- /package/es/{iconfont.1726453742001.woff → iconfont.1728348263835.woff} +0 -0
- /package/es/{iconfont.1726453742001.woff2 → iconfont.1728348263835.woff2} +0 -0
- /package/lib/{iconfont.1726453742001.ttf → iconfont.1728348263835.ttf} +0 -0
- /package/lib/{iconfont.1726453742001.woff → iconfont.1728348263835.woff} +0 -0
- /package/lib/{iconfont.1726453742001.woff2 → iconfont.1728348263835.woff2} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_utils=require("../../ui/src/utils"),_ui=require("../../ui"),_methods=_interopRequireDefault(require("./methods")),_body=_interopRequireDefault(require("./body")),_header=_interopRequireDefault(require("./header")),_footer=_interopRequireDefault(require("./footer")),_props=_interopRequireDefault(require("./props")),_vn=require("../../ui/src/vn"),_log=require("../../ui/src/log"),_panel=_interopRequireDefault(require("../module/custom/panel")),_panel2=_interopRequireDefault(require("../module/filter/panel")),_importPanel=_interopRequireDefault(require("../module/export/import-panel")),_exportPanel=_interopRequireDefault(require("../module/export/export-panel")),_panel3=_interopRequireDefault(require("../module/menu/panel")),_mixin=_interopRequireDefault(require("../module/filter/mixin")),_mixin2=_interopRequireDefault(require("../module/menu/mixin")),_mixin3=_interopRequireDefault(require("../module/edit/mixin")),_mixin4=_interopRequireDefault(require("../module/export/mixin")),_mixin5=_interopRequireDefault(require("../module/keyboard/mixin")),_mixin6=_interopRequireDefault(require("../module/validator/mixin")),_mixin7=_interopRequireDefault(require("../module/custom/mixin"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,o){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0===o)return("string"===t?String:Number)(e);o=o.call(e,t||"default");if("object"!=_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}var getConfig=_ui.VxeUI.getConfig,getI18n=_ui.VxeUI.getI18n,renderer=_ui.VxeUI.renderer,globalResize=_ui.VxeUI.globalResize,globalEvents=_ui.VxeUI.globalEvents,globalMixins=_ui.VxeUI.globalMixins;function renderFixed(e,t,o){var i=t._e,r=t.tableData,n=t.tableColumn,s=t.tableGroupColumn,l=t.vSize,a=t.showHeader,u=t.showFooter,c=t.footerTableData,t=t.columnStore["".concat(o,"List")];return e("div",{class:"vxe-table--fixed-".concat(o,"-wrapper"),ref:"".concat(o,"Container")},[a?e(_header.default,{props:{fixedType:o,tableData:r,tableColumn:n,tableGroupColumn:s,size:l,fixedColumn:t},ref:"".concat(o,"Header")}):i(),e(_body.default,{props:{fixedType:o,tableData:r,tableColumn:n,fixedColumn:t,size:l},ref:"".concat(o,"Body")}),u?e(_footer.default,{props:{footerTableData:c,tableColumn:n,fixedColumn:t,fixedType:o,size:l},ref:"".concat(o,"Footer")}):i()])}function renderEmptyContenet(e,t){var o=t.$scopedSlots,i=t.emptyOpts,r={$table:t};return o.empty?o.empty.call(t,r,e):(o=(o=i.name?renderer.get(i.name):null)?o.renderTableEmptyView||o.renderEmpty:null)?(0,_vn.getSlotVNs)(o.call(t,e,i,r)):(0,_utils.getFuncText)(t.emptyText)||getI18n("vxe.table.emptyText")}function handleUupdateResize(e){var t=e.$el;t&&t.clientWidth&&t.clientHeight&&e.recalculate()}var _default=exports.default={name:"VxeTable",mixins:[globalMixins.sizeMixin,_mixin.default,_mixin2.default,_mixin3.default,_mixin4.default,_mixin5.default,_mixin6.default,_mixin7.default],props:_props.default,provide:function(){return{$xetable:this,$xeTable:this,xecolgroup:null}},inject:{$xeGrid:{default:null},$xegrid:{default:null}},data:function(){return{tId:"".concat(_xeUtils.default.uniqueId()),isCalcColumn:!1,staticColumns:[],tableGroupColumn:[],tableColumn:[],tableData:[],scrollXLoad:!1,scrollYLoad:!1,overflowY:!0,overflowX:!1,scrollbarWidth:0,scrollbarHeight:0,rowHeight:0,parentHeight:0,isGroup:!1,isAllOverflow:!1,isAllSelected:!1,isIndeterminate:!1,selectCheckboxMaps:{},currentRow:null,currentColumn:null,selectRadioRow:null,footerTableData:[],expandColumn:null,hasFixedColumn:!1,treeNodeColumn:null,rowExpandedMaps:{},rowExpandLazyLoadedMaps:{},treeExpandedMaps:{},treeExpandLazyLoadedMaps:{},treeIndeterminateMaps:{},mergeList:[],mergeFooterList:[],initStore:{filter:!1,import:!1,export:!1,custom:!1},customColumnList:[],upDataFlag:0,reColumnFlag:0,pendingRowMaps:{},pendingRowList:[],customStore:{btnEl:null,isAll:!1,isIndeterminate:!1,activeBtn:!1,activeWrapper:!1,visible:!1,maxHeight:0,oldSortMaps:{},oldFixedMaps:{},oldVisibleMaps:{}},filterStore:{isAllSelected:!1,isIndeterminate:!1,style:null,options:[],column:null,multiple:!1,visible:!1,maxHeight:null},columnStore:{leftList:[],centerList:[],rightList:[],resizeList:[],pxList:[],pxMinList:[],autoMinList:[],scaleList:[],scaleMinList:[],autoList:[],remainList:[]},ctxMenuStore:{selected:null,visible:!1,showChild:!1,selectChild:null,list:[],style:null},editStore:{indexs:{columns:[]},titles:{columns:[]},selected:{row:null,column:null},copyed:{cut:!1,rows:[],columns:[]},actived:{row:null,column:null},focused:{row:null,column:null},insertList:[],insertMaps:{},removeList:[],removeMaps:{}},tooltipStore:{row:null,column:null,visible:!1,currOpts:{}},validStore:{visible:!1},validErrorMaps:{},importStore:{inited:!1,file:null,type:"",modeList:[],typeList:[],filename:"",visible:!1},importParams:{mode:"",types:null,message:!0},exportStore:{inited:!1,name:"",modeList:[],typeList:[],columns:[],isPrint:!1,hasFooter:!1,hasTree:!1,hasMerge:!1,hasColgroup:!1,visible:!1},exportParams:{filename:"",sheetName:"",mode:"",type:"",isColgroup:!1,isMerge:!1,isAllExpand:!1,useStyle:!1,original:!1,message:!0,isHeader:!1,isFooter:!1},_isLoading:!1}},computed:{tableId:function(){var e=this.id;return e?_xeUtils.default.isFunction(e)?"".concat(e({$table:this})||""):"".concat(e):""},validOpts:function(){return this.computeValidOpts},computeValidOpts:function(){return Object.assign({message:"default"},getConfig().table.validConfig,this.validConfig)},sXOpts:function(){return this.computeSXOpts},computeSXOpts:function(){return Object.assign({},getConfig().table.scrollX,this.scrollX)},sYOpts:function(){return this.computeSYOpts},computeSYOpts:function(){return Object.assign({},getConfig().table.scrollY,this.scrollY)},rowHeightMaps:function(){return{default:48,medium:44,small:40,mini:36}},columnOpts:function(){return this.computeColumnOpts},computeColumnOpts:function(){return Object.assign({},getConfig().table.columnConfig,this.columnConfig)},rowOpts:function(){return this.computeRowOpts},computeRowOpts:function(){return Object.assign({},getConfig().table.rowConfig,this.rowConfig)},resizeOpts:function(){return this.computeResizeOpts},computeResizeOpts:function(){return Object.assign({},getConfig().table.resizeConfig,this.resizeConfig)},resizableOpts:function(){return this.computeResizableOpts},computeResizableOpts:function(){return Object.assign({},getConfig().table.resizableConfig,this.resizableConfig)},seqOpts:function(){return this.computeSeqOpts},computeSeqOpts:function(){return Object.assign({startIndex:0},getConfig().table.seqConfig,this.seqConfig)},radioOpts:function(){return this.computeRadioOpts},computeRadioOpts:function(){return Object.assign({},getConfig().table.radioConfig,this.radioConfig)},checkboxOpts:function(){return this.computeCheckboxOpts},computeCheckboxOpts:function(){return Object.assign({},getConfig().table.checkboxConfig,this.checkboxConfig)},tooltipOpts:function(){return this.computeTooltipOpts},computeTooltipOpts:function(){return Object.assign({},getConfig().tooltip,getConfig().table.tooltipConfig,this.tooltipConfig)},tipConfig:function(){return Object.assign({},this.tooltipOpts)},validTipOpts:function(){return Object.assign({isArrow:!1},this.tooltipOpts)},editOpts:function(){return this.computeEditOpts},computeEditOpts:function(){return Object.assign({},getConfig().table.editConfig,this.editConfig)},sortOpts:function(){return this.computeSortOpts},computeSortOpts:function(){return Object.assign({orders:["asc","desc",null]},getConfig().table.sortConfig,this.sortConfig)},filterOpts:function(){return this.computeFilterOpts},computeFilterOpts:function(){return Object.assign({},getConfig().table.filterConfig,this.filterConfig)},mouseOpts:function(){return this.computeMouseOpts},computeMouseOpts:function(){return Object.assign({},getConfig().table.mouseConfig,this.mouseConfig)},areaOpts:function(){return this.computeAreaOpts},computeAreaOpts:function(){return Object.assign({},getConfig().table.areaConfig,this.areaConfig)},keyboardOpts:function(){return this.computeKeyboardOpts},computeKeyboardOpts:function(){return Object.assign({},getConfig().table.keyboardConfig,this.keyboardConfig)},clipOpts:function(){return this.computeClipOpts},computeClipOpts:function(){return Object.assign({},getConfig().table.clipConfig,this.clipConfig)},fnrOpts:function(){return this.computeFNROpts},computeFNROpts:function(){return Object.assign({},getConfig().table.fnrConfig,this.fnrConfig)},hasTip:function(){return!0},headerCtxMenu:function(){var e=this.ctxMenuOpts.header;return e&&e.options?e.options:[]},bodyCtxMenu:function(){var e=this.ctxMenuOpts.body;return e&&e.options?e.options:[]},footerCtxMenu:function(){var e=this.ctxMenuOpts.footer;return e&&e.options?e.options:[]},isCtxMenu:function(){return!(!this.contextMenu&&!this.menuConfig||!(0,_utils.isEnableConf)(this.ctxMenuOpts)||!(this.headerCtxMenu.length||this.bodyCtxMenu.length||this.footerCtxMenu.length))},ctxMenuList:function(){var t=[];return this.ctxMenuStore.list.forEach(function(e){e.forEach(function(e){t.push(e)})}),t},ctxMenuOpts:function(){return this.computeMenuOpts},computeMenuOpts:function(){return Object.assign({},getConfig().table.menuConfig,this.contextMenu,this.menuConfig)},exportOpts:function(){return this.computeExportOpts},computeExportOpts:function(){return Object.assign({},getConfig().table.exportConfig,this.exportConfig)},importOpts:function(){return this.computeImportOpts},computeImportOpts:function(){return Object.assign({},getConfig().table.importConfig,this.importConfig)},printOpts:function(){return this.computePrintOpts},computePrintOpts:function(){return Object.assign({},getConfig().table.printConfig,this.printConfig)},expandOpts:function(){return this.computeExpandOpts},computeExpandOpts:function(){return Object.assign({},getConfig().table.expandConfig,this.expandConfig)},treeOpts:function(){return this.computeTreeOpts},computeTreeOpts:function(){return Object.assign({},getConfig().table.treeConfig,this.treeConfig)},emptyOpts:function(){return this.computeEmptyOpts},computeEmptyOpts:function(){return Object.assign({},getConfig().table.emptyRender,this.emptyRender)},loadingOpts:function(){return this.computeLoadingOpts},computeLoadingOpts:function(){return Object.assign({},getConfig().table.loadingConfig,this.loadingConfig)},cellOffsetWidth:function(){return this.border?Math.max(2,Math.ceil(this.scrollbarWidth/this.tableColumn.length)):1},customOpts:function(){return this.computeCustomOpts},computeCustomOpts:function(){return Object.assign({},getConfig().table.customConfig,this.customConfig)},autoWidthColumnList:function(){var e=this.tableColumn,t=this.visibleColumn;return e.length||t.length?t.filter(function(e){return"auto"===e.width||"auto"===e.minWidth}):[]},fixedColumnSize:function(){var e=this.collectColumn,t=0;return e.forEach(function(e){e.renderFixed&&t++}),t},isMaxFixedColumn:function(){var e=this.columnOpts.maxFixedSize;return!!e&&this.fixedColumnSize>=e},tableBorder:function(){var e=this.border;return!0===e?"full":e||"default"},isAllCheckboxDisabled:function(){var e=this.tableFullData,t=this.tableData,o=(this.treeConfig,this.checkboxOpts),i=o.strict,r=o.checkMethod;return!!i&&(!t.length&&!e.length||!!r&&e.every(function(e){return!r({row:e})}))}},watch:{data:function(e){var t=this,o=this.inited,i=this.initStatus;this.loadTableData(e).then(function(){t.inited=!0,t.initStatus=!0,i||t.handleLoadDefaults(),o||t.handleInitDefaults(),(t.scrollXLoad||t.scrollYLoad)&&t.expandColumn&&(0,_log.warnLog)("vxe.error.scrollErrProp",["column.type=expand"]),t.recalculate()})},staticColumns:function(e){this.handleColumn(e)},tableColumn:function(){this.analyColumnWidth()},upDataFlag:function(){var e=this;this.$nextTick().then(function(){return e.updateData()})},reColumnFlag:function(){var e=this;this.$nextTick().then(function(){return e.refreshColumn()})},showHeader:function(){var e=this;this.$nextTick(function(){e.recalculate(!0).then(function(){return e.refreshScroll()})})},showFooter:function(){var e=this;this.$nextTick(function(){e.recalculate(!0).then(function(){return e.refreshScroll()})})},height:function(){var e=this;this.$nextTick(function(){return e.recalculate(!0)})},maxHeight:function(){var e=this;this.$nextTick(function(){return e.recalculate(!0)})},syncResize:function(e){var t=this;e&&(handleUupdateResize(this),this.$nextTick(function(){handleUupdateResize(t),setTimeout(function(){return handleUupdateResize(t)})}))},mergeCells:function(e){var t=this;this.clearMergeCells(),this.$nextTick(function(){return t.setMergeCells(e)})},mergeFooterItems:function(e){var t=this;this.clearMergeFooterItems(),this.$nextTick(function(){return t.setMergeFooterItems(e)})}},created:function(){var t,o,e=this,i=Object.assign(this,{tZindex:0,elemStore:{},scrollXStore:{},scrollYStore:{},tableWidth:0,tableHeight:0,headerHeight:0,footerHeight:0,lastScrollLeft:0,lastScrollTop:0,radioReserveRow:null,checkboxReserveRowMap:{},rowExpandedReserveRowMap:{},treeExpandedReserveRowMap:{},tableFullData:[],afterFullData:[],afterFullRowMaps:{},collectColumn:[],tableFullColumn:[],visibleColumn:[],fullAllDataRowMap:new Map,fullAllDataRowIdData:{},fullDataRowMap:new Map,fullDataRowIdData:{},fullColumnMap:new Map,fullColumnIdData:{},fullColumnFieldData:{}}),r=i.scrollXStore,n=i.sYOpts,s=i.scrollYStore,l=i.data,a=i.editOpts,u=i.treeOpts,c=i.treeConfig,p=i.showOverflow,i=i.rowOpts;if("development"===process.env.VUE_APP_VXE_TABLE_ENV&&(this.rowId&&(0,_log.warnLog)("vxe.error.delProp",["row-id","row-config.keyField"]),this.rowKey&&(0,_log.warnLog)("vxe.error.delProp",["row-key","row-config.useKey"]),this.columnKey&&(0,_log.warnLog)("vxe.error.delProp",["column-id","column-config.useKey"]),this.rowId||i.keyField||!(this.checkboxOpts.reserve||this.checkboxOpts.checkRowKeys||this.radioOpts.reserve||this.radioOpts.checkRowKey||this.expandOpts.expandRowKeys||this.treeOpts.expandRowKeys)||(0,_log.warnLog)("vxe.error.reqProp",["row-config.keyField"]),this.editConfig&&a.showStatus&&!this.keepSource&&(0,_log.warnLog)("vxe.error.reqProp",["keep-source"]),!c||!u.showLine&&!u.line||(this.rowKey||i.useKey)&&p||(0,_log.warnLog)("vxe.error.reqProp",["row-config.useKey | show-overflow"]),!this.showFooter||this.footerMethod||this.footerData||(0,_log.warnLog)("vxe.error.reqProp",["footer-data | footer-method"]),c&&this.stripe&&(0,_log.warnLog)("vxe.error.noTree",["stripe"]),this.tooltipOpts.enabled&&(0,_log.warnLog)("vxe.error.delProp",["tooltip-config.enabled","tooltip-config.showAll"]),a=this.exportConfig,t=this.exportOpts,i=this.importConfig,o=this.importOpts,i&&o.types&&!o.importMethod&&!_xeUtils.default.includeArrays(_xeUtils.default.keys(o._typeMaps),o.types)&&(0,_log.warnLog)("vxe.error.errProp",["export-config.types=".concat(o.types.join(",")),o.types.filter(function(e){return _xeUtils.default.includes(_xeUtils.default.keys(o._typeMaps),e)}).join(",")||_xeUtils.default.keys(o._typeMaps).join(",")]),a)&&t.types&&!t.exportMethod&&!_xeUtils.default.includeArrays(_xeUtils.default.keys(t._typeMaps),t.types)&&(0,_log.warnLog)("vxe.error.errProp",["export-config.types=".concat(t.types.join(",")),t.types.filter(function(e){return _xeUtils.default.includes(_xeUtils.default.keys(t._typeMaps),e)}).join(",")||_xeUtils.default.keys(t._typeMaps).join(",")]),"development"===process.env.VUE_APP_VXE_TABLE_ENV){p=this.customOpts;if(!this.id&&this.customConfig&&(!0===p.storage||p.storage&&p.storage.resizable||p.storage&&p.storage.visible)&&(0,_log.errLog)("vxe.error.reqProp",["id"]),this.treeConfig&&this.checkboxOpts.range&&(0,_log.errLog)("vxe.error.noTree",["checkbox-config.range"]),this.rowOpts.height&&!this.showOverflow&&(0,_log.warnLog)("vxe.error.notProp",["table.show-overflow"]),!this.handleUpdateCellAreas&&(this.clipConfig&&(0,_log.warnLog)("vxe.error.notProp",["clip-config"]),this.fnrConfig&&(0,_log.warnLog)("vxe.error.notProp",["fnr-config"]),this.mouseOpts.area))return void(0,_log.errLog)("vxe.error.notProp",["mouse-config.area"]);this.treeConfig&&u.children&&(0,_log.warnLog)("vxe.error.delProp",["tree-config.children","tree-config.childrenField"]),this.treeConfig&&u.line&&(0,_log.warnLog)("vxe.error.delProp",["tree-config.line","tree-config.showLine"]),this.mouseOpts.area&&this.mouseOpts.selected&&(0,_log.warnLog)("vxe.error.errConflicts",["mouse-config.area","mouse-config.selected"]),this.treeConfig&&this.mouseOpts.area&&(0,_log.errLog)("vxe.error.noTree",["mouse-config.area"])}"development"===process.env.VUE_APP_VXE_TABLE_ENV&&(this.contextMenu&&((0,_log.warnLog)("vxe.error.delProp",["context-menu","menu-config"]),_xeUtils.default.isObject(this.contextMenu)||(0,_log.warnLog)("vxe.error.errProp",["table.context-menu=".concat(this.contextMenu),"table.context-menu={}"])),this.menuConfig&&!_xeUtils.default.isObject(this.menuConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.menu-config=".concat(this.menuConfig),"table.menu-config={}"]),this.exportConfig&&!_xeUtils.default.isObject(this.exportConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.export-config=".concat(this.exportConfig),"table.export-config={}"]),this.importConfig&&!_xeUtils.default.isObject(this.importConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.import-config=".concat(this.importConfig),"table.import-config={}"]),this.printConfig&&!_xeUtils.default.isObject(this.printConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.print-config=".concat(this.printConfig),"table.print-config={}"]),this.treeConfig&&!_xeUtils.default.isObject(this.treeConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.tree-config=".concat(this.treeConfig),"table.tree-config={}"]),this.customConfig&&!_xeUtils.default.isObject(this.customConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.custom-config=".concat(this.customConfig),"table.custom-config={}"]),this.editConfig&&!_xeUtils.default.isObject(this.editConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.edit-config=".concat(this.editConfig),"table.edit-config={}"]),this.emptyRender&&!_xeUtils.default.isObject(this.emptyRender)&&(0,_log.warnLog)("vxe.error.errProp",["table.empty-render=".concat(this.emptyRender),"table.empty-render={}"]),this.editConfig&&this.editOpts.activeMethod&&(0,_log.warnLog)("vxe.error.delProp",["table.edit-config.activeMethod","table.edit-config.beforeEditMethod"]),this.treeConfig&&this.checkboxOpts.isShiftKey&&(0,_log.errLog)("vxe.error.errConflicts",["tree-config","checkbox-config.isShiftKey"]),this.checkboxOpts.halfField)&&(0,_log.warnLog)("vxe.error.delProp",["checkbox-config.halfField","checkbox-config.indeterminateField"]),"development"===process.env.VUE_APP_VXE_TABLE_ENV&&(this.editConfig&&!this._insert&&(0,_log.errLog)("vxe.error.reqModule",["Edit"]),this.editRules&&!this._validate&&(0,_log.errLog)("vxe.error.reqModule",["Validator"]),(this.checkboxOpts.range||this.keyboardConfig||this.mouseConfig)&&!this.triggerCellMousedownEvent&&(0,_log.errLog)("vxe.error.reqModule",["Keyboard"]),this.printConfig||this.importConfig||this.exportConfig)&&!this._exportData&&(0,_log.errLog)("vxe.error.reqModule",["Export"]),Object.assign(s,{startIndex:0,endIndex:1,visibleSize:0,adaptive:!1!==n.adaptive}),Object.assign(r,{startIndex:0,endIndex:1,visibleSize:0}),this.loadTableData(l).then(function(){l&&l.length&&(e.inited=!0,e.initStatus=!0,e.handleLoadDefaults(),e.handleInitDefaults()),e.updateStyle()}),globalEvents.on(this,"paste",this.handleGlobalPasteEvent),globalEvents.on(this,"copy",this.handleGlobalCopyEvent),globalEvents.on(this,"cut",this.handleGlobalCutEvent),globalEvents.on(this,"mousedown",this.handleGlobalMousedownEvent),globalEvents.on(this,"blur",this.handleGlobalBlurEvent),globalEvents.on(this,"mousewheel",this.handleGlobalMousewheelEvent),globalEvents.on(this,"keydown",this.handleGlobalKeydownEvent),globalEvents.on(this,"resize",this.handleGlobalResizeEvent),globalEvents.on(this,"contextmenu",this.handleGlobalContextmenuEvent),this.preventEvent(null,"created")},mounted:function(){var e,t,o=this;"development"===process.env.VUE_APP_VXE_TABLE_ENV&&(t=this.$listeners,!this.menuConfig&&(t["menu-click"]||t["cell-menu"]||t["header-cell-menu"]||t["footer-cell-menu"])&&(0,_log.warnLog)("vxe.error.reqProp",["menu-config"]),this.tooltipConfig||!t["cell-mouseenter"]&&!t["cell-mouseleave"]||(0,_log.warnLog)("vxe.error.reqProp",["tooltip-config"])),this.autoResize&&(e=this.resizeOpts.refreshDelay?_xeUtils.default.throttle(function(){return o.recalculate(!0)},this.resizeOpts.refreshDelay,{leading:!0,trailing:!0}):null,(t=globalResize.create(e?function(){o.autoResize&&requestAnimationFrame(e)}:function(){o.autoResize&&o.recalculate(!0)})).observe(this.$el),t.observe(this.getParentElem()),this.$resize=t),this.preventEvent(null,"mounted")},activated:function(){var e=this;this.recalculate().then(function(){return e.refreshScroll()}),this.preventEvent(null,"activated")},deactivated:function(){this.preventEvent(null,"deactivated")},beforeDestroy:function(){this.$resize&&this.$resize.disconnect(),this.closeFilter(),this.closeMenu(),this.preventEvent(null,"beforeDestroy")},destroyed:function(){globalEvents.off(this,"paste"),globalEvents.off(this,"copy"),globalEvents.off(this,"cut"),globalEvents.off(this,"mousedown"),globalEvents.off(this,"blur"),globalEvents.off(this,"mousewheel"),globalEvents.off(this,"keydown"),globalEvents.off(this,"resize"),globalEvents.off(this,"contextmenu"),this.preventEvent(null,"destroyed")},render:function(e){var t=this._e,o=this.$scopedSlots,i=this.tId,r=this.isCalcColumn,n=this.tableData,s=this.tableColumn,l=this.tableGroupColumn,a=this.isGroup,u=this.loading,c=this.stripe,p=this.showHeader,f=this.height,h=this.tableBorder,d=this.treeOpts,g=this.treeConfig,m=this.mouseConfig,b=this.mouseOpts,x=this.vSize,v=this.validOpts,C=this.showFooter,_=this.overflowX,O=this.overflowY,y=this.scrollXLoad,w=this.scrollYLoad,M=this.scrollbarHeight,L=this.highlightCell,P=this.highlightHoverRow,E=this.highlightHoverColumn,T=this.editConfig,F=this.validTipOpts,R=this.initStore,S=this.columnStore,U=this.filterStore,I=this.customStore,D=this.ctxMenuStore,V=this.ctxMenuOpts,A=this.footerTableData,q=this.hasTip,$=this.columnOpts,H=this.rowOpts,K=this.checkboxOpts,k=this.loadingOpts,j=this.editRules,z=S.leftList,S=S.rightList,u=this._isLoading||u;return e("div",{class:["vxe-table","vxe-table--render-default","tid_".concat(i),x?"size--".concat(x):"","border--".concat(h),(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(i={},"valid-msg--".concat(v.msgMode),!!j),"vxe-editable",!!T),"old-cell-valid",j&&"obsolete"===getConfig().cellVaildMode),"cell--highlight",L),"cell--selected",m&&b.selected),"cell--area",m&&b.area),"row--highlight",H.isHover||P),"column--highlight",$.isHover||E),"checkbox--range",K.range),"column--calc",r),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(i,"is--header",p),"is--footer",C),"is--group",a),"is--tree-line",g&&(d.showLine||d.line)),"is--fixed-left",z.length),"is--fixed-right",S.length),"is--animat",!!this.animat),"is--round",this.round),"is--stripe",!g&&c),"is--loading",u),_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(i,"is--empty",!u&&!n.length),"is--scroll-y",O),"is--scroll-x",_),"is--virtual-x",y),"is--virtual-y",w))],attrs:{spellcheck:!1},on:{keydown:this.keydownEvent}},[e("div",{class:"vxe-table-slots",ref:"hideColumn"},this.$slots.default),e("div",{class:"vxe-table--render-wrapper"},[e("div",{class:"vxe-table--main-wrapper"},[p?e(_header.default,{ref:"tableHeader",props:{tableData:n,tableColumn:s,tableGroupColumn:l,size:x}}):t(),e(_body.default,{ref:"tableBody",props:{tableData:n,tableColumn:s,size:x}}),C?e(_footer.default,{ref:"tableFooter",props:{footerTableData:A,tableColumn:s,size:x}}):t()]),e("div",{class:"vxe-table--fixed-wrapper"},[z&&z.length&&_?renderFixed(e,this,"left"):t(),S&&S.length&&_?renderFixed(e,this,"right"):t()])]),e("div",{ref:"emptyPlaceholder",class:"vxe-table--empty-placeholder"},[e("div",{class:"vxe-table--empty-content"},renderEmptyContenet(e,this))]),e("div",{class:"vxe-table--border-line"}),e("div",{class:"vxe-table--resizable-bar",style:_?{"padding-bottom":"".concat(M,"px")}:{},ref:"resizeBar"}),e("vxe-loading",{class:"vxe-table--loading",props:{value:u,icon:k.icon,text:k.text}},this.callSlot(o.loading,{},e)),R.custom?e(_panel.default,{ref:"customWrapper",props:{customStore:I}}):t(),R.filter?e(_panel2.default,{ref:"filterWrapper",props:{filterStore:U}}):t(),R.import&&this.importConfig?e(_importPanel.default,{props:{defaultOptions:this.importParams,storeData:this.importStore}}):t(),R.export&&(this.exportConfig||this.printConfig)?e(_exportPanel.default,{props:{defaultOptions:this.exportParams,storeData:this.exportStore}}):t(),D.visible&&this.isCtxMenu?e(_panel3.default,{ref:"ctxWrapper",props:{ctxMenuStore:D,ctxMenuOpts:V}}):t(),e("div",{},[q?e("vxe-tooltip",{ref:"commTip",props:{isArrow:!1,enterable:!1}}):t(),q?e("vxe-tooltip",{ref:"tooltip",props:Object.assign({},this.tipConfig,this.tooltipStore.currOpts)}):t(),q&&this.editRules&&v.showMessage&&("default"===v.message?!f:"tooltip"===v.message)?e("vxe-tooltip",{ref:"validTip",class:[{"old-cell-valid":j&&"obsolete"===getConfig().cellVaildMode},"vxe-table--valid-error"],props:"tooltip"===v.message||1===n.length?F:null}):t()])])},methods:_methods.default};
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_utils=require("../../ui/src/utils"),_ui=require("../../ui"),_methods=_interopRequireDefault(require("./methods")),_body=_interopRequireDefault(require("./body")),_header=_interopRequireDefault(require("./header")),_footer=_interopRequireDefault(require("./footer")),_props=_interopRequireDefault(require("./props")),_vn=require("../../ui/src/vn"),_log=require("../../ui/src/log"),_panel=_interopRequireDefault(require("../module/custom/panel")),_panel2=_interopRequireDefault(require("../module/filter/panel")),_importPanel=_interopRequireDefault(require("../module/export/import-panel")),_exportPanel=_interopRequireDefault(require("../module/export/export-panel")),_panel3=_interopRequireDefault(require("../module/menu/panel")),_mixin=_interopRequireDefault(require("../module/filter/mixin")),_mixin2=_interopRequireDefault(require("../module/menu/mixin")),_mixin3=_interopRequireDefault(require("../module/edit/mixin")),_mixin4=_interopRequireDefault(require("../module/export/mixin")),_mixin5=_interopRequireDefault(require("../module/keyboard/mixin")),_mixin6=_interopRequireDefault(require("../module/validator/mixin")),_mixin7=_interopRequireDefault(require("../module/custom/mixin"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let{getConfig,getI18n,renderer,globalResize,globalEvents,globalMixins}=_ui.VxeUI;function renderFixed(e,t,o){var{_e:t,tableData:i,tableColumn:r,tableGroupColumn:l,vSize:s,showHeader:n,showFooter:a,columnStore:u,footerTableData:p}=t,u=u[o+"List"];return e("div",{class:`vxe-table--fixed-${o}-wrapper`,ref:o+"Container"},[n?e(_header.default,{props:{fixedType:o,tableData:i,tableColumn:r,tableGroupColumn:l,size:s,fixedColumn:u},ref:o+"Header"}):t(),e(_body.default,{props:{fixedType:o,tableData:i,tableColumn:r,fixedColumn:u,size:s},ref:o+"Body"}),a?e(_footer.default,{props:{footerTableData:p,tableColumn:r,fixedColumn:u,fixedType:o,size:s},ref:o+"Footer"}):t()])}function renderEmptyContenet(e,t){var{$scopedSlots:o,emptyOpts:i}=t;let r="";var l={$table:t};return r=o.empty?o.empty.call(t,l,e):(o=(o=i.name?renderer.get(i.name):null)?o.renderTableEmptyView||o.renderEmpty:null)?(0,_vn.getSlotVNs)(o.call(t,e,i,l)):(0,_utils.getFuncText)(t.emptyText)||getI18n("vxe.table.emptyText")}function handleUupdateResize(e){var t=e.$el;t&&t.clientWidth&&t.clientHeight&&e.recalculate()}var _default=exports.default={name:"VxeTable",mixins:[globalMixins.sizeMixin,_mixin.default,_mixin2.default,_mixin3.default,_mixin4.default,_mixin5.default,_mixin6.default,_mixin7.default],props:_props.default,provide(){return{$xetable:this,$xeTable:this,xecolgroup:null}},inject:{$xeTabs:{default:null},$xeGrid:{default:null},$xegrid:{default:null}},data(){return{tId:""+_xeUtils.default.uniqueId(),isCalcColumn:!1,staticColumns:[],tableGroupColumn:[],tableColumn:[],tableData:[],scrollXLoad:!1,scrollYLoad:!1,overflowY:!0,overflowX:!1,scrollbarWidth:0,scrollbarHeight:0,rowHeight:0,parentHeight:0,isGroup:!1,isAllOverflow:!1,isAllSelected:!1,isIndeterminate:!1,selectCheckboxMaps:{},currentRow:null,currentColumn:null,selectRadioRow:null,footerTableData:[],expandColumn:null,hasFixedColumn:!1,treeNodeColumn:null,rowExpandedMaps:{},rowExpandLazyLoadedMaps:{},treeExpandedMaps:{},treeExpandLazyLoadedMaps:{},treeIndeterminateMaps:{},mergeList:[],mergeFooterList:[],initStore:{filter:!1,import:!1,export:!1,custom:!1},customColumnList:[],upDataFlag:0,reColumnFlag:0,pendingRowMaps:{},pendingRowList:[],customStore:{btnEl:null,isAll:!1,isIndeterminate:!1,activeBtn:!1,activeWrapper:!1,visible:!1,maxHeight:0,oldSortMaps:{},oldFixedMaps:{},oldVisibleMaps:{}},filterStore:{isAllSelected:!1,isIndeterminate:!1,style:null,options:[],column:null,multiple:!1,visible:!1,maxHeight:null},columnStore:{leftList:[],centerList:[],rightList:[],resizeList:[],pxList:[],pxMinList:[],autoMinList:[],scaleList:[],scaleMinList:[],autoList:[],remainList:[]},ctxMenuStore:{selected:null,visible:!1,showChild:!1,selectChild:null,list:[],style:null},editStore:{indexs:{columns:[]},titles:{columns:[]},selected:{row:null,column:null},copyed:{cut:!1,rows:[],columns:[]},actived:{row:null,column:null},focused:{row:null,column:null},insertList:[],insertMaps:{},removeList:[],removeMaps:{}},tooltipStore:{row:null,column:null,visible:!1,currOpts:{}},validStore:{visible:!1},validErrorMaps:{},importStore:{inited:!1,file:null,type:"",modeList:[],typeList:[],filename:"",visible:!1},importParams:{mode:"",types:null,message:!0},exportStore:{inited:!1,name:"",modeList:[],typeList:[],columns:[],isPrint:!1,hasFooter:!1,hasTree:!1,hasMerge:!1,hasColgroup:!1,visible:!1},exportParams:{filename:"",sheetName:"",mode:"",type:"",isColgroup:!1,isMerge:!1,isAllExpand:!1,useStyle:!1,original:!1,message:!0,isHeader:!1,isFooter:!1},_isLoading:!1}},computed:Object.assign(Object.assign({},{}),{tableId(){var e=this.id;return e?_xeUtils.default.isFunction(e)?""+(e({$table:this})||""):""+e:""},validOpts(){return this.computeValidOpts},computeValidOpts(){return Object.assign({message:"default"},_xeUtils.default.clone(getConfig().table.validConfig,!0),this.validConfig)},sXOpts(){return this.computeSXOpts},computeSXOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.scrollX,!0),this.scrollX)},sYOpts(){return this.computeSYOpts},computeSYOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.scrollY,!0),this.scrollY)},rowHeightMaps(){return{default:48,medium:44,small:40,mini:36}},columnOpts(){return this.computeColumnOpts},computeColumnOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.columnConfig,!0),this.columnConfig)},rowOpts(){return this.computeRowOpts},computeRowOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.rowConfig,!0),this.rowConfig)},resizeOpts(){return this.computeResizeOpts},computeResizeOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.resizeConfig,!0),this.resizeConfig)},resizableOpts(){return this.computeResizableOpts},computeResizableOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.resizableConfig,!0),this.resizableConfig)},seqOpts(){return this.computeSeqOpts},computeSeqOpts(){return Object.assign({startIndex:0},_xeUtils.default.clone(getConfig().table.seqConfig,!0),this.seqConfig)},radioOpts(){return this.computeRadioOpts},computeRadioOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.radioConfig,!0),this.radioConfig)},checkboxOpts(){return this.computeCheckboxOpts},computeCheckboxOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.checkboxConfig,!0),this.checkboxConfig)},tooltipOpts(){return this.computeTooltipOpts},computeTooltipOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().tooltip,!0),_xeUtils.default.clone(getConfig().table.tooltipConfig,!0),this.tooltipConfig)},tipConfig(){return Object.assign({},this.tooltipOpts)},validTipOpts(){return Object.assign({isArrow:!1},this.tooltipOpts)},editOpts(){return this.computeEditOpts},computeEditOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.editConfig,!0),this.editConfig)},sortOpts(){return this.computeSortOpts},computeSortOpts(){return Object.assign({orders:["asc","desc",null]},_xeUtils.default.clone(getConfig().table.sortConfig,!0),this.sortConfig)},filterOpts(){return this.computeFilterOpts},computeFilterOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.filterConfig,!0),this.filterConfig)},mouseOpts(){return this.computeMouseOpts},computeMouseOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.mouseConfig,!0),this.mouseConfig)},areaOpts(){return this.computeAreaOpts},computeAreaOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.areaConfig,!0),this.areaConfig)},keyboardOpts(){return this.computeKeyboardOpts},computeKeyboardOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.keyboardConfig,!0),this.keyboardConfig)},clipOpts(){return this.computeClipOpts},computeClipOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.clipConfig,!0),this.clipConfig)},fnrOpts(){return this.computeFNROpts},computeFNROpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.fnrConfig,!0),this.fnrConfig)},headerCtxMenu(){var e=this.ctxMenuOpts.header;return e&&e.options?e.options:[]},bodyCtxMenu(){var e=this.ctxMenuOpts.body;return e&&e.options?e.options:[]},footerCtxMenu(){var e=this.ctxMenuOpts.footer;return e&&e.options?e.options:[]},isCtxMenu(){return!(!this.contextMenu&&!this.menuConfig||!(0,_utils.isEnableConf)(this.ctxMenuOpts)||!(this.headerCtxMenu.length||this.bodyCtxMenu.length||this.footerCtxMenu.length))},ctxMenuList(){let t=[];return this.ctxMenuStore.list.forEach(e=>{e.forEach(e=>{t.push(e)})}),t},ctxMenuOpts(){return this.computeMenuOpts},computeMenuOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.menuConfig,!0),this.contextMenu,this.menuConfig)},exportOpts(){return this.computeExportOpts},computeExportOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.exportConfig,!0),this.exportConfig)},importOpts(){return this.computeImportOpts},computeImportOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.importConfig,!0),this.importConfig)},printOpts(){return this.computePrintOpts},computePrintOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.printConfig,!0),this.printConfig)},expandOpts(){return this.computeExpandOpts},computeExpandOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.expandConfig,!0),this.expandConfig)},treeOpts(){return this.computeTreeOpts},computeTreeOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.treeConfig,!0),this.treeConfig)},emptyOpts(){return this.computeEmptyOpts},computeEmptyOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.emptyRender,!0),this.emptyRender)},loadingOpts(){return this.computeLoadingOpts},computeLoadingOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.loadingConfig,!0),this.loadingConfig)},cellOffsetWidth(){return this.border?Math.max(2,Math.ceil(this.scrollbarWidth/this.tableColumn.length)):1},customOpts(){return this.computeCustomOpts},computeCustomOpts(){return Object.assign({},_xeUtils.default.clone(getConfig().table.customConfig,!0),this.customConfig)},autoWidthColumnList(){var{tableColumn:e,visibleColumn:t}=this;return e.length||t.length?t.filter(e=>"auto"===e.width||"auto"===e.minWidth):[]},fixedColumnSize(){var e=this.collectColumn;let t=0;return e.forEach(e=>{e.renderFixed&&t++}),t},isMaxFixedColumn(){var e=this.columnOpts.maxFixedSize;return!!e&&this.fixedColumnSize>=e},tableBorder(){var e=this.border;return!0===e?"full":e||"default"},isAllCheckboxDisabled(){var{tableFullData:e,tableData:t,checkboxOpts:o}=this;let{strict:i,checkMethod:r}=o;return!!i&&(!t.length&&!e.length||!!r&&e.every(e=>!r({row:e})))},tabsResizeFlag(){var e=this.$xeTabs;return e?e.reactData.resizeFlag:null}}),watch:{data(e){let{inited:t,initStatus:o}=this;this.loadTableData(e).then(()=>{this.inited=!0,this.initStatus=!0,o||this.handleLoadDefaults(),t||this.handleInitDefaults(),(this.scrollXLoad||this.scrollYLoad)&&this.expandColumn&&(0,_log.warnLog)("vxe.error.scrollErrProp",["column.type=expand"]),this.recalculate()})},staticColumns(e){this.handleColumn(e)},tableColumn(){this.analyColumnWidth()},upDataFlag(){this.$nextTick().then(()=>this.updateData())},reColumnFlag(){this.$nextTick().then(()=>this.refreshColumn())},showHeader(){this.$nextTick(()=>{this.recalculate(!0).then(()=>this.refreshScroll())})},showFooter(){this.$nextTick(()=>{this.recalculate(!0).then(()=>this.refreshScroll())})},height(){this.$nextTick(()=>this.recalculate(!0))},maxHeight(){this.$nextTick(()=>this.recalculate(!0))},syncResize(e){e&&(handleUupdateResize(this),this.$nextTick(()=>{handleUupdateResize(this),setTimeout(()=>handleUupdateResize(this))}))},tabsResizeFlag(){this.handleGlobalResizeEvent()},mergeCells(e){this.clearMergeCells(),this.$nextTick(()=>this.setMergeCells(e))},mergeFooterItems(e){this.clearMergeFooterItems(),this.$nextTick(()=>this.setMergeFooterItems(e))}},created(){let{scrollXStore:e,sYOpts:t,scrollYStore:o,data:i,editOpts:r,treeOpts:l,treeConfig:s,showOverflow:n,rowOpts:a}=Object.assign(this,{tZindex:0,elemStore:{},scrollXStore:{},scrollYStore:{},tableWidth:0,tableHeight:0,headerHeight:0,footerHeight:0,lastScrollLeft:0,lastScrollTop:0,radioReserveRow:null,checkboxReserveRowMap:{},rowExpandedReserveRowMap:{},treeExpandedReserveRowMap:{},tableFullData:[],afterFullData:[],afterFullRowMaps:{},collectColumn:[],tableFullColumn:[],visibleColumn:[],fullAllDataRowMap:new Map,fullAllDataRowIdData:{},fullDataRowMap:new Map,fullDataRowIdData:{},fullColumnMap:new Map,fullColumnIdData:{},fullColumnFieldData:{}});if("development"===process.env.NODE_ENV){this.rowId&&(0,_log.warnLog)("vxe.error.delProp",["row-id","row-config.keyField"]),this.rowKey&&(0,_log.warnLog)("vxe.error.delProp",["row-key","row-config.useKey"]),this.columnKey&&(0,_log.warnLog)("vxe.error.delProp",["column-id","column-config.useKey"]),this.rowId||a.keyField||!(this.checkboxOpts.reserve||this.checkboxOpts.checkRowKeys||this.radioOpts.reserve||this.radioOpts.checkRowKey||this.expandOpts.expandRowKeys||this.treeOpts.expandRowKeys)||(0,_log.warnLog)("vxe.error.reqProp",["row-config.keyField"]),this.editConfig&&r.showStatus&&!this.keepSource&&(0,_log.warnLog)("vxe.error.reqProp",["keep-source"]),!s||!l.showLine&&!l.line||(this.rowKey||a.useKey)&&n||(0,_log.warnLog)("vxe.error.reqProp",["row-config.useKey | show-overflow"]),!this.showFooter||this.footerMethod||this.footerData||(0,_log.warnLog)("vxe.error.reqProp",["footer-data | footer-method"]),s&&this.stripe&&(0,_log.warnLog)("vxe.error.noTree",["stripe"]),this.tooltipOpts.enabled&&(0,_log.warnLog)("vxe.error.delProp",["tooltip-config.enabled","tooltip-config.showAll"]);let{exportConfig:e,exportOpts:t,importConfig:o,importOpts:i}=this;o&&i.types&&!i.importMethod&&!_xeUtils.default.includeArrays(_xeUtils.default.keys(i._typeMaps),i.types)&&(0,_log.warnLog)("vxe.error.errProp",["export-config.types="+i.types.join(","),i.types.filter(e=>_xeUtils.default.includes(_xeUtils.default.keys(i._typeMaps),e)).join(",")||_xeUtils.default.keys(i._typeMaps).join(",")]),e&&t.types&&!t.exportMethod&&!_xeUtils.default.includeArrays(_xeUtils.default.keys(t._typeMaps),t.types)&&(0,_log.warnLog)("vxe.error.errProp",["export-config.types="+t.types.join(","),t.types.filter(e=>_xeUtils.default.includes(_xeUtils.default.keys(t._typeMaps),e)).join(",")||_xeUtils.default.keys(t._typeMaps).join(",")])}if("development"===process.env.NODE_ENV){var u=this.customOpts;if(!this.id&&this.customConfig&&(!0===u.storage||u.storage&&u.storage.resizable||u.storage&&u.storage.visible)&&(0,_log.errLog)("vxe.error.reqProp",["id"]),this.treeConfig&&this.checkboxOpts.range&&(0,_log.errLog)("vxe.error.noTree",["checkbox-config.range"]),this.rowOpts.height&&!this.showOverflow&&(0,_log.warnLog)("vxe.error.notProp",["table.show-overflow"]),!this.handleUpdateCellAreas&&(this.clipConfig&&(0,_log.warnLog)("vxe.error.notProp",["clip-config"]),this.fnrConfig&&(0,_log.warnLog)("vxe.error.notProp",["fnr-config"]),this.mouseOpts.area))return void(0,_log.errLog)("vxe.error.notProp",["mouse-config.area"]);this.treeConfig&&l.children&&(0,_log.warnLog)("vxe.error.delProp",["tree-config.children","tree-config.childrenField"]),this.treeConfig&&l.line&&(0,_log.warnLog)("vxe.error.delProp",["tree-config.line","tree-config.showLine"]),this.mouseOpts.area&&this.mouseOpts.selected&&(0,_log.warnLog)("vxe.error.errConflicts",["mouse-config.area","mouse-config.selected"]),this.treeConfig&&this.mouseOpts.area&&(0,_log.errLog)("vxe.error.noTree",["mouse-config.area"])}"development"===process.env.NODE_ENV&&(this.contextMenu&&((0,_log.warnLog)("vxe.error.delProp",["context-menu","menu-config"]),_xeUtils.default.isObject(this.contextMenu)||(0,_log.warnLog)("vxe.error.errProp",["table.context-menu="+this.contextMenu,"table.context-menu={}"])),this.menuConfig&&!_xeUtils.default.isObject(this.menuConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.menu-config="+this.menuConfig,"table.menu-config={}"]),this.exportConfig&&!_xeUtils.default.isObject(this.exportConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.export-config="+this.exportConfig,"table.export-config={}"]),this.importConfig&&!_xeUtils.default.isObject(this.importConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.import-config="+this.importConfig,"table.import-config={}"]),this.printConfig&&!_xeUtils.default.isObject(this.printConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.print-config="+this.printConfig,"table.print-config={}"]),this.treeConfig&&!_xeUtils.default.isObject(this.treeConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.tree-config="+this.treeConfig,"table.tree-config={}"]),this.customConfig&&!_xeUtils.default.isObject(this.customConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.custom-config="+this.customConfig,"table.custom-config={}"]),this.editConfig&&!_xeUtils.default.isObject(this.editConfig)&&(0,_log.warnLog)("vxe.error.errProp",["table.edit-config="+this.editConfig,"table.edit-config={}"]),this.emptyRender&&!_xeUtils.default.isObject(this.emptyRender)&&(0,_log.warnLog)("vxe.error.errProp",["table.empty-render="+this.emptyRender,"table.empty-render={}"]),this.editConfig&&this.editOpts.activeMethod&&(0,_log.warnLog)("vxe.error.delProp",["table.edit-config.activeMethod","table.edit-config.beforeEditMethod"]),this.treeConfig&&this.checkboxOpts.isShiftKey&&(0,_log.errLog)("vxe.error.errConflicts",["tree-config","checkbox-config.isShiftKey"]),this.checkboxOpts.halfField)&&(0,_log.warnLog)("vxe.error.delProp",["checkbox-config.halfField","checkbox-config.indeterminateField"]),"development"===process.env.NODE_ENV&&(this.editConfig&&!this._insert&&(0,_log.errLog)("vxe.error.reqModule",["Edit"]),this.editRules&&!this._validate&&(0,_log.errLog)("vxe.error.reqModule",["Validator"]),(this.checkboxOpts.range||this.keyboardConfig||this.mouseConfig)&&!this.triggerCellMousedownEvent&&(0,_log.errLog)("vxe.error.reqModule",["Keyboard"]),this.printConfig||this.importConfig||this.exportConfig)&&!this._exportData&&(0,_log.errLog)("vxe.error.reqModule",["Export"]),Object.assign(o,{startIndex:0,endIndex:1,visibleSize:0,adaptive:!1!==t.adaptive}),Object.assign(e,{startIndex:0,endIndex:1,visibleSize:0}),this.loadTableData(i).then(()=>{i&&i.length&&(this.inited=!0,this.initStatus=!0,this.handleLoadDefaults(),this.handleInitDefaults()),this.updateStyle()}),globalEvents.on(this,"paste",this.handleGlobalPasteEvent),globalEvents.on(this,"copy",this.handleGlobalCopyEvent),globalEvents.on(this,"cut",this.handleGlobalCutEvent),globalEvents.on(this,"mousedown",this.handleGlobalMousedownEvent),globalEvents.on(this,"blur",this.handleGlobalBlurEvent),globalEvents.on(this,"mousewheel",this.handleGlobalMousewheelEvent),globalEvents.on(this,"keydown",this.handleGlobalKeydownEvent),globalEvents.on(this,"resize",this.handleGlobalResizeEvent),globalEvents.on(this,"contextmenu",this.handleGlobalContextmenuEvent),this.preventEvent(null,"created")},mounted(){let o=this;if("development"===process.env.NODE_ENV&&(t=this.$listeners,!this.menuConfig&&(t["menu-click"]||t["cell-menu"]||t["header-cell-menu"]||t["footer-cell-menu"])&&(0,_log.warnLog)("vxe.error.reqProp",["menu-config"]),this.tooltipConfig||!t["cell-mouseenter"]&&!t["cell-mouseleave"]||(0,_log.warnLog)("vxe.error.reqProp",["tooltip-config"])),"development"===process.env.NODE_ENV){let e=_ui.VxeUI.getComponent("VxeLoading"),t=_ui.VxeUI.getComponent("VxeTooltip");this.$nextTick(()=>{o.loading&&!e&&(0,_log.errLog)("vxe.error.reqComp",["vxe-loading"]),!0!==o.showOverflow&&"tooltip"!==o.showOverflow&&!0!==o.showHeaderOverflow&&"tooltip"!==o.showHeaderOverflow&&!0!==o.showFooterOverflow&&"tooltip"!==o.showFooterOverflow&&!o.tooltipConfig&&!o.editRules||t||(0,_log.errLog)("vxe.error.reqComp",["vxe-tooltip"])})}if(this.autoResize){let e=this.resizeOpts.refreshDelay?_xeUtils.default.throttle(()=>this.recalculate(!0),this.resizeOpts.refreshDelay,{leading:!0,trailing:!0}):null;var t=globalResize.create(e?()=>{this.autoResize&&e()}:()=>{this.autoResize&&this.recalculate(!0)});t.observe(this.$el),t.observe(this.getParentElem()),this.$resize=t}this.preventEvent(null,"mounted")},activated(){this.recalculate().then(()=>this.refreshScroll()),this.preventEvent(null,"activated")},deactivated(){this.preventEvent(null,"deactivated")},beforeDestroy(){this.$resize&&this.$resize.disconnect(),this.closeFilter(),this.closeMenu(),this.preventEvent(null,"beforeDestroy")},destroyed(){globalEvents.off(this,"paste"),globalEvents.off(this,"copy"),globalEvents.off(this,"cut"),globalEvents.off(this,"mousedown"),globalEvents.off(this,"blur"),globalEvents.off(this,"mousewheel"),globalEvents.off(this,"keydown"),globalEvents.off(this,"resize"),globalEvents.off(this,"contextmenu"),this.preventEvent(null,"destroyed")},render(e){var t=_ui.VxeUI.getComponent("VxeLoading"),o=_ui.VxeUI.getComponent("VxeTooltip"),{_e:i,$scopedSlots:r,tId:l,isCalcColumn:s,tableData:n,tableColumn:a,tableGroupColumn:u,isGroup:p,loading:d,stripe:h,showHeader:g,height:c,tableBorder:f,treeOpts:m,treeConfig:x,mouseConfig:b,mouseOpts:C,computeSize:v,validOpts:O,showFooter:_,overflowX:w,overflowY:y,scrollXLoad:M,scrollYLoad:L,scrollbarHeight:E,highlightCell:R,highlightHoverRow:D,highlightHoverColumn:F,editConfig:P,validTipOpts:T,initStore:S,columnStore:U,filterStore:I,customStore:$,ctxMenuStore:q,ctxMenuOpts:H,footerTableData:V,columnOpts:G,rowOpts:K,checkboxOpts:N,loadingOpts:k,editRules:j}=this,{leftList:U,rightList:z}=U,d=this._isLoading||d;return e("div",{class:["vxe-table","vxe-table--render-default","tid_"+l,v?"size--"+v:"","border--"+f,{["valid-msg--"+O.msgMode]:!!j,"vxe-editable":!!P,"old-cell-valid":j&&"obsolete"===getConfig().cellVaildMode,"cell--highlight":R,"cell--selected":b&&C.selected,"cell--area":b&&C.area,"row--highlight":K.isHover||D,"column--highlight":G.isHover||F,"checkbox--range":N.range,"column--calc":s,"is--header":g,"is--footer":_,"is--group":p,"is--tree-line":x&&(m.showLine||m.line),"is--fixed-left":U.length,"is--fixed-right":z.length,"is--animat":!!this.animat,"is--padding":this.padding,"is--round":this.round,"is--stripe":!x&&h,"is--loading":d,"is--empty":!d&&!n.length,"is--scroll-y":y,"is--scroll-x":w,"is--virtual-x":M,"is--virtual-y":L}],attrs:{spellcheck:!1},on:{keydown:this.keydownEvent}},[e("div",{class:"vxe-table-slots",ref:"hideColumn"},this.$slots.default),e("div",{class:"vxe-table--render-wrapper"},[e("div",{class:"vxe-table--main-wrapper"},[g?e(_header.default,{ref:"tableHeader",props:{tableData:n,tableColumn:a,tableGroupColumn:u,size:v}}):i(),e(_body.default,{ref:"tableBody",props:{tableData:n,tableColumn:a,size:v}}),_?e(_footer.default,{ref:"tableFooter",props:{footerTableData:V,tableColumn:a,size:v}}):i()]),e("div",{class:"vxe-table--fixed-wrapper"},[U&&U.length&&w?renderFixed(e,this,"left"):i(),z&&z.length&&w?renderFixed(e,this,"right"):i()])]),e("div",{ref:"emptyPlaceholder",class:"vxe-table--empty-placeholder"},[e("div",{class:"vxe-table--empty-content"},renderEmptyContenet(e,this))]),e("div",{class:"vxe-table--border-line"}),e("div",{class:"vxe-table--resizable-bar",style:w?{"padding-bottom":E+"px"}:{},ref:"resizeBar"}),t?e(t,{class:"vxe-table--loading",props:{value:d,icon:k.icon,text:k.text}},this.callSlot(r.loading,{},e)):i(),S.custom?e(_panel.default,{ref:"customWrapper",props:{customStore:$}}):i(),S.filter?e(_panel2.default,{ref:"filterWrapper",props:{filterStore:I}}):i(),S.import&&this.importConfig?e(_importPanel.default,{props:{defaultOptions:this.importParams,storeData:this.importStore}}):i(),S.export&&(this.exportConfig||this.printConfig)?e(_exportPanel.default,{props:{defaultOptions:this.exportParams,storeData:this.exportStore}}):i(),q.visible&&this.isCtxMenu?e(_panel3.default,{ref:"ctxWrapper",props:{ctxMenuStore:q,ctxMenuOpts:H}}):i(),e("div",{},[o?e(o,{ref:"commTip",props:{isArrow:!1,enterable:!1}}):i(),o?e(o,{ref:"tooltip",props:Object.assign({},this.tipConfig,this.tooltipStore.currOpts)}):i(),o&&this.editRules&&O.showMessage&&("default"===O.message?!c:"tooltip"===O.message)?e(o,{ref:"validTip",class:[{"old-cell-valid":j&&"obsolete"===getConfig().cellVaildMode},"vxe-table--valid-error"],props:"tooltip"===O.message||1===n.length?T:null}):i()])])},methods:_methods.default};
|
package/lib/table/src/util.js
CHANGED
|
@@ -33,22 +33,14 @@ var _columnInfo = require("./columnInfo");
|
|
|
33
33
|
var _dom = require("../../ui/src/dom");
|
|
34
34
|
var _log = require("../../ui/src/log");
|
|
35
35
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
40
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
41
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
42
|
-
var _getAllConvertColumns = function getAllConvertColumns(columns, parentColumn) {
|
|
43
|
-
var result = [];
|
|
44
|
-
columns.forEach(function (column) {
|
|
36
|
+
const getAllConvertColumns = (columns, parentColumn) => {
|
|
37
|
+
const result = [];
|
|
38
|
+
columns.forEach(column => {
|
|
45
39
|
column.parentId = parentColumn ? parentColumn.id : null;
|
|
46
40
|
if (column.visible) {
|
|
47
|
-
if (column.children && column.children.length && column.children.some(
|
|
48
|
-
return column.visible;
|
|
49
|
-
})) {
|
|
41
|
+
if (column.children && column.children.length && column.children.some(column => column.visible)) {
|
|
50
42
|
result.push(column);
|
|
51
|
-
result.push
|
|
43
|
+
result.push(...getAllConvertColumns(column.children, column));
|
|
52
44
|
} else {
|
|
53
45
|
result.push(column);
|
|
54
46
|
}
|
|
@@ -56,22 +48,20 @@ var _getAllConvertColumns = function getAllConvertColumns(columns, parentColumn)
|
|
|
56
48
|
});
|
|
57
49
|
return result;
|
|
58
50
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
const convertHeaderColumnToRows = originColumns => {
|
|
52
|
+
let maxLevel = 1;
|
|
53
|
+
const traverse = (column, parent) => {
|
|
62
54
|
if (parent) {
|
|
63
55
|
column.level = parent.level + 1;
|
|
64
56
|
if (maxLevel < column.level) {
|
|
65
57
|
maxLevel = column.level;
|
|
66
58
|
}
|
|
67
59
|
}
|
|
68
|
-
if (column.children && column.children.length && column.children.some(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var colSpan = 0;
|
|
72
|
-
column.children.forEach(function (subColumn) {
|
|
60
|
+
if (column.children && column.children.length && column.children.some(column => column.visible)) {
|
|
61
|
+
let colSpan = 0;
|
|
62
|
+
column.children.forEach(subColumn => {
|
|
73
63
|
if (subColumn.visible) {
|
|
74
|
-
|
|
64
|
+
traverse(subColumn, column);
|
|
75
65
|
colSpan += subColumn.colSpan;
|
|
76
66
|
}
|
|
77
67
|
});
|
|
@@ -80,19 +70,17 @@ var convertHeaderColumnToRows = exports.convertHeaderColumnToRows = function con
|
|
|
80
70
|
column.colSpan = 1;
|
|
81
71
|
}
|
|
82
72
|
};
|
|
83
|
-
originColumns.forEach(
|
|
73
|
+
originColumns.forEach(column => {
|
|
84
74
|
column.level = 1;
|
|
85
|
-
|
|
75
|
+
traverse(column);
|
|
86
76
|
});
|
|
87
|
-
|
|
88
|
-
for (
|
|
77
|
+
const rows = [];
|
|
78
|
+
for (let i = 0; i < maxLevel; i++) {
|
|
89
79
|
rows.push([]);
|
|
90
80
|
}
|
|
91
|
-
|
|
92
|
-
allColumns.forEach(
|
|
93
|
-
if (column.children && column.children.length && column.children.some(
|
|
94
|
-
return column.visible;
|
|
95
|
-
})) {
|
|
81
|
+
const allColumns = getAllConvertColumns(originColumns);
|
|
82
|
+
allColumns.forEach(column => {
|
|
83
|
+
if (column.children && column.children.length && column.children.some(column => column.visible)) {
|
|
96
84
|
column.rowSpan = 1;
|
|
97
85
|
} else {
|
|
98
86
|
column.rowSpan = maxLevel - column.level + 1;
|
|
@@ -101,13 +89,14 @@ var convertHeaderColumnToRows = exports.convertHeaderColumnToRows = function con
|
|
|
101
89
|
});
|
|
102
90
|
return rows;
|
|
103
91
|
};
|
|
104
|
-
|
|
92
|
+
exports.convertHeaderColumnToRows = convertHeaderColumnToRows;
|
|
93
|
+
const lineOffsetSizes = {
|
|
105
94
|
mini: 3,
|
|
106
95
|
small: 2,
|
|
107
96
|
medium: 1
|
|
108
97
|
};
|
|
109
98
|
function restoreScrollLocation(_vm, scrollLeft, scrollTop) {
|
|
110
|
-
return _vm.clearScroll().then(
|
|
99
|
+
return _vm.clearScroll().then(() => {
|
|
111
100
|
if (scrollLeft || scrollTop) {
|
|
112
101
|
// 重置最后滚动状态
|
|
113
102
|
_vm.lastScrollLeft = 0;
|
|
@@ -118,9 +107,7 @@ function restoreScrollLocation(_vm, scrollLeft, scrollTop) {
|
|
|
118
107
|
});
|
|
119
108
|
}
|
|
120
109
|
function toTreePathSeq(path) {
|
|
121
|
-
return path.map(
|
|
122
|
-
return i % 2 === 0 ? Number(num) + 1 : '.';
|
|
123
|
-
}).join('');
|
|
110
|
+
return path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
|
|
124
111
|
}
|
|
125
112
|
function removeScrollListener(scrollElem) {
|
|
126
113
|
if (scrollElem && scrollElem._onscroll) {
|
|
@@ -144,23 +131,23 @@ function getRowkey($xetable) {
|
|
|
144
131
|
}
|
|
145
132
|
// 行主键 value
|
|
146
133
|
function getRowid($xetable, row) {
|
|
147
|
-
|
|
134
|
+
const rowid = _xeUtils.default.get(row, getRowkey($xetable));
|
|
148
135
|
return _xeUtils.default.eqNull(rowid) ? '' : encodeURIComponent(rowid);
|
|
149
136
|
}
|
|
150
137
|
function getPaddingLeftRightSize(elem) {
|
|
151
138
|
if (elem) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
139
|
+
const computedStyle = getComputedStyle(elem);
|
|
140
|
+
const paddingLeft = _xeUtils.default.toNumber(computedStyle.paddingLeft);
|
|
141
|
+
const paddingRight = _xeUtils.default.toNumber(computedStyle.paddingRight);
|
|
155
142
|
return paddingLeft + paddingRight;
|
|
156
143
|
}
|
|
157
144
|
return 0;
|
|
158
145
|
}
|
|
159
146
|
function getElemenMarginWidth(elem) {
|
|
160
147
|
if (elem) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
148
|
+
const computedStyle = getComputedStyle(elem);
|
|
149
|
+
const marginLeft = _xeUtils.default.toNumber(computedStyle.marginLeft);
|
|
150
|
+
const marginRight = _xeUtils.default.toNumber(computedStyle.marginRight);
|
|
164
151
|
return elem.offsetWidth + marginLeft + marginRight;
|
|
165
152
|
}
|
|
166
153
|
return 0;
|
|
@@ -173,18 +160,20 @@ function handleFieldOrColumn(_vm, fieldOrColumn) {
|
|
|
173
160
|
}
|
|
174
161
|
// 组装列配置
|
|
175
162
|
function assembleColumn(_vm) {
|
|
176
|
-
|
|
177
|
-
$
|
|
178
|
-
$
|
|
179
|
-
|
|
180
|
-
|
|
163
|
+
const {
|
|
164
|
+
$el,
|
|
165
|
+
$xetable,
|
|
166
|
+
$xecolumn,
|
|
167
|
+
columnConfig
|
|
168
|
+
} = _vm;
|
|
169
|
+
const groupConfig = $xecolumn ? $xecolumn.columnConfig : null;
|
|
181
170
|
columnConfig.slots = _vm.$scopedSlots;
|
|
182
171
|
if (groupConfig) {
|
|
183
|
-
if (process.env.
|
|
172
|
+
if (process.env.NODE_ENV === 'development') {
|
|
184
173
|
if ($xecolumn.$options._componentTag === 'vxe-table-column') {
|
|
185
|
-
(0, _log.errLog)('vxe.error.groupTag', [
|
|
174
|
+
(0, _log.errLog)('vxe.error.groupTag', [`<vxe-table-colgroup title=${$xecolumn.title} ...>`, `<vxe-table-column title=${$xecolumn.title} ...>`]);
|
|
186
175
|
} else if ($xecolumn.$options._componentTag === 'vxe-column') {
|
|
187
|
-
(0, _log.warnLog)('vxe.error.groupTag', [
|
|
176
|
+
(0, _log.warnLog)('vxe.error.groupTag', [`<vxe-colgroup title=${$xecolumn.title} ...>`, `<vxe-column title=${$xecolumn.title} ...>`]);
|
|
188
177
|
}
|
|
189
178
|
}
|
|
190
179
|
if (!groupConfig.children) {
|
|
@@ -197,26 +186,26 @@ function assembleColumn(_vm) {
|
|
|
197
186
|
}
|
|
198
187
|
// 销毁列
|
|
199
188
|
function destroyColumn(_vm) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
189
|
+
const {
|
|
190
|
+
$xetable,
|
|
191
|
+
columnConfig
|
|
192
|
+
} = _vm;
|
|
193
|
+
const matchObj = _xeUtils.default.findTree($xetable.staticColumns, column => column === columnConfig);
|
|
205
194
|
if (matchObj) {
|
|
206
195
|
matchObj.items.splice(matchObj.index, 1);
|
|
207
196
|
}
|
|
208
197
|
}
|
|
209
198
|
function getRootColumn($xetable, column) {
|
|
210
|
-
|
|
199
|
+
const fullColumnIdData = $xetable.fullColumnIdData;
|
|
211
200
|
if (!column) {
|
|
212
201
|
return null;
|
|
213
202
|
}
|
|
214
|
-
|
|
203
|
+
let parentColId = column.parentId;
|
|
215
204
|
while (fullColumnIdData[parentColId]) {
|
|
216
|
-
|
|
217
|
-
parentColId =
|
|
205
|
+
const column = fullColumnIdData[parentColId].column;
|
|
206
|
+
parentColId = column.parentId;
|
|
218
207
|
if (!parentColId) {
|
|
219
|
-
return
|
|
208
|
+
return column;
|
|
220
209
|
}
|
|
221
210
|
}
|
|
222
211
|
return column;
|
|
@@ -226,17 +215,18 @@ function queryCellElement(cell, selector) {
|
|
|
226
215
|
}
|
|
227
216
|
function toFilters(filters) {
|
|
228
217
|
if (filters && _xeUtils.default.isArray(filters)) {
|
|
229
|
-
return filters.map(
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
218
|
+
return filters.map(({
|
|
219
|
+
label,
|
|
220
|
+
value,
|
|
221
|
+
data,
|
|
222
|
+
resetValue,
|
|
223
|
+
checked
|
|
224
|
+
}) => {
|
|
235
225
|
return {
|
|
236
|
-
label
|
|
237
|
-
value
|
|
238
|
-
data
|
|
239
|
-
resetValue
|
|
226
|
+
label,
|
|
227
|
+
value,
|
|
228
|
+
data,
|
|
229
|
+
resetValue,
|
|
240
230
|
checked: !!checked,
|
|
241
231
|
_checked: !!checked
|
|
242
232
|
};
|
|
@@ -245,48 +235,58 @@ function toFilters(filters) {
|
|
|
245
235
|
return filters;
|
|
246
236
|
}
|
|
247
237
|
function getColReMinWidth(params) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
238
|
+
const {
|
|
239
|
+
$table,
|
|
240
|
+
column,
|
|
241
|
+
cell
|
|
242
|
+
} = params;
|
|
243
|
+
const {
|
|
244
|
+
showHeaderOverflow: allColumnHeaderOverflow,
|
|
245
|
+
resizableOpts
|
|
246
|
+
} = $table;
|
|
247
|
+
const {
|
|
248
|
+
minWidth
|
|
249
|
+
} = resizableOpts;
|
|
254
250
|
// 如果自定义调整宽度逻辑
|
|
255
251
|
if (minWidth) {
|
|
256
|
-
|
|
252
|
+
const customMinWidth = _xeUtils.default.isFunction(minWidth) ? minWidth(params) : minWidth;
|
|
257
253
|
if (customMinWidth !== 'auto') {
|
|
258
254
|
return Math.max(1, _xeUtils.default.toNumber(customMinWidth));
|
|
259
255
|
}
|
|
260
256
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
257
|
+
const {
|
|
258
|
+
showHeaderOverflow,
|
|
259
|
+
minWidth: colMinWidth
|
|
260
|
+
} = column;
|
|
261
|
+
const headOverflow = _xeUtils.default.isUndefined(showHeaderOverflow) || _xeUtils.default.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
262
|
+
const showEllipsis = headOverflow === 'ellipsis';
|
|
263
|
+
const showTitle = headOverflow === 'title';
|
|
264
|
+
const showTooltip = headOverflow === true || headOverflow === 'tooltip';
|
|
265
|
+
const hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
266
|
+
const minTitleWidth = _xeUtils.default.floor((_xeUtils.default.toNumber(getComputedStyle(cell).fontSize) || 14) * 1.6);
|
|
267
|
+
const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryCellElement(cell, ''));
|
|
268
|
+
let mWidth = minTitleWidth + paddingLeftRight;
|
|
271
269
|
// 默认最小宽处理
|
|
272
270
|
if (hasEllipsis) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
271
|
+
const checkboxIconWidth = getPaddingLeftRightSize(queryCellElement(cell, '--title>.vxe-cell--checkbox'));
|
|
272
|
+
const requiredIconWidth = getElemenMarginWidth(queryCellElement(cell, '>.vxe-cell--required-icon'));
|
|
273
|
+
const editIconWidth = getElemenMarginWidth(queryCellElement(cell, '>.vxe-cell--edit-icon'));
|
|
274
|
+
const prefixIconWidth = getElemenMarginWidth(queryCellElement(cell, '>.vxe-cell-title-prefix-icon'));
|
|
275
|
+
const suffixIconWidth = getElemenMarginWidth(queryCellElement(cell, '>.vxe-cell-title-suffix-icon'));
|
|
276
|
+
const sortIconWidth = getElemenMarginWidth(queryCellElement(cell, '>.vxe-cell--sort'));
|
|
277
|
+
const filterIconWidth = getElemenMarginWidth(queryCellElement(cell, '>.vxe-cell--filter'));
|
|
280
278
|
mWidth += checkboxIconWidth + requiredIconWidth + editIconWidth + prefixIconWidth + suffixIconWidth + filterIconWidth + sortIconWidth;
|
|
281
279
|
}
|
|
282
280
|
// 如果设置最小宽
|
|
283
281
|
if (colMinWidth) {
|
|
284
|
-
|
|
285
|
-
|
|
282
|
+
const {
|
|
283
|
+
tableBody
|
|
284
|
+
} = $table.$refs;
|
|
285
|
+
const bodyElem = tableBody ? tableBody.$el : null;
|
|
286
286
|
if (bodyElem) {
|
|
287
287
|
if ((0, _dom.isScale)(colMinWidth)) {
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
const bodyWidth = bodyElem.clientWidth - 1;
|
|
289
|
+
const meanWidth = bodyWidth / 100;
|
|
290
290
|
return Math.max(mWidth, Math.floor(_xeUtils.default.toInteger(colMinWidth) * meanWidth));
|
|
291
291
|
} else if ((0, _dom.isPx)(colMinWidth)) {
|
|
292
292
|
return Math.max(mWidth, _xeUtils.default.toInteger(colMinWidth));
|
|
@@ -296,39 +296,47 @@ function getColReMinWidth(params) {
|
|
|
296
296
|
return mWidth;
|
|
297
297
|
}
|
|
298
298
|
function countTreeExpand(prevRow, params) {
|
|
299
|
-
|
|
299
|
+
let count = 1;
|
|
300
300
|
if (!prevRow) {
|
|
301
301
|
return count;
|
|
302
302
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
303
|
+
const {
|
|
304
|
+
$table
|
|
305
|
+
} = params;
|
|
306
|
+
const {
|
|
307
|
+
treeOpts
|
|
308
|
+
} = $table;
|
|
309
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
310
|
+
const rowChildren = prevRow[childrenField];
|
|
307
311
|
if (rowChildren && $table.isTreeExpandByRow(prevRow)) {
|
|
308
|
-
for (
|
|
312
|
+
for (let index = 0; index < rowChildren.length; index++) {
|
|
309
313
|
count += countTreeExpand(rowChildren[index], params);
|
|
310
314
|
}
|
|
311
315
|
}
|
|
312
316
|
return count;
|
|
313
317
|
}
|
|
314
318
|
function getOffsetSize($xetable) {
|
|
315
|
-
|
|
319
|
+
const vSize = $xetable.computeSize;
|
|
320
|
+
return lineOffsetSizes[vSize] || 0;
|
|
316
321
|
}
|
|
317
322
|
function calcTreeLine(params, items, rIndex) {
|
|
318
|
-
|
|
319
|
-
|
|
323
|
+
const {
|
|
324
|
+
$table
|
|
325
|
+
} = params;
|
|
326
|
+
let expandSize = 1;
|
|
320
327
|
if (rIndex) {
|
|
321
328
|
expandSize = countTreeExpand(items[rIndex - 1], params);
|
|
322
329
|
}
|
|
323
330
|
return $table.rowHeight * expandSize - (rIndex ? 1 : 12 - getOffsetSize($table));
|
|
324
331
|
}
|
|
325
332
|
function mergeBodyMethod(mergeList, _rowIndex, _columnIndex) {
|
|
326
|
-
for (
|
|
327
|
-
|
|
328
|
-
mergeRowIndex
|
|
329
|
-
mergeColIndex
|
|
330
|
-
mergeRowspan
|
|
331
|
-
mergeColspan
|
|
333
|
+
for (let mIndex = 0; mIndex < mergeList.length; mIndex++) {
|
|
334
|
+
const {
|
|
335
|
+
row: mergeRowIndex,
|
|
336
|
+
col: mergeColIndex,
|
|
337
|
+
rowspan: mergeRowspan,
|
|
338
|
+
colspan: mergeColspan
|
|
339
|
+
} = mergeList[mIndex];
|
|
332
340
|
if (mergeColIndex > -1 && mergeRowIndex > -1 && mergeRowspan && mergeColspan) {
|
|
333
341
|
if (mergeRowIndex === _rowIndex && mergeColIndex === _columnIndex) {
|
|
334
342
|
return {
|
|
@@ -388,15 +396,17 @@ function createColumn($xeTable, options, renderOptions) {
|
|
|
388
396
|
return isColumnInfo(options) ? options : new _columnInfo.ColumnInfo($xeTable, options, renderOptions);
|
|
389
397
|
}
|
|
390
398
|
function rowToVisible($xetable, row) {
|
|
391
|
-
|
|
392
|
-
|
|
399
|
+
const {
|
|
400
|
+
tableBody
|
|
401
|
+
} = $xetable.$refs;
|
|
402
|
+
const bodyElem = tableBody ? tableBody.$el : null;
|
|
393
403
|
if (bodyElem) {
|
|
394
|
-
|
|
404
|
+
const trElem = bodyElem.querySelector(`[rowid="${getRowid($xetable, row)}"]`);
|
|
395
405
|
if (trElem) {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
406
|
+
const bodyHeight = bodyElem.clientHeight;
|
|
407
|
+
const bodySrcollTop = bodyElem.scrollTop;
|
|
408
|
+
const trOffsetTop = trElem.offsetTop + (trElem.offsetParent ? trElem.offsetParent.offsetTop : 0);
|
|
409
|
+
const trHeight = trElem.clientHeight;
|
|
400
410
|
// 检测行是否在可视区中
|
|
401
411
|
if (trOffsetTop < bodySrcollTop || trOffsetTop > bodySrcollTop + bodyHeight) {
|
|
402
412
|
// 向上定位
|
|
@@ -415,15 +425,17 @@ function rowToVisible($xetable, row) {
|
|
|
415
425
|
return Promise.resolve();
|
|
416
426
|
}
|
|
417
427
|
function colToVisible($xetable, column) {
|
|
418
|
-
|
|
419
|
-
|
|
428
|
+
const {
|
|
429
|
+
tableBody
|
|
430
|
+
} = $xetable.$refs;
|
|
431
|
+
const bodyElem = tableBody ? tableBody.$el : null;
|
|
420
432
|
if (bodyElem) {
|
|
421
|
-
|
|
433
|
+
const tdElem = bodyElem.querySelector(`.${column.id}`);
|
|
422
434
|
if (tdElem) {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
435
|
+
const bodyWidth = bodyElem.clientWidth;
|
|
436
|
+
const bodySrcollLeft = bodyElem.scrollLeft;
|
|
437
|
+
const tdOffsetLeft = tdElem.offsetLeft + (tdElem.offsetParent ? tdElem.offsetParent.offsetLeft : 0);
|
|
438
|
+
const tdWidth = tdElem.clientWidth;
|
|
427
439
|
// 检测行是否在可视区中
|
|
428
440
|
if (tdOffsetLeft < bodySrcollLeft || tdOffsetLeft > bodySrcollLeft + bodyWidth) {
|
|
429
441
|
// 向左定位
|
|
@@ -435,9 +447,9 @@ function colToVisible($xetable, column) {
|
|
|
435
447
|
} else {
|
|
436
448
|
// 如果是虚拟渲染跨行滚动
|
|
437
449
|
if ($xetable.scrollXLoad) {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
for (
|
|
450
|
+
const visibleColumn = $xetable.visibleColumn;
|
|
451
|
+
let scrollLeft = 0;
|
|
452
|
+
for (let index = 0; index < visibleColumn.length; index++) {
|
|
441
453
|
if (visibleColumn[index] === column) {
|
|
442
454
|
break;
|
|
443
455
|
}
|