diff --git a/packages/core/client/src/block-provider/SharedFilterProvider.tsx b/packages/core/client/src/block-provider/SharedFilterProvider.tsx index a65485348..e267234f2 100644 --- a/packages/core/client/src/block-provider/SharedFilterProvider.tsx +++ b/packages/core/client/src/block-provider/SharedFilterProvider.tsx @@ -17,10 +17,21 @@ export type SharedFilterContextValue = { getFilterParams: (filterStore?: SharedFilterStore) => any; }; +export const getFilterParams = (filterStore?: SharedFilterStore) => { + const newAssociationFilterList = Object.entries(filterStore).map(([key, filter]) => filter); + const newAssociationFilter = newAssociationFilterList.length + ? { + $and: newAssociationFilterList, + } + : {}; + + return newAssociationFilter; +}; + export const SharedFilterContext = createContext({ sharedFilterStore: {}, - setSharedFilterStore: undefined!, - getFilterParams: undefined!, + setSharedFilterStore: () => {}, + getFilterParams, }); export const concatFilter = (f1: SharedFilter, f2: SharedFilter): SharedFilter => { @@ -39,23 +50,14 @@ export const SharedFilterProvider: FC<{ params?: any }> = (props) => { setSharedFilterStoreUnwrap(associationFilter); }; - const getFilterParams = (filterStore?: SharedFilterStore) => { - const newAssociationFilterList = Object.entries(filterStore ?? sharedFilterStore).map(([key, filter]) => filter); - const newAssociationFilter = newAssociationFilterList.length - ? { - $and: newAssociationFilterList, - } - : {}; - - return newAssociationFilter; - }; + const getFilterParamsWrap = (filterStore?: SharedFilterStore) => getFilterParams(filterStore ?? sharedFilterStore); return ( {props.children} diff --git a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.tsx b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.tsx index 57a9cb518..012a3a6b7 100644 --- a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.tsx +++ b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.tsx @@ -43,6 +43,8 @@ export const AssociationFilterItem = (props) => { action: 'list', params: { fields: [labelKey, valueKey], + pageSize: 200, + page: 1, }, }, { @@ -89,7 +91,7 @@ export const AssociationFilterItem = (props) => { const paramFilter = getFilterParams(newAssociationFilterStore); - service.run({ ...service.params?.[0], page: 1, filter: paramFilter }); + service.run({ ...service.params?.[0], pageSize: 200, page: 1, filter: paramFilter }); }; const handleSearchToggle = (e: MouseEvent) => { @@ -179,7 +181,7 @@ export const AssociationFilterItem = (props) => { className={css` & .ant-collapse-content-box { padding: 0 8px !important; - max-height: 200px; + max-height: 400px; overflow: auto; } & .ant-collapse-header {