react-bootstrap-table2-toolkit
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -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(){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}}(),c=r(0),s=n(c),f=r(1),l=n(f),p=r(12),d=n(p),h=r(19),y=n(h),v=s.default.createContext(),b=function(e){function t(e){o(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={searchText:""},r._=null,r.onSearch=r.onSearch.bind(r),r.setDependencyModules=r.setDependencyModules.bind(r),r}return u(t,e),i(t,[{key:"onSearch",value:function(e){e!==this.state.searchText&&this.setState({searchText:e})}},{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,y.default)(this.props.search),searchText:this.state.searchText}),s.default.createElement(v.Provider,{value:{searchProps:{onSearch:this.onSearch},csvProps:{onExport:this.handleExportCSV},baseProps:e}},this.props.children)}}]),t}((0,d.default)(s.default.Component));b.propTypes={keyField:l.default.string.isRequired,data:l.default.array.isRequired,columns:l.default.array.isRequired,children:l.default.node.isRequired,bootstrap4:l.default.bool,search:l.default.oneOfType([l.default.bool,l.default.shape({searchFormatted:l.default.bool})]),exportCSV:l.default.oneOfType([l.default.bool,l.default.shape({fileName:l.default.string,separator:l.default.string,ignoreHeader:l.default.bool,noAutoBOM:l.default.bool})])},b.defaultProps={search:!1,exportCSV:!1,bootstrap4:!1},t.default={Provider:b,Consumer:v.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(10);Object.defineProperty(t,"CSVExport",{enumerable:!0,get:function(){return n(a).default}});var u=r(2),i=n(u),c=r(20),s=n(c);t.default=s.default;t.ToolkitContext=i.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5),o=function(e){return e&&e.__esModule?e:{default:e}}(n);t.default={SearchBar: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=arguments,i=r(0),c=n(i),s=r(1),f=n(s),l=function(e,t,r){var n=void 0;return function(){var o=function(){n=null,r||e.apply(void 0,u)},a=r&&!n;clearTimeout(n),n=setTimeout(o,t||0),a&&e.appy(void 0,u)}},p=function e(t){var r=t.delay,n=t.onSearch,u=t.className,i=t.style,s=t.placeholder,f=(t.searchText,o(t,["delay","onSearch","className","style","placeholder","searchText"])),p=void 0,d=l(function(){n(p.value)},r);return c.default.createElement("input",a({ref:function(e){return p=e},type:"text",style:i,onKeyUp:function(){return d()},className:"form-control "+u,placeholder:s||e.defaultProps.placeholder},f))};p.propTypes={onSearch:f.default.func.isRequired,className:f.default.string,placeholder:f.default.string,style:f.default.object,delay:f.default.number,searchText:f.default.string},p.defaultProps={className:"",style:{},placeholder:"Search",delay:250,searchText:""},t.default=p},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,c){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 f=[r,n,a,u,i,c],l=0;s=new Error(t.replace(/%s/g,function(){return f[l++]})),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";Object.defineProperty(t,"__esModule",{value:!0});var n=r(11),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),c=r(1),s=n(c),f=function(e){var t=e.onExport,r=e.children,n=o(e,["onExport","children"]);return i.default.createElement("button",a({type:"button",onClick:t},n),r)};f.propTypes={children:s.default.node.isRequired,onExport:s.default.func.isRequired,className:s.default.string,style:s.default.object},f.defaultProps={className:"react-bs-table-csv-btn btn btn-default",style:{}},t.default=f},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(13),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,c=Array(i),s=0;s<i;s++)c[s]=arguments[s];return r=a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),a.registerExposedAPI=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach(function(e){a[e.name]=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(14),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(15),c={fileName:"spreadsheet.csv",separator:",",ignoreHeader:!1,noAutoBOM:!0,exportAll:!0};t.default=function(e){return function(e){function t(){var e,r,a,s;n(this,t);for(var f=arguments.length,l=Array(f),p=0;p<f;p++)l[p]=arguments[p];return r=a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),a.handleExportCSV=function(){var e=a.props,t=e.columns,r=e.exportCSV,n=(0,i.getMetaInfo)(t),o=!0===r?c:u({},c,r),s=o.exportAll?a.props.data:a.getData(),f=(0,i.transform)(s,n,a._.get,o);(0,i.save)(f,o)},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(16),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(["\ufeff",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),c=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)},f=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){c(e)}}},l=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,c,p){p||(t=l(t));var d,h=this,y=t.type,v="application/octet-stream"===y,b=function(){f(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=c,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=l(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(17)&&null!==r(18)&&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}}(),c=r(0),s=n(c),f=r(1),l=n(f);t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{searchFormatted:!1};return function(t,r,n){var c=s.default.createContext(),f=function(f){function l(e){o(this,l);var t=a(this,(l.__proto__||Object.getPrototypeOf(l)).call(this,e));return t.performRemoteSearch=""!==e.searchText,t}return u(l,f),i(l,[{key:"componentWillReceiveProps",value:function(e){r()&&(e.searchText!==this.props.searchText?this.performRemoteSearch=!0:this.performRemoteSearch=!1)}},{key:"search",value:function(){var o=this.props,a=o.data,u=o.columns,i=this.props.searchText;return r()&&this.performRemoteSearch?(n(i),a):(i=i.toLowerCase(),a.filter(function(r,n){for(var o=0;o<u.length;o+=1){var a=u[o];if(!1!==a.searchable){var c=t.get(r,a.dataField);if(a.formatter&&e.searchFormatted?c=a.formatter(c,r,n,a.formatExtraData):a.filterValue&&(c=a.filterValue(c,r)),null!==c&&void 0!==c&&(c=c.toString().toLowerCase(),c.indexOf(i)>-1))return!0}}return!1}))}},{key:"render",value:function(){var e=this.search();return s.default.createElement(c.Provider,{value:{data:e}},this.props.children)}}]),l}(s.default.Component);return f.propTypes={data:l.default.array.isRequired,columns:l.default.array.isRequired,searchText:l.default.string},{Provider:f,Consumer:c.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),c=r(2),s=n(c),f=function(e){return a.default.createElement(s.default.Provider,e,a.default.createElement(s.default.Consumer,null,function(t){return e.children(t)}))};f.propTypes={children:i.default.func.isRequired},t.default=f}])}); | ||
!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(){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}}(),c=r(0),f=n(c),l=r(1),s=n(l),p=r(12),d=n(p),h=r(19),y=n(h),v=f.default.createContext(),b=function(e){function t(e){o(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={searchText:""},r._=null,r.onSearch=r.onSearch.bind(r),r.setDependencyModules=r.setDependencyModules.bind(r),r}return u(t,e),i(t,[{key:"onSearch",value:function(e){e!==this.state.searchText&&this.setState({searchText:e})}},{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,y.default)(this.props.search),searchText:this.state.searchText}),f.default.createElement(v.Provider,{value:{searchProps:{onSearch:this.onSearch},csvProps:{onExport:this.handleExportCSV},baseProps:e}},this.props.children)}}]),t}((0,d.default)(f.default.Component));b.propTypes={keyField:s.default.string.isRequired,data:s.default.array.isRequired,columns:s.default.array.isRequired,children:s.default.node.isRequired,bootstrap4:s.default.bool,search:s.default.oneOfType([s.default.bool,s.default.shape({searchFormatted:s.default.bool})]),exportCSV:s.default.oneOfType([s.default.bool,s.default.shape({fileName:s.default.string,separator:s.default.string,ignoreHeader:s.default.bool,noAutoBOM:s.default.bool,exportAll:s.default.bool,onlyExportSelection:s.default.bool})])},b.defaultProps={search:!1,exportCSV:!1,bootstrap4:!1},t.default={Provider:b,Consumer:v.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(10);Object.defineProperty(t,"CSVExport",{enumerable:!0,get:function(){return n(a).default}});var u=r(2),i=n(u),c=r(20),f=n(c);t.default=f.default;t.ToolkitContext=i.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5),o=function(e){return e&&e.__esModule?e:{default:e}}(n);t.default={SearchBar: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=arguments,i=r(0),c=n(i),f=r(1),l=n(f),s=function(e,t,r){var n=void 0;return function(){var o=function(){n=null,r||e.apply(void 0,u)},a=r&&!n;clearTimeout(n),n=setTimeout(o,t||0),a&&e.appy(void 0,u)}},p=function e(t){var r=t.delay,n=t.onSearch,u=t.className,i=t.style,f=t.placeholder,l=(t.searchText,o(t,["delay","onSearch","className","style","placeholder","searchText"])),p=void 0,d=s(function(){n(p.value)},r);return c.default.createElement("input",a({ref:function(e){return p=e},type:"text",style:i,onKeyUp:function(){return d()},className:"form-control "+u,placeholder:f||e.defaultProps.placeholder},l))};p.propTypes={onSearch:l.default.func.isRequired,className:l.default.string,placeholder:l.default.string,style:l.default.object,delay:l.default.number,searchText:l.default.string},p.defaultProps={className:"",style:{},placeholder:"Search",delay:250,searchText:""},t.default=p},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,c){if(o(t),!e){var f;if(void 0===t)f=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,a,u,i,c],s=0;f=new Error(t.replace(/%s/g,function(){return l[s++]})),f.name="Invariant Violation"}throw f.framesToPop=1,f}}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";Object.defineProperty(t,"__esModule",{value:!0});var n=r(11),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),c=r(1),f=n(c),l=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)};l.propTypes={children:f.default.node.isRequired,onExport:f.default.func.isRequired,className:f.default.string,style:f.default.object},l.defaultProps={className:"react-bs-table-csv-btn btn btn-default",style:{}},t.default=l},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(13),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,c=Array(i),f=0;f<i;f++)c[f]=arguments[f];return r=a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),a.registerExposedAPI=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach(function(e){a[e.name]=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(14),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(15),c={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,f;n(this,t);for(var l=arguments.length,s=Array(l),p=0;p<l;p++)s[p]=arguments[p];return r=a=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),a.handleExportCSV=function(e){var t=a.props,r=t.columns,n=t.exportCSV,o=t.keyField,f=(0,i.getMetaInfo)(r),l=!0===n?c:u({},c,n),s=void 0;if(s=void 0!==e?e:l.exportAll?a.props.data:a.getData(),l.onlyExportSelection){var p=a.getSelected();s=s.filter(function(e){return!!p.find(function(t){return e[o]===t})})}var d=(0,i.transform)(s,f,a._.get,l);(0,i.save)(d,l)},f=r,o(a,f)}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(16),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(["\ufeff",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),c=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},f=function(e){var t=function(){"string"==typeof e?r().revokeObjectURL(e):e.remove()};setTimeout(t,4e4)},l=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){c(e)}}},s=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,c,p){p||(t=s(t));var d,h=this,y=t.type,v="application/octet-stream"===y,b=function(){l(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=c,a(n),b(),f(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(),f(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=s(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(17)&&null!==r(18)&&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}}(),c=r(0),f=n(c),l=r(1),s=n(l);t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{searchFormatted:!1};return function(t,r,n){var c=f.default.createContext(),l=function(l){function s(e){o(this,s);var t=a(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,e));return t.performRemoteSearch=""!==e.searchText,t}return u(s,l),i(s,[{key:"componentWillReceiveProps",value:function(e){r()&&(e.searchText!==this.props.searchText?this.performRemoteSearch=!0:this.performRemoteSearch=!1)}},{key:"search",value:function(){var o=this.props,a=o.data,u=o.columns,i=this.props.searchText;return r()&&this.performRemoteSearch?(n(i),a):(i=i.toLowerCase(),a.filter(function(r,n){for(var o=0;o<u.length;o+=1){var a=u[o];if(!1!==a.searchable){var c=t.get(r,a.dataField);if(a.formatter&&e.searchFormatted?c=a.formatter(c,r,n,a.formatExtraData):a.filterValue&&(c=a.filterValue(c,r)),null!==c&&void 0!==c&&(c=c.toString().toLowerCase(),c.indexOf(i)>-1))return!0}}return!1}))}},{key:"render",value:function(){var e=this.search();return f.default.createElement(c.Provider,{value:{data:e}},this.props.children)}}]),s}(f.default.Component);return l.propTypes={data:s.default.array.isRequired,columns:s.default.array.isRequired,searchText:s.default.string},{Provider:l,Consumer:c.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),c=r(2),f=n(c),l=function(e){return a.default.createElement(f.default.Provider,e,a.default.createElement(f.default.Consumer,null,function(t){return e.children(t)}))};l.propTypes={children:i.default.func.isRequired},t.default=l}])}); |
@@ -124,3 +124,5 @@ 'use strict'; | ||
ignoreHeader: _propTypes2.default.bool, | ||
noAutoBOM: _propTypes2.default.bool | ||
noAutoBOM: _propTypes2.default.bool, | ||
exportAll: _propTypes2.default.bool, | ||
onlyExportSelection: _propTypes2.default.bool | ||
})]) | ||
@@ -127,0 +129,0 @@ }; |
@@ -30,3 +30,5 @@ 'use strict'; | ||
type: 'button', | ||
onClick: onExport | ||
onClick: function onClick() { | ||
return onExport(); | ||
} | ||
}, rest), | ||
@@ -33,0 +35,0 @@ children |
@@ -22,3 +22,4 @@ 'use strict'; | ||
noAutoBOM: true, | ||
exportAll: true | ||
exportAll: true, | ||
onlyExportSelection: false | ||
}; | ||
@@ -41,6 +42,7 @@ | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = CSVOperation.__proto__ || Object.getPrototypeOf(CSVOperation)).call.apply(_ref, [this].concat(args))), _this), _this.handleExportCSV = function () { | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = CSVOperation.__proto__ || Object.getPrototypeOf(CSVOperation)).call.apply(_ref, [this].concat(args))), _this), _this.handleExportCSV = function (source) { | ||
var _this$props = _this.props, | ||
columns = _this$props.columns, | ||
exportCSV = _this$props.exportCSV; | ||
exportCSV = _this$props.exportCSV, | ||
keyField = _this$props.keyField; | ||
@@ -50,3 +52,19 @@ var meta = (0, _exporter.getMetaInfo)(columns); | ||
var data = options.exportAll ? _this.props.data : _this.getData(); | ||
// get data for csv export | ||
var data = void 0; | ||
if (typeof source !== 'undefined') { | ||
data = source; | ||
} else { | ||
data = options.exportAll ? _this.props.data : _this.getData(); | ||
} | ||
// filter data | ||
if (options.onlyExportSelection) { | ||
var selections = _this.getSelected(); | ||
data = data.filter(function (row) { | ||
return !!selections.find(function (sel) { | ||
return row[keyField] === sel; | ||
}); | ||
}); | ||
} | ||
var content = (0, _exporter.transform)(data, meta, _this._.get, options); | ||
@@ -53,0 +71,0 @@ (0, _exporter.save)(content, options); |
{ | ||
"name": "react-bootstrap-table2-toolkit", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "The toolkit for react-bootstrap-table2", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -126,2 +126,5 @@ # react-bootstrap-table2-toolkit | ||
#### exportAll - [bool] | ||
Default is `true`. `false` will only export current data which display on table. | ||
Default is `true`. `false` will only export current data which display on table. | ||
#### onlyExportSelection - [bool] | ||
Default is `false`. `true` will only export the data which is selected. |
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
145110
1812
129