react-bootstrap-table2-filter
Advanced tools
Comparing version 1.1.2 to 1.1.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.ReactBootstrapTable2Filter=t(require("react")):e.ReactBootstrapTable2Filter=t(e.React)}(this,function(e){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,o){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:o})},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 o(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 n=r(5),a=o(n),i=r(10),l=o(i),u=r(11),s=o(u),c=r(12),p=o(c),f=r(13),d=o(f),m=r(14),h=o(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:l.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 o(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function n(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 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 l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),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){n(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:e.defaultValue},r}return i(t,e),u(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,r=t.onFilter,o=t.getFilter,n=t.column,a=this.input.value;a&&r(this.props.column,d.FILTER_TYPE.TEXT,!0)(a),o&&o(function(t){e.setState(function(){return{value:t}}),r(n,d.FILTER_TYPE.TEXT)(t)})}},{key:"componentWillReceiveProps",value:function(e){e.defaultValue!==this.props.defaultValue&&this.applyFilter(e.defaultValue)}},{key:"componentWillUnmount",value:function(){this.cleanTimer()}},{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.placeholder,n=t.column.text,a=t.style,i=t.className,u=(t.onFilter,t.caseSensitive,t.defaultValue,t.getFilter,o(t,["placeholder","column","style","className","onFilter","caseSensitive","defaultValue","getFilter"]));return c.default.createElement("input",l({},u,{ref:function(t){return e.input=t},type:"text",className:"filter text-filter form-control "+i,style:a,onChange:this.filter,onClick:this.handleClick,placeholder:r||"Enter "+n+"...",value:this.state.value}))}}]),t}(s.Component);m.propTypes={onFilter:p.PropTypes.func.isRequired,column:p.PropTypes.object.isRequired,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,defaultValue:"",caseSensitive:!1},t.default=m},function(e,t,r){"use strict";var o=r(7),n=r(8),a=r(9);e.exports=function(){function e(e,t,r,o,i,l){l!==a&&n(!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=o,r.PropTypes=r,r}},function(e,t,r){"use strict";function o(e){return function(){return e}}var n=function(){};n.thatReturns=o,n.thatReturnsFalse=o(!1),n.thatReturnsTrue=o(!0),n.thatReturnsNull=o(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n},function(e,t,r){"use strict";function o(e,t,r,o,a,i,l,u){if(n(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,o,a,i,l,u],p=0;s=new Error(t.replace(/%s/g,function(){return c[p++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}var n=function(e){};e.exports=o},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 o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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)}function u(e,t){if(Array.isArray(e)){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 e.length===t.length}for(var o=Object.keys(e),n=0;n<o.length;n+=1)if(e[o[n]]!==t[o[n]])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 o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},p=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),f=r(2),d=o(f),m=r(3),h=o(m),y=r(0),v=r(1),b=function(e){function t(e){a(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.filter=r.filter.bind(r);var o=void 0!==s(e.options,e.defaultValue);return r.state={isSelected:o},r}return l(t,e),p(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,r=t.column,o=t.onFilter,n=t.getFilter,a=this.selectInput.value;a&&""!==a&&o(r,v.FILTER_TYPE.SELECT,!0)(a),n&&n(function(t){e.setState(function(){return{isSelected:""!==t}}),e.selectInput.value=t,o(r,v.FILTER_TYPE.SELECT)(t)})}},{key:"componentDidUpdate",value:function(e){var t=!1;if(this.props.defaultValue!==e.defaultValue?t=!0:u(this.props.options,e.options)||(t=!0),t){var r=this.selectInput.value;r&&this.props.onFilter(this.props.column,v.FILTER_TYPE.SELECT)(r)}}},{key:"getOptions",value:function(){var e=[],t=this.props,r=t.options,o=t.placeholder,n=t.column;return t.withoutEmptyOption||e.push(d.default.createElement("option",{key:"-1",value:""},o||"Select "+n.text+"...")),Array.isArray(r)?r.forEach(function(t){var r=t.value,o=t.label;return e.push(d.default.createElement("option",{key:r,value:r},o))}):Object.keys(r).forEach(function(t){return e.push(d.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.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:"render",value:function(){var e=this,t=this.props,r=t.style,o=t.className,a=t.defaultValue,i=(t.onFilter,t.column,t.options,t.comparator,t.withoutEmptyOption,t.caseSensitive,t.getFilter,n(t,["style","className","defaultValue","onFilter","column","options","comparator","withoutEmptyOption","caseSensitive","getFilter"])),l="filter select-filter form-control "+o+" "+(this.state.isSelected?"":"placeholder-selected");return d.default.createElement("select",c({},i,{ref:function(t){return e.selectInput=t},style:r,className:l,onChange:this.filter,onClick:function(e){return e.stopPropagation()},defaultValue:void 0!==a?a:""}),this.getOptions())}}]),t}(f.Component);b.propTypes={onFilter:h.default.func.isRequired,column:h.default.object.isRequired,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:"",className:"",withoutEmptyOption:!1,comparator:y.EQ,caseSensitive:!0},t.default=b},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var r={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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)}function u(e,t){for(var r=Object.keys(e),o=0;o<r.length;o+=1)if(e[r[o]]!==t[r[o]])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 o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},c=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),p=r(2),f=o(p),d=r(3),m=o(d),h=r(0),y=r(1),v=function(e){return Array.from(e.selectedOptions).map(function(e){return e.value})},b=function(e){function t(e){a(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.filter=r.filter.bind(r),r.applyFilter=r.applyFilter.bind(r);var o=e.defaultValue.map(function(t){return e.options[t]}).length>0;return r.state={isSelected:o},r}return l(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(this.selectInput.value)}},{key:"getOptions",value:function(){var e=[],t=this.props,r=t.options,o=t.placeholder,n=t.column;return t.withoutEmptyOption||e.push(f.default.createElement("option",{key:"-1",value:""},o||"Select "+n.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.style,o=t.className,a=t.defaultValue,i=(t.onFilter,t.column,t.options,t.comparator,t.withoutEmptyOption,t.caseSensitive,t.getFilter,n(t,["style","className","defaultValue","onFilter","column","options","comparator","withoutEmptyOption","caseSensitive","getFilter"])),l="filter select-filter form-control "+o+" "+(this.state.isSelected?"":"placeholder-selected");return f.default.createElement("select",s({},i,{ref:function(t){return e.selectInput=t},style:r,multiple:!0,className:l,onChange:this.filter,onClick:function(e){return e.stopPropagation()},defaultValue:void 0!==a?a:""}),this.getOptions())}}]),t}(p.Component);b.propTypes={onFilter:m.default.func.isRequired,column:m.default.object.isRequired,options:m.default.object.isRequired,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:[],className:"",withoutEmptyOption:!1,comparator:h.EQ,caseSensitive:!0},t.default=b},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(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 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 l=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(2),s=o(u),c=r(3),p=o(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){n(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.comparators=e.comparators||h,r.timeout=null;var o=void 0!==e.defaultValue&&void 0!==e.defaultValue.number;return e.options&&o&&(o=e.options.indexOf(e.defaultValue.number)>-1),r.state={isSelected:o},r.onChangeNumber=r.onChangeNumber.bind(r),r.onChangeNumberSet=r.onChangeNumberSet.bind(r),r.onChangeComparator=r.onChangeComparator.bind(r),r}return i(t,e),l(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,r=t.column,o=t.onFilter,n=t.getFilter,a=this.numberFilterComparator.value,i=this.numberFilter.value;a&&i&&o(r,m.FILTER_TYPE.NUMBER,!0)({number:i,comparator:a}),n&&n(function(t){e.setState(function(){return{isSelected:""!==t}}),e.numberFilterComparator.value=t.comparator,e.numberFilter.value=t.number,o(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,o=t.column,n=t.onFilter,a=this.numberFilterComparator.value;if(""!==a){this.timeout&&clearTimeout(this.timeout);var i=e.target.value;this.timeout=setTimeout(function(){n(o,m.FILTER_TYPE.NUMBER)({number:i,comparator:a})},r)}}},{key:"onChangeNumberSet",value:function(e){var t=this.props,r=t.column,o=t.onFilter,n=this.numberFilterComparator.value,a=e.target.value;this.setState(function(){return{isSelected:""!==a}}),o(r,m.FILTER_TYPE.NUMBER)({number:a,comparator:n})}},{key:"onChangeComparator",value:function(e){var t=this.props,r=t.column,o=t.onFilter,n=this.numberFilter.value,a=e.target.value;o(r,m.FILTER_TYPE.NUMBER)({number:n,comparator:a})}},{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,o=t.column;t.withoutEmptyNumberOption||e.push(s.default.createElement("option",{key:"-1",value:""},this.props.placeholder||"Select "+o.text+"..."));for(var n=0;n<r.length;n+=1)e.push(s.default.createElement("option",{key:n,value:r[n]},r[n]));return e}},{key:"applyFilter",value:function(e){var t=this.props,r=t.column,o=t.onFilter,n=e.number,a=e.comparator;this.setState(function(){return{isSelected:""!==n}}),this.numberFilterComparator.value=a,this.numberFilter.value=n,o(r,m.FILTER_TYPE.NUMBER)({number:n,comparator:a})}},{key:"cleanFiltered",value:function(){var e=this.props,t=e.column,r=e.onFilter,o=e.defaultValue,n=o?o.number:"",a=o?o.comparator:"";this.setState(function(){return{isSelected:""!==n}}),this.numberFilterComparator.value=a,this.numberFilter.value=n,r(t,m.FILTER_TYPE.NUMBER)({number:n,comparator:a})}},{key:"render",value:function(){var e=this,t=this.state.isSelected,r=this.props,o=r.defaultValue,n=r.column,a=r.options,i=r.style,l=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 ";return s.default.createElement("div",{onClick:function(e){return e.stopPropagation()},className:"filter number-filter "+l,style:i},s.default.createElement("select",{ref:function(t){return e.numberFilterComparator=t},style:p,className:"number-filter-comparator form-control "+f,onChange:this.onChangeComparator,defaultValue:o?o.comparator:""},this.getComparatorOptions()),a?s.default.createElement("select",{ref:function(t){return e.numberFilter=t},style:u,className:m,onChange:this.onChangeNumberSet,defaultValue:o?o.number:""},this.getNumberOptions()):s.default.createElement("input",{ref:function(t){return e.numberFilter=t},type:"number",style:u,className:"number-filter-input form-control "+c,placeholder:d||"Enter "+n.text+"...",onChange:this.onChangeNumber,defaultValue:o?o.number:""}))}}]),t}(u.Component);y.propTypes={onFilter:p.default.func.isRequired,column:p.default.object.isRequired,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 o=!1,n=0;n<h.length;n+=1)if(h[n]===e[t][r]||""===e[t][r]){o=!0;break}if(!o)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:""},withoutEmptyComparatorOption:!1,withoutEmptyNumberOption:!1,comparators:h,placeholder:void 0,style:void 0,className:"",comparatorStyle:void 0,comparatorClassName:"",numberStyle:void 0,numberClassName:""},t.default=y},function(e,t,r){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(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 i(e){return e.getFullYear()+"-"+("0"+(e.getMonth()+1)).slice(-2)+"-"+("0"+e.getDate()).slice(-2)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),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){o(this,t);var r=n(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),l(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props.getFilter,r=this.dateFilterComparator.value,o=this.inputDate.value;r&&o&&this.applyFilter(o,r,!0),t&&t(function(t){var r=t||{date:null,comparator:null};e.dateFilterComparator.value=r.comparator,e.inputDate.value=r.date?i(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:"getDefaultDate",value:function(){var e="",t=this.props.defaultValue;return t&&t.date&&(e=i(new Date(t.date))),e}},{key:"applyFilter",value:function(e,t,r){var o=this.props,n=o.column,a=o.onFilter,i=o.delay,l=function(){var o=""===e?null:new Date(e);a(n,d.FILTER_TYPE.DATE,r)({date:o,comparator:t})};i?this.timeout=setTimeout(function(){l()},i):l()}},{key:"render",value:function(){var e=this,t=this.props,r=t.placeholder,o=t.column.text,n=t.style,a=t.comparatorStyle,i=t.dateStyle,l=t.className,u=t.comparatorClassName,c=t.dateClassName,p=t.defaultValue;return s.default.createElement("div",{onClick:function(e){return e.stopPropagation()},className:"filter date-filter "+l,style:n},s.default.createElement("select",{ref:function(t){return e.dateFilterComparator=t},style:a,className:"date-filter-comparator form-control "+u,onChange:this.onChangeComparator,defaultValue:p?p.comparator:""},this.getComparatorOptions()),s.default.createElement("input",{ref:function(t){return e.inputDate=t},className:"filter date-filter-input form-control "+c,style:i,type:"date",onChange:this.onChangeDate,placeholder:r||"Enter "+o+"...",defaultValue:this.getDefaultDate()}))}}]),t}(u.Component);h.propTypes={onFilter:c.PropTypes.func.isRequired,column:c.PropTypes.object.isRequired,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 o=!1,n=0;n<m.length;n+=1)if(m[n]===e[t][r]||""===e[t][r]){o=!0;break}if(!o)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:""},withoutEmptyComparatorOption:!1,comparators:m,placeholder:void 0,style:void 0,className:"",comparatorStyle:void 0,comparatorClassName:"",dateStyle:void 0,dateClassName:""},t.default=h},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(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 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 l=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),u=r(2),s=o(u),c=r(3),p=o(c),f=r(15),d=r(0),m=r(1);t.default=function(e,t,r){var o=s.default.createContext(),u=function(u){function c(e){n(this,c);var t=a(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,e));return t.currFilters={},t.onFilter=t.onFilter.bind(t),t.onExternalFilter=t.onExternalFilter.bind(t),t}return i(c,u),l(c,[{key:"componentDidMount",value:function(){t()&&Object.keys(this.currFilters).length>0&&r(this.currFilters)}},{key:"onFilter",value:function(o,n){var a=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(l){var u=Object.assign({},a.currFilters),s=o.dataField,c=o.filter;if(e.isDefined(l)&&""!==l&&0!==l.length){var p=c.props,f=p.comparator,h=void 0===f?n===m.FILTER_TYPE.SELECT?d.EQ:d.LIKE:f,y=p.caseSensitive,v=void 0!==y&&y;u[s]={filterVal:l,filterType:n,comparator:h,caseSensitive:v}}else delete u[s];if(a.currFilters=u,t())return void(i||r(a.currFilters));c.props.onFilter&&c.props.onFilter(l),a.forceUpdate()}}},{key:"onExternalFilter",value:function(e,t){var r=this;return function(o){r.onFilter(e,t)(o)}}},{key:"render",value:function(){var r=this.props.data;return t()||(r=(0,f.filters)(r,this.props.columns,e)(this.currFilters)),s.default.createElement(o.Provider,{value:{data:r,onFilter:this.onFilter,onExternalFilter:this.onExternalFilter}},this.props.children)}}]),c}(s.default.Component);return u.propTypes={data:p.default.array.isRequired,columns:p.default.array.isRequired},{Provider:u,Consumer:o.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 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},n=r(1),a=r(0),i=t.filterByText=function(e){return function(t,r,o,n){var i=o.filterVal,l=void 0===i?"":i,u=o.comparator,s=void 0===u?a.LIKE:u,c=o.caseSensitive,p=l.toString();return t.filter(function(t){var o=e.get(t,r);n&&(o=n(o,t));var i=e.isDefined(o)?o.toString():"";return s===a.EQ?i===p:c?i.includes(p):-1!==i.toLocaleUpperCase().indexOf(p.toLocaleUpperCase())})}},l=t.filterByNumber=function(e){return function(t,r,o,n){var i=o.filterVal,l=i.comparator,u=i.number;return t.filter(function(t){if(""===u||!l)return!0;var o=!0,i=e.get(t,r);switch(n&&(i=n(i,t)),l){case a.EQ:i!=u&&(o=!1);break;case a.GT:i<=u&&(o=!1);break;case a.GE:i<u&&(o=!1);break;case a.LT:i>=u&&(o=!1);break;case a.LE:i>u&&(o=!1);break;case a.NE:i==u&&(o=!1);break;default:console.error("Number comparator provided is not supported")}return o})}},u=t.filterByDate=function(e){return function(t,r,n,i){var l=n.filterVal,u=l.comparator,s=l.date;if(!s||!u)return t;var c=s.getDate(),p=s.getMonth(),f=s.getFullYear();return t.filter(function(t){var n=!0,l=e.get(t,r);i&&(l=i(l,t)),"object"!==(void 0===l?"undefined":o(l))&&(l=new Date(l));var d=l.getDate(),m=l.getMonth(),h=l.getFullYear();switch(u){case a.EQ:c===d&&p===m&&f===h||(n=!1);break;case a.GT:l<=s&&(n=!1);break;case a.GE:h<f?n=!1:h===f&&m<p?n=!1:h===f&&m===p&&d<c&&(n=!1);break;case a.LT:l>=s&&(n=!1);break;case a.LE:h>f?n=!1:h===f&&m>p?n=!1:h===f&&m===p&&d>c&&(n=!1);break;case a.NE:c===d&&p===m&&f===h&&(n=!1);break;default:console.error("Date comparator provided is not supported")}return n})}},s=t.filterByArray=function(e){return function(t,r,o){var n=o.filterVal,i=o.comparator;if(0===n.length)return t;var l=n.filter(function(t){return e.isDefined(t)}).map(function(e){return e.toString()});return t.filter(function(t){var o=e.get(t,r),n=e.isDefined(o)?o.toString():"";return i===a.EQ?-1!==l.indexOf(n):(n=n.toLocaleUpperCase(),l.some(function(e){return-1!==n.indexOf(e.toLocaleUpperCase())}))})}},c=t.filterFactory=function(e){return function(t){var r=void 0;switch(t){case n.FILTER_TYPE.TEXT:case n.FILTER_TYPE.SELECT:r=i(e);break;case n.FILTER_TYPE.MULTISELECT:r=s(e);break;case n.FILTER_TYPE.NUMBER:r=l(e);break;case n.FILTER_TYPE.DATE:r=u(e);break;default:r=i(e)}return r}};t.filters=function(e,t,r){return function(o){var n=c(r),a=e,i=void 0;return Object.keys(o).forEach(function(e){var r=o[e];i=n(r.filterType);for(var l=void 0,u=0;u<t.length;u+=1)if(t[u].dataField===e){l=t[u].filterValue;break}a=i(a,e,r,l)}),a}}}])}); | ||
!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),i=r(10),l=n(i),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:l.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 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 l=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:e.defaultValue},r}return i(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:"componentWillReceiveProps",value:function(e){e.defaultValue!==this.props.defaultValue&&this.applyFilter(e.defaultValue)}},{key:"componentWillUnmount",value:function(){this.cleanTimer()}},{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.placeholder,o=t.column.text,a=t.style,i=t.className,u=(t.onFilter,t.caseSensitive,t.defaultValue,t.getFilter,n(t,["placeholder","column","style","className","onFilter","caseSensitive","defaultValue","getFilter"]));return c.default.createElement("input",l({},u,{ref:function(t){return e.input=t},type:"text",className:"filter text-filter form-control "+i,style:a,onChange:this.filter,onClick:this.handleClick,placeholder:r||"Enter "+o+"...",value:this.state.value}))}}]),t}(s.Component);m.propTypes={onFilter:p.PropTypes.func.isRequired,column:p.PropTypes.object.isRequired,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,defaultValue:"",caseSensitive:!1},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,i,l){l!==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,i,l,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,i,l,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 i(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)}function u(e,t){if(Array.isArray(e)){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 e.length===t.length}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=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));r.filter=r.filter.bind(r);var n=void 0!==s(e.options,e.defaultValue);return r.state={isSelected:n},r}return l(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;if(this.props.defaultValue!==e.defaultValue?t=!0:u(this.props.options,e.options)||(t=!0),t){var r=this.selectInput.value;r&&this.props.onFilter(this.props.column,v.FILTER_TYPE.SELECT)(r)}}},{key:"getOptions",value:function(){var e=[],t=this.props,r=t.options,n=t.placeholder,o=t.column;return t.withoutEmptyOption||e.push(d.default.createElement("option",{key:"-1",value:""},n||"Select "+o.text+"...")),Array.isArray(r)?r.forEach(function(t){var r=t.value,n=t.label;return e.push(d.default.createElement("option",{key:r,value:r},n))}):Object.keys(r).forEach(function(t){return e.push(d.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.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:"render",value:function(){var e=this,t=this.props,r=t.style,n=t.className,a=t.defaultValue,i=(t.onFilter,t.column,t.options,t.comparator,t.withoutEmptyOption,t.caseSensitive,t.getFilter,o(t,["style","className","defaultValue","onFilter","column","options","comparator","withoutEmptyOption","caseSensitive","getFilter"])),l="filter select-filter form-control "+n+" "+(this.state.isSelected?"":"placeholder-selected");return d.default.createElement("select",c({},i,{ref:function(t){return e.selectInput=t},style:r,className:l,onChange:this.filter,onClick:function(e){return e.stopPropagation()},defaultValue:void 0!==a?a:""}),this.getOptions())}}]),t}(f.Component);b.propTypes={onFilter:h.default.func.isRequired,column:h.default.object.isRequired,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:"",className:"",withoutEmptyOption:!1,comparator:y.EQ,caseSensitive:!0},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 i(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)}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){return Array.from(e.selectedOptions).map(function(e){return e.value})},b=function(e){function t(e){a(this,t);var r=i(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 l(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(this.selectInput.value)}},{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.style,n=t.className,a=t.defaultValue,i=(t.onFilter,t.column,t.options,t.comparator,t.withoutEmptyOption,t.caseSensitive,t.getFilter,o(t,["style","className","defaultValue","onFilter","column","options","comparator","withoutEmptyOption","caseSensitive","getFilter"])),l="filter select-filter form-control "+n+" "+(this.state.isSelected?"":"placeholder-selected");return f.default.createElement("select",s({},i,{ref:function(t){return e.selectInput=t},style:r,multiple:!0,className:l,onChange:this.filter,onClick:function(e){return e.stopPropagation()},defaultValue:void 0!==a?a:""}),this.getOptions())}}]),t}(p.Component);b.propTypes={onFilter:m.default.func.isRequired,column:m.default.object.isRequired,options:m.default.object.isRequired,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:[],className:"",withoutEmptyOption:!1,comparator:h.EQ,caseSensitive:!0},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 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 l=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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 i(t,e),l(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,r=t.column,n=t.onFilter,o=t.getFilter,a=this.numberFilterComparator.value,i=this.numberFilter.value;a&&i&&n(r,m.FILTER_TYPE.NUMBER,!0)({number:i,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 i=e.target.value;this.timeout=setTimeout(function(){o(n,m.FILTER_TYPE.NUMBER)({number:i,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:"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.defaultValue,o=r.column,a=r.options,i=r.style,l=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 ";return s.default.createElement("div",{onClick:function(e){return e.stopPropagation()},className:"filter number-filter "+l,style:i},s.default.createElement("select",{ref:function(t){return e.numberFilterComparator=t},style:p,className:"number-filter-comparator form-control "+f,onChange:this.onChangeComparator,defaultValue:n?n.comparator:""},this.getComparatorOptions()),a?s.default.createElement("select",{ref:function(t){return e.numberFilter=t},style:u,className:m,onChange:this.onChangeNumberSet,defaultValue:n?n.number:""},this.getNumberOptions()):s.default.createElement("input",{ref:function(t){return e.numberFilter=t},type:"number",style:u,className:"number-filter-input form-control "+c,placeholder:d||"Enter "+o.text+"...",onChange:this.onChangeNumber,defaultValue:n?n.number:""}))}}]),t}(u.Component);y.propTypes={onFilter:p.default.func.isRequired,column:p.default.object.isRequired,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:""},withoutEmptyComparatorOption:!1,withoutEmptyNumberOption:!1,comparators:h,placeholder:void 0,style:void 0,className:"",comparatorStyle:void 0,comparatorClassName:"",numberStyle:void 0,numberClassName:""},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 i(e){return e.getFullYear()+"-"+("0"+(e.getMonth()+1)).slice(-2)+"-"+("0"+e.getDate()).slice(-2)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),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),l(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?i(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:"getDefaultDate",value:function(){var e="",t=this.props.defaultValue;return t&&t.date&&(e=i(new Date(t.date))),e}},{key:"applyFilter",value:function(e,t,r){var n=this.props,o=n.column,a=n.onFilter,i=n.delay,l=function(){var n=""===e?null:new Date(e);a(o,d.FILTER_TYPE.DATE,r)({date:n,comparator:t})};i?this.timeout=setTimeout(function(){l()},i):l()}},{key:"render",value:function(){var e=this,t=this.props,r=t.placeholder,n=t.column.text,o=t.style,a=t.comparatorStyle,i=t.dateStyle,l=t.className,u=t.comparatorClassName,c=t.dateClassName,p=t.defaultValue;return s.default.createElement("div",{onClick:function(e){return e.stopPropagation()},className:"filter date-filter "+l,style:o},s.default.createElement("select",{ref:function(t){return e.dateFilterComparator=t},style:a,className:"date-filter-comparator form-control "+u,onChange:this.onChangeComparator,defaultValue:p?p.comparator:""},this.getComparatorOptions()),s.default.createElement("input",{ref:function(t){return e.inputDate=t},className:"filter date-filter-input form-control "+c,style:i,type:"date",onChange:this.onChangeDate,placeholder:r||"Enter "+n+"...",defaultValue:this.getDefaultDate()}))}}]),t}(u.Component);h.propTypes={onFilter:c.PropTypes.func.isRequired,column:c.PropTypes.object.isRequired,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:""},withoutEmptyComparatorOption:!1,comparators:m,placeholder:void 0,style:void 0,className:"",comparatorStyle:void 0,comparatorClassName:"",dateStyle:void 0,dateClassName:""},t.default=h},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 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 l=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(2),s=n(u),c=r(3),p=n(c),f=r(15),d=r(0),m=r(1);t.default=function(e,t,r){var n=s.default.createContext(),u=function(u){function c(e){o(this,c);var t=a(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,e));return t.currFilters={},t.onFilter=t.onFilter.bind(t),t.onExternalFilter=t.onExternalFilter.bind(t),t.state={data:e.data},t}return i(c,u),l(c,[{key:"componentDidMount",value:function(){t()&&Object.keys(this.currFilters).length>0&&r(this.currFilters)}},{key:"componentWillReceiveProps",value:function(e){t()&&this.setState({data:e.data})}},{key:"onFilter",value:function(n,o){var a=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(l){var u=Object.assign({},a.currFilters),s=n.dataField,c=n.filter;if(e.isDefined(l)&&""!==l&&0!==l.length){var p=c.props,h=p.comparator,y=void 0===h?o===m.FILTER_TYPE.SELECT?d.EQ:d.LIKE:h,v=p.caseSensitive,b=void 0!==v&&v;u[s]={filterVal:l,filterType:o,comparator:y,caseSensitive:b}}else delete u[s];if(a.currFilters=u,t())return void(i||r(a.currFilters));var E=void 0;c.props.onFilter&&(E=c.props.onFilter(l));var T=a.props,g=T.dataChangeListener,F=T.data;E=E||(0,f.filters)(F,a.props.columns,e)(a.currFilters),g&&g.emit("filterChanged",E.length),a.setState({data:E})}}},{key:"onExternalFilter",value:function(e,t){var r=this;return function(n){r.onFilter(e,t)(n)}}},{key:"render",value:function(){return s.default.createElement(n.Provider,{value:{data:this.state.data,onFilter:this.onFilter,onExternalFilter:this.onExternalFilter}},this.props.children)}}]),c}(s.default.Component);return u.propTypes={data:p.default.array.isRequired,columns:p.default.array.isRequired,dataChangeListener:p.default.object},{Provider:u,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="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},o=r(1),a=r(0),i=t.filterByText=function(e){return function(t,r,n,o){var i=n.filterVal,l=void 0===i?"":i,u=n.comparator,s=void 0===u?a.LIKE:u,c=n.caseSensitive,p=l.toString();return t.filter(function(t){var n=e.get(t,r);o&&(n=o(n,t));var i=e.isDefined(n)?n.toString():"";return s===a.EQ?i===p:c?i.includes(p):-1!==i.toLocaleUpperCase().indexOf(p.toLocaleUpperCase())})}},l=t.filterByNumber=function(e){return function(t,r,n,o){var i=n.filterVal,l=i.comparator,u=i.number;return t.filter(function(t){if(""===u||!l)return!0;var n=!0,i=e.get(t,r);switch(o&&(i=o(i,t)),l){case a.EQ:i!=u&&(n=!1);break;case a.GT:i<=u&&(n=!1);break;case a.GE:i<u&&(n=!1);break;case a.LT:i>=u&&(n=!1);break;case a.LE:i>u&&(n=!1);break;case a.NE:i==u&&(n=!1);break;default:console.error("Number comparator provided is not supported")}return n})}},u=t.filterByDate=function(e){return function(t,r,o,i){var l=o.filterVal,u=l.comparator,s=l.date;if(!s||!u)return t;var c=s.getDate(),p=s.getMonth(),f=s.getFullYear();return t.filter(function(t){var o=!0,l=e.get(t,r);i&&(l=i(l,t)),"object"!==(void 0===l?"undefined":n(l))&&(l=new Date(l));var d=l.getDate(),m=l.getMonth(),h=l.getFullYear();switch(u){case a.EQ:c===d&&p===m&&f===h||(o=!1);break;case a.GT:l<=s&&(o=!1);break;case a.GE:h<f?o=!1:h===f&&m<p?o=!1:h===f&&m===p&&d<c&&(o=!1);break;case a.LT:l>=s&&(o=!1);break;case a.LE:h>f?o=!1:h===f&&m>p?o=!1:h===f&&m===p&&d>c&&(o=!1);break;case a.NE:c===d&&p===m&&f===h&&(o=!1);break;default:console.error("Date comparator provided is not supported")}return o})}},s=t.filterByArray=function(e){return function(t,r,n){var o=n.filterVal,i=n.comparator;if(0===o.length)return t;var l=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 i===a.EQ?-1!==l.indexOf(o):(o=o.toLocaleUpperCase(),l.some(function(e){return-1!==o.indexOf(e.toLocaleUpperCase())}))})}},c=t.filterFactory=function(e){return function(t){var r=void 0;switch(t){case o.FILTER_TYPE.TEXT:case o.FILTER_TYPE.SELECT:r=i(e);break;case o.FILTER_TYPE.MULTISELECT:r=s(e);break;case o.FILTER_TYPE.NUMBER:r=l(e);break;case o.FILTER_TYPE.DATE:r=u(e);break;default:r=i(e)}return r}};t.filters=function(e,t,r){return function(n){var o=c(r),a=e,i=void 0;return Object.keys(n).forEach(function(e){var r=n[e];i=o(r.filterType);for(var l=void 0,u=0;u<t.length;u+=1)if(t[u].dataField===e){l=t[u].filterValue;break}a=i(a,e,r,l)}),a}}}])}); |
@@ -47,2 +47,5 @@ 'use strict'; | ||
_this.onExternalFilter = _this.onExternalFilter.bind(_this); | ||
_this.state = { | ||
data: props.data | ||
}; | ||
return _this; | ||
@@ -59,2 +62,11 @@ } | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
if (isRemoteFiltering()) { | ||
this.setState({ | ||
data: nextProps.data | ||
}); | ||
} | ||
} | ||
}, { | ||
key: 'onFilter', | ||
@@ -97,7 +109,16 @@ value: function onFilter(column, filterType) { | ||
var result = void 0; | ||
if (filter.props.onFilter) { | ||
filter.props.onFilter(filterVal); | ||
result = filter.props.onFilter(filterVal); | ||
} | ||
_this2.forceUpdate(); | ||
var _props = _this2.props, | ||
dataChangeListener = _props.dataChangeListener, | ||
data = _props.data; | ||
result = result || (0, _filter.filters)(data, _this2.props.columns, _)(_this2.currFilters); | ||
if (dataChangeListener) { | ||
dataChangeListener.emit('filterChanged', result.length); | ||
} | ||
_this2.setState({ data: result }); | ||
}; | ||
@@ -117,11 +138,6 @@ } | ||
value: function render() { | ||
var data = this.props.data; | ||
if (!isRemoteFiltering()) { | ||
data = (0, _filter.filters)(data, this.props.columns, _)(this.currFilters); | ||
} | ||
return _react2.default.createElement( | ||
FilterContext.Provider, | ||
{ value: { | ||
data: data, | ||
data: this.state.data, | ||
onFilter: this.onFilter, | ||
@@ -141,3 +157,4 @@ onExternalFilter: this.onExternalFilter | ||
data: _propTypes2.default.array.isRequired, | ||
columns: _propTypes2.default.array.isRequired | ||
columns: _propTypes2.default.array.isRequired, | ||
dataChangeListener: _propTypes2.default.object | ||
}; | ||
@@ -144,0 +161,0 @@ |
{ | ||
"name": "react-bootstrap-table2-filter", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "it's a column filter addon for react-bootstrap-table2", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
303074
3947