UNPKG

@maherunlocker/custom-react-table

Version:

**Custom-react-table** is based on <code>React-Table v7</code>: collection of hooks for **building powerful tables and datagrid experiences**. These hooks are lightweight, composable, and ultra-extensible, but **do not render any markup or styles for you*

1 lines 51.5 kB
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@aureskonnect/react-ui"),n=require("react"),r=e(n),a=e(require("@mui/material/Alert")),i=require("@mui/material"),l=require("reactstrap"),o=require("react-table"),c=e(require("@mui/material/TableBody")),s=e(require("@mui/material/TableCell")),u=e(require("@mui/material/TableHead")),d=e(require("@mui/material/TableRow")),m=e(require("@mui/material/Table")),p=e(require("classnames")),h=require("@mui/styles"),g=require("match-sorter"),f=e(require("@mui/icons-material/ArrowForwardIos")),v=e(require("@mui/material/Box")),b=e(require("@mui/material/Collapse")),y=e(require("@mui/material/IconButton")),E=e(require("@mui/icons-material/KeyboardArrowDown")),x=e(require("@mui/material/Paper")),w=e(require("@mui/material/TableContainer")),C=e(require("@mui/icons-material/KeyboardArrowRight")),F=e(require("@mui/icons-material/KeyboardArrowUp")),S=e(require("@mui/icons-material/ViewColumn")),k=e(require("lodash.uniqby")),N=e(require("axios"));function T(e,t,n,r,a,i,l){try{var o=e[i](l),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,a)}function A(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function l(e){T(i,r,a,l,o,"next",e)}function o(e){T(i,r,a,l,o,"throw",e)}l(void 0)}))}}function L(){return(L=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function R(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(a[n]=e[n]);return a}var I,H=(function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",l=r.toStringTag||"@@toStringTag";function o(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{o({},"")}catch(e){o=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var a=Object.create((t&&t.prototype instanceof d?t:d).prototype),i=new C(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(a,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw i;return{value:void 0,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var o=E(l,n);if(o){if(o===u)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=s(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===u)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,i),a}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var u={};function d(){}function m(){}function p(){}var h={};o(h,a,(function(){return this}));var g=Object.getPrototypeOf,f=g&&g(g(F([])));f&&f!==t&&n.call(f,a)&&(h=f);var v=p.prototype=d.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){o(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){var r;this._invoke=function(a,i){function l(){return new t((function(r,l){!function r(a,i,l,o){var c=s(e[a],e,i);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==typeof d&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,l,o)}),(function(e){r("throw",e,l,o)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return r("throw",e,l,o)}))}o(c.arg)}(a,i,r,l)}))}return r=r?r.then(l,l):l()}}function E(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var r=s(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,u;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function F(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:S}}function S(){return{value:void 0,done:!0}}return m.prototype=p,o(v,"constructor",p),o(p,"constructor",m),m.displayName=o(p,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,o(e,l,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},b(y.prototype),o(y.prototype,i,(function(){return this})),e.AsyncIterator=y,e.async=function(t,n,r,a,i){void 0===i&&(i=Promise);var l=new y(c(t,n,r,a),i);return e.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},b(v),o(v,l,"Generator"),o(v,a,(function(){return this})),o(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=F,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return l.type="throw",l.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var o=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(o&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var l=i?i.completion:{};return l.type=e,l.arg=t,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),w(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;w(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:F(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(I={exports:{}}),I.exports);function B(){return r.createElement("div",{className:"centeranimation"},r.createElement("div",{className:"spinner-grow text-primary",role:"status"},r.createElement("span",{className:"sr-only"})),r.createElement("div",{className:"spinner-grow text-secondary",role:"status"},r.createElement("span",{className:"sr-only"})),r.createElement("div",{className:"spinner-grow text-success",role:"status"},r.createElement("span",{className:"sr-only"})),r.createElement("div",{className:"spinner-grow text-danger",role:"status"},r.createElement("span",{className:"sr-only"})),r.createElement("div",{className:"spinner-grow text-warning",role:"status"},r.createElement("span",{className:"sr-only"})),r.createElement("div",{className:"spinner-grow text-info",role:"status"},r.createElement("span",{className:"sr-only"})),r.createElement("div",{className:"spinner-grow text-light",role:"status"},r.createElement("span",{className:"sr-only"})),r.createElement("div",{className:"spinner-grow text-dark",role:"status"},r.createElement("span",{className:"sr-only"})))}function O(){return r.createElement("div",{className:"d-flex align-items-center justify-content-center centeranimation ",style:{padding:"20%"}},r.createElement(a,{variant:"filled",severity:"error"},"Erreur chargement des données."))}var j=["children","className"],G=["children","className"],P=["children","className"],D=["children","className"],z=["children","className"],M=["children","className"],_=["children","className"],q=["children","className"],V=h.makeStyles({rawTable:{borderSpacing:0,border:"1px solid rgba(224, 224, 224, 1)",width:"100%",borderTop:"0"},tableHead:{position:"sticky",top:"0px",zIndex:200,borderTop:"0",marginTop:"0",marginBottom:"2",paddingTop:"0"},tableHeadRow:{backgroundColor:"#F8F8FB ",color:"#000",border:"0px"},tableHeadCell:{padding:"16px 1px 16px 16px",fontSize:"0.875rem",textAlign:"center",maxHeight:45,verticalAlign:"inherit",fontWeight:"700 !important",lineHeight:"1.5rem",borderRight:"1px solid rgba(224, 224, 224, 1)","&:last-child":{borderRight:"none"}},tableBody:{},tableRow:{color:"inherit",outline:0,verticalAlign:"middle","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.07)"},borderBottom:"1px rgb(239, 239, 239)","&:last-child":{borderBottom:"none"},"&.rowSelected":{backgroundColor:"rgba(0, 0, 0, 0.04)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.07)"}},"&.clickable":{cursor:"pointer"}},tableLabel:{},tableCell:{padding:"8px 16px",fontSize:"0.875rem",textAlign:"center",fontWeight:300,lineHeight:1.3,verticalAlign:"inherit",color:"rgba(0, 0, 0, 0.87)",display:"flex",justifyContent:"center",alignItems:"center"},resizeHandle:{position:"absolute",cursor:"col-resize",zIndex:100,opacity:0,borderLeft:"1px solid #42a5f5",borderRight:"1px solid #42a5f5",height:"50%",top:"25%",transition:"all linear 100ms",right:-2,width:3,"&.handleActive":{opacity:1,border:"none",backgroundColor:"#42a5f5",height:"calc(100% - 4px)",top:"2px",right:-1,width:1}},tableSortLabel:{"& svg":{width:16,height:16,marginTop:0,marginLeft:2}},tableFilterAltOutlinedIcon:{width:" 21px !important",height:"23px !important",marginTop:0,marginRight:2},headerIcon:{"& svg":{width:16,height:16,marginTop:4,marginRight:0}},iconDirectionAsc:{transform:"rotate(90deg)"},iconDirectionDesc:{transform:"rotate(180deg)"},iconDirectionRight:{transform:"rotate(180deg)"},cellIcon:{"& svg":{width:16,height:16,marginTop:3}},FiltersCss:{border:"1px solid rgba(224, 224, 224, 1)",borderSpacing:0,paddingLeft:"0 !important",paddingTop:"0 !important",height:"45px !important",backgroundColor:" var(--unnamed-color-ffffff) 0% 0% no-repeat padding-box ",alignItems:"center",minHeight:"64px"},DividerCss:{background:"#F7F7FA 0% 0% no-repeat padding-box",height:"2px"},SvgNoDataCss:{display:"flex !important",justifyContent:"center !important",alignContent:"center!important",alignItems:"center!important",border:"0",height:"100%"},cardHeaderCss:{padding:"0 ",backgroundColor:"white",marginBottom:"4px !important",border:"1px solid rgba(0,0,0,.125)"}}),Z=function(e,t){return e.checked===t.checked&&e.indeterminate===t.indeterminate},W=function(e){var t=e.children,n=e.className,a=R(e,j),i=V();return r.createElement(m,Object.assign({className:p(n,i.rawTable)},a),t)},J=function(e){var t=e.children,n=e.className,a=R(e,G),i=V();return r.createElement(c,Object.assign({className:p(n,i.tableBody)},a),t)},U=function(e){var t=e.children,n=e.className,a=R(e,P),i=V();return r.createElement(u,Object.assign({className:p(n,i.tableHead)},a),t)},K=function(e){var t=e.children,n=e.className,a=R(e,D),i=V();return r.createElement(d,Object.assign({className:p(n,i.tableHeadRow)},a),t)},X=function(e){var t=e.children,n=e.className,a=R(e,z),i=V();return r.createElement(s,Object.assign({className:p(n,i.tableHeadCell)},a),t)},Y=function(e){var t=e.children,n=e.className,a=R(e,M),i=V();return r.createElement(d,Object.assign({className:p(n,i.tableRow)},a),t)},Q=function(e){var t=e.children,n=e.className,a=R(e,_),i=V();return r.createElement(s,Object.assign({className:p(n,i.tableCell)},a),t)},$=function(e){var t=e.children,n=e.className,a=R(e,q),i=V();return r.createElement("div",Object.assign({className:p(n,i.tableLabel)},a),t)},ee=r.memo(i.styled(i.Checkbox)({fontSize:"1rem",margin:"-8px 0 -8px -15px",padding:"8px 9px","& svg":{width:"24px",height:"24px"},"&:hover":{backgroundColor:"transparent"}}),Z),te=r.memo(i.styled(i.Checkbox)({fontSize:"14px",margin:"-9px 0 -8px -15px",padding:"5px 9px","&:hover":{backgroundColor:"transparent"},"& svg":{width:24,height:24}}),Z);function ne(e,t){var r=n.useState((function(){try{var n=window.localStorage.getItem(e);return n?JSON.parse(n):t}catch(e){return console.log(e),t}})),a=r[1];return[r[0],n.useCallback((function(t){try{a(t),window.localStorage.setItem(e,JSON.stringify(t))}catch(e){console.log(e)}}),[e])]}function re(e,t,n){return g.matchSorter(e,n,{keys:[function(e){return e.values[t]}]})}re.autoRemove=function(e){return!e};var ae=/([=<>!]*)\s*((?:[0-9].?[0-9]*)+)/;function ie(e,t,n){var r=function(e){var t=function(t){return t==e},n=ae.exec(e);if(!n)return t;switch(n[1]){case">":return function(e){return parseFloat(e)>parseFloat(n[2])};case"<":return function(e){return parseFloat(e)<parseFloat(n[2])};case"<=":return function(e){return parseFloat(e)<=parseFloat(n[2])};case">=":return function(e){return parseFloat(e)>=parseFloat(n[2])};case"=":return function(e){return parseFloat(e)===parseFloat(n[2])};case"!":return function(e){return parseFloat(e)!==parseFloat(n[2])}}return t}(n);return e.filter((function(e){return r(e.values[t[0]])}))}function le(e){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:24.007,height:21.893},e),r.createElement("g",{"data-name":"Groupe 18578",fill:"#2b2828"},r.createElement("path",{"data-name":"Trac\\xE9 17835",d:"M15.391 14.645a1.371 1.371 0 0 0-.551.1 1.024 1.024 0 0 0-1.045-.736 1.365 1.365 0 0 0-.557.1 1.051 1.051 0 0 0-1.039-.708 1.368 1.368 0 0 0-.541.092v-1.314a.993.993 0 0 0-1.055-.85 1.287 1.287 0 0 0-.8.234.75.75 0 0 0-.335.6v2.914a1.366 1.366 0 0 0-.5-.093 1.28 1.28 0 0 0-.774.245.746.746 0 0 0-.321.591v.945a.307.307 0 0 0 .592 0v-.945a.342.342 0 0 1 .147-.271.588.588 0 0 1 .355-.112.455.455 0 0 1 .5.383v1.46l-.133.1a.191.191 0 0 0 0 .32.364.364 0 0 0 .419 0l.219-.168a.2.2 0 0 0 .087-.16v-5.211a.344.344 0 0 1 .153-.276.59.59 0 0 1 .367-.107.458.458 0 0 1 .483.4v4.556a.307.307 0 0 0 .593 0v-2.5a.344.344 0 0 1 .153-.276.592.592 0 0 1 .367-.107.457.457 0 0 1 .483.4v2.484a.307.307 0 0 0 .592 0v-1.89a.344.344 0 0 1 .153-.275.59.59 0 0 1 .367-.107.458.458 0 0 1 .483.4v1.875a.307.307 0 0 0 .592 0v-1.249a.344.344 0 0 1 .153-.276.59.59 0 0 1 .367-.107.458.458 0 0 1 .483.4v3.372a1.713 1.713 0 0 1-.087.536l-.208.636a2.066 2.066 0 0 0-.1.646v.754H9.661v-.749a.984.984 0 0 0-.3-.684l-.718-.731a.6.6 0 0 1-.18-.413v-1.047a.307.307 0 0 0-.592 0v1.047a.985.985 0 0 0 .3.685l.718.731a.594.594 0 0 1 .18.413v.975a.269.269 0 0 0 .3.226h6.384a.268.268 0 0 0 .3-.226v-.98a1.714 1.714 0 0 1 .087-.536l.208-.636a2.066 2.066 0 0 0 .1-.646v-3.381a.993.993 0 0 0-1.057-.853Z"}),r.createElement("path",{"data-name":"Trac\\xE9 17836",d:"M3.502 5.246a.588.588 0 0 0 0 .832l1.163 1.163a.589.589 0 0 0 .832 0l2.325-2.325a.589.589 0 0 0-.832-.832L5.079 5.992l-.747-.746a.589.589 0 0 0-.83 0Z"}),r.createElement("path",{"data-name":"Trac\\xE9 17837",d:"M11.323 8.319V3a3.008 3.008 0 0 0-3-3H7.035a.589.589 0 0 0 0 1.177H8.32A1.829 1.829 0 0 1 10.146 3v5.319a1.829 1.829 0 0 1-1.827 1.828H3.005A1.83 1.83 0 0 1 1.18 8.319V3a1.83 1.83 0 0 1 1.828-1.828h1.284a.589.589 0 1 0 0-1.177H3.005a3.008 3.008 0 0 0-3 3v5.324a3.008 3.008 0 0 0 3 3H8.32a3.008 3.008 0 0 0 3.003-3Z"}),r.createElement("path",{"data-name":"Trac\\xE9 17838",d:"M15.687 11.324h5.315a3.008 3.008 0 0 0 3-3V3a3.008 3.008 0 0 0-3-3h-5.315a3.008 3.008 0 0 0-3 3v5.319a3.008 3.008 0 0 0 3 3.005ZM13.86 3a1.829 1.829 0 0 1 1.827-1.827h5.315A1.829 1.829 0 0 1 22.834 3v5.319a1.829 1.829 0 0 1-1.827 1.827h-5.315a1.829 1.829 0 0 1-1.827-1.827Z"})))}ie.autoRemove=function(e){return!e};var oe=h.makeStyles({cell_short:{lineHeight:"1.5rem",fontWeight:"700!important",border:"0 !important"}});function ce(e){var t,n,a=e.row,i=e.headerGroups,l=a.original,o=oe(e),u=r.useState(!1),p=u[0],h=u[1];return r.createElement(r.Fragment,null,r.createElement(d,{sx:{"& > *":{borderBottom:"unset"}}},null==(t=i[0])?void 0:t.headers.filter((function(e){return"_selector"!==e.id&&"rating"!==e.id&&"subRows"!==e.id&&"hidecolumns"!==e.id&&"expander"!==e.id&&"Actions"!==e.id})).slice(0,3).map((function(e){return"image"===e.id||"picture"===e.id?r.createElement(s,{component:"th",scope:"key",variant:"body",key:e.id},r.createElement("img",{src:l[e.id],className:"w-25 h-25",alt:""})):r.createElement(s,{component:"th",scope:"row",key:e.id},l[e.id])})),r.createElement(s,{align:"right"},r.createElement(y,{"aria-label":"expand row",size:"small",onClick:function(){return h(!p)}},r.createElement(p?E:f,null)))),r.createElement(d,{style:{marginTop:"2px"}},r.createElement(s,{style:{paddingBottom:0,paddingTop:0,paddingLeft:0},colSpan:6},r.createElement(b,{in:p,timeout:"auto",unmountOnExit:!0},r.createElement(v,{sx:{marginLeft:0,marginRight:0}},r.createElement(m,{"aria-label":a.id},r.createElement(c,null,r.createElement(d,{key:a.id,sx:{alignItems:"between"}},null==(n=i[0])?void 0:n.headers.filter((function(e){return"_selector"!==e.id&&"rating"!==e.id&&"subRows"!==e.id&&"hidecolumns"!==e.id&&"expander"!==e.id&&"Actions"!==e.id})).slice(3).map((function(e){return"image"===e.id||"picture"===e.id?r.createElement(d,{component:"th",scope:"row",key:e.id},r.createElement(s,{className:"tableCellLabel",scope:"key",variant:"body",align:"right"},e.id),r.createElement(s,{component:"th",scope:"row",variant:"body"},r.createElement("img",{src:l[e.id],className:"w-25 h-25",alt:""}))):r.createElement(d,{component:"th",scope:"row",key:e.id,style:{display:"flex",justifyContent:"space-between"}},r.createElement(s,{scope:"key",variant:"body",className:o.cell_short},e.id),r.createElement(s,{scope:"key",style:{border:0}},l[e.id]))}))))))))))}function se(e){var t,n=e.props,a=n.headerGroups,i=n.page;return r.createElement(w,{component:x,style:{minHeight:"200",maxHeight:"99vh",overflowX:"hidden"}},r.createElement(m,{"aria-label":"collapsible table",stickyHeader:!0},r.createElement(u,{id:"TableHeader",style:{zIndex:"200",position:"sticky",borderTop:"0",top:"0"}},r.createElement(d,null,null==(t=a[0])?void 0:t.headers.filter((function(e){return"_selector"!==e.id&&"rating"!==e.id&&"subRows"!==e.id&&"hidecolumns"!==e.id&&"expander"!==e.id&&"Actions"!==e.id})).slice(0,3).map((function(e){return r.createElement(s,{key:e.id},e.id)})),r.createElement(s,{align:"right"},"actions"))),r.createElement(c,null,null==i?void 0:i.map((function(e){return r.createElement(ce,{key:e.id,row:e,headerGroups:a})})))))}function ue(e){var t=e.instance,n=V(),a=r.useState(!1),l=a[0],o=a[1],c=t.toggleHideAllColumns,s=t.toggleHideColumn,u=t.allColumns.filter((function(e){return!("_selector"===e.id||"expander"===e.id||"hidecolumns"===e.id)})),d=u.reduce((function(e,t){return e+(t.isVisible?0:1)}),0),m=d+1>=u.length;return u.length>1?r.createElement("div",{className:"d-flex flex-column"},r.createElement("div",{key:"showall",className:" mx-2 d-flex align-items-center justify-content-between"},r.createElement("label",{style:{font:"normal normal normal 13px/17px Segoe UI",letterSpacing:"0px",color:"#495057 "}},"Afficher tous:"),r.createElement("input",{type:"checkbox",checked:l,onChange:function(){c(!1),o(!0)}})),r.createElement(i.Divider,{className:n.DividerCss}),u.map((function(e){return r.createElement("div",{key:e.id,className:" my-1 mx-2 d-flex align-items-center justify-content-between"},r.createElement("label",{style:{font:"normal normal normal 13px/17px Segoe UI",letterSpacing:"0px",color:"#495057 "}},e.id),r.createElement("input",{type:"checkbox",onChange:function(){s(e.id,e.isVisible),o(0===d)},disabled:e.isVisible&&m,checked:e.isVisible}))}))):null}var de=h.makeStyles(h.createStyles({filtersActiveLabel:{color:"#2B2828",fontSize:"14px",paddingRight:10},chipZone:{padding:"18px 0 5px 10px",width:"100%"},chipLabel:{fontWeight:500,marginRight:5,color:"#2B2828 !important"},filterChip:{border:"1px solid #626368 !important",background:"#F6F6F6 0% 0% no-repeat padding-box !important",marginRight:"5px!important",marginBottom:"5px!important"}})),me=function(e,t){switch(e.filter){case"between":var n=t[0],r=t[1];return n?r?n+"-"+r:">="+n:"<="+r}return t};function pe(e){var a=e.instance,l=de({}),o=a.allColumns,c=a.setFilter,s=a.setAllFilters,u=a.state.filters,d=n.useCallback((function(e){c(e,void 0)}),[c]),m=n.useCallback((function(){s([])}),[s]);return Object.keys(u).length>0?r.createElement("div",{className:l.chipZone},r.createElement("span",{className:l.filtersActiveLabel,style:{color:"#FF0000",textDecoration:"underline",cursor:"pointer",fontWeight:"bold"},onClick:function(){return m()}},"Effacer tous"),u&&o.map((function(e){var n=u.find((function(t){return t.id===e.id})),a=n&&n.value;return a&&r.createElement(i.Chip,{className:l.filterChip,key:e.id,deleteIcon:r.createElement(t.CrossIcon,{height:10,width:10,fill:"#2B2828"}),label:r.createElement(r.Fragment,null,r.createElement("span",{className:l.chipLabel},e.render("Header"),": "),r.createElement("span",{className:l.chipLabel},me(e,a)," ")),onDelete:function(){return d(e.id)},variant:"outlined"})}))):null}var he=h.makeStyles(h.createStyles({filtersActiveLabel:{color:"#2B2828",fontSize:"14px",paddingRight:10},chipZone:{padding:"18px 0 5px 10px",width:"100%"},chipLabel:{fontWeight:500,marginRight:5,color:"#2B2828 !important"},filterChip:{border:"1px solid #626368 !important",background:"#F6F6F6 0% 0% no-repeat padding-box !important",marginRight:"5px!important",marginBottom:"5px!important"}})),ge=function(e,t){switch(e.filter){case"between":var n=t[0],r=t[1];return n?r?n+"-"+r:">="+n:"<="+r}return t};function fe(e){var a=e.instance,l=e.showMore,o=he({}),c=a.allColumns,s=a.setFilter,u=a.setAllFilters,d=a.state.filters,m=n.useCallback((function(e){s(e,void 0)}),[s]),p=n.useCallback((function(){u([])}),[u]),h=r.useState(!1),g=h[0],f=h[1];function v(e){var n=e.splicedFilter,a=e.showMore,l=r.useState((function(){return d})),s=l[0],u=l[1];return r.useEffect((function(){a&&u(n?d.slice(2,d.length):d.slice(0,2))}),[a,n]),r.createElement(r.Fragment,null,c.map((function(e){var n=s.find((function(t){return t.id===e.id})),a=n&&n.value;return a&&r.createElement(i.Chip,{className:o.filterChip,key:e.id,deleteIcon:r.createElement(t.CrossIcon,{height:10,width:10,fill:"#2B2828"}),label:r.createElement(r.Fragment,null,r.createElement("span",{className:o.chipLabel},e.render("Header"),": "),r.createElement("span",{className:o.chipLabel},ge(e,a)," ")),onDelete:function(){return m(e.id)},variant:"outlined"})})))}return Object.keys(d).length>0?r.createElement("div",{className:o.chipZone},r.createElement("span",{className:o.filtersActiveLabel,style:{color:"#FF0000",textDecoration:"underline",cursor:"pointer",fontWeight:"bold"},onClick:function(){return p()}},"Effacer tous"),d.length>0?r.createElement(v,{splicedFilter:!1,showMore:l}):null,r.createElement(i.Collapse,{in:g},d.length>2?r.createElement(v,{splicedFilter:!0,showMore:l}):null),l?r.createElement("span",{onClick:function(){f(!g)},style:{textAlign:"end",color:"#0077D7",textDecoration:"underline",cursor:"pointer",alignItems:"flex-end",display:"block",marginRight:"11px"}},g?"Afficher moins":"Afficher plus"):null):null}function ve(){var e=r.useState(window.innerWidth),t=e[0],n=e[1];return r.useEffect((function(){var e=function(){return n(window.innerWidth)};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[]),t<767}var be=h.makeStyles(h.createStyles({columnsPopOver:{padding:24,display:"flex"},FiltersCss:{border:"1px solid rgba(224, 224, 224, 1)"},filtersResetButton:{position:"absolute",top:18,right:21},popoverTitle:{fontWeight:500,padding:"0 24px 24px 0",textTransform:"uppercase"},grid:{display:"grid",gridTemplateColumns:"repeat(2, 218px)","@media (max-width: 600px)":{gridTemplateColumns:"repeat(1, 180px)"},gridColumnGap:24,gridRowGap:24},cell:{display:"flex",flexDirection:"column"},hidden:{display:"none"}}));function ye(e){var a=e.instance,l=be({}),o=a.allColumns,c=a.setAllFilters,s=a.state.filters,u=n.useRef(null),d=r.useState((function(){return!1})),m=d[0],p=d[1],h=r.useState((function(){return 120})),g=h[0],f=h[1],v=ne("SavedFilters",[]),b=v[0],y=v[1],E=r.useState(""),x=E[0],w=E[1];r.useEffect((function(){null!==u.current&&(p(document.getElementById("maher").offsetHeight>120),f(document.getElementById("maher").offsetHeight))}),[]);var C=n.useCallback((function(){b.find((function(e){return e.label===x}))?b[b.findIndex((function(e){return e.label===x}))]={label:x,value:s}:y([].concat(b,[{label:x,value:s}]))}),[x,s,y,b]),F=n.useCallback((function(e){w(e.label);var t=b.findIndex((function(t){return t.label===e.label}));t&&c(b[t].value)}),[b,c]),S=ve();return r.createElement("div",{className:l.cell,style:{marginLeft:5,marginRight:5}},r.createElement(t.StyledLabel,{style:{borderBottom:"2px solid",marginLeft:1,marginRight:1,marginTop:10}},"Filtres enregistrés"),r.createElement(i.Box,{component:"div",sx:{display:"flex",justifyContent:"space-between"}},r.createElement("div",{style:{width:" 100%",marginTop:10}},r.createElement(t.StyledLabel,{htmlFor:"savedFilter"},"Sélectionner un filtre"),r.createElement(t.StyledSelectInput,{onInputChange:function(e){""!==e&&w(e)},inputValue:x,id:"savedFilter",name:"savedFilter",options:b.length>0?b:[],placeholder:b.length>0?"Sélectionner ...":"Aucune",onChange:F,allowCreateWhileLoading:!0})),r.createElement(i.Box,{component:"div",sx:{display:"flex",alignItems:"end"}},r.createElement(t.StyledIconButton,{icon:"DiskIcon",style:{margin:"5px",marginBottom:"0",border:"1px solid",borderRadius:"6px"},onClick:C},r.createElement(t.DiskIcon,{height:20,width:20})),r.createElement(t.StyledIconButton,{icon:"VerticalDotsIcon",style:{margin:"5px",marginBottom:"0",border:"1px solid",borderRadius:"6px"}},r.createElement(t.VerticalDotsIcon,{height:20,width:20})))),r.createElement(t.StyledLabel,{style:{borderBottom:"2px solid",marginLeft:1,marginRight:1,marginTop:10}},"Filtrer"),Object.keys(a.state.filters).length>0?r.createElement(i.Box,{id:"maher",component:"div",ref:u},r.createElement(fe,{instance:a,showMore:m,currentHeight:g})):r.createElement(t.StyledButton,{rounded:!0,variant:"light",style:{width:"100%"}},"Aucun filtre actif"),r.createElement(i.Box,{component:"div",style:{maxHeight:S?"auto":"50vh",overflow:"auto",alignItems:"center"}},o.filter((function(e){return e.canFilter&&e.isVisible&&"delete"!==e.id&&"Actions"!==e.id&&"expander"!==e.id&&"hidecolumns"!==e.id})).map((function(e){return r.createElement("div",{key:e.id,className:"my-2"},e.render("Filter"))}))))}function Ee(e){var n=e.instance,a=e.filterActive,o=e.setLocalFilterActive,c=V();return r.createElement(l.Modal,{toggle:function(){return o(!a)},isOpen:a,style:{margin:"0 ",padding:"0 ",height:"100%"},scrollable:!0},r.createElement(l.ModalHeader,{className:"text-capitalize",toggle:function(){return o(!a)}},r.createElement(i.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"}},r.createElement(t.FilterIcon,{className:c.tableFilterAltOutlinedIcon,style:{flexDirection:"row-reverse"}}),r.createElement(t.StyledH2,null,"Filtre(s)"))),r.createElement(l.ModalBody,{style:{margin:"0 ",padding:"0 ",height:"100%"}},r.createElement(ye,{instance:n,setLocalFilterActive:o,filterActive:a})))}var xe=function(e){var t,n=e.column,a=V();return r.createElement("div",Object.assign({},n.getResizerProps(),{style:{cursor:"col-resize"},className:p((t={},t[a.resizeHandle]=!0,t.handleActive=n.isResizing,t))}))},we=function(e){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:247.734,height:256.229},e),n.createElement("g",{fill:"#a7a7a7"},n.createElement("path",{"data-name":"Trac\\xE9 8747",d:"M117.853 125.483h13.531a3.753 3.753 0 0 0 0-7.507h-13.531a3.753 3.753 0 0 0 0 7.507Z"}),n.createElement("path",{"data-name":"Trac\\xE9 8748",d:"M139.25 135.366a3.753 3.753 0 0 0-4.917 2 10.544 10.544 0 0 1-19.437 0 3.753 3.753 0 0 0-6.916 2.916 18.051 18.051 0 0 0 33.27 0 3.754 3.754 0 0 0-2-4.916Z"}),n.createElement("path",{"data-name":"Trac\\xE9 8749",d:"M238.39 227.772h-50.177l-2.392-11.653a35.711 35.711 0 0 0-10.88-19.138h30.945a3.753 3.753 0 0 0 3.753-3.753v-25.463a3.753 3.753 0 1 0-7.507 0v21.709h-39.746a35.488 35.488 0 0 0-11.649-1.972h-5.733V184a54.5 54.5 0 0 0 50.9-39.961 25.294 25.294 0 0 0 6.226-1.235v9.95a3.753 3.753 0 1 0 7.507 0V138.8a25.468 25.468 0 0 0 9.3-25.783 14.118 14.118 0 0 0-9.3-10.553V75.683A75.768 75.768 0 0 0 133.957 0h-18.691a75.766 75.766 0 0 0-75.673 75.683v26.778a14.122 14.122 0 0 0-9.294 10.552 25.467 25.467 0 0 0 9.294 25.778v54.437a3.753 3.753 0 0 0 3.753 3.753h30.875a35.631 35.631 0 0 0-8.207 11.178 3.753 3.753 0 1 0 6.8 3.177 28.414 28.414 0 0 1 25.652-16.327h6.115a20.381 20.381 0 0 0 40.067 0h6.084a28.415 28.415 0 0 1 27.734 22.619l3.007 14.65a3.754 3.754 0 0 0 3.677 3h24.065v13.444h-36.332a5.287 5.287 0 0 1-5.281-5.281v-11.916a3.753 3.753 0 0 0-7.507 0v11.917a12.708 12.708 0 0 0 1.146 5.281H87.966a12.707 12.707 0 0 0 1.146-5.281v-11.917a3.753 3.753 0 0 0-7.507 0v11.917a5.287 5.287 0 0 1-5.281 5.281H39.987v-13.445h24.066a3.755 3.755 0 0 0 3.673-3l1.5-7.3a3.754 3.754 0 1 0-7.354-1.508l-.881 4.295H10.814a3.753 3.753 0 0 0-3.753 3.753v5.036a19.692 19.692 0 0 0 19.669 19.669h195.745a19.692 19.692 0 0 0 19.669-19.669v-5.036a3.754 3.754 0 0 0-3.754-3.746Zm-48.048-98.145a46.94 46.94 0 0 1-46.887 46.887h-37.679a46.94 46.94 0 0 1-46.887-46.887V95.484c26.208-1.595 75.846-12.536 98.754-31.322 4.727 8.026 16.278 24.831 32.7 30.151Zm21.716-10.985a17.986 17.986 0 0 1-14.617 17.642 54.654 54.654 0 0 0 .408-6.657v-5.207c1.177-1.288 3.714-3.534 6.349-2.471a3.753 3.753 0 1 0 2.808-6.962 11.475 11.475 0 0 0-9.093.226 6.974 6.974 0 0 1 13.7-.547 18.068 18.068 0 0 1 .445 3.976ZM133.957 7.507a68.253 68.253 0 0 1 68.176 68.176v26.295a14.952 14.952 0 0 0-4.285 1.455V91.462a3.753 3.753 0 0 0-2.91-3.657c-19.579-4.517-32.784-30.988-32.914-31.252a3.753 3.753 0 0 0-6.025-1c-8.712 8.712-25.788 17.027-48.083 23.415-18.057 5.174-38.817 8.778-52.888 9.182a3.754 3.754 0 0 0-3.645 3.75v11.531a14.934 14.934 0 0 0-4.283-1.453V75.683a68.25 68.25 0 0 1 68.166-68.176ZM37.621 114.666a6.974 6.974 0 0 1 13.7.547 11.471 11.471 0 0 0-9.093-.226 3.753 3.753 0 0 0 2.808 6.962c2.629-1.061 5.161 1.174 6.341 2.463v5.214a54.646 54.646 0 0 0 .408 6.656 17.975 17.975 0 0 1-14.169-21.616Zm49.186 74.808H47.1V142.8a25.3 25.3 0 0 0 6.224 1.236A54.5 54.5 0 0 0 104.234 184v3.5h-5.768a35.622 35.622 0 0 0-11.659 1.974Zm37.812 14.661a12.894 12.894 0 0 1-12.879-12.879v-7.236h25.758v7.235a12.893 12.893 0 0 1-12.878 12.879ZM14.566 236.56v-1.282H32.48v13.444h-5.75a12.176 12.176 0 0 1-12.164-12.162Zm220.069 0a12.176 12.176 0 0 1-12.162 12.162h-5.75v-13.444h17.913Z"}),n.createElement("path",{"data-name":"Trac\\xE9 8750",d:"M165.757 110.08a10.545 10.545 0 0 1-19.437 0 3.753 3.753 0 1 0-6.917 2.916 18.051 18.051 0 0 0 33.271 0 3.753 3.753 0 0 0-6.917-2.916Z"}),n.createElement("path",{"data-name":"Trac\\xE9 8751",d:"M107.829 108.079a3.753 3.753 0 0 0-4.916 2 10.545 10.545 0 0 1-19.437 0 3.753 3.753 0 1 0-6.917 2.916 18.051 18.051 0 0 0 33.271 0 3.754 3.754 0 0 0-2.001-4.916Z"}),n.createElement("path",{"data-name":"Trac\\xE9 8752",d:"M200.104 27.198h8.229v8.229a3.753 3.753 0 0 0 7.507 0v-8.229h8.229a3.753 3.753 0 0 0 0-7.507h-8.229v-8.229a3.753 3.753 0 0 0-7.507 0v8.229h-8.229a3.753 3.753 0 0 0 0 7.507Z"}),n.createElement("path",{"data-name":"Trac\\xE9 8753",d:"M11.983 100.848a3.753 3.753 0 1 0 7.507 0v-8.229h8.224a3.753 3.753 0 1 0 0-7.506h-8.225v-8.229a3.753 3.753 0 0 0-7.507 0v8.229H3.753a3.753 3.753 0 1 0 0 7.506h8.229Z"}),n.createElement("path",{"data-name":"Trac\\xE9 8754",d:"M243.982 174.313h-8.229v-8.229a3.753 3.753 0 1 0-7.507 0v8.229h-8.229a3.753 3.753 0 0 0 0 7.507h8.229v8.229a3.753 3.753 0 1 0 7.507 0v-8.229h8.229a3.753 3.753 0 0 0 0-7.507Z"})))};function Ce(e){var a=e.instance,i=a.state,l=i.pageIndex,o=i.pageSize,c=i.rowCount,s=void 0===c?a.rows.length:c,u=a.gotoPage,d=a.nextPage,m=a.pageOptions,p=a.previousPage,h=a.canPreviousPage,g=a.canNextPage,f=a.setPageSize,v=n.useCallback((function(e,t){t===l+1?d():t===l-1?p():u(t)}),[u,d,l,p]);return s?r.createElement((function(e){var n=e.count,a=e.page,i=e.rowsPerPage,c=e.onPageChange;return r.createElement("div",{className:"d-flex justify-content-end pagination"},r.createElement("div",{className:"d-flex align-items-center"},"Lignes par page :",r.createElement("select",{value:o,onChange:function(e){f(Number(e.target.value))}},[10,20,30,40,50,250].map((function(e){return r.createElement("option",{key:e,value:e},e)})))),r.createElement("button",{className:"btn",onClick:function(e){c(e,0)},disabled:!h},r.createElement(t.AngleDoubleSmallLeftIcon,{height:20,width:20})),r.createElement("button",{className:"btn",onClick:function(e){c(e,a-1)},disabled:!h},r.createElement(t.AngleSmallLeftIcon,{height:20,width:20})),r.createElement("span",{className:"d-flex align-items-center"},"Page ",l+1," sur ",m.length),r.createElement("button",{className:"btn",onClick:function(e){c(e,a+1)},disabled:!g},r.createElement(t.AngleSmallRightIcon,{height:20,width:20})),r.createElement("button",{className:"btn",onClick:function(e){c(e,Math.max(0,Math.ceil(n/i)-1))},disabled:!g},r.createElement(t.AngleDoubleSmallRightIcon,{height:20,width:20})))}),{count:s,rowsPerPage:o,page:l,onPageChange:v}):null}var Fe=h.makeStyles(h.createStyles({columnsPopOver:{padding:24,display:"flex"},filtersResetButton:{position:"absolute",top:18,right:21},popoverTitle:{fontWeight:500,padding:"0 24px 24px 0",textTransform:"uppercase"},grid:{display:"grid",gridTemplateColumns:"repeat(2, 218px)","@media (max-width: 600px)":{gridTemplateColumns:"repeat(1, 180px)"},gridColumnGap:24,gridRowGap:24},cell:{width:"100%",display:"flex",flexDirection:"column"},hidden:{display:"none"}}));function Se(e){var t=e.instance,n=e.anchorEl,a=e.onClose,l=e.show,o=Fe({}),c=t.toggleHideColumn,s=t.allColumns.filter((function(e){return!("_selector"===e.id||"expander"===e.id||"hidecolumns"===e.id)})),u=s.reduce((function(e,t){return e+(t.isVisible?0:1)}),0)+1>=s.length;return s.length>1?r.createElement("div",null,r.createElement(i.Popover,{anchorEl:n,id:"popover-filters",onClose:a,open:l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},style:{padding:24}},r.createElement("div",{className:o.cell},r.createElement(i.Typography,{className:o.popoverTitle},"Visible Columns"),r.createElement("div",{style:{display:"grid"}},s.map((function(e){return r.createElement(i.FormControlLabel,{key:e.id,control:r.createElement(i.Checkbox,{value:""+e.id,disabled:e.isVisible&&u}),label:e.id,checked:e.isVisible,onChange:function(){return c(e.id,e.isVisible)}})})))))):null}function ke(e){var a=e.setGlobalFilter,i=e.style,l=n.useState(""),c=l[0],s=l[1],u=o.useAsyncDebounce((function(e){a(e||void 0)}),300);return r.createElement(t.StyledSearchInput,{style:i,value:c||"",onChange:function(e){s(e.target.value),u(e.target.value)},placeholder:"Rechercher "})}var Ne=h.makeStyles((function(e){return h.createStyles({toolbar:{display:"flex",justifyContent:"space-between",alignItems:"center"},leftButtons:{},rightButtons:{},leftIcons:{"&:first-of-type":{marginLeft:-12}},rightIcons:{padding:12,marginTop:"-6px",width:48,height:48,"&:last-of-type":{marginRight:-12}}})})),Te=function(e){var t,n=e.icon,a=e.onClick,l=e.label,o=e.enabled,c=void 0===o||o,s=e.variant,u=Ne({});return r.createElement(i.Tooltip,{title:l,"aria-label":l},r.createElement("span",null,r.createElement(i.IconButton,{className:p((t={},t[u.rightIcons]="right"===s,t[u.leftIcons]="left"===s,t)),onClick:a,disabled:!c,size:"large"},n)))};function Ae(e){var a=e.instance,l=e.showGlobalFilter,o=e.showFilter,c=e.showColumnIcon,s=e.filterActive,u=e.setLocalFilterActive,d=e.customJsxSideFilterButton,m=a.columns,p=Ne(),h=n.useState(void 0),g=h[0],f=h[1],v=n.useState(!1),b=v[0],y=v[1],E=n.useState(!1)[1],x=m.filter((function(e){return!("_selector"===e.id)})),w=n.useCallback((function(e){f(e.currentTarget),y(!0)}),[f,y]),C=n.useCallback((function(){y(!1),E(!1),f(void 0)}),[]);return r.createElement(i.Toolbar,{className:l||o||c?p.toolbar:"d-none"},l?r.createElement(ke,{preGlobalFilteredRows:a.preGlobalFilteredRows,setGlobalFilter:a.setGlobalFilter}):null,r.createElement("div",{className:p.rightButtons,style:{display:"flex",alignItems:"center",height:"25"}},r.createElement(Se,{instance:a,onClose:C,show:b,anchorEl:g}),c?x.length>1&&r.createElement(Te,{icon:r.createElement(S,null),onClick:w,label:"Show / hide columns",variant:"right"}):null,o?r.createElement(r.Fragment,null,r.createElement(t.StyledButton,{rounded:!0,variant:"primary",onClick:function(){u(!s)},label:"Filter by columns"},"Filtre(s)")):null,d))}var Le=h.makeStyles({truncated:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}}),Re=function(e){var t=e.text,n=e.tooltip,a=void 0===n?t:n,l=e.align,o=Le({});return r.createElement(i.Tooltip,{title:null!==a?a:" ",className:o.truncated,arrow:!0,style:{textAlign:l}},r.createElement("span",null,t))},Ie=["name","columns","onClick","canGroupBy","canSort","canSelect","canResize","actionColumn","showGlobalFilter","showFilter","showColumnIcon","filterActive","setLocalFilterActive","customJsxSideFilterButton","setSelectedRows","elevationTable","minHeight","maxHeight"],He=["key","title","role"],Be=["key","role"],Oe=["title"],je=["title"],Ge=["key","role"],Pe=["key","role"],De=function(e,t,n){return[e,{style:{justifyContent:"center",alignItems:"center",display:"flex"}}]},ze=function(e,t){return De(e)},Me=function(e,t){return De(e)},_e={Filter:function(e){var a=e.columns,i=e.column,l=e.rows,o=e.prepareRow,c=i.filterValue,s=i.setFilter,u=i.render,d=r.useState(c||"")[1];n.useEffect((function(){d(c||"")}),[c]);var m=l.map((function(e){return o(e),e.cells.filter((function(e){return e.getCellProps().key.replace(/([^\_]*\_){2}/,"")===i.id})).map((function(e){return{label:String(e.value),value:String(e.value)}}))[0]})),p=k(m,"label"),h=function e(t){return t[0].columns?e(t[0].columns):t[0]}(a)===i,g=r.useState([])[1];return r.createElement(r.Fragment,null,r.createElement(t.StyledLabel,{htmlFor:i.id},u("Header")),r.createElement(t.StyledSelectInput,{id:u("Header"),name:u("Header"),options:p,placeholder:"Sélectionner ...",onChange:function(e){g(e),s(e.value)},autoFocus:h}))},Cell:function(e){var t=e.column.align;return r.createElement(Re,{text:e.cell.value,align:void 0===t?"left":t})},Header:function(e){var t=e.column;return r.createElement(r.Fragment,null,t.id.startsWith("_")?null:function(e){for(var t,n="",r=0,a=!0,i=!0;r<e.length;)t=e.charCodeAt(r),0===r?n+=e[r].toUpperCase():!i&&t>=65&&t<=90||!a&&t>=48&&t<=57?(n+=" ",n+=e[r].toUpperCase()):n+=e[r].toLowerCase(),a=t>=48&&t<=57,i=t>=65&&t<=90,r++;return n}(t.id))},minWidth:10,maxWidth:200},qe={fuzzyText:re,numeric:ie},Ve=function(e){e.allColumns.push((function(e){return[{id:"_selector",disableResizing:!0,disableGroupBy:!0,minWidth:45,width:45,maxWidth:45,Aggregated:void 0,Header:function(e){return r.createElement(ee,Object.assign({},(0,e.getToggleAllRowsSelectedProps)()))},Cell:function(e){return r.createElement(te,Object.assign({},e.row.getToggleRowSelectedProps()))}}].concat(e)}))};function Ze(e){var a=e.name,c=e.columns,s=e.onClick,u=e.canGroupBy,d=e.canSort,m=e.canSelect,h=e.canResize,g=e.actionColumn,f=e.showGlobalFilter,v=e.showFilter,b=e.showColumnIcon,y=e.filterActive,E=e.setLocalFilterActive,x=e.customJsxSideFilterButton,w=e.setSelectedRows,S=e.minHeight,k=e.maxHeight,N=R(e,Ie),T=V();null==a&&(a="mytable");var A=ne("tableState:"+a,{}),I=A[0],H=A[1],B=[o.useColumnOrder,o.useFilters,o.useGlobalFilter,o.useGroupBy,o.useSortBy,o.useExpanded,o.useFlexLayout,o.usePagination,o.useResizeColumns,o.useRowSelect];m&&B.push(Ve),void 0!==g&&B.push((function(e){e.allColumns.push((function(e){return[].concat(e,[{id:"hidecolumns",accessor:"hidecolumns",disableResizing:!0,disableGroupBy:!0,disableFilters:!0,disableSortBy:!0,canFilter:!1,minWidth:60,width:60,maxWidth:100,Header:function(){return r.createElement("div",{className:"dropdown"},r.createElement("div",{id:"dropdownHideColomuns","data-bs-toggle":"dropdown"},r.createElement(le,{height:25,width:25})),r.createElement("ul",{className:"dropdown-menu ","aria-labelledby":"dropdownHideColomuns"},r.createElement(ue,{instance:z})))},Cell:function(e){return r.createElement(g,{selectedRow:e.row})}}])}))}));var O,j,G,P,D={filteredIds:[]},z=o.useTable.apply(void 0,[L({},N,{columns:c,filterTypes:qe,defaultColumn:_e,getSubRows:function(e){return e.subRows},globalFilter:function(e,t,n){return function e(t,n,r,a){if(""===r||null==r)return t;if("string"!=typeof r)return[];var i=r.trim().toLocaleLowerCase().split(" ");return t.filter((function(t){if(a&&Array.isArray(a.filteredIds)&&a.filteredIds.some((function(e){return t.id.startsWith(e)})))return a.filteredIds.push(t.id),!0;var l=t.values,o=n.map((function(e){return l&&l[e]})).filter((function(e){return["string","number"].includes(typeof e)})).join(" ").split(" ").filter((function(e){return""!==e})).join(" ").toLocaleLowerCase(),c=i.every((function(e){return o.includes(e)})),s=c||Array.isArray(t.subRows)&&!!e(t.subRows,n,r).length;return c&&a&&Array.isArray(a.filteredIds)&&a.filteredIds.push(t.id),s}))}(e,t,n,D)},initialState:I})].concat(B)),M=z.headerGroups,_=z.getTableBodyProps,q=z.page,Z=z.prepareRow,ee=z.selectedFlatRows,te=(G=(j=n.useState(O=z.state))[0],P=j[1],n.useEffect((function(){var e=setTimeout((function(){P(O)}),200);return function(){clearTimeout(e)}}),[O,200]),G);n.useEffect((function(){H({sortBy:te.sortBy,filters:te.filters,pageSize:te.pageSize,columnResizing:te.columnResizing,hiddenColumns:te.hiddenColumns}),void 0!==w&&w(ee.map((function(e){return e.original})))}),[H,te]);var re=function(e){return function(){s&&!e.column.isGrouped&&!e.row.isGrouped&&"_selector"!==e.column.id&&s(e.row)}},ae=ve();return r.createElement(r.Fragment,null,ae?r.createElement(r.Fragment,null,r.createElement(l.CardHeader,{id:"TablePagination",style:{marginBottom:"2px"},className:f||v||b?T.cardHeaderCss:"d-none"},r.createElement(Ae,Object.assign({instance:z},{showGlobalFilter:f,showFilter:v,showColumnIcon:b,filterActive:y,setLocalFilterActive:E,customJsxSideFilterButton:x})),r.createElement(pe,{instance:z})),r.createElement(l.CardBody,{id:a,style:{marginRight:"0",marginLeft:"0",padding:0,paddingTop:"4px ",minHeight:"100vh"}},r.createElement(se,{props:z})),r.createElement(l.CardFooter,{id:"TablePagination",style:{backgroundColor:"white",padding:"0"}},r.createElement(Ce,{instance:z})),y?r.createElement(Ee,{instance:z,setLocalFilterActive:E,filterActive:y}):null):r.createElement("div",{style:{display:"grid",gridTemplateColumns:y?"2fr 1fr ":"auto",gridColumnGap:"4px"}},r.createElement(l.Card,{style:{border:"0px"}},r.createElement(l.CardHeader,{id:"TableToolbar",className:f||v||b?T.cardHeaderCss:"d-none"},r.createElement(Ae,Object.assign({instance:z},{showGlobalFilter:f,showFilter:v,showColumnIcon:b,filterActive:y,setLocalFilterActive:E,customJsxSideFilterButton:x})),r.createElement(pe,{instance:z})),r.createElement(l.CardBody,{id:a,style:{marginRight:"0",marginLeft:"0",padding:0,paddingTop:"4px !important ",border:"1px solid rgba(0,0,0,.125)"}},r.createElement(i.Grid,{container:!0,id:"tablecontainer",direction:"row",sx:{display:"grid"}},r.createElement(i.TableContainer,{sx:{paddingRight:"0!important",paddingLeft:"0!important",overflowX:"auto",maxHeight:0===k||""===k||void 0===k?"630px":k,minHeight:0===S||""===S||void 0===S?"580px":S},className:"table-responsive"},r.createElement(W,null,r.createElement(U,null,M.map((function(e){var t=e.getHeaderGroupProps(),n=t.key,a=R(t,He);return r.createElement(K,Object.assign({key:n},a),e.headers.map((function(e){var t={textAlign:e.align?e.align:"left "},n=e.getHeaderProps(ze),a=n.key,l=R(n,Be),o=e.getGroupByToggleProps(),c=o.title,s=void 0===c?"":c,m=R(o,Oe),p=e.getSortByToggleProps(),g=p.title,f=void 0===g?"":g,v=R(p,je);return r.createElement(X,Object.assign({key:a},l),u?e.canGroupBy&&r.createElement(i.Tooltip,{title:s},r.createElement(i.TableSortLabel,Object.assign({active:!0,IconComponent:C},m,{className:T.headerIcon}))):null,e.canSort&&d?r.createElement(i.Tooltip,{title:f},r.createElement(i.TableSortLabel,Object.assign({active:e.isSorted,direction:e.isSortedDesc?"desc":"asc"},v,{className:T.tableSortLabel,style:{flexDirection:"row-reverse"}}),e.render("Header"))):r.createElement($,{style:t},e.render("Header")),h?e.canResize&&r.createElement(xe,{column:e}):null)})))}))),r.createElement(J,Object.assign({},_(),{className:0===q.length?T.SvgNoDataCss:""}),0!==q.length?q.map((function(e){Z(e);var t=e.getRowProps(),n=t.key,a=R(t,Ge);return r.createElement(Y,Object.assign({key:n},a,{className:p({rowSelected:e.isSelected,clickable:s})}),e.cells.map((function(t){var n=t.getCellProps(Me),a=n.key,l=R(n,Pe);return r.createElement(Q,Object.assign({key:a},l,{onClick:re(t)}),t.isGrouped?r.createElement(r.Fragment,null,r.createElement(i.TableSortLabel,Object.assign({classes:{iconDirectionAsc:T.iconDirectionAsc,iconDirectionDesc:T.iconDirectionDesc},active:!0,direction:e.isExpanded?"desc":"asc",IconComponent:F},e.getToggleRowExpandedProps(),{className:T.cellIcon}))," ",t.render("Cell",{editable:!1})," (",e.subRows.length,")"):t.isAggregated?t.render("Aggregated"):t.isPlaceholder?null:t.render("Cell"))})))})):null)),r.createElement("div",{className:0===q.length?T.SvgNoDataCss:"d-none"},r.createElement(we,null))))),r.createElement(l.CardFooter,{id:"TablePagination",style:{backgroundColor:"white",border:"1px solid rgba(0,0,0,.125)",borderTop:"0px",borderRadius:"0px 0px 12px 12px"}},r.createElement(Ce,{instance:z}))),y?r.createElement(l.Card,{style:{border:"0px"}},r.createElement(l.CardHeader,{style:{display:"flex",alignItems:"center",maxHeight:"64px !important",justifyContent:"space-between"},className:T.FiltersCss+" "+T.cardHeaderCss},r.createElement(i.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"10px"}},r.createElement(t.FilterIcon,{className:T.tableFilterAltOutlinedIcon,style:{flexDirection:"row-reverse"}}),r.createElement(t.StyledH2,null,"Filtre(s)")),r.createElement(t.CrossIcon,{height:11,width:25,onClick:function(){E(!1)}})),r.createElement(l.CardBody,{id:"filterbody",style:{marginRight:"0",marginLeft:"0",padding:0,paddingTop:"4px !important ",border:"1px solid rgba(0,0,0,.125)",backgroundColor:"white",borderTop:"1px solid rgba(0,0,0,.125)",borderRadius:"0px 0px 12px 12px "}},r.createElement(ye,{instance:z,setLocalFilterActive:E,filterActive:y}))):null))}exports.DynamicTable=function(e){var a=e.url,i=e.name,l=e.actionColumn,o=e.canGroupBy,c=e.canSort,s=e.canResize,u=e.canExpand,d=e.canSelect,m=e.showGlobalFilter,p=e.showFilter,h=e.showColumnIcon,g=e.canDeleteOrDuplicate,f=e.arrayOfCustomColumns,v=e.filterActive,b=e.setLocalFilterActive,y=e.customJsxSideFilterButton,E=e.onClick,x=e.elevationTable,w=e.setSelectedRows,C=e.setDataIsUpdated,F=e.dataIsUpdated,S=e.minHeight,k=e.maxHeight,T=n.useState(),R=T[0],I=T[1],j=n.useState(!0),G=j[0],P=j[1],D=n.useState(null),z=D[0],M=D[1],_=V();function q(){return(q=A(H.mark((function e(t){return H.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,N.get(t).then((function(e){I(e.data)})).catch((function(e){M(e)})).finally((function(){P(!1)}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}void 0===x&&(x=0);var Z=n.useMemo((function(){return void 0!==R&&void 0!==R.structure&&Array.isArray(null==R?void 0:R.structure)?R.structure.filter((function(e){return"subRows"!==e})).map((function(e){return"image"===e||"picture"===e?{id:e,Header:e,accessor:e,disableFilters:!0,canFilter:!1,Cell:function(e){return r.createElement("img",{src:e.cell.value,className:"w-50",alt:""})}}:{id:e,Header:e,accessor:e,aggregate:"count",primary:!1,canFilter:!0,Aggregated:function(e){return e.cell.value+" "}}})):[]}),[R]),W=n.useMemo((function(){var e=Z;return u&&(e=[{id:"expander",Header:"",minWidth:50,width:60,disableResizing:!0,disableGroupBy:!0,canFilter:!1,disableFilters:!0,Cell:function(e){var n=e.row;return n.canExpand?r.createElement("span",Object.assign({},n.getToggleRowExpandedProps({style:{paddingLeft:2*n.depth+"rem"}})),r.createElement(t.AngleSmallRightIcon,n.isExpanded?{height:25,width:25,className:_.iconDirectionAsc}:{height:25,width:25})):null}}].concat(e)),f&&f.length>0&&f.map((fun