react-bootstrap-table2-filter
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -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),i=r(10),u=n(i),l=r(11),s=n(l),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:u.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 u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(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),l(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,l=(t.onFilter,t.caseSensitive,t.defaultValue,t.getFilter,n(t,["placeholder","column","style","className","onFilter","caseSensitive","defaultValue","getFilter"]));return c.default.createElement("input",u({},l,{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,u){u!==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,u,l){if(o(t),!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,a,i,u,l],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 u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){if(Array.isArray(e)){for(var r=0;r<e.length;r+=1)if(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 u(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:l(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:n,value:n},r))}):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"])),u="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:u,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 u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(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 u(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:l(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"])),u="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:u,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 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}}(),l=r(2),s=n(l),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),u(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,u=r.className,l=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 "+u,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:l,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:l,className:"number-filter-input form-control "+c,placeholder:d||"Enter "+o.text+"...",onChange:this.onChangeNumber,defaultValue:n?n.number:""}))}}]),t}(l.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 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}}(),l=r(2),s=function(e){return e&&e.__esModule?e:{default:e}}(l),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),u(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){e.dateFilterComparator.value=t.comparator,e.inputDate.value=i(t.date),e.applyFilter(t.date,t.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,u=function(){var n=""===e?null:new Date(e);a(o,d.FILTER_TYPE.DATE,r)({date:n,comparator:t})};i?this.timeout=setTimeout(function(){u()},i):u()}},{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,u=t.className,l=t.comparatorClassName,c=t.dateClassName,p=t.defaultValue;return s.default.createElement("div",{onClick:function(e){return e.stopPropagation()},className:"filter date-filter "+u,style:o},s.default.createElement("select",{ref:function(t){return e.dateFilterComparator=t},style:a,className:"date-filter-comparator form-control "+l,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}(l.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 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}}(),l=r(2),s=n(l),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(),l=function(l){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}return i(c,l),u(c,[{key:"componentDidMount",value:function(){t()&&Object.keys(this.currFilters).length>0&&r(this.currFilters)}},{key:"onFilter",value:function(n,o){var a=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(u){var l=Object.assign({},a.currFilters),s=n.dataField,c=n.filter;if(e.isDefined(u)&&""!==u&&0!==u.length){var p=c.props,f=p.comparator,h=void 0===f?o===m.FILTER_TYPE.SELECT?d.EQ:d.LIKE:f,y=p.caseSensitive,v=void 0!==y&&y;l[s]={filterVal:u,filterType:o,comparator:h,caseSensitive:v}}else delete l[s];if(a.currFilters=l,t())return void(i||r(a.currFilters));a.forceUpdate()}}},{key:"onExternalFilter",value:function(e,t){var r=this;return function(n){r.onFilter(e,t)(n)}}},{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(n.Provider,{value:{data:r,onFilter:this.onFilter,onExternalFilter:this.onExternalFilter}},this.props.children)}}]),c}(s.default.Component);return l.propTypes={data:p.default.array.isRequired,columns:p.default.array.isRequired},{Provider:l,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,u=void 0===i?"":i,l=n.comparator,s=void 0===l?a.LIKE:l,c=n.caseSensitive,p=u.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())})}},u=t.filterByNumber=function(e){return function(t,r,n,o){var i=n.filterVal,u=i.comparator,l=i.number;return t.filter(function(t){if(""===l||!u)return!0;var n=!0,i=e.get(t,r);switch(o&&(i=o(i,t)),u){case a.EQ:i!=l&&(n=!1);break;case a.GT:i<=l&&(n=!1);break;case a.GE:i<l&&(n=!1);break;case a.LT:i>=l&&(n=!1);break;case a.LE:i>l&&(n=!1);break;case a.NE:i==l&&(n=!1);break;default:console.error("Number comparator provided is not supported")}return n})}},l=t.filterByDate=function(e){return function(t,r,o,i){var u=o.filterVal,l=u.comparator,s=u.date;if(!s||!l)return t;var c=s.getDate(),p=s.getMonth(),f=s.getFullYear();return t.filter(function(t){var o=!0,u=e.get(t,r);i&&(u=i(u,t)),"object"!==(void 0===u?"undefined":n(u))&&(u=new Date(u));var d=u.getDate(),m=u.getMonth(),h=u.getFullYear();switch(l){case a.EQ:c===d&&p===m&&f===h||(o=!1);break;case a.GT:u<=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:u>=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 u=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!==u.indexOf(o):(o=o.toLocaleUpperCase(),u.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=u(e);break;case o.FILTER_TYPE.DATE:r=l(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 u=void 0,l=0;l<t.length;l+=1)if(t[l].dataField===e){u=t[l].filterValue;break}a=i(a,e,r,u)}),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),u=n(i),l=r(11),s=n(l),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:u.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 u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(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),l(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,l=(t.onFilter,t.caseSensitive,t.defaultValue,t.getFilter,n(t,["placeholder","column","style","className","onFilter","caseSensitive","defaultValue","getFilter"]));return c.default.createElement("input",u({},l,{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,u){u!==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,u,l){if(o(t),!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,a,i,u,l],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 u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(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 u(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:l(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"])),u="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:u,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 u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(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 u(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:l(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"])),u="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:u,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 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}}(),l=r(2),s=n(l),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),u(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,u=r.className,l=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 "+u,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:l,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:l,className:"number-filter-input form-control "+c,placeholder:d||"Enter "+o.text+"...",onChange:this.onChangeNumber,defaultValue:n?n.number:""}))}}]),t}(l.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 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}}(),l=r(2),s=function(e){return e&&e.__esModule?e:{default:e}}(l),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),u(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){e.dateFilterComparator.value=t.comparator,e.inputDate.value=i(t.date),e.applyFilter(t.date,t.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,u=function(){var n=""===e?null:new Date(e);a(o,d.FILTER_TYPE.DATE,r)({date:n,comparator:t})};i?this.timeout=setTimeout(function(){u()},i):u()}},{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,u=t.className,l=t.comparatorClassName,c=t.dateClassName,p=t.defaultValue;return s.default.createElement("div",{onClick:function(e){return e.stopPropagation()},className:"filter date-filter "+u,style:o},s.default.createElement("select",{ref:function(t){return e.dateFilterComparator=t},style:a,className:"date-filter-comparator form-control "+l,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}(l.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 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}}(),l=r(2),s=n(l),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(),l=function(l){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}return i(c,l),u(c,[{key:"componentDidMount",value:function(){t()&&Object.keys(this.currFilters).length>0&&r(this.currFilters)}},{key:"onFilter",value:function(n,o){var a=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(u){var l=Object.assign({},a.currFilters),s=n.dataField,c=n.filter;if(e.isDefined(u)&&""!==u&&0!==u.length){var p=c.props,f=p.comparator,h=void 0===f?o===m.FILTER_TYPE.SELECT?d.EQ:d.LIKE:f,y=p.caseSensitive,v=void 0!==y&&y;l[s]={filterVal:u,filterType:o,comparator:h,caseSensitive:v}}else delete l[s];if(a.currFilters=l,t())return void(i||r(a.currFilters));a.forceUpdate()}}},{key:"onExternalFilter",value:function(e,t){var r=this;return function(n){r.onFilter(e,t)(n)}}},{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(n.Provider,{value:{data:r,onFilter:this.onFilter,onExternalFilter:this.onExternalFilter}},this.props.children)}}]),c}(s.default.Component);return l.propTypes={data:p.default.array.isRequired,columns:p.default.array.isRequired},{Provider:l,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,u=void 0===i?"":i,l=n.comparator,s=void 0===l?a.LIKE:l,c=n.caseSensitive,p=u.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())})}},u=t.filterByNumber=function(e){return function(t,r,n,o){var i=n.filterVal,u=i.comparator,l=i.number;return t.filter(function(t){if(""===l||!u)return!0;var n=!0,i=e.get(t,r);switch(o&&(i=o(i,t)),u){case a.EQ:i!=l&&(n=!1);break;case a.GT:i<=l&&(n=!1);break;case a.GE:i<l&&(n=!1);break;case a.LT:i>=l&&(n=!1);break;case a.LE:i>l&&(n=!1);break;case a.NE:i==l&&(n=!1);break;default:console.error("Number comparator provided is not supported")}return n})}},l=t.filterByDate=function(e){return function(t,r,o,i){var u=o.filterVal,l=u.comparator,s=u.date;if(!s||!l)return t;var c=s.getDate(),p=s.getMonth(),f=s.getFullYear();return t.filter(function(t){var o=!0,u=e.get(t,r);i&&(u=i(u,t)),"object"!==(void 0===u?"undefined":n(u))&&(u=new Date(u));var d=u.getDate(),m=u.getMonth(),h=u.getFullYear();switch(l){case a.EQ:c===d&&p===m&&f===h||(o=!1);break;case a.GT:u<=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:u>=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 u=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!==u.indexOf(o):(o=o.toLocaleUpperCase(),u.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=u(e);break;case o.FILTER_TYPE.DATE:r=l(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 u=void 0,l=0;l<t.length;l+=1)if(t[l].dataField===e){u=t[l].filterValue;break}a=i(a,e,r,u)}),a}}}])}); |
@@ -39,3 +39,3 @@ 'use strict'; | ||
for (var i = 0; i < currOpts.length; i += 1) { | ||
if (currOpts[i].label !== prevOpts[i].label) { | ||
if (currOpts[i].value !== prevOpts[i].value || currOpts[i].label !== prevOpts[i].label) { | ||
return false; | ||
@@ -150,4 +150,4 @@ } | ||
'option', | ||
{ key: label, value: label }, | ||
value | ||
{ key: value, value: value }, | ||
label | ||
)); | ||
@@ -154,0 +154,0 @@ }); |
{ | ||
"name": "react-bootstrap-table2-filter", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "it's a column filter addon for react-bootstrap-table2", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -122,5 +122,5 @@ # react-bootstrap-table2-filter | ||
const selectOptions = [ | ||
{ label: 0, value: 'good' }, | ||
{ label: 1, value: 'Bad' }, | ||
{ label: 2, value: 'unknown' } | ||
{ value: 0, label: 'good' }, | ||
{ value: 1, label: 'Bad' }, | ||
{ value: 2, label: 'unknown' } | ||
]; | ||
@@ -131,3 +131,3 @@ const columns = [ | ||
text: 'Product Quailty', | ||
formatter: cell => selectOptions.find(opt => opt.label === cell).value, | ||
formatter: cell => selectOptions.find(opt => opt.value === cell).label, | ||
filter: selectFilter({ | ||
@@ -134,0 +134,0 @@ options: selectOptions |
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
299338