From 5abafc2bfd493f4654ac1747266a3814a451afe3 Mon Sep 17 00:00:00 2001 From: mahdi andalib Date: Tue, 8 Mar 2022 14:18:11 +0330 Subject: [PATCH] update --- src/components/ReactTable5/BasicTable.js | 77 ++++++++++++++---------- src/components/ReactTable5/COLUMNS.js | 7 +++ 2 files changed, 53 insertions(+), 31 deletions(-) diff --git a/src/components/ReactTable5/BasicTable.js b/src/components/ReactTable5/BasicTable.js index b3f9900..c3a0dca 100644 --- a/src/components/ReactTable5/BasicTable.js +++ b/src/components/ReactTable5/BasicTable.js @@ -33,6 +33,10 @@ import { useExpanded, } from "react-table"; +export function CheckBox({}) { + return ; +} + const BasicTable = ({ settingsIcon, thead, @@ -129,24 +133,24 @@ const BasicTable = ({ useSortBy, useExpanded, usePagination, - useRowSelect, - (hooks) => { - hooks.visibleColumns.push((columns) => { - return [ - { - id: "selection", - className: "w-7", - Header: ({ getToggleAllRowsSelectedProps }) => ( - - ), - Cell: ({ row }) => ( - - ), - }, - ...columns, - ]; - }); - } + useRowSelect + // (hooks) => { + // hooks.visibleColumns.push((columns) => { + // return [ + // { + // id: "selection", + // className: "w-7", + // Header: ({ getToggleAllRowsSelectedProps }) => ( + // + // ), + // Cell: ({ row }) => ( + // + // ), + // }, + // ...columns, + // ]; + // }); + // } ); const { globalFilter, pageIndex, pageSize } = state; @@ -154,7 +158,7 @@ const BasicTable = ({ const [activeList, setActiveList] = useState(false); return ( - <> +
{/*
{listView.map((list, i) => ( ))}
{" "} */} - setActiveList(false)} - /> - setActiveList(true)} - /> +
+ {/* select View list */} +
+ setActiveList(false)} + /> + setActiveList(true)} + /> +
+
{/* right box */} @@ -244,6 +253,7 @@ const BasicTable = ({ {activeTab == 0 ? ( <> {activeList === false && ( + // table

{item.fileName}

@@ -396,7 +406,7 @@ const BasicTable = ({ columns={defaultColumn} /> )} - + ); }; @@ -408,4 +418,9 @@ BasicTable.defaultProps = { thead: false, goToPage: false, showMore: false, + + // listView: [ + // { icon: grid, click: () => setActiveList(false) }, + // { icon: list, click: () => setActiveList(true) }, + // ], }; diff --git a/src/components/ReactTable5/COLUMNS.js b/src/components/ReactTable5/COLUMNS.js index e250f90..54e254c 100644 --- a/src/components/ReactTable5/COLUMNS.js +++ b/src/components/ReactTable5/COLUMNS.js @@ -1,5 +1,7 @@ import { format } from "date-fns"; +import BasicTable, { CheckBox } from "../ReactTable5/BasicTable"; + import { OrderStatus } from "./OrderStatus"; import { OrderLevel } from "./OrderLevel"; import { Buttons } from "./Buttons"; @@ -9,6 +11,11 @@ import { SelectColumnFilter2 } from "./SelectColumnFilter2.js"; import { SliderColumnFilter } from "./SliderColumnFilter.js"; export const COLUMNS = ({ setFiltering, filtering, addTab }) => [ + { + Header: "چک باکس", + accessor: CheckBox, + className: "bg-red-100 w-7", + }, { Header: "ایکن فایل", accessor: "filePic",