diff --git a/README.md b/README.md
index ba7ebd1..586fef1 100644
--- a/README.md
+++ b/README.md
@@ -47,8 +47,8 @@
价格 |
- | DD001 |
- 2020-01-31 |
+ DD001 |
+ 2020-01-31 |
...
889.00 |
@@ -80,6 +80,8 @@
| stripe | table | 表格是否需要斑马间隔色 |
| fixed | thead -> tr -> th | 是否固定该列 |
| sort | thead -> tr -> th | 是否对该列有排序功能(默认按照string排序,可指定为sort="number" ) |
+| align | th or td | 对某一单元格指定水平排列方式 |
+| nowrap | th or td | 对某一单元格指定内容是否允许换行 |
| unsort | tbody -> tr | 可指定body中的某一行不参与排序 |
| expand | tbody -> tr | 可指定body中的某一行是否需要展开, 指定expand="001" 001为当前行的ID |
| expand-parent | tbody -> tr | 可指定body中的某一行是子项, 指定expand-parent="001" 001为父级ID |
diff --git a/dist/smartTable.min.js b/dist/smartTable.min.js
index c09388f..ddeffc9 100644
--- a/dist/smartTable.min.js
+++ b/dist/smartTable.min.js
@@ -1 +1 @@
-/*! smartTable v1.2.1 | (c) pengyajun 2020 | Released under the MIT License. */!function(e){var t={};function r(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(o,i,function(t){return e[t]}.bind(null,i));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createElement=function(e,t){var r=document.createElement(e);return t&&(r.className=t),r},t.appendChild=function(e,t){return e.appendChild(t)},t.hasAttribute=function(e,t){return e.hasAttribute(t)},t.setAttribute=function(e,t,r){return e.setAttribute(t,r||!0)},t.getAttribute=function(e,t){return e.getAttribute(t)},t.removeAttribute=function(e,t){return e.removeAttribute(t)},t.appendChildren=function(e,t){return t.forEach((function(t){e.appendChild(t)})),e},t.insertBefore=function(e,t,r){e.insertBefore(t,r)},t.nextSibling=function(e){return e.nextSibling},t.removeChild=function(e,t){e.removeChild(t)},t.cloneNode=function(e,t){return e.cloneNode(t)},t.querySelector=function(e,t){return e.querySelector(t)},t.querySelectorAll=function(e,t){return e.querySelectorAll(t)},t.offsetHeight=function(e){return e.offsetHeight},t.offsetWidth=function(e){return e.offsetWidth},t.styled=function(e,t){for(var r in t)e.style[r]=t[r];return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.refactorCell=function(e){var t=e.childNodes,r=(0,o.createElement)("div","stb_cell");for(;t.length;)(0,o.appendChild)(r,t[0]);(0,o.appendChild)(e,r)},t.createCheckbox=function(e,t){if(!e)return;var r=(0,o.createElement)(e);(0,o.setAttribute)(r,"rowspan",t);var i=(0,o.createElement)("label","std-checkbox"),n=(0,o.createElement)("span","std-checkbox_input");return(0,o.appendChild)(n,(0,o.createElement)("span","std-checkbox_inner")),(0,o.appendChild)(i,n),(0,o.appendChild)(r,i),r},t.createTableWrapper=function(e,t,r,n){var a=(0,o.createElement)("div",e),l=(0,o.createElement)("table","stb_"+r);return(0,o.styled)(l,{width:t.size.tableWidth+"px"}),(0,o.appendChildren)(l,[i(t.colgroup),n]),(0,o.appendChild)(a,l),a},t.replaceColGroup=function(e){(0,o.querySelectorAll)(e.$root,"table").forEach((function(t){(0,o.styled)(t,{width:e.size.tableWidth+"px"}),t.replaceChild(i(e.colgroup),(0,o.querySelector)(t,"colgroup"))}))},t.getAttrNumber=function(e,t,r){return Number.parseInt((0,o.getAttribute)(e,t)||r)},t.getEmptyIndexInArray=function(e){for(var t=0,r=e.length;te?l():r=setTimeout(l,e-n)}},t.debounce=function(e,t){var r=void 0;return function(){var o=this,i=arguments;function n(){t.apply(o,i)}r&&clearTimeout(r),r=setTimeout(n,e)}};var o=r(0);function i(e){if(e){var t=(0,o.createElement)("colgroup");return e.forEach((function(e){var r=(0,o.createElement)("col");(0,o.setAttribute)(r,"width",e),(0,o.appendChild)(t,r)})),t}}},function(e,t,r){"use strict";var o,i=r(3),n=(o=i)&&o.__esModule?o:{default:o};window.SmartTable=n.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(4);var o,i=r(8);function n(e){var t=this;this instanceof n||console.error("Smart Table is a constructor and should be called with the `new` keyword"),window.addEventListener("load",(function(){setTimeout(t._init(e),0)}))}(0,((o=i)&&o.__esModule?o:{default:o}).default)(n),t.default=n},function(e,t,r){var o=r(5),i=r(6);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var n={insert:"head",singleton:!1},a=(o(e.i,i,n),i.locals?i.locals:{});e.exports=a},function(e,t,r){"use strict";var o,i=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},n=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),a={};function l(e,t,r){for(var o=0;otd: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 th[align="left"],.smart-table td[align="left"]{text-align:left}.smart-table th[nowrap] .stb_cell,.smart-table td[nowrap] .stb_cell{white-space:nowrap}.smart-table .std-checkbox_inner{display:inline-block;position:relative;border:1px solid #dcdfe6;border-radius:2px;box-sizing:border-box;width:14px;height:14px;background-color:#fff;z-index:1;-webkit-transition:border-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46),background-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46);transition:border-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46),background-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46)}.smart-table .std-checkbox_inner:after{box-sizing:content-box;content:"";border:1px solid #fff;border-left:0;border-top:0;height:7px;left:4px;position:absolute;top:1px;-webkit-transform:rotate(45deg) scaleY(0);transform:rotate(45deg) scaleY(0);width:3px;-webkit-transition:-webkit-transform .15s ease-in .05s;transition:-webkit-transform .15s ease-in .05s;transition:transform .15s ease-in .05s;transition:transform .15s ease-in .05s, -webkit-transform .15s ease-in .05s;-webkit-transform-origin:center;transform-origin:center}.smart-table .std-checkbox_input{white-space:nowrap;cursor:pointer;outline:none;display:inline-block;line-height:1;position:relative;vertical-align:middle}.smart-table .std-checkbox{color:#606266;font-weight:500;font-size:14px;position:relative;cursor:pointer;display:inline-block;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.smart-table .std-checkbox[checked]>.std-checkbox_input>.std-checkbox_inner{background-color:#409eff;border-color:#409eff}.smart-table .std-checkbox[checked]>.std-checkbox_input>.std-checkbox_inner:after{-webkit-transform:rotate(45deg) scaleY(1);transform:rotate(45deg) scaleY(1)}.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',""]),e.exports=t},function(e,t,r){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=function(e,t){var r=e[1]||"",o=e[3];if(!o)return r;if(t&&"function"==typeof btoa){var i=(a=o,l=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),d="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(l),"/*# ".concat(d," */")),n=o.sources.map((function(e){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(e," */")}));return[r].concat(n).concat([i]).join("\n")}var a,l,d;return[r].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r){"string"==typeof e&&(e=[[null,e,""]]);for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:{};if(!e.selector)return console.error("Smart Table init need a selector");var t=String(e.selector).trim(),r=(0,i.querySelector)(document,t);if(!r)return console.error("Smart Table "+t+" not found");var o=(0,i.querySelector)(r,"table");if(!o)return console.error("Smart Table init need a table");var a=(0,i.querySelector)(o,"thead");if(!a)return console.error("Smart Table init need a thead");var d=(0,i.querySelector)(o,"tbody");if(!d)return console.error("Smart Table init need a tbody");r.classList.add("smart-table"),e.size&&r.classList.add("stb-cust-"+e.size),e.align&&r.classList.add("stb-cust-"+e.align),(0,i.hasAttribute)(o,"stripe")&&d.classList.add("stripe"),e.expand?((0,i.querySelectorAll)(a,"th[sort]").forEach((function(e){(0,i.removeAttribute)(e,"sort")})),(0,i.querySelectorAll)(a,"th[fixed]").forEach((function(e){(0,i.removeAttribute)(e,"fixed")}))):((0,i.querySelectorAll)(d,"tr[expand]").forEach((function(e){(0,i.removeAttribute)(e,"expand")})),(0,i.querySelectorAll)(a,"tr[expand-parent]").forEach((function(e){(0,i.removeAttribute)(e,"expand-parent")})));var f=this;f.$root=r,f.$thead=a,f.$tbody=d,f.options=e,f.gutterWidth=(0,l.default)(),f.style={radioBgColor:e.radioBgColor||"#D1E7FF",hoverBgColor:e.hoverBgColor||"#EFF8FF"},f.size={},f.hasCheckbox=!e.expand&&"checkbox"===e.selection,f.hasCheckbox&&s(f),g(f),c(f,o),e.expand||(x(f),(0,n.default)(f,a,d)),v(f,d),e.expand&&m(f,d),u(f);var b=(0,i.createElement)("th");(0,i.styled)(b,{display:"none"}),(0,i.setAttribute)(b,"width",f.gutterWidth),(0,i.setAttribute)(b,"rowspan",f.props.shapes.length),(0,i.appendChild)((0,i.querySelector)(f.$thead,"tr"),b),f.$scrollTH=b,f.scrollY&&((0,i.styled)(f.$scrollTH,{display:"table-cell"}),h(f))}};var o=d(r(9)),i=r(0),n=d(r(10)),a=r(1),l=d(r(11));function d(e){return e&&e.__esModule?e:{default:e}}function s(e){var t=e.$thead,r=e.$tbody,o=(0,i.querySelector)(t,"tr"),n=o.querySelector("th"),l=(0,a.createCheckbox)("th",(0,a.getAttrNumber)(n,"rowspan",1));(0,i.hasAttribute)(n,"fixed")&&(0,i.setAttribute)(l,"fixed"),(0,i.insertBefore)(o,l,n),(0,i.querySelectorAll)(r,"tr").forEach((function(e){var t=e.querySelector("td");(0,i.insertBefore)(e,(0,a.createCheckbox)("td",(0,a.getAttrNumber)(t,"rowspan",1)),t)}))}function c(e,t){var r=e.$root,o=e.$thead,n=e.$tbody,l=e.options.height;(0,i.querySelectorAll)(o,"th").forEach((function(e){return(0,a.refactorCell)(e)})),(0,i.querySelectorAll)(n,"td").forEach((function(e){return(0,a.refactorCell)(e)})),f(e),e.$theadWrapper=(0,a.createTableWrapper)("stb_header-wrapper",e,"header",o),e.$tbodyWrapper=(0,a.createTableWrapper)("stb_body-wrapper",e,"body",n),(0,i.appendChildren)(r,[e.$theadWrapper,e.$tbodyWrapper]);var d=(0,i.offsetHeight)(o),s=("function"==typeof l?l.call():l)||(0,i.offsetHeight)(r),c=s>d?s-d-1:d+150;(0,i.styled)(e.$tbodyWrapper,{height:c+"px"}),e.size.tbodyWrapperHeight=c,e.scrollY=(0,i.offsetHeight)(e.$tbody)>c,(0,i.removeChild)(t.parentNode,t)}function f(e){var t=e.$root,r=e.props,o=(0,i.offsetWidth)(t)-1,n=o-(e.scrollY?e.gutterWidth:0),l=[],d=0;r.shapes.forEach((function(e){e.forEach((function(e,t){e&&(1===(0,a.getAttrNumber)(e,"colspan",1)&&(l[t]=(0,a.getAttrNumber)(e,"width",0)))}))}));var s=0;if(l.forEach((function(e){d+=e,0===e&&s++})),s){var c=Math.floor((n-d)/s),f=c>80?c:80,u=0;d=0,l=l.map((function(t,r){return 0===t&&(t=e.hasCheckbox&&0===r?c>55?c:55:f,u=r),d+=t,t})),n>d&&(l[u]=l[u]+n-d,d=n)}else d=l.reduce((function(e,t){return t+e}),0);e.colgroup=l,e.size.rootWidth=o,e.size.tableWidth=d,e.scrollX=e.size.tableWidth>e.size.rootWidth}function u(e){!function(e){e.$tbodyWrapper.addEventListener("scroll",(function(){return function(e){(0,a.throttle)(20,(function(){e.$theadWrapper.scrollLeft=e.$tbodyWrapper.scrollLeft,e.$fixedLeftBody&&(e.$fixedLeftBody.scrollTop=e.$tbodyWrapper.scrollTop),e.$fixedRightBody&&(e.$fixedRightBody.scrollTop=e.$tbodyWrapper.scrollTop)}))()}(e)}),{passive:!0})}(e),function(e){var t=e.options,r=t.selection,o=t.selectionKey,n=(0,i.querySelector)(e.$fixedLeft||e.$thead,"th>.stb_cell>label.std-checkbox");[].concat(e.data,e.unsortData).forEach((function(t){if(p(e,t.$el,[t.$fixedLeftEl,t.$fixedRightEl]),t.$fixedLeftEl&&p(e,t.$fixedLeftEl,[t.$el,t.$fixedRightEl]),t.$fixedRightEl&&p(e,t.$fixedRightEl,[t.$el,t.$fixedLeftEl]),r){var a=t["field-"+(o||0)];switch(r){case"radio":b(e,t.$el,[t.$fixedLeftEl,t.$fixedRightEl],a),t.$fixedLeftEl&&b(e,t.$fixedLeftEl,[t.$el,t.$fixedRightEl],a),t.$fixedRightEl&&b(e,t.$fixedRightEl,[t.$el,t.$fixedLeftEl],a);break;case"checkbox":!function(e,t,r,o){var n=(0,i.querySelector)(t,"label.std-checkbox");if(!n||!r)return;n.addEventListener("click",(function(){var t=e.selected;t=t||[];var a=!(0,i.hasAttribute)(n,"checked");a?(0,i.setAttribute)(n,"checked",!0):(0,i.removeAttribute)(n,"checked"),a?t.push(o):t.splice(t.indexOf(o),1);var l=t.length;l?(0,i.setAttribute)(e.$root,"selected",JSON.stringify(t)):(0,i.removeAttribute)(e.$root,"selected"),l===e.data.length+e.unsortData.length?(0,i.setAttribute)(r,"checked",!0):(0,i.removeAttribute)(r,"checked"),e.selected=t}))}(e,t.$fixedLeftEl||t.$el,n,a)}}})),e.hasCheckbox&&function(e,t){if(!t)return;var r=e.options.selectionKey;t.addEventListener("click",(function(){var o=e.selected;o=[];var n=!(0,i.hasAttribute)(t,"checked");n?(0,i.setAttribute)(t,"checked",!0):(0,i.removeAttribute)(t,"checked"),[].concat(e.data,e.unsortData).forEach((function(e){var t=(0,i.querySelector)(e.$fixedLeftEl||e.$el,"label.std-checkbox");n?(0,i.setAttribute)(t,"checked",!0):(0,i.removeAttribute)(t,"checked"),n&&o.push(e["field-"+(r||0)])})),o.length?(0,i.setAttribute)(e.$root,"selected",JSON.stringify(o)):(0,i.removeAttribute)(e.$root,"selected"),e.selected=o}))}(e,n)}(e),e.options.expand?function(e){!function e(t){t.forEach((function(t){t.expand&&((0,i.querySelector)(t.$el,"td").addEventListener("click",(function(){!function e(t,r){r?(0,i.setAttribute)(t.$el,"expanded"):(0,i.removeAttribute)(t.$el,"expanded"),t.children&&t.children.forEach((function(t){(0,i.styled)(t.$el,{display:r?"":"none"}),e(t,r)}))}(t,!(0,i.hasAttribute)(t.$el,"expanded"))})),t.children&&e(t.children))}))}(e.expandData)}(e):function(e){var t=Array.from((0,i.querySelectorAll)(e.$root,"th[sort]"));if(0===t.length)return;t.forEach((function(r){r.addEventListener("click",(function(n){n.stopPropagation();var a="ASC",l=(0,i.getAttribute)(r,"sort")||"string";r.classList.contains("asc")?(r.classList.remove("asc"),r.classList.add("desc"),a="DESC"):(r.classList.remove("desc"),r.classList.add("asc")),t=t.map((function(e){return r!=e&&e.classList.remove("asc","desc"),e})),(0,o.default)(e,(0,i.getAttribute)(r,"sortkey"),a,l)}))}))}(e),function(e){window.addEventListener("resize",(function(){return h(e)}),{passive:!0})}(e)}function h(e){(0,a.debounce)(500,(function(){var t=e.props,r=t.fixedLeft,o=t.fixedRight;f(e),(0,a.replaceColGroup)(e),e.scrollY=(0,i.offsetHeight)(e.$tbody)>e.size.tbodyWrapperHeight,(0,i.styled)(e.$scrollTH,{display:e.scrollY?"table-cell":"none"});var n=(0,i.offsetHeight)(e.$root)-(e.scrollX?e.gutterWidth:2),l=(0,i.offsetHeight)(e.$thead)+(0,i.offsetHeight)(e.$tbody);n=l>n?n:l;var d=e.size.tbodyWrapperHeight-(e.scrollX?e.gutterWidth:0),s=(0,i.offsetHeight)(e.$thead),c=0,u=0;e.$fixedLeft&&r.thead.length&&(r.thead.forEach((function(t,r){c+=e.colgroup[r]})),(0,i.styled)(e.$fixedLeftBody,{height:d+"px",top:s+"px"}),(0,i.styled)(e.$fixedLeft,{width:c+"px",height:n+"px"})),e.$fixedRight&&o.thead.length&&(o.thead.forEach((function(t,r){u+=e.colgroup[e.colgroup.length-r-1]})),(0,i.styled)(e.$fixedRightBody,{height:d+"px",top:s+"px"}),(0,i.styled)(e.$fixedRight,{width:u+"px",height:n+"px",right:(e.scrollY?e.gutterWidth:0)+"px"}),(0,i.styled)(e.$rightPatch,{display:e.scrollY?"block":"none",height:(0,i.offsetHeight)(e.$thead)+"px"}))}))()}function b(e,t,r,o){t&&t.addEventListener("click",(function(){var n=e.selected,a=!1;(n!==o||(0,i.hasAttribute)(t,"checked"))&&(n!==o?((0,i.querySelectorAll)(e.$root,"tr[checked]>td").forEach((function(e){return(0,i.styled)(e,{background:""})})),(0,i.querySelectorAll)(e.$root,"tr[checked]").forEach((function(e){return(0,i.removeAttribute)(e,"checked")})),a=!0):(0,i.hasAttribute)(t,"checked")&&(a=!1),n=a?o:null,a?(0,i.setAttribute)(t,"checked",!0):(0,i.removeAttribute)(t,"checked"),t.querySelectorAll("td").forEach((function(t){(0,i.styled)(t,{background:a?e.style.radioBgColor:""})})),r.forEach((function(t){t&&(a?(0,i.setAttribute)(t,"checked",!0):(0,i.removeAttribute)(t,"checked"),t.querySelectorAll("td").forEach((function(t){(0,i.styled)(t,{background:a?e.style.radioBgColor:""})})))})),a?(0,i.setAttribute)(e.$root,"selected",JSON.stringify(n)):(0,i.removeAttribute)(e.$root,"selected"),e.selected=n)}))}function p(e,t,r){t&&(t.addEventListener("mouseenter",(function(){(0,i.styled)(t,{background:e.style.hoverBgColor}),r.forEach((function(t){t&&(0,i.styled)(t,{background:e.style.hoverBgColor})}))})),t.addEventListener("mouseleave",(function(){(0,i.styled)(t,{background:""}),r.forEach((function(e){e&&(0,i.styled)(e,{background:""})}))})))}function g(e){var t={},r=[];(0,i.querySelectorAll)(e.$thead,"tr").forEach((function(e,t){var o=r[t]||[];(0,i.querySelectorAll)(e,"th").forEach((function(e){var n=(0,a.getAttrNumber)(e,"rowspan",1),l=(0,a.getAttrNumber)(e,"colspan",1),d=(0,a.getEmptyIndexInArray)(o)||o.length;if(o[d]=e,(0,i.hasAttribute)(e,"sort")&&(0,i.setAttribute)(e,"sortkey","field-"+d),l>1)for(var s=1;s1)for(var c=1;cth"),s=d.length,c=0;if(0!==s){if((0,i.hasAttribute)(d[0],"fixed"))for(var f=0;f0&&(0,i.hasAttribute)(d[p],"fixed")&&p!==c;p--){l.thead.push("field-"+p);for(var g=(0,a.getAttrNumber)(d[p],"colspan",1),x=0;xt}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){var i=320,d=e.props,s=d.fixedLeft,c=d.fixedRight;if(s.thead.length>0){i=i>s.width?i:s.width;var f=n(e,t,s),u=a(e,r,s,"left");e.$fixedLeft=l(e,f,u,s,"stb_fixed","left"),(0,o.appendChild)(e.$root,e.$fixedLeft),e.$fixedLeftBody=u}if(c.thead.length>0){i+=c.width;var h=n(e,t,c),b=a(e,r,c,"right");e.$fixedRight=l(e,h,b,c,"stb_fixed-right","right"),(0,o.appendChild)(e.$root,e.$fixedRight),e.$fixedRightBody=b;var p=(0,o.createElement)("div","stb_fixed-right-patch");(0,o.styled)(p,{display:"none",width:e.gutterWidth+"px",height:(0,o.offsetHeight)(e.$thead)+"px"}),(0,o.appendChild)(e.$root,p),e.$rightPatch=p,e.scrollY&&(0,o.styled)(e.$rightPatch,{display:"block"})}(0,o.styled)(e.$root,{minWidth:i+"px"})};var o=r(0),i=r(1);function n(e,t,r){var n=(0,o.cloneNode)(t,!0);return(0,o.querySelectorAll)(n,"tr:first-child>th").forEach((function(e,t){-1===r.thead.indexOf("field-"+t)&&e.classList.add("is-hidden")})),(0,i.createTableWrapper)("stb_fixed-header-wrapper",e,"header",n)}function a(e,t,r,n){var a=(0,o.cloneNode)(t,!0);(0,o.querySelectorAll)(a,"tr").forEach((function(e){var t=-1;(0,o.querySelectorAll)(e,"td").forEach((function(e,o){"left"===n?t=o:t+=(0,i.getAttrNumber)(e,"colspan",1),-1===r.tbody.indexOf("field-"+t)&&e.classList.add("is-hidden")}))}));var l=(0,i.createTableWrapper)("stb_fixed-body-wrapper",e,"body",a);return(0,o.styled)(l,{top:(0,o.offsetHeight)(e.$thead)+"px",height:e.size.tbodyWrapperHeight-(e.scrollX?e.gutterWidth:0)+"px"}),l}function l(e,t,r,i,n,a){var l=(0,o.createElement)("div",n);(0,o.appendChildren)(l,[t,r]);var d=(0,o.offsetHeight)(e.$root)-(e.scrollX?e.gutterWidth:2),s=(0,o.offsetHeight)(e.$thead)+(0,o.offsetHeight)(e.$tbody);return(0,o.styled)(l,{width:i.width+"px",height:(s>d?d:s)+"px",right:"right"===a?(e.scrollY?e.gutterWidth:0)+"px":""}),l}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){if(void 0!==i)return i;var e=(0,o.createElement)("div","smart-table");(0,o.appendChild)(document.body,e);var t=(0,o.createElement)("div");(0,o.styled)(t,{visibility:"hidden",width:"100px",position:"absolute",top:"-9999px"}),(0,o.appendChild)(e,t);var r=(0,o.offsetWidth)(t);(0,o.styled)(t,{overflow:"scroll"});var n=(0,o.createElement)("div");(0,o.styled)(n,{width:"100%"}),(0,o.appendChild)(t,n);var a=(0,o.offsetWidth)(n);return(0,o.removeChild)(e.parentNode,e),i=r-a};var o=r(0),i=void 0}]);
\ No newline at end of file
+/*! smartTable v1.2.1 | (c) pengyajun 2020 | Released under the MIT License. */!function(e){var t={};function r(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(o,i,function(t){return e[t]}.bind(null,i));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createElement=function(e,t){var r=document.createElement(e);return t&&(r.className=t),r},t.appendChild=function(e,t){return e.appendChild(t)},t.hasAttribute=function(e,t){return e.hasAttribute(t)},t.setAttribute=function(e,t,r){return e.setAttribute(t,r||!0)},t.getAttribute=function(e,t){return e.getAttribute(t)},t.removeAttribute=function(e,t){return e.removeAttribute(t)},t.appendChildren=function(e,t){return t.forEach((function(t){e.appendChild(t)})),e},t.insertBefore=function(e,t,r){e.insertBefore(t,r)},t.nextSibling=function(e){return e.nextSibling},t.removeChild=function(e,t){e.removeChild(t)},t.cloneNode=function(e,t){return e.cloneNode(t)},t.querySelector=function(e,t){return e.querySelector(t)},t.querySelectorAll=function(e,t){return e.querySelectorAll(t)},t.offsetHeight=function(e){return e.offsetHeight},t.offsetWidth=function(e){return e.offsetWidth},t.styled=function(e,t){for(var r in t)e.style[r]=t[r];return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.refactorCell=function(e){var t=e.childNodes,r=(0,o.createElement)("div","stb_cell");for(;t.length;)(0,o.appendChild)(r,t[0]);(0,o.appendChild)(e,r)},t.createCheckbox=function(e,t){if(!e)return;var r=(0,o.createElement)(e);(0,o.setAttribute)(r,"rowspan",t);var i=(0,o.createElement)("label","std-checkbox"),n=(0,o.createElement)("span","std-checkbox_input");return(0,o.appendChild)(n,(0,o.createElement)("span","std-checkbox_inner")),(0,o.appendChild)(i,n),(0,o.appendChild)(r,i),r},t.createTableWrapper=function(e,t,r,n){var a=(0,o.createElement)("div",e),l=(0,o.createElement)("table","stb_"+r);return(0,o.styled)(l,{width:t.size.tableWidth+"px"}),(0,o.appendChildren)(l,[i(t.colgroup),n]),(0,o.appendChild)(a,l),a},t.replaceColGroup=function(e){(0,o.querySelectorAll)(e.$root,"table").forEach((function(t){(0,o.styled)(t,{width:e.size.tableWidth+"px"}),t.replaceChild(i(e.colgroup),(0,o.querySelector)(t,"colgroup"))}))},t.getAttrNumber=function(e,t,r){return Number.parseInt((0,o.getAttribute)(e,t)||r)},t.getEmptyIndexInArray=function(e){for(var t=0,r=e.length;te?l():r=setTimeout(l,e-n)}},t.debounce=function(e,t){var r=void 0;return function(){var o=this,i=arguments;function n(){t.apply(o,i)}r&&clearTimeout(r),r=setTimeout(n,e)}};var o=r(0);function i(e){if(e){var t=(0,o.createElement)("colgroup");return e.forEach((function(e){var r=(0,o.createElement)("col");(0,o.setAttribute)(r,"width",e),(0,o.appendChild)(t,r)})),t}}},function(e,t,r){"use strict";var o,i=r(3),n=(o=i)&&o.__esModule?o:{default:o};window.SmartTable=n.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(4);var o,i=r(8);function n(e){var t=this;this instanceof n||console.error("Smart Table is a constructor and should be called with the `new` keyword"),window.addEventListener("load",(function(){setTimeout(t._init(e),0)}))}(0,((o=i)&&o.__esModule?o:{default:o}).default)(n),t.default=n},function(e,t,r){var o=r(5),i=r(6);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var n={insert:"head",singleton:!1},a=(o(e.i,i,n),i.locals?i.locals:{});e.exports=a},function(e,t,r){"use strict";var o,i=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},n=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),a={};function l(e,t,r){for(var o=0;otd: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 th[align="left"],.smart-table td[align="left"]{text-align:left}.smart-table th[align="center"],.smart-table td[align="center"]{text-align:center}.smart-table th[align="right"],.smart-table td[align="right"]{text-align:right}.smart-table th[nowrap] .stb_cell,.smart-table td[nowrap] .stb_cell{white-space:nowrap}.smart-table .std-checkbox_inner{display:inline-block;position:relative;border:1px solid #dcdfe6;border-radius:2px;box-sizing:border-box;width:14px;height:14px;background-color:#fff;z-index:1;-webkit-transition:border-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46),background-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46);transition:border-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46),background-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46)}.smart-table .std-checkbox_inner:after{box-sizing:content-box;content:"";border:1px solid #fff;border-left:0;border-top:0;height:7px;left:4px;position:absolute;top:1px;-webkit-transform:rotate(45deg) scaleY(0);transform:rotate(45deg) scaleY(0);width:3px;-webkit-transition:-webkit-transform .15s ease-in .05s;transition:-webkit-transform .15s ease-in .05s;transition:transform .15s ease-in .05s;transition:transform .15s ease-in .05s, -webkit-transform .15s ease-in .05s;-webkit-transform-origin:center;transform-origin:center}.smart-table .std-checkbox_input{white-space:nowrap;cursor:pointer;outline:none;display:inline-block;line-height:1;position:relative;vertical-align:middle}.smart-table .std-checkbox{color:#606266;font-weight:500;font-size:14px;position:relative;cursor:pointer;display:inline-block;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.smart-table .std-checkbox[checked]>.std-checkbox_input>.std-checkbox_inner{background-color:#409eff;border-color:#409eff}.smart-table .std-checkbox[checked]>.std-checkbox_input>.std-checkbox_inner:after{-webkit-transform:rotate(45deg) scaleY(1);transform:rotate(45deg) scaleY(1)}.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',""]),e.exports=t},function(e,t,r){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=function(e,t){var r=e[1]||"",o=e[3];if(!o)return r;if(t&&"function"==typeof btoa){var i=(a=o,l=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),d="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(l),"/*# ".concat(d," */")),n=o.sources.map((function(e){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(e," */")}));return[r].concat(n).concat([i]).join("\n")}var a,l,d;return[r].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r){"string"==typeof e&&(e=[[null,e,""]]);for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:{};if(!e.selector)return console.error("Smart Table init need a selector");var t=String(e.selector).trim(),r=(0,i.querySelector)(document,t);if(!r)return console.error("Smart Table "+t+" not found");var o=(0,i.querySelector)(r,"table");if(!o)return console.error("Smart Table init need a table");var a=(0,i.querySelector)(o,"thead");if(!a)return console.error("Smart Table init need a thead");var d=(0,i.querySelector)(o,"tbody");if(!d)return console.error("Smart Table init need a tbody");r.classList.add("smart-table"),e.size&&r.classList.add("stb-cust-"+e.size),e.align&&r.classList.add("stb-cust-"+e.align),(0,i.hasAttribute)(o,"stripe")&&d.classList.add("stripe"),e.expand?((0,i.querySelectorAll)(a,"th[sort]").forEach((function(e){(0,i.removeAttribute)(e,"sort")})),(0,i.querySelectorAll)(a,"th[fixed]").forEach((function(e){(0,i.removeAttribute)(e,"fixed")}))):((0,i.querySelectorAll)(d,"tr[expand]").forEach((function(e){(0,i.removeAttribute)(e,"expand")})),(0,i.querySelectorAll)(a,"tr[expand-parent]").forEach((function(e){(0,i.removeAttribute)(e,"expand-parent")})));var f=this;f.$root=r,f.$thead=a,f.$tbody=d,f.options=e,f.gutterWidth=(0,l.default)(),f.style={radioBgColor:e.radioBgColor||"#D1E7FF",hoverBgColor:e.hoverBgColor||"#EFF8FF"},f.size={},f.hasCheckbox=!e.expand&&"checkbox"===e.selection,f.hasCheckbox&&s(f),g(f),c(f,o),e.expand||(x(f),(0,n.default)(f,a,d)),v(f,d),e.expand&&m(f,d),u(f);var b=(0,i.createElement)("th");(0,i.styled)(b,{display:"none"}),(0,i.setAttribute)(b,"width",f.gutterWidth),(0,i.setAttribute)(b,"rowspan",f.props.shapes.length),(0,i.appendChild)((0,i.querySelector)(f.$thead,"tr"),b),f.$scrollTH=b,f.scrollY&&((0,i.styled)(f.$scrollTH,{display:"table-cell"}),h(f))}};var o=d(r(9)),i=r(0),n=d(r(10)),a=r(1),l=d(r(11));function d(e){return e&&e.__esModule?e:{default:e}}function s(e){var t=e.$thead,r=e.$tbody,o=(0,i.querySelector)(t,"tr"),n=o.querySelector("th"),l=(0,a.createCheckbox)("th",(0,a.getAttrNumber)(n,"rowspan",1));(0,i.hasAttribute)(n,"fixed")&&(0,i.setAttribute)(l,"fixed"),(0,i.insertBefore)(o,l,n),(0,i.querySelectorAll)(r,"tr").forEach((function(e){var t=e.querySelector("td");(0,i.insertBefore)(e,(0,a.createCheckbox)("td",(0,a.getAttrNumber)(t,"rowspan",1)),t)}))}function c(e,t){var r=e.$root,o=e.$thead,n=e.$tbody,l=e.options.height;(0,i.querySelectorAll)(o,"th").forEach((function(e){return(0,a.refactorCell)(e)})),(0,i.querySelectorAll)(n,"td").forEach((function(e){return(0,a.refactorCell)(e)})),f(e),e.$theadWrapper=(0,a.createTableWrapper)("stb_header-wrapper",e,"header",o),e.$tbodyWrapper=(0,a.createTableWrapper)("stb_body-wrapper",e,"body",n),(0,i.appendChildren)(r,[e.$theadWrapper,e.$tbodyWrapper]);var d=(0,i.offsetHeight)(o),s=("function"==typeof l?l.call():l)||(0,i.offsetHeight)(r),c=s>d?s-d-1:d+150;(0,i.styled)(e.$tbodyWrapper,{height:c+"px"}),e.size.tbodyWrapperHeight=c,e.scrollY=(0,i.offsetHeight)(e.$tbody)>c,(0,i.removeChild)(t.parentNode,t)}function f(e){var t=e.$root,r=e.props,o=(0,i.offsetWidth)(t)-1,n=o-(e.scrollY?e.gutterWidth:0),l=[],d=0;r.shapes.forEach((function(e){e.forEach((function(e,t){e&&(1===(0,a.getAttrNumber)(e,"colspan",1)&&(l[t]=(0,a.getAttrNumber)(e,"width",0)))}))}));var s=0;if(l.forEach((function(e){d+=e,0===e&&s++})),s){var c=Math.floor((n-d)/s),f=c>80?c:80,u=0;d=0,l=l.map((function(t,r){return 0===t&&(t=e.hasCheckbox&&0===r?c>55?c:55:f,u=r),d+=t,t})),n>d&&(l[u]=l[u]+n-d,d=n)}else d=l.reduce((function(e,t){return t+e}),0);e.colgroup=l,e.size.rootWidth=o,e.size.tableWidth=d,e.scrollX=e.size.tableWidth>e.size.rootWidth}function u(e){!function(e){e.$tbodyWrapper.addEventListener("scroll",(function(){return function(e){(0,a.throttle)(20,(function(){e.$theadWrapper.scrollLeft=e.$tbodyWrapper.scrollLeft,e.$fixedLeftBody&&(e.$fixedLeftBody.scrollTop=e.$tbodyWrapper.scrollTop),e.$fixedRightBody&&(e.$fixedRightBody.scrollTop=e.$tbodyWrapper.scrollTop)}))()}(e)}),{passive:!0})}(e),function(e){var t=e.options,r=t.selection,o=t.selectionKey,n=(0,i.querySelector)(e.$fixedLeft||e.$thead,"th>.stb_cell>label.std-checkbox");[].concat(e.data,e.unsortData).forEach((function(t){if(p(e,t.$el,[t.$fixedLeftEl,t.$fixedRightEl]),t.$fixedLeftEl&&p(e,t.$fixedLeftEl,[t.$el,t.$fixedRightEl]),t.$fixedRightEl&&p(e,t.$fixedRightEl,[t.$el,t.$fixedLeftEl]),r){var a=t["field-"+(o||0)];switch(r){case"radio":b(e,t.$el,[t.$fixedLeftEl,t.$fixedRightEl],a),t.$fixedLeftEl&&b(e,t.$fixedLeftEl,[t.$el,t.$fixedRightEl],a),t.$fixedRightEl&&b(e,t.$fixedRightEl,[t.$el,t.$fixedLeftEl],a);break;case"checkbox":!function(e,t,r,o){var n=(0,i.querySelector)(t,"label.std-checkbox");if(!n||!r)return;n.addEventListener("click",(function(){var t=e.selected;t=t||[];var a=!(0,i.hasAttribute)(n,"checked");a?(0,i.setAttribute)(n,"checked",!0):(0,i.removeAttribute)(n,"checked"),a?t.push(o):t.splice(t.indexOf(o),1);var l=t.length;l?(0,i.setAttribute)(e.$root,"selected",JSON.stringify(t)):(0,i.removeAttribute)(e.$root,"selected"),l===e.data.length+e.unsortData.length?(0,i.setAttribute)(r,"checked",!0):(0,i.removeAttribute)(r,"checked"),e.selected=t}))}(e,t.$fixedLeftEl||t.$el,n,a)}}})),e.hasCheckbox&&function(e,t){if(!t)return;var r=e.options.selectionKey;t.addEventListener("click",(function(){var o=e.selected;o=[];var n=!(0,i.hasAttribute)(t,"checked");n?(0,i.setAttribute)(t,"checked",!0):(0,i.removeAttribute)(t,"checked"),[].concat(e.data,e.unsortData).forEach((function(e){var t=(0,i.querySelector)(e.$fixedLeftEl||e.$el,"label.std-checkbox");n?(0,i.setAttribute)(t,"checked",!0):(0,i.removeAttribute)(t,"checked"),n&&o.push(e["field-"+(r||0)])})),o.length?(0,i.setAttribute)(e.$root,"selected",JSON.stringify(o)):(0,i.removeAttribute)(e.$root,"selected"),e.selected=o}))}(e,n)}(e),e.options.expand?function(e){!function e(t){t.forEach((function(t){t.expand&&((0,i.querySelector)(t.$el,"td").addEventListener("click",(function(){!function e(t,r){r?(0,i.setAttribute)(t.$el,"expanded"):(0,i.removeAttribute)(t.$el,"expanded"),t.children&&t.children.forEach((function(t){(0,i.styled)(t.$el,{display:r?"":"none"}),e(t,r)}))}(t,!(0,i.hasAttribute)(t.$el,"expanded"))})),t.children&&e(t.children))}))}(e.expandData)}(e):function(e){var t=Array.from((0,i.querySelectorAll)(e.$root,"th[sort]"));if(0===t.length)return;t.forEach((function(r){r.addEventListener("click",(function(n){n.stopPropagation();var a="ASC",l=(0,i.getAttribute)(r,"sort")||"string";r.classList.contains("asc")?(r.classList.remove("asc"),r.classList.add("desc"),a="DESC"):(r.classList.remove("desc"),r.classList.add("asc")),t=t.map((function(e){return r!=e&&e.classList.remove("asc","desc"),e})),(0,o.default)(e,(0,i.getAttribute)(r,"sortkey"),a,l)}))}))}(e),function(e){window.addEventListener("resize",(function(){return h(e)}),{passive:!0})}(e)}function h(e){(0,a.debounce)(500,(function(){var t=e.props,r=t.fixedLeft,o=t.fixedRight;f(e),(0,a.replaceColGroup)(e),e.scrollY=(0,i.offsetHeight)(e.$tbody)>e.size.tbodyWrapperHeight,(0,i.styled)(e.$scrollTH,{display:e.scrollY?"table-cell":"none"});var n=(0,i.offsetHeight)(e.$root)-(e.scrollX?e.gutterWidth:2),l=(0,i.offsetHeight)(e.$thead)+(0,i.offsetHeight)(e.$tbody);n=l>n?n:l;var d=e.size.tbodyWrapperHeight-(e.scrollX?e.gutterWidth:0),s=(0,i.offsetHeight)(e.$thead),c=0,u=0;e.$fixedLeft&&r.thead.length&&(r.thead.forEach((function(t,r){c+=e.colgroup[r]})),(0,i.styled)(e.$fixedLeftBody,{height:d+"px",top:s+"px"}),(0,i.styled)(e.$fixedLeft,{width:c+"px",height:n+"px"})),e.$fixedRight&&o.thead.length&&(o.thead.forEach((function(t,r){u+=e.colgroup[e.colgroup.length-r-1]})),(0,i.styled)(e.$fixedRightBody,{height:d+"px",top:s+"px"}),(0,i.styled)(e.$fixedRight,{width:u+"px",height:n+"px",right:(e.scrollY?e.gutterWidth:0)+"px"}),(0,i.styled)(e.$rightPatch,{display:e.scrollY?"block":"none",height:(0,i.offsetHeight)(e.$thead)+"px"}))}))()}function b(e,t,r,o){t&&t.addEventListener("click",(function(){var n=e.selected,a=!1;(n!==o||(0,i.hasAttribute)(t,"checked"))&&(n!==o?((0,i.querySelectorAll)(e.$root,"tr[checked]>td").forEach((function(e){return(0,i.styled)(e,{background:""})})),(0,i.querySelectorAll)(e.$root,"tr[checked]").forEach((function(e){return(0,i.removeAttribute)(e,"checked")})),a=!0):(0,i.hasAttribute)(t,"checked")&&(a=!1),n=a?o:null,a?(0,i.setAttribute)(t,"checked",!0):(0,i.removeAttribute)(t,"checked"),t.querySelectorAll("td").forEach((function(t){(0,i.styled)(t,{background:a?e.style.radioBgColor:""})})),r.forEach((function(t){t&&(a?(0,i.setAttribute)(t,"checked",!0):(0,i.removeAttribute)(t,"checked"),t.querySelectorAll("td").forEach((function(t){(0,i.styled)(t,{background:a?e.style.radioBgColor:""})})))})),a?(0,i.setAttribute)(e.$root,"selected",JSON.stringify(n)):(0,i.removeAttribute)(e.$root,"selected"),e.selected=n)}))}function p(e,t,r){t&&(t.addEventListener("mouseenter",(function(){(0,i.styled)(t,{background:e.style.hoverBgColor}),r.forEach((function(t){t&&(0,i.styled)(t,{background:e.style.hoverBgColor})}))})),t.addEventListener("mouseleave",(function(){(0,i.styled)(t,{background:""}),r.forEach((function(e){e&&(0,i.styled)(e,{background:""})}))})))}function g(e){var t={},r=[];(0,i.querySelectorAll)(e.$thead,"tr").forEach((function(e,t){var o=r[t]||[];(0,i.querySelectorAll)(e,"th").forEach((function(e){var n=(0,a.getAttrNumber)(e,"rowspan",1),l=(0,a.getAttrNumber)(e,"colspan",1),d=(0,a.getEmptyIndexInArray)(o)||o.length;if(o[d]=e,(0,i.hasAttribute)(e,"sort")&&(0,i.setAttribute)(e,"sortkey","field-"+d),l>1)for(var s=1;s1)for(var c=1;cth"),s=d.length,c=0;if(0!==s){if((0,i.hasAttribute)(d[0],"fixed"))for(var f=0;f0&&(0,i.hasAttribute)(d[p],"fixed")&&p!==c;p--){l.thead.push("field-"+p);for(var g=(0,a.getAttrNumber)(d[p],"colspan",1),x=0;xt}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){var i=320,d=e.props,s=d.fixedLeft,c=d.fixedRight;if(s.thead.length>0){i=i>s.width?i:s.width;var f=n(e,t,s),u=a(e,r,s,"left");e.$fixedLeft=l(e,f,u,s,"stb_fixed","left"),(0,o.appendChild)(e.$root,e.$fixedLeft),e.$fixedLeftBody=u}if(c.thead.length>0){i+=c.width;var h=n(e,t,c),b=a(e,r,c,"right");e.$fixedRight=l(e,h,b,c,"stb_fixed-right","right"),(0,o.appendChild)(e.$root,e.$fixedRight),e.$fixedRightBody=b;var p=(0,o.createElement)("div","stb_fixed-right-patch");(0,o.styled)(p,{display:"none",width:e.gutterWidth+"px",height:(0,o.offsetHeight)(e.$thead)+"px"}),(0,o.appendChild)(e.$root,p),e.$rightPatch=p,e.scrollY&&(0,o.styled)(e.$rightPatch,{display:"block"})}(0,o.styled)(e.$root,{minWidth:i+"px"})};var o=r(0),i=r(1);function n(e,t,r){var n=(0,o.cloneNode)(t,!0);return(0,o.querySelectorAll)(n,"tr:first-child>th").forEach((function(e,t){-1===r.thead.indexOf("field-"+t)&&e.classList.add("is-hidden")})),(0,i.createTableWrapper)("stb_fixed-header-wrapper",e,"header",n)}function a(e,t,r,n){var a=(0,o.cloneNode)(t,!0);(0,o.querySelectorAll)(a,"tr").forEach((function(e){var t=-1;(0,o.querySelectorAll)(e,"td").forEach((function(e,o){"left"===n?t=o:t+=(0,i.getAttrNumber)(e,"colspan",1),-1===r.tbody.indexOf("field-"+t)&&e.classList.add("is-hidden")}))}));var l=(0,i.createTableWrapper)("stb_fixed-body-wrapper",e,"body",a);return(0,o.styled)(l,{top:(0,o.offsetHeight)(e.$thead)+"px",height:e.size.tbodyWrapperHeight-(e.scrollX?e.gutterWidth:0)+"px"}),l}function l(e,t,r,i,n,a){var l=(0,o.createElement)("div",n);(0,o.appendChildren)(l,[t,r]);var d=(0,o.offsetHeight)(e.$root)-(e.scrollX?e.gutterWidth:2),s=(0,o.offsetHeight)(e.$thead)+(0,o.offsetHeight)(e.$tbody);return(0,o.styled)(l,{width:i.width+"px",height:(s>d?d:s)+"px",right:"right"===a?(e.scrollY?e.gutterWidth:0)+"px":""}),l}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){if(void 0!==i)return i;var e=(0,o.createElement)("div","smart-table");(0,o.appendChild)(document.body,e);var t=(0,o.createElement)("div");(0,o.styled)(t,{visibility:"hidden",width:"100px",position:"absolute",top:"-9999px"}),(0,o.appendChild)(e,t);var r=(0,o.offsetWidth)(t);(0,o.styled)(t,{overflow:"scroll"});var n=(0,o.createElement)("div");(0,o.styled)(n,{width:"100%"}),(0,o.appendChild)(t,n);var a=(0,o.offsetWidth)(n);return(0,o.removeChild)(e.parentNode,e),i=r-a};var o=r(0),i=void 0}]);
\ No newline at end of file
diff --git a/examples/index.html b/examples/index.html
index 055df09..4d0a8eb 100644
--- a/examples/index.html
+++ b/examples/index.html
@@ -90,7 +90,7 @@
| Id |
Logo |
- 日期 |
+ 日期 |
姓名 |
省份(包含自治区) |
市区 |
@@ -102,11 +102,11 @@
| 10 |
 |
- 2020-01-03 |
+ 2020-01-03 |
1王小虎 |
1上海 |
2长宁区 |
- 3上海市长宁区淞虹路888号 |
+ 3上海市长宁区淞虹路888号 |
200331 |
diff --git a/lib/index.scss b/lib/index.scss
index ed629f9..2857a98 100644
--- a/lib/index.scss
+++ b/lib/index.scss
@@ -154,6 +154,14 @@
td[align="left"] {
text-align: left;
}
+ th[align="center"],
+ td[align="center"] {
+ text-align: center;
+ }
+ th[align="right"],
+ td[align="right"] {
+ text-align: right;
+ }
th[nowrap],
td[nowrap] {
.stb_cell {