fix: add forceDisabled prop to Field component for improved disable logic
This commit is contained in:
parent
32a24c9df1
commit
8222744683
|
|
@ -68,6 +68,7 @@ export interface FieldProps {
|
||||||
search?: "api" | "local";
|
search?: "api" | "local";
|
||||||
visibleLabel?: boolean;
|
visibleLabel?: boolean;
|
||||||
autoRefresh?: boolean;
|
autoRefresh?: boolean;
|
||||||
|
forceDisabled?: boolean;
|
||||||
}
|
}
|
||||||
export const Field: React.FC<FieldProps> = ({
|
export const Field: React.FC<FieldProps> = ({
|
||||||
fm,
|
fm,
|
||||||
|
|
@ -99,6 +100,7 @@ export const Field: React.FC<FieldProps> = ({
|
||||||
pagination = true,
|
pagination = true,
|
||||||
search = "api",
|
search = "api",
|
||||||
autoRefresh = false,
|
autoRefresh = false,
|
||||||
|
forceDisabled,
|
||||||
}) => {
|
}) => {
|
||||||
let result = null;
|
let result = null;
|
||||||
const field = useLocal({
|
const field = useLocal({
|
||||||
|
|
@ -135,7 +137,11 @@ export const Field: React.FC<FieldProps> = ({
|
||||||
search,
|
search,
|
||||||
};
|
};
|
||||||
const is_disable =
|
const is_disable =
|
||||||
disabled === false ? false : fm.mode === "view" ? true : disabled;
|
typeof forceDisabled === "boolean"
|
||||||
|
? forceDisabled
|
||||||
|
: fm.mode === "view"
|
||||||
|
? true
|
||||||
|
: disabled;
|
||||||
const error = fm.error?.[name];
|
const error = fm.error?.[name];
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue