fix: update onCount prop to accept parameters for improved functionality in Typeahead and List components

This commit is contained in:
faisolavolut 2025-02-27 14:13:10 +07:00
parent b5e0598a2e
commit e614c4b82c
4 changed files with 8 additions and 4 deletions

View File

@ -270,7 +270,7 @@ export const TypeaheadOptionsBetter: FC<{
console.log({ result }); console.log({ result });
return result; return result;
}} }}
onCount={async () => { onCount={async (params: any) => {
const result: any = const result: any =
typeof onCount === "function" typeof onCount === "function"
? await onCount({ ? await onCount({

View File

@ -62,7 +62,7 @@ export const ListUI: React.FC<any> = ({
name={name} name={name}
content={content} content={content}
onLoad={onLoad} onLoad={onLoad}
onCount={async () => { onCount={async (params: any) => {
const result = await onCount(); const result = await onCount();
local.count = result; local.count = result;
local.render(); local.render();

View File

@ -79,7 +79,7 @@ export const ListUIClean: React.FC<any> = ({
name={name} name={name}
content={content} content={content}
onLoad={onLoad} onLoad={onLoad}
onCount={async () => { onCount={async (params: any) => {
const result = await onCount(); const result = await onCount();
local.count = result; local.count = result;
local.render(); local.render();

View File

@ -261,7 +261,11 @@ export const TableEditBetter: React.FC<any> = ({
} }
> >
<div className="flex items-center h-full flex-grow p-2"> <div className="flex items-center h-full flex-grow p-2">
<span>{col?.header()}</span> <span>
{typeof col?.header === "function"
? col?.header()
: col.header}
</span>
</div> </div>
</HeaderColumn> </HeaderColumn>
); );