You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

el-table-virtual-scroll

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

el-table-virtual-scroll - npm Package Compare versions

Comparing version
2.0.0
to
2.0.1
demo-v1/yarn.lock

Sorry, the diff of this file is too big to display

+114
<template>
<div>
<el-table
ref="table"
:data="list"
height="500"
row-key="id"
tooltip-effect="dark"
style="width: 100%"
:highlight-selection-row="highlight"
@select="onSelect"
@select-all="onSelectAll"
@selection-change="handleSelectionChange">
<!-- 多选 -->
<el-table-column width="60" type="selection" :selectable="getSelectable"></el-table-column>
<el-table-column
label="id"
prop="id"
width="120">
</el-table-column>
<el-table-column
label="count"
prop="count"
width="120">
</el-table-column>
<el-table-column
label="日期"
width="120">
<template slot-scope="scope">{{ scope.row.date }}</template>
</el-table-column>
<el-table-column
prop="name"
label="姓名"
width="120">
</el-table-column>
<el-table-column
prop="address"
label="地址"
show-overflow-tooltip>
</el-table-column>
<el-table-column label="操作" width="260">
<template slot-scope="{ row }">
<el-button @click="onDel(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 20px">
<el-button @click="toggleSelection([list[1], list[2]])">切换第二、第三行的选中状态</el-button>
<el-button @click="toggleSelection()">取消选择</el-button>
<el-button @click="toggleAllSelection()">toggleAllSelection</el-button>
<el-button @click="refresh()">刷新</el-button>
<el-button @click="show = !show">show</el-button>
<span style="margin-left: 10px;">选中高亮: <el-switch v-model="highlight"></el-switch></span>
</div>
</div>
</template>
<script>
import { mockData } from '@/utils'
export default {
components: {
},
data () {
return {
list: mockData(0, 20),
tableData: [],
multipleSelection: [],
show: true,
highlight: false
}
},
methods: {
refresh () {
this.list = mockData(0, 20)
},
getSelectable (row, idx) {
return idx > 2
},
toggleSelection (rows) {
if (rows) {
this.$refs.table.toggleRowSelection(rows)
} else {
this.$refs.table.clearSelection()
}
},
toggleAllSelection () {
this.$refs.table.toggleAllSelection()
},
handleSelectionChange (val) {
console.log('multipleSelection', val)
this.multipleSelection = val
},
onSelect (selection, row, checked) {
console.log('select:', selection, row, checked)
},
onSelectAll (selection, checked) {
console.log('select-all:', selection, checked)
},
onDel (row) {
const index = this.list.findIndex(item => item === row)
if (index > -1) {
this.list.splice(index, 1)
}
}
},
created () {
}
}
</script>
<style lang='less' scoped>
</style>

Sorry, the diff of this file is too big to display

