UNPKG

react-table-pro

Version:
1 lines 18.8 kB
module.exports=(()=>{var e={228:e=>{e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}},858:e=>{e.exports=function(e){if(Array.isArray(e))return e}},506:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},926:e=>{function t(e,t,r,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}e.exports=function(e){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=e.apply(r,n);function c(e){t(i,o,a,c,u,"next",e)}function u(e){t(i,o,a,c,u,"throw",e)}c(void 0)}))}}},575:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},913:e=>{function t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}},713:e=>{e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},754:e=>{function t(r){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},t(r)}e.exports=t},205:(e,t,r)=>{var n=r(489);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}},884:e=>{e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(n=(i=c.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw a}}return r}}},521:e=>{e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},585:(e,t,r)=>{var n=r(8),o=r(506);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?o(e):t}},489:e=>{function t(r,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(r,n)}e.exports=t},38:(e,t,r)=>{var n=r(858),o=r(884),a=r(379),i=r(521);e.exports=function(e,t){return n(e)||o(e,t)||a(e,t)||i()}},8:e=>{function t(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(r)}e.exports=t},379:(e,t,r)=>{var n=r(228);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}},757:(e,t,r)=>{e.exports=r(666)},493:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Table:()=>$,sortDirection:()=>R});var n=r(757),o=r.n(n),a=r(926),i=r.n(a),c=r(38),u=r.n(c),l=r(713),s=r.n(l);const f=require("react");var p=r.n(f);function h(){for(var e=[],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(var o=0,a=r;o<a.length;o++){var i=a[o];if(i)if("string"!=typeof i)for(var c=Object.keys(i),u=0,l=c;u<l.length;u++){var s=l[u];i[s]&&e.push(s)}else e.push(i)}return e.join(" ")}var d="static";function y(e){var t=e.size,r=e.lineWidth,n=e.arcColor,o=e.circleColor,a=e.isShow,i=e.wrapperWidth,c=e.wrapperHeight,u=e.position,l=e.wrapperColor,f=e.wrapperPadding,y=e.className;if(!1===a)return null;var v=u||d,m=t||48,g={borderWidth:r,width:m,height:m,borderColor:o,borderTopColor:n},b={minHeight:m,minWidth:m,position:v,backgroundColor:l,width:i,height:c,padding:f};return p().createElement("div",{className:h("e48c57",y,s()({},"_3fad33",v===d)),style:b},p().createElement("div",{className:"_395527",style:g}))}function v(e){var t=e.isRender,r=e.children;return t?r:null}const m="ed688d",g="_345528";function b(e){var t=e.colSpan,r=e.isInProgress?"_90f714":"_2bf402";return p().createElement("tbody",null,p().createElement("tr",{className:g},p().createElement("td",{colSpan:t},p().createElement("p",{className:r},"∅"))))}var w=r(575),x=r.n(w),E=r(913),P=r.n(E),S=r(205),O=r.n(S),L=r(585),j=r.n(L),_=r(754),k=r.n(_),N=[5,10,25,50,100,1e3,5e3,1e4],C=N[4],R={asc:"asc",desc:"desc"};function I(e){var t=e.direction;if(!t)return null;var r=t===R.asc?"d0a067":"_9b1664";return p().createElement("svg",{className:r,viewBox:"0 0 24 24"},p().createElement("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z",fill:"#777"}))}function B(e){var t=e.children,r=e.align,n=e.direction,o=e.handleSort,a=h("_6c63d4",s()({},"cf090b",Boolean(o)));return p().createElement("th",{align:r,className:a,onClick:o},p().createElement("div",{className:"f16a8f"},p().createElement(I,{direction:n}),t))}var T=function(e){O()(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=k()(t);if(r){var o=k()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return j()(this,e)});function o(){return x()(this,o),n.apply(this,arguments)}return P()(o,[{key:"createSortHandler",value:function(e){var t=this;return function(){(0,t.props.onRequestSort)(e)}}},{key:"renderCell",value:function(e){var t=this.props,r=t.order,n=t.orderBy,o=e.id,a=e.label,i=e.hasSort,c=e.align;if(!1===i)return p().createElement(B,{align:c,key:o+"-no-sort"},a);var u=this.createSortHandler(o);return n===o?p().createElement(B,{align:c,direction:r,handleSort:u,key:o+"-sort-active"},a):p().createElement(B,{align:c,handleSort:u,key:o+"-sort"},a)}},{key:"render",value:function(){var e=this,t=this.props.columnList;return p().createElement("thead",null,p().createElement("tr",null,t.map((function(t){return e.renderCell(t)}))))}}]),o}(f.Component);function D(e){return e.title}function A(e){return"number"==typeof e&&!Number.isNaN(e)}var G=p().createElement("path",{d:"M9,16.2L4.8,12l-1.4,1.4L9,19L21,7l-1.4-1.4L9,16.2z",fill:"#0c0"}),M=p().createElement("path",{d:"M19,13H5v-2h14V13z",fill:"#999"});function F(e){var t=e.isChecked;return p().createElement("svg",{className:"_355b6b",height:"24px",version:"1.1",viewBox:"0 0 24 24",width:"24px",x:"0px",xmlns:"http://www.w3.org/2000/svg",y:"0px"},t?G:M)}var H=function(e){O()(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=k()(t);if(r){var o=k()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return j()(this,e)});function o(){return x()(this,o),n.apply(this,arguments)}return P()(o,[{key:"getCellValue",value:function(e,t){var r=t[e.id];return"boolean"==typeof r?p().createElement(F,{isChecked:r}):r}},{key:"renderCell",value:function(e,t){var r=e.id,n=this.getCellValue(e,t);return p().createElement("td",{align:e.align,className:"_2581d3",key:r},n)}},{key:"renderRow",value:function(e,t){var r=this,n=this.props.header.columnList;return p().createElement("tr",{className:g,key:t},n.map((function(t){return r.renderCell(t,e)})))}},{key:"render",value:function(){var e=this,t=this.props.table.rowList;return p().createElement("tbody",null,t.map((function(t,r){return e.renderRow(t,r)})))}}]),o}(f.Component);function V(e){var t=JSON.stringify(e.header.title||{})||"no-table-name",r=e.header.columnList.map((function(e){return e.id})).join(" | ");return'Table "'.concat(t,'" - ').concat(r)}function q(e,t){var r={order:e.order,orderBy:e.orderBy,rowsPerPage:e.rowsPerPage};return localStorage.setItem(V(t),JSON.stringify(r)),r}const z="_8636d9";function W(e){return p().createElement("option",{key:e,value:e},e)}function J(e){var t=e.count,r=e.onChangePageIndex,n=e.onChangeRowsPerPage,o=e.pageIndex,a=e.rowsPerPage,i=e.optionList,c=o<=0,u=o+1>=t/a,l=h("_7eac79",s()({},z,c)),f=h("_94de26",s()({},z,u));function d(e){var t=Number.parseInt(e.currentTarget.value,10);r(0),n(t)}return p().createElement("div",{className:"_40b779"},p().createElement("select",{"aria-label":"rows per page",className:"c2ebb1",defaultValue:a,onBlur:d,onChange:d},i.map(W)),p().createElement("p",{className:"_7c9922"},function(e,t,r){var n=e*t+1,o=n+t-1;return"".concat(n,"-").concat(o," / ").concat(r)}(o,a,t)),p().createElement("button",{"aria-label":"previous page",className:l,onClick:function(){r(o-1)},type:"button"},"⇦"),p().createElement("button",{"aria-label":"next page",className:f,onClick:function(){r(o+1)},type:"button"},"⇨"))}function Y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function U(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(r),!0).forEach((function(t){s()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function $(e){var t=e.getData,r=e.header,n=r.columnList,a=r.title,c=U(U(U({},function(e){return{order:R.asc,orderBy:e.header.columnList[0].id,rowsPerPage:C}}(e)),function(e){var t,r=V(e),n=JSON.parse(localStorage.getItem(r)||"{}"),o=n.order,a=n.orderBy,i=n.rowsPerPage,c=R.asc,u=R.desc;return{order:o===u?u:c,orderBy:(t=a,"string"==typeof t?a:e.header.columnList[0].id),rowsPerPage:A(i)?i:C}}(e)),{},{pageIndex:0,list:[],count:0,isInProgress:!1}),l=(0,f.useState)(c.order),s=u()(l,2),h=s[0],d=s[1],g=(0,f.useState)(c.orderBy),w=u()(g,2),x=w[0],E=w[1],P=(0,f.useState)(c.rowsPerPage),S=u()(P,2),O=S[0],L=S[1],j=(0,f.useState)(c.pageIndex),_=u()(j,2),k=_[0],I=_[1],B=(0,f.useState)(c.list),G=u()(B,2),M=G[0],F=G[1],z=(0,f.useState)(c.count),W=u()(z,2),Y=W[0],$=W[1],K=(0,f.useState)(c.isInProgress),Q=u()(K,2),X=Q[0],Z=Q[1],ee=(0,f.useCallback)(function(){var r=i()(o().mark((function r(){var a;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return Z(!0),r.next=3,t(k,O,x,h,n);case 3:a=r.sent,F(a.list),$(a.count),Z(!1),q({order:h,orderBy:x,rowsPerPage:O},e);case 8:case"end":return r.stop()}}),r)})));function n(){return r.apply(this,arguments)}return n}(),[t,h,x,k,O,e]);function te(e){var t=R.asc,r=R.desc;d(x===e&&h===r?t:r),E(e)}function re(e){I(e)}function ne(e){L(e)}(0,f.useEffect)((function(){ee().catch(console.error)}),[k,O,x,h,ee]);var oe=M.length>0;return p().createElement("div",{className:"c41e5f"},p().createElement(D,{title:a}),p().createElement(y,{isShow:X,position:"absolute",wrapperColor:"rgba(255, 255, 255, 0.5)"}),p().createElement(v,{isRender:!oe},p().createElement("table",{className:m,key:"table-no-data"},p().createElement(T,{columnList:n,onRequestSort:te,order:h,orderBy:x}),p().createElement(b,{colSpan:n.length,isInProgress:X})),p().createElement(J,{count:Y,onChangePageIndex:re,onChangeRowsPerPage:ne,optionList:N,pageIndex:k,rowsPerPage:O})),p().createElement(v,{isRender:oe},p().createElement("table",{className:m,key:"table"},p().createElement(T,{columnList:n,onRequestSort:te,order:h,orderBy:x}),p().createElement(H,{header:r,table:{rowList:M}})),p().createElement(J,{count:Y,onChangePageIndex:re,onChangeRowsPerPage:ne,optionList:N,pageIndex:k,rowsPerPage:O})))}},666:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),i=new _(n||[]);return a._invoke=function(e,t,r){var n=f;return function(o,a){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw a;return N()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=O(i,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var u=s(e,t,r);if("normal"===u.type){if(n=r.done?d:p,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=d,r.method="throw",r.arg=u.arg)}}}(e,r,i),a}function s(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var f="suspendedStart",p="suspendedYield",h="executing",d="completed",y={};function v(){}function m(){}function g(){}var b={};b[a]=function(){return this};var w=Object.getPrototypeOf,x=w&&w(w(k([])));x&&x!==r&&n.call(x,a)&&(b=x);var E=g.prototype=v.prototype=Object.create(b);function P(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function r(o,a,i,c){var u=s(e[o],e,a);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,i,c)}),(function(e){r("throw",e,i,c)})):t.resolve(f).then((function(e){l.value=e,i(l)}),(function(e){return r("throw",e,i,c)}))}c(u.arg)}var o;this._invoke=function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}}function O(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=s(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function k(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}return{next:N}}function N(){return{value:t,done:!0}}return m.prototype=E.constructor=g,g.constructor=m,m.displayName=u(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,u(e,c,"GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return{__await:e}},P(S.prototype),S.prototype[i]=function(){return this},e.AsyncIterator=S,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new S(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},P(E),u(E,c,"Generator"),E[a]=function(){return this},E.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=k,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),l=n.call(i,"finallyLoc");if(u&&l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),j(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:k(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}},t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(493)})();