mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
fix: implement lazy loading in select input in filter modal
This commit is contained in:
@@ -70,24 +70,34 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
|||||||
const filterModal = useModal();
|
const filterModal = useModal();
|
||||||
|
|
||||||
// ===== OPTIONS =====
|
// ===== OPTIONS =====
|
||||||
const { options: areaOptions, isLoadingOptions: isLoadingAreas } = useSelect(
|
const {
|
||||||
AreaApi.basePath,
|
options: areaOptions,
|
||||||
'id',
|
isLoadingOptions: isLoadingAreas,
|
||||||
'name',
|
setInputValue: setAreaInputValue,
|
||||||
'search'
|
loadMore: loadMoreArea,
|
||||||
);
|
} = useSelect(AreaApi.basePath, 'id', 'name', 'search');
|
||||||
|
|
||||||
const { options: supplierOptions, isLoadingOptions: isLoadingSuppliers } =
|
const {
|
||||||
useSelect(SupplierApi.basePath, 'id', 'name', 'search', {
|
options: supplierOptions,
|
||||||
category: 'SAPRONAK',
|
isLoadingOptions: isLoadingSuppliers,
|
||||||
});
|
setInputValue: setSupplierInputValue,
|
||||||
|
loadMore: loadMoreSupplier,
|
||||||
|
} = useSelect(SupplierApi.basePath, 'id', 'name', 'search', {
|
||||||
|
category: 'SAPRONAK',
|
||||||
|
});
|
||||||
|
|
||||||
const { options: productOptions, isLoadingOptions: isLoadingProducts } =
|
const {
|
||||||
useSelect(ProductApi.basePath, 'id', 'name', 'search');
|
options: productOptions,
|
||||||
|
isLoadingOptions: isLoadingProducts,
|
||||||
|
setInputValue: setProductInputValue,
|
||||||
|
loadMore: loadMoreProduct,
|
||||||
|
} = useSelect(ProductApi.basePath, 'id', 'name', 'search');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
options: productCategoryOptions,
|
options: productCategoryOptions,
|
||||||
isLoadingOptions: isLoadingProductCategories,
|
isLoadingOptions: isLoadingProductCategories,
|
||||||
|
setInputValue: setProductCategoryInputValue,
|
||||||
|
loadMore: loadMoreProductCategory,
|
||||||
} = useSelect(ProductCategoryApi.basePath, 'id', 'name', 'search');
|
} = useSelect(ProductCategoryApi.basePath, 'id', 'name', 'search');
|
||||||
|
|
||||||
const dataTypeOptions = useMemo(
|
const dataTypeOptions = useMemo(
|
||||||
@@ -907,6 +917,8 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
|||||||
isLoading={isLoadingAreas}
|
isLoading={isLoadingAreas}
|
||||||
isClearable
|
isClearable
|
||||||
className={{ wrapper: 'w-full' }}
|
className={{ wrapper: 'w-full' }}
|
||||||
|
onInputChange={setAreaInputValue}
|
||||||
|
onMenuScrollToBottom={loadMoreArea}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Supplier Filter */}
|
{/* Supplier Filter */}
|
||||||
@@ -926,6 +938,8 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
|||||||
isLoading={isLoadingSuppliers}
|
isLoading={isLoadingSuppliers}
|
||||||
isClearable
|
isClearable
|
||||||
className={{ wrapper: 'w-full' }}
|
className={{ wrapper: 'w-full' }}
|
||||||
|
onInputChange={setSupplierInputValue}
|
||||||
|
onMenuScrollToBottom={loadMoreSupplier}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Product Filter */}
|
{/* Product Filter */}
|
||||||
@@ -945,6 +959,8 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
|||||||
isLoading={isLoadingProducts}
|
isLoading={isLoadingProducts}
|
||||||
isClearable
|
isClearable
|
||||||
className={{ wrapper: 'w-full' }}
|
className={{ wrapper: 'w-full' }}
|
||||||
|
onInputChange={setProductInputValue}
|
||||||
|
onMenuScrollToBottom={loadMoreProduct}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Product Category Filter */}
|
{/* Product Category Filter */}
|
||||||
@@ -964,6 +980,8 @@ const PurchasesPerSupplierTab = ({ tabId }: PurchasesPerSupplierTabProps) => {
|
|||||||
isLoading={isLoadingProductCategories}
|
isLoading={isLoadingProductCategories}
|
||||||
isClearable
|
isClearable
|
||||||
className={{ wrapper: 'w-full' }}
|
className={{ wrapper: 'w-full' }}
|
||||||
|
onInputChange={setProductCategoryInputValue}
|
||||||
|
onMenuScrollToBottom={loadMoreProductCategory}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Filter By Type */}
|
{/* Filter By Type */}
|
||||||
|
|||||||
Reference in New Issue
Block a user