fix: add description prop to Field component and pass filter prop in TableUI and TableList components

This commit is contained in:
faisolavolut 2025-03-12 10:41:59 +07:00
parent 566ab6c206
commit 8a911a9115
3 changed files with 10 additions and 1 deletions

View File

@ -69,6 +69,7 @@ export interface FieldProps {
visibleLabel?: boolean; visibleLabel?: boolean;
autoRefresh?: boolean; autoRefresh?: boolean;
forceDisabled?: boolean; forceDisabled?: boolean;
description?: string;
} }
export const Field: React.FC<FieldProps> = ({ export const Field: React.FC<FieldProps> = ({
fm, fm,
@ -101,6 +102,7 @@ export const Field: React.FC<FieldProps> = ({
search = "api", search = "api",
autoRefresh = false, autoRefresh = false,
forceDisabled, forceDisabled,
description,
}) => { }) => {
let result = null; let result = null;
const field = useLocal({ const field = useLocal({
@ -513,7 +515,11 @@ export const Field: React.FC<FieldProps> = ({
)} )}
</div> </div>
</TooltipBetter> </TooltipBetter>
{description ? (
<div className="text-xs text-gray-500 py-1">{description}</div>
) : (
<></>
)}
{error ? ( {error ? (
<div className="text-sm text-red-500 py-1">{error}</div> <div className="text-sm text-red-500 py-1">{error}</div>
) : ( ) : (

View File

@ -122,6 +122,7 @@ export const TableList = <T extends object>({
onChange, onChange,
filter = true, filter = true,
}: TableListProps<T>) => { }: TableListProps<T>) => {
console.log({ filter });
const [show, setShow] = useState(false as boolean); const [show, setShow] = useState(false as boolean);
const [data, setData] = useState<any[]>([]); const [data, setData] = useState<any[]>([]);
const sideLeft = const sideLeft =

View File

@ -41,6 +41,7 @@ export const TableUI = <T extends object>({
breadcrumb, breadcrumb,
title, title,
ready = true, ready = true,
filter = true,
}: TableUIProps<T>) => { }: TableUIProps<T>) => {
const local = useLocal({ const local = useLocal({
tab: get(tab, "[0].id"), tab: get(tab, "[0].id"),
@ -142,6 +143,7 @@ export const TableUI = <T extends object>({
<div className="w-full flex flex-row flex-grow overflow-hidden "> <div className="w-full flex flex-row flex-grow overflow-hidden ">
{local.show ? ( {local.show ? (
<TableList <TableList
filter={filter}
name={name} name={name}
header={header} header={header}
column={column} column={column}