diff --git a/.browserlistrc b/.browserlistrc new file mode 100644 index 0000000..01d2cb4 --- /dev/null +++ b/.browserlistrc @@ -0,0 +1,4 @@ +# Browsers that we support +last 1 version +> 1% +IE 10 # sorry \ No newline at end of file diff --git a/config/webpack.common.js b/config/webpack.common.js index eb99ca6..9d5f907 100644 --- a/config/webpack.common.js +++ b/config/webpack.common.js @@ -6,6 +6,7 @@ module.exports = { use: [ 'style-loader', 'css-loader', + 'postcss-loader', { loader: 'sass-loader', options: { diff --git a/dist/smartTable.min.js b/dist/smartTable.min.js index fd5feba..49ae43e 100644 --- a/dist/smartTable.min.js +++ b/dist/smartTable.min.js @@ -1 +1 @@ -/*! smartTable v1.1.1 | (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},s=(o(t.i,i,n),i.locals?i.locals:{});t.exports=s},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]}}(),s={};function a(t,e,r){for(var o=0;o*,.smart-table th.is-hidden>*{visibility:hidden}.smart-table th{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;-webkit-border-radius:2em;-moz-border-radius:2em;-o-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,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=(s=o,a=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),"/*# ".concat(l," */")),n=o.sources.map((function(t){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(t," */")}));return[r].concat(n).concat([i]).join("\n")}var s,a,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;oe}function n(t,e){let r=document.createElement(t);return e&&(r.className=e),r}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,r=n("div","stb_cell");for(;e.length;)s(r,e[0]);s(t,r)}function u(t,e,r,o,i){let l=n("div",t),d=n("table","stb_"+r);return d.style.width=e.size.tabelWidth-1+"px",a(d,[g(e.colgroup,e.gutterWidth,i),o]),s(l,d),l}function b(t,e){let r=g(t.colgroup);e.replaceChild(r,f(e,"colgroup"))}function p(t,e,r){return Number.parseInt(t.getAttribute(e)||r)}function g(t,e,r){if(!t)return;let o=n("colgroup");if(t.forEach(t=>{let e=n("col");e.setAttribute("width",t),s(o,e)}),r){let t=n("col");t.setAttribute("width",e),s(o,t)}return o}function m(t,e,r){let o=d(e,!0);return c(o,"tr:first-child>th").forEach((t,e)=>{-1===r.thead.indexOf("field-"+e)&&t.classList.add("is-hidden")}),u("stb_fixed-header-wrapper",t,"header",o)}function x(t,e,r,o){let i=d(e,!0);c(i,"tr").forEach(t=>{let e=-1;c(t,"td").forEach((t,i)=>{"left"===o?e=i:e+=p(t,"colspan",1),-1===r.tbody.indexOf("field-"+e)&&t.classList.add("is-hidden")})});let n=u("stb_fixed-body-wrapper",t,"body",i);return n.style.top=t.size.theadHeight+"px",n.style.height=t.size.tbodyHeight-(t.scrollX?t.gutterWidth:0)+"px",n}function A(t,e,r,o,i,s){let l=n("div",i);return"right"===s&&(l.style.right=(t.scrollY?t.gutterWidth:0)+"px"),a(l,[e,r]),l.style.width=o.width+"px",l.style.height=t.size.fixWrapperHeigth-(t.scrollX?t.gutterWidth:0)+"px",l}let y;function w(t,e,r){if(e){let o=f(e,".stb_header"),i=f(e,".stb_body");b(t,o),b(t,i);const n=c(e,"tr:first-child>th");let s=0;n.forEach((e,r)=>{"is-hidden"!=e.className&&(s+=t.colgroup[r])}),e.style.width=s+"px",o.style.width=r+"px",i.style.width=r+"px"}}function v(t){this instanceof v||console.error("Smart Table is a constructor and should be called with the `new` keyword"),window.addEventListener("load",()=>{setTimeout(this._init(t),0)})}v.prototype._init=function(t={}){t.selector||console.error("Smart Table init need a selector");const e=this;e.$options=t;const r=t.selector&&f(document,String(t.selector).trim());if(!r)return;const i=f(r,"table");if(!i)return;e.style={hoverBgColor:t.hoverBgColor||"#EFF8FF"},e.gutterWidth=function(){if(void 0!==y)return y;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 r=e.offsetWidth;e.style.overflow="scroll";const o=n("div");o.style.width="100%",s(e,o);const i=o.offsetWidth;return l(t.parentNode,t),y=r-i,y}(),r.classList.add("smart-table"),t.size&&r.classList.add("stb-cust-"+t.size),t.align&&r.classList.add("stb-cust-"+t.align);const d=f(i,"thead"),g=f(i,"tbody");c(d,"th").forEach(t=>h(t)),c(g,"td").forEach(t=>h(t)),i.hasAttribute("stripe")&&g.classList.add("stripe"),i.style.width="100%",e.$root=r;const v=d.offsetHeight,E=i.offsetHeight;let W=t.height;if(W=("function"==typeof W?W.call():W)||E,W=W>v?W:v+100,e.size={theadHeight:v,tbodyHeight:W-v,tabelWidth:i.offsetWidth,wrapperWidth:i.offsetWidth,tableHeight:W,fixWrapperHeigth:E>W?W:E},e.props=function(t){let e={},r=[],o=c(t,"tr");return o.forEach((t,e)=>{let o=r[e]||[];c(t,"th").forEach(t=>{let i=p(t,"rowspan",1),n=p(t,"colspan",1),s=function(t){for(let e=0,r=t.length;e1)for(let t=1;t1)for(let t=1;tth").forEach(t=>{let e=p(t,"width",0);0===e&&(e=t.offsetWidth>80?t.offsetWidth:80),o.push(e)}):c(e,"tr:first-child>td").forEach(t=>{let e=t.offsetWidth;e+=e<50?10:e>=50&&e<100?30:40,o.push(e)}),o}(d,g,e.props.theadLength),e.size.tabelWidth=i.style.width=e.colgroup.reduce((t,e)=>t+e),e.scrollY=Wth"),l=a.length;let d=0;if(0!==l){if(a[0].hasAttribute("fixed"))for(let t=0;t0;e--)if(a[e].hasAttribute("fixed")){if(e===d)break;s.thead.push("field-"+e);let o=p(a[e],"colspan",1);for(let e=0;e0){o=o>i.width?o:i.width;const n=m(t,e,i),a=x(t,r,i,"left");s(t.$root,A(t,n,a,i,"stb_fixed","left")),t.$fixedLeft=a}if(a.thead.length>0){o+=a.width;const i=m(t,e,a),l=x(t,r,a,"right");if(s(t.$root,A(t,i,l,a,"stb_fixed-right","right")),t.$fixedRight=l,t.scrollY){let e=n("div","stb_fixed-right-patch");e.style.width=t.gutterWidth+"px",e.style.height=t.size.theadHeight+"px",s(t.$root,e)}}t.$root.style.minWidth=o+"px"}(e,d,g),e.data=function(t,e){let r=t.$fixedLeft&&c(t.$fixedLeft,"tbody tr"),o=t.$fixedRight&&c(t.$fixedRight,"tbody tr"),i=[];return c(e,"tr").forEach((t,e)=>{if(!t.hasAttribute("unsort")){let n={$el:t,$fixedLeftEl:r&&r[e],$fixedRightEl:o&&o[e],$key:"$$rowkey"+e};c(t,"td .stb_cell").forEach((t,e)=>{n["field-"+e]=t.innerHTML}),i.push(n)}}),i}(e,g),function(t){(function(t){t.$tbodyWrapper.addEventListener("scroll",()=>function(t){!function(t,e){let r,o=0;return function(){let i=this,n=(new Date).getTime()-o,s=arguments;function a(){o=(new Date).getTime(),e.apply(i,s)}r&&clearTimeout(r),n>t?a():r=setTimeout(a,t-n)}}(20,()=>{t.$theadWrapper.scrollLeft=t.$tbodyWrapper.scrollLeft,t.$fixedLeft&&(t.$fixedLeft.scrollTop=t.$tbodyWrapper.scrollTop),t.$fixedRight&&(t.$fixedRight.scrollTop=t.$tbodyWrapper.scrollTop)})()}(t),{passive:!0})})(t),function(t){let e=c(t.$tbodyWrapper,"tr"),r=c(t.$root,".stb_fixed .stb_fixed-body-wrapper tr"),o=c(t.$root,".stb_fixed-right .stb_fixed-body-wrapper tr");e.forEach((e,i)=>{e.addEventListener("mouseenter",()=>{e.style.background=t.style.hoverBgColor,r.length>0&&(r[i].style.background=t.style.hoverBgColor),o.length>0&&(o[i].style.background=t.style.hoverBgColor)}),e.addEventListener("mouseleave",()=>{e.style.background="",r.length>0&&(r[i].style.background=""),o.length>0&&(o[i].style.background="")})})}(t),function(t){let e=Array.from(c(t.$root,"th[sort]"));0!==e.length&&e.forEach(r=>{r.addEventListener("click",i=>{i.stopPropagation();let n="ASC",s=r.getAttribute("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,r.getAttribute("sortkey"),n,s)})})}(t),function(t){window.addEventListener("resize",function(t,e){let r=null;return function(){null!==r&&clearTimeout(r),r=setTimeout(e,t)}}(600,()=>{let e=t.$root,r=t.size.wrapperWidth,o=t.size.tabelWidth,i=e.offsetWidth,n=parseInt(o*(i/r)),s=f(t.$theadWrapper,".stb_header"),a=f(t.$tbodyWrapper,".stb_body");t.colgroup.forEach((function(e,r){t.colgroup[r]=parseInt(n*(e/o))+1})),t.size.wrapperWidth=i,t.size.tabelWidth=n,s.style.width=n+"px",a.style.width=n+"px",b(t,s),b(t,a),w(t,f(e,".stb_fixed"),n),w(t,f(e,".stb_fixed-right"),n)}))}(t)}(e),e.scrollY){let t=n("th");t.setAttribute("width",e.gutterWidth),t.setAttribute("rowspan",e.props.shapes.length),s(f(d,"tr"),t)}};var E=v;window.SmartTable=E}]); \ No newline at end of file +/*! smartTable v1.1.1 | (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},s=(o(t.i,i,n),i.locals?i.locals:{});t.exports=s},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]}}(),s={};function a(t,e,r){for(var o=0;o*,.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;-webkit-border-radius:2em;-moz-border-radius:2em;-o-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,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=(s=o,a=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),"/*# ".concat(l," */")),n=o.sources.map((function(t){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(t," */")}));return[r].concat(n).concat([i]).join("\n")}var s,a,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;oe}function n(t,e){let r=document.createElement(t);return e&&(r.className=e),r}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,r=n("div","stb_cell");for(;e.length;)s(r,e[0]);s(t,r)}function u(t,e,r,o,i){let l=n("div",t),d=n("table","stb_"+r);return d.style.width=e.size.tabelWidth-1+"px",a(d,[g(e.colgroup,e.gutterWidth,i),o]),s(l,d),l}function b(t,e){let r=g(t.colgroup);e.replaceChild(r,f(e,"colgroup"))}function p(t,e,r){return Number.parseInt(t.getAttribute(e)||r)}function g(t,e,r){if(!t)return;let o=n("colgroup");if(t.forEach(t=>{let e=n("col");e.setAttribute("width",t),s(o,e)}),r){let t=n("col");t.setAttribute("width",e),s(o,t)}return o}function m(t,e,r){let o=d(e,!0);return c(o,"tr:first-child>th").forEach((t,e)=>{-1===r.thead.indexOf("field-"+e)&&t.classList.add("is-hidden")}),u("stb_fixed-header-wrapper",t,"header",o)}function x(t,e,r,o){let i=d(e,!0);c(i,"tr").forEach(t=>{let e=-1;c(t,"td").forEach((t,i)=>{"left"===o?e=i:e+=p(t,"colspan",1),-1===r.tbody.indexOf("field-"+e)&&t.classList.add("is-hidden")})});let n=u("stb_fixed-body-wrapper",t,"body",i);return n.style.top=t.size.theadHeight+"px",n.style.height=t.size.tbodyHeight-(t.scrollX?t.gutterWidth:0)+"px",n}function A(t,e,r,o,i,s){let l=n("div",i);return"right"===s&&(l.style.right=(t.scrollY?t.gutterWidth:0)+"px"),a(l,[e,r]),l.style.width=o.width+"px",l.style.height=t.size.fixWrapperHeigth-(t.scrollX?t.gutterWidth:0)+"px",l}let y;function w(t,e,r){if(e){let o=f(e,".stb_header"),i=f(e,".stb_body");b(t,o),b(t,i);const n=c(e,"tr:first-child>th");let s=0;n.forEach((e,r)=>{"is-hidden"!=e.className&&(s+=t.colgroup[r])}),e.style.width=s+"px",o.style.width=r+"px",i.style.width=r+"px"}}function v(t){this instanceof v||console.error("Smart Table is a constructor and should be called with the `new` keyword"),window.addEventListener("load",()=>{setTimeout(this._init(t),0)})}v.prototype._init=function(t={}){t.selector||console.error("Smart Table init need a selector");const e=this;e.$options=t;const r=t.selector&&f(document,String(t.selector).trim());if(!r)return;const i=f(r,"table");if(!i)return;e.style={hoverBgColor:t.hoverBgColor||"#EFF8FF"},e.gutterWidth=function(){if(void 0!==y)return y;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 r=e.offsetWidth;e.style.overflow="scroll";const o=n("div");o.style.width="100%",s(e,o);const i=o.offsetWidth;return l(t.parentNode,t),y=r-i,y}(),r.classList.add("smart-table"),t.size&&r.classList.add("stb-cust-"+t.size),t.align&&r.classList.add("stb-cust-"+t.align);const d=f(i,"thead"),g=f(i,"tbody");c(d,"th").forEach(t=>h(t)),c(g,"td").forEach(t=>h(t)),i.hasAttribute("stripe")&&g.classList.add("stripe"),i.style.width="100%",e.$root=r;const v=d.offsetHeight,E=i.offsetHeight;let k=t.height;if(k=("function"==typeof k?k.call():k)||E,k=k>v?k:v+100,e.size={theadHeight:v,tbodyHeight:k-v,tabelWidth:i.offsetWidth,wrapperWidth:i.offsetWidth,tableHeight:k,fixWrapperHeigth:E>k?k:E},e.props=function(t){let e={},r=[],o=c(t,"tr");return o.forEach((t,e)=>{let o=r[e]||[];c(t,"th").forEach(t=>{let i=p(t,"rowspan",1),n=p(t,"colspan",1),s=function(t){for(let e=0,r=t.length;e1)for(let t=1;t1)for(let t=1;tth").forEach(t=>{let e=p(t,"width",0);0===e&&(e=t.offsetWidth>80?t.offsetWidth:80),o.push(e)}):c(e,"tr:first-child>td").forEach(t=>{let e=t.offsetWidth;e+=e<50?10:e>=50&&e<100?30:40,o.push(e)}),o}(d,g,e.props.theadLength),e.size.tabelWidth=i.style.width=e.colgroup.reduce((t,e)=>t+e),e.scrollY=kth"),l=a.length;let d=0;if(0!==l){if(a[0].hasAttribute("fixed"))for(let t=0;t0;e--)if(a[e].hasAttribute("fixed")){if(e===d)break;s.thead.push("field-"+e);let o=p(a[e],"colspan",1);for(let e=0;e0){o=o>i.width?o:i.width;const n=m(t,e,i),a=x(t,r,i,"left");s(t.$root,A(t,n,a,i,"stb_fixed","left")),t.$fixedLeft=a}if(a.thead.length>0){o+=a.width;const i=m(t,e,a),l=x(t,r,a,"right");if(s(t.$root,A(t,i,l,a,"stb_fixed-right","right")),t.$fixedRight=l,t.scrollY){let e=n("div","stb_fixed-right-patch");e.style.width=t.gutterWidth+"px",e.style.height=t.size.theadHeight+"px",s(t.$root,e)}}t.$root.style.minWidth=o+"px"}(e,d,g),e.data=function(t,e){let r=t.$fixedLeft&&c(t.$fixedLeft,"tbody tr"),o=t.$fixedRight&&c(t.$fixedRight,"tbody tr"),i=[];return c(e,"tr").forEach((t,e)=>{if(!t.hasAttribute("unsort")){let n={$el:t,$fixedLeftEl:r&&r[e],$fixedRightEl:o&&o[e],$key:"$$rowkey"+e};c(t,"td .stb_cell").forEach((t,e)=>{n["field-"+e]=t.innerHTML}),i.push(n)}}),i}(e,g),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,s=arguments;function a(){o=(new Date).getTime(),e.apply(i,s)}r&&clearTimeout(r),n>t?a():r=setTimeout(a,t-n)}}(20,()=>{t.$theadWrapper.scrollLeft=t.$tbodyWrapper.scrollLeft,t.$fixedLeft&&(t.$fixedLeft.scrollTop=t.$tbodyWrapper.scrollTop),t.$fixedRight&&(t.$fixedRight.scrollTop=t.$tbodyWrapper.scrollTop)})()}(t),{passive:!0})})(t),function(t){let e=c(t.$tbodyWrapper,"tr"),r=c(t.$root,".stb_fixed .stb_fixed-body-wrapper tr"),o=c(t.$root,".stb_fixed-right .stb_fixed-body-wrapper tr");e.forEach((e,i)=>{e.addEventListener("mouseenter",()=>{e.style.background=t.style.hoverBgColor,r.length>0&&(r[i].style.background=t.style.hoverBgColor),o.length>0&&(o[i].style.background=t.style.hoverBgColor)}),e.addEventListener("mouseleave",()=>{e.style.background="",r.length>0&&(r[i].style.background=""),o.length>0&&(o[i].style.background="")})})}(t),function(t){let e=Array.from(c(t.$root,"th[sort]"));0!==e.length&&e.forEach(r=>{r.addEventListener("click",i=>{i.stopPropagation();let n="ASC",s=r.getAttribute("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,r.getAttribute("sortkey"),n,s)})})}(t),function(t){window.addEventListener("resize",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)}}(600,()=>{let e=t.$root,r=t.size.wrapperWidth,o=t.size.tabelWidth,i=e.offsetWidth,n=parseInt(o*(i/r)),s=f(t.$theadWrapper,".stb_header"),a=f(t.$tbodyWrapper,".stb_body");t.colgroup.forEach((function(e,r){t.colgroup[r]=parseInt(n*(e/o))+1})),t.size.wrapperWidth=i,t.size.tabelWidth=n,s.style.width=n+"px",a.style.width=n+"px",b(t,s),b(t,a),w(t,f(e,".stb_fixed"),n),w(t,f(e,".stb_fixed-right"),n)}))}(t)}(e),e.scrollY){let t=n("th");t.setAttribute("width",e.gutterWidth),t.setAttribute("rowspan",e.props.shapes.length),s(f(d,"tr"),t)}};var E=v;window.SmartTable=E}]); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index a133408..5020f63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "smart-utils", - "version": "1.0.0", + "name": "smart-table", + "version": "1.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -413,6 +413,15 @@ "readable-stream": "^2.0.6" } }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, "arr-diff": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", @@ -562,6 +571,21 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "dev": true }, + "autoprefixer": { + "version": "9.7.4", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.7.4.tgz", + "integrity": "sha512-g0Ya30YrMBAEZk60lp+qfX5YQllG+S5W3GYCFvyHTvhOki0AEQJLPEcIuGRsqVwLi8FvXPVtwTGhfr38hVpm0g==", + "dev": true, + "requires": { + "browserslist": "^4.8.3", + "caniuse-lite": "^1.0.30001020", + "chalk": "^2.4.2", + "normalize-range": "^0.1.2", + "num2fraction": "^1.2.2", + "postcss": "^7.0.26", + "postcss-value-parser": "^4.0.2" + } + }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -867,6 +891,17 @@ "pako": "~1.0.5" } }, + "browserslist": { + "version": "4.8.6", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.8.6.tgz", + "integrity": "sha512-ZHao85gf0eZ0ESxLfCp73GG9O/VTytYDIkIiZDlURppLTI9wErSM/5yAKEq6rcUdxBLjMELmrYUJGg5sxGKMHg==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001023", + "electron-to-chromium": "^1.3.341", + "node-releases": "^1.1.47" + } + }, "buffer": { "version": "4.9.2", "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", @@ -965,6 +1000,30 @@ "unset-value": "^1.0.0" } }, + "caller-callsite": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", + "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", + "dev": true, + "requires": { + "callsites": "^2.0.0" + } + }, + "caller-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", + "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", + "dev": true, + "requires": { + "caller-callsite": "^2.0.0" + } + }, + "callsites": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", + "dev": true + }, "camel-case": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", @@ -999,6 +1058,12 @@ } } }, + "caniuse-lite": { + "version": "1.0.30001024", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001024.tgz", + "integrity": "sha512-LubRSEPpOlKlhZw9wGlLHo8ZVj6ugGU3xGUfLPneNBledSd9lIM5cCGZ9Mz/mMCJUhEt4jZpYteZNVRdJw5FRA==", + "dev": true + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -1380,6 +1445,30 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, + "cosmiconfig": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz", + "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==", + "dev": true, + "requires": { + "import-fresh": "^2.0.0", + "is-directory": "^0.3.1", + "js-yaml": "^3.13.1", + "parse-json": "^4.0.0" + }, + "dependencies": { + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + } + } + }, "create-ecdh": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", @@ -1833,6 +1922,12 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", "dev": true }, + "electron-to-chromium": { + "version": "1.3.345", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.345.tgz", + "integrity": "sha512-f8nx53+Z9Y+SPWGg3YdHrbYYfIJAtbUjpFfW4X1RwTZ94iUG7geg9tV8HqzAXX7XTNgyWgAFvce4yce8ZKxKmg==", + "dev": true + }, "elliptic": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", @@ -1974,6 +2069,12 @@ "estraverse": "^4.1.1" } }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, "esrecurse": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", @@ -3650,6 +3751,34 @@ "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", "dev": true }, + "import-cwd": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz", + "integrity": "sha1-qmzzbnInYShcs3HsZRn1PiQ1sKk=", + "dev": true, + "requires": { + "import-from": "^2.1.0" + } + }, + "import-fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", + "integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=", + "dev": true, + "requires": { + "caller-path": "^2.0.0", + "resolve-from": "^3.0.0" + } + }, + "import-from": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-from/-/import-from-2.1.0.tgz", + "integrity": "sha1-M1238qev/VOqpHHUuAId7ja387E=", + "dev": true, + "requires": { + "resolve-from": "^3.0.0" + } + }, "import-local": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", @@ -3859,6 +3988,12 @@ } } }, + "is-directory": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", + "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", + "dev": true + }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", @@ -4026,6 +4161,16 @@ "integrity": "sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw==", "dev": true }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", @@ -4606,6 +4751,23 @@ } } }, + "node-releases": { + "version": "1.1.47", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.47.tgz", + "integrity": "sha512-k4xjVPx5FpwBUj0Gw7uvFOTF4Ep8Hok1I6qjwL3pLfwe7Y0REQSAqOwwv9TWBCUtMHxcXfY4PgRLRozcChvTcA==", + "dev": true, + "requires": { + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "node-sass": { "version": "4.13.0", "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.13.0.tgz", @@ -4710,6 +4872,12 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, + "normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", + "dev": true + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -4740,6 +4908,12 @@ "boolbase": "~1.0.0" } }, + "num2fraction": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz", + "integrity": "sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4=", + "dev": true + }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", @@ -5227,6 +5401,41 @@ } } }, + "postcss-load-config": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-2.1.0.tgz", + "integrity": "sha512-4pV3JJVPLd5+RueiVVB+gFOAa7GWc25XQcMp86Zexzke69mKf6Nx9LRcQywdz7yZI9n1udOxmLuAwTBypypF8Q==", + "dev": true, + "requires": { + "cosmiconfig": "^5.0.0", + "import-cwd": "^2.0.0" + } + }, + "postcss-loader": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-3.0.0.tgz", + "integrity": "sha512-cLWoDEY5OwHcAjDnkyRQzAXfs2jrKjXpO/HQFcc5b5u/r7aa471wdmChmwfnv7x2u840iat/wi0lQ5nbRgSkUA==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "postcss": "^7.0.0", + "postcss-load-config": "^2.0.0", + "schema-utils": "^1.0.0" + }, + "dependencies": { + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + } + } + }, "postcss-modules-extract-imports": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-2.0.0.tgz", @@ -6505,6 +6714,12 @@ "extend-shallow": "^3.0.0" } }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, "sshpk": { "version": "1.16.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", diff --git a/package.json b/package.json index 53f30be..8dcb77d 100644 --- a/package.json +++ b/package.json @@ -12,12 +12,14 @@ "author": "pyj92055@163.com", "license": "MIT", "devDependencies": { + "autoprefixer": "^9.7.4", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^5.1.1", "css-loader": "^3.4.1", "extract-text-webpack-plugin": "^3.0.2", "html-webpack-plugin": "^3.2.0", "node-sass": "^4.13.0", + "postcss-loader": "^3.0.0", "sass-loader": "^8.0.0", "style-loader": "^1.1.2", "uglifyjs-webpack-plugin": "^2.2.0", @@ -28,4 +30,4 @@ }, "dependencies": {}, "keywords": [] -} \ No newline at end of file +} diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..afeb286 --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,5 @@ +module.exports = { + plugins: [ + require('autoprefixer') + ] +} \ No newline at end of file