(this["webpackJsonpgonzo-test-client"]=this["webpackJsonpgonzo-test-client"]||[]).push([[54],{"1s2O":function(e,t,a){},"5umc":function(e,t,a){},"7EKC":function(e,t,a){"use strict";var n=a("J2iB"),s=a.n(n),r=a("q1tI"),i=a.n(r),o=a("17x9"),l=a.n(o),c=a("2dKy"),d=a("wd/R"),h=a.n(d),p=a("OwcS");class u extends r.Component{constructor(...e){super(...e),this.state={value:this.getInitialValue()},this.id=Object(p.a)(),this.container=i.a.createRef(),this.onKeyDown=e=>{const{type:t}=this.props;if("date"===t||"datetime-local"===t)if(["ArrowUp","ArrowDown"].includes(e.key)){let t=this.state.value?this.state.value.clone():h()();"ArrowUp"===e.key?t.add(1,"day"):"ArrowDown"===e.key&&t.subtract(1,"day"),this.setState({value:t}),e.stopPropagation(),e.preventDefault()}else this.props.onOverrideKeyDown(e);else this.props.onOverrideKeyDown(e);return!1},this.onChange=e=>{const{type:t,allowFloat:a}=this.props;if("date"===t||"datetime-local"===t){let t=h()(e);this.setState({value:t.isValid()?t:this.state.value})}else if("number"===t){let t=parseFloat(e);isNaN(t)?this.setState({value:null}):this.setState({value:a?t:Math.floor(t)})}else this.setState({value:e})}}componentDidMount(){setTimeout(()=>{try{this.container.current.querySelector(".fetura-input").querySelector("input").focus()}catch(e){console.error(e)}})}getInitialValue(){const{type:e,value:t}=this.props;if("date"===e||"datetime-local"===e){if(""===t)return null;if(void 0===t)return h()();if(t)return t instanceof h.a?t:h()()}if("number"===e){return new RegExp("^\\d+$").test(t)?+t:null}return t}getInputNode(){return null}getValue(){const{column:{key:e}}=this.props;return{[e]:this.state.value}}getInputValue(e){if(s()(e)||""===e)return null;const{type:t}=this.props;switch(t){case"date":return e.format(h.a.HTML5_FMT.DATE);case"datetime-local":return e.format(h.a.HTML5_FMT.DATETIME_LOCAL);default:return e}}isDisabled(){const{disabled:e}=this.props;return"function"===typeof e?e(this.props):e}render(){const{type:e,height:t,unit:a}=this.props,{value:n}=this.state;return i.a.createElement("div",{ref:this.container},i.a.createElement(c.a,{type:e,onKeyDown:this.onKeyDown,onChange:this.onChange,value:this.getInputValue(n),style:{height:t},disabled:this.isDisabled(),id:this.id,unit:a}))}}u.propTypes={type:l.a.string.isRequired,disabled:l.a.oneOfType([l.a.bool,l.a.func]),allowFloat:l.a.bool,unit:l.a.string},u.defaultProps={allowFloat:!0},t.a=u},"7KuR":function(e,t,a){},AAik:function(e,t,a){"use strict";var n=a("44Ds"),s=a.n(n),r=a("lSCD"),i=a.n(r),o=a("Y+p1"),l=a.n(o),c=a("mwIZ"),d=a.n(c),h=a("UfWW"),p=a.n(h),u=a("q1tI"),m=a.n(u),f=a("17x9"),g=a.n(f),b=a("IJf1"),y=(a("bThs"),a("uugb")),C=a("S8cm"),v=a("OwcS"),w=a("uSQv"),E=a("2dKy"),O=a("yLV6"),S=a.n(O),k=a("v9qu"),x=a("ZwF7"),R=a("2HEh"),N=a("wd/R"),j=a.n(N),F=a("E+oP"),D=a.n(F),I=a("PP4N"),T=a.n(I),P=a("D1y2"),q=a.n(P),A=a("sEfC"),M=a.n(A),W=a("/MKj"),V=(a("vLM9"),a("7KuR"),a("LCzB"));class L extends u.Component{constructor(...e){super(...e),this.onAndClick=()=>{const{value:e}=this.props;let t=e[Object.keys(e)].slice(0);t.push({}),this.props.onChangeFilters(t,this.props.path)},this.onOrClick=()=>{this.props.onOrClick(this.props.path)}}render(){const{children:e,t:t}=this.props;return m.a.createElement("div",{className:"filter-level"},m.a.createElement("div",{className:"filter-data"},e),m.a.createElement("div",{className:"filter-level-controls"},m.a.createElement(w.a,{onClick:this.onAndClick},t("filterGrid.and")),m.a.createElement(w.a,{onClick:this.onOrClick},t("filterGrid.or"))))}}L.propTypes={onTypeChange:g.a.func.isRequired,path:g.a.string.isRequired,onChangeFilters:g.a.func.isRequired,value:g.a.object.isRequired,onOrClick:g.a.func.isRequired};var B=Object(V.a)()(L),H=a("hw2D"),$=a("P5Co"),G=a("txkB"),K=a("n7pt");class U extends u.Component{constructor(...e){super(...e),this.state={headers:this.props.headers.filter(e=>e.filterType).map(e=>({name:e.name,value:e.filterColumn||e.field})),column:null,type:null,typeOptions:[],inputType:"text",inputValue:"",filterType:$.a.STRING,treeValues:K.a.getObjectForTreeSelect(this.props.farm)},this.onRemoveClick=()=>{const{index:e,path:t,onRemove:a}=this.props;a(t,e)},this.onColumnChange=e=>{const{path:t,index:a,onFilterChange:n,value:s}=this.props;let r=t+"[".concat(a,"]"),i=Object.keys(s),o=d()(s,i[0],null);delete s[i[0]],s[e]=o,n(s,r)},this.onTypeChange=e=>{const{path:t,index:a,value:n,onFilterChange:s}=this.props;let r=t+"[".concat(a,"]");n[Object.keys(n)[0]]={[e]:null},s(n,r)},this.onInputChange=e=>{const{inputType:t}=this.state,{path:a,index:n,value:s,onFilterChange:r}=this.props;let i=a+"[".concat(n,"]"),o=s[Object.keys(s)[0]];"number"===t&&(e=+e),o[Object.keys(o)[0]]=e,r(s,i)}}static getTypes(e,t){const{t:a}=t;switch(e){case $.a.DEV_ADDRESS:return[{name:a("equals"),value:"$devAdrEq"}];case $.a.NUMBER:return[{name:a("filterGrid.greaterThanOrEquals"),value:"$sanGte"},{name:a("filterGrid.lessThanOrEquals"),value:"$sanLte"},{name:a("equals"),value:"$sanEq"},{name:a("filterGrid.notEquals"),value:"$sanNe"}];case $.a.STRING:return[{name:a("contains"),value:"$includes"},{name:a("equals"),value:"$eq"},{name:a("filterGrid.startsWith"),value:"$startsWith"},{name:a("endWith"),value:"$endsWith"}];case $.a.DATE:return[{name:a("equals"),value:"$dateEq"},{name:a("filterGrid.greaterThanOrEquals"),value:"$dateGte"},{name:a("filterGrid.lessThanOrEquals"),value:"$dateLte"}];case $.a.LOCATION:return[{name:a("filterGrid.below"),value:"$locBelow"},{name:a("filterGrid.onlyLevel"),value:"$locLevel"}];default:return[]}}static getInputType(e){switch(e){case $.a.NUMBER:return"number";case $.a.DATE:return"date";default:return"text"}}static getDerivedStateFromProps(e,t){let a=Object.keys(e.value),n={column:a[0]||null,typeOptions:[],inputType:"text",inputValue:"",type:null,filterType:$.a.STRING};if(n.column){let t=e.headers.find(e=>(e.filterColumn||e.field)===n.column);n.typeOptions=U.getTypes(t.filterType,e),n.inputType=U.getInputType(t.filterType),n.filterType=t.filterType}if(e.value[a[0]]){let t=Object.keys(e.value[a[0]]);n.type=t[0],n.inputValue=e.value[a[0]][t[0]]}return console.log(n,e),n}render(){const{t:e}=this.props,{headers:t,column:a,type:n,typeOptions:s,inputType:r,inputValue:i,filterType:o,treeValues:l}=this.state;return m.a.createElement("div",{className:"filter-row"},m.a.createElement(H.a,{value:a,options:t,onChange:this.onColumnChange,placeholder:e("filterGrid.column")}),m.a.createElement(H.a,{value:n,options:s,onChange:this.onTypeChange,disabled:!a,placeholder:e("filterGrid.condition")}),o===$.a.LOCATION&&m.a.createElement(G.a,{options:l,value:i,onChange:this.onInputChange,disabled:!n,expanded:!0,placeholder:e("value")}),o!==$.a.LOCATION&&m.a.createElement(E.a,{type:r,disabled:!n,onChange:this.onInputChange,value:i,placeholder:e("value")}),m.a.createElement(w.a,{icon:m.a.createElement("i",{className:"fas fa-trash"}),onClick:this.onRemoveClick}))}}U.propTypes={index:g.a.number.isRequired,path:g.a.string.isRequired,onRemove:g.a.func.isRequired,headers:g.a.array.isRequired,value:g.a.object.isRequired,onFilterChange:g.a.func.isRequired,farm:g.a.string.isRequired};var _=Object(V.a)()(U);class Y extends u.Component{constructor(...e){super(...e),this.container=m.a.createRef(),this.line=m.a.createRef(),this.onAddOrClick=()=>{const{value:e,path:t,onFilterChange:a}=this.props;e.push({$and:[{}]}),a(e,t)}}componentDidMount(){this.getHeightOfLine()}componentDidUpdate(e,t,a){this.getHeightOfLine()}getOffsetTop(e){let t=0;for(;e!==this.container.current;)t+=e.offsetTop,e=e.offsetParent;return t}getHeightOfLine(){if(this.container.current){let e=this.container.current.querySelectorAll(":scope > .filter-level"),t=e[0],a=e[e.length-1],n=0;if(t.classList.contains("or")){let e=t.querySelector(":scope > .line");n=e.clientHeight/2+ +e.style.top.replace("px","")}else{n=t.querySelector(".filter-data").clientHeight/2}if(this.line.current.style.top="".concat(n,"px"),a.classList.contains("or")){let e=a.querySelector(":scope > .line > .line-label"),t=this.getOffsetTop(e);this.line.current.style.height="".concat(t-n,"px")}else{let e=a.querySelector(".filter-data"),t=this.getOffsetTop(e);this.line.current.style.height="".concat(t+e.clientHeight/2-n,"px")}}}render(){const{children:e,t:t}=this.props;return m.a.createElement("div",{className:"filter-level or",ref:this.container},e,m.a.createElement("div",{className:"line",ref:this.line},m.a.createElement("div",{className:"line-label"},t("filterGrid.or"))),m.a.createElement("div",{className:"filter-level-controls"},m.a.createElement(w.a,{onClick:this.onAddOrClick},"Lub")))}}Y.propTypes={value:g.a.array.isRequired,path:g.a.string.isRequired,onFilterChange:g.a.func.isRequired};var J=Object(V.a)()(Y),z=a("hot2");class Q extends u.Component{constructor(e){super(e),this.state={showFilter:!1,filter:{$and:[{}]},quickFilter:""},this.onFilterButtonClick=()=>{this.setState(e=>({showFilter:!e.showFilter,quickFilter:""})),""!==this.state.quickFilter&&this.props.onQuickFilterChange("")},this.onTypeChange=(e,t)=>{let{filter:a}=this.state,n=d()(a,t),s=t.split("."),r=s.slice(0,-1).join("."),i=s[s.length-1],o=d()(a,r,a);delete o[i],o[e]=n,r?q()(a,r,o):a=o,this.setState({filter:a})},this.onChangeFilters=(e,t)=>{let a=JSON.parse(JSON.stringify(this.state.filter));q()(a,t,e),this.setState({filter:a})},this.onRemove=(e,t)=>{let a=JSON.parse(JSON.stringify(this.state.filter)),n=d()(a,e,[]);if(n.splice(t,1),0===n.length){T()(a,e);let t=e.split(".").slice(0,-1).join(".");a=this.clearParent(a,t)}D()(a)&&(a={$and:[{}]}),this.setState({filter:a})},this.onOrClick=e=>{let{filter:t}=this.state,a=e.split(".").slice(0,-1).join("."),n={$or:[d()(t,a,t),{$and:[{}]}]};a?q()(t,a,n):t=n,this.setState({filter:t})},this.onApplyFilterClick=()=>{const{onFilterChange:e}=this.props;e(this.state.filter)},this.onQuickFilterChange=e=>{this.setState({quickFilter:e}),this.quickFilter(e)},this.onSaveToExcelClick=()=>{const{headers:e,data:t,excelFileName:a}=this.props;let n=z.a.formatData(e,t);new z.a(n,{headers:e}).save(a)},this.onClearClick=()=>{let e={$and:[{}]};this.setState({filter:e}),this.props.onFilterChange(e)},this.quickFilter=M()(this.props.onQuickFilterChange,300)}isNewGroup(e){return Object.keys(e).includes("$and")}clearParent(e,t){let a=d()(e,t,e),n=Object.keys(a);if(0===n.length)T()(e,t);else{let s=n[0];a[s]=a[s].filter(e=>e),1===a[s].length&&(t?q()(e,t,a[s][0]):e=a[s][0])}let s=t.split(".").slice(0,-1).join("");return t&&(e=this.clearParent(e,s)),e}renderFilters(e=this.state.filter,t=""){let a;for(let n in e){let s=e[n];t+=t?"."+n:n,a="$or"===n?m.a.createElement(J,{value:s,path:t,onFilterChange:this.onChangeFilters},s.map((e,a)=>this.renderFilters(e,t+"[".concat(a,"]")))):m.a.createElement(B,{value:{[n]:s},onChangeFilters:this.onChangeFilters,path:t,onTypeChange:this.onTypeChange,onOrClick:this.onOrClick},s.map((e,a)=>this.isNewGroup(e)?this.renderFilters(e,t+"[".concat(a,"]")):m.a.createElement(_,{index:a,path:t,onRemove:this.onRemove,headers:this.props.headers,value:e,onFilterChange:this.onChangeFilters,farm:this.props.farm})))}return a}render(){if(!this.props.showFilter)return null;const{showFilter:e,quickFilter:t}=this.state,{t:a,saveToExcel:n}=this.props;return m.a.createElement("div",{className:"table-grid-filter"},m.a.createElement("div",{className:"table-grid-filter-buttons"},m.a.createElement("div",{className:"table-grid-filter-buttons-main"},m.a.createElement(w.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-filter"}),onClick:this.onFilterButtonClick}),m.a.createElement(E.a,{type:"text",placeholder:a("filterGrid.filter"),onChange:this.onQuickFilterChange,value:t,disabled:e})),n&&m.a.createElement(w.a,{buttonStyle:"round",buttonColor:"success",icon:m.a.createElement("i",{className:"fas fa-file-excel"}),onClick:this.onSaveToExcelClick})),e&&m.a.createElement("div",{className:"table-grid-filter-advanced"},this.renderFilters(),m.a.createElement("div",{className:"table-grid-filter-advanced-apply"},m.a.createElement(w.a,{icon:m.a.createElement("i",{className:"fas fa-eraser"}),onClick:this.onClearClick},a("clear")),m.a.createElement(w.a,{buttonColor:"success",icon:m.a.createElement("i",{className:"fas fa-check"}),onClick:this.onApplyFilterClick},a("filterGrid.filter")))))}}Q.propTypes={onFilterChange:g.a.func.isRequired,onQuickFilterChange:g.a.func.isRequired},Q=Object(W.connect)((function(e){return{farm:e.location.farm}}))(Q);var Z=Object(V.a)()(Q),X=a("xpEm"),ee=a("1tfL"),te=a("i8MS"),ae=a("I8zd"),ne=a("XzT5"),se=a("0MVo");function re(){return(re=Object.assign||function(e){for(var t=1;t{const{cookies:e,name:t,paginationItems:a,data:n}=this.props;let s={sortColumn:"",sortType:"off",page:0,paginationItems:a||n.length,filters:[]};if(t){let a=e.get(t);try{return oe({},s,{},a)}catch(r){return s}}return s},this.swipePage=e=>{try{clearTimeout(this.timer),this.timer=setTimeout(()=>{this.onPageChange(Math.max(Math.min(this.state.page+e,this.state.maxPage),0))},250)}catch(t){console.error(t)}},this.onSelectAll=e=>{const{data:t}=this.state;let a=[];if(e)for(let n of t){let e=p()(this.props.data,n);a.push(e)}this.setState({selectedRows:a}),this.changeIndexesToData(a)},this.onRowClick=e=>{const{singleRowSelect:t,onRowClick:a,data:n}=this.props;let s=p()(n,e);a&&a(e,s);let{selectedRows:r}=this.state;t?r=[s]:r.includes(s)?r=r.filter(e=>e!==s):r.push(s),this.setState({selectedRows:r}),this.changeIndexesToData(r)},this.onFilterChange=e=>{console.log(e);let t=this.state.toFilter.filter(Object(X.a)(e,{operations:{$devAdrEq:(e,t,a)=>Object(ee.d)(t=>(e.toString().startsWith("0x")?e:"0x".concat(parseInt(e).toString(16)))===t,t,a),$sanGte:(e,t,a)=>(console.log(e,t,a),Object(ee.d)(t=>(console.log(t),console.log(+(t+"").replace(/[^0-9.]/g,"")),+(t+"").replace(/[^0-9.]/g,"")>=e),t,a)),$sanLte:(e,t,a)=>Object(ee.d)(t=>+(t+"").replace(/[^0-9.]/g,"")<=e,t,a),$sanEq:(e,t,a)=>(console.log(e,t,a),Object(ee.d)(t=>+(t+"").replace(/[^0-9.]/g,"")===e,t,a)),$sanNe:(e,t,a)=>Object(ee.d)(t=>+(t+"").replace(/[^0-9.]/g,"")!==e,t,a),$includes:(e,t,a)=>Object(ee.d)(t=>!!t&&t.toString().toUpperCase().includes(e.toString().toUpperCase()),t,a),$startsWith:(e,t,a)=>Object(ee.d)(t=>!!t&&t.toString().toUpperCase().startsWith(e.toString().toUpperCase()),t,a),$endsWith:(e,t,a)=>Object(ee.d)(t=>!!t&&t.toString().toUpperCase().endsWith(e.toString().toUpperCase()),t,a),$dateGte:(e,t,a)=>Object(ee.d)(t=>{let a=j()(t);return a.startOf("day"),a.toDate().getTime()>=j()(e).toDate().getTime()},t,a),$dateLte:(e,t,a)=>Object(ee.d)(t=>{let a=j()(t);return a.startOf("day"),a.toDate().getTime()<=j()(e).toDate().getTime()},t,a),$dateEq:(e,t,a)=>Object(ee.d)(t=>{let a=j()(t);return a.startOf("day"),a.format("DD.MM.YYYY")===j()(e).format("DD.MM.YYYY")},t,a),$locLevel:(e,t,a)=>Object(ee.d)(t=>{if(t&&e){return(Array.isArray(t)?t:[t]).includes(e.object[e.key])}return!1},t,a),$locBelow:(e,t,a)=>Object(ee.d)(t=>{if(t&&e){let a=Array.isArray(t)?t:[t],n="BgID"===e.key?ae.a.BUILDING:"SID"===e.key?ae.a.SECTOR:"CID"===e.key?ae.a.CHAMBER:ae.a.BOX,s=te.a.scanLocalizationIds(e.object,n);for(let e of s)if(a.includes(e))return!0}return!1},t,a)}})),a=Math.ceil(t.length/this.state.paginationItems)-1,n=t.map(e=>e._row);this.setState({data:n,paginatedData:this.paginateItems(n),selectedRows:[],maxPage:a,page:0},()=>{this.changeIndexesToData([]),this.onSortChange()})},this.onPaginationAmountChange=e=>{let t=Math.ceil(this.state.data.length/e)-1,a=this.state.page>t?t:this.state.page;this.setState({paginationItems:+e,maxPage:t,page:a},()=>{const{name:t,cookies:n}=this.props;if(t){let s=oe({},this.getCookie(),{page:a,paginationItems:+e});n.set(t,s,{path:"/",expires:j()().add(1,"year").toDate()})}this.setState({paginatedData:this.paginateItems(this.state.data)})})},this.onPageChange=e=>{this.setState({page:e},()=>{this.setState({paginatedData:this.paginateItems(this.state.data)},()=>{const{name:t,cookies:a,scrollOnPageChange:n}=this.props;if(t){let n=oe({},this.getCookie(),{page:e});a.set(t,n,{path:"/",expires:j()().add(1,"year").toDate()})}this.onSortChange(),n&&this.ref.scrollIntoView({behavior:"smooth"})})})},this.sortValues=(e,t,a={})=>{const{sortType:n}=this.state,s=e=>{const t=a.field?d()(e,a.field):e;return a.valueFormatter&&!a.disableValueFormatterSort?a.valueFormatter(t)+"":t};return Object(se.b)(s(e),s(t),{numeric:!0,ascending:"desc"!==n,nonValuesAtEnd:!1})},this.onSortChange=()=>{const{sortColumn:e,sortType:t,data:a,headers:n}=this.state,{fullWidthRowGroups:s}=this.props;let r=[],i=n.find(t=>t.name===e),o=a.slice(0),l=this.groupByFullWidthRows(o);for(let c of l){switch(t){case"asc":c.sort((e,a)=>i&&i.customSort?i.customSort(e,a,i,t,d()(e,i.field),d()(a,i.field)):this.sortValues(e,a,i));break;case"desc":c.sort((e,a)=>i&&i.customSort?i.customSort(a,e,i,t,d()(a,i.field),d()(e,i.field)):this.sortValues(e,a,i)),s&&(c.unshift(c[c.length-1]),c=c.slice(0,c.length-1))}r=[...r,...c]}this.setState({paginatedData:this.paginateItems(r)})},this.onHeaderClick=e=>{const{cookies:t,name:a}=this.props;let{sortType:n,sortColumn:s}=this.state;if(s===e.name)switch(n){case"off":n="asc";break;case"asc":n="desc";break;default:n="off"}else n="asc";this.setState({sortColumn:e.name,sortType:n},()=>{if(a){let s=oe({},this.getCookie(),{sortColumn:e.name,sortType:n});t.set(a,s,{path:"/",expires:j()().add(1,"year").toDate()})}this.onSortChange()})},this.onSelectMobileNode=e=>{this.setState({show:!0,expandedMobileNode:e})},this.onHide=()=>{this.setState({show:!1},()=>{setTimeout(()=>{this.setState({expandedMobileNode:null})},300)})},this.onQuickFilterChange=e=>{const{toFilter:t}=this.state;let a=t.filter(t=>t._search.includes(e.toLowerCase())),n=Math.ceil(a.length/this.state.paginationItems)-1,s=a.map(e=>e._row);this.setState({data:s,paginatedData:this.paginateItems(s),selectedRows:[],maxPage:n,page:0},()=>{this.changeIndexesToData([]),this.onSortChange()})};let t=this.getCookie(),a=Math.ceil(e.data.length/t.paginationItems-1)<0?0:Math.ceil(e.data.length/t.paginationItems-1),n=ce.getFilteredHeaders(this.props.headers);this.state={selectedRows:[],filterHeaders:e.headers.map(e=>e.filterType?e:void 0).filter(e=>e),data:e.data.slice(0),paginatedData:e.data.slice(t.page,t.paginationItems),paginationItems:t.paginationItems,page:t.page>a?0:t.page,maxPage:a,sortColumn:t.sortColumn||this.props.initialSortColumn,sortType:this.props.initialSortColumn?"asc":t.sortType?t.sortType:"off",expandedMobileNode:null,show:!1,toFilter:this.createToFilterArray(e.data,n),headers:n}}static getFilteredHeaders(e){return e.map(e=>{let t=!0;const a=oe({},e,{valueFormatter:e.valueFormatter?s()(e.valueFormatter,(...e)=>JSON.stringify(e)):void 0});if(e.hasOwnProperty("shouldShow")&&(t=e.shouldShow()),t)return a}).filter(e=>e)}componentDidMount(){try{this.props.showPagination&&this.props.swipePagination&&(this.hammer=new S.a(this.ref),this.hammer.on("swiperight",()=>this.swipePage(-1)),this.hammer.on("swipeleft",()=>this.swipePage(1)))}catch(e){console.error(e)}this.onSortChange()}createToFilterArray(e,t){return e.map(e=>{let a={_row:e},n={};for(let r of t){let t=r.filterColumn||r.field;if(r.valueFormatter){try{n[t]=r.valueFormatter(d()(e,r.field||r.filterColumn,e))}catch(s){n[t]=e[t]}r.disableValueFormatterFilter?a[t]=e[t]:a[t]=n[t]}else a[t]=e[t],n[t]=e[t]}return a._search=JSON.stringify(n).toLowerCase(),a})}componentWillUnmount(){for(let t of this.state.headers)t.valueFormatter&&t.valueFormatter.cache.clear();clearTimeout(this.timer);try{this.hammer&&this.hammer.destroy()}catch(e){console.error(e)}}UNSAFE_componentWillReceiveProps(e,t){if(l()(this.props.headers,e.headers)||this.setState({headers:ce.getFilteredHeaders(e.headers)}),!l()(this.props.data,e.data)){let t={data:e.data.slice(0),page:this.props.data.length!==e.data.length?0:this.state.page,paginationItems:e.showPagination?this.state.paginationItems:e.data.length,maxPage:Math.ceil(e.data.length/this.state.paginationItems-1)<0?0:Math.ceil(e.data.length/this.state.paginationItems-1),toFilter:this.createToFilterArray(e.data,this.state.headers)};this.props.clearSelectOnNewData&&(t.selectedRows=[]),this.setState(e=>t,()=>{this.setState({paginatedData:this.paginateItems(e.data)},()=>{this.onSortChange()}),this.props.clearSelectOnNewData&&this.props.onSelectedRowsChanged([])})}if(!l()(this.props.selectedRows,e.selectedRows)){let t=e.selectedRows.map(t=>e.data.indexOf(t));l()(this.state.selectedRows,t)||this.setState({selectedRows:t})}}changeIndexesToData(e){const{data:t}=this.props;let a=e.map(e=>t[e]);this.props.onSelectedRowsChanged(a)}paginateItems(e){const{page:t,paginationItems:a}=this.state;return e.slice(t*a,t*a+a)}groupByFullWidthRows(e){const{isFullWidthRow:t,fullWidthRowGroups:a}=this.props;if(a){let a=[],n=[a];for(let s of e){t(s)?(a=[s],n.push(a)):a.push(s)}return n.filter(e=>e.length>0)}return[e]}createPinnedRows(e){const{shouldIndex:t,selectableRow:a}=this.props,{headers:n}=this.state;return e.map((e,s)=>m.a.isValidElement(e)?m.a.createElement("div",{className:"pinned-row"},e):m.a.createElement(y.a,{object:e,headers:n,key:s,isPinned:!0,isSelectable:a,shouldIndex:t}))}getMobileInfoName(){const{mobileAdditionalInfoName:e}=this.props,{expandedMobileNode:t}=this.state;return"function"===typeof e?e(t):e}checkIfSelected(e){const{selectedRows:t,paginatedData:a}=this.state,{data:n}=this.props;let s=a[e],r=p()(n,s);return t.includes(r)}getBeforeFullWidthAmount(e){const{isFullWidthRow:t}=this.props;if(t){const{data:a}=this.state;let n=0;for(let s=0;se).join(" ");return m.a.createElement(m.a.Fragment,null,m.a.createElement(Z,re({},this.props,{filterHeaders:V,onFilterChange:this.onFilterChange,onQuickFilterChange:this.onQuickFilterChange})),e&&m.a.createElement("h4",null,e),m.a.createElement("div",{className:$,ref:e=>this.ref=e},!(B&&f)&&m.a.createElement("div",{className:"header-container"},a&&!u&&m.a.createElement("div",{className:"header-item selected-header"},m.a.createElement(C.a,{label:"",id:Object(v.a)(),onChange:this.onSelectAll,checked:j.length===P.length})),t&&m.a.createElement("div",{className:"header-item index"},"#"),L.map((e,t)=>m.a.createElement(b.a,{key:t,header:e,isSortable:d,onSortChange:this.onHeaderClick,sortColumn:q,sortType:A}))),!!o&&m.a.createElement("div",{className:"top-pinned-container"},i()(o)?this.createPinnedRows(o(I,F,P)):this.createPinnedRows(o)),m.a.createElement("div",{className:"body-container"},I.map((e,n)=>{let s=l&&l(e);return Object(k.a)()&&f?s&&c?m.a.cloneElement(c,{object:e},c.props.children):m.a.cloneElement(f,oe({},f.props,{object:e,headers:L,paginationItems:F,page:D,key:D*F+n,index:D*F+n+1,onClick:this.onSelectMobileNode,onSelect:this.onRowClick,selected:this.checkIfSelected(n),className:O,singleRowSelect:u,isSelectable:a})):m.a.createElement(y.a,{headers:L,object:e,key:D*F+n,index:D*F+n+1,singleRowSelect:u,shouldIndex:t,isSelectable:a,selected:this.checkIfSelected(n),mobile:B,onClick:this.onRowClick,page:D,paginationItems:F,isFullWidthRow:l,fullWidthRow:c,isClickable:a||!!h,className:O,fullWidthBefore:this.getBeforeFullWidthAmount(D*F+n),isExpanded:S,component:R})}),0===I.length&&m.a.createElement("div",{className:"empty-list"},m.a.createElement("i",null,p("tableGrid.noData")))),!!r&&m.a.createElement("div",{className:"bottom-pinned-container"},i()(r)?this.createPinnedRows(r(I,F,P)):this.createPinnedRows(r)),n&&!N&&m.a.createElement("div",{className:"pagination"},m.a.createElement("div",{className:"items-amount"},ne.a.t("tableGrid.displaying",{type1:I.length,type2:P.length})),m.a.createElement("div",{className:"pagination-buttons"},m.a.createElement(w.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-step-backward"}),onClick:()=>this.onPageChange(0)}),m.a.createElement(w.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-backward"}),onClick:()=>this.onPageChange(D-1),disabled:0===D}),m.a.createElement("span",null,D+1,"/",T+1),m.a.createElement(w.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-forward"}),onClick:()=>this.onPageChange(D+1),disabled:D===T}),m.a.createElement(w.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-step-forward"}),onClick:()=>this.onPageChange(T)}),m.a.createElement(E.a,{type:"number",value:F,onChange:this.onPaginationAmountChange}))),n&&N&&m.a.createElement("div",{className:"pagination small-pagination"},m.a.createElement(w.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-backward"}),onClick:()=>this.onPageChange(D-1),disabled:0===D}),m.a.createElement(w.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-forward"}),onClick:()=>this.onPageChange(D+1),disabled:D===T}))),Object(k.a)()&&g&&m.a.createElement(x.a,{show:M,name:this.getMobileInfoName(),onHide:this.onHide},m.a.cloneElement(g,oe({},g.props,{object:W}))))}}ce.propTypes={headers:g.a.arrayOf(g.a.shape({name:g.a.node.isRequired,field:g.a.string,valueFormatter:g.a.func,component:g.a.oneOfType([g.a.func,g.a.element]),headerComponent:g.a.element,customSort:g.a.func,disableValueFormatterSort:g.a.bool,disableValueFormatterFilter:g.a.bool,notSortable:g.a.bool,_floating:g.a.bool,_hideMobile:g.a.bool,_mobileDate:g.a.bool,_mobileHeader:g.a.bool})).isRequired,data:g.a.array.isRequired,shouldIndex:g.a.bool,onSelectedRowsChanged:g.a.func,selectableRow:g.a.bool,showFilter:g.a.bool,showPagination:g.a.bool,swipePagination:g.a.bool,paginationItems:g.a.number,className:g.a.string,bottomPinnedRows:g.a.oneOfType([g.a.array,g.a.func]),topPinnedRows:g.a.oneOfType([g.a.array,g.a.func]),isFullWidthRow:g.a.func,fullWidthRow:g.a.node,isSortable:g.a.bool,saveToExcel:g.a.bool,excelFileName:g.a.string,onRowClick:g.a.func,singleRowSelect:g.a.bool,title:g.a.string,clearSelectOnNewData:g.a.bool,mobileRow:g.a.node,mobileAdditionalInfo:g.a.node,mobileAdditionalInfoName:g.a.oneOfType([g.a.string,g.a.func]),selectedRows:g.a.array,rowClassName:g.a.oneOfType([g.a.string,g.a.func]),name:g.a.string,fullWidthRowGroups:g.a.bool,isExpanded:g.a.bool,contentValue:g.a.node,component:g.a.node,scrollOnPageChange:g.a.bool,initialSortColumn:g.a.string,smallPagination:g.a.bool},ce.defaultProps={shouldIndex:!1,onSelectedRowsChanged:()=>{},selectableRow:!1,className:"",excelFileName:"noName",singleRowSelect:!1,swipePagination:!1,title:"",clearSelectOnNewData:!0,isSortable:!0,isExpanded:!1,scrollOnPageChange:!0,initialSortColumn:null},ce=Object(R.a)(ce),ce=Object(V.a)()(ce);t.a=ce},AZuN:function(e,t,a){},"B/gD":function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a("q1tI"),s=a.n(n),r=a("17x9"),i=a.n(r),o=a("OwcS");a("YKSY");class l extends s.a.Component{constructor(...e){super(...e),this.onChange=e=>{this.props.onChange(!!e.target.checked,e)},this.onDivClick=e=>{this.props.disabled||this.props.onDivClick&&this.props.onDivClick(e)}}render(){const{label:e,id:t,disabled:a,value:n,reverseOrder:r,additionalClass:i,title:o}=this.props;return s.a.createElement("div",{title:o,className:"fetura-switch ".concat(i),onClick:this.onDivClick},s.a.createElement("input",{disabled:a,checked:n,type:"checkbox",id:t,onChange:this.onChange}),s.a.createElement("label",{className:r?"reverse":void 0,htmlFor:t},s.a.createElement("span",{className:"switch"}),s.a.createElement("span",{className:"no-break-word"},e)))}}l.propTypes={label:i.a.string.isRequired,additionalClass:i.a.string,onChange:i.a.func,value:i.a.bool,id:i.a.string,disabled:i.a.bool,onDivClick:i.a.func,reverseOrder:i.a.bool},l.defaultProps={onChange:e=>{},id:Object(o.a)(),disabled:!1,reverseOrder:!1}},BbMY:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a("q1tI"),s=a.n(n),r=(a("N7W8"),a("17x9")),i=a.n(r),o=a("v9qu"),l=(a("n7vY"),a("TAe8"));class c extends s.a.Component{render(){const{children:e,activeStep:t}=this.props,a=Math.max(t,1)-1,n=a?e[a-1]:null,r=e[a],i=a+1=100?"success":"info",text:"".concat(t,"/").concat(e.length),percentage:o})))}}function d(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function h(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}c.propTypes={activeStep:i.a.number,onClickStep:i.a.func},c.defaultProps={onClickStep:()=>{}};class p extends s.a.Component{constructor(...e){super(...e),this.onClickStep=e=>{this.props.onClickStep(e)}}getChildren(){let e,t=[];e=Array.isArray(this.props.children)?this.props.children:[this.props.children];for(let a of e)a&&(Array.isArray(a)?t=[...t,...a]:a.props.children?t=[...t,...a.props.children]:t.push(a));return t.filter(Boolean)}render(){const{activeStep:e}=this.props,t=Object(o.a)();let a=this.getChildren();return s.a.createElement(t?c:"div",{children:a.map((n,r)=>s.a.cloneElement(n,function(e){for(var t=1;tr+1},n.props,{onClick:this.onClickStep}))),className:"stepper",activeStep:e})}}p.propTypes={activeStep:i.a.number,onClickStep:i.a.func},p.defaultProps={onClickStep:()=>{}}},IJf1:function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a("Y+p1"),s=a.n(n),r=a("q1tI"),i=a.n(r),o=a("17x9"),l=a.n(o),c=a("tgc7");class d extends i.a.Component{constructor(e){super(e),this.onClick=()=>{const{onSortChange:e,header:t,isSortable:a}=this.props;a&&!t.notSortable&&e(t)},this.state={show:this.props.show}}shouldComponentUpdate(e,t){return!s()(this.props,e)||!s()(this.state,t)}getClassName(){let e="header-item",{header:{headerClassName:t,colWidth:a,disabledSort:n,notSortable:s},isSortable:r}=this.props;return r&&!s&&(e+=" sortable"),n&&(e+=" disabled-sort"),t&&(e+=" "+t),a&&(e+=" col-width-".concat(a)),e}render(){const{header:{name:e,headerComponent:t,disabledSort:a,multiValues:n,animals:s,field:r,unit:o,type:l},isSortable:d,sortColumn:h,sortType:p,show:u}=this.props;return i.a.createElement("div",{className:this.getClassName(),onClick:a?null:this.onClick},t&&i.a.cloneElement(t,{name:e},t.props.children),!t&&i.a.createElement("div",{className:"multiValues"},e,u&&i.a.createElement("div",null,i.a.createElement("br",null),n&&i.a.createElement(c.a,{field:r,unit:o,type:l,animals:s}))),d&&h===e&&"off"!==p&&i.a.createElement("div",{className:"header-sorting-icon"},"asc"===p&&i.a.createElement("i",{className:"fas fa-sort-amount-up"}),"desc"===p&&i.a.createElement("i",{className:"fas fa-sort-amount-down"})))}}d.propTypes={header:l.a.shape({name:l.a.node.isRequired,field:l.a.string,valueFormatter:l.a.func,component:l.a.oneOfType([l.a.func,l.a.element]),headerComponent:l.a.element,headerClassName:l.a.string,notSortable:l.a.bool}).isRequired,isSortable:l.a.bool,onSortChange:l.a.func,sortColumn:l.a.string,sortType:l.a.string},d.defaultProps={isSortable:!1,onHeaderClick:()=>{}}},K0y0:function(e,t,a){},N7W8:function(e,t,a){},Ry3h:function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a("q1tI"),s=a.n(n),r=a("17x9"),i=a.n(r);a("K0y0");function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class c extends s.a.Component{render(){const{children:e,isActive:t}=this.props;return s.a.createElement("div",{className:"tab",style:t?{}:{display:"none"}},s.a.cloneElement(e,function(e){for(var t=1;t{this.setState({value:e})}}getInputNode(){return null}getValue(){const{value:e}=this.state,{column:{key:t}}=this.props;return{[t]:e}}render(){const{buildings:e,value:t}=this.state;return s.a.createElement(r.a,{options:e,onChange:this.onChange,value:t})}}c.propTypes={farm:l.a.string.isRequired,showStands:l.a.bool},c.defaultProps={showStands:!0},t.a=c},XM6k:function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a("q1tI"),s=a.n(n),r=a("17x9"),i=a.n(r),o=a("OwcS"),l=a("B/gD");class c extends s.a.Component{constructor(...e){super(...e),this.onChange=()=>{this.props.input.onChange(!!event.target.checked)}}render(){const{label:e,id:t,input:{value:a},disabled:n,reverseOrder:r}=this.props;return s.a.createElement(l.a,{reverseOrder:r,id:t,label:e,value:!!a,onChange:this.onChange,disabled:n})}}c.propTypes={label:i.a.string.isRequired,id:i.a.string,disabled:i.a.bool,reverseOrder:i.a.bool},c.defaultProps={id:Object(o.a)(),reverse:!1}},YKSY:function(e,t,a){},"a+pQ":function(e,t,a){"use strict";var n=a("lSCD"),s=a.n(n),r=a("q1tI"),i=a.n(r),o=a("17x9"),l=a.n(o),c=a("IJf1"),d=a("mwIZ"),h=a.n(d),p=a("d/v1"),u=a("OwcS");function m(){return(m=Object.assign||function(e){for(var t=1;t!this.checkForFunc(a)&&t(this.props)})}}g.propTypes={className:l.a.string.isRequired,onClick:l.a.func.isRequired,disabled:l.a.bool},g.defaultProps={onClick:()=>{}};var b=a("/MKj");class y extends i.a.Component{constructor(...e){super(...e),this.onClick=()=>{const{fields:e,minLength:t,index:a}=this.props;e.length>t&&e.remove(a)}}render(){const{headers:e,field:t,data:a,shouldIndex:n,index:s,addRemoveButton:r,fields:o}=this.props;return i.a.createElement("div",{className:"table-row"},n&&i.a.createElement("div",{className:"table-item index"},s+1),e.map((e,n)=>i.a.createElement(f,{header:e,key:n,field:t,value:h()(a,e.field),fields:o,index:s})),r&&i.a.createElement("div",{className:"table-item index"},i.a.createElement(g,{className:"fas fa-trash",onClick:this.onClick})))}}(y=Object(b.connect)(e=>({form:e.form}))(y)).propTypes={field:l.a.string.isRequired,index:l.a.number.isRequired,headers:l.a.array.isRequired,data:l.a.object.isRequired,shouldIndex:l.a.bool,addRemoveButton:l.a.bool,minLength:l.a.number.isRequired};var C=a("uSQv"),v=(a("bThs"),a("vzZS")),w=a("uugb"),E=a("LCzB");class O extends i.a.Component{constructor(e){super(e),this._onClick=()=>{const{moreOptions:e}=this.state;this.setState({moreOptions:!e})},this.state={moreOptions:!1}}createPinnedRows(e=[]){const{headers:t,shouldIndex:a,selectableRow:n}=this.props;return e.map((e,s)=>i.a.isValidElement(e)?i.a.createElement("div",{className:"pinned-row"},e):i.a.createElement(w.a,{object:e,headers:t,key:s,isPinned:!0,isSelectable:n,shouldIndex:a}))}render(){const{topPinnedRows:e,bottomPinnedRows:t,addDefaultValue:a,headers:n,shouldIndex:r,fields:o,addRemoveButton:l,addAddButton:d,minLength:h,meta:{error:p,submitFailed:u},t:m,moreOptionsButton:f}=this.props,{moreOptions:g}=this.state;return i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{className:"fetura-grid redux"},f&&i.a.createElement(C.a,{className:"more-options",type:"button",onClick:this._onClick},m(g?"close":"reduxTableGrid.moreOptions")),i.a.createElement("div",{className:"header-container"},r&&i.a.createElement("div",{className:"header-item index"},"#"),n.map((e,t)=>i.a.createElement(c.a,{key:t,show:g,header:e})),l&&i.a.createElement("div",{className:"header-item index"})),!!e&&i.a.createElement("div",{className:"top-pinned-container"},s()(e)?this.createPinnedRows(e(o)):this.createPinnedRows(e)),i.a.createElement("div",{className:"body-container"},o.map((e,t)=>i.a.createElement(y,{field:e,headers:n,index:t,key:t,data:o.get(t),shouldIndex:r,addRemoveButton:l,fields:o,minLength:h})),0===o.length&&i.a.createElement("div",{className:"empty-list"},i.a.createElement("i",null,m("reduxTableGrid.noData")))),!!t&&i.a.createElement("div",{className:"bottom-pinned-container"},s()(t)?this.createPinnedRows(t(o)):this.createPinnedRows(t))),d&&i.a.createElement(C.a,{type:"button",onClick:()=>o.push(a)},this.props.t("reduxTableGrid.addRow")),p&&u&&i.a.createElement(v.a,{boxColor:"error"},p))}}O.propTypes={headers:l.a.array.isRequired,shouldIndex:l.a.bool,addRemoveButton:l.a.bool,addAddButton:l.a.bool,minLength:l.a.number,addDefaultValue:l.a.object},O.defaultProps={minLength:1,addDefaultValue:{}},O=Object(E.a)()(O);t.a=O},bHJJ:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("17x9"),i=a.n(r),o=a("hw2D");class l extends n.Component{constructor(...e){super(...e),this.state={value:this.getInitialValue()},this.onChange=e=>{const{onCommit:t}=this.props;this.setState({value:e},()=>{t()})},this.onKeyDown=e=>{["ArrowUp","ArrowDown"].includes(e.key)?e.stopPropagation():this.props.onOverrideKeyDown(e)}}getInitialValue(){const{value:e}=this.props;return""===e?null:e}getInputNode(){return null}getValue(){const{column:{key:e}}=this.props;return{[e]:this.state.value}}render(){const{value:e,options:t,ref:a}=this.props;return s.a.createElement("div",{onKeyDown:this.onKeyDown},s.a.createElement(o.a,{value:e,options:t,ref:a,onChange:this.onChange,autofocus:!0,insertFirstOnNoSelected:!1}))}}l.propTypes={options:i.a.arrayOf(i.a.shape({})).isRequired},t.a=l},bThs:function(e,t,a){},c8gq:function(e,t,a){},erjJ:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a("q1tI"),s=a.n(n),r=a("17x9"),i=a.n(r);a("1s2O");class o extends s.a.Component{constructor(...e){super(...e),this.getClassName=()=>{const{isActive:e,isFinished:t,mobile:a,disabled:n}=this.props;let s=a?"step-mobile":"step";return e&&(s+=" active"),t&&(s+=" active finished"),n&&(s+=" disabled"),s},this.onClick=()=>{const{isFinished:e,index:t}=this.props;e&&this.props.onClick(t)}}render(){const{isFinished:e,index:t,label:a,showLine:n,mobile:r,disabled:i}=this.props;return s.a.createElement("div",{className:this.getClassName(),onClick:this.onClick},s.a.createElement("div",{className:"step-circle"},e&&s.a.createElement("i",{className:"fas fa-check"}),!e&&t),s.a.createElement("div",{className:"step-label"},a),n&&!r&&s.a.createElement("span",{className:"step-line"}),i&&s.a.createElement("i",{className:"fas fa-times"}))}}o.propTypes={label:i.a.node.isRequired,index:i.a.number,isActive:i.a.bool,isFinished:i.a.bool,showLine:i.a.bool,onClick:i.a.func,disabled:i.a.bool},o.defaultProps={onClick:()=>{}}},gfib:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a("q1tI"),s=a.n(n),r=a("17x9"),i=a.n(r);a("K0y0");class o extends s.a.Component{constructor(...e){super(...e),this.onChangeIndex=e=>{this.props.onSlide(e)}}getChildren(){const{children:e}=this.props;return Array.isArray(e)?e:[e]}render(){const{activeKey:e}=this.props;let t=this.getChildren();return s.a.createElement("div",{className:"fetura-tabs"},t.filter(e=>e).map((t,a)=>e===a?s.a.cloneElement(t,{isActive:e===a,key:a}):s.a.createElement("div",{key:a})))}}o.propTypes={activeKey:i.a.node.isRequired,onSlide:i.a.func.isRequired}},n7vY:function(e,t,a){},phKq:function(e,t,a){},sJUw:function(e,t,a){"use strict";var n=a("sEfC"),s=a.n(n),r=a("Y+p1"),i=a.n(r),o=a("E+oP"),l=a.n(o),c=a("q1tI"),d=a.n(c),h=a("CRfi"),p=a("veAh"),u=a("17x9"),m=a.n(u),f=(a("7FTq"),a("c7k8")),g=(a("tDIT"),a("uvcQ"),a("CuyV")),b=a("KYPV");class y extends c.Component{getText(){const{formatter:e,formatterProps:t}=this.props;if(e)return e(t);const{row:a,column:{key:n}}=t;let s=a[n];return s instanceof Object?null:s}getError(){const{formatterProps:{column:{key:e},rowIdx:t},errors:a}=this.props;return Object(b.b)(a,"[".concat(t,"].").concat(e))}getClassName(){const{formatterProps:{column:{editable:e},row:t}}=this.props;let a="fetura-rdg-custom-cell";return void 0!==e&&("function"===typeof e&&e(t)||"boolean"===typeof e&&e)&&(a+=" editable"),this.getError()&&(a+=" error"),a}render(){let e=this.getError();return d.a.createElement("div",{className:this.getClassName()},this.getText(),e&&d.a.createElement(g.a,{tooltipContent:e,type:"error"},d.a.createElement("i",{className:"fas fa-exclamation-circle"})))}}y.propTypes={formatter:m.a.func};var C=y,v=a("zk5+");function w(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function E(e){for(var t=1;t{let i,o,c=this.state.value.slice(0);if(e===h.b.COPY_PASTE){if(this.props.disableCopyPasteBetweenColumns&&s!==r)return;i=a,o=a}else i=Math.min(t,a),o=Math.max(t,a);let d=this.props.getDisabledRows?this.props.getDisabledRows(c,i,o):[],p=this.state.columns.find(e=>e.key===s);if(p&&p.clearRowOnRemove&&null===n[s])for(let l of this.state.columns)"index"===l.key||l.noClearing||(n[l.key]=null);for(let l in n)void 0===n[l]&&delete n[l];if(!l()(n)){for(let e=i;e<=o;e++)d.includes(e)||(p&&p.onChange&&(n=p.onChange(n,c[e],this.state.filters)),n[p.key]?p.clearRowOnRemove&&!n[p.key]||!this.props.enableAutoInsert?c[e]=E({},c[e],{},n):c[e]=this.autoInsertValues(c[e],n,s):c[e]=E({},c[e],{},n));this.props.onDataChange&&this.props.onDataChange(c,this.state.filters),this.props.onChange(this.props.name,c)}},this.addRow=s()(()=>{const e=this.state.value.slice(0);e.push({}),this.props.onDataChange&&this.props.onDataChange(e,this.state.filters),this.props.onChange(this.props.name,e)},25),this.onSelectedCellChange=({idx:e,rowIdx:t})=>{const{shouldIndex:a,disableAddingNewRow:n}=this.props,{columns:s,enableCellDragAndDrop:r}=this.state,i=this.state.value.slice(0);a&&0===e&&this.grid.current.selectCell({rowIdx:t,idx:1}),s[e].disableDragAndDrop||a&&0===e?r&&this.setState({enableCellDragAndDrop:!1}):r||this.setState({enableCellDragAndDrop:!0}),n||t===i.length-1&&this.addRow()},this.onFiltersChange=e=>{const{onFiltersChange:t}=this.props;let a=this.state.value.slice(0);if(t){const n=Array.isArray(a)&&a.filter(e=>!e.occupied),s=Array.isArray(a)&&a.filter(e=>e.occupied);a=t(e,n,this.state.filters);const r=[...s,...a];this.props.onDataChange&&this.props.onDataChange(r,e),this.props.onChange(this.props.name,r)}this.setState({filters:e})}}static getDerivedStateFromProps(e,t){return{columns:S.getColumns(e),value:e.value||[]}}static getColumns(e){const{shouldIndex:t,columns:a}=e;let n=a.map(t=>E({},t,{editable:void 0===t.editable||t.editable,formatter:a=>d.a.createElement(C,{formatterProps:a,formatter:t.formatter,errors:e.errors})}));return t&&n.unshift({name:"#",key:"index",width:10,formatter:({rowIdx:e})=>e+1,frozen:!0}),n}componentDidMount(){const{shouldIndex:e}=this.props,{columns:t}=this.state;e&&t[1].disableDragAndDrop&&this.setState({enableCellDragAndDrop:!1})}shouldComponentUpdate(e,t,a){return!i()(this.state,t)}getColumn(e){return this.state.columns.find(t=>t.key===e)}autoInsertValues(e,t,a){const{filters:n}=this.state;let s=E({},e,{},t);for(let r in n){let e=this.getColumn(r);if(!e.disableAutoInsert&&a!==r&&(e.insertEvenIfNotEditable||"function"===typeof e.editable&&e.editable(s)||"boolean"===typeof e.editable&&e.editable)){let t=n[r];s[r]||(s[r]=t,s=E({},s,{},e.onChange?e.onChange(s,s,this.state.filters):{}))}}return s}clearFilters(){this.setState({filters:{}})}removeFilter(e){const{filters:t}=this.state;delete t[e],this.onFiltersChange(t)}setFilters(e){this.setState({filters:e})}render(){const{columns:e,value:t,filters:a,enableCellDragAndDrop:n}=this.state;return d.a.createElement("div",{className:"fetura-table-input",ref:this.container},d.a.createElement(f.a,null,({width:s,height:r})=>d.a.createElement(p.a,{columns:e,rows:t,onRowsUpdate:this.handleRowUpdate,onSelectedCellChange:this.onSelectedCellChange,ref:this.grid,enableFilters:!0,onFiltersChange:this.onFiltersChange,filters:a,enableCellDragAndDrop:n,enableCellCopyPaste:!0,rowHeight:v.a,style:{width:s,height:r}})))}}S.propTypes={columns:m.a.arrayOf(m.a.shape({name:m.a.string.isRequired,key:m.a.string.isRequired,editor:m.a.object,formatter:m.a.func,disableAutoInsert:m.a.bool,disableDragAndDrop:m.a.bool,clearRowOnRemove:m.a.bool,insertEvenIfNotEditable:m.a.bool,noClearing:m.a.bool})).isRequired,shouldIndex:m.a.bool,onFiltersChange:m.a.func,enableAutoInsert:m.a.bool,initialFilters:m.a.object,disableCopyPasteBetweenColumns:m.a.bool,value:m.a.array.isRequired,onChange:m.a.func.isRequired,errors:m.a.array.isRequired,name:m.a.string,disableAddingNewRow:m.a.bool,onDataChange:m.a.func,getDisabledRows:m.a.func},S.defaultProps={enableAutoInsert:!0,initialFilters:{},disableCopyPasteBetweenColumns:!0,name:"data"};t.a=S},sgBY:function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a("lSCD"),s=a.n(n),r=a("mwIZ"),i=a.n(r),o=a("q1tI"),l=a.n(o),c=a("17x9"),d=a.n(c);a("AZuN");class h extends l.a.Component{renderItem(e,t,a){const{field:n,valueFormatter:r,component:o}=t;let c=e;return n&&(c=i()(e,n,"")),r&&(c=r(c)),o?s()(o)?o({index:a,value:c,page:0,paginationItems:0},this.props):l.a.cloneElement(o,{index:a,value:c,page:0,paginationItems:0}):c}render(){const{headers:e,data:t,shouldIndex:a}=this.props;return l.a.createElement("table",{className:"printable-fetura-grid"},l.a.createElement("thead",null,l.a.createElement("tr",null,a&&l.a.createElement("th",null,"#"),e.map((e,t)=>l.a.createElement("th",{key:t,className:e.headerClassName&&e.headerClassName.includes("empty")?"empty":null},e.name)))),l.a.createElement("tbody",null,t.map((t,n)=>l.a.createElement("tr",null,a&&l.a.createElement("td",null,n+1),e.map((e,a)=>l.a.createElement("td",{key:"".concat(n,".").concat(a)},this.renderItem(t,e,n)))))))}}h.propTypes={headers:d.a.arrayOf(d.a.shape({name:d.a.node.isRequired,field:d.a.string,valueFormatter:d.a.func,component:d.a.oneOfType([d.a.func,d.a.element])})).isRequired,data:d.a.array.isRequired,shouldIndex:d.a.bool}},tDIT:function(e,t,a){},uugb:function(e,t,a){"use strict";a.d(t,"a",(function(){return S}));var n=a("lSCD"),s=a.n(n),r=a("Y+p1"),i=a.n(r),o=a("q1tI"),l=a.n(o),c=a("17x9"),d=a.n(c),h=a("UB5X"),p=a.n(h),u=a("4qC0"),m=a.n(u),f=a("mwIZ"),g=a.n(f),b=a("7xGa");class y extends l.a.Component{constructor(e){super(e),this.getValue=()=>{const{header:{field:e,valueFormatter:t},object:a,isPinned:n}=this.props;let s=a;return e&&(s=g()(a,e,"")),t&&!n&&(s=t(s)),s},this.renderComponent=()=>{const e=this.getValue(),{header:{component:t},index:a,page:n,paginationItems:r}=this.props;return t?s()(t)?t({index:a,value:e,page:n,paginationItems:r},this.props):l.a.cloneElement(t,{index:a,value:e,page:n,paginationItems:r}):e},this.getTitle=()=>{const{header:{component:e}}=this.props;if(e)return null;let t=this.getValue();return"object"===typeof t?null:t},this.handleEnter=e=>{const{hover:t}=this.state;console.log(t,this.isOverflown(this.itemRef.current)),!t&&e&&this.isOverflown(this.itemRef.current)&&this.setState({hover:!0})},this.handleLeave=(e,t=2500)=>{const{hover:a}=this.state;a&&e&&(this.timeout=setTimeout(()=>{this.setState({hover:!1})},t))},this.getStyle=()=>{try{const e=this.itemRef.current,t=window.innerWidth-15-e.offsetLeft;return{top:e.offsetTop,left:e.offsetLeft,minWidth:e.clientWidth,minHeight:e.clientHeight,maxWidth:t,position:"absolute"}}catch(e){return{top:0,left:0,minWidth:0,minHeight:0,maxWidth:0,position:"absolute"}}},this.isOverflown=({clientWidth:e,clientHeight:t,scrollWidth:a,scrollHeight:n})=>{const{header:{component:s}}=this.props;return!!s||(n>t||a>e)},this.state={hover:!1},this.itemRef=l.a.createRef()}shouldComponentUpdate(e,t,a){return!i()(this.props,e)||!i()(this.state,t)}getClassName(){const{header:{itemClassName:e,colWidth:t,rtl:a}}=this.props,n=["table-item",e];return a&&n.push("rtl"),t&&n.push("col-width-".concat(t)),n.filter(e=>e).join(" ")}componentWillUnmount(){clearTimeout(this.timeout)}render(){const e=this.renderComponent(),{header:{overflowInPortal:t},mobile:a}=this.props,n=this.getTitle(),s=this.getClassName(),{hover:r}=this.state,i=a&&(m()(e)||p()(e))||t;return l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{ref:this.itemRef,onTouchEnd:()=>this.handleLeave(i),onTouchCancel:()=>this.handleLeave(i,1e3),onTouchMove:()=>this.handleLeave(i,0),onTouchStart:()=>this.handleEnter(i),className:s,title:n},e),l.a.createElement(b.a,{in:r,unmountOnExit:!0,mountOnEnter:!0},l.a.createElement("div",{style:this.getStyle(),className:"".concat(s," item-title")},e)))}}y.propTypes={header:d.a.shape({name:d.a.node.isRequired,field:d.a.string,valueFormatter:d.a.func,component:d.a.oneOfType([d.a.func,d.a.element]),itemClassName:d.a.string,overflowInPortal:d.a.bool}).isRequired,object:d.a.oneOfType([d.a.node,d.a.object]).isRequired,index:d.a.number,page:d.a.number,paginationItems:d.a.number,isPinned:d.a.bool};var C=a("OwcS"),v=a("S8cm"),w=a("gNnm");function E(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function O(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class S extends l.a.Component{constructor(e){super(e),this.getClassName=()=>{const{isSelectable:e,selected:t,className:a,object:n}=this.props;let s="table-row";if(e&&(s+=" selectable"),t&&(s+=" selected"),a)if("function"===typeof a){let e=a(n);e&&(s+=" ".concat(e))}else s+=" ".concat(a);return s},this.onRowClick=e=>{e.preventDefault();const{object:t,index:a}=this.props;this.props.onClick(t,a-1)},this.renderFullWidthRow=()=>{const{fullWidthRow:e}=this.props;return s()(e)?e(this.props):l.a.cloneElement(e,function(e){for(var t=1;t{let e=this.current&&this.current.getElementsByClassName("table-row")[0].getElementsByTagName("i").length>0?this.current.getElementsByClassName("table-row")[0].getElementsByTagName("i")[0]:void 0,t=this.current&&this.current.getElementsByClassName("isExpand-content").length>0?this.current.getElementsByClassName("isExpand-content")[0]:void 0;t&&("flex"===t.style.display?t.style.display="none":t.style.display="flex"),e&&t&&("flex"===t.style.display?e.style.transform="rotate(180deg)":e.style.transform="rotate(0deg)")},this.createExpandContent=(e,t)=>l.a.cloneElement(e,t);const{isFullWidthRow:t,object:a,fullWidthRow:n}=e;if(t&&t(a)&&!n)throw new Error("Wykryto pe\u0142ny wiersz bez komponentu fullWidthRow")}shouldComponentUpdate(e,t,a){return!i()(this.props,e)}render(){const{headers:e,object:t,shouldIndex:a,index:n,isSelectable:s,selected:r,page:i,paginationItems:o,isPinned:c,isFullWidthRow:d,isClickable:h,singleRowSelect:p,mobile:u,fullWidthBefore:m,isExpanded:f,component:g}=this.props;return d&&d(t)?l.a.createElement("div",{className:"table-row full-width"},this.renderFullWidthRow()):l.a.createElement("div",{className:"table-row-box",ref:e=>{this.current=e}},l.a.createElement("div",{className:this.getClassName(),onClick:f?this.onExpand:h?this.onRowClick:void 0},s&&l.a.createElement(l.a.Fragment,null,c&&l.a.createElement("div",{className:"table-item checkbox"}),p?l.a.createElement("div",{className:"table-item checkbox"},l.a.createElement(w.a,{label:"",id:Object(C.a)(),checked:r,readOnly:!0})):!c&&l.a.createElement("div",{className:"table-item checkbox"},l.a.createElement(v.a,{label:"",id:Object(C.a)(),checked:r,readOnly:!0}))),a&&l.a.createElement(l.a.Fragment,null,c&&l.a.createElement("div",{className:"table-item index"}),!c&&l.a.createElement("div",{className:"table-item index"},n-m)),e.map((e,a)=>l.a.createElement(y,{mobile:u,header:e,object:t,key:a,index:n-1,page:i,paginationItems:o,isPinned:c}))),f&&l.a.createElement("div",{className:"isExpand-content"},this.createExpandContent(g,t)))}}S.propTypes={headers:d.a.arrayOf(d.a.shape({name:d.a.node.isRequired,field:d.a.string,valueFormatter:d.a.func,component:d.a.oneOfType([d.a.func,d.a.element])})).isRequired,object:d.a.oneOfType([d.a.node,d.a.object]).isRequired,shouldIndex:d.a.bool,index:d.a.number,isSelectable:d.a.bool,selected:d.a.bool,onClick:d.a.func,page:d.a.number,paginationItems:d.a.number,isPinned:d.a.bool,isFullWidthRow:d.a.func,fullWidthRow:d.a.node,isClickable:d.a.bool,singleRowSelect:d.a.bool,className:d.a.oneOfType([d.a.string,d.a.func]),fullWidthBefore:d.a.number,isExpanded:d.a.bool,component:d.a.node},S.defaultProps={isExpanded:!1,shouldIndex:!1,isSelectable:!1,selected:!1,onClick:()=>{}}},uvcQ:function(e,t,a){},vLM9:function(e,t,a){},vzPY:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("CuyV");a("c8gq");class i extends n.Component{render(){const{value:e}=this.props;return s.a.createElement(r.a,{tooltipContent:e},s.a.createElement("div",{className:"tooltip-cell"},e))}}t.a=i},y3qy:function(e,t,a){"use strict";var n=a("J2iB"),s=a.n(n),r=a("sEfC"),i=a.n(r),o=a("q1tI"),l=a.n(o),c=a("wd/R"),d=a.n(c),h=a("2dKy"),p=a("17x9"),u=a.n(p);class m extends o.Component{constructor(...e){super(...e),this.state={value:this.props.value},this.sendFilter=i()(e=>{this.props.onChange(e)},300),this.onChange=e=>{const{type:t,allowFloat:a}=this.props;if(""===e&&(e=null),"date"!==t&&"datetime-local"!==t||e instanceof d.a||(e=d()(e)),"number"===this.props.type){let t=parseFloat(e);e=isNaN(t)?null:a?t:Math.floor(t)}this.setState({value:e}),this.sendFilter(e)},this.onKeyDown=e=>{if("date"===this.props.type&&["ArrowUp","ArrowDown"].includes(e.key)){let t=this.state.value?this.state.value.clone():d()();"ArrowUp"===e.key?t.add(1,"day"):"ArrowDown"===e.key&&t.subtract(1,"day"),this.onChange(t),e.stopPropagation(),e.preventDefault()}return!1}}componentDidUpdate(e,t,a){this.state.value===t.value&&this.props.value!==e.value&&this.setState({value:this.props.value})}getValue(e){if(s()(e)||""===e)return"";const{type:t}=this.props;switch(t){case"date":return e.format(d.a.HTML5_FMT.DATE);case"datetime-local":return e.format(d.a.HTML5_FMT.DATETIME_LOCAL);default:return e}}render(){const{value:e}=this.state,{type:t,placeholder:a}=this.props;return l.a.createElement(h.a,{type:t,value:this.getValue(e),onChange:this.onChange,onKeyDown:this.onKeyDown,placeholder:a})}}m.propTypes={value:u.a.oneOfType([u.a.string,u.a.number,u.a.instanceOf(d.a)]),onChange:u.a.func.isRequired,type:u.a.oneOf(["text","number","date","datetime-local"]).isRequired,placeholder:u.a.string,allowFloat:u.a.bool},m.defaultProps={allowFloat:!0},t.a=m},yjtO:function(e,t,a){"use strict";var n=a("4qC0"),s=a.n(n),r=a("J2iB"),i=a.n(r),o=a("lSCD"),l=a.n(o),c=a("mwIZ"),d=a.n(c),h=a("q1tI"),p=a.n(h),u=a("17x9"),m=a.n(u),f=a("3Z9Z"),g=a("JI6e"),b=(a("5umc"),a("wd/R")),y=a.n(b),C=a("gNnm"),v=a("OwcS"),w=a("S8cm");function E(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function O(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class S extends h.Component{constructor(...e){super(...e),this.getContent=(e={})=>{const{component:t,field:a,valueFormatter:n}=e,{index:s,page:r,paginationItems:i,object:o}=this.props;let c=o;return a&&(c=d()(o,a,"")),n&&(c=n(c)),t?l()(t)?t({index:s,value:c,page:r,paginationItems:i},this.props):p.a.cloneElement(t,{index:s,value:c,page:r,paginationItems:i}):c},this.itemRenderer=(e={})=>{const t=this.getContent(e);if(i()(t))return null;const a=(e.name||"").trim();return p.a.createElement(f.a,null,p.a.createElement(g.a,{className:"col-md-auto opacity-75 pr-md-1",sm:12},a?p.a.createElement(p.a.Fragment,null,a,":"):null),p.a.createElement(g.a,{className:"col-md-auto pl-md-1",sm:12},t))},this.getDate=()=>{const{headers:e}=this.props,t=e.find(e=>e._mobileDate);if(!t)return null;const a=function(e){for(var t=1;ty()(e).format("DD.MM.YY HH:mm")}),n=this.getContent(a);return p.a.createElement("div",{className:"fetura-grid-mobile-row-date"},n)},this.getFloatingItems=()=>{const{headers:e}=this.props,t=e.filter(e=>e._floating);if(!t.length)return null;const a=t.map(e=>this.getContent(e)).filter(e=>!!e);return a.length?p.a.createElement("div",{className:"fetura-grid-mobile-row-floating"},a):null},this.getHeader=()=>{const{headers:e}=this.props,t=e.find(e=>e._mobileHeader);if(!t)return null;const a=this.getContent(t);return p.a.createElement(f.a,null,p.a.createElement(g.a,{xs:12},p.a.createElement("strong",null,a)))},this.onSelect=e=>{const{object:t,index:a,isSelectable:n,onSelect:s}=this.props;if(e.preventDefault(),!n)return null;s(t,a-1)},this.getSelect=()=>{const{isSelectable:e,singleRowSelect:t,selected:a}=this.props;return e?p.a.createElement(f.a,{className:"fetura-grid-mobile-row-select"},p.a.createElement(g.a,{xs:12},t?p.a.createElement(C.a,{label:"",id:Object(v.a)(),checked:a,readOnly:!0}):p.a.createElement(w.a,{label:"",id:Object(v.a)(),checked:a,readOnly:!0}))):null},this.getClassName=()=>{const{className:e,object:t}=this.props;return["fetura-grid-mobile-row",s()(e)?e:l()(e)?e(t):""].filter(e=>!!e).join(" ")}}render(){const{headers:e}=this.props,t=this.getClassName();return p.a.createElement("div",{className:t,onClick:this.onSelect},this.getDate(),this.getSelect(),this.getHeader(),e.filter(e=>!e._mobileDate&&!e._mobileHeader&&!e._mobileHide&&!e._floating).map(e=>this.itemRenderer(e)),this.getFloatingItems())}}S.propTypes={object:m.a.object,headers:m.a.array},t.a=S}}]); //# sourceMappingURL=main~84dcf98e.5ddad101.chunk.js.map