fix: pageSize 200 & not a function (#1299)
This commit is contained in:
parent
7bfd8ea05b
commit
07a01fc507
@ -17,10 +17,21 @@ export type SharedFilterContextValue = {
|
|||||||
getFilterParams: (filterStore?: SharedFilterStore) => any;
|
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<SharedFilterContextValue>({
|
export const SharedFilterContext = createContext<SharedFilterContextValue>({
|
||||||
sharedFilterStore: {},
|
sharedFilterStore: {},
|
||||||
setSharedFilterStore: undefined!,
|
setSharedFilterStore: () => {},
|
||||||
getFilterParams: undefined!,
|
getFilterParams,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const concatFilter = (f1: SharedFilter, f2: SharedFilter): SharedFilter => {
|
export const concatFilter = (f1: SharedFilter, f2: SharedFilter): SharedFilter => {
|
||||||
@ -39,23 +50,14 @@ export const SharedFilterProvider: FC<{ params?: any }> = (props) => {
|
|||||||
setSharedFilterStoreUnwrap(associationFilter);
|
setSharedFilterStoreUnwrap(associationFilter);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFilterParams = (filterStore?: SharedFilterStore) => {
|
const getFilterParamsWrap = (filterStore?: SharedFilterStore) => getFilterParams(filterStore ?? sharedFilterStore);
|
||||||
const newAssociationFilterList = Object.entries(filterStore ?? sharedFilterStore).map(([key, filter]) => filter);
|
|
||||||
const newAssociationFilter = newAssociationFilterList.length
|
|
||||||
? {
|
|
||||||
$and: newAssociationFilterList,
|
|
||||||
}
|
|
||||||
: {};
|
|
||||||
|
|
||||||
return newAssociationFilter;
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SharedFilterContext.Provider
|
<SharedFilterContext.Provider
|
||||||
value={{
|
value={{
|
||||||
sharedFilterStore,
|
sharedFilterStore,
|
||||||
setSharedFilterStore,
|
setSharedFilterStore,
|
||||||
getFilterParams,
|
getFilterParams: getFilterParamsWrap,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
|
@ -43,6 +43,8 @@ export const AssociationFilterItem = (props) => {
|
|||||||
action: 'list',
|
action: 'list',
|
||||||
params: {
|
params: {
|
||||||
fields: [labelKey, valueKey],
|
fields: [labelKey, valueKey],
|
||||||
|
pageSize: 200,
|
||||||
|
page: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -89,7 +91,7 @@ export const AssociationFilterItem = (props) => {
|
|||||||
|
|
||||||
const paramFilter = getFilterParams(newAssociationFilterStore);
|
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) => {
|
const handleSearchToggle = (e: MouseEvent) => {
|
||||||
@ -179,7 +181,7 @@ export const AssociationFilterItem = (props) => {
|
|||||||
className={css`
|
className={css`
|
||||||
& .ant-collapse-content-box {
|
& .ant-collapse-content-box {
|
||||||
padding: 0 8px !important;
|
padding: 0 8px !important;
|
||||||
max-height: 200px;
|
max-height: 400px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
& .ant-collapse-header {
|
& .ant-collapse-header {
|
||||||
|
Loading…
Reference in New Issue
Block a user