Files
smart-table/dist/smartTable.min.js
Julyp 09fd8b4147 - 修复resize layout布局错乱
- 修复fixed元素hover失效
2020-02-05 17:18:52 +08:00

1 line
19 KiB
JavaScript

/*! smartTable v1.1.1 | (c) pengyajun 2020 | Released under the MIT License. */!function(t){var e={};function o(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)o.d(r,i,function(e){return t[e]}.bind(null,i));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=4)}([function(t,e,o){var r=o(1),i=o(2);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[t.i,i,""]]);var n={insert:"head",singleton:!1},s=(r(t.i,i,n),i.locals?i.locals:{});t.exports=s},function(t,e,o){"use strict";var r,i=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},n=function(){var t={};return function(e){if(void 0===t[e]){var o=document.querySelector(e);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(t){o=null}t[e]=o}return t[e]}}(),s={};function a(t,e,o){for(var r=0;r<e.length;r++){var i={css:e[r][1],media:e[r][2],sourceMap:e[r][3]};s[t][r]?s[t][r](i):s[t].push(p(i,o))}}function l(t){var e=document.createElement("style"),r=t.attributes||{};if(void 0===r.nonce){var i=o.nc;i&&(r.nonce=i)}if(Object.keys(r).forEach((function(t){e.setAttribute(t,r[t])})),"function"==typeof t.insert)t.insert(e);else{var s=n(t.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(e)}return e}var d,f=(d=[],function(t,e){return d[t]=e,d.filter(Boolean).join("\n")});function c(t,e,o,r){var i=o?"":r.css;if(t.styleSheet)t.styleSheet.cssText=f(e,i);else{var n=document.createTextNode(i),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(n,s[e]):t.appendChild(n)}}function h(t,e,o){var r=o.css,i=o.media,n=o.sourceMap;if(i?t.setAttribute("media",i):t.removeAttribute("media"),n&&btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(n))))," */")),t.styleSheet)t.styleSheet.cssText=r;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(r))}}var u=null,b=0;function p(t,e){var o,r,i;if(e.singleton){var n=b++;o=u||(u=l(e)),r=c.bind(null,o,n,!1),i=c.bind(null,o,n,!0)}else o=l(e),r=h.bind(null,o,e),i=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(o)};return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}t.exports=function(t,e,o){return(o=o||{}).singleton||"boolean"==typeof o.singleton||(o.singleton=i()),t=o.base?t+o.base:t,e=e||[],s[t]||(s[t]=[]),a(t,e,o),function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){s[t]||(s[t]=[]),a(t,e,o);for(var r=e.length;r<s[t].length;r++)s[t][r]();s[t].length=e.length,0===s[t].length&&delete s[t]}}}},function(t,e,o){(e=o(3)(!1)).push([t.i,'.smart-table{position:relative;overflow:hidden;box-sizing:border-box;width:100%;max-width:100%;background-color:#fff;color:#6A6B6F;border:1px solid #ECF0F5;border-right:none;border-bottom:none}.smart-table:after,.smart-table:before{content:"";position:absolute;background-color:#ECF0F5;z-index:1}.smart-table:before{left:0;bottom:0;width:100%;height:1px}.smart-table:after{top:0;right:0;width:1px;height:100%}.smart-table table{border-spacing:0;border:0}.smart-table thead{background:#F5F7FB;font-size:13px}.smart-table tbody{font-size:12px}.smart-table tbody.stripe tr:nth-child(2n){background-color:#F9FBFF}.smart-table tr{-webkit-transition:background-color .25s ease;transition:background-color .25s ease}.smart-table td,.smart-table th{padding:5px 0;text-overflow:ellipsis;vertical-align:middle;position:relative;border-bottom:1px solid #ECF0F5;border-right:1px solid #ECF0F5;text-align:center}.smart-table td.is-hidden>*,.smart-table th.is-hidden>*{visibility:hidden}.smart-table th{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden}.smart-table th[sort]{cursor:pointer}.smart-table th[sort] :after{margin-left:5px;content:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAOCAYAAAAbvf3sAAAAAXNSR0IArs4c6QAAAR5JREFUKBVjYKA7+P//P/OBo2dmHzx6rgab5YzIgseOPeb8/e/Vyv8M/33B4owM0+2tjHMYGRn/wdTBNRw7dlXo9/8fm4E2WMEkQTQjA+N6OWmhKEVFxR8QPpA8eOqyLMPvXzuBijVBgugAaMNhPi4mP0NDww8sIMn/f35aMP1nnA00DV0thP+fgeHz93/mQM5O7ArwiIKNPHDkjCMTEwM/HnUM//4zvXSwNjoOdhIzK9O7f7//LQXaLIlNE9DUW+zMjO4gObijjx8/r/Dr79+dQE1qyJoYGRlOcbMzeJuYmLwBiTPBJC0tDR9wczBYgxTAxIDsbUDFjjDFIHG4DTBFFy9e5P7w+c/q/4wML+2tjFKBQfoHJoeTBiUPXJIAbjheeFXAZxsAAAAASUVORK5CYII=")}.smart-table th[sort].desc :after{content:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAOCAYAAAAbvf3sAAAAAXNSR0IArs4c6QAAASdJREFUKBVjYKA7+P//P/OBo2dmHzx6rgab5YzIgseOPeb8/e/Vyv8M/33B4owM0+2tjHMYGRn/wdTBNRw7dlXo9/8fm4E2WMEkQTQjA+N6OWmhKEVFxR8QPpA8eOqyLMPvXzuBijVBgugAaMNhPi4mP0NDww8sIMn/f35aMP1nnA00DV0thP+fgeHz93/mQM5O7ArwiIKNdF7435HhHwM/HnUMDEwML/fGMx4HO+kfE8O7//8YljL8Z5DEpomRkeEW+z8Gd5AcE4jYH8t4kYOBwQokAeIjA6DYKR52BusdiYwPQOIovvRd9l/ky0+Grf//M5iBJRkZtvGIMIRu9mX8BuKDAIoGkIDbov/cv/4wrAbKvHRQYEhtcGT8AxLHC0JX/WfGpQAAJIlcYMXwsAoAAAAASUVORK5CYII=")}.smart-table th[sort].asc :after{content:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAOCAYAAAAbvf3sAAAAAXNSR0IArs4c6QAAARlJREFUKBVjYKA7aPj/n8lx/v+pQFyFzXJGZEHPbf/Zf7xkWPr/P0MwSJyRkWGqfQJDXgMj4z+YOrgGl1X/+f9+Ydj4n4HBHiYJ1bSWQ5whersX408wH0S4Lv8v9ecHw3agyXogPjoAmnqQmYfBf08Y40cWkOSfnww2DIwMS4FOWIquGMb/+5XBGsjeBuMTTYP9cODIGUcmJgZ+fLr+/Wd66WBtdBzsJGZWpnf/fv9bCvSwJDZNQFNvsTMzuoPk4KF0/Ph5hV9//+4EalJD1gT01yludgZvExOTNyBxJpikpaXhA24OBmuQApgYkL0NqNgRphgkDrcBpujixYvcHz7/Wf2fkeGlvZVRKiMj4x+YHE76////zLgkATPDVMggLp6aAAAAAElFTkSuQmCC")}.smart-table.stb-cust-large thead{font-size:16px}.smart-table.stb-cust-large tbody{font-size:15px}.smart-table.stb-cust-large td,.smart-table.stb-cust-large th{padding:12px 0}.smart-table.stb-cust-middle thead{font-size:15px}.smart-table.stb-cust-middle tbody{font-size:14px}.smart-table.stb-cust-middle td,.smart-table.stb-cust-middle th{padding:10px 0}.smart-table.stb-cust-left td,.smart-table.stb-cust-left th{text-align:left}.smart-table.stb-cust-right td,.smart-table.stb-cust-right th{text-align:right}.smart-table .stb_cell{overflow:hidden;text-overflow:ellipsis;white-space:normal;word-break:break-all;padding:0 4px;line-height:23px}.smart-table th>.stb_cell{display:inline-block;position:relative;vertical-align:middle}.smart-table .stb_body,.smart-table .stb_footer,.smart-table .stb_header{table-layout:fixed;border-collapse:separate;background:#fff}.smart-table .stb_header-wrapper{overflow:hidden}.smart-table .stb_body-wrapper{overflow:auto}.smart-table .stb_fixed,.smart-table .stb_fixed-right{position:absolute;top:0;left:0;overflow-x:hidden;overflow-y:hidden;box-shadow:0 -1px 8px rgba(0,0,0,0.08)}.smart-table .stb_fixed-right{top:0;left:auto;right:0;box-shadow:-1px 0 8px rgba(0,0,0,0.08)}.smart-table .stb_fixed-right .stb_fixed-body-wrapper,.smart-table .stb_fixed-right .stb_fixed-footer-wrapper,.smart-table .stb_fixed-right .stb_fixed-header-wrapper{left:auto;right:0}.smart-table .stb_fixed-right-patch{position:absolute;top:-1px;right:0;background-color:#F5F7FB}.smart-table .stb_fixed-header-wrapper{position:absolute;left:0;top:0;z-index:3}.smart-table .stb_fixed-body-wrapper{position:absolute;left:0;top:37px;overflow:hidden;z-index:3}.smart-table ::-webkit-scrollbar{width:8px;height:8px;background-color:#e9edf4}.smart-table ::-webkit-scrollbar-thumb{background-color:#ccc;border-radius:2em}.smart-table ::-webkit-scrollbar-thumb:hover{background-color:#9bbbfa}.smart-table *{box-sizing:border-box}\n',""]),t.exports=e},function(t,e,o){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var o=function(t,e){var o=t[1]||"",r=t[3];if(!r)return o;if(e&&"function"==typeof btoa){var i=(s=r,a=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),"/*# ".concat(l," */")),n=r.sources.map((function(t){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(t," */")}));return[o].concat(n).concat([i]).join("\n")}var s,a,l;return[o].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(o,"}"):o})).join("")},e.i=function(t,o){"string"==typeof t&&(t=[[null,t,""]]);for(var r=0;r<t.length;r++){var i=[].concat(t[r]);o&&(i[2]?i[2]="".concat(o," and ").concat(i[2]):i[2]=o),e.push(i)}},e}},function(t,e,o){"use strict";o.r(e);o(0);var r=function(t,e,o,r){if(!t.data||t.data.length<1)return;let n=function t(e,o,r,n){if(e.length<=1)return e;let s=[],a=[],l=e.length,d=Math.floor(l/2),f=e.splice(d,1)[0];for(let t=0;t<l-1;t++)i(e[t][o],f[o],r,n)?s.push(e[t]):a.push(e[t]);return t(s,o,r,n).concat(f,t(a,o,r,n))}(JSON.parse(JSON.stringify(t.data)),e,o,r);JSON.stringify(t.data)!==JSON.stringify(n)&&(!function(t,e){let o=0;for(let r=0;r<e.length;r++){const i=e[r];let n=0;for(;n<t.length;n++){const s=t[n];if(i.$key===s.$key){if(i.$el=s.$el,i.$fixedLeftEl=s.$fixedLeftEl,i.$fixedRightEl=s.$fixedRightEl,n<o){const t=e[r-1],o=t.$el.nextSibling;if(o.parentNode.insertBefore(s.$el,o),t.$fixedLeftEl){const e=t.$fixedLeftEl.nextSibling;e.parentNode.insertBefore(s.$fixedLeftEl,e)}if(t.$fixedRightEl){const e=t.$fixedRightEl.nextSibling;e.parentNode.insertBefore(s.$fixedRightEl,e)}}else o=n;break}}}}(t.data,n),t.data=n)};function i(t,e,o,r){return"number"===r&&(t=parseFloat(t),e=parseFloat(e)),"ASC"===o?t<e:t>e}function n(t,e){let o=document.createElement(t);return e&&(o.className=e),o}function s(t,e){return t.appendChild(e)}function a(t,e){return e.forEach(e=>{t.appendChild(e)}),t}function l(t,e){t.removeChild(e)}function d(t,e){return t.cloneNode(e)}function f(t,e){return t.querySelector(e)}function c(t,e){return t.querySelectorAll(e)}function h(t){let e=t.childNodes,o=n("div","stb_cell");for(;e.length;)s(o,e[0]);s(t,o)}function u(t,e,o,r){let i=n("div",t),l=n("table","stb_"+o);return l.style.width=e.size.tableWidth+"px",a(l,[p(e.colgroup),r]),s(i,l),i}function b(t,e,o){return Number.parseInt(t.getAttribute(e)||o)}function p(t){if(!t)return;let e=n("colgroup");return t.forEach(t=>{let o=n("col");o.setAttribute("width",t),s(e,o)}),e}function g(t,e,o){const r=d(e,!0);return c(r,"tr:first-child>th").forEach((t,e)=>{-1===o.thead.indexOf("field-"+e)&&t.classList.add("is-hidden")}),u("stb_fixed-header-wrapper",t,"header",r)}function x(t,e,o,r){const i=d(e,!0);c(i,"tr").forEach(t=>{let e=-1;c(t,"td").forEach((t,i)=>{"left"===r?e=i:e+=b(t,"colspan",1),-1===o.tbody.indexOf("field-"+e)&&t.classList.add("is-hidden")})});const n=u("stb_fixed-body-wrapper",t,"body",i);return n.style.top=t.$thead.offsetHeight+"px",n.style.height=t.size.tbodyWrapperHeight-(t.scrollX?t.gutterWidth:0)+"px",n}function y(t,e,o,r,i,s){const l=n("div",i);"right"===s&&(l.style.right=(t.scrollY?t.gutterWidth:0)+"px"),a(l,[e,o]),l.style.width=r.width+"px";let d=t.$root.offsetHeight-(t.scrollX?t.gutterWidth:2);const f=t.$thead.offsetHeight+t.$tbody.offsetHeight;return d=f>d?d:f,l.style.height=d+"px",l}let m;function A(t){const{$root:e,props:o}=t,r=e.offsetWidth-1,i=r-(t.scrollY?t.gutterWidth:0);let n=[],s=0;o.shapes.forEach(t=>{t.forEach((t,e)=>{if(t){1===b(t,"colspan",1)&&(n[e]=b(t,"width",0))}})});let a=0;if(n.forEach(t=>{s+=t,0===t&&a++}),a){const t=Math.floor((i-s)/a),e=t>80?t:80;let o=0;s=0,n=n.map((t,r)=>(0===t&&(t=e,o=r),s+=t,t)),i>s&&(n[o]=n[o]+i-s,s=i)}else s=n.reduce((t,e)=>e+t,0);t.colgroup=n,t.size.rootWidth=r,t.size.tableWidth=s,t.scrollX=t.size.tableWidth>t.size.rootWidth}function w(t){!function(t,e){let o;return function(){const r=this,i=arguments;function n(){e.apply(r,i)}o&&clearTimeout(o),o=setTimeout(n,t)}}(500,()=>{const{fixedLeft:e,fixedRight:o}=t.props;A(t),function(t){c(t.$root,"table").forEach(e=>{e.style.width=t.size.tableWidth+"px",e.replaceChild(p(t.colgroup),f(e,"colgroup"))})}(t),t.scrollY=t.$tbody.offsetHeight>t.size.tbodyWrapperHeight,t.$scrollTH.style.display=t.scrollY?"table-cell":"none";let r=t.$root.offsetHeight-(t.scrollX?t.gutterWidth:2);const i=t.$thead.offsetHeight+t.$tbody.offsetHeight;r=i>r?r:i;const n=t.size.tbodyWrapperHeight-(t.scrollX?t.gutterWidth:0),s=t.$thead.offsetHeight;let a=0,l=0;t.$fixedLeft&&e.thead.length&&(e.thead.forEach((e,o)=>{a+=t.colgroup[o]}),t.$fixedLeftBody.style.height=n+"px",t.$fixedLeftBody.style.top=s+"px",t.$fixedLeft.style.width=a+"px",t.$fixedLeft.style.height=r+"px"),t.$fixedRight&&o.thead.length&&(o.thead.forEach((e,o)=>{l+=t.colgroup[t.colgroup.length-o-1]}),t.$fixedRightBody.style.height=n+"px",t.$fixedRightBody.style.top=s+"px",t.$fixedRight.style.width=l+"px",t.$fixedRight.style.height=r+"px",t.$fixedRight.style.right=(t.scrollY?t.gutterWidth:0)+"px",t.$rightPatch.style.display=t.scrollY?"block":"none",t.$rightPatch.style.height=t.$thead.offsetHeight)})()}function v(t,e,o){e&&(e.addEventListener("mouseenter",()=>{e.style.background=t.style.hoverBgColor,o.forEach(e=>{e&&(e.style.background=t.style.hoverBgColor)})}),e.addEventListener("mouseleave",()=>{e.style.background="",o.forEach(t=>{t&&(t.style.background="")})}))}function $(t){this instanceof $||console.error("Smart Table is a constructor and should be called with the `new` keyword"),window.addEventListener("load",()=>{setTimeout(this._init(t),0)})}$.prototype._init=function(t={}){if(!t.selector)return console.error("Smart Table init need a selector");const e=String(t.selector).trim(),o=f(document,e);if(!o)return console.error("Smart Table "+e+" not found");const i=f(o,"table");if(!i)return console.error("Smart Table init need a table");const d=f(i,"thead");if(!d)return console.error("Smart Table init need a thead");const p=f(i,"tbody");if(!p)return console.error("Smart Table init need a tbody");o.classList.add("smart-table"),t.size&&o.classList.add("stb-cust-"+t.size),t.align&&o.classList.add("stb-cust-"+t.align),i.hasAttribute("stripe")&&p.classList.add("stripe");const $=this;$.$root=o,$.$thead=d,$.$tbody=p,$.options=t,$.gutterWidth=function(){if(void 0!==m)return m;const t=n("div","smart-table");s(document.body,t);const e=n("div");e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",s(t,e);const o=e.offsetWidth;e.style.overflow="scroll";const r=n("div");r.style.width="100%",s(e,r);const i=r.offsetWidth;return l(t.parentNode,t),m=o-i,m}(),$.style={hoverBgColor:t.hoverBgColor||"#EFF8FF"},$.size={},function(t){let e={},o=[];c(t.$thead,"tr").forEach((t,e)=>{let r=o[e]||[];c(t,"th").forEach(t=>{let i=b(t,"rowspan",1),n=b(t,"colspan",1),s=function(t){for(let e=0,o=t.length;e<o;e++)if(void 0===t[e])return e}(r)||r.length;if(r[s]=t,t.hasAttribute("sort")&&t.setAttribute("sortkey","field-"+s),n>1)for(let t=1;t<n;t++)r[s+t]=0;if(i>1)for(let t=1;t<i;t++){let r=o[e+t]||[];for(let t=0;t<n;t++)r[s+t]=0;o[e+t]=r}o[e]=r})}),e.shapes=o,t.props=e}($),function(t,e){const{$root:o,$thead:r,$tbody:i,options:n}=t,{height:s}=n;c(r,"th").forEach(t=>h(t)),c(i,"td").forEach(t=>h(t)),A(t),t.$theadWrapper=u("stb_header-wrapper",t,"header",r),t.$tbodyWrapper=u("stb_body-wrapper",t,"body",i),a(o,[t.$theadWrapper,t.$tbodyWrapper]);const d=r.offsetHeight,f=("function"==typeof s?s.call():s)||o.offsetHeight,b=f>d?f-d-1:d+150;t.$tbodyWrapper.style.height=b+"px",t.size.tbodyWrapperHeight=b,t.scrollY=t.$tbody.offsetHeight>b,l(e.parentNode,e)}($,i),function(t){let{colgroup:e,props:o}=t;const r=e.length;let i={thead:[],tbody:[],width:0},n={thead:[],tbody:[],width:0};const s=c(t.$thead,"tr:first-child>th"),a=s.length;let l=0;if(0!==a){if(s[0].hasAttribute("fixed"))for(let t=0;t<a-1&&s[t].hasAttribute("fixed");t++){l=t,i.thead.push("field-"+t);let o=b(s[t],"colspan",1);for(let r=0;r<o;r++)i.tbody.push("field-"+(t+r)),i.width+=e[t+r]}if(s[a-1].hasAttribute("fixed")){let t=0;for(let o=a-1;o>0&&s[o].hasAttribute("fixed")&&o!==l;o--){n.thead.push("field-"+o);let i=b(s[o],"colspan",1);for(let o=0;o<i;o++)t++,n.tbody.push("field-"+(r-t)),n.width+=e[r-t]}}}o.fixedLeft=i,o.fixedRight=n}($),function(t,e,o){let r=320;const{fixedLeft:i,fixedRight:a}=t.props;if(i.thead.length>0){r=r>i.width?r:i.width;const n=g(t,e,i),a=x(t,o,i,"left");t.$fixedLeft=y(t,n,a,i,"stb_fixed","left"),s(t.$root,t.$fixedLeft),t.$fixedLeftBody=a}if(a.thead.length>0){r+=a.width;const i=g(t,e,a),l=x(t,o,a,"right");t.$fixedRight=y(t,i,l,a,"stb_fixed-right","right"),s(t.$root,t.$fixedRight),t.$fixedRightBody=l;let d=n("div","stb_fixed-right-patch");d.style.display="none",d.style.width=t.gutterWidth+"px",d.style.height=t.$thead.offsetHeight+"px",s(t.$root,d),t.$rightPatch=d,t.scrollY&&(t.$rightPatch.style.display="block")}t.$root.style.minWidth=r+"px"}($,d,p),function(t,e){let o=t.$fixedLeftBody&&c(t.$fixedLeftBody,"tbody tr"),r=t.$fixedRightBody&&c(t.$fixedRightBody,"tbody tr"),i=[],n=[];c(e,"tr").forEach((t,e)=>{let s={$el:t,$fixedLeftEl:o&&o[e],$fixedRightEl:r&&r[e],$key:"$$rowkey"+e};c(t,"td .stb_cell").forEach((t,e)=>{s["field-"+e]=t.innerHTML}),t.hasAttribute("unsort")?n.push(s):i.push(s)}),t.data=i,t.unsortData=n}($,p),function(t){(function(t){t.$tbodyWrapper.addEventListener("scroll",()=>function(t){!function(t,e){let o,r=0;return function(){const i=this,n=(new Date).getTime()-r,s=arguments;function a(){r=(new Date).getTime(),e.apply(i,s)}o&&clearTimeout(o),n>t?a():o=setTimeout(a,t-n)}}(20,()=>{t.$theadWrapper.scrollLeft=t.$tbodyWrapper.scrollLeft,t.$fixedLeftBody&&(t.$fixedLeftBody.scrollTop=t.$tbodyWrapper.scrollTop),t.$fixedRightBody&&(t.$fixedRightBody.scrollTop=t.$tbodyWrapper.scrollTop)})()}(t),{passive:!0})})(t),function(t){[].concat(t.data,t.unsortData).forEach(e=>{v(t,e.$el,[e.$fixedLeftEl,e.$fixedRightEl]),e.$fixedLeftEl&&v(t,e.$fixedLeftEl,[e.$el,e.$fixedRightEl]),e.$fixedRightEl&&v(t,e.$fixedRightEl,[e.$el,e.$fixedLeftEl])})}(t),function(t){let e=Array.from(c(t.$root,"th[sort]"));0!==e.length&&e.forEach(o=>{o.addEventListener("click",i=>{i.stopPropagation();let n="ASC",s=o.getAttribute("sort")||"string";o.classList.contains("asc")?(o.classList.remove("asc"),o.classList.add("desc"),n="DESC"):(o.classList.remove("desc"),o.classList.add("asc")),e=e.map(t=>(o!=t&&t.classList.remove("asc","desc"),t)),r(t,o.getAttribute("sortkey"),n,s)})})}(t),function(t){window.addEventListener("resize",()=>w(t),{passive:!0})}(t)}($);const E=n("th");E.style.display="none",E.setAttribute("width",$.gutterWidth),E.setAttribute("rowspan",$.props.shapes.length),s(f($.$thead,"tr"),E),$.$scrollTH=E,$.scrollY&&($.$scrollTH.style.display="table-cell",w($))};var E=$;window.SmartTable=E}]);