Files
smart-table/dist/smartTable.min.js
2020-02-06 22:47:17 +08:00

1 line
19 KiB
JavaScript

/*! smartTable v1.1.2 | (c) pengyajun 2020 | Released under the MIT License. */!function(t){var e={};function r(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=t,r.c=e,r.d=function(t,e,o){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(o,i,function(e){return t[e]}.bind(null,i));return o},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=4)}([function(t,e,r){var o=r(1),i=r(2);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[t.i,i,""]]);var n={insert:"head",singleton:!1},a=(o(t.i,i,n),i.locals?i.locals:{});t.exports=a},function(t,e,r){"use strict";var o,i=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},n=function(){var t={};return function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}t[e]=r}return t[e]}}(),a={};function s(t,e,r){for(var o=0;o<e.length;o++){var i={css:e[o][1],media:e[o][2],sourceMap:e[o][3]};a[t][o]?a[t][o](i):a[t].push(b(i,r))}}function l(t){var e=document.createElement("style"),o=t.attributes||{};if(void 0===o.nonce){var i=r.nc;i&&(o.nonce=i)}if(Object.keys(o).forEach((function(t){e.setAttribute(t,o[t])})),"function"==typeof t.insert)t.insert(e);else{var a=n(t.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(e)}return e}var d,c=(d=[],function(t,e){return d[t]=e,d.filter(Boolean).join("\n")});function f(t,e,r,o){var i=r?"":o.css;if(t.styleSheet)t.styleSheet.cssText=c(e,i);else{var n=document.createTextNode(i),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(n,a[e]):t.appendChild(n)}}function h(t,e,r){var o=r.css,i=r.media,n=r.sourceMap;if(i?t.setAttribute("media",i):t.removeAttribute("media"),n&&btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(n))))," */")),t.styleSheet)t.styleSheet.cssText=o;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(o))}}var p=null,u=0;function b(t,e){var r,o,i;if(e.singleton){var n=u++;r=p||(p=l(e)),o=f.bind(null,r,n,!1),i=f.bind(null,r,n,!0)}else r=l(e),o=h.bind(null,r,e),i=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(r)};return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else i()}}t.exports=function(t,e,r){return(r=r||{}).singleton||"boolean"==typeof r.singleton||(r.singleton=i()),t=r.base?t+r.base:t,e=e||[],a[t]||(a[t]=[]),s(t,e,r),function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){a[t]||(a[t]=[]),s(t,e,r);for(var o=e.length;o<a[t].length;o++)a[t][o]();a[t].length=e.length,0===a[t].length&&delete a[t]}}}},function(t,e,r){(e=r(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 tr{-webkit-transition:background-color .25s ease;transition:background-color .25s ease}.smart-table tbody{font-size:12px}.smart-table tbody tr[expand] td:first-child{cursor:pointer}.smart-table tbody tr[expand] td:first-child :before{-webkit-transition:0.35s ease transform;transition:0.35s ease transform;-webkit-transform-origin:25% 50%;transform-origin:25% 50%;content:'';float:left;width:0;height:0;border-width:6px;border-style:solid;border-color:transparent transparent transparent #c0c4cc;margin:5px 0 0 5px}.smart-table tbody tr[expand][expanded]>td:first-child>:before{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.smart-table tbody.stripe tr:nth-child(2n){background-color:#F9FBFF}.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] :before,.smart-table th[sort] :after{content:'';float:right;width:0;height:0;border-width:5px;border-style:solid}.smart-table th[sort] :before{margin:1px 0 0 -10px;border-color:transparent transparent #c0c4cc transparent}.smart-table th[sort] :after{margin:12px 0 0 4px;border-color:#c0c4cc transparent transparent transparent}.smart-table th[sort].desc :after{border-top-color:#409eff}.smart-table th[sort].asc :before{border-bottom-color:#409eff}.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:#919191}.smart-table *{box-sizing:border-box}\n",""]),t.exports=e},function(t,e,r){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r=function(t,e){var r=t[1]||"",o=t[3];if(!o)return r;if(e&&"function"==typeof btoa){var i=(a=o,s=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(l," */")),n=o.sources.map((function(t){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(t," */")}));return[r].concat(n).concat([i]).join("\n")}var a,s,l;return[r].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(r,"}"):r})).join("")},e.i=function(t,r){"string"==typeof t&&(t=[[null,t,""]]);for(var o=0;o<t.length;o++){var i=[].concat(t[o]);r&&(i[2]?i[2]="".concat(r," and ").concat(i[2]):i[2]=r),e.push(i)}},e}},function(t,e,r){"use strict";r.r(e);r(0);var o=function(t,e,r,o){if(!t.data||t.data.length<1)return;let n=function t(e,r,o,n){if(e.length<=1)return e;let a=[],s=[],l=e.length,d=Math.floor(l/2),c=e.splice(d,1)[0];for(let t=0;t<l-1;t++)i(e[t][r],c[r],o,n)?a.push(e[t]):s.push(e[t]);return t(a,r,o,n).concat(c,t(s,r,o,n))}(JSON.parse(JSON.stringify(t.data)),e,r,o);JSON.stringify(t.data)!==JSON.stringify(n)&&(!function(t,e){let r=0;for(let o=0;o<e.length;o++){const i=e[o];let n=0;for(;n<t.length;n++){const a=t[n];if(i.$key===a.$key){if(i.$el=a.$el,i.$fixedLeftEl=a.$fixedLeftEl,i.$fixedRightEl=a.$fixedRightEl,n<r){const t=e[o-1],r=t.$el.nextSibling;if(r.parentNode.insertBefore(a.$el,r),t.$fixedLeftEl){const e=t.$fixedLeftEl.nextSibling;e.parentNode.insertBefore(a.$fixedLeftEl,e)}if(t.$fixedRightEl){const e=t.$fixedRightEl.nextSibling;e.parentNode.insertBefore(a.$fixedRightEl,e)}}else r=n;break}}}}(t.data,n),t.data=n)};function i(t,e,r,o){return"number"===o&&(t=parseFloat(t),e=parseFloat(e)),"ASC"===r?t<e:t>e}function n(t,e){let r=document.createElement(t);return e&&(r.className=e),r}function a(t,e){return t.appendChild(e)}function s(t,e){return t.hasAttribute(e)}function l(t,e,r){return t.setAttribute(e,r||!0)}function d(t,e){return t.getAttribute(e)}function c(t,e){return t.removeAttribute(e)}function f(t,e){return e.forEach(e=>{t.appendChild(e)}),t}function h(t,e){t.removeChild(e)}function p(t,e){return t.cloneNode(e)}function u(t,e){return t.querySelector(e)}function b(t,e){return t.querySelectorAll(e)}function g(t){let e=t.childNodes,r=n("div","stb_cell");for(;e.length;)a(r,e[0]);a(t,r)}function x(t,e,r,o){let i=n("div",t),s=n("table","stb_"+r);return s.style.width=e.size.tableWidth+"px",f(s,[m(e.colgroup),o]),a(i,s),i}function y(t,e,r){return Number.parseInt(d(t,e)||r)}function m(t){if(!t)return;let e=n("colgroup");return t.forEach(t=>{let r=n("col");r.setAttribute("width",t),a(e,r)}),e}function $(t,e,r){const o=p(e,!0);return b(o,"tr:first-child>th").forEach((t,e)=>{-1===r.thead.indexOf("field-"+e)&&t.classList.add("is-hidden")}),x("stb_fixed-header-wrapper",t,"header",o)}function v(t,e,r,o){const i=p(e,!0);b(i,"tr").forEach(t=>{let e=-1;b(t,"td").forEach((t,i)=>{"left"===o?e=i:e+=y(t,"colspan",1),-1===r.tbody.indexOf("field-"+e)&&t.classList.add("is-hidden")})});const n=x("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 w(t,e,r,o,i,a){const s=n("div",i);"right"===a&&(s.style.right=(t.scrollY?t.gutterWidth:0)+"px"),f(s,[e,r]),s.style.width=o.width+"px";let l=t.$root.offsetHeight-(t.scrollX?t.gutterWidth:2);const d=t.$thead.offsetHeight+t.$tbody.offsetHeight;return l=d>l?l:d,s.style.height=l+"px",s}let E;function L(t){const{$root:e,props:r}=t,o=e.offsetWidth-1,i=o-(t.scrollY?t.gutterWidth:0);let n=[],a=0;r.shapes.forEach(t=>{t.forEach((t,e)=>{if(t){1===y(t,"colspan",1)&&(n[e]=y(t,"width",0))}})});let s=0;if(n.forEach(t=>{a+=t,0===t&&s++}),s){const t=Math.floor((i-a)/s),e=t>80?t:80;let r=0;a=0,n=n.map((t,o)=>(0===t&&(t=e,r=o),a+=t,t)),i>a&&(n[r]=n[r]+i-a,a=i)}else a=n.reduce((t,e)=>e+t,0);t.colgroup=n,t.size.rootWidth=o,t.size.tableWidth=a,t.scrollX=t.size.tableWidth>t.size.rootWidth}function k(t){!function(t,e){let r;return function(){const o=this,i=arguments;function n(){e.apply(o,i)}r&&clearTimeout(r),r=setTimeout(n,t)}}(500,()=>{const{fixedLeft:e,fixedRight:r}=t.props;L(t),function(t){b(t.$root,"table").forEach(e=>{e.style.width=t.size.tableWidth+"px",e.replaceChild(m(t.colgroup),u(e,"colgroup"))})}(t),t.scrollY=t.$tbody.offsetHeight>t.size.tbodyWrapperHeight,t.$scrollTH.style.display=t.scrollY?"table-cell":"none";let o=t.$root.offsetHeight-(t.scrollX?t.gutterWidth:2);const i=t.$thead.offsetHeight+t.$tbody.offsetHeight;o=i>o?o:i;const n=t.size.tbodyWrapperHeight-(t.scrollX?t.gutterWidth:0),a=t.$thead.offsetHeight;let s=0,l=0;t.$fixedLeft&&e.thead.length&&(e.thead.forEach((e,r)=>{s+=t.colgroup[r]}),t.$fixedLeftBody.style.height=n+"px",t.$fixedLeftBody.style.top=a+"px",t.$fixedLeft.style.width=s+"px",t.$fixedLeft.style.height=o+"px"),t.$fixedRight&&r.thead.length&&(r.thead.forEach((e,r)=>{l+=t.colgroup[t.colgroup.length-r-1]}),t.$fixedRightBody.style.height=n+"px",t.$fixedRightBody.style.top=a+"px",t.$fixedRight.style.width=l+"px",t.$fixedRight.style.height=o+"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+"px")})()}function _(t,e,r){e&&(e.addEventListener("mouseenter",()=>{e.style.background=t.style.hoverBgColor,r.forEach(e=>{e&&(e.style.background=t.style.hoverBgColor)})}),e.addEventListener("mouseleave",()=>{e.style.background="",r.forEach(t=>{t&&(t.style.background="")})}))}function W(t){this instanceof W||console.error("Smart Table is a constructor and should be called with the `new` keyword"),window.addEventListener("load",()=>{setTimeout(this._init(t),0)})}W.prototype._init=function(t={}){if(!t.selector)return console.error("Smart Table init need a selector");const e=String(t.selector).trim(),r=u(document,e);if(!r)return console.error("Smart Table "+e+" not found");const i=u(r,"table");if(!i)return console.error("Smart Table init need a table");const p=u(i,"thead");if(!p)return console.error("Smart Table init need a thead");const m=u(i,"tbody");if(!m)return console.error("Smart Table init need a tbody");r.classList.add("smart-table"),t.size&&r.classList.add("stb-cust-"+t.size),t.align&&r.classList.add("stb-cust-"+t.align),s(i,"stripe")&&m.classList.add("stripe"),t.expand?(b(p,"th[sort]").forEach(t=>{c(t,"sort")}),b(p,"th[fixed]").forEach(t=>{c(t,"fixed")})):(b(m,"tr[expand]").forEach(t=>{c(t,"expand")}),b(p,"tr[expand-parent]").forEach(t=>{c(t,"expand-parent")}));const W=this;W.$root=r,W.$thead=p,W.$tbody=m,W.options=t,W.gutterWidth=function(){if(void 0!==E)return E;const t=n("div","smart-table");a(document.body,t);const e=n("div");e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",a(t,e);const r=e.offsetWidth;e.style.overflow="scroll";const o=n("div");o.style.width="100%",a(e,o);const i=o.offsetWidth;return h(t.parentNode,t),E=r-i,E}(),W.style={hoverBgColor:t.hoverBgColor||"#EFF8FF"},W.size={},function(t){let e={},r=[];b(t.$thead,"tr").forEach((t,e)=>{let o=r[e]||[];b(t,"th").forEach(t=>{let i=y(t,"rowspan",1),n=y(t,"colspan",1),a=function(t){for(let e=0,r=t.length;e<r;e++)if(void 0===t[e])return e}(o)||o.length;if(o[a]=t,s(t,"sort")&&l(t,"sortkey","field-"+a),n>1)for(let t=1;t<n;t++)o[a+t]=0;if(i>1)for(let t=1;t<i;t++){let o=r[e+t]||[];for(let t=0;t<n;t++)o[a+t]=0;r[e+t]=o}r[e]=o})}),e.shapes=r,t.props=e}(W),function(t,e){const{$root:r,$thead:o,$tbody:i,options:n}=t,{height:a}=n;b(o,"th").forEach(t=>g(t)),b(i,"td").forEach(t=>g(t)),L(t),t.$theadWrapper=x("stb_header-wrapper",t,"header",o),t.$tbodyWrapper=x("stb_body-wrapper",t,"body",i),f(r,[t.$theadWrapper,t.$tbodyWrapper]);const s=o.offsetHeight,l=("function"==typeof a?a.call():a)||r.offsetHeight,d=l>s?l-s-1:s+150;t.$tbodyWrapper.style.height=d+"px",t.size.tbodyWrapperHeight=d,t.scrollY=t.$tbody.offsetHeight>d,h(e.parentNode,e)}(W,i),t.expand||(function(t){let{colgroup:e,props:r}=t;const o=e.length;let i={thead:[],tbody:[],width:0},n={thead:[],tbody:[],width:0};const a=b(t.$thead,"tr:first-child>th"),l=a.length;let d=0;if(0!==l){if(s(a[0],"fixed"))for(let t=0;t<l-1&&s(a[t],"fixed");t++){d=t,i.thead.push("field-"+t);let r=y(a[t],"colspan",1);for(let o=0;o<r;o++)i.tbody.push("field-"+(t+o)),i.width+=e[t+o]}if(s(a[l-1],"fixed")){let t=0;for(let r=l-1;r>0&&s(a[r],"fixed")&&r!==d;r--){n.thead.push("field-"+r);let i=y(a[r],"colspan",1);for(let r=0;r<i;r++)t++,n.tbody.push("field-"+(o-t)),n.width+=e[o-t]}}}r.fixedLeft=i,r.fixedRight=n}(W),function(t,e,r){let o=320;const{fixedLeft:i,fixedRight:s}=t.props;if(i.thead.length>0){o=o>i.width?o:i.width;const n=$(t,e,i),s=v(t,r,i,"left");t.$fixedLeft=w(t,n,s,i,"stb_fixed","left"),a(t.$root,t.$fixedLeft),t.$fixedLeftBody=s}if(s.thead.length>0){o+=s.width;const i=$(t,e,s),l=v(t,r,s,"right");t.$fixedRight=w(t,i,l,s,"stb_fixed-right","right"),a(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",a(t.$root,d),t.$rightPatch=d,t.scrollY&&(t.$rightPatch.style.display="block")}t.$root.style.minWidth=o+"px"}(W,p,m)),function(t,e){let r=t.$fixedLeftBody&&b(t.$fixedLeftBody,"tbody tr"),o=t.$fixedRightBody&&b(t.$fixedRightBody,"tbody tr"),i=[],n=[];b(e,"tr").forEach((t,e)=>{let a={$el:t,$fixedLeftEl:r&&r[e],$fixedRightEl:o&&o[e],$key:"$$rowkey"+e};b(t,"td .stb_cell").forEach((t,e)=>{a["field-"+e]=t.innerHTML}),s(t,"unsort")?n.push(a):i.push(a)}),t.data=i,t.unsortData=n}(W,m),t.expand&&function(t,e){const r=t.options.defaultExpandAll;let o=[],i=[];b(e,"tr").forEach(t=>{let e=i.length,n=s(t,"expand"),a=s(t,"expand-parent"),f={$el:t,id:d(t,"expand"),expand:n};if(n&&(r?l(t,"expanded"):c(t,"expanded")),n&&!a)f.children=[],i=[f],o.push(f);else if(a){let r=d(t,"expand-parent"),o=[];for(let t=0;t<i.length&&(o.push(i[t]),i[t].id!==r);t++);i=o,e=i.length;let a=i[i.length-1];a&&a.children.push(f),n&&(i.push(f),f.children=[])}else o.push(f);a&&(u(t,"td").style.paddingLeft=20*e+"px",t.style.display=r?"":"none")}),t.expandData=o,t.$tbodyWrapper.style.height=""}(W,m),function(t){(function(t){t.$tbodyWrapper.addEventListener("scroll",()=>function(t){!function(t,e){let r,o=0;return function(){const i=this,n=(new Date).getTime()-o,a=arguments;function s(){o=(new Date).getTime(),e.apply(i,a)}r&&clearTimeout(r),n>t?s():r=setTimeout(s,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=>{_(t,e.$el,[e.$fixedLeftEl,e.$fixedRightEl]),e.$fixedLeftEl&&_(t,e.$fixedLeftEl,[e.$el,e.$fixedRightEl]),e.$fixedRightEl&&_(t,e.$fixedRightEl,[e.$el,e.$fixedLeftEl])})}(t),t.options.expand?function(t){!function t(e){e.forEach(e=>{e.expand&&(u(e.$el,"td").addEventListener("click",()=>{!function t(e,r){r?l(e.$el,"expanded"):c(e.$el,"expanded"),e.children&&e.children.forEach(e=>{e.$el.style.display=r?"":"none",t(e,r)})}(e,!s(e.$el,"expanded"))}),e.children&&t(e.children))})}(t.expandData)}(t):function(t){let e=Array.from(b(t.$root,"th[sort]"));0!==e.length&&e.forEach(r=>{r.addEventListener("click",i=>{i.stopPropagation();let n="ASC",a=d(r,"sort")||"string";r.classList.contains("asc")?(r.classList.remove("asc"),r.classList.add("desc"),n="DESC"):(r.classList.remove("desc"),r.classList.add("asc")),e=e.map(t=>(r!=t&&t.classList.remove("asc","desc"),t)),o(t,d(r,"sortkey"),n,a)})})}(t),function(t){window.addEventListener("resize",()=>k(t),{passive:!0})}(t)}(W);const S=n("th");S.style.display="none",l(S,"width",W.gutterWidth),l(S,"rowspan",W.props.shapes.length),a(u(W.$thead,"tr"),S),W.$scrollTH=S,W.scrollY&&(W.$scrollTH.style.display="table-cell",k(W))};var S=W;window.SmartTable=S}]);