react-bootstrap-table2-toolkit
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactBootstrapTable2Toolkit=t(require("react")):e.ReactBootstrapTable2Toolkit=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(t,r){t.exports=e},function(e,t,r){e.exports=r(6)()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=function(){function e(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)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(0),c=n(s),f=r(1),p=n(f),d=r(13),h=n(d),y=r(20),v=n(y),b=c.default.createContext(),m=function(e){function t(e){o(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={searchText:"object"===i(e.search)?e.search.defaultSearch||"":""},r._=null,r.onClear=r.onClear.bind(r),r.onSearch=r.onSearch.bind(r),r.setDependencyModules=r.setDependencyModules.bind(r),r}return u(t,e),l(t,[{key:"onSearch",value:function(e){e!==this.state.searchText&&this.setState({searchText:e})}},{key:"onClear",value:function(){this.setState({searchText:""})}},{key:"setDependencyModules",value:function(e){this._=e}},{key:"render",value:function(){var e={keyField:this.props.keyField,columns:this.props.columns,data:this.props.data,bootstrap4:this.props.bootstrap4,setDependencyModules:this.setDependencyModules,registerExposedAPI:this.registerExposedAPI};return this.props.search&&(e.search={searchContext:(0,v.default)(this.props.search),searchText:this.state.searchText}),c.default.createElement(b.Provider,{value:{searchProps:{searchText:this.state.searchText,onSearch:this.onSearch,onClear:this.onClear},csvProps:{onExport:this.handleExportCSV},baseProps:e}},this.props.children)}}]),t}((0,h.default)(c.default.Component));m.propTypes={keyField:p.default.string.isRequired,data:p.default.array.isRequired,columns:p.default.array.isRequired,children:p.default.node.isRequired,bootstrap4:p.default.bool,search:p.default.oneOfType([p.default.bool,p.default.shape({defaultSearch:p.default.string,searchFormatted:p.default.bool})]),exportCSV:p.default.oneOfType([p.default.bool,p.default.shape({fileName:p.default.string,separator:p.default.string,ignoreHeader:p.default.bool,noAutoBOM:p.default.bool,exportAll:p.default.bool,onlyExportSelection:p.default.bool})])},m.defaultProps={search:!1,exportCSV:!1,bootstrap4:!1},t.default={Provider:m,Consumer:b.Consumer}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.CSVExport=t.Search=t.ToolkitContext=void 0;var o=r(4);Object.defineProperty(t,"Search",{enumerable:!0,get:function(){return n(o).default}});var a=r(11);Object.defineProperty(t,"CSVExport",{enumerable:!0,get:function(){return n(a).default}});var u=r(2),i=n(u),l=r(21),s=n(l);t.default=s.default;t.ToolkitContext=i.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),a=n(o),u=r(10),i=n(u);t.default={SearchBar:a.default,ClearSearchButton:i.default}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(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)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=arguments,s=r(0),c=n(s),f=r(1),p=n(f),d=function(e,t,r){var n=void 0;return function(){var o=function(){n=null,r||e.apply(void 0,l)},a=r&&!n;clearTimeout(n),n=setTimeout(o,t||0),a&&e.appy(void 0,l)}},h=function(e){function t(e){o(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.onChangeValue=function(e){r.setState({value:e.target.value})},r.onKeyup=function(){var e=r.props,t=e.delay,n=e.onSearch;d(function(){n(r.input.value)},t)()},r.state={value:e.searchText},r}return u(t,e),i(t,[{key:"componentWillReceiveProps",value:function(e){this.setState({value:e.searchText})}},{key:"render",value:function(){var e=this,r=this.props,n=r.className,o=r.style,a=r.placeholder;return c.default.createElement("input",{ref:function(t){return e.input=t},type:"text",style:o,onKeyUp:function(){return e.onKeyup()},onChange:this.onChangeValue,className:"form-control "+n,value:this.state.value,placeholder:a||t.defaultProps.placeholder})}}]),t}(c.default.Component);h.propTypes={onSearch:p.default.func.isRequired,className:p.default.string,placeholder:p.default.string,style:p.default.object,delay:p.default.number,searchText:p.default.string},h.defaultProps={className:"",style:{},placeholder:"Search",delay:250,searchText:""},t.default=h},function(e,t,r){"use strict";var n=r(7),o=r(8),a=r(9);e.exports=function(){function e(e,t,r,n,u,i){i!==a&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return r.checkPropTypes=n,r.PropTypes=r,r}},function(e,t,r){"use strict";function n(e){return function(){return e}}var o=function(){};o.thatReturns=n,o.thatReturnsFalse=n(!1),o.thatReturnsTrue=n(!0),o.thatReturnsNull=n(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,r){"use strict";function n(e,t,r,n,a,u,i,l){if(o(t),!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,a,u,i,l],f=0;s=new Error(t.replace(/%s/g,function(){return c[f++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}var o=function(e){};e.exports=n},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),a=n(o),u=r(1),i=n(u),l=function(e){var t=e.onClear,r=e.text;return a.default.createElement("button",{className:"btn btn-default",onClick:t},r)};l.propTypes={onClear:i.default.func.isRequired,text:i.default.string},l.defaultProps={text:"Clear"},t.default=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(12),o=function(e){return e&&e.__esModule?e:{default:e}}(n);t.default={ExportCSVButton:o.default}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(0),i=n(u),l=r(1),s=n(l),c=function(e){var t=e.onExport,r=e.children,n=o(e,["onExport","children"]);return i.default.createElement("button",a({type:"button",onClick:function(){return t()}},n),r)};c.propTypes={children:s.default.node.isRequired,onExport:s.default.func.isRequired,className:s.default.string,style:s.default.object},c.defaultProps={className:"react-bs-table-csv-btn btn btn-default",style:{}},t.default=c},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=r(14),i=function(e){return e&&e.__esModule?e:{default:e}}(u);t.default=function(e){return function(e){function t(){var e,r,a,u;n(this,t);for(var i=arguments.length,l=Array(i),s=0;s<i;s++)l[s]=arguments[s];return r=a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),a.registerExposedAPI=function(e){a.tableExposedAPIEmitter=e},u=r,o(a,u)}return a(t,e),t}(i.default.csvOperation(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(15),o=function(e){return e&&e.__esModule?e:{default:e}}(n);t.default={csvOperation:o.default}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(16),l={fileName:"spreadsheet.csv",separator:",",ignoreHeader:!1,noAutoBOM:!0,exportAll:!0,onlyExportSelection:!1};t.default=function(e){return function(e){function t(){var e,r,a,s;n(this,t);for(var c=arguments.length,f=Array(c),p=0;p<c;p++)f[p]=arguments[p];return r=a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(f))),a.handleExportCSV=function(e){var t=a.props,r=t.columns,n=t.exportCSV,o=t.keyField,s=(0,i.getMetaInfo)(r),c=!0===n?l:u({},l,n),f=void 0;if(void 0!==e)f=e;else if(c.exportAll)f=a.props.data;else{var p={};a.tableExposedAPIEmitter.emit("get.table.data",p),f=p.result}if(c.onlyExportSelection){var d={};a.tableExposedAPIEmitter.emit("get.selected.rows",d);var h=d.result;f=f.filter(function(e){return!!h.find(function(t){return e[o]===t})})}var y=(0,i.transform)(f,s,a._.get,c);(0,i.save)(y,c)},s=r,o(a,s)}return a(t,e),t}(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.save=t.transform=t.getMetaInfo=void 0;var n=r(17),o=function(e){return e&&e.__esModule?e:{default:e}}(n);t.getMetaInfo=function(e){return e.map(function(e){return{field:e.dataField,type:e.csvType||String,formatter:e.csvFormatter,formatExtraData:e.formatExtraData,header:e.csvText||e.text,export:!1!==e.csvExport,row:Number(e.row)||0,rowSpan:Number(e.rowSpan)||1,colSpan:Number(e.colSpan)||1}}).filter(function(e){return e.export})},t.transform=function(e,t,r,n){var o=n.separator,a=n.ignoreHeader,u=t.filter(function(e){return e.export}),i="";return a||(i+=u.map(function(e){return'"'+e.header+'"'}).join(o),i+="\n"),0===e.length?i:i+=e.map(function(e,t){return u.map(function(n){var o=r(e,n.field);return n.formatter&&(o=n.formatter(o,e,t,n.formatExtraData)),n.type===String?'"'+o+'"':o}).join(o)}).join("\n")},t.save=function(e,t){var r=t.noAutoBOM,n=t.fileName;o.default.saveAs(new Blob([e],{type:"text/plain;charset=utf-8"}),n,r)}},function(e,t,r){var n,o=o||function(e){"use strict";if(!(void 0===e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=e.document,r=function(){return e.URL||e.webkitURL||e},n=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in n,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},u=/constructor/i.test(e.HTMLElement)||e.safari,i=/CriOS\/[\d]+/.test(navigator.userAgent),l=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},s=function(e){var t=function(){"string"==typeof e?r().revokeObjectURL(e):e.remove()};setTimeout(t,4e4)},c=function(e,t,r){t=[].concat(t);for(var n=t.length;n--;){var o=e["on"+t[n]];if("function"==typeof o)try{o.call(e,r||e)}catch(e){l(e)}}},f=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},p=function(t,l,p){p||(t=f(t));var d,h=this,y=t.type,v="application/octet-stream"===y,b=function(){c(h,"writestart progress write writeend".split(" "))};if(h.readyState=h.INIT,o)return d=r().createObjectURL(t),void setTimeout(function(){n.href=d,n.download=l,a(n),b(),s(d),h.readyState=h.DONE});!function(){if((i||v&&u)&&e.FileReader){var n=new FileReader;return n.onloadend=function(){var t=i?n.result:n.result.replace(/^data:[^;]*;/,"data:attachment/file;");e.open(t,"_blank")||(e.location.href=t),t=void 0,h.readyState=h.DONE,b()},n.readAsDataURL(t),void(h.readyState=h.INIT)}if(d||(d=r().createObjectURL(t)),v)e.location.href=d;else{e.open(d,"_blank")||(e.location.href=d)}h.readyState=h.DONE,b(),s(d)}()},d=p.prototype,h=function(e,t,r){return new p(e,t||e.name||"download",r)};return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,r){return t=t||e.name||"download",r||(e=f(e)),navigator.msSaveOrOpenBlob(e,t)}:(d.abort=function(){},d.readyState=d.INIT=0,d.WRITING=1,d.DONE=2,d.error=d.onwritestart=d.onprogress=d.onwrite=d.onabort=d.onerror=d.onwriteend=null,h)}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);void 0!==e&&e.exports?e.exports.saveAs=o:null!==r(18)&&null!==r(19)&&void 0!==(n=function(){return o}.call(t,r,t,e))&&(e.exports=n)},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(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)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=r(0),s=n(l),c=r(1),f=n(c);t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{searchFormatted:!1};return function(t,r,n){var l=s.default.createContext(),c=function(c){function f(e){o(this,f);var t=a(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,e)),u=e.data;return r()&&""!==t.props.searchText?n(t.props.searchText):(u=t.search(e.searchText.toLowerCase()),t.triggerListener(u)),t.state={data:u},t}return u(f,c),i(f,[{key:"componentWillReceiveProps",value:function(e){if(e.searchText!==this.props.searchText)if(r())n(e.searchText);else{var t=this.search(e.searchText.toLowerCase());this.triggerListener(t),this.setState({data:t})}else r()&&this.setState({data:e.data})}},{key:"triggerListener",value:function(e){this.props.dataChangeListener&&this.props.dataChangeListener.emit("filterChanged",e.length)}},{key:"search",value:function(r){var n=this.props,o=n.data,a=n.columns;return o.filter(function(n,o){for(var u=0;u<a.length;u+=1){var i=a[u];if(!1!==i.searchable){var l=t.get(n,i.dataField);if(i.formatter&&e.searchFormatted?l=i.formatter(l,n,o,i.formatExtraData):i.filterValue&&(l=i.filterValue(l,n)),null!==l&&void 0!==l&&(l=l.toString().toLowerCase(),l.indexOf(r)>-1))return!0}}return!1})}},{key:"render",value:function(){return s.default.createElement(l.Provider,{value:{data:this.state.data}},this.props.children)}}]),f}(s.default.Component);return c.propTypes={data:f.default.array.isRequired,columns:f.default.array.isRequired,searchText:f.default.string,dataChangeListener:f.default.object},{Provider:c,Consumer:l.Consumer}}}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),a=n(o),u=r(1),i=n(u),l=r(2),s=n(l),c=function(e){return a.default.createElement(s.default.Provider,e,a.default.createElement(s.default.Consumer,null,function(t){return e.children(t)}))};c.propTypes={children:i.default.func.isRequired},t.default=c}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactBootstrapTable2Toolkit=t(require("react")):e.ReactBootstrapTable2Toolkit=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(t,r){t.exports=e},function(e,t,r){e.exports=r(6)()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(){function e(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)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=r(0),c=n(l),f=r(1),p=n(f),d=r(13),h=n(d),y=r(20),v=n(y),b=c.default.createContext(),m=function(e){function t(e){o(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={searchText:"object"===i(e.search)?e.search.defaultSearch||"":""},r._=null,r.onClear=r.onClear.bind(r),r.onSearch=r.onSearch.bind(r),r.setDependencyModules=r.setDependencyModules.bind(r),r}return u(t,e),s(t,[{key:"onSearch",value:function(e){e!==this.state.searchText&&this.setState({searchText:e})}},{key:"onClear",value:function(){this.setState({searchText:""})}},{key:"setDependencyModules",value:function(e){this._=e}},{key:"render",value:function(){var e={keyField:this.props.keyField,columns:this.props.columns,data:this.props.data,bootstrap4:this.props.bootstrap4,setDependencyModules:this.setDependencyModules,registerExposedAPI:this.registerExposedAPI};return this.props.search&&(e.search={searchContext:(0,v.default)(this.props.search),searchText:this.state.searchText}),c.default.createElement(b.Provider,{value:{searchProps:{searchText:this.state.searchText,onSearch:this.onSearch,onClear:this.onClear},csvProps:{onExport:this.handleExportCSV},baseProps:e}},this.props.children)}}]),t}((0,h.default)(c.default.Component));m.propTypes={keyField:p.default.string.isRequired,data:p.default.array.isRequired,columns:p.default.array.isRequired,children:p.default.node.isRequired,bootstrap4:p.default.bool,search:p.default.oneOfType([p.default.bool,p.default.shape({defaultSearch:p.default.string,searchFormatted:p.default.bool})]),exportCSV:p.default.oneOfType([p.default.bool,p.default.shape({fileName:p.default.string,separator:p.default.string,ignoreHeader:p.default.bool,noAutoBOM:p.default.bool,exportAll:p.default.bool,onlyExportSelection:p.default.bool})])},m.defaultProps={search:!1,exportCSV:!1,bootstrap4:!1},t.default={Provider:m,Consumer:b.Consumer}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.CSVExport=t.Search=t.ToolkitContext=void 0;var o=r(4);Object.defineProperty(t,"Search",{enumerable:!0,get:function(){return n(o).default}});var a=r(11);Object.defineProperty(t,"CSVExport",{enumerable:!0,get:function(){return n(a).default}});var u=r(2),i=n(u),s=r(21),l=n(s);t.default=l.default;t.ToolkitContext=i.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),a=n(o),u=r(10),i=n(u);t.default={SearchBar:a.default,ClearSearchButton:i.default}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(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)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=arguments,l=r(0),c=n(l),f=r(1),p=n(f),d=function(e,t,r){var n=void 0;return function(){var o=function(){n=null,r||e.apply(void 0,s)},a=r&&!n;clearTimeout(n),n=setTimeout(o,t||0),a&&e.appy(void 0,s)}},h=function(e){function t(e){o(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.onChangeValue=function(e){r.setState({value:e.target.value})},r.onKeyup=function(){var e=r.props,t=e.delay,n=e.onSearch;d(function(){n(r.input.value)},t)()},r.state={value:e.searchText},r}return u(t,e),i(t,[{key:"componentWillReceiveProps",value:function(e){this.setState({value:e.searchText})}},{key:"render",value:function(){var e=this,r=this.props,n=r.className,o=r.style,a=r.placeholder;return c.default.createElement("input",{ref:function(t){return e.input=t},type:"text",style:o,onKeyUp:function(){return e.onKeyup()},onChange:this.onChangeValue,className:"form-control "+n,value:this.state.value,placeholder:a||t.defaultProps.placeholder})}}]),t}(c.default.Component);h.propTypes={onSearch:p.default.func.isRequired,className:p.default.string,placeholder:p.default.string,style:p.default.object,delay:p.default.number,searchText:p.default.string},h.defaultProps={className:"",style:{},placeholder:"Search",delay:250,searchText:""},t.default=h},function(e,t,r){"use strict";var n=r(7),o=r(8),a=r(9);e.exports=function(){function e(e,t,r,n,u,i){i!==a&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return r.checkPropTypes=n,r.PropTypes=r,r}},function(e,t,r){"use strict";function n(e){return function(){return e}}var o=function(){};o.thatReturns=n,o.thatReturnsFalse=n(!1),o.thatReturnsTrue=n(!0),o.thatReturnsNull=n(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,r){"use strict";function n(e,t,r,n,a,u,i,s){if(o(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,a,u,i,s],f=0;l=new Error(t.replace(/%s/g,function(){return c[f++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var o=function(e){};e.exports=n},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),a=n(o),u=r(1),i=n(u),s=function(e){var t=e.onClear,r=e.text;return a.default.createElement("button",{className:"btn btn-default",onClick:t},r)};s.propTypes={onClear:i.default.func.isRequired,text:i.default.string},s.defaultProps={text:"Clear"},t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(12),o=function(e){return e&&e.__esModule?e:{default:e}}(n);t.default={ExportCSVButton:o.default}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(0),i=n(u),s=r(1),l=n(s),c=function(e){var t=e.onExport,r=e.children,n=o(e,["onExport","children"]);return i.default.createElement("button",a({type:"button",onClick:function(){return t()}},n),r)};c.propTypes={children:l.default.node.isRequired,onExport:l.default.func.isRequired,className:l.default.string,style:l.default.object},c.defaultProps={className:"react-bs-table-csv-btn btn btn-default",style:{}},t.default=c},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=r(14),i=function(e){return e&&e.__esModule?e:{default:e}}(u);t.default=function(e){return function(e){function t(){var e,r,a,u;n(this,t);for(var i=arguments.length,s=Array(i),l=0;l<i;l++)s[l]=arguments[l];return r=a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),a.registerExposedAPI=function(e){a.tableExposedAPIEmitter=e},u=r,o(a,u)}return a(t,e),t}(i.default.csvOperation(e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(15),o=function(e){return e&&e.__esModule?e:{default:e}}(n);t.default={csvOperation:o.default}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(16),s={fileName:"spreadsheet.csv",separator:",",ignoreHeader:!1,noAutoBOM:!0,exportAll:!0,onlyExportSelection:!1};t.default=function(e){return function(e){function t(){var e,r,a,l;n(this,t);for(var c=arguments.length,f=Array(c),p=0;p<c;p++)f[p]=arguments[p];return r=a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(f))),a.handleExportCSV=function(e){var t=a.props,r=t.columns,n=t.exportCSV,o=t.keyField,l=(0,i.getMetaInfo)(r),c=!0===n?s:u({},s,n),f=void 0;if(void 0!==e)f=e;else if(c.exportAll)f=a.props.data;else{var p={};a.tableExposedAPIEmitter.emit("get.table.data",p),f=p.result}if(c.onlyExportSelection){var d={};a.tableExposedAPIEmitter.emit("get.selected.rows",d);var h=d.result;f=f.filter(function(e){return!!h.find(function(t){return e[o]===t})})}var y=(0,i.transform)(f,l,a._.get,c);(0,i.save)(y,c)},l=r,o(a,l)}return a(t,e),t}(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.save=t.transform=t.getMetaInfo=void 0;var n=r(17),o=function(e){return e&&e.__esModule?e:{default:e}}(n);t.getMetaInfo=function(e){return e.map(function(e){return{field:e.dataField,type:e.csvType||String,formatter:e.csvFormatter,formatExtraData:e.formatExtraData,header:e.csvText||e.text,export:!1!==e.csvExport,row:Number(e.row)||0,rowSpan:Number(e.rowSpan)||1,colSpan:Number(e.colSpan)||1}}).filter(function(e){return e.export})},t.transform=function(e,t,r,n){var o=n.separator,a=n.ignoreHeader,u=t.filter(function(e){return e.export}),i="";return a||(i+=u.map(function(e){return'"'+e.header+'"'}).join(o),i+="\n"),0===e.length?i:i+=e.map(function(e,t){return u.map(function(n){var o=r(e,n.field);return n.formatter&&(o=n.formatter(o,e,t,n.formatExtraData)),n.type===String?'"'+o+'"':o}).join(o)}).join("\n")},t.save=function(e,t){var r=t.noAutoBOM,n=t.fileName;o.default.saveAs(new Blob([e],{type:"text/plain;charset=utf-8"}),n,r)}},function(e,t,r){var n,o=o||function(e){"use strict";if(!(void 0===e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=e.document,r=function(){return e.URL||e.webkitURL||e},n=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in n,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},u=/constructor/i.test(e.HTMLElement)||e.safari,i=/CriOS\/[\d]+/.test(navigator.userAgent),s=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},l=function(e){var t=function(){"string"==typeof e?r().revokeObjectURL(e):e.remove()};setTimeout(t,4e4)},c=function(e,t,r){t=[].concat(t);for(var n=t.length;n--;){var o=e["on"+t[n]];if("function"==typeof o)try{o.call(e,r||e)}catch(e){s(e)}}},f=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},p=function(t,s,p){p||(t=f(t));var d,h=this,y=t.type,v="application/octet-stream"===y,b=function(){c(h,"writestart progress write writeend".split(" "))};if(h.readyState=h.INIT,o)return d=r().createObjectURL(t),void setTimeout(function(){n.href=d,n.download=s,a(n),b(),l(d),h.readyState=h.DONE});!function(){if((i||v&&u)&&e.FileReader){var n=new FileReader;return n.onloadend=function(){var t=i?n.result:n.result.replace(/^data:[^;]*;/,"data:attachment/file;");e.open(t,"_blank")||(e.location.href=t),t=void 0,h.readyState=h.DONE,b()},n.readAsDataURL(t),void(h.readyState=h.INIT)}if(d||(d=r().createObjectURL(t)),v)e.location.href=d;else{e.open(d,"_blank")||(e.location.href=d)}h.readyState=h.DONE,b(),l(d)}()},d=p.prototype,h=function(e,t,r){return new p(e,t||e.name||"download",r)};return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,r){return t=t||e.name||"download",r||(e=f(e)),navigator.msSaveOrOpenBlob(e,t)}:(d.abort=function(){},d.readyState=d.INIT=0,d.WRITING=1,d.DONE=2,d.error=d.onwritestart=d.onprogress=d.onwrite=d.onabort=d.onerror=d.onwriteend=null,h)}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);void 0!==e&&e.exports?e.exports.saveAs=o:null!==r(18)&&null!==r(19)&&void 0!==(n=function(){return o}.call(t,r,t,e))&&(e.exports=n)},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(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)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(0),l=n(s),c=r(1),f=n(c);t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{searchFormatted:!1};return function(t,r,n){var s=l.default.createContext(),c=function(c){function f(e){o(this,f);var t=a(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,e)),u=e.data;return r()&&""!==t.props.searchText?n(t.props.searchText):(u=t.search(e),t.triggerListener(u)),t.state={data:u},t}return u(f,c),i(f,[{key:"componentWillReceiveProps",value:function(e){if(e.searchText!==this.props.searchText)if(r())n(e.searchText);else{var o=this.search(e);this.triggerListener(o),this.setState({data:o})}else if(r())this.setState({data:e.data});else if(!t.isEqual(e.data,this.props.data)){var a=this.search(e);this.triggerListener(a),this.setState({data:a})}}},{key:"triggerListener",value:function(e){this.props.dataChangeListener&&this.props.dataChangeListener.emit("filterChanged",e.length)}},{key:"search",value:function(r){var n=r.data,o=r.columns,a=r.searchText.toLowerCase();return n.filter(function(r,n){for(var u=0;u<o.length;u+=1){var i=o[u];if(!1!==i.searchable){var s=t.get(r,i.dataField);if(i.formatter&&e.searchFormatted?s=i.formatter(s,r,n,i.formatExtraData):i.filterValue&&(s=i.filterValue(s,r)),null!==s&&void 0!==s&&(s=s.toString().toLowerCase(),s.indexOf(a)>-1))return!0}}return!1})}},{key:"render",value:function(){return l.default.createElement(s.Provider,{value:{data:this.state.data}},this.props.children)}}]),f}(l.default.Component);return c.propTypes={data:f.default.array.isRequired,columns:f.default.array.isRequired,searchText:f.default.string,dataChangeListener:f.default.object},{Provider:c,Consumer:s.Consumer}}}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),a=n(o),u=r(1),i=n(u),s=r(2),l=n(s),c=function(e){return a.default.createElement(l.default.Provider,e,a.default.createElement(l.default.Consumer,null,function(t){return e.children(t)}))};c.propTypes={children:i.default.func.isRequired},t.default=c}])}); |
@@ -27,2 +27,3 @@ 'use strict'; | ||
/* eslint no-lonely-if: 0 */ | ||
/* eslint class-methods-use-this: 0 */ | ||
@@ -49,3 +50,3 @@ | ||
} else { | ||
initialData = _this.search(props.searchText.toLowerCase()); | ||
initialData = _this.search(props); | ||
_this.triggerListener(initialData); | ||
@@ -64,3 +65,3 @@ } | ||
} else { | ||
var result = this.search(nextProps.searchText.toLowerCase()); | ||
var result = this.search(nextProps); | ||
this.triggerListener(result); | ||
@@ -74,2 +75,8 @@ this.setState({ | ||
this.setState({ data: nextProps.data }); | ||
} else if (!_.isEqual(nextProps.data, this.props.data)) { | ||
var _result = this.search(nextProps); | ||
this.triggerListener(_result); | ||
this.setState({ | ||
data: _result | ||
}); | ||
} | ||
@@ -87,7 +94,7 @@ } | ||
key: 'search', | ||
value: function search(searchText) { | ||
var _props = this.props, | ||
data = _props.data, | ||
columns = _props.columns; | ||
value: function search(props) { | ||
var data = props.data, | ||
columns = props.columns; | ||
var searchText = props.searchText.toLowerCase(); | ||
return data.filter(function (row, ridx) { | ||
@@ -94,0 +101,0 @@ for (var cidx = 0; cidx < columns.length; cidx += 1) { |
{ | ||
"name": "react-bootstrap-table2-toolkit", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "The toolkit for react-bootstrap-table2", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
162910
2027