change size
This commit is contained in:
@@ -30,6 +30,7 @@ function MuiDatePicker({ label, value, setFieldValue, name, minDate, maxDate, he
|
||||
maxDate={maxDate ? new Date(maxDate) : null}
|
||||
slotProps={{
|
||||
textField: {
|
||||
size: 'small',
|
||||
error: error,
|
||||
placeholder: placeholder,
|
||||
InputProps: {
|
||||
@@ -60,9 +61,9 @@ function MuiDatePicker({ label, value, setFieldValue, name, minDate, maxDate, he
|
||||
},
|
||||
}}
|
||||
/>
|
||||
<FormHelperText id="component-helper-text" sx={{ ml: 2, color: error ? "#d32f2f" : "unset" }}>
|
||||
{/* <FormHelperText id="component-helper-text" variant="caption" sx={{ ml: 2, color: error ? "#d32f2f" : "unset", fontWeight: 'bold' }}>
|
||||
{helperText ? helperText : ""}
|
||||
</FormHelperText>
|
||||
</FormHelperText> */}
|
||||
</LocalizationProvider>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -1,46 +1,32 @@
|
||||
"use client";
|
||||
|
||||
import { FormControl, FormHelperText, InputLabel, MenuItem, OutlinedInput, Select, Typography } from "@mui/material";
|
||||
import { useEffect, useMemo } from "react";
|
||||
|
||||
function CustomSelect({ column, dependencyFieldValue, filterParameters, defaultFilterTranslation, handleChange }) {
|
||||
const columnSelectOption = useMemo(() => {
|
||||
return column?.columnSelectOption?.(dependencyFieldValue) || [];
|
||||
}, [dependencyFieldValue]);
|
||||
|
||||
useEffect(() => {
|
||||
const isValidValue = columnSelectOption.some((option) => option.value === filterParameters.value);
|
||||
if (!isValidValue) {
|
||||
handleChange({ ...filterParameters, value: "" });
|
||||
}
|
||||
}, [columnSelectOption, filterParameters.value, handleChange]);
|
||||
|
||||
const isValidValue = columnSelectOption.some((option) => option.value === filterParameters.value);
|
||||
const selectedValue = isValidValue ? filterParameters.value : "";
|
||||
function CustomSelect({ column, filterParameters, defaultFilterTranslation, handleChange }) {
|
||||
|
||||
return (
|
||||
<FormControl fullWidth sx={{ marginY: 1 }}>
|
||||
<FormControl fullWidth sx={{ marginY: 1 }} size="small">
|
||||
<InputLabel id={`label${column.id}`}>{column.header}</InputLabel>
|
||||
<Select
|
||||
labelId={`label${column.id}`}
|
||||
id={column.id}
|
||||
name={`${column.id}.value`}
|
||||
value={selectedValue}
|
||||
value={filterParameters.value}
|
||||
input={<OutlinedInput label={column.header} />}
|
||||
size="small"
|
||||
onChange={(e) => handleChange({ ...filterParameters, value: e.target.value })}
|
||||
>
|
||||
<MenuItem value="">{column.header}</MenuItem>
|
||||
{columnSelectOption.map((option) => (
|
||||
{column.columnSelectOption().map((option) => (
|
||||
<MenuItem key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
<FormHelperText>
|
||||
<Typography variant="button" sx={{ color: "#155175" }}>
|
||||
{/* <FormHelperText>
|
||||
<Typography variant="caption" sx={{ color: "#155175", fontWeight: 'bold' }}>
|
||||
نوع فیلتر: {defaultFilterTranslation}
|
||||
</Typography>
|
||||
</FormHelperText>
|
||||
</FormHelperText> */}
|
||||
</FormControl>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,13 +12,14 @@ function CustomSelectByDependency({
|
||||
columnSelectOption,
|
||||
}) {
|
||||
return (
|
||||
<FormControl fullWidth sx={{ marginY: 1 }}>
|
||||
<FormControl fullWidth sx={{ marginY: 1 }} size="small">
|
||||
<InputLabel id={`label${column.id}`}>{column.header}</InputLabel>
|
||||
<Select
|
||||
labelId={`label${column.id}`}
|
||||
id={column.id}
|
||||
name={`${column.id}.value`}
|
||||
value={value}
|
||||
size="small"
|
||||
input={<OutlinedInput label={column.header} />}
|
||||
onChange={(e) => handleChange({ ...filterParameters, value: e.target.value })}
|
||||
>
|
||||
@@ -28,11 +29,11 @@ function CustomSelectByDependency({
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
<FormHelperText>
|
||||
<Typography variant="button" sx={{ color: "#155175" }}>
|
||||
{/* <FormHelperText>
|
||||
<Typography variant="caption" sx={{ color: "#155175", fontWeight: 'bold' }}>
|
||||
نوع فیلتر: {defaultFilterTranslation}
|
||||
</Typography>
|
||||
</FormHelperText>
|
||||
</FormHelperText> */}
|
||||
</FormControl>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ function CustomSelectMultiple({ column, filterParameters, defaultFilterTranslati
|
||||
};
|
||||
|
||||
return (
|
||||
<FormControl fullWidth sx={{ marginY: 1 }}>
|
||||
<FormControl fullWidth sx={{ marginY: 1 }} size="small">
|
||||
<InputLabel htmlFor="uncontrolled-native" id={`label${column.id}`}>
|
||||
{column.header}
|
||||
</InputLabel>
|
||||
@@ -30,6 +30,7 @@ function CustomSelectMultiple({ column, filterParameters, defaultFilterTranslati
|
||||
id={column.id}
|
||||
value={filterParameters.value}
|
||||
multiple
|
||||
size="small"
|
||||
onChange={(e) => handleChange({ ...filterParameters, value: e.target.value })}
|
||||
renderValue={(selected) => (
|
||||
<Box sx={{ display: "flex", flexWrap: "wrap", gap: 0.5 }}>
|
||||
@@ -46,11 +47,11 @@ function CustomSelectMultiple({ column, filterParameters, defaultFilterTranslati
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
<FormHelperText>
|
||||
<Typography variant="button" sx={{ color: "#155175" }}>
|
||||
{/* <FormHelperText>
|
||||
<Typography variant="caption" sx={{ color: "#155175", fontWeight: 'bold' }}>
|
||||
نوع فیلتر: {defaultFilterTranslation}
|
||||
</Typography>
|
||||
</FormHelperText>
|
||||
</FormHelperText> */}
|
||||
</FormControl>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@ function CustomTextField({
|
||||
onBlur={handleBlur}
|
||||
fullWidth
|
||||
helperText={
|
||||
<Typography variant="button" sx={{ color: "#155175" }}>
|
||||
<Typography variant="caption" sx={{ color: "#155175", fontWeight: 'bold' }}>
|
||||
نوع فیلتر: {defaultFilterTranslation}
|
||||
</Typography>
|
||||
}
|
||||
variant="outlined"
|
||||
size="normal"
|
||||
size="small"
|
||||
sx={{ marginY: 1 }}
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
|
||||
@@ -24,12 +24,12 @@ function CustomTextFieldRange({
|
||||
fullWidth
|
||||
error={touched?.[`${column.id}`]?.value && Boolean(errors?.[`${column.id}`]?.value)}
|
||||
helperText={
|
||||
<Typography variant="button" sx={{ color: "#155175" }}>
|
||||
<Typography variant="caption" sx={{ color: "#155175", fontWeight: 'bold' }}>
|
||||
نوع فیلتر: {defaultFilterTranslation}
|
||||
</Typography>
|
||||
}
|
||||
variant="outlined"
|
||||
size="normal"
|
||||
size="small"
|
||||
sx={{ marginY: 1, marginRight: 1 }}
|
||||
/>
|
||||
<TextField
|
||||
@@ -45,7 +45,7 @@ function CustomTextFieldRange({
|
||||
value={filterParameters.value[1]}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
size="normal"
|
||||
size="small"
|
||||
sx={{ marginY: 1 }}
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
|
||||
Reference in New Issue
Block a user