react-bootstrap-table2-filter
Advanced tools
Comparing version 1.3.1 to 1.3.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.ReactBootstrapTable2Filter=t(require("react")):e.ReactBootstrapTable2Filter=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=4)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.LIKE="LIKE",t.EQ="=",t.NE="!=",t.GT=">",t.GE=">=",t.LT="<",t.LE="<="},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.FILTER_TYPE={TEXT:"TEXT",SELECT:"SELECT",MULTISELECT:"MULTISELECT",NUMBER:"NUMBER",DATE:"DATE"},t.FILTER_DELAY=500},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}}Object.defineProperty(t,"__esModule",{value:!0}),t.customFilter=t.dateFilter=t.numberFilter=t.multiSelectFilter=t.selectFilter=t.textFilter=t.Comparator=t.FILTER_TYPES=void 0;var o=r(5),a=n(o),l=r(10),i=n(l),u=r(11),s=n(u),c=r(12),p=n(c),f=r(13),d=n(f),m=r(14),h=n(m),y=r(0),v=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(y),b=r(1);t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{createContext:h.default,options:e}};t.FILTER_TYPES=b.FILTER_TYPE,t.Comparator=v,t.textFilter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{Filter:a.default,props:e}},t.selectFilter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{Filter:i.default,props:e}},t.multiSelectFilter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{Filter:s.default,props:e}},t.numberFilter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{Filter:p.default,props:e}},t.dateFilter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{Filter:d.default,props:e}},t.customFilter=function(){return{props:arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}}}},function(e,t,r){"use strict";function n(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}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 l(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=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=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(2),c=function(e){return e&&e.__esModule?e:{default:e}}(s),p=r(3),f=r(0),d=r(1),m=function(e){function t(e){o(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.filter=r.filter.bind(r),r.handleClick=r.handleClick.bind(r),r.timeout=null,r.state={value:function(){return e.filterState&&void 0!==e.filterState.filterVal?e.filterState.filterVal:e.defaultValue}()},r}return l(t,e),u(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,r=t.onFilter,n=t.getFilter,o=t.column,a=this.input.value;a&&r(this.props.column,d.FILTER_TYPE.TEXT,!0)(a),n&&n(function(t){e.setState(function(){return{value:t}}),r(o,d.FILTER_TYPE.TEXT)(t)})}},{key:"componentWillUnmount",value:function(){this.cleanTimer()}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){e.defaultValue!==this.props.defaultValue&&this.applyFilter(e.defaultValue)}},{key:"filter",value:function(e){var t=this;e.stopPropagation(),this.cleanTimer();var r=e.target.value;this.setState(function(){return{value:r}}),this.timeout=setTimeout(function(){t.props.onFilter(t.props.column,d.FILTER_TYPE.TEXT)(r)},this.props.delay)}},{key:"cleanTimer",value:function(){this.timeout&&clearTimeout(this.timeout)}},{key:"cleanFiltered",value:function(){var e=this.props.defaultValue;this.setState(function(){return{value:e}}),this.props.onFilter(this.props.column,d.FILTER_TYPE.TEXT)(e)}},{key:"applyFilter",value:function(e){this.setState(function(){return{value:e}}),this.props.onFilter(this.props.column,d.FILTER_TYPE.TEXT)(e)}},{key:"handleClick",value:function(e){e.stopPropagation(),this.props.onClick&&this.props.onClick(e)}},{key:"render",value:function(){var e=this,t=this.props,r=t.id,o=t.placeholder,a=t.column,l=a.dataField,u=a.text,s=t.style,p=t.className,f=(t.onFilter,t.caseSensitive,t.defaultValue,t.getFilter,t.filterState,n(t,["id","placeholder","column","style","className","onFilter","caseSensitive","defaultValue","getFilter","filterState"])),d="text-filter-column-"+l+(r?"-"+r:"");return c.default.createElement("label",{className:"filter-label",htmlFor:d},c.default.createElement("span",{className:"sr-only"},"Filter by ",u),c.default.createElement("input",i({},f,{ref:function(t){return e.input=t},type:"text",id:d,className:"filter text-filter form-control "+p,style:s,onChange:this.filter,onClick:this.handleClick,placeholder:o||"Enter "+u+"...",value:this.state.value})))}}]),t}(s.Component);m.propTypes={onFilter:p.PropTypes.func.isRequired,column:p.PropTypes.object.isRequired,id:p.PropTypes.string,filterState:p.PropTypes.object,comparator:p.PropTypes.oneOf([f.LIKE,f.EQ]),defaultValue:p.PropTypes.string,delay:p.PropTypes.number,placeholder:p.PropTypes.string,style:p.PropTypes.object,className:p.PropTypes.string,caseSensitive:p.PropTypes.bool,getFilter:p.PropTypes.func},m.defaultProps={delay:d.FILTER_DELAY,filterState:{},defaultValue:"",caseSensitive:!1,id:null},t.default=m},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,l,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,l,i,u){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,l,i,u],p=0;s=new Error(t.replace(/%s/g,function(){return c[p++]})),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}}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}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 i(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)}function u(e,t){if(Array.isArray(e)){if(e.length===t.length){for(var r=0;r<e.length;r+=1)if(e[r].value!==t[r].value||e[r].label!==t[r].label)return!1;return!0}return!1}for(var n=Object.keys(e),o=0;o<n.length;o+=1)if(e[n[o]]!==t[n[o]])return!1;return Object.keys(e).length===Object.keys(t).length}function s(e,t){if(Array.isArray(e)){return e.filter(function(e){return e.label===t}).map(function(e){return e.value})[0]}return e[t]}Object.defineProperty(t,"__esModule",{value:!0});var c=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},p=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}}(),f=r(2),d=n(f),m=r(3),h=n(m),y=r(0),v=r(1),b=function(e){function t(e){a(this,t);var r=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.filter=r.filter.bind(r),r.options=r.getOptions(e);var n=void 0!==s(r.options,r.getDefaultValue());return r.state={isSelected:n},r}return i(t,e),p(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,r=t.column,n=t.onFilter,o=t.getFilter,a=this.selectInput.value;a&&""!==a&&n(r,v.FILTER_TYPE.SELECT,!0)(a),o&&o(function(t){e.setState(function(){return{isSelected:""!==t}}),e.selectInput.value=t,n(r,v.FILTER_TYPE.SELECT)(t)})}},{key:"componentDidUpdate",value:function(e){var t=!1,r=this.props,n=r.column,o=r.onFilter,a=r.defaultValue,l=this.getOptions(this.props);if(a!==e.defaultValue?t=!0:u(l,this.options)||(this.options=l,t=!0),t){var i=this.selectInput.value;i&&o(n,v.FILTER_TYPE.SELECT)(i)}}},{key:"getOptions",value:function(e){return"function"==typeof e.options?e.options(e.column):e.options}},{key:"getDefaultValue",value:function(){var e=this.props,t=e.filterState,r=e.defaultValue;return t&&void 0!==t.filterVal?t.filterVal:r}},{key:"cleanFiltered",value:function(){var e=void 0!==this.props.defaultValue?this.props.defaultValue:"";this.setState(function(){return{isSelected:""!==e}}),this.selectInput.value=e,this.props.onFilter(this.props.column,v.FILTER_TYPE.SELECT)(e)}},{key:"applyFilter",value:function(e){this.selectInput.value=e,this.setState(function(){return{isSelected:""!==e}}),this.props.onFilter(this.props.column,v.FILTER_TYPE.SELECT)(e)}},{key:"filter",value:function(e){var t=e.target.value;this.setState(function(){return{isSelected:""!==t}}),this.props.onFilter(this.props.column,v.FILTER_TYPE.SELECT)(t)}},{key:"renderOptions",value:function(){var e=[],t=this.options,r=this.props,n=r.placeholder,o=r.column;return r.withoutEmptyOption||e.push(d.default.createElement("option",{key:"-1",value:""},n||"Select "+o.text+"...")),Array.isArray(t)?t.forEach(function(t){var r=t.value,n=t.label;return e.push(d.default.createElement("option",{key:r,value:r},n))}):Object.keys(t).forEach(function(r){return e.push(d.default.createElement("option",{key:r,value:r},t[r]))}),e}},{key:"render",value:function(){var e=this,t=this.props,r=t.id,n=t.style,a=t.className,l=(t.defaultValue,t.onFilter,t.column),i=(t.options,t.comparator,t.withoutEmptyOption,t.caseSensitive,t.getFilter,t.filterState,o(t,["id","style","className","defaultValue","onFilter","column","options","comparator","withoutEmptyOption","caseSensitive","getFilter","filterState"])),u="filter select-filter form-control "+a+" "+(this.state.isSelected?"":"placeholder-selected"),s="select-filter-column-"+l.dataField+(r?"-"+r:"");return d.default.createElement("label",{className:"filter-label",htmlFor:s},d.default.createElement("span",{className:"sr-only"},"Filter by ",l.text),d.default.createElement("select",c({},i,{ref:function(t){return e.selectInput=t},id:s,style:n,className:u,onChange:this.filter,onClick:function(e){return e.stopPropagation()},defaultValue:this.getDefaultValue()||""}),this.renderOptions()))}}]),t}(f.Component);b.propTypes={onFilter:h.default.func.isRequired,column:h.default.object.isRequired,id:h.default.string,filterState:h.default.object,options:h.default.oneOfType([h.default.object,h.default.array]).isRequired,comparator:h.default.oneOf([y.LIKE,y.EQ]),placeholder:h.default.string,style:h.default.object,className:h.default.string,withoutEmptyOption:h.default.bool,defaultValue:h.default.any,caseSensitive:h.default.bool,getFilter:h.default.func},b.defaultProps={defaultValue:"",filterState:{},className:"",withoutEmptyOption:!1,comparator:y.EQ,caseSensitive:!0,id:null},t.default=b},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}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 i(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)}function u(e,t){for(var r=Object.keys(e),n=0;n<r.length;n+=1)if(e[r[n]]!==t[r[n]])return!1;return Object.keys(e).length===Object.keys(t).length}Object.defineProperty(t,"__esModule",{value:!0});var s=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},c=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}}(),p=r(2),f=n(p),d=r(3),m=n(d),h=r(0),y=r(1),v=function(e){if(e.selectedOptions)return Array.from(e.selectedOptions).map(function(e){return e.value});for(var t=[],r=e.options.length,n=0;n<r;n+=1){var o=e.options.item(n);o.selected&&t.push(o.value)}return t},b=function(e){function t(e){a(this,t);var r=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.filter=r.filter.bind(r),r.applyFilter=r.applyFilter.bind(r);var n=e.defaultValue.map(function(t){return e.options[t]}).length>0;return r.state={isSelected:n},r}return i(t,e),c(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props.getFilter,r=v(this.selectInput);r&&r.length>0&&this.applyFilter(r),t&&t(function(t){e.selectInput.value=t,e.applyFilter(t)})}},{key:"componentDidUpdate",value:function(e){var t=!1;this.props.defaultValue!==e.defaultValue?t=!0:u(this.props.options,e.options)||(t=!0),t&&this.applyFilter(v(this.selectInput))}},{key:"getDefaultValue",value:function(){var e=this.props,t=e.filterState,r=e.defaultValue;return t&&void 0!==t.filterVal?t.filterVal:r}},{key:"getOptions",value:function(){var e=[],t=this.props,r=t.options,n=t.placeholder,o=t.column;return t.withoutEmptyOption||e.push(f.default.createElement("option",{key:"-1",value:""},n||"Select "+o.text+"...")),Object.keys(r).forEach(function(t){return e.push(f.default.createElement("option",{key:t,value:t},r[t]))}),e}},{key:"cleanFiltered",value:function(){var e=void 0!==this.props.defaultValue?this.props.defaultValue:[];this.selectInput.value=e,this.applyFilter(e)}},{key:"applyFilter",value:function(e){1===e.length&&""===e[0]&&(e=[]),this.setState(function(){return{isSelected:e.length>0}}),this.props.onFilter(this.props.column,y.FILTER_TYPE.MULTISELECT)(e)}},{key:"filter",value:function(e){var t=v(e.target);this.applyFilter(t)}},{key:"render",value:function(){var e=this,t=this.props,r=t.id,n=t.style,a=t.className,l=(t.filterState,t.defaultValue,t.onFilter,t.column),i=(t.options,t.comparator,t.withoutEmptyOption,t.caseSensitive,t.getFilter,o(t,["id","style","className","filterState","defaultValue","onFilter","column","options","comparator","withoutEmptyOption","caseSensitive","getFilter"])),u="filter select-filter form-control "+a+" "+(this.state.isSelected?"":"placeholder-selected"),c="multiselect-filter-column-"+l.dataField+(r?"-"+r:"");return f.default.createElement("label",{className:"filter-label",htmlFor:c},f.default.createElement("span",{className:"sr-only"},"Filter by ",l.text),f.default.createElement("select",s({},i,{ref:function(t){return e.selectInput=t},id:c,style:n,multiple:!0,className:u,onChange:this.filter,onClick:function(e){return e.stopPropagation()},defaultValue:this.getDefaultValue()}),this.getOptions()))}}]),t}(p.Component);b.propTypes={onFilter:m.default.func.isRequired,column:m.default.object.isRequired,options:m.default.object.isRequired,id:m.default.string,filterState:m.default.object,comparator:m.default.oneOf([h.LIKE,h.EQ]),placeholder:m.default.string,style:m.default.object,className:m.default.string,withoutEmptyOption:m.default.bool,defaultValue:m.default.array,caseSensitive:m.default.bool,getFilter:m.default.func},b.defaultProps={defaultValue:[],filterState:{},className:"",withoutEmptyOption:!1,comparator:h.EQ,caseSensitive:!0,id:null},t.default=b},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 l(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}}(),u=r(2),s=n(u),c=r(3),p=n(c),f=r(0),d=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(f),m=r(1),h=[d.EQ,d.NE,d.GT,d.GE,d.LT,d.LE],y=function(e){function t(e){o(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.comparators=e.comparators||h,r.timeout=null;var n=void 0!==e.defaultValue&&void 0!==e.defaultValue.number;return e.options&&n&&(n=e.options.indexOf(e.defaultValue.number)>-1),r.state={isSelected:n},r.onChangeNumber=r.onChangeNumber.bind(r),r.onChangeNumberSet=r.onChangeNumberSet.bind(r),r.onChangeComparator=r.onChangeComparator.bind(r),r}return l(t,e),i(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,r=t.column,n=t.onFilter,o=t.getFilter,a=this.numberFilterComparator.value,l=this.numberFilter.value;a&&l&&n(r,m.FILTER_TYPE.NUMBER,!0)({number:l,comparator:a}),o&&o(function(t){e.setState(function(){return{isSelected:""!==t}}),e.numberFilterComparator.value=t.comparator,e.numberFilter.value=t.number,n(r,m.FILTER_TYPE.NUMBER)({number:t.number,comparator:t.comparator})})}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeout)}},{key:"onChangeNumber",value:function(e){var t=this.props,r=t.delay,n=t.column,o=t.onFilter,a=this.numberFilterComparator.value;if(""!==a){this.timeout&&clearTimeout(this.timeout);var l=e.target.value;this.timeout=setTimeout(function(){o(n,m.FILTER_TYPE.NUMBER)({number:l,comparator:a})},r)}}},{key:"onChangeNumberSet",value:function(e){var t=this.props,r=t.column,n=t.onFilter,o=this.numberFilterComparator.value,a=e.target.value;this.setState(function(){return{isSelected:""!==a}}),n(r,m.FILTER_TYPE.NUMBER)({number:a,comparator:o})}},{key:"onChangeComparator",value:function(e){var t=this.props,r=t.column,n=t.onFilter,o=this.numberFilter.value,a=e.target.value;n(r,m.FILTER_TYPE.NUMBER)({number:o,comparator:a})}},{key:"getDefaultComparator",value:function(){var e=this.props,t=e.defaultValue,r=e.filterState;return r&&r.filterVal?r.filterVal.comparator:t&&t.comparator?t.comparator:""}},{key:"getDefaultValue",value:function(){var e=this.props,t=e.defaultValue,r=e.filterState;return r&&r.filterVal?r.filterVal.number:t&&t.number?t.number:""}},{key:"getComparatorOptions",value:function(){var e=[];this.props.withoutEmptyComparatorOption||e.push(s.default.createElement("option",{key:"-1"}));for(var t=0;t<this.comparators.length;t+=1)e.push(s.default.createElement("option",{key:t,value:this.comparators[t]},this.comparators[t]));return e}},{key:"getNumberOptions",value:function(){var e=[],t=this.props,r=t.options,n=t.column;t.withoutEmptyNumberOption||e.push(s.default.createElement("option",{key:"-1",value:""},this.props.placeholder||"Select "+n.text+"..."));for(var o=0;o<r.length;o+=1)e.push(s.default.createElement("option",{key:o,value:r[o]},r[o]));return e}},{key:"applyFilter",value:function(e){var t=this.props,r=t.column,n=t.onFilter,o=e.number,a=e.comparator;this.setState(function(){return{isSelected:""!==o}}),this.numberFilterComparator.value=a,this.numberFilter.value=o,n(r,m.FILTER_TYPE.NUMBER)({number:o,comparator:a})}},{key:"cleanFiltered",value:function(){var e=this.props,t=e.column,r=e.onFilter,n=e.defaultValue,o=n?n.number:"",a=n?n.comparator:"";this.setState(function(){return{isSelected:""!==o}}),this.numberFilterComparator.value=a,this.numberFilter.value=o,r(t,m.FILTER_TYPE.NUMBER)({number:o,comparator:a})}},{key:"render",value:function(){var e=this,t=this.state.isSelected,r=this.props,n=r.id,o=r.column,a=r.options,l=r.style,i=r.className,u=r.numberStyle,c=r.numberClassName,p=r.comparatorStyle,f=r.comparatorClassName,d=r.placeholder,m="\n select-filter \n number-filter-input \n form-control \n "+c+" \n "+(t?"":"placeholder-selected")+"\n ",h="number-filter-comparator-"+o.dataField+(n?"-"+n:""),y="number-filter-column-"+o.dataField+(n?"-"+n:"");return s.default.createElement("div",{onClick:function(e){return e.stopPropagation()},className:"filter number-filter "+i,style:l},s.default.createElement("label",{className:"filter-label",htmlFor:h},s.default.createElement("span",{className:"sr-only"},"Filter comparator"),s.default.createElement("select",{ref:function(t){return e.numberFilterComparator=t},style:p,id:h,className:"number-filter-comparator form-control "+f,onChange:this.onChangeComparator,defaultValue:this.getDefaultComparator()},this.getComparatorOptions())),a?s.default.createElement("label",{className:"filter-label",htmlFor:y},s.default.createElement("span",{className:"sr-only"},"Select "+o.text),s.default.createElement("select",{ref:function(t){return e.numberFilter=t},id:y,style:u,className:m,onChange:this.onChangeNumberSet,defaultValue:this.getDefaultValue()},this.getNumberOptions())):s.default.createElement("label",{htmlFor:y},s.default.createElement("span",{className:"sr-only"},"Enter "+o.text),s.default.createElement("input",{ref:function(t){return e.numberFilter=t},id:y,type:"number",style:u,className:"number-filter-input form-control "+c,placeholder:d||"Enter "+o.text+"...",onChange:this.onChangeNumber,defaultValue:this.getDefaultValue()})))}}]),t}(u.Component);y.propTypes={onFilter:p.default.func.isRequired,column:p.default.object.isRequired,id:p.default.string,filterState:p.default.object,options:p.default.arrayOf(p.default.number),defaultValue:p.default.shape({number:p.default.oneOfType([p.default.string,p.default.number]),comparator:p.default.oneOf([].concat(h,[""]))}),delay:p.default.number,comparators:function(e,t){if(e[t])for(var r=0;r<e[t].length;r+=1){for(var n=!1,o=0;o<h.length;o+=1)if(h[o]===e[t][r]||""===e[t][r]){n=!0;break}if(!n)return new Error("Number comparator provided is not supported.\n Use only "+h)}},placeholder:p.default.string,withoutEmptyComparatorOption:p.default.bool,withoutEmptyNumberOption:p.default.bool,style:p.default.object,className:p.default.string,comparatorStyle:p.default.object,comparatorClassName:p.default.string,numberStyle:p.default.object,numberClassName:p.default.string,getFilter:p.default.func},y.defaultProps={delay:m.FILTER_DELAY,options:void 0,defaultValue:{number:void 0,comparator:""},filterState:{},withoutEmptyComparatorOption:!1,withoutEmptyNumberOption:!1,comparators:h,placeholder:void 0,style:void 0,className:"",comparatorStyle:void 0,comparatorClassName:"",numberStyle:void 0,numberClassName:"",id:null},t.default=y},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)}function l(e){return e.getUTCFullYear()+"-"+("0"+(e.getUTCMonth()+1)).slice(-2)+"-"+("0"+e.getUTCDate()).slice(-2)}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}}(),u=r(2),s=function(e){return e&&e.__esModule?e:{default:e}}(u),c=r(3),p=r(0),f=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(p),d=r(1),m=[f.EQ,f.NE,f.GT,f.GE,f.LT,f.LE],h=function(e){function t(e){n(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.timeout=null,r.comparators=e.comparators||m,r.applyFilter=r.applyFilter.bind(r),r.onChangeDate=r.onChangeDate.bind(r),r.onChangeComparator=r.onChangeComparator.bind(r),r}return a(t,e),i(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props.getFilter,r=this.dateFilterComparator.value,n=this.inputDate.value;r&&n&&this.applyFilter(n,r,!0),t&&t(function(t){var r=t||{date:null,comparator:null};e.dateFilterComparator.value=r.comparator,e.inputDate.value=r.date?l(r.date):null,e.applyFilter(r.date,r.comparator)})}},{key:"componentWillUnmount",value:function(){this.timeout&&clearTimeout(this.timeout)}},{key:"onChangeDate",value:function(e){var t=this.dateFilterComparator.value,r=e.target.value;this.applyFilter(r,t)}},{key:"onChangeComparator",value:function(e){var t=this.inputDate.value,r=e.target.value;this.applyFilter(t,r)}},{key:"getComparatorOptions",value:function(){var e=[];this.props.withoutEmptyComparatorOption||e.push(s.default.createElement("option",{key:"-1"}));for(var t=0;t<this.comparators.length;t+=1)e.push(s.default.createElement("option",{key:t,value:this.comparators[t]},this.comparators[t]));return e}},{key:"getDefaultComparator",value:function(){var e=this.props,t=e.defaultValue,r=e.filterState;return r&&r.filterVal?r.filterVal.comparator:t&&t.comparator?t.comparator:""}},{key:"getDefaultDate",value:function(){var e=this.props,t=e.defaultValue,r=e.filterState;return r&&r.filterVal&&r.filterVal.date?l(r.filterVal.date):t&&t.date?l(new Date(t.date)):""}},{key:"applyFilter",value:function(e,t,r){var n=this.props,o=n.column,a=n.onFilter,l=n.delay,i=function(){var n=""===e?null:new Date(e);a(o,d.FILTER_TYPE.DATE,r)({date:n,comparator:t})};l?this.timeout=setTimeout(function(){i()},l):i()}},{key:"render",value:function(){var e=this,t=this.props,r=t.id,n=t.placeholder,o=t.column,a=o.dataField,l=o.text,i=t.style,u=t.comparatorStyle,c=t.dateStyle,p=t.className,f=t.comparatorClassName,d=t.dateClassName,m="date-filter-comparator-"+a+(r?"-"+r:""),h="date-filter-column-"+a+(r?"-"+r:"");return s.default.createElement("div",{onClick:function(e){return e.stopPropagation()},className:"filter date-filter "+p,style:i},s.default.createElement("label",{className:"filter-label",htmlFor:m},s.default.createElement("span",{className:"sr-only"},"Filter comparator"),s.default.createElement("select",{ref:function(t){return e.dateFilterComparator=t},id:m,style:u,className:"date-filter-comparator form-control "+f,onChange:this.onChangeComparator,defaultValue:this.getDefaultComparator()},this.getComparatorOptions())),s.default.createElement("label",{htmlFor:h},s.default.createElement("span",{className:"sr-only"},"Enter $",l),s.default.createElement("input",{ref:function(t){return e.inputDate=t},id:h,className:"filter date-filter-input form-control "+d,style:c,type:"date",onChange:this.onChangeDate,placeholder:n||"Enter "+l+"...",defaultValue:this.getDefaultDate()})))}}]),t}(u.Component);h.propTypes={onFilter:c.PropTypes.func.isRequired,column:c.PropTypes.object.isRequired,id:c.PropTypes.string,filterState:c.PropTypes.object,delay:c.PropTypes.number,defaultValue:c.PropTypes.shape({date:c.PropTypes.oneOfType([c.PropTypes.object]),comparator:c.PropTypes.oneOf([].concat(m,[""]))}),comparators:function(e,t){if(e[t])for(var r=0;r<e[t].length;r+=1){for(var n=!1,o=0;o<m.length;o+=1)if(m[o]===e[t][r]||""===e[t][r]){n=!0;break}if(!n)return new Error("Date comparator provided is not supported.\n Use only "+m)}},placeholder:c.PropTypes.string,withoutEmptyComparatorOption:c.PropTypes.bool,style:c.PropTypes.object,comparatorStyle:c.PropTypes.object,dateStyle:c.PropTypes.object,className:c.PropTypes.string,comparatorClassName:c.PropTypes.string,dateClassName:c.PropTypes.string,getFilter:c.PropTypes.func},h.defaultProps={delay:0,defaultValue:{date:void 0,comparator:""},filterState:{},withoutEmptyComparatorOption:!1,comparators:m,placeholder:void 0,style:void 0,className:"",comparatorStyle:void 0,comparatorClassName:"",dateStyle:void 0,dateClassName:"",id:null},t.default=h},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 i(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=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(2),c=n(s),p=r(3),f=n(p),d=r(15),m=r(0),h=r(1);t.default=function(e,t,r){var n=c.default.createContext(),s=function(s){function p(e){a(this,p);var t=l(this,(p.__proto__||Object.getPrototypeOf(p)).call(this,e));return t.currFilters={},t.clearFilters={},t.onFilter=t.onFilter.bind(t),t.doFilter=t.doFilter.bind(t),t.onExternalFilter=t.onExternalFilter.bind(t),t.data=e.data,t.isEmitDataChange=!1,t}return i(p,s),u(p,[{key:"componentDidMount",value:function(){t()&&Object.keys(this.currFilters).length>0&&r(this.currFilters)}},{key:"onFilter",value:function(n,a){var l=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(u){var s=Object.assign({},l.currFilters);l.clearFilters={};var c=n.dataField,p=n.filter;if(e.isDefined(u)&&""!==u&&0!==u.length){var f=p.props,d=f.comparator,y=void 0===d?a===h.FILTER_TYPE.SELECT?m.EQ:m.LIKE:d,v=f.caseSensitive,b=void 0!==v&&v;s[c]={filterVal:u,filterType:a,comparator:y,caseSensitive:b}}else delete s[c],l.clearFilters=o({},c,{clear:!0,filterVal:u});if(l.currFilters=s,t())return void(i||r(l.currFilters));l.doFilter(l.props)}}},{key:"onExternalFilter",value:function(e,t){var r=this;return function(n){r.onFilter(e,t)(n)}}},{key:"getFiltered",value:function(){return this.data}},{key:"UNSAFE_componentWillReceiveProps",value:function(r){t()||e.isEqual(r.data,this.data)?this.data=r.data:this.doFilter(r,this.isEmitDataChange)}},{key:"doFilter",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.dataChangeListener,o=t.data,a=t.columns,l=(0,d.filters)(o,a,e)(this.currFilters,this.clearFilters);this.data=l,n&&!r?(this.isEmitDataChange=!0,n.emit("filterChanged",l.length)):(this.isEmitDataChange=!1,this.forceUpdate())}},{key:"render",value:function(){return c.default.createElement(n.Provider,{value:{data:this.data,onFilter:this.onFilter,onExternalFilter:this.onExternalFilter,currFilters:this.currFilters}},this.props.children)}}]),p}(c.default.Component);return s.propTypes={data:f.default.array.isRequired,columns:f.default.array.isRequired,dataChangeListener:f.default.object},{Provider:s,Consumer:n.Consumer}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.filters=t.filterFactory=t.filterByArray=t.filterByDate=t.filterByNumber=t.filterByText=void 0;var n=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},o="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},a=r(1),l=r(0),i=t.filterByText=function(e){return function(t,r,n,o){var a=n.filterVal,i=void 0===a?"":a,u=n.comparator,s=void 0===u?l.LIKE:u,c=n.caseSensitive,p=i.toString();return t.filter(function(t){var n=e.get(t,r);o&&(n=o(n,t));var a=e.isDefined(n)?n.toString():"";return s===l.EQ?a===p:c?a.includes(p):-1!==a.toLocaleUpperCase().indexOf(p.toLocaleUpperCase())})}},u=t.filterByNumber=function(e){return function(t,r,n,o){var a=n.filterVal,i=a.comparator,u=a.number;return t.filter(function(t){if(""===u||!i)return!0;var n=!0,a=e.get(t,r);switch(o&&(a=o(a,t)),i){case l.EQ:a!=u&&(n=!1);break;case l.GT:a<=u&&(n=!1);break;case l.GE:a<u&&(n=!1);break;case l.LT:a>=u&&(n=!1);break;case l.LE:a>u&&(n=!1);break;case l.NE:a==u&&(n=!1);break;default:console.error("Number comparator provided is not supported")}return n})}},s=t.filterByDate=function(e){return function(t,r,n,a){var i=n.filterVal,u=i.comparator,s=i.date;if(!s||!u)return t;var c=s.getUTCDate(),p=s.getUTCMonth(),f=s.getUTCFullYear();return t.filter(function(t){var n=!0,i=e.get(t,r);a&&(i=a(i,t)),"object"!==(void 0===i?"undefined":o(i))&&(i=new Date(i));var d=i.getUTCDate(),m=i.getUTCMonth(),h=i.getUTCFullYear();switch(u){case l.EQ:c===d&&p===m&&f===h||(n=!1);break;case l.GT:i<=s&&(n=!1);break;case l.GE:h<f?n=!1:h===f&&m<p?n=!1:h===f&&m===p&&d<c&&(n=!1);break;case l.LT:i>=s&&(n=!1);break;case l.LE:h>f?n=!1:h===f&&m>p?n=!1:h===f&&m===p&&d>c&&(n=!1);break;case l.NE:c===d&&p===m&&f===h&&(n=!1);break;default:console.error("Date comparator provided is not supported")}return n})}},c=t.filterByArray=function(e){return function(t,r,n){var o=n.filterVal,a=n.comparator;if(0===o.length)return t;var i=o.filter(function(t){return e.isDefined(t)}).map(function(e){return e.toString()});return t.filter(function(t){var n=e.get(t,r),o=e.isDefined(n)?n.toString():"";return a===l.EQ?-1!==i.indexOf(o):(o=o.toLocaleUpperCase(),i.some(function(e){return-1!==o.indexOf(e.toLocaleUpperCase())}))})}},p=t.filterFactory=function(e){return function(t){var r=void 0;switch(t){case a.FILTER_TYPE.TEXT:case a.FILTER_TYPE.SELECT:r=i(e);break;case a.FILTER_TYPE.MULTISELECT:r=c(e);break;case a.FILTER_TYPE.NUMBER:r=u(e);break;case a.FILTER_TYPE.DATE:r=s(e);break;default:r=i(e)}return r}};t.filters=function(e,t,r){return function(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=p(r),i=n({},a,o),u=e,s=void 0;return Object.keys(i).forEach(function(e){for(var r=void 0,n=void 0,o=void 0,c=0;c<t.length;c+=1)if(t[c].dataField===e){n=t[c].filterValue,t[c].filter&&(o=t[c].filter.props.onFilter);break}if(a[e]&&o)void 0!==(r=o(a[e].filterVal,u))&&(u=r);else{var p=i[e];s=l(p.filterType),o&&(r=o(p.filterVal,u)),u=void 0===r?s(u,e,p,n):r}}),u}}}])}); | ||
!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.ReactBootstrapTable2Filter=t(require("react")):e.ReactBootstrapTable2Filter=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=4)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.LIKE="LIKE",t.EQ="=",t.NE="!=",t.GT=">",t.GE=">=",t.LT="<",t.LE="<="},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.FILTER_TYPE={TEXT:"TEXT",SELECT:"SELECT",MULTISELECT:"MULTISELECT",NUMBER:"NUMBER",DATE:"DATE"},t.FILTER_DELAY=500},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}}Object.defineProperty(t,"__esModule",{value:!0}),t.customFilter=t.dateFilter=t.numberFilter=t.multiSelectFilter=t.selectFilter=t.textFilter=t.Comparator=t.FILTER_TYPES=void 0;var o=r(5),a=n(o),l=r(10),i=n(l),u=r(11),s=n(u),c=r(12),f=n(c),p=r(13),d=n(p),m=r(14),h=n(m),y=r(0),v=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(y),b=r(1);t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{createContext:h.default,options:e}};t.FILTER_TYPES=b.FILTER_TYPE,t.Comparator=v,t.textFilter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{Filter:a.default,props:e}},t.selectFilter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{Filter:i.default,props:e}},t.multiSelectFilter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{Filter:s.default,props:e}},t.numberFilter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{Filter:f.default,props:e}},t.dateFilter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{Filter:d.default,props:e}},t.customFilter=function(){return{props:arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}}}},function(e,t,r){"use strict";function n(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}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 l(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=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=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(2),c=function(e){return e&&e.__esModule?e:{default:e}}(s),f=r(3),p=r(0),d=r(1),m=function(e){function t(e){o(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.filter=r.filter.bind(r),r.handleClick=r.handleClick.bind(r),r.timeout=null,r.state={value:function(){return e.filterState&&void 0!==e.filterState.filterVal?e.filterState.filterVal:e.defaultValue}()},r}return l(t,e),u(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,r=t.onFilter,n=t.getFilter,o=t.column,a=this.input.value;a&&r(this.props.column,d.FILTER_TYPE.TEXT,!0)(a),n&&n(function(t){e.setState(function(){return{value:t}}),r(o,d.FILTER_TYPE.TEXT)(t)})}},{key:"componentWillUnmount",value:function(){this.cleanTimer()}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){e.defaultValue!==this.props.defaultValue&&this.applyFilter(e.defaultValue)}},{key:"filter",value:function(e){var t=this;e.stopPropagation(),this.cleanTimer();var r=e.target.value;this.setState(function(){return{value:r}}),this.timeout=setTimeout(function(){t.props.onFilter(t.props.column,d.FILTER_TYPE.TEXT)(r)},this.props.delay)}},{key:"cleanTimer",value:function(){this.timeout&&clearTimeout(this.timeout)}},{key:"cleanFiltered",value:function(){var e=this.props.defaultValue;this.setState(function(){return{value:e}}),this.props.onFilter(this.props.column,d.FILTER_TYPE.TEXT)(e)}},{key:"applyFilter",value:function(e){this.setState(function(){return{value:e}}),this.props.onFilter(this.props.column,d.FILTER_TYPE.TEXT)(e)}},{key:"handleClick",value:function(e){e.stopPropagation(),this.props.onClick&&this.props.onClick(e)}},{key:"render",value:function(){var e=this,t=this.props,r=t.id,o=t.placeholder,a=t.column,l=a.dataField,u=a.text,s=t.style,f=t.className,p=(t.onFilter,t.caseSensitive,t.defaultValue,t.getFilter,t.filterState,n(t,["id","placeholder","column","style","className","onFilter","caseSensitive","defaultValue","getFilter","filterState"])),d="text-filter-column-"+l+(r?"-"+r:"");return c.default.createElement("label",{className:"filter-label",htmlFor:d},c.default.createElement("span",{className:"sr-only"},"Filter by ",u),c.default.createElement("input",i({},p,{ref:function(t){return e.input=t},type:"text",id:d,className:"filter text-filter form-control "+f,style:s,onChange:this.filter,onClick:this.handleClick,placeholder:o||"Enter "+u+"...",value:this.state.value})))}}]),t}(s.Component);m.propTypes={onFilter:f.PropTypes.func.isRequired,column:f.PropTypes.object.isRequired,id:f.PropTypes.string,filterState:f.PropTypes.object,comparator:f.PropTypes.oneOf([p.LIKE,p.EQ]),defaultValue:f.PropTypes.string,delay:f.PropTypes.number,placeholder:f.PropTypes.string,style:f.PropTypes.object,className:f.PropTypes.string,caseSensitive:f.PropTypes.bool,getFilter:f.PropTypes.func},m.defaultProps={delay:d.FILTER_DELAY,filterState:{},defaultValue:"",caseSensitive:!1,id:null},t.default=m},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,l,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,l,i,u){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,l,i,u],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}}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}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 i(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)}function u(e,t){if(Array.isArray(e)){if(e.length===t.length){for(var r=0;r<e.length;r+=1)if(e[r].value!==t[r].value||e[r].label!==t[r].label)return!1;return!0}return!1}for(var n=Object.keys(e),o=0;o<n.length;o+=1)if(e[n[o]]!==t[n[o]])return!1;return Object.keys(e).length===Object.keys(t).length}function s(e,t){if(Array.isArray(e)){return e.filter(function(e){return e.label===t}).map(function(e){return e.value})[0]}return e[t]}Object.defineProperty(t,"__esModule",{value:!0});var c=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},f=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}}(),p=r(2),d=n(p),m=r(3),h=n(m),y=r(0),v=r(1),b=function(e){function t(e){a(this,t);var r=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.filter=r.filter.bind(r),r.options=r.getOptions(e);var n=void 0!==s(r.options,r.getDefaultValue());return r.state={isSelected:n},r}return i(t,e),f(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,r=t.column,n=t.onFilter,o=t.getFilter,a=this.selectInput.value;a&&""!==a&&n(r,v.FILTER_TYPE.SELECT,!0)(a),o&&o(function(t){e.setState(function(){return{isSelected:""!==t}}),e.selectInput.value=t,n(r,v.FILTER_TYPE.SELECT)(t)})}},{key:"componentDidUpdate",value:function(e){var t=!1,r=this.props,n=r.column,o=r.onFilter,a=r.defaultValue,l=this.getOptions(this.props);if(a!==e.defaultValue?t=!0:u(l,this.options)||(this.options=l,t=!0),t){var i=this.selectInput.value;i&&o(n,v.FILTER_TYPE.SELECT)(i)}}},{key:"getOptions",value:function(e){return"function"==typeof e.options?e.options(e.column):e.options}},{key:"getDefaultValue",value:function(){var e=this.props,t=e.filterState,r=e.defaultValue;return t&&void 0!==t.filterVal?t.filterVal:r}},{key:"cleanFiltered",value:function(){var e=void 0!==this.props.defaultValue?this.props.defaultValue:"";this.setState(function(){return{isSelected:""!==e}}),this.selectInput.value=e,this.props.onFilter(this.props.column,v.FILTER_TYPE.SELECT)(e)}},{key:"applyFilter",value:function(e){this.selectInput.value=e,this.setState(function(){return{isSelected:""!==e}}),this.props.onFilter(this.props.column,v.FILTER_TYPE.SELECT)(e)}},{key:"filter",value:function(e){var t=e.target.value;this.setState(function(){return{isSelected:""!==t}}),this.props.onFilter(this.props.column,v.FILTER_TYPE.SELECT)(t)}},{key:"renderOptions",value:function(){var e=[],t=this.options,r=this.props,n=r.placeholder,o=r.column;return r.withoutEmptyOption||e.push(d.default.createElement("option",{key:"-1",value:""},n||"Select "+o.text+"...")),Array.isArray(t)?t.forEach(function(t){var r=t.value,n=t.label;return e.push(d.default.createElement("option",{key:r,value:r},n))}):Object.keys(t).forEach(function(r){return e.push(d.default.createElement("option",{key:r,value:r},t[r]))}),e}},{key:"render",value:function(){var e=this,t=this.props,r=t.id,n=t.style,a=t.className,l=(t.defaultValue,t.onFilter,t.column),i=(t.options,t.comparator,t.withoutEmptyOption,t.caseSensitive,t.getFilter,t.filterState,o(t,["id","style","className","defaultValue","onFilter","column","options","comparator","withoutEmptyOption","caseSensitive","getFilter","filterState"])),u="filter select-filter form-control "+a+" "+(this.state.isSelected?"":"placeholder-selected"),s="select-filter-column-"+l.dataField+(r?"-"+r:"");return d.default.createElement("label",{className:"filter-label",htmlFor:s},d.default.createElement("span",{className:"sr-only"},"Filter by ",l.text),d.default.createElement("select",c({},i,{ref:function(t){return e.selectInput=t},id:s,style:n,className:u,onChange:this.filter,onClick:function(e){return e.stopPropagation()},defaultValue:this.getDefaultValue()||""}),this.renderOptions()))}}]),t}(p.Component);b.propTypes={onFilter:h.default.func.isRequired,column:h.default.object.isRequired,id:h.default.string,filterState:h.default.object,options:h.default.oneOfType([h.default.object,h.default.array]).isRequired,comparator:h.default.oneOf([y.LIKE,y.EQ]),placeholder:h.default.string,style:h.default.object,className:h.default.string,withoutEmptyOption:h.default.bool,defaultValue:h.default.any,caseSensitive:h.default.bool,getFilter:h.default.func},b.defaultProps={defaultValue:"",filterState:{},className:"",withoutEmptyOption:!1,comparator:y.EQ,caseSensitive:!0,id:null},t.default=b},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}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 i(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)}function u(e,t){for(var r=Object.keys(e),n=0;n<r.length;n+=1)if(e[r[n]]!==t[r[n]])return!1;return Object.keys(e).length===Object.keys(t).length}Object.defineProperty(t,"__esModule",{value:!0});var s=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},c=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}}(),f=r(2),p=n(f),d=r(3),m=n(d),h=r(0),y=r(1),v=function(e){if(e.selectedOptions)return Array.from(e.selectedOptions).map(function(e){return e.value});for(var t=[],r=e.options.length,n=0;n<r;n+=1){var o=e.options.item(n);o.selected&&t.push(o.value)}return t},b=function(e){function t(e){a(this,t);var r=l(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.filter=r.filter.bind(r),r.applyFilter=r.applyFilter.bind(r);var n=e.defaultValue.map(function(t){return e.options[t]}).length>0;return r.state={isSelected:n},r}return i(t,e),c(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props.getFilter,r=v(this.selectInput);r&&r.length>0&&this.applyFilter(r),t&&t(function(t){e.selectInput.value=t,e.applyFilter(t)})}},{key:"componentDidUpdate",value:function(e){var t=!1;this.props.defaultValue!==e.defaultValue?t=!0:u(this.props.options,e.options)||(t=!0),t&&this.applyFilter(v(this.selectInput))}},{key:"getDefaultValue",value:function(){var e=this.props,t=e.filterState,r=e.defaultValue;return t&&void 0!==t.filterVal?t.filterVal:r}},{key:"getOptions",value:function(){var e=[],t=this.props,r=t.options,n=t.placeholder,o=t.column;return t.withoutEmptyOption||e.push(p.default.createElement("option",{key:"-1",value:""},n||"Select "+o.text+"...")),Object.keys(r).forEach(function(t){return e.push(p.default.createElement("option",{key:t,value:t},r[t]))}),e}},{key:"cleanFiltered",value:function(){var e=void 0!==this.props.defaultValue?this.props.defaultValue:[];this.selectInput.value=e,this.applyFilter(e)}},{key:"applyFilter",value:function(e){1===e.length&&""===e[0]&&(e=[]),this.setState(function(){return{isSelected:e.length>0}}),this.props.onFilter(this.props.column,y.FILTER_TYPE.MULTISELECT)(e)}},{key:"filter",value:function(e){var t=v(e.target);this.applyFilter(t)}},{key:"render",value:function(){var e=this,t=this.props,r=t.id,n=t.style,a=t.className,l=(t.filterState,t.defaultValue,t.onFilter,t.column),i=(t.options,t.comparator,t.withoutEmptyOption,t.caseSensitive,t.getFilter,o(t,["id","style","className","filterState","defaultValue","onFilter","column","options","comparator","withoutEmptyOption","caseSensitive","getFilter"])),u="filter select-filter form-control "+a+" "+(this.state.isSelected?"":"placeholder-selected"),c="multiselect-filter-column-"+l.dataField+(r?"-"+r:"");return p.default.createElement("label",{className:"filter-label",htmlFor:c},p.default.createElement("span",{className:"sr-only"},"Filter by ",l.text),p.default.createElement("select",s({},i,{ref:function(t){return e.selectInput=t},id:c,style:n,multiple:!0,className:u,onChange:this.filter,onClick:function(e){return e.stopPropagation()},defaultValue:this.getDefaultValue()}),this.getOptions()))}}]),t}(f.Component);b.propTypes={onFilter:m.default.func.isRequired,column:m.default.object.isRequired,options:m.default.object.isRequired,id:m.default.string,filterState:m.default.object,comparator:m.default.oneOf([h.LIKE,h.EQ]),placeholder:m.default.string,style:m.default.object,className:m.default.string,withoutEmptyOption:m.default.bool,defaultValue:m.default.array,caseSensitive:m.default.bool,getFilter:m.default.func},b.defaultProps={defaultValue:[],filterState:{},className:"",withoutEmptyOption:!1,comparator:h.EQ,caseSensitive:!0,id:null},t.default=b},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 l(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}}(),u=r(2),s=n(u),c=r(3),f=n(c),p=r(0),d=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(p),m=r(1),h=[d.EQ,d.NE,d.GT,d.GE,d.LT,d.LE],y=function(e){function t(e){o(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.comparators=e.comparators||h,r.timeout=null;var n=void 0!==e.defaultValue&&void 0!==e.defaultValue.number;return e.options&&n&&(n=e.options.indexOf(e.defaultValue.number)>-1),r.state={isSelected:n},r.onChangeNumber=r.onChangeNumber.bind(r),r.onChangeNumberSet=r.onChangeNumberSet.bind(r),r.onChangeComparator=r.onChangeComparator.bind(r),r}return l(t,e),i(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,r=t.column,n=t.onFilter,o=t.getFilter,a=this.numberFilterComparator.value,l=this.numberFilter.value;a&&l&&n(r,m.FILTER_TYPE.NUMBER,!0)({number:l,comparator:a}),o&&o(function(t){e.setState(function(){return{isSelected:""!==t}}),e.numberFilterComparator.value=t.comparator,e.numberFilter.value=t.number,n(r,m.FILTER_TYPE.NUMBER)({number:t.number,comparator:t.comparator})})}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeout)}},{key:"onChangeNumber",value:function(e){var t=this.props,r=t.delay,n=t.column,o=t.onFilter,a=this.numberFilterComparator.value;if(""!==a){this.timeout&&clearTimeout(this.timeout);var l=e.target.value;this.timeout=setTimeout(function(){o(n,m.FILTER_TYPE.NUMBER)({number:l,comparator:a})},r)}}},{key:"onChangeNumberSet",value:function(e){var t=this.props,r=t.column,n=t.onFilter,o=this.numberFilterComparator.value,a=e.target.value;this.setState(function(){return{isSelected:""!==a}}),n(r,m.FILTER_TYPE.NUMBER)({number:a,comparator:o})}},{key:"onChangeComparator",value:function(e){var t=this.props,r=t.column,n=t.onFilter,o=this.numberFilter.value,a=e.target.value;n(r,m.FILTER_TYPE.NUMBER)({number:o,comparator:a})}},{key:"getDefaultComparator",value:function(){var e=this.props,t=e.defaultValue,r=e.filterState;return r&&r.filterVal?r.filterVal.comparator:t&&t.comparator?t.comparator:""}},{key:"getDefaultValue",value:function(){var e=this.props,t=e.defaultValue,r=e.filterState;return r&&r.filterVal?r.filterVal.number:t&&t.number?t.number:""}},{key:"getComparatorOptions",value:function(){var e=[];this.props.withoutEmptyComparatorOption||e.push(s.default.createElement("option",{key:"-1"}));for(var t=0;t<this.comparators.length;t+=1)e.push(s.default.createElement("option",{key:t,value:this.comparators[t]},this.comparators[t]));return e}},{key:"getNumberOptions",value:function(){var e=[],t=this.props,r=t.options,n=t.column;t.withoutEmptyNumberOption||e.push(s.default.createElement("option",{key:"-1",value:""},this.props.placeholder||"Select "+n.text+"..."));for(var o=0;o<r.length;o+=1)e.push(s.default.createElement("option",{key:o,value:r[o]},r[o]));return e}},{key:"applyFilter",value:function(e){var t=this.props,r=t.column,n=t.onFilter,o=e.number,a=e.comparator;this.setState(function(){return{isSelected:""!==o}}),this.numberFilterComparator.value=a,this.numberFilter.value=o,n(r,m.FILTER_TYPE.NUMBER)({number:o,comparator:a})}},{key:"cleanFiltered",value:function(){var e=this.props,t=e.column,r=e.onFilter,n=e.defaultValue,o=n?n.number:"",a=n?n.comparator:"";this.setState(function(){return{isSelected:""!==o}}),this.numberFilterComparator.value=a,this.numberFilter.value=o,r(t,m.FILTER_TYPE.NUMBER)({number:o,comparator:a})}},{key:"render",value:function(){var e=this,t=this.state.isSelected,r=this.props,n=r.id,o=r.column,a=r.options,l=r.style,i=r.className,u=r.numberStyle,c=r.numberClassName,f=r.comparatorStyle,p=r.comparatorClassName,d=r.placeholder,m="\n select-filter \n number-filter-input \n form-control \n "+c+" \n "+(t?"":"placeholder-selected")+"\n ",h="number-filter-comparator-"+o.dataField+(n?"-"+n:""),y="number-filter-column-"+o.dataField+(n?"-"+n:"");return s.default.createElement("div",{onClick:function(e){return e.stopPropagation()},className:"filter number-filter "+i,style:l},s.default.createElement("label",{className:"filter-label",htmlFor:h},s.default.createElement("span",{className:"sr-only"},"Filter comparator"),s.default.createElement("select",{ref:function(t){return e.numberFilterComparator=t},style:f,id:h,className:"number-filter-comparator form-control "+p,onChange:this.onChangeComparator,defaultValue:this.getDefaultComparator()},this.getComparatorOptions())),a?s.default.createElement("label",{className:"filter-label",htmlFor:y},s.default.createElement("span",{className:"sr-only"},"Select "+o.text),s.default.createElement("select",{ref:function(t){return e.numberFilter=t},id:y,style:u,className:m,onChange:this.onChangeNumberSet,defaultValue:this.getDefaultValue()},this.getNumberOptions())):s.default.createElement("label",{htmlFor:y},s.default.createElement("span",{className:"sr-only"},"Enter "+o.text),s.default.createElement("input",{ref:function(t){return e.numberFilter=t},id:y,type:"number",style:u,className:"number-filter-input form-control "+c,placeholder:d||"Enter "+o.text+"...",onChange:this.onChangeNumber,defaultValue:this.getDefaultValue()})))}}]),t}(u.Component);y.propTypes={onFilter:f.default.func.isRequired,column:f.default.object.isRequired,id:f.default.string,filterState:f.default.object,options:f.default.arrayOf(f.default.number),defaultValue:f.default.shape({number:f.default.oneOfType([f.default.string,f.default.number]),comparator:f.default.oneOf([].concat(h,[""]))}),delay:f.default.number,comparators:function(e,t){if(e[t])for(var r=0;r<e[t].length;r+=1){for(var n=!1,o=0;o<h.length;o+=1)if(h[o]===e[t][r]||""===e[t][r]){n=!0;break}if(!n)return new Error("Number comparator provided is not supported.\n Use only "+h)}},placeholder:f.default.string,withoutEmptyComparatorOption:f.default.bool,withoutEmptyNumberOption:f.default.bool,style:f.default.object,className:f.default.string,comparatorStyle:f.default.object,comparatorClassName:f.default.string,numberStyle:f.default.object,numberClassName:f.default.string,getFilter:f.default.func},y.defaultProps={delay:m.FILTER_DELAY,options:void 0,defaultValue:{number:void 0,comparator:""},filterState:{},withoutEmptyComparatorOption:!1,withoutEmptyNumberOption:!1,comparators:h,placeholder:void 0,style:void 0,className:"",comparatorStyle:void 0,comparatorClassName:"",numberStyle:void 0,numberClassName:"",id:null},t.default=y},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)}function l(e){return e.getUTCFullYear()+"-"+("0"+(e.getUTCMonth()+1)).slice(-2)+"-"+("0"+e.getUTCDate()).slice(-2)}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}}(),u=r(2),s=function(e){return e&&e.__esModule?e:{default:e}}(u),c=r(3),f=r(0),p=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(f),d=r(1),m=[p.EQ,p.NE,p.GT,p.GE,p.LT,p.LE],h=function(e){function t(e){n(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.timeout=null,r.comparators=e.comparators||m,r.applyFilter=r.applyFilter.bind(r),r.onChangeDate=r.onChangeDate.bind(r),r.onChangeComparator=r.onChangeComparator.bind(r),r}return a(t,e),i(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props.getFilter,r=this.dateFilterComparator.value,n=this.inputDate.value;r&&n&&this.applyFilter(n,r,!0),t&&t(function(t){var r=t||{date:null,comparator:null};e.dateFilterComparator.value=r.comparator,e.inputDate.value=r.date?l(r.date):null,e.applyFilter(r.date,r.comparator)})}},{key:"componentWillUnmount",value:function(){this.timeout&&clearTimeout(this.timeout)}},{key:"onChangeDate",value:function(e){var t=this.dateFilterComparator.value,r=e.target.value;this.applyFilter(r,t)}},{key:"onChangeComparator",value:function(e){var t=this.inputDate.value,r=e.target.value;this.applyFilter(t,r)}},{key:"getComparatorOptions",value:function(){var e=[];this.props.withoutEmptyComparatorOption||e.push(s.default.createElement("option",{key:"-1"}));for(var t=0;t<this.comparators.length;t+=1)e.push(s.default.createElement("option",{key:t,value:this.comparators[t]},this.comparators[t]));return e}},{key:"getDefaultComparator",value:function(){var e=this.props,t=e.defaultValue,r=e.filterState;return r&&r.filterVal?r.filterVal.comparator:t&&t.comparator?t.comparator:""}},{key:"getDefaultDate",value:function(){var e=this.props,t=e.defaultValue,r=e.filterState;return r&&r.filterVal&&r.filterVal.date?l(r.filterVal.date):t&&t.date?l(new Date(t.date)):""}},{key:"applyFilter",value:function(e,t,r){var n=this.props,o=n.column,a=n.onFilter,l=n.delay,i=function(){var n=""===e?null:new Date(e);a(o,d.FILTER_TYPE.DATE,r)({date:n,comparator:t})};l?this.timeout=setTimeout(function(){i()},l):i()}},{key:"render",value:function(){var e=this,t=this.props,r=t.id,n=t.placeholder,o=t.column,a=o.dataField,l=o.text,i=t.style,u=t.comparatorStyle,c=t.dateStyle,f=t.className,p=t.comparatorClassName,d=t.dateClassName,m="date-filter-comparator-"+a+(r?"-"+r:""),h="date-filter-column-"+a+(r?"-"+r:"");return s.default.createElement("div",{onClick:function(e){return e.stopPropagation()},className:"filter date-filter "+f,style:i},s.default.createElement("label",{className:"filter-label",htmlFor:m},s.default.createElement("span",{className:"sr-only"},"Filter comparator"),s.default.createElement("select",{ref:function(t){return e.dateFilterComparator=t},id:m,style:u,className:"date-filter-comparator form-control "+p,onChange:this.onChangeComparator,defaultValue:this.getDefaultComparator()},this.getComparatorOptions())),s.default.createElement("label",{htmlFor:h},s.default.createElement("span",{className:"sr-only"},"Enter $",l),s.default.createElement("input",{ref:function(t){return e.inputDate=t},id:h,className:"filter date-filter-input form-control "+d,style:c,type:"date",onChange:this.onChangeDate,placeholder:n||"Enter "+l+"...",defaultValue:this.getDefaultDate()})))}}]),t}(u.Component);h.propTypes={onFilter:c.PropTypes.func.isRequired,column:c.PropTypes.object.isRequired,id:c.PropTypes.string,filterState:c.PropTypes.object,delay:c.PropTypes.number,defaultValue:c.PropTypes.shape({date:c.PropTypes.oneOfType([c.PropTypes.object]),comparator:c.PropTypes.oneOf([].concat(m,[""]))}),comparators:function(e,t){if(e[t])for(var r=0;r<e[t].length;r+=1){for(var n=!1,o=0;o<m.length;o+=1)if(m[o]===e[t][r]||""===e[t][r]){n=!0;break}if(!n)return new Error("Date comparator provided is not supported.\n Use only "+m)}},placeholder:c.PropTypes.string,withoutEmptyComparatorOption:c.PropTypes.bool,style:c.PropTypes.object,comparatorStyle:c.PropTypes.object,dateStyle:c.PropTypes.object,className:c.PropTypes.string,comparatorClassName:c.PropTypes.string,dateClassName:c.PropTypes.string,getFilter:c.PropTypes.func},h.defaultProps={delay:0,defaultValue:{date:void 0,comparator:""},filterState:{},withoutEmptyComparatorOption:!1,comparators:m,placeholder:void 0,style:void 0,className:"",comparatorStyle:void 0,comparatorClassName:"",dateStyle:void 0,dateClassName:"",id:null},t.default=h},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 i(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=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(2),c=n(s),f=r(3),p=n(f),d=r(15),m=r(0),h=r(1);t.default=function(e,t,r){var n=c.default.createContext(),s=function(s){function f(e){a(this,f);var t=l(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,e));return t.currFilters={},t.clearFilters={},t.onFilter=t.onFilter.bind(t),t.doFilter=t.doFilter.bind(t),t.onExternalFilter=t.onExternalFilter.bind(t),t.data=e.data,t.isEmitDataChange=!1,t}return i(f,s),u(f,[{key:"componentDidMount",value:function(){t()&&Object.keys(this.currFilters).length>0&&r(this.currFilters)}},{key:"onFilter",value:function(n,a){var l=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(u){var s=Object.assign({},l.currFilters);l.clearFilters={};var c=n.dataField,f=n.filter;if(e.isDefined(u)&&""!==u&&0!==u.length){var p=f.props,d=p.comparator,y=void 0===d?a===h.FILTER_TYPE.SELECT?m.EQ:m.LIKE:d,v=p.caseSensitive,b=void 0!==v&&v;s[c]={filterVal:u,filterType:a,comparator:y,caseSensitive:b}}else delete s[c],l.clearFilters=o({},c,{clear:!0,filterVal:u});if(l.currFilters=s,t())return void(i||r(l.currFilters));l.doFilter(l.props)}}},{key:"onExternalFilter",value:function(e,t){var r=this;return function(n){r.onFilter(e,t)(n)}}},{key:"getFiltered",value:function(){return this.data}},{key:"UNSAFE_componentWillReceiveProps",value:function(r){t()||e.isEqual(r.data,this.data)?this.data=r.data:this.doFilter(r,this.isEmitDataChange)}},{key:"doFilter",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.dataChangeListener,o=t.data,a=t.columns,l=t.filter,i=(0,d.filters)(o,a,e)(this.currFilters,this.clearFilters);l.afterFilter&&l.afterFilter(i,this.currFilters),this.data=i,n&&!r?(this.isEmitDataChange=!0,n.emit("filterChanged",i.length)):(this.isEmitDataChange=!1,this.forceUpdate())}},{key:"render",value:function(){return c.default.createElement(n.Provider,{value:{data:this.data,onFilter:this.onFilter,onExternalFilter:this.onExternalFilter,currFilters:this.currFilters}},this.props.children)}}]),f}(c.default.Component);return s.propTypes={data:p.default.array.isRequired,columns:p.default.array.isRequired,dataChangeListener:p.default.object},{Provider:s,Consumer:n.Consumer}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.filters=t.filterFactory=t.filterByArray=t.filterByDate=t.filterByNumber=t.filterByText=void 0;var n=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},o="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},a=r(1),l=r(0),i=t.filterByText=function(e){return function(t,r,n,o){var a=n.filterVal,i=void 0===a?"":a,u=n.comparator,s=void 0===u?l.LIKE:u,c=n.caseSensitive,f=i.toString();return t.filter(function(t){var n=e.get(t,r);o&&(n=o(n,t));var a=e.isDefined(n)?n.toString():"";return s===l.EQ?a===f:c?a.includes(f):-1!==a.toLocaleUpperCase().indexOf(f.toLocaleUpperCase())})}},u=t.filterByNumber=function(e){return function(t,r,n,o){var a=n.filterVal,i=a.comparator,u=a.number;return t.filter(function(t){if(""===u||!i)return!0;var n=!0,a=e.get(t,r);switch(o&&(a=o(a,t)),i){case l.EQ:a!=u&&(n=!1);break;case l.GT:a<=u&&(n=!1);break;case l.GE:a<u&&(n=!1);break;case l.LT:a>=u&&(n=!1);break;case l.LE:a>u&&(n=!1);break;case l.NE:a==u&&(n=!1);break;default:console.error("Number comparator provided is not supported")}return n})}},s=t.filterByDate=function(e){return function(t,r,n,a){var i=n.filterVal,u=i.comparator,s=i.date;if(!s||!u)return t;var c=s.getUTCDate(),f=s.getUTCMonth(),p=s.getUTCFullYear();return t.filter(function(t){var n=!0,i=e.get(t,r);a&&(i=a(i,t)),"object"!==(void 0===i?"undefined":o(i))&&(i=new Date(i));var d=i.getUTCDate(),m=i.getUTCMonth(),h=i.getUTCFullYear();switch(u){case l.EQ:c===d&&f===m&&p===h||(n=!1);break;case l.GT:i<=s&&(n=!1);break;case l.GE:h<p?n=!1:h===p&&m<f?n=!1:h===p&&m===f&&d<c&&(n=!1);break;case l.LT:i>=s&&(n=!1);break;case l.LE:h>p?n=!1:h===p&&m>f?n=!1:h===p&&m===f&&d>c&&(n=!1);break;case l.NE:c===d&&f===m&&p===h&&(n=!1);break;default:console.error("Date comparator provided is not supported")}return n})}},c=t.filterByArray=function(e){return function(t,r,n){var o=n.filterVal,a=n.comparator;if(0===o.length)return t;var i=o.filter(function(t){return e.isDefined(t)}).map(function(e){return e.toString()});return t.filter(function(t){var n=e.get(t,r),o=e.isDefined(n)?n.toString():"";return a===l.EQ?-1!==i.indexOf(o):(o=o.toLocaleUpperCase(),i.some(function(e){return-1!==o.indexOf(e.toLocaleUpperCase())}))})}},f=t.filterFactory=function(e){return function(t){var r=void 0;switch(t){case a.FILTER_TYPE.TEXT:case a.FILTER_TYPE.SELECT:r=i(e);break;case a.FILTER_TYPE.MULTISELECT:r=c(e);break;case a.FILTER_TYPE.NUMBER:r=u(e);break;case a.FILTER_TYPE.DATE:r=s(e);break;default:r=i(e)}return r}};t.filters=function(e,t,r){return function(o){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=f(r),i=n({},a,o),u=e,s=void 0;return Object.keys(i).forEach(function(e){for(var r=void 0,n=void 0,o=void 0,c=0;c<t.length;c+=1)if(t[c].dataField===e){n=t[c].filterValue,t[c].filter&&(o=t[c].filter.props.onFilter);break}if(a[e]&&o)void 0!==(r=o(a[e].filterVal,u))&&(u=r);else{var f=i[e];s=l(f.filterType),o&&(r=o(f.filterVal,u)),u=void 0===r?s(u,e,f,n):r}}),u}}}])}); |
@@ -136,5 +136,9 @@ 'use strict'; | ||
data = props.data, | ||
columns = props.columns; | ||
columns = props.columns, | ||
filter = props.filter; | ||
var result = (0, _filter.filters)(data, columns, _)(this.currFilters, this.clearFilters); | ||
if (filter.afterFilter) { | ||
filter.afterFilter(result, this.currFilters); | ||
} | ||
this.data = result; | ||
@@ -141,0 +145,0 @@ if (dataChangeListener && !ignoreEmitDataChange) { |
{ | ||
"name": "react-bootstrap-table2-filter", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "it's a column filter addon for react-bootstrap-table2", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -364,1 +364,26 @@ # react-bootstrap-table2-filter | ||
``` | ||
## Configuration | ||
`filterFactory` is a factory function for initializing some internal config. Below is available options for `filterFactory`: | ||
### afterFilter | ||
This hook function will be called with two arguments(new filter result and filter object) when filtering completed. | ||
```js | ||
function afterFilter(newResult, newFilters) { | ||
console.log(newResult); | ||
console.log(newFilters); | ||
} | ||
export default () => ( | ||
<div> | ||
<BootstrapTable | ||
keyField="id" | ||
data={ products } | ||
columns={ columns } | ||
filter={ filterFactory({ afterFilter }) } | ||
/> | ||
</div> | ||
); | ||
``` |
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
345324
4577
388