var ElTableVirtualScroll=function(e,t,n,i){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(t);function l(){l=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function h(e,t,n,i){var o=t&&t.prototype instanceof b?t:b,l=Object.create(o.prototype),a=new D(i||[]);return r(l,"_invoke",{value:_(e,n,a)}),l}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var f="suspendedStart",v="suspendedYield",p="executing",g="completed",m={};function b(){}function y(){}function w(){}var x={};u(x,a,(function(){return this}));var S=Object.getPrototypeOf,T=S&&S(S(B([])));T&&T!==n&&i.call(T,a)&&(x=T);var A=w.prototype=b.prototype=Object.create(x);function E(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(r,o,l,a){var s=d(e[r],e,o);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==typeof u&&i.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,a)}),(function(e){n("throw",e,l,a)})):t.resolve(u).then((function(e){c.value=e,l(c)}),(function(e){return n("throw",e,l,a)}))}a(s.arg)}var o;r(this,"_invoke",{value:function(e,i){function r(){return new t((function(t,r){n(e,i,t,r)}))}return o=o?o.then(r,r):r()}})}function _(t,n,i){var r=f;return function(o,l){if(r===p)throw new Error("Generator is already running");if(r===g){if("throw"===o)throw l;return{value:e,done:!0}}for(i.method=o,i.arg=l;;){var a=i.delegate;if(a){var s=k(a,i);if(s){if(s===m)continue;return s}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===f)throw r=g,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=p;var c=d(t,n,i);if("normal"===c.type){if(r=i.done?g:v,c.arg===m)continue;return{value:c.arg,done:i.done}}"throw"===c.type&&(r=g,i.method="throw",i.arg=c.arg)}}}function k(t,n){var i=n.method,r=t.iterator[i];if(r===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,k(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),m;var o=d(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var l=o.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function $(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach($,this),this.reset(!0)}function B(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function n(){for(;++r<t.length;)if(i.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return y.prototype=w,r(A,"constructor",{value:w,configurable:!0}),r(w,"constructor",{value:y,configurable:!0}),y.displayName=u(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,u(e,c,"GeneratorFunction")),e.prototype=Object.create(A),e},t.awrap=function(e){return{__await:e}},E(C.prototype),u(C.prototype,s,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,i,r,o){void 0===o&&(o=Promise);var l=new C(h(e,n,i,r),o);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},E(A),u(A,c,"Generator"),u(A,a,(function(){return this})),u(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=B,D.prototype={constructor:D,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(R),!t)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(i,r){return a.type="throw",a.arg=t,n.next=i,r&&(n.method="next",n.arg=e),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var l=this.tryEntries[o],a=l.completion;if("root"===l.tryLoc)return r("end");if(l.tryLoc<=this.prev){var s=i.call(l,"catchLoc"),c=i.call(l,"finallyLoc");if(s&&c){if(this.prev<l.catchLoc)return r(l.catchLoc,!0);if(this.prev<l.finallyLoc)return r(l.finallyLoc)}else if(s){if(this.prev<l.catchLoc)return r(l.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return r(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var l=o?o.completion:{};return l.type=e,l.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),R(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;R(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:B(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),m}},t}function a(e){return a="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},a(e)}function s(e,t,n,i,r,o,l){try{var a=e[o](l),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(i,r)}function c(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var o=e.apply(t,n);function l(e){s(o,i,r,l,a,"next",e)}function a(e){s(o,i,r,l,a,"throw",e)}l(void 0)}))}}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,l,a=[],s=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(i=o.call(n)).done)&&(a.push(i.value),a.length!==t);s=!0);}catch(e){c=!0,r=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw r}}return a}}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){if(e){if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var v=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},g="object"==typeof p&&p&&p.Object===Object&&p,m="object"==typeof self&&self&&self.Object===Object&&self,b=g||m||Function("return this")(),y=function(){return b.Date.now()},w=/\s/;var x=function(e){for(var t=e.length;t--&&w.test(e.charAt(t)););return t},S=/^\s+/;var T=function(e){return e?e.slice(0,x(e)+1).replace(S,""):e},A=b.Symbol,E=Object.prototype,C=E.hasOwnProperty,_=E.toString,k=A?A.toStringTag:void 0;var $=function(e){var t=C.call(e,k),n=e[k];try{e[k]=void 0;var i=!0}catch(e){}var r=_.call(e);return i&&(t?e[k]=n:delete e[k]),r},R=Object.prototype.toString;var D=function(e){return R.call(e)},B=A?A.toStringTag:void 0;var N=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":B&&B in Object(e)?$(e):D(e)};var P=function(e){return null!=e&&"object"==typeof e};var O=function(e){return"symbol"==typeof e||P(e)&&"[object Symbol]"==N(e)},L=/^[-+]0x[0-9a-f]+$/i,F=/^0b[01]+$/i,j=/^0o[0-7]+$/i,I=parseInt;var M=function(e){if("number"==typeof e)return e;if(O(e))return NaN;if(v(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=v(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=T(e);var n=F.test(e);return n||j.test(e)?I(e.slice(2),n?2:8):L.test(e)?NaN:+e},z=Math.max,H=Math.min;var W=function(e,t,n){var i,r,o,l,a,s,c=0,u=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var n=i,o=r;return i=r=void 0,c=t,l=e.apply(o,n)}function p(e){var n=e-s;return void 0===s||n>=t||n<0||h&&e-c>=o}function g(){var e=y();if(p(e))return m(e);a=setTimeout(g,function(e){var n=t-(e-s);return h?H(n,o-(e-c)):n}(e))}function m(e){return a=void 0,d&&i?f(e):(i=r=void 0,l)}function b(){var e=y(),n=p(e);if(i=arguments,r=this,s=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(g,t),u?f(e):l}(s);if(h)return clearTimeout(a),a=setTimeout(g,t),f(s)}return void 0===a&&(a=setTimeout(g,t)),l}return t=M(t)||0,v(n)&&(u=!!n.leading,o=(h="maxWait"in n)?z(M(n.maxWait)||0,t):o,d="trailing"in n?!!n.trailing:d),b.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=s=r=a=void 0},b.flush=function(){return void 0===a?l:m(y())},b};var K=function(e,t,n){var i=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return v(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),W(e,t,{leading:i,maxWait:t,trailing:r})};function V(e){var t=window.getComputedStyle(e,null),n=["auto","scroll"];return n.includes(t.overflow)||n.includes(t["overflow-y"])}function Y(e){return e===window?window.pageYOffset:e.scrollTop}function U(e){return null==e}var q="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>-1;var G=function(e){return null!==e&&"object"===a(e)},X=function(e,t,i,r,o){if(!t&&!r&&(!o||Array.isArray(o)&&!o.length))return e;i="string"==typeof i?"descending"===i?-1:1:i&&i<0?-1:1;var l=r?null:function(i,r){return o?(Array.isArray(o)||(o=[o]),o.map((function(t){return"string"==typeof t?n.getValueByPath(i,t):t(i,r,e)}))):("$key"!==t&&G(i)&&"$value"in i&&(i=i.$value),[G(i)?n.getValueByPath(i,t):i])};return e.map((function(e,t){return{value:e,index:t,key:l?l(e,t):null}})).sort((function(e,t){var n=function(e,t){if(r)return r(e.value,t.value);for(var n=0,i=e.key.length;n<i;n++){if(e.key[n]<t.key[n])return-1;if(e.key[n]>t.key[n])return 1}return 0}(e,t);return n||(n=e.index-t.index),n*i})).map((function(e){return e.value}))},Q=[".el-table__body-wrapper",".el-table__fixed-right .el-table__fixed-body-wrapper",".el-table__fixed .el-table__fixed-body-wrapper"],Z={name:"el-table-virtual-scroll",props:{data:{type:Array,required:!0},itemSize:{type:Number,default:60},scrollBox:{type:String},buffer:{type:Number,default:200},keyProp:{type:String,default:"id"},throttleTime:{type:Number,default:16},dynamic:{type:Boolean,default:!0},virtualized:{type:Boolean,default:!0},rowSpanKey:{type:Function},warn:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},selectionSort:{type:[Function,Boolean],default:!0},getElTable:{type:Function,default:function(){return this.$children[0]}},keepScroll:{type:Boolean,default:!0}},provide:function(){return{virtualScroll:this}},data:function(){return{sizes:{},start:0,end:void 0,curRow:null,oldSelection:[],isExpanding:!1,columnVms:[],isHideAppend:!1,scrollPosition:"",hasFixedRight:!1,listData:[],isTree:!1}},computed:{offsetMap:function(e){var t=e.keyProp,n=e.itemSize,i=e.sizes,r=e.listData;if(!this.dynamic)return{};for(var o={},l=0,a=0;a<r.length;a++){var s=r[a][t];void 0===s&&this.warn&&console.warn("data[".concat(a,"][").concat(t,"] 为 undefined,请确保 keyProp 对应的值不为undefined")),o[s]=l;var c=i[s];l+="number"==typeof c?c:n}return o},treeMap:function(e){var t=e.data,n=e.keyProp,i=e.treeProps;if(e.isTree&&i){var r={},o=i.children;return function e(t){t.forEach((function(t){var i=t[n];void 0!==i&&t[o]&&(r[i]=t[o],e(t[o]))}))}(t),r}}},methods:{initData:function(){var e=this;if(this.destory(),this.renderData=[],this.top=void 0,this.bottom=void 0,this.start=0,this.end=void 0,this.isInnerScroll=!1,this.highlightRow=null,this.scrollPos=[0,0],this.triggleScroll=!1,this.checkOrder=0,this.elTable=this.getElTable(),!this.elTable||"ElTable"!==this.elTable.$options.name)throw new Error("未找到 <el-table> 组件. 请确保 <el-table> 组件在虚拟组件内,且 getElTable 方法能获取到正确的 <el-table> 组件!");this.elTable.rowKey||this.warn&&console.warn("[el-table-virtual-scroll]: 建议设置 <el-table> 组件的 rowKey 属性"),this.scroller=this.getScroller(),this.observeElTable(),this.onScroll=this.throttleTime?K(this.handleScroll,this.throttleTime):this.handleScroll,this.scroller.addEventListener("scroll",this.onScroll),window.addEventListener("resize",this.onScroll),this.hackTableExpand(),this.hackTableHeaderDrag(),this.hackTableSort(),this.hackTableFilter(),this.hackRowHighlight(),this.hackSelection(),this.hackCustomTree(),this.bindTableDestory(),this.treeProps=this.elTable.treeProps||{children:"children",hasChildren:"hasChildren"},this.elTable.defaultSort?this.$nextTick((function(){e.onSortChange()})):this.updateTreeData(),setTimeout((function(){!e.triggleScroll&&e.onScroll()}),100)},slowOnMousewheel:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scroller;this.removeMousewheelEvent&&this.removeMousewheelEvent(),this.removeMousewheelEvent=null,e&&(this.removeMousewheelEvent=function(e,t){var n=K((function(n){var i=o.default(n);if(Math.abs(i.spinY)>0){var r=e.scrollTop;i.pixelY<0&&0!==r&&n.preventDefault(),i.pixelY>0&&e.scrollHeight-e.clientHeight>r&&n.preventDefault(),e.scrollTop+=Math.ceil(i.pixelY/t)}}),0);return e.addEventListener(q?"DOMMouseScroll":"mousewheel",n,{passive:!1}),function(){e.removeEventListener(q?"DOMMouseScroll":"mousewheel",n)}}(t,e))},getScroller:function(){var e;if(this.scrollBox){if("window"===this.scrollBox||this.scrollBox===window)return window;if(!(e=document.querySelector(this.scrollBox)))throw new Error(" scrollBox prop: '".concat(this.scrollBox,"' is not a valid selector"));return V(e)||console.warn("Warning! scrollBox prop: '".concat(this.scrollBox,"' is not a scroll element")),e}return this.elTable&&(this.elTable.height||this.elTable.maxHeight||0===this.elTable.height||0===this.elTable.maxHeight)?(this.isInnerScroll=!0,this.$el.querySelector(".el-table__body-wrapper")):function(e){for(var t=e;t;){if([window,document,document.documentElement].includes(t))return window;if(V(t))return t;t=t.parentNode}return t||window}(this.$el)},getToTop:function(){return this.isInnerScroll?0:this.$el.getBoundingClientRect().top-(this.scroller===window?0:this.scroller.getBoundingClientRect().top)+Y(this.scroller)},handleScroll:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.disabled||this.scroller&&(this.triggleScroll=!0,(!this.isInnerScroll||this.scroller.style.height||this.scroller.style.maxHeight)&&(this.isDeactivated||(this.isInnerScroll&&this.elTable.layout.bodyHeight&&(this.scrollPos[0]=this.scroller.scrollTop,this.scrollPos[1]=this.scroller.scrollLeft),this.virtualized&&(this.removeHoverRows(),this.updateSizes(),this.calcRenderData(),this.calcPosition(),e&&this.updatePosition(),this.$emit("change",this.renderData,this.start,this.end),this.syncRowsHighlight()))))},removeHoverRows:function(){var e=this.$el.querySelectorAll(".el-table__row.hover-row");e.length>1&&Array.from(e).forEach((function(e){e.classList.remove("hover-row")}))},updateSizes:function(){var e=this;if(this.dynamic){var t=this.$el.querySelectorAll(".el-table__body > tbody > .el-table__row"),n=this.elTable.lazy,i=this.isTree,r=/el-table__row--level-[1-9]\d*/;!i&&n&&(t=Array.from(this.$el.querySelectorAll(".el-table__body > tbody > .el-table__row")).filter((function(e){return!r.test(e.className)}))),Array.from(t).forEach((function(t,o){var l=e.renderData[o];if(l){var a=t.offsetHeight;if(n||i||!t.classList.contains("expanded")||(a+=t.nextSibling.offsetHeight),n)for(var s=t.nextSibling;s&&"TR"===s.tagName&&r.test(s.className);)a+=s.offsetHeight,s=s.nextSibling;var c=l[e.keyProp];a&&e.sizes[c]!==a&&e.$set(e.sizes,c,a)}}))}},getItemOffsetTop:function(e){if(!this.dynamic)return this.itemSize*e;var t=this.listData[e];return t&&this.offsetMap[t[this.keyProp]]||0},getItemSize:function(e){if(e<=-1)return 0;var t=this.listData[e];if(t){var n=t[this.keyProp];return this.sizes[n]||this.itemSize}return this.itemSize},calcRenderData:function(){var e,t,n,i=this.scroller,r=this.listData,o=this.buffer,l=this.getToTop(),a=Y(i)-o-l,s=Y(i)+((e=i)===window?window.innerHeight:e.offsetHeight)+o-l;if(this.dynamic){for(var c=0,h=r.length-1,d=0;c<=h;){if(d=Math.floor((c+h)/2),this.getItemOffsetTop(d)<a){if(this.getItemOffsetTop(d+1)>a)break;c=d+1}else h=d-1}for(c=t=d,h=r.length-1,d=0;c<=h;){if(d=Math.floor((c+h)/2),this.getItemOffsetTop(d)>=s){if(this.getItemOffsetTop(d-1)<s)break;h=d-1}else c=d+1}n=d}else t=a<=0?0:Math.floor(a/this.itemSize),n=s<=0?0:Math.ceil(s/this.itemSize);if(this.isRowSpan()){var f=u(this.calcRenderSpanData(t,n),2);t=f[0],n=f[1]}else t%2&&(t-=1);this.top=a,this.bottom=s,this.start=t,this.end=n,this.renderData=r.slice(t,n+1),0===this.start&&this.end>30&&this.end===this.listData.length-1&&this.warn&&console.warn("[el-table-virtual-scroll] 表格数据全部渲染,渲染数量为:"+this.listData.length)},isRowSpan:function(){return"function"==typeof this.rowSpanKey},calcRenderSpanData:function(e,t){for(var n;e>0;){var i=this.listData[e],r=this.rowSpanKey(i,e);if(U(r))break;if(!U(n)&&n!==r){e++;break}n=r,e--}var o=this.listData.length;for(n=void 0;t<o;){var l=this.listData[t],a=this.rowSpanKey(l,t);if(!a)break;if(n&&n!==a){t--;break}n=a,t++}return[e,t]},calcPosition:function(){var e,t=this,n=this.listData.length-1,i=this.getItemOffsetTop(n)+this.getItemSize(n),r=this.getItemOffsetTop(this.start);Q.forEach((function(n,o){var l=t.$el.querySelector(n);if(l){if(!l.wrapEl){var a=document.createElement("div"),s=document.createElement("div");a.appendChild(s),s.appendChild(l.children[0]),l.insertBefore(a,l.firstChild),l.wrapEl=a,l.innerEl=s,o>0&&e&&t.$nextTick((function(){l.scrollTop=e.scrollTop}))}0===o&&(e=l),l.wrapEl&&(l.wrapEl.style.height=i+"px",l.innerEl.style.transform="translateY(".concat(r,"px)"))}}))},observeElTable:function(){var e=this,t=this.$watch((function(){return[e.elTable.scrollPosition,e.elTable.layout.scrollX]}),(function(t){var n=u(t,2),i=n[0],r=n[1],o=u(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2);o[0];var l=o[1];e.scrollPosition=e.elTable.layout.scrollX?i:"none",r&&!l&&e.elTable.syncPostion&&e.elTable.syncPostion()}),{immediate:!0}),n=this.$watch((function(){return e.elTable.layout.bodyHeight}),(function(t){t>0&&e.restoreScroll(),t>0&&e.onScroll()}));this.unWatchs=[t,n]},doUpdate:function(){var e=this;this.hasDoUpdate||this.scroller&&(this.isHideAppend=!0,this.onScroll(),this.hasDoUpdate=!0,this.$nextTick((function(){e.hasDoUpdate=!1,e.isHideAppend=!1})))},updatePosition:function(){var e=this;this.timer&&clearTimeout(this.timer),this.timer=setTimeout((function(){e.timer&&clearTimeout(e.timer),e.handleScroll(!1)}),this.throttleTime+10)},renderAllData:function(){var e=this;this.renderData=this.listData,this.$emit("change",this.listData,0,this.listData.length-1),console.log("renderAllData",this.listData),this.$nextTick((function(){Q.forEach((function(t){var n=e.$el.querySelector(t);n&&n.wrapEl&&(n.wrapEl.style.height="auto",n.innerEl.style.transform="translateY(".concat(0,"px)"))}))}))},restoreScroll:function(){this.scroller&&this.isInnerScroll&&(this.scroller.scrollLeft=this.keepScroll?this.scrollPos[1]:0,this.scroller.scrollTop=this.keepScroll?this.scrollPos[0]:0)},update:function(){this.isTree&&this.onFilterChange&&this.onFilterChange(),this.handleScroll()},scrollTo:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.listData[e]&&this.scroller&&(this.updateSizes(),this.calcRenderData(),this.$nextTick((function(){var r,o,l=t.getItemOffsetTop(e)-n;r=t.scroller,o=l,r===window?window.scroll(0,o):r.scrollTop=o,i||setTimeout((function(){t.scrollTo(e,n,!0)}),50)})))},scrollToRow:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.listData.findIndex((function(n){return n===e||n[t.keyProp]===e[t.keyProp]}));this.scrollTo(i,n)},reset:function(){this.sizes={},this.scrollTo(0,0,!1)},destory:function(){this.scroller&&(this.scroller.removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.onScroll)),this.unWatchs&&this.unWatchs.forEach((function(e){return e()})),this.removeMousewheelEvent&&this.removeMousewheelEvent(),this.oldSelection=[],this.elTable=null,this.scroller=null,this.unWatchs=[]},getData:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.list||(e?this.data:this.listData)},addColumn:function(e){this.columnVms.push(e)},removeColumn:function(e){this.columnVms=this.columnVms.filter((function(t){return t!==e}))},checkAll:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.listData,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[];n.forEach((function(n){n.$v_checked&&r.push(n),n.$v_checked!==e&&(t.$set(n,"$v_checked",e),t.$set(n,"$v_checkedOrder",e?t.checkOrder++:void 0))}));var o=this.emitSelectionChange(r);i&&(this.$emit("select-all",o,e),this.elTable.$emit("select-all",o,e)),!1===e&&(this.checkOrder=0)},checkRow:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.$v_checked!==t&&(this.$set(e,"$v_checked",t),this.$set(e,"$v_checkedOrder",t?this.checkOrder++:void 0),n)){var r=this.emitSelectionChange(t?[]:[e]);i&&(this.$emit("select",r,e,t),this.elTable.$emit("select",r,e,t))}},clearSelection:function(){var e=this;this.oldSelection.forEach((function(t){e.$set(t,"$v_checked",!1)})),this.oldSelection=[],this.checkAll(!1),this.columnVms.forEach((function(e){return e.syncCheckStatus()}))},toggleRowSelection:function(e,t){Array.isArray(e)||(e=[e]),this.toggleRowsSelection(e,t)},toggleRowsSelection:function(e,t){var n=this,i={},r={},o=null,l=this.isReserveSelection();l&&(this.oldSelection.forEach((function(e){i[e[n.keyProp]]=!0})),this.data.forEach((function(e){r[e[n.keyProp]]=!0})));var a=[];e.forEach((function(e){var s="boolean"==typeof t?t:!e.$v_checked;if(!s&&a.push(e),n.$set(e,"$v_checked",s),n.$set(e,"$v_checkedOrder",s?n.checkOrder++:void 0),l){var c=e[n.keyProp];c in i&&!s&&(o||(o={}),o[c]=!0),!(c in r)&&s&&n.oldSelection.push(e)}})),o&&(this.oldSelection=this.oldSelection.filter((function(e){return!(e[n.keyProp]in o)}))),this.emitSelectionChange(a),this.columnVms.forEach((function(e){return e.syncCheckStatus()}))},emitSelectionChange:function(e){var t=this.isReserveSelection(),n=t?h(this.oldSelection):[];return this.data.forEach((function(e){e.$v_checked&&n.push(e)})),this.sortSelection(n),this.$emit("selection-change",n,e),this.elTable.$emit("selection-change",n,e),t||(this.oldSelection=h(n)),n},updateSelectionByRowKey:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(this.elTable){n.forEach((function(e){e.$v_checked&&t.oldSelection.push(e)}));var i={};this.oldSelection.forEach((function(e){i[e[t.keyProp]]=!0}));var r={};e.forEach((function(e){var n=e[t.keyProp];n in i&&(t.$set(e,"$v_checked",!0),r[n]=!0)})),this.oldSelection=this.oldSelection.filter((function(e){return!(e[t.keyProp]in r)}))}},isReserveSelection:function(){return this.columnVms.some((function(e){return e.reserveSelection&&e.isSelection()}))},getSelection:function(){if(this.isReserveSelection()){var e=this.data.filter((function(e){return e.$v_checked}));return[].concat(h(this.oldSelection),h(e))}return this.oldSelection},updateSelectionData:function(e,t){var n=this;if(this.syncSelectionStatus(),e===t){var i=this.data.filter((function(e){return e.$v_checked}));this.sortSelection(i);var r=i.reduce((function(e,t){return e[t[n.keyProp]]=!0,e}),{}),o=this.oldSelection.reduce((function(e,t){return t[n.keyProp]in r||e.push(t),e}),[]);(o.length||i.length!==this.oldSelection.length)&&(this.$emit("selection-change",i,o),this.elTable.$emit("selection-change",i,o),this.oldSelection=h(i))}else this.oldSelection.length>0&&(this.$emit("selection-change",[],h(this.oldSelection)),this.elTable.$emit("selection-change",[],h(this.oldSelection)),this.oldSelection=[])},sortSelection:function(e){var t=this;this.selectionSort&&("function"==typeof this.selectionSort?e.sort((function(e,n){return t.selectionSort(e,n)})):e.sort((function(e,t){return e.$v_checkedOrder-t.$v_checkedOrder})))},syncSelectionStatus:function(){var e=this.columnVms.find((function(e){return e.isSelection()}));e&&e.syncCheckStatus()},setCurrentRow:function(e){this.curRow=e,this.$emit("current-change",e),this.elTable.$emit("current-change",e)},hackRowHighlight:function(){var e=this;if(this.elTable.setCurrentRow.virtual){var t=this.elTable.setCurrentRow.bind(this.elTable),n=function(n){e.elTable.store.states.currentRow=e.highlightRow,e.highlightRow!==n&&(e.highlightRow=n),t(n)};this.elTable.setCurrentRow=n,n.virtual=!0}var i=this.$watch((function(){return e.elTable.currentRowKey}),(function(t){if(e.elTable.rowKey){var n=e.listData.find((function(n){return t===n[e.elTable.rowKey]}));e.highlightRow=n}}),{immediate:!0});this.unWatchs.push(i);var r=function(t){e.highlightRow=t};this.elTable.$on("current-change",r),this.unWatchs.push((function(){e.elTable.$off("current-change",r)}))},syncRowsHighlight:function(){var e=this;this.elTable.highlightCurrentRow&&this.$nextTick((function(){e.elTable.store.states.currentRow=e.highlightRow}))},useCustomSelection:function(){this.isSelection=!0},hackSelection:function(){var e=this,t=this.$watch((function(){return[e.elTable.fixedColumns,e.elTable.rightFixedColumns]}),(function(){e.elTable&&e.elTable.$children.filter((function(e){return"ElTableBody"===e.$options.name})).forEach((function(t){if(!t.getRowClass.virtual){var n=t.getRowClass.bind(e.elTable);t.getRowClass=function(t,i){var r=n(t,i);return e.elTable.highlightSelectionRow&&t.$v_checked&&r.push("selection-row"),r},t.getRowClass.virtual=!0}}))}),{immediate:!0});this.unWatchs.push(t),this.elTable.toggleRowSelection=function(t,n){e.toggleRowSelection(t,n)},this.elTable.clearSelection=function(){e.clearSelection()},this.elTable.toggleAllSelection=function(){var t=e.columnVms.find((function(e){return e.isSelection()}));t&&t.onCheckAllRows(!t.isCheckedAll)}},hackTableHeaderDrag:function(){var e=this,t=function(){e.hasHeadDrag=!0,e.elTable.doLayout(),e.update()};this.elTable.$on("header-dragend",t),this.unWatchs.push((function(){e.elTable.$off("header-dragend",t)}))},useExpandTable:function(){this.isExpandType=!0},hackTableExpand:function(){var e=this;if(this.isExpandType){var t=this.elTable.store;t.isRowExpanded=function(e){return e.$v_expanded},t.setExpandRowKeys=function(){var t=e.elTable.expandRowKeys;e.listData.forEach((function(n){e.$set(n,"$v_expanded",t.includes(n[e.elTable.rowKey]))}))},t.updateExpandRows=function(){e.elTable.defaultExpandAll&&e.listData.forEach((function(t){e.$set(t,"$v_expanded",!0)}))},t.toggleRowExpansion=function(t,n){var i="boolean"==typeof n?n:!t.$v_expanded;i!==Boolean(t.$v_expanded)&&(e.$set(t,"$v_expanded",i),e.elTable.$emit("expand-change",t,e.listData.filter((function(e){return e.$v_expanded}))),e.updateExpandeding||(e.updateExpandeding=!0,e.$nextTick((function(){e.updateExpandeding=!1,e.update()}))))},t.states.expandRows.indexOf=function(e){return e&&e.$v_expanded||-1}}},toggleRowExpansion:function(e,t){this.elTable.toggleRowExpansion(e,t)},headerCellFixedStyle:function(e){return this.cellFixedStyle(e,!0)},cellFixedStyle:function(e){var t=this,n=e.column,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.getElTable();if(r){var o=r.layout,l=o.gutterWidth,a=o.scrollY,s=o.bodyWidth,c=i&&a?l:0;if(!this.fixedMap||this._isScrollY!==a||this._bodyWidth!==s||this.hasHeadDrag){this.hasHeadDrag&&(this.hasHeadDrag=!1),this._isScrollY=a,this._bodyWidth=s,this.fixedMap={},this.totalLeft=0,this.totalRight=0;for(var u,h,d=r.columns,f=[],v=0;v<d.length;v++){var p=d[v],g=p.className&&p.className.includes("virtual-column__fixed-left"),m=p.className&&p.className.includes("virtual-column__fixed-right");(g||m)&&(g&&(u=p,this.fixedMap[p.id]={left:this.totalLeft},this.totalLeft+=p.realWidth||p.width),m&&(h||(h=p),f.push(p)))}var b=" is-last-column",y=" is-first-column";u&&!u.className.includes(b)&&(u.className+=b),h&&!h.className.includes(y)&&(h.className+=y),this.hasFixedRight=f.length>0,f.reverse().forEach((function(e){t.fixedMap[e.id]={right:t.totalRight},t.totalRight+=e.realWidth||e.width}))}var w=this.fixedMap[n.id];if(w){var x="right"in w?{right:w.right+c+"px"}:{left:w.left+"px"};return r.showSummary&&this.$nextTick((function(){var e=t.$el.querySelector(".el-table__footer-wrapper .".concat(n.id));e&&(x.left&&(e.style.left=x.left),x.right&&(e.style.right=x.right))})),x}}},doHeaderLayout:function(){this.elTable&&(this.fixedMap=null,this.elTable.$refs.tableHeader.$forceUpdate())},hackTableSort:function(){var e=this;this.onSortChange=function(){if(e.elTable){var t=e.elTable.store.states,n=t.sortingColumn,i=e.filterData||e.data;if(n&&"string"!=typeof n.sortable){var r=X(i,t.sortProp,t.sortOrder,n.sortMethod,n.sortBy);e.updateTreeData(r)}else e.updateTreeData(i);e.doUpdate(),e.virtualized||e.renderAllData(),e.$nextTick((function(){e.syncSelectionStatus()}))}},this.elTable.$on("sort-change",this.onSortChange),this.unWatchs.push((function(){e.elTable.$off("sort-change",e.onSortChange)}));var t=this.elTable.clearSort.bind(this.elTable);this.elTable.clearSort=function(){t.apply(void 0,arguments),e.onSortChange()}},hackTableFilter:function(){var e=this;this.isTree&&this.$nextTick((function(){e.elTable.store.execQuery=function(){e.elTable.store.states.data=h(e.elTable.data)}})),this.onFilterChange=function(){if(e.elTable){var t=e.elTable.store.states,n=t.filters,i=e.data;Object.keys(n).forEach((function(e){var n=t.filters[e];if(n&&0!==n.length){var r=function(e,t){var n=null;return e.columns.forEach((function(e){e.id===t&&(n=e)})),n}(t,e);r&&r.filterMethod&&(i=i.filter((function(e){return n.some((function(t){return r.filterMethod.call(null,t,e,r)}))})))}}));var r=e.data!==i;e.filterData=r?i:null,e.onSortChange()}},this.elTable.$on("filter-change",this.onFilterChange),this.unWatchs.push((function(){e.elTable.$off("filter-change",e.onFilterChange)}));var t=this.elTable.clearFilter.bind(this.elTable);this.elTable.clearFilter=function(){t.apply(void 0,arguments),e.onFilterChange()},this.elTable.store.states.columns.forEach((function(t){t.filteredValue&&t.filteredValue.length&&e.onFilterChange()}))},useCustomTree:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isTree=!0;var n=this.getElTable();if(n){var i=n.store.states;i.childrenColumnName="",i.lazyColumnIdentifier="",n.store.updateTreeData=function(){}}else t&&this.$nextTick((function(){e.useCustomTree(!1)}))},hackCustomTree:function(){var e=this;if(this.isTree){var t=this.$watch((function(){return e.elTable.expandRowKeys}),(function(){e.expandRowKeysChanged=!0,e.update(),e.expandRowKeysChanged=!1}));this.unWatchs.push(t),this.elTable.toggleRowExpansion=function(t,n){var i=t.$v_tree;i&&(void 0===n&&(n=!i.expanded),i.expanded!==n&&(i.expanded=n,e.togglingRowExpansion||(e.togglingRowExpansion=!0,e.$nextTick((function(){e.togglingRowExpansion=!1,e.update(),e.columnVms.forEach((function(e){return e.isTree&&e.renderTreeNode()}))})))))}}},updateTreeData:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.data;if(this.isTree&&this.treeProps){var n=[],i=this.treeProps.children,r=void 0===i?"children":i,o=this.elTable,l=o.defaultExpandAll,a=o.expandRowKeys,s=o.rowKey,c=o.indent,u=function(e){return e&&(l||a&&-1!==a.indexOf(e))||!1};!function t(i,o){var l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];i.forEach((function(i){a&&n.push(i);var h=i.$v_tree||{};if(i.$v_tree?e.expandRowKeysChanged&&(h.expanded=u(i[s])):i.$v_tree=h={parent:o,level:l,expanded:u(i[s]),loaded:!1,loading:!1,indent:(l-1)*c},Array.isArray(i[r])){var d=a&&h.expanded;t(i[r],i,l+1,d)}}))}(t),this.listData=n}else this.listData=t},getChildNodes:function(e){var t=this.treeProps.children;return e[void 0===t?"children":t]||[]},getParentNode:function(e){var t=e.$v_tree;return t&&t.parent},getParentNodes:function(e){for(var t=[],n=e;n;){var i=n.$v_tree;if(!i||!i.parent)break;t.unshift(i.parent),n=i.parent}return t},reloadNode:function(e){var t=this;return c(l().mark((function n(){var i,r,o,a,s,c,u;return l().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(i=e.$v_tree){n.next=3;break}return n.abrupt("return");case 3:if(r=t.treeProps,o=r.children,a=void 0===o?"children":o,s=r.hasChildren,c=void 0===s?"hasChildren":s,e[a]=null,e[c]=!0,i.loaded=!1,t.update(),u=t.columnVms.find((function(e){return e.isTree})),n.t0=u,!n.t0){n.next=13;break}return n.next=13,u.loadChildNodes(e,!0);case 13:case"end":return n.stop()}}),n)})))()},unexpandAllNodes:function(){var e=this,t=this.treeProps.children;!function n(i){i.forEach((function(i){e.toggleRowExpansion(i,!1),Array.isArray(i[t])&&n(i[t])}))}(this.listData)},expandAllNodes:function(){var e=this,t=this.treeProps,n=t.children,i=t.hasChildren,r=void 0===i?"hasChildren":i;!function t(i){i.forEach((function(i){var o=i.$v_tree;i[r]&&!o.loaded||(e.toggleRowExpansion(i,!0),Array.isArray(i[n])&&t(i[n]))}))}(this.listData)},bindTableDestory:function(){var e=this,t=function(){e.warn&&console.warn("<el-table> 组件销毁时,建议将 <el-table-virtual-scroll> 组件一同销毁"),e.destory(),e.$nextTick((function(){e.initData()}))};this.elTable.$on("hook:beforeDestory",t),this.unWatchs.push((function(){e.elTable.$off("hook:beforeDestory",t)}))}},watch:{data:function(e,t){this.listData=e,this.list&&e!==t&&(this.list=e),this.onFilterChange&&this.onFilterChange(),this.isReserveSelection()?this.updateSelectionByRowKey(e,t):this.updateSelectionData(e,t)},virtualized:{immediate:!0,handler:function(){this.onFilterChange&&this.onFilterChange()}},disabled:function(){this.doUpdate()},treeMap:function(){this.update()}},created:function(){var e=this;this.$nextTick((function(){e.initData()}))},activated:function(){var e;this.isDeactivated=!1,!1===(null===(e=this.elTable)||void 0===e?void 0:e.fit)&&this.restoreScroll()},deactivated:function(){this.isDeactivated=!0},beforeDestroy:function(){this.destory()}};function J(e,t,n,i,r,o,l,a,s,c){"boolean"!=typeof l&&(s=a,a=l,l=!1);const u="function"==typeof n?n.options:n;let h;if(e&&e.render&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),i&&(u._scopeId=i),o?(h=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,s(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=h):t&&(h=l?function(e){t.call(this,c(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,a(e))}),h)if(u.functional){const e=u.render;u.render=function(t,n){return h.call(n),e(t,n)}}else{const e=u.beforeCreate;u.beforeCreate=e?[].concat(e,h):[h]}return n}const ee="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function te(e){return(e,t)=>function(e,t){const n=ee?t.media||"default":e,i=ie[n]||(ie[n]={ids:new Set,styles:[]});if(!i.ids.has(e)){i.ids.add(e);let n=t.source;if(t.map&&(n+="\n/*# sourceURL="+t.map.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),i.element||(i.element=document.createElement("style"),i.element.type="text/css",t.media&&i.element.setAttribute("media",t.media),void 0===ne&&(ne=document.head||document.getElementsByTagName("head")[0]),ne.appendChild(i.element)),"styleSheet"in i.element)i.styles.push(n),i.element.styleSheet.cssText=i.styles.filter(Boolean).join("\n");else{const e=i.ids.size-1,t=document.createTextNode(n),r=i.element.childNodes;r[e]&&i.element.removeChild(r[e]),r.length?i.element.insertBefore(t,r[e]):i.element.appendChild(t)}}}(e,t)}let ne;const ie={};var re=Z,oe=function(){var e=this,t=e.$createElement;return(e._self._c||t)("div",{staticClass:"el-table-virtual-scroll",class:[e.isExpanding?"is-expanding":"",e.isHideAppend?"hide-append":"",e.scrollPosition?"is-scrolling-"+e.scrollPosition:"",e.hasFixedRight?"has-custom-fixed-right":""]},[e._t("default",null,null,{headerCellFixedStyle:e.headerCellFixedStyle,cellFixedStyle:e.cellFixedStyle})],2)};oe._withStripped=!0;var le=J({render:oe,staticRenderFns:[]},(function(e){e&&(e("data-v-f7156cc6_0",{source:".el-table-virtual-scroll.has-custom-fixed-right .el-table__cell.gutter {\n position: sticky;\n right: 0;\n}\n",map:{version:3,sources:["el-table-virtual-scroll.vue"],names:[],mappings:"AAAA;EACE,gBAAgB;EAChB,QAAQ;AACV",file:"el-table-virtual-scroll.vue",sourcesContent:[".el-table-virtual-scroll.has-custom-fixed-right .el-table__cell.gutter {\n position: sticky;\n right: 0;\n}\n"]},media:void 0}),e("data-v-f7156cc6_1",{source:".is-expanding[data-v-f7156cc6] .el-table__expand-icon {\n transition: none;\n}\n.hide-append[data-v-f7156cc6] .el-table__append-wrapper {\n display: none;\n}\n",map:{version:3,sources:["el-table-virtual-scroll.vue"],names:[],mappings:"AAAA;EACE,gBAAgB;AAClB;AACA;EACE,aAAa;AACf",file:"el-table-virtual-scroll.vue",sourcesContent:[".is-expanding /deep/ .el-table__expand-icon {\n transition: none;\n}\n.hide-append /deep/ .el-table__append-wrapper {\n display: none;\n}\n"]},media:void 0}))}),re,"data-v-f7156cc6",false,undefined,!1,te,void 0,void 0),ae=J({},undefined,{name:"el-table-virtual-column-formatter",props:{vNode:{type:Object}},render:function(){return this.vNode}},undefined,undefined,undefined,!1,void 0,void 0,void 0),se={scope:null,result:null},ce={name:"el-table-virtual-column",components:{ElCheckbox:i.Checkbox,ElRadio:i.Radio,ElTableVirtualColumnFormatter:ae},inject:["virtualScroll"],props:{selectable:{type:Function},reserveSelection:{type:Boolean,default:!1}},data:function(){return{isCheckedAll:!1,isCheckedImn:!1,isTree:!1,isNested:!1,treeNodeKey:1}},computed:{getClassName:function(){var e=[],t=this.$attrs["class-name"]||this.$attrs.className;t&&e.push(t),this.isTree&&e.push("el-table__row--level");var n=this.$attrs.vfixed;return!0!==n&&""!==n||(n="left"),n&&e.push("virtual-column__fixed-"+n),e.join(" ")},indent:function(){return(this.virtualScroll.elTable||{}).indent||16}},methods:{getColumnType:function(){var e=this.$attrs.type;return["index","selection","radio","tree"].includes(e)?"":e},getDisabled:function(e){if(this.selectable){var t=this.getIndex(e,!1);return!this.selectable(e.row,t)}return!1},onCheckAllRows:function(e){var t=this,n=this.virtualScroll.elTable.selectOnIndeterminate;if(e=void 0===n||n?!!this.isCheckedImn||!this.isCheckedAll:!this.isCheckedImn&&!this.isCheckedAll,this.selectable){var i=[];this.virtualScroll.getData(!1).forEach((function(e,n){t.selectable(e,n)&&i.push(e)})),this.virtualScroll.checkAll(e,i,!0)}else this.virtualScroll.checkAll(e);var r=this.virtualScroll.getSelection();this.isCheckedImn=!e&&r.length>0,this.isCheckedAll=e},onCheckRow:function(e,t){var n=this.getIndex(e,!1);if(this.selectable&&!this.selectable(e.row,n))return;this.virtualScroll.checkRow(e.row,t,!0,!0),this.syncCheckStatus()},isSelection:function(){return"selection"===this.$attrs.type},syncCheckStatus:function(){var e=this,t=this.virtualScroll.getData(!1),n=t.filter((function(e){return!0===e.$v_checked})).length,i=this.virtualScroll.getSelection();n&&n===t.length?this.isCheckedAll=!0:n&&this.selectable?this.isCheckedAll=t.every((function(t,n){return!e.selectable(t,n)||t.$v_checked})):this.isCheckedAll=!1,this.isCheckedImn=!this.isCheckedAll&&i.length>0},onRadioChange:function(e){this.virtualScroll.setCurrentRow(e)},getIndex:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.virtualScroll.start+e.$index;return"function"==typeof this.$attrs.index?this.$attrs.index(n):n+(t?1:0)},setScope:function(e){return e.$index=this.virtualScroll.start+e.$index,e},getTreeState:function(e){return e.$v_tree||{}},canExpand:function(e){var t=this.virtualScroll.treeProps||{},n=t.children,i=void 0===n?"children":n,r=t.hasChildren,o=void 0===r?"hasChildren":r,l=e.$v_tree||{};return(e[i]||[]).length>0||e[o]&&!l.loaded},onTreeNodeExpand:function(e){var t=this;return c(l().mark((function n(){var i,r,o,a;return l().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!(i=e.$v_tree)){n.next=15;break}if(r=t.virtualScroll.treeProps,o=r.hasChildren,a=void 0===o?"hasChildren":o,!i.loading){n.next=6;break}return n.abrupt("return");case 6:if(i.expanded||!e[a]||i.loaded){n.next=11;break}return n.next=9,t.loadChildNodes(e);case 9:n.next=14;break;case 11:i.expanded=!i.expanded,t.renderTreeNode(),t.virtualScroll.update();case 14:t.virtualScroll.elTable.$emit("expand-change",e,i.expanded);case 15:case"end":return n.stop()}}),n)})))()},loadChildNodes:function(e){var t=this;return c(l().mark((function n(){return l().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",new Promise((function(n){var i=t.virtualScroll.treeProps,r=t.virtualScroll.elTable.load;if(!r)return n();var o=i.children,l=void 0===o?"children":o,a=e.$v_tree;a.loading=!0,t.renderTreeNode(),r(e,a,function(t){if(!Array.isArray(t))throw new Error("[ElTable] data must be an array");a.loading=!1,a.loaded=!0,a.expanded=!0,this.renderTreeNode(),Array.isArray(t)?(this.$set(e,l,t),this.virtualScroll.update(),n()):n()}.bind(t))})));case 1:case"end":return n.stop()}}),n)})))()},renderTreeNode:function(){this.treeNodeKey=1===this.treeNodeKey?2:1},isVNode:function(e){return this._vnode.constructor===(null==e?void 0:e.constructor)},getFormatterResult:function(e){return se.scope===e||(se.scope=e,se.result=e.column.formatter(e.row,e.column,e.row[e.column.property],e.$index)),se.result}},beforeCreate:function(){this.$root.$options.components.ElTableColumn||(this.$options.components.ElTableColumn=i.TableColumn)},created:function(){this.isNested=!!this.$slots.default,this.virtualScroll.addColumn(this);var e=this.$attrs.type;"expand"===e?this.virtualScroll.useExpandTable():"tree"===e?(this.isTree=!0,this.virtualScroll.useCustomTree()):"selection"===e&&this.virtualScroll.useCustomSelection()},beforeDestroy:function(){this.virtualScroll.removeColumn(this),se.scope=null,se.result=null}},ue=ce,he=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("el-table-column",e._g(e._b({attrs:{type:e.getColumnType(),"class-name":e.getClassName},scopedSlots:e._u([{key:"header",fn:function(t){return[e.$scopedSlots.header?e._t("header",null,null,t):["selection"===e.$attrs.type?n("el-checkbox",{attrs:{value:e.isCheckedAll,indeterminate:e.isCheckedImn},on:{change:e.onCheckAllRows}}):[e._v("\n "+e._s(t.column.label)+"\n ")]]]}},{key:"default",fn:function(t){return[e.isTree?[n("span",{staticClass:"el-table__indent",style:{paddingLeft:e.getTreeState(t.row).level*e.indent+"px"}}),e._v(" "),e.canExpand(t.row)&&e.treeNodeKey?n("div",{staticClass:"el-table__expand-icon",class:e.getTreeState(t.row).expanded?"el-table__expand-icon--expanded":"",on:{click:function(n){return e.onTreeNodeExpand(t.row)}}},[e.getTreeState(t.row).loading?n("i",{staticClass:"el-icon-loading"}):n("i",{staticClass:"el-icon-arrow-right"})]):n("span",{staticClass:"el-table__placeholder"})]:e._e(),e._v(" "),e.$scopedSlots.default?e._t("default",null,null,e.setScope(t)):["selection"===e.$attrs.type?n("el-checkbox",{attrs:{value:t.row.$v_checked||!1,disabled:e.getDisabled(t)},on:{change:function(n){return e.onCheckRow(t,!t.row.$v_checked)}},nativeOn:{click:function(e){e.stopPropagation()}}}):e._e(),e._v(" "),"radio"===e.$attrs.type?n("el-radio",{attrs:{label:!0,value:e.virtualScroll.curRow===t.row},on:{change:function(n){return e.onRadioChange(t.row)}}},[n("span")]):"index"===e.$attrs.type?n("span",[e._v("\n "+e._s(e.getIndex(t))+"\n ")]):t.column.formatter?[e.isVNode(e.getFormatterResult(t))?n("el-table-virtual-column-formatter",{attrs:{"v-node":e.getFormatterResult(t)}}):[e._v(e._s(e.getFormatterResult(t)))]]:[e._v("\n "+e._s(t.row[t.column.property])+"\n ")]]]}}],null,!0)},"el-table-column",e.$attrs,!1),e.$listeners),[e._v(" "),e.isNested?[e._t("default")]:e._e()],2)};he._withStripped=!0;var de=J({render:he,staticRenderFns:[]},(function(e){e&&e("data-v-4703507b_0",{source:'.el-table-virtual-scroll .virtual-column__fixed-left,\n.el-table-virtual-scroll .virtual-column__fixed-right {\n position: sticky !important;\n z-index: 2 !important;\n background: #fff;\n}\n.el-table-virtual-scroll.is-scrolling-left .is-last-column:before {\n box-shadow: none;\n}\n.el-table-virtual-scroll.is-scrolling-right .is-last-column,\n.el-table-virtual-scroll.is-scrolling-middle .is-last-column {\n border-right: none;\n}\n.el-table-virtual-scroll.is-scrolling-right .is-first-column:before {\n box-shadow: none;\n}\n.el-table-virtual-scroll.is-scrolling-left .is-first-column,\n.el-table-virtual-scroll.is-scrolling-middle .is-first-column {\n border-left: none;\n}\n.el-table-virtual-scroll .is-last-column,\n.el-table-virtual-scroll .is-first-column {\n overflow: visible !important;\n}\n.el-table-virtual-scroll .is-last-column:before,\n.el-table-virtual-scroll .is-first-column:before {\n content: "";\n position: absolute;\n top: 0px;\n width: 10px;\n bottom: -1px;\n overflow-x: hidden;\n overflow-y: hidden;\n touch-action: none;\n pointer-events: none;\n}\n.el-table-virtual-scroll .is-last-column:before {\n right: -10px;\n box-shadow: inset 10px 0 10px -10px rgba(0, 0, 0, 0.12);\n}\n.el-table-virtual-scroll .is-first-column:before {\n left: -10px;\n box-shadow: inset -10px 0 10px -10px rgba(0, 0, 0, 0.12);\n}\n.el-table-virtual-scroll.is-scrolling-none .is-last-column:before,\n.el-table-virtual-scroll.is-scrolling-none .is-first-column:before {\n content: none;\n}\n',map:{version:3,sources:["el-table-virtual-column.vue"],names:[],mappings:"AAAA;;EAEE,2BAA2B;EAC3B,qBAAqB;EACrB,gBAAgB;AAClB;AACA;EACE,gBAAgB;AAClB;AACA;;EAEE,kBAAkB;AACpB;AACA;EACE,gBAAgB;AAClB;AACA;;EAEE,iBAAiB;AACnB;AACA;;EAEE,4BAA4B;AAC9B;AACA;;EAEE,WAAW;EACX,kBAAkB;EAClB,QAAQ;EACR,WAAW;EACX,YAAY;EACZ,kBAAkB;EAClB,kBAAkB;EAClB,kBAAkB;EAClB,oBAAoB;AACtB;AACA;EACE,YAAY;EACZ,uDAAuD;AACzD;AACA;EACE,WAAW;EACX,wDAAwD;AAC1D;AACA;;EAEE,aAAa;AACf",file:"el-table-virtual-column.vue",sourcesContent:['.el-table-virtual-scroll .virtual-column__fixed-left,\n.el-table-virtual-scroll .virtual-column__fixed-right {\n position: sticky !important;\n z-index: 2 !important;\n background: #fff;\n}\n.el-table-virtual-scroll.is-scrolling-left .is-last-column:before {\n box-shadow: none;\n}\n.el-table-virtual-scroll.is-scrolling-right .is-last-column,\n.el-table-virtual-scroll.is-scrolling-middle .is-last-column {\n border-right: none;\n}\n.el-table-virtual-scroll.is-scrolling-right .is-first-column:before {\n box-shadow: none;\n}\n.el-table-virtual-scroll.is-scrolling-left .is-first-column,\n.el-table-virtual-scroll.is-scrolling-middle .is-first-column {\n border-left: none;\n}\n.el-table-virtual-scroll .is-last-column,\n.el-table-virtual-scroll .is-first-column {\n overflow: visible !important;\n}\n.el-table-virtual-scroll .is-last-column:before,\n.el-table-virtual-scroll .is-first-column:before {\n content: "";\n position: absolute;\n top: 0px;\n width: 10px;\n bottom: -1px;\n overflow-x: hidden;\n overflow-y: hidden;\n touch-action: none;\n pointer-events: none;\n}\n.el-table-virtual-scroll .is-last-column:before {\n right: -10px;\n box-shadow: inset 10px 0 10px -10px rgba(0, 0, 0, 0.12);\n}\n.el-table-virtual-scroll .is-first-column:before {\n left: -10px;\n box-shadow: inset -10px 0 10px -10px rgba(0, 0, 0, 0.12);\n}\n.el-table-virtual-scroll.is-scrolling-none .is-last-column:before,\n.el-table-virtual-scroll.is-scrolling-none .is-first-column:before {\n content: none;\n}\n']},media:void 0})}),ue,undefined,false,undefined,!1,te,void 0,void 0);return e.VirtualColumn=de,e.VirtualScroll=le,e.default=le,Object.defineProperty(e,"__esModule",{value:!0}),e}({},normalizeWheel,util,ELEMENT);
+1
-1

@@ -7,3 +7,3 @@ <!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<title>el-table-virtual-scroll</title>
</head>

@@ -10,0 +10,0 @@ <body>

{
"name": "el-table-virtual-scroll",
"version": "2.0.0",
"version": "2.0.1",
"description": "The virtual scrolling component developed based on the Table component of Element-UI supports dynamic height and solves the problem of scrolling stuck when the amount of data is large.",

@@ -5,0 +5,0 @@ "main": "dist/el-table-virtual-scroll.umd.js",

@@ -134,3 +134,3 @@ # el-table-virtual-scroll

| * | 支持 `<el-table-column>` 组件的props属性,如label, fixed, prop, width, min-width, index 等等 | - | — | - |
| type | type="index" 为索引;type="selection" 为多选;type="radio" 为单选;type="expand" 为扩展行;type="tree" 为模拟树结构 | String | 选填 | |
| type | type="index" 为索引;type="selection" 为多选;type="radio" 为单选;type="expand" 为扩展行;type="tree" 为树形表格 | String | 选填 | |
| vfixed | 固定列。使用 position: sticky; 来实现固定列,不会生成额外table,滚动更丝滑;使用时,需要设置table的headerCellStyle、cellStyle(注意组件必须按固定列顺序排列最左或最右),参考[demo](https://xiaocheng555.github.io/el-table-virtual-scroll/#/VFixedDemo) | String/Boolean | left/right/true | - |

@@ -157,1 +157,16 @@

### 2024-9-2
* 重构:兼容树形表格;兼容扩展行、多选原生事件、属性、方法;
* npm 2.0.0 版本发包
### 2024-9-16
* 修复virtualized更改在筛选和树形表格上会有问题
* 修复多选select-change事件在表格数据更新后未触发,导致旧数据未清除 #100
* npm 2.0.1 版本发包

@@ -594,2 +594,3 @@ <template>

this.$emit('change', this.listData, 0, this.listData.length - 1)
console.log('renderAllData', this.listData)

@@ -870,3 +871,8 @@ this.$nextTick(() => {

if (data !== oldData) {
this.oldSelection = []
if (this.oldSelection.length > 0) {
// 修复多选select-change事件在表格数据更新后未触发,导致旧数据未清除 #100
this.$emit('selection-change', [], [...this.oldSelection])
this.elTable.$emit('selection-change', [], [...this.oldSelection])
this.oldSelection = []
}
return

@@ -1198,2 +1204,5 @@ }

this.doUpdate()
if (!this.virtualized) {
this.renderAllData()
}
this.$nextTick(() => {

@@ -1473,8 +1482,4 @@ this.syncSelectionStatus()

}
if (!this.virtualized) {
this.renderAllData()
} else {
// 筛选数据后会调用update更新视图
this.onFilterChange && this.onFilterChange()
}
// 筛选数据后会调用update更新视图
this.onFilterChange && this.onFilterChange()
if (this.isReserveSelection()) {

@@ -1490,8 +1495,5 @@ // 保留旧的选中值

immediate: true,
handler (val) {
if (!val) {
this.renderAllData()
} else {
this.doUpdate()
}
handler () {
// 筛选数据后会调用update更新视图
this.onFilterChange && this.onFilterChange()
}

@@ -1498,0 +1500,0 @@ },

Sorry, the diff of this file is too big to display