ex-table-column
Version:
Extended to element table column, supports column width to be automatically adjusted according to content, supports all attributes of el-table-column, compatible el-table-column.
2 lines • 3.23 kB
JavaScript
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("element-ui"),require("vue")):"function"===typeof define&&define.amd?define(["element-ui"],e):"object"===typeof exports?exports["ex-table-column"]=e(require("element-ui"),require("vue")):t["ex-table-column"]=e(t["element-ui"],t["Vue"])})("undefined"!==typeof self?self:this,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fb15")}({"5f72":function(e,n){e.exports=t},"8bbf":function(t,n){t.exports=e},f6fd:function(t,e){(function(t){var e="currentScript",n=t.getElementsByTagName("script");e in t||Object.defineProperty(t,e,{get:function(){try{throw new Error}catch(r){var t,e=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(r.stack)||[!1])[1];for(t in n)if(n[t].src==e||"interactive"==n[t].readyState)return n[t];return null}}})})(document)},fb15:function(t,e,n){"use strict";var r;(n.r(e),"undefined"!==typeof window)&&(n("f6fd"),(r=window.document.currentScript)&&(r=r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=r[1]));var o=n("5f72");n("8bbf");Object.prototype.hasOwnProperty;function u(t){return void 0!==t&&(t=parseInt(t,10),isNaN(t)&&(t=null)),t}function i(t){return"undefined"!==typeof t&&(t=u(t),isNaN(t)&&(t=80)),t}function c(t){return Math.max.apply(null,t.filter((function(t){return!isNaN(t)})))}function f(t,e){return Array.prototype.map.call(t,e)}function a(t){return 0===t.length}var l={name:"ExTableColumn",extends:o["TableColumn"],props:{fitByClass:{type:String,default:"cell"},autoFit:{type:Boolean,default:!1},fitGap:{type:Number,default:0},fitHeader:{type:Boolean,default:!1}},data:function(){return{autoWidth:0}},computed:{realMinWidth:function(){return this.autoFit?i(c([this.minWidth,this.autoWidth])):o["TableColumn"].computed.realMinWidth.call(this)}},methods:{updateAutoWidth:function(){if(this.autoFit){var t=this.fitHeader?".".concat(this.columnId):"td.".concat(this.columnId),e=window.document.querySelectorAll("".concat(t," .").concat(this.fitByClass));if(a(e)&&(e=window.document.querySelectorAll("".concat(t," .cell"))),!a(e)){var n=c(f(e,(function(t){return t.getBoundingClientRect().width})))+this.fitGap+1;this.autoWidth!==n&&(this.autoWidth=n)}}}},updated:function(){this.updateAutoWidth()},mounted:function(){this.$nextTick(this.updateAutoWidth)}};e["default"]=l}})}));
//# sourceMappingURL=ex-table-column.umd.min.js.map