From e614c4b82cb3c2cec6c7c5d1f5370cecda01f9d3 Mon Sep 17 00:00:00 2001 From: faisolavolut Date: Thu, 27 Feb 2025 14:13:10 +0700 Subject: [PATCH] fix: update onCount prop to accept parameters for improved functionality in Typeahead and List components --- components/form/field/typeahead-opt-better.tsx | 2 +- components/list/ListUI.tsx | 2 +- components/list/ListUIClean.tsx | 2 +- components/tablelist/TableBetter.tsx | 6 +++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/components/form/field/typeahead-opt-better.tsx b/components/form/field/typeahead-opt-better.tsx index 6b2bdf1..5c30dcf 100644 --- a/components/form/field/typeahead-opt-better.tsx +++ b/components/form/field/typeahead-opt-better.tsx @@ -270,7 +270,7 @@ export const TypeaheadOptionsBetter: FC<{ console.log({ result }); return result; }} - onCount={async () => { + onCount={async (params: any) => { const result: any = typeof onCount === "function" ? await onCount({ diff --git a/components/list/ListUI.tsx b/components/list/ListUI.tsx index c130839..ab92d9d 100644 --- a/components/list/ListUI.tsx +++ b/components/list/ListUI.tsx @@ -62,7 +62,7 @@ export const ListUI: React.FC = ({ name={name} content={content} onLoad={onLoad} - onCount={async () => { + onCount={async (params: any) => { const result = await onCount(); local.count = result; local.render(); diff --git a/components/list/ListUIClean.tsx b/components/list/ListUIClean.tsx index 77fe20a..74181c6 100644 --- a/components/list/ListUIClean.tsx +++ b/components/list/ListUIClean.tsx @@ -79,7 +79,7 @@ export const ListUIClean: React.FC = ({ name={name} content={content} onLoad={onLoad} - onCount={async () => { + onCount={async (params: any) => { const result = await onCount(); local.count = result; local.render(); diff --git a/components/tablelist/TableBetter.tsx b/components/tablelist/TableBetter.tsx index c3ed24b..f8a4d0d 100644 --- a/components/tablelist/TableBetter.tsx +++ b/components/tablelist/TableBetter.tsx @@ -261,7 +261,11 @@ export const TableEditBetter: React.FC = ({ } >
- {col?.header()} + + {typeof col?.header === "function" + ? col?.header() + : col.header} +
);