fixed performance

This commit is contained in:
AmirHossein Mahmoodi
2025-01-22 09:55:46 +03:30
parent 05cf77b915
commit 572d995f15
10 changed files with 42 additions and 46 deletions

View File

@@ -93,7 +93,7 @@ function FilterBody({ columns, drawerState, setDrawerState }) {
{Object.keys(filterData).length > 0 && (
<ScrollBox>
<form onSubmit={handleSubmit(onSubmit)}>
<Box sx={{ px: 1, py: 2 }}>
<Box sx={{ px: 1, py: 3 }}>
{columns.map((column) =>
column.enableColumnFilter ? (
column.dependencyId ? (

View File

@@ -1,8 +1,8 @@
"use client";
import { Box, IconButton, Typography } from "@mui/material";
import CancelIcon from "@mui/icons-material/Cancel";
import FilterAltIcon from "@mui/icons-material/FilterAlt";
import { Box, IconButton, Typography } from "@mui/material";
function FilterHeader({ setDrawerState }) {
return (

View File

@@ -1,11 +1,11 @@
"use client";
import { FormControl, FormHelperText, InputLabel, MenuItem, OutlinedInput, Select, Typography } from "@mui/material";
function CustomSelect({ column, filterParameters, defaultFilterTranslation, handleChange }) {
import { FormControl, InputLabel, MenuItem, OutlinedInput, Select } from "@mui/material";
function CustomSelect({ column, filterParameters, handleChange }) {
return (
<FormControl fullWidth sx={{ marginY: 1 }} size="small">
<InputLabel id={`label${column.id}`}>{column.header}</InputLabel>
<InputLabel id={`label${column.id}`} shrink>{column.header}</InputLabel>
<Select
labelId={`label${column.id}`}
id={column.id}
@@ -14,19 +14,12 @@ function CustomSelect({ column, filterParameters, defaultFilterTranslation, hand
input={<OutlinedInput label={column.header} />}
size="small"
onChange={(e) => handleChange({ ...filterParameters, value: e.target.value })}
displayEmpty
>
<MenuItem value="">{column.header}</MenuItem>
{column.columnSelectOption().map((option) => (
<MenuItem key={option.value} value={option.value}>
{option.label}
</MenuItem>
<MenuItem key={option.value} value={option.value}>{option.label}</MenuItem>
))}
</Select>
{/* <FormHelperText>
<Typography variant="caption" sx={{ color: "#155175", fontWeight: 'bold' }}>
نوع فیلتر: {defaultFilterTranslation}
</Typography>
</FormHelperText> */}
</FormControl>
);
}

View File

@@ -12,8 +12,8 @@ function CustomSelectByDependency({
columnSelectOption,
}) {
return (
<FormControl fullWidth sx={{ marginY: 1 }} size="small">
<InputLabel id={`label${column.id}`}>{column.header}</InputLabel>
<FormControl fullWidth sx={{ my: 1 }} size="small">
<InputLabel id={`label${column.id}`} shrink>{column.header}</InputLabel>
<Select
labelId={`label${column.id}`}
id={column.id}
@@ -22,6 +22,7 @@ function CustomSelectByDependency({
size="small"
input={<OutlinedInput label={column.header} />}
onChange={(e) => handleChange({ ...filterParameters, value: e.target.value })}
displayEmpty
>
{columnSelectOption.map((option) => (
<MenuItem key={option.value} value={option.value}>

View File

@@ -40,6 +40,7 @@ function CustomSelectMultiple({ column, filterParameters, defaultFilterTranslati
</Box>
)}
input={<OutlinedInput label={column.header} />}
InputLabelProps={{ shrink: true }}
>
{columnSelectOption.map((option) => (
<MenuItem key={option.value} value={option.value}>

View File

@@ -18,14 +18,14 @@ function CustomTextField({
onChange={(e) => handleChange({ ...filterParameters, value: e.target.value })}
onBlur={handleBlur}
fullWidth
helperText={
<Typography variant="caption" sx={{ color: "#155175", fontWeight: 'bold' }}>
نوع فیلتر: {defaultFilterTranslation}
</Typography>
}
// helperText={
// <Typography variant="caption" sx={{ color: "#155175", fontWeight: 'bold' }}>
// نوع فیلتر: {defaultFilterTranslation}
// </Typography>
// }
variant="outlined"
size="small"
sx={{ marginY: 1 }}
sx={{ my: 1 }}
InputProps={{
endAdornment: (
<InputAdornment position="end" sx={{ cursor: "pointer" }} onClick={handleOpenFilterBox}>
@@ -33,6 +33,7 @@ function CustomTextField({
</InputAdornment>
),
}}
InputLabelProps={{ shrink: true }}
/>
);
}

View File

@@ -30,7 +30,7 @@ function CustomTextFieldRange({
}
variant="outlined"
size="small"
sx={{ marginY: 1, marginRight: 1 }}
sx={{ my: 1, marginRight: 1 }}
/>
<TextField
id={`${column.id}.value[1]`}
@@ -46,7 +46,7 @@ function CustomTextFieldRange({
fullWidth
variant="outlined"
size="small"
sx={{ marginY: 1 }}
sx={{ my: 1 }}
InputProps={{
endAdornment: (
<InputAdornment position="end" sx={{ cursor: "pointer" }} onClick={handleOpenFilterBox}>

View File

@@ -9,16 +9,14 @@ function FilterColumn({ columns, user_id, page_name, table_name }) {
return (
<>
<FilterButton drawerState={open} setDrawerState={setOpen} />
{open && (
<FilterBody
columns={columns}
drawerState={open}
setDrawerState={setOpen}
user_id={user_id}
page_name={page_name}
table_name={table_name}
/>
)}
<FilterBody
columns={columns}
drawerState={open}
setDrawerState={setOpen}
user_id={user_id}
page_name={page_name}
table_name={table_name}
/>
</>
);
}