|
|
|
@ -19,6 +19,10 @@ import { GlobalFilter } from "./GlobalFilter"; |
|
|
|
|
import { Checkbox } from "./Checkbox"; |
|
|
|
|
import MOCK_DATA from "./MOCK_DATA.json"; |
|
|
|
|
|
|
|
|
|
import dobleLeftArrow from "./double-left-arrow.svg"; |
|
|
|
|
import leftArrow from "./left-arrow.svg"; |
|
|
|
|
import rightArrow from "./right-arrow.svg"; |
|
|
|
|
|
|
|
|
|
// This is a custom filter UI for selecting
|
|
|
|
|
// a unique option from a list
|
|
|
|
|
export function SelectColumnFilter({ |
|
|
|
@ -146,7 +150,8 @@ const BasicTable = () => { |
|
|
|
|
// const firstPageRows = rows.slice(0, 10);
|
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
<div className="customeClass1"> |
|
|
|
|
{/* filter */} |
|
|
|
|
{/* <div className="customeClass1"> |
|
|
|
|
{headerGroups.map((headerGroup) => |
|
|
|
|
headerGroup.headers.map((column) => |
|
|
|
|
column.Filter ? ( |
|
|
|
@ -156,15 +161,33 @@ const BasicTable = () => { |
|
|
|
|
) : null |
|
|
|
|
) |
|
|
|
|
)} |
|
|
|
|
</div> */} |
|
|
|
|
{/* */} |
|
|
|
|
{/* toggle columns */} |
|
|
|
|
{/* <div> |
|
|
|
|
<div> |
|
|
|
|
<Checkbox {...getToggleHideAllColumnsProps()} /> Toggle All |
|
|
|
|
</div> |
|
|
|
|
{allColumns.map((column) => ( |
|
|
|
|
<div key={column.id}> |
|
|
|
|
<label> |
|
|
|
|
<input type="checkbox" {...column.getToggleHiddenProps()} /> |
|
|
|
|
{column.Header} |
|
|
|
|
</label> |
|
|
|
|
</div> |
|
|
|
|
))} |
|
|
|
|
</div> */} |
|
|
|
|
{/* Change Column Order */} |
|
|
|
|
{/* <button onClick={changeOrder}> Change Column Order </button> */} |
|
|
|
|
<div className="flex flex-row items-center justify-end mb-3 mx-4"> |
|
|
|
|
{/* search box */} |
|
|
|
|
{/* <GlobalFilter filter={globalFilter} setFilter={setGlobalFilter} /> */} |
|
|
|
|
{/* pagination */} |
|
|
|
|
<div |
|
|
|
|
className="border border-blue-400 rounded-sm py-1 px-2 flex flex-items-center" |
|
|
|
|
style={{}} |
|
|
|
|
className="rounded-md py-2 px-4 flex flex-row flex-items-center" |
|
|
|
|
style={{ backgroundColor: "#F1F6FF" }} |
|
|
|
|
> |
|
|
|
|
{/* <GlobalFilter filter={globalFilter} setFilter={setGlobalFilter} /> */} |
|
|
|
|
{/* pagination */} |
|
|
|
|
<div className="flex flex-row flex-items-center bg-white p-1"> |
|
|
|
|
{/* go to page */} |
|
|
|
|
<div> |
|
|
|
|
<input |
|
|
|
@ -188,15 +211,15 @@ const BasicTable = () => { |
|
|
|
|
<div className={`bg-gray-400 w-0.5 my-2 mx-1`}></div> |
|
|
|
|
{/* arrows */} |
|
|
|
|
<button |
|
|
|
|
className="rounded py-1 px-2 mx-1 text-xs" |
|
|
|
|
className="rounded py-1 px-2 mx-1 text-xs font-bold" |
|
|
|
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
|
|
|
|
onClick={() => gotoPage(0)} |
|
|
|
|
disabled={!canPreviousPage} |
|
|
|
|
> |
|
|
|
|
{"<<"} |
|
|
|
|
<img src={dobleLeftArrow} /> |
|
|
|
|
</button> |
|
|
|
|
<button |
|
|
|
|
className="rounded py-1 px-2 mx-1 text-xs" |
|
|
|
|
className="rounded py-1 px-2 mx-1 text-xs font-bold" |
|
|
|
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
|
|
|
|
onClick={() => previousPage()} |
|
|
|
|
disabled={!canPreviousPage} |
|
|
|
@ -204,7 +227,7 @@ const BasicTable = () => { |
|
|
|
|
{"<"} |
|
|
|
|
</button> |
|
|
|
|
<button |
|
|
|
|
className="rounded py-1 px-2 mx-1 text-xs" |
|
|
|
|
className="rounded py-1 px-2 mx-1 text-xs font-bold" |
|
|
|
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
|
|
|
|
onClick={() => nextPage()} |
|
|
|
|
disabled={!canNextPage} |
|
|
|
@ -212,32 +235,19 @@ const BasicTable = () => { |
|
|
|
|
{">"} |
|
|
|
|
</button> |
|
|
|
|
<button |
|
|
|
|
className="rounded py-1 px-2 mx-1 text-xs" |
|
|
|
|
className="rounded py-1 px-2 mx-1 text-xs font-bold" |
|
|
|
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
|
|
|
|
onClick={() => gotoPage(pageCount - 1)} |
|
|
|
|
disabled={!canNextPage} |
|
|
|
|
> |
|
|
|
|
{">>"} |
|
|
|
|
</button> |
|
|
|
|
{/* dobleLeftArrow |
|
|
|
|
leftArrow |
|
|
|
|
import rightArrow from "./right-arrow.svg"; */} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
{/* */} |
|
|
|
|
{/* toggle columns */} |
|
|
|
|
{/* <div> |
|
|
|
|
<div> |
|
|
|
|
<Checkbox {...getToggleHideAllColumnsProps()} /> Toggle All |
|
|
|
|
</div> |
|
|
|
|
{allColumns.map((column) => ( |
|
|
|
|
<div key={column.id}> |
|
|
|
|
<label> |
|
|
|
|
<input type="checkbox" {...column.getToggleHiddenProps()} /> |
|
|
|
|
{column.Header} |
|
|
|
|
</label> |
|
|
|
|
</div> |
|
|
|
|
))} |
|
|
|
|
</div> */} |
|
|
|
|
{/* Change Column Order */} |
|
|
|
|
{/* <button onClick={changeOrder}> Change Column Order </button> */} |
|
|
|
|
<table |
|
|
|
|
{...getTableProps()} |
|
|
|
|
className="min-w-full divide-y divide-gray-200" |
|
|
|
@ -334,12 +344,31 @@ const BasicTable = () => { |
|
|
|
|
</pre> |
|
|
|
|
|
|
|
|
|
<div className="mt-3 "> |
|
|
|
|
<span className="text-sm ml-4"> |
|
|
|
|
{/* <span className="text-sm ml-4"> |
|
|
|
|
صفحه{" "} |
|
|
|
|
<strong className="text-indigo-500"> |
|
|
|
|
{pageIndex + 1} از {pageOptions.length} |
|
|
|
|
</strong> |
|
|
|
|
{""} |
|
|
|
|
</span> */} |
|
|
|
|
<span className="text-sm ml-4"> |
|
|
|
|
صفحه{" "} |
|
|
|
|
<strong className="text-indigo-500"> |
|
|
|
|
<input |
|
|
|
|
className="ml-1 text-xs p-1 rounded border-blue-400" |
|
|
|
|
type="number" |
|
|
|
|
defaultValue={pageIndex + 1} |
|
|
|
|
onChange={(e) => { |
|
|
|
|
const pageNumber = e.target.value |
|
|
|
|
? Number(e.target.value) - 1 |
|
|
|
|
: 0; |
|
|
|
|
gotoPage(pageNumber); |
|
|
|
|
}} |
|
|
|
|
style={{ width: "50px" }} |
|
|
|
|
/>{" "} |
|
|
|
|
از {pageOptions.length} |
|
|
|
|
</strong> |
|
|
|
|
{""} |
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
<select |
|
|
|
|