|
|
|
@ -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,71 +161,7 @@ const BasicTable = () => { |
|
|
|
|
) : null |
|
|
|
|
) |
|
|
|
|
)} |
|
|
|
|
</div> |
|
|
|
|
<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={{}} |
|
|
|
|
> |
|
|
|
|
{/* go to page */} |
|
|
|
|
<div> |
|
|
|
|
<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" }} |
|
|
|
|
/> |
|
|
|
|
<span className={`text-xs`} style={{ color: "#65A9FF" }}> |
|
|
|
|
{" "} |
|
|
|
|
برو به صفحه{" "} |
|
|
|
|
</span> |
|
|
|
|
</div> |
|
|
|
|
{/* */} |
|
|
|
|
<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" |
|
|
|
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
|
|
|
|
onClick={() => gotoPage(0)} |
|
|
|
|
disabled={!canPreviousPage} |
|
|
|
|
> |
|
|
|
|
{"<<"} |
|
|
|
|
</button> |
|
|
|
|
<button |
|
|
|
|
className="rounded py-1 px-2 mx-1 text-xs" |
|
|
|
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
|
|
|
|
onClick={() => previousPage()} |
|
|
|
|
disabled={!canPreviousPage} |
|
|
|
|
> |
|
|
|
|
{"<"} |
|
|
|
|
</button> |
|
|
|
|
<button |
|
|
|
|
className="rounded py-1 px-2 mx-1 text-xs" |
|
|
|
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
|
|
|
|
onClick={() => nextPage()} |
|
|
|
|
disabled={!canNextPage} |
|
|
|
|
> |
|
|
|
|
{">"} |
|
|
|
|
</button> |
|
|
|
|
<button |
|
|
|
|
className="rounded py-1 px-2 mx-1 text-xs" |
|
|
|
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
|
|
|
|
onClick={() => gotoPage(pageCount - 1)} |
|
|
|
|
disabled={!canNextPage} |
|
|
|
|
> |
|
|
|
|
{">>"} |
|
|
|
|
</button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> */} |
|
|
|
|
{/* */} |
|
|
|
|
{/* toggle columns */} |
|
|
|
|
{/* <div> |
|
|
|
@ -238,6 +179,75 @@ const BasicTable = () => { |
|
|
|
|
</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 */} |
|
|
|
|
<div |
|
|
|
|
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 |
|
|
|
|
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" }} |
|
|
|
|
/> |
|
|
|
|
<span className={`text-xs`} style={{ color: "#65A9FF" }}> |
|
|
|
|
{" "} |
|
|
|
|
برو به صفحه{" "} |
|
|
|
|
</span> |
|
|
|
|
</div> |
|
|
|
|
{/* */} |
|
|
|
|
<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 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 font-bold" |
|
|
|
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
|
|
|
|
onClick={() => previousPage()} |
|
|
|
|
disabled={!canPreviousPage} |
|
|
|
|
> |
|
|
|
|
{"<"} |
|
|
|
|
</button> |
|
|
|
|
<button |
|
|
|
|
className="rounded py-1 px-2 mx-1 text-xs font-bold" |
|
|
|
|
style={{ backgroundColor: "#F5F9FF", color: "#65A9FF" }} |
|
|
|
|
onClick={() => nextPage()} |
|
|
|
|
disabled={!canNextPage} |
|
|
|
|
> |
|
|
|
|
{">"} |
|
|
|
|
</button> |
|
|
|
|
<button |
|
|
|
|
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> |
|
|
|
|
</div> |
|
|
|
|
<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 |
|
|
|
|