diff --git a/src/App.js b/src/App.js index f946e28..d7c0dfa 100644 --- a/src/App.js +++ b/src/App.js @@ -89,7 +89,7 @@ function App() { {/* */} {/* */} {/* */} - {/* */} + {/* */} {/* */} diff --git a/src/components/ReactTable4/NumberRangeColumnFilter.js b/src/components/ReactTable4/NumberRangeColumnFilter.js deleted file mode 100644 index 591cdb1..0000000 --- a/src/components/ReactTable4/NumberRangeColumnFilter.js +++ /dev/null @@ -1,59 +0,0 @@ -import React from "react"; - -const NumberRangeColumnFilter = ({ - column: { filterValue = [], preFilteredRows, setFilter, id }, -}) => { - const [min, max] = React.useMemo(() => { - let min = preFilteredRows.length ? preFilteredRows[0].values[id] : 0; - let max = preFilteredRows.length ? preFilteredRows[0].values[id] : 0; - preFilteredRows.forEach((row) => { - min = Math.min(row.values[id], min); - max = Math.max(row.values[id], max); - }); - return [min, max]; - }, [id, preFilteredRows]); - - return ( -
- { - const val = e.target.value; - setFilter((old = []) => [ - val ? parseInt(val, 10) : undefined, - old[1], - ]); - }} - placeholder={`Min (${min})`} - style={{ - width: "70px", - marginRight: "0.5rem", - }} - /> - to - { - const val = e.target.value; - setFilter((old = []) => [ - old[0], - val ? parseInt(val, 10) : undefined, - ]); - }} - placeholder={`Max (${max})`} - style={{ - width: "70px", - marginLeft: "0.5rem", - }} - /> -
- ); -}; - -export default NumberRangeColumnFilter; diff --git a/src/components/ReactTable4/columns.js b/src/components/ReactTable4/columns.js index aa5189b..23f9913 100644 --- a/src/components/ReactTable4/columns.js +++ b/src/components/ReactTable4/columns.js @@ -7,7 +7,6 @@ import { EditButtons } from "./EditButtons"; import { SelectColumnFilter } from "./SelectColumnFilter.js"; import { SelectColumnFilter2 } from "./SelectColumnFilter2.js"; import { SliderColumnFilter } from "./SliderColumnFilter.js"; -import NumberRangeColumnFilter from "./NumberRangeColumnFilter"; export const COLUMNS = ({ setFiltering, filtering, addTab }) => [ { @@ -20,8 +19,7 @@ export const COLUMNS = ({ setFiltering, filtering, addTab }) => [ Header: "تاریخ سفارش", Footer: "ستون تاریخ سفارش", accessor: "order_date", - // Filter: SliderColumnFilter, - Filter: NumberRangeColumnFilter, + Filter: SliderColumnFilter, Cell: ({ value }) => { return format(new Date(value), "dd/MM/yyyy"); }, @@ -30,7 +28,7 @@ export const COLUMNS = ({ setFiltering, filtering, addTab }) => [ Header: "مبلغ سفارش", Footer: "ستون مبلغ سفارش", accessor: "order_price", - Filter: NumberRangeColumnFilter, + Filter: SliderColumnFilter, }, { Header: "شماره سفارش", @@ -58,7 +56,7 @@ export const COLUMNS = ({ setFiltering, filtering, addTab }) => [ }, { Header: () => EditButtons({ setFiltering, filtering, addTab }), - Footer: "ستون ویرایش", + Footer: "ستون ", accessor: "edit", Cell: ({ row }) => Buttons({ row, addTab }), disableSortBy: true, diff --git a/src/components/ReactTable4/index.js b/src/components/ReactTable4/index.js index 435b4c0..18e709c 100644 --- a/src/components/ReactTable4/index.js +++ b/src/components/ReactTable4/index.js @@ -32,7 +32,6 @@ const ReactTable4 = ({ breadCrumbs, subTitle, title }) => { return (
- {/* breadCrumb */}
{breadCrumbs.map((breadCrumb, index) => (