jamespot-react-components 1.3.28 → 1.3.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2088,8 +2088,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2088
2088
|
}
|
|
2089
2089
|
}
|
|
2090
2090
|
}
|
|
2091
|
-
|
|
2092
|
-
margin-bottom: -24px;
|
|
2093
2091
|
`,Yv=m(We)`
|
|
2094
2092
|
margin-top: 24px;
|
|
2095
2093
|
`,Zv=m($)`
|
|
@@ -3410,7 +3408,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
3410
3408
|
align-items: center;
|
|
3411
3409
|
justify-content: center;
|
|
3412
3410
|
margin: 50px;
|
|
3413
|
-
`;function Iw(e){return e?e.map(t=>({id:t.name,desc:t.sort==="DESC"})):[]}function b9(e){return e.map(t=>({name:t.id,sort:t.desc?"DESC":"ASC"}))}const sc=e=>{const[t,A]=g.useState(1),[n,r]=g.useState([]),i=g.useMemo(()=>n.length?n:e.data,[e.data,n]),o=g.useMemo(()=>e.columns,[e.columns]),a=g.useRef([]),[l,c]=g.useState(0),[d,u]=g.useState(),[f,h]=g.useState(()=>({pageIndex:0,pageSize:e.config?.pagination&&e.config?.pagination.type!=="loadMore"&&"perPage"in e.config.pagination?e.config.pagination.perPage:10})),p=e?.config?.draggable??!1,v=g.useCallback((Q,R)=>"uri"in Q&&typeof Q.uri=="string"?Q.uri:Q.id&&Q.type?`${Q.type}/${Q.id}`:R.toString(),[]),b=g.useMemo(()=>Iw(e.config?.orders).map(Q=>({id:Q.id,desc:!!Q.desc})),[e.config?.orders]),[w,x]=g.useState(b),B=n9({data:i,columns:o,getRowId:v,manualSorting:e?.config?.manualSortBy??!1,state:{sorting:w,pagination:f},onSortingChange:x,onPaginationChange:h,getCoreRowModel:Y7(),getSortedRowModel:$7(),getPaginationRowModel:_7()});sE(()=>{if(e?.config?.manualSortBy&&e.eventHandlers?.onSort){const Q=(w||[]).map(R=>({id:String(R.id),desc:!!R.desc}));e.eventHandlers.onSort(b9(Q)),a.current=Q}},[w]),g.useEffect(()=>{const Q=Iw(e.config?.orders);ae.deepEqual(Q,a.current)||x(Q.map(R=>({id:R.id,desc:!!R.desc})))},[e.config?.orders]),g.useEffect(()=>{if(e.config?.pagination&&e.config?.pagination.type!=="loadMore"&&"page"in e.config.pagination){const Q=e.config.pagination.page;Q!==void 0&&Q-1!==f.pageIndex&&h(R=>({...R,pageIndex:Q-1}))}},[e.config?.pagination]);const y=(Q,R)=>{d===void 0&&u(Q),c(R);const M=i[Q],k=i.slice();k.splice(Q,1),k.splice(R,0,M),r(k)},C=()=>{if(d===void 0)return;const Q=e.data[d],R=e.data[l],M=l-(d??0)<0?"before":"after";e.eventHandlers?.onDrag&&e.eventHandlers.onDrag(Q,R,M,n),r([]),u(void 0)},E=Q=>{const R=Q.getIsSorted&&Q.getIsSorted()!==!1,M=Q.getIsSorted&&Q.getIsSorted()==="desc";return Q.getCanSort?.()?R?M?s.jsx($,{name:"icon-sort-desc",size:12,color:"grey4"}):s.jsx($,{name:"icon-sort-asc",size:12,color:"grey4"}):s.jsx($,{name:"icon-sort",size:12,color:"grey2"}):""},S=B.getHeaderGroups(),T=B.getRowModel().rows;return s.jsxs(g.Fragment,{children:[s.jsxs(u9,{"data-cy":e.dataCy,className:e.className,loading:e.loading,children:[s.jsx(f9,{children:S.map((Q,R)=>s.jsxs(pl,{children:[p&&s.jsx(Dw,{}),Q.headers.map(M=>{const k=M.column,U=k.getCanSort?k.getCanSort():!1,W=k.getIsSorted?k.getIsSorted()!==!1:!1,G=k.getIsSorted?k.getIsSorted()==="desc":!1;return s.jsxs(Dw,{title:void 0,width:k.columnDef.size,sortable:U,onKeyDown:U?Ae=>{Ae.key==="Enter"&&k.toggleSorting?.()}:void 0,tabIndex:U?0:void 0,"aria-sort":U?W?G?"descending":"ascending":"none":void 0,onClick:k.getToggleSortingHandler(),children:[Bw(M.column.columnDef.header,M.getContext()),U?E(k):""]},M.id)})]},Q.id??`head-${R}`))}),!e.loading&&s.jsx(Ew,{children:s.jsx(p9,{draggable:p,children:T.map((Q,R)=>s.jsx(m9,{index:R,onDrag:y,onDrop:C,draggable:p,"data-rowid":Q.id,children:Q.getVisibleCells().map((M,k)=>s.jsx(Sw,{width:M.column.columnDef.size,children:Bw(M.column.columnDef.cell,M.getContext())},`${Q.id}-${k}`))},Q.id))})}),e.loading&&s.jsx(Ew,{children:s.jsx(pl,{children:s.jsx(Sw,{colSpan:(S[0]?.headers?.length??0)+(p?1:0),children:s.jsx(w9,{children:s.jsx(Ie,{size:"l"})})})},"loader")})]}),e.config?.pagination&&!e.loading?e.config.pagination?.type==="loadMore"?s.jsx(s.Fragment,{children:!e.config.pagination.end&&s.jsx(h9,{children:s.jsx(ue,{onClick:()=>{e.eventHandlers?.onPage?.(t+1),A(t+1)},children:s.jsx(L.FormattedMessage,{id:"GLOBAL_Load_More"})})})}):s.jsx(ic,{activePage:e.config.pagination.page,nbrOfPage:Math.ceil(e.config.pagination.nbResults/e.config.pagination.perPage),clickHandler:Q=>e.eventHandlers?.onPage?.(Q)}):null]})},ml=m.a`
|
|
3411
|
+
`;function Iw(e){return e?e.map(t=>({id:t.name,desc:t.sort==="DESC"})):[]}function b9(e){return e.map(t=>({name:t.id,sort:t.desc?"DESC":"ASC"}))}const sc=e=>{const[t,A]=g.useState(1),[n,r]=g.useState([]),i=g.useMemo(()=>n.length?n:e.data,[e.data,n]),o=g.useMemo(()=>e.columns,[e.columns]),a=g.useRef([]),[l,c]=g.useState(0),[d,u]=g.useState(),[f,h]=g.useState(()=>({pageIndex:0,pageSize:e.config?.pagination&&e.config?.pagination.type!=="loadMore"&&"perPage"in e.config.pagination?e.config.pagination.perPage:10})),p=e?.config?.draggable??!1,v=g.useCallback((Q,R)=>"uri"in Q&&typeof Q.uri=="string"?Q.uri:Q.id&&Q.type?`${Q.type}/${Q.id}`:R.toString(),[]),b=g.useMemo(()=>Iw(e.config?.orders).map(Q=>({id:Q.id,desc:!!Q.desc})),[e.config?.orders]),[w,x]=g.useState(b),B=n9({data:i,columns:o,getRowId:v,manualSorting:e?.config?.manualSortBy??!1,state:{sorting:w,pagination:f},onSortingChange:x,onPaginationChange:h,getCoreRowModel:Y7(),getSortedRowModel:$7(),getPaginationRowModel:_7()});sE(()=>{if(e?.config?.manualSortBy&&e.eventHandlers?.onSort){const Q=(w||[]).map(R=>({id:String(R.id),desc:!!R.desc}));e.eventHandlers.onSort(b9(Q)),a.current=Q}},[w]),g.useEffect(()=>{const Q=Iw(e.config?.orders);ae.deepEqual(Q,a.current)||x(Q.map(R=>({id:R.id,desc:!!R.desc})))},[e.config?.orders]),g.useEffect(()=>{if(e.config?.pagination&&e.config?.pagination.type!=="loadMore"&&"page"in e.config.pagination){const Q=e.config.pagination.page;Q!==void 0&&Q-1!==f.pageIndex&&h(R=>({...R,pageIndex:Q-1}))}},[e.config?.pagination]);const y=(Q,R)=>{d===void 0&&u(Q),c(R);const M=i[Q],k=i.slice();k.splice(Q,1),k.splice(R,0,M),r(k)},C=()=>{if(d===void 0)return;const Q=e.data[d],R=e.data[l],M=l-(d??0)<0?"before":"after";e.eventHandlers?.onDrag&&e.eventHandlers.onDrag(Q,R,M,n),r([]),u(void 0)},E=Q=>{const R=Q.getIsSorted&&Q.getIsSorted()!==!1,M=Q.getIsSorted&&Q.getIsSorted()==="desc";return Q.getCanSort?.()?R?M?s.jsx($,{name:"icon-sort-desc",size:12,color:"grey4"}):s.jsx($,{name:"icon-sort-asc",size:12,color:"grey4"}):s.jsx($,{name:"icon-sort",size:12,color:"grey2"}):""},S=B.getHeaderGroups(),T=g.useMemo(()=>B.getRowModel().rows,[B]);return s.jsxs(g.Fragment,{children:[s.jsxs(u9,{"data-cy":e.dataCy,className:e.className,loading:e.loading,title:e.title,children:[s.jsx(f9,{children:S.map((Q,R)=>s.jsxs(pl,{children:[p&&s.jsx(Dw,{}),Q.headers.map(M=>{const k=M.column,U=k.getCanSort?k.getCanSort():!1,W=k.getIsSorted?k.getIsSorted()!==!1:!1,G=k.getIsSorted?k.getIsSorted()==="desc":!1;return s.jsxs(Dw,{scope:"col",title:void 0,width:k.columnDef.size,sortable:U,onKeyDown:U?Ae=>{Ae.key==="Enter"&&k.toggleSorting?.()}:void 0,tabIndex:U?0:void 0,"aria-sort":U?W?G?"descending":"ascending":"none":void 0,onClick:k.getToggleSortingHandler(),children:[Bw(M.column.columnDef.header,M.getContext()),U?E(k):""]},M.id)})]},Q.id??`head-${R}`))}),!e.loading&&s.jsx(Ew,{children:s.jsx(p9,{draggable:p,children:T.map((Q,R)=>s.jsx(m9,{index:R,onDrag:y,onDrop:C,draggable:p,"data-rowid":Q.id,children:Q.getVisibleCells().map((M,k)=>s.jsx(Sw,{width:M.column.columnDef.size,children:Bw(M.column.columnDef.cell,M.getContext())},`${Q.id}-${k}`))},Q.id))})}),e.loading&&s.jsx(Ew,{children:s.jsx(pl,{children:s.jsx(Sw,{colSpan:(S[0]?.headers?.length??0)+(p?1:0),children:s.jsx(w9,{children:s.jsx(Ie,{size:"l"})})})},"loader")})]}),e.config?.pagination&&!e.loading?e.config.pagination?.type==="loadMore"?s.jsx(s.Fragment,{children:!e.config.pagination.end&&s.jsx(h9,{children:s.jsx(ue,{onClick:()=>{e.eventHandlers?.onPage?.(t+1),A(t+1)},children:s.jsx(L.FormattedMessage,{id:"GLOBAL_Load_More"})})})}):s.jsx(s.Fragment,{children:e.config.pagination.nbResults>e.config.pagination.perPage&&s.jsx(ic,{activePage:e.config.pagination.page,nbrOfPage:Math.ceil(e.config.pagination.nbResults/e.config.pagination.perPage),clickHandler:Q=>e.eventHandlers?.onPage?.(Q)})}):null]})},ml=m.a`
|
|
3414
3412
|
flex: 1;
|
|
3415
3413
|
flex-direction: row;
|
|
3416
3414
|
display: flex;
|