UNPKG

@livelybone/vue-table

Version:

A vue table component, support width change

10 lines (8 loc) 21.5 kB
/** * Bundle of @livelybone/vue-table * Generated: 2019-08-04 * Version: 3.0.0 * License: MIT * Author: 2631541504@qq.com */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).VueTable={})}(this,function(t){"use strict";var e=function(t,e,n,i,r,o,s,a,c,l){"boolean"!=typeof s&&(c=a,a=s,s=!1);var d,h="function"==typeof n?n.options:n;if(t&&t.render&&(h.render=t.render,h.staticRenderFns=t.staticRenderFns,h._compiled=!0,r&&(h.functional=!0)),i&&(h._scopeId=i),o?(d=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,c(t)),t&&t._registeredComponents&&t._registeredComponents.add(o)},h._ssrRegister=d):e&&(d=s?function(){e.call(this,l(this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),d)if(h.functional){var u=h.render;h.render=function(t,e){return d.call(e),u(t,e)}}else{var f=h.beforeCreate;h.beforeCreate=f?[].concat(f,d):[d]}return n},n=e({render:function(){var r=this,t=r.$createElement,o=r._self._c||t;return o("table",{staticClass:"vue-table table-base"},[r.noHead?r._e():o("thead",{staticClass:"thead"},[o("tr",{staticClass:"tr",style:r.headTrStyle},r._l(r.heads,function(t,e){return o("th",{key:e,staticClass:"th",style:t.style,on:{click:function(t){return r.$emit("clickTh",{ev:t,th:e})}}},[r._v("\n "+r._s(t.headformatter?t.headFormatter(t.title):t.title)+"\n "),r._t("th-"+e)],2)}),0)]),r._v(" "),r.data&&0<r.data.length?o("tbody",{staticClass:"tbody",style:{maxHeight:"30vh"}},r._l(r.data,function(n,i){return o("tr",{key:i,staticClass:"tr",style:Object.assign({},r.trStyle,i%2==1?r.evenTrStyle:{}),on:{click:function(t){return r.$emit("clickTr",{ev:t,tr:i})}}},r._l(r.heads,function(t,e){return o("td",{key:e,staticClass:"td",style:t.tdStyle||t.style,on:{click:function(t){return r.$emit("clickTd",{ev:t,tr:i,td:e})}}},[o("div",{staticClass:"td-value",domProps:{innerHTML:r._s(t.formatter?t.formatter(n,t.key):n[t.key])}}),r._v(" "),r._t("td-"+i+"-"+e)],2)}),0)}),0):r._e()])},staticRenderFns:[]},void 0,{name:"TableBase",props:{heads:{default:function(){return[]},type:[Array,Object]},data:{default:function(){return[]},type:[Array,Object]},headTrStyle:Object,trStyle:Object,evenTrStyle:Object,noHead:Boolean}},void 0,!1,void 0,void 0,void 0);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function o(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var r=d,s=d,a=d,c=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,l=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function d(t){var e=(t=t||{}).ua;return e||"undefined"==typeof navigator||(e=navigator.userAgent),e&&e.headers&&"string"==typeof e.headers["user-agent"]&&(e=e.headers["user-agent"]),"string"==typeof e&&(t.tablet?l.test(e):c.test(e))}function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function u(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?h(o,!0).forEach(function(t){var e,n,i;e=r,i=o[n=t],n in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):h(o).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(o,t))})}return r}function f(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],i=!0,r=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(i=(s=a.next()).done)&&(n.push(s.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{i||null==a.return||a.return()}finally{if(r)throw o}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}r.isMobile=s,r.default=a,"undefined"!=typeof window&&"undefined"!=typeof document&&(window.addEventListener,"onwheel"in document.createElement("div")||window.onmousewheel);var p="",m="addEventListener",v="removeEventListener";function b(t,e,n,i){var r=p+e;return t[m].bind(t)(r,n,i),function(){t[v].bind(t)(r,n,i)}}"undefined"!=typeof window&&"undefined"!=typeof document&&(window.addEventListener?(m="addEventListener",v="removeEventListener"):(m="attachEvent",v="detachEvent",p="on"));var y=s(),g=Object.freeze({$addListener:b,$isMobile:y}),w=y?"mobile":"pc",_={start:{pc:"mousedown",mobile:"touchstart"}[w],move:{pc:"mousemove",mobile:"touchmove"}[w],end:{pc:"mouseup",mobile:"touchend"}[w]};function x(t){var e=null;if(y)if(0<t.changedTouches.length)e=f(t.changedTouches,1)[0];else if(0<t.targetTouched.length){e=f(t.changedTouches,1)[0]}else{e=f(t.touches,1)[0]}return e||t}function S(t,e){return{deltaX:x(t).clientX-x(e).clientX,deltaY:x(t).clientY-x(e).clientY,originalEvent:t}}var T=Object.freeze({bind:function(t,o,s){var a,c;return"function"==typeof t&&(s=o,o=t,t=window),b(t,_.start,function t(e){var n={deltaX:0,deltaY:0,originalEvent:e,type:"dragMoveStart"};if(e.type===_.start){a=e;var i=b(window,_.move,t,s),r=b(window,_.end,t,s);c=function(){i(),r()}}else e.type===_.move?n=u({},S(e,a),{type:"dragMove"}):e.type===_.end&&(n=u({},S(e,a),{type:"dragMoveEnd"}),c&&c());o(n)},s)}});function $(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}var C={x:{posPropName:"left",parentScrollPos:"scrollLeft",deltaName:"deltaX",sizeName:"width"},y:{posPropName:"top",parentScrollPos:"scrollTop",deltaName:"deltaY",sizeName:"height"}},W={opacity:1,pointerEvents:"initial"};var P=function(t,e,n,i,r,o,s,a,c,l){"boolean"!=typeof s&&(c=a,a=s,s=!1);var d,h="function"==typeof n?n.options:n;if(t&&t.render&&(h.render=t.render,h.staticRenderFns=t.staticRenderFns,h._compiled=!0,r&&(h.functional=!0)),i&&(h._scopeId=i),o?(d=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,c(t)),t&&t._registeredComponents&&t._registeredComponents.add(o)},h._ssrRegister=d):e&&(d=s?function(){e.call(this,l(this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),d)if(h.functional){var u=h.render;h.render=function(t,e){return d.call(e),u(t,e)}}else{var f=h.beforeCreate;h.beforeCreate=f?[].concat(f,d):[d]}return n},j=P({render:function(){var n=this,t=n.$createElement,i=n._self._c||t;return i("div",{ref:"wrap",staticClass:"scrollbar-wrap",style:n.$_wrapStyle,on:{click:function(t){return n.$emit("wrapClick",t)}}},[i("div",{ref:"content",staticClass:"scrollbar-content",style:n.$_contentStyle},[n._t("default")],2),n._v(" "),!n.isMobile&&n.width.wrap&&n.height.wrap?n._l(n.scrollbars,function(t,e){return i("Bar",{key:e,attrs:{type:e,marginToWrap:n.marginToWrap,parentScroll:n.scrollPos[t.scrollPropName],clientSize:t.size.wrap,scrollSize:t.size.content},on:{scrollTo:function(t){return n.setScroll(t,"drag")}}})}):n._e()],2)},staticRenderFns:[]},void 0,{name:"Scrollbar",components:{Bar:P({render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{directives:[{name:"show",rawName:"v-show",value:t.$_show,expression:"$_show"}],ref:"bar",staticClass:"scrollbar",class:"scrollbar-"+t.type,style:t.$_barStyle,attrs:{draggable:!1}})},staticRenderFns:[]},void 0,{name:"Bar",props:{type:String,parentScroll:Number,marginToWrap:{type:Number,default:5},clientSize:Number,scrollSize:Number},data:function(){return{sPosition:0,showBar:!1,unbind:null,startPosition:0}},computed:{$_show:function(){return this.scrollSize>this.clientSize},$_scrollbarType:function(){return C[this.type]},size:function(){return this.clientSize/this.scrollSize*this.clientSize-2*this.marginToWrap},positionRange:function(){return{min:this.marginToWrap,max:this.clientSize-this.marginToWrap-this.size}},$_barStyle:function(){var t;return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(n,!0).forEach(function(t){$(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},this.showBar?W:{},($(t={},this.$_scrollbarType.posPropName,"".concat(this.sPosition,"px !important")),$(t,this.$_scrollbarType.sizeName,"".concat(this.size,"px !important")),$(t,"userSelect","none"),t))}},watch:{$_show:{handler:function(t){var e=this;setTimeout(function(){e.unbind&&e.unbind(),t&&"undefined"!=typeof window&&(e.unbind=T.bind(e.$refs.bar,e.drag))},200)},immediate:!0},parentScroll:{handler:function(t){this.sPosition=(this.positionRange.max-this.positionRange.min)/(this.scrollSize-this.clientSize)*t+this.positionRange.min},immediate:!0}},methods:{drag:function(t){t.originalEvent.preventDefault(),"dragMoveStart"===t.type&&(this.startPosition=this.sPosition);var e=Math.min(this.positionRange.max,Math.max(this.positionRange.min,this.startPosition+t[this.$_scrollbarType.deltaName]));this.$emit("scrollTo",$({},this.$_scrollbarType.parentScrollPos,(e-this.marginToWrap)/(this.positionRange.max-this.marginToWrap)*(this.scrollSize-this.clientSize))),this.showBar="dragMoveEnd"!==t.type}},beforeDestroy:function(){this.unbind&&this.unbind()}},void 0,!1,void 0,void 0,void 0)},props:{isMobile:Boolean,maxHeight:[Number,String],scrollTo:[Number,Object],marginToWrap:{default:5,type:Number}},data:function(){return{width:{wrap:0,content:0},height:{wrap:0,content:0},scrollPos:{scrollLeft:0,scrollTop:0},isTop:!0,isBottom:!0,isLeft:!0,isRight:!0,nativeScrollbarWidth:{x:0,y:0}}},computed:{scrollbars:function(){return{x:{scrollPropName:"scrollLeft",size:this.width},y:{scrollPropName:"scrollTop",size:this.height}}},$_maxHeight:function(){return"number"==typeof this.maxHeight?"".concat(this.maxHeight,"px"):this.maxHeight},$_wrapStyle:function(){return{position:"relative",height:this.isMobile?"auto !important":"".concat(this.height.wrap,"px !important"),maxHeight:"".concat(this.$_maxHeight," !important"),padding:"0 !important",overflow:"hidden !important"}},$_contentStyle:function(){if(this.isMobile)return{maxHeight:this.$_maxHeight,overflow:"scroll"};var t=this.nativeScrollbarWidth,e=t.x,n=t.y;return{width:"calc(100% + ".concat(n,"px) !important"),maxHeight:"calc(".concat(this.$_maxHeight," + ").concat(e,"px) !important"),overflow:"scroll"}},maxScroll:function(){return{scrollLeft:this.width.content-this.width.wrap,scrollTop:this.height.content-this.height.wrap}}},watch:{scrollTo:{handler:function(e){var n=this;this.$nextTick(function(){if(e){var t={scrollLeft:0,scrollTop:0};e.x||e.y?(t.scrollLeft=+e.x*n.maxScroll.scrollLeft,t.scrollTop=+e.y*n.maxScroll.scrollTop):(t.scrollLeft=+e*n.maxScroll.scrollLeft,t.scrollTop=+e*n.maxScroll.scrollTop),n.setScroll(t,"drag")}})},immediate:!0},isBottom:function(t){t&&this.$emit("reachBottom")},isTop:function(t){t&&this.$emit("reachTop")},isLeft:function(t){t&&this.$emit("reachLeft")},isRight:function(t){t&&this.$emit("reachRight")}},methods:{getHeight:function(){function t(){if(o.$refs.content){var t=o.$refs.content,e=t.scrollHeight,n=t.clientHeight,i=t.scrollWidth,r=t.clientWidth;o.height.wrap=n,o.height.content=e,o.width.wrap=r,o.width.content=i}}var o=this;t(),this.$on("hook:updated",t)},scroll:function(){var t=this.$refs.content,e=t.scrollTop,n=t.scrollLeft;this.setScroll({scrollTop:e,scrollLeft:n})},setScroll:function(t,e){var n=t.scrollTop,i=void 0===n?void 0:n,r=t.scrollLeft,o=void 0===r?void 0:r,s="scroll"!==(1<arguments.length&&void 0!==e?e:"scroll");void 0!==i&&this.setPos(i,"scrollTop",s),void 0!==o&&this.setPos(o,"scrollLeft",s),this.judgeOnBoundary()},setPos:function(t,e,n){this.scrollPos[e]=t,n&&(this.$refs.content[e]=t)},judgeOnBoundary:function(){this.isTop=0===this.scrollPos.scrollTop,this.isBottom=this.scrollPos.scrollTop===this.maxScroll.scrollTop,this.isLeft=0===this.scrollPos.scrollLeft,this.isRight=this.scrollPos.scrollLeft===this.maxScroll.scrollLeft},bind:function(){this.$once("hook:beforeDestroy",g.$addListener(this.$refs.content,"scroll",this.scroll))},insertStyle:function(){var t="vue-scrollbar-live-module-style";if(!document.getElementById(t)){var e=document.createElement("style");e.id=t,e.innerText=".scrollbar-wrap .scrollbar-content::-webkit-scrollbar{width:0;height:0;}.scrollbar-wrap .scrollbar-content{-ms-overflow-style:none;scrollbar-width:none;}.scrollbar-wrap .scrollbar{position:absolute;border-radius:.25em;background:#eee;box-shadow:0 0 2px rgba(0,0,0,0.1);opacity:0;pointer-events:none}.scrollbar-wrap .scrollbar-y{right:0.25em;width:.5em}.scrollbar-wrap .scrollbar-x{bottom:0.25em;height:.5em}.scrollbar-wrap:hover .scrollbar{opacity:1;pointer-events:initial}",document.head.appendChild(e)}}},created:function(){var t=this;this.isMobile||"undefined"==typeof window||(this.insertStyle(),this.$once("hook:mounted",function(){t.nativeScrollbarWidth=function(t){var e=(t=t||window)===window;try{var n=e?window.nativeScrollbarWidth:null;if(!n||"number"!=typeof n.y||"number"!=typeof n.x){var i=e?document.createElement("div"):t;e&&(i.setAttribute("style","position:fixed;top:0;left:0;opacity:0;pointer-events:none;width:200px;height:200px;overflow:scroll"),document.body.appendChild(i)),n={y:i.offsetWidth-i.clientWidth,x:i.offsetHeight-i.clientHeight},e&&(window.nativeScrollbarWidth=n,document.body.removeChild(i))}return n}catch(t){return{y:17,x:17}}}(t.$refs.content),t.getHeight(),t.bind()}))}},void 0,!1,void 0,void 0,void 0),k=function(t){return t.getBoundingClientRect()};function E(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce(function(t,e){return function(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?i(o,!0).forEach(function(t){var e,n,i;e=r,i=o[n=t],n in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):i(o).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(o,t))})}return r}({},t,{},e)},{})}var z={components:{Item:e({render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",t._g({ref:"item"},t.$listeners),[t._t("default")],2)},staticRenderFns:[]},void 0,{name:"Item",mounted:function(){this.widthChange(k(this.$refs.item))},updated:function(){this.widthChange(k(this.$refs.item))},data:function(){return{oldWidth:-1}},methods:{widthChange:function(t){var e=t.width;e!==this.oldWidth&&(this.oldWidth=e,this.$emit("contentWidthChange",e))}}},void 0,!1,void 0,void 0,void 0)},props:{heads:Array,widths:Array},data:function(){return{contentWidths:[]}},methods:{contentChange:function(t,e){var n=this;this.$set(this.contentWidths,e,t),this.heads.every(function(t,e){return void 0!==n.contentWidths[e]})&&this.$emit("contentWidthChange",this.contentWidths)},assign:E,cWidth:function(t){var e=this.widths[t];return e?"number"==typeof e?"".concat(e,"px"):e:"auto"}}},L=e({render:function(){var i=this,t=i.$createElement,e=i._self._c||t;return e("div",{ref:"table",staticClass:"vue-table table-extend",style:{width:i.tableChangedWidth?i.tableChangedWidth+"px":""}},[i.noHead?i._e():e("div",{staticClass:"thead"},[e("th-row",{staticClass:"tr",style:i.headTrStyle,attrs:{widths:i.widths,heads:i.heads},on:{clickTh:function(t){return i.$emit("clickTh",t)},widthChange:i.widthChange,contentWidthChange:function(t){return i.contentWidthChange(t,0)}}},[i._l(i.heads,function(t,e){return i._t("th-"+e,null,{slot:"th-"+e})})],2)],1),i._v(" "),i.data&&0<i.data.length?e("vue-scrollbar",{staticClass:"tbody",attrs:{isMobile:i.scrollbarProps.isMobile,maxHeight:i.scrollbarProps.maxHeight||"1000vh",marginToWrap:i.scrollbarProps.marginToWrap||2}},i._l(i.data,function(t,n){return e("td-row",{key:n,staticClass:"tr",style:i.assign(i.trStyle,n%2==1?i.evenTrStyle:{}),attrs:{heads:i.heads,item:t,widths:i.widths},on:{click:function(t){return i.$emit("clickTr",{ev:t,tr:n})},clickTd:function(t){i.$emit("clickTd",i.assign(t,{tr:n}))},contentWidthChange:function(t){return i.contentWidthChange(t,n+1)}}},[i._l(i.heads,function(t,e){return i._t("td-"+n+"-"+e,null,{slot:"td-"+e})})],2)}),1):i._e()],1)},staticRenderFns:[]},void 0,{name:"TableBase",components:{VueScrollbar:j,TdRow:e({render:function(){var n=this,t=n.$createElement,i=n._self._c||t;return i("div",n._g({ref:"row",staticClass:"row"},n.$listeners),n._l(n.heads,function(t,e){return i("item",{key:e,staticClass:"td",style:n.assign(t.tdStyle||t.style,{width:n.cWidth(e)}),on:{click:function(t){return n.$emit("clickTd",{ev:t,td:e})},contentWidthChange:function(t){return n.contentChange(t,e)}}},[i("div",{staticClass:"td-value",domProps:{innerHTML:n._s(t.formatter?t.formatter(n.item,t.key):n.item[t.key])}}),n._v(" "),n._t("td-"+e)],2)}),1)},staticRenderFns:[]},void 0,{name:"Row",mixins:[z],props:{item:Object},data:function(){return{}},methods:{}},void 0,!1,void 0,void 0,void 0),ThRow:e({render:function(){var n=this,t=n.$createElement,i=n._self._c||t;return i("div",n._g({ref:"row",staticClass:"row",attrs:{draggable:!1}},n.$listeners),n._l(n.heads,function(t,e){return i("item",{key:e,staticClass:"th",style:n.assign(t.style,{width:n.cWidth(e)}),on:{click:function(t){return n.$emit("clickTh",{ev:t,th:e})},contentWidthChange:function(t){return n.contentChange(t,e)}}},[n._v("\n "+n._s(t.headformatter?t.headFormatter(t.title):t.title)+"\n "),n._t("th-"+e),n._v(" "),i("div",{staticClass:"column-resize",attrs:{draggable:!1},on:{mousedown:function(t){return n.down(t,e)},click:function(t){t.stopPropagation()}}})],2)}),1)},staticRenderFns:[]},void 0,{name:"Row",mixins:[z],data:function(){return{start:null}},methods:{down:function(t,e){this.start={x:t.pageX,index:e}},clear:function(){this.start=null},resize:function(t){if(this.start){var e=t.pageX-this.start.x;this.$emit("widthChange",{value:e,index:this.start.index}),this.start.x=t.pageX}}},mounted:function(){window.addEventListener("mousemove",this.resize),window.addEventListener("mouseup",this.clear)},beforeDestroy:function(){window.removeEventListener("mousemove",this.resize),window.removeEventListener("mouseup",this.clear)}},void 0,!1,void 0,void 0,void 0)},props:{heads:{default:function(){return[]},type:[Array,Object]},data:{default:function(){return[]},type:[Array,Object]},headTrStyle:Object,trStyle:Object,evenTrStyle:Object,noHead:Boolean,scrollbarProps:{default:function(){return{}},type:Object}},data:function(){return{tableSize:{},contentWidths:[],tableChangedWidth:0,fixedWidth:[]}},computed:{widths:function(){var i=this;if(this.contentWidthsInvalid())return[];var t=this.tableSize.clientWidth,e=this.heads.map(function(t,e){return Math.max.apply(Math,o(i.contentWidths.map(function(t){return t[e]})).concat([0]))}),n=e.reduce(function(t,e,n){return i.fixedWidth[n]?t:t+e},0),r=t-this.fixedWidth.reduce(function(t,e){return t+e},0);return e.map(function(t,e){return i.fixedWidth[e]||t/n*r})}},watch:{heads:{handler:function(){this.initFixedWidth()},immediate:!0}},methods:{initFixedWidth:function(){var n=this;this.heads&&(this.fixedWidth=this.heads.map(function(t,e){return n.fixedWidth[e]||t.width||0}))},contentWidthsInvalid:function(){var n=this;return[1].concat(o(this.data||[])).some(function(t,e){return!n.contentWidths[e]})},sizeChange:function(){var t=this.$refs.table||{},e=t.clientHeight,n=void 0===e?0:e,i=t.clientWidth,r=void 0===i?0:i;this.$set(this.tableSize,"clientHeight",n),this.$set(this.tableSize,"clientWidth",r)},assign:E,contentWidthChange:function(t,e){this.$set(this.contentWidths,e,t)},widthChange:function(t){var e=t.value,n=t.index,i=this.widths[n]+e;60<i&&(this.$set(this.fixedWidth,n,i),this.tableSize.clientWidth=this.tableSize.clientWidth+e,this.tableChangedWidth=this.tableSize.clientWidth)}},mounted:function(){this.sizeChange(),window.addEventListener("resize",this.sizeChange)},updated:function(){this.sizeChange()},beforeDestroy:function(){window.removeEventListener("resize",this.sizeChange)}},void 0,!1,void 0,void 0,void 0);t.TableBase=n,t.TableExtend=L,Object.defineProperty(t,"__esModule",{value:!0})});