Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature pagination#1374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
FalkWolsky merged 5 commits intodevfromfeature-pagination
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ import { useDispatch, useSelector } from "react-redux";
import { useParams } from "react-router-dom";
import { HomeBreadcrumbType, HomeLayout } from "./HomeLayout";
import {useEffect, useState} from "react";
import {ApplicationMeta, FolderMeta} from "../../constants/applicationConstants";
import {ApplicationCategoriesEnum,ApplicationMeta, FolderMeta} from "../../constants/applicationConstants";
import { buildFolderUrl } from "../../constants/routesURL";
import { folderElementsSelector, foldersSelector } from "../../redux/selectors/folderSelector";
import { Helmet } from "react-helmet";
Expand DownExpand Up@@ -46,6 +46,7 @@ export function FolderView() {
const [typeFilter, setTypeFilter] = useState<number>(0);
const [modify, setModify] = useState(true);
const [searchValue, setSearchValue] = useState("");
const [categoryFilter, setCategoryFilter] = useState<ApplicationCategoriesEnum | "All">("All");

const dispatch = useDispatch();

Expand All@@ -68,6 +69,7 @@ export function FolderView() {
pageSize:pageSize,
applicationType: ApplicationPaginationType[typeFilter],
name: searchValues,
category: categoryFilter === "All" ? "" : categoryFilter
}).then(
(data: any) => {
if (data.success) {
Expand All@@ -80,7 +82,7 @@ export function FolderView() {
} catch (error) {
console.error('Failed to fetch data:', error);
}
}, [currentPage, pageSize, searchValues, typeFilter, modify]);
}, [currentPage, pageSize, searchValues, typeFilter, modify, categoryFilter]);

useEffect( () => {
if (searchValues !== "")
Expand DownExpand Up@@ -113,6 +115,7 @@ export function FolderView() {
setTypeFilterPagination={setTypeFilter}
setModify={setModify}
modify={modify}
setCategoryFilterPagination={setCategoryFilter}
/>
</>
);
Expand Down
35 changes: 19 additions & 16 deletionsclient/packages/lowcoder/src/pages/ApplicationV2/HomeLayout.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -316,6 +316,9 @@ export interface HomeLayoutProps {
searchValue?: string;
setSearchValue?: any;
setTypeFilterPagination?: any;
setCategoryFilterPagination?: any;
setIsCreated?: any;
isCreated?: boolean;
setModify?: any;
modify?: boolean;
}
Expand All@@ -334,10 +337,15 @@ export function HomeLayout(props: HomeLayoutProps) {
setSearchValue,
total,
setTypeFilterPagination,
setCategoryFilterPagination,
setModify,
modify
modify,
setIsCreated,
isCreated

} = props;


const handlePageChange = (page: number) => {
setCurrentPage(page);
};
Expand DownExpand Up@@ -429,15 +437,6 @@ export function HomeLayout(props: HomeLayoutProps) {
}
return true;
})
.filter((e) => {
// If "All" is selected, do not filter out any elements based on category
if (categoryFilter === 'All' || !categoryFilter) {
return true;
}
// Otherwise, filter elements based on the selected category
return !e.folder && e.category === categoryFilter.toString();
})

.map((e) =>
e.folder
? {
Expand DownExpand Up@@ -469,7 +468,6 @@ export function HomeLayout(props: HomeLayoutProps) {
}
);


const getFilterMenuItem = (type: HomeResTypeEnum) => {
const Icon = HomeResInfo[type].icon;
return {
Expand DownExpand Up@@ -546,17 +544,22 @@ export function HomeLayout(props: HomeLayoutProps) {
getFilterMenuItem(HomeResTypeEnum.Application),
getFilterMenuItem(HomeResTypeEnum.Module),
...(mode !== "marketplace" ? [getFilterMenuItem(HomeResTypeEnum.Navigation), getFilterMenuItem(HomeResTypeEnum.MobileTabLayout)] : []),
...(mode !== "trash" && mode !== "marketplace" ? [getFilterMenuItem(HomeResTypeEnum.Folder)] : []),
...(mode !== "trash" && mode !== "marketplace"&& mode !== "folder"? [getFilterMenuItem(HomeResTypeEnum.Folder)] : []),
]}
getPopupContainer={(node: any) => node}
suffixIcon={<ArrowSolidIcon />} />
)}
{mode === "view" &&
{(mode === "view" || mode === "folder") &&
<FilterDropdown
style={{ minWidth: "220px" }}
variant="borderless"
value={categoryFilter}
onChange={(value: any) => setCategoryFilter(value as ApplicationCategoriesEnum)}
onChange={(value: any) => {
setCategoryFilter(value as ApplicationCategoriesEnum)
setCategoryFilterPagination(value as ApplicationCategoriesEnum);
}

}
options={categoryOptions}
// getPopupContainer={(node) => node}
suffixIcon={<ArrowSolidIcon />}
Expand All@@ -580,7 +583,7 @@ export function HomeLayout(props: HomeLayoutProps) {
style={{ width: "192px", height: "32px", margin: "0" }}
/>
{mode !== "trash" && mode !== "marketplace" && user.orgDev && (
<CreateDropdown defaultVisible={showNewUserGuide(user)} mode={mode} setModify={setModify} modify={modify!} />
<CreateDropdown defaultVisible={showNewUserGuide(user)} mode={mode} setModify={setIsCreated} modify={isCreated!} />
)}
</OperationRightWrapper>
</OperationWrapper>
Expand DownExpand Up@@ -667,7 +670,7 @@ export function HomeLayout(props: HomeLayoutProps) {
? trans("home.projectEmptyCanAdd")
: trans("home.projectEmpty")}
</div>
{mode !== "trash" && mode !== "marketplace" && user.orgDev && <CreateDropdown mode={mode} setModify={setModify} modify={modify!}/>}
{mode !== "trash" && mode !== "marketplace" && user.orgDev && <CreateDropdown mode={mode} setModify={setIsCreated} modify={isCreated!}/>}
</EmptyView>
)}
</>
Expand Down
47 changes: 27 additions & 20 deletionsclient/packages/lowcoder/src/pages/ApplicationV2/HomeView.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@ import { Helmet } from "react-helmet";
import { trans } from "i18n";
import {useState, useEffect } from "react";
import {fetchFolderElements} from "@lowcoder-ee/util/pagination/axios";
import {ApplicationMeta, FolderMeta} from "@lowcoder-ee/constants/applicationConstants";
import {ApplicationCategoriesEnum,ApplicationMeta, FolderMeta} from "@lowcoder-ee/constants/applicationConstants";
import {ApplicationPaginationType} from "@lowcoder-ee/util/pagination/type";

interface ElementsState {
Expand All@@ -21,26 +21,30 @@ export function HomeView() {
const [searchValues, setSearchValues] = useState("");
const [typeFilter, setTypeFilter] = useState<number>(0);
const [modify, setModify] = useState(true);
const [isCreated, setIsCreated] = useState(true);
const [categoryFilter, setCategoryFilter] = useState<ApplicationCategoriesEnum | "All">("All");

useEffect( () => {
try{
fetchFolderElements({
pageNum:currentPage,
pageSize:pageSize,
applicationType: ApplicationPaginationType[typeFilter],
name: searchValues,
}).then(
(data: any) => {
if (data.success) {
setElements({elements: data.data || [], total: data.total || 1})
}
else
console.error("ERROR: fetchFolderElements", data.error)
}
);
} catch (error) {
console.error('Failed to fetch data:', error);
}
}, [currentPage, pageSize, searchValues, typeFilter, modify]
try{
fetchFolderElements({
pageNum:currentPage,
pageSize:pageSize,
applicationType: ApplicationPaginationType[typeFilter],
name: searchValues,
category: categoryFilter === "All" ? "" : categoryFilter
}).then(
(data: any) => {
if (data.success) {
setElements({elements: data.data || [], total: data.total || 1})
}
else
console.error("ERROR: fetchFolderElements", data.error)
}
);
} catch (error) {
console.error('Failed to fetch data:', error);
}
}, [currentPage, pageSize, searchValues, typeFilter, modify, categoryFilter, isCreated]
);

useEffect( () => {
Expand DownExpand Up@@ -79,6 +83,9 @@ export function HomeView() {
setTypeFilterPagination={setTypeFilter}
setModify={setModify}
modify={modify}
setCategoryFilterPagination={setCategoryFilter}
setIsCreated={setIsCreated}
isCreated={isCreated}
/>
</>
);
Expand Down
1 change: 1 addition & 0 deletionsclient/packages/lowcoder/src/util/pagination/type.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -61,6 +61,7 @@ export interface fetchFolderRequestType {
pageSize?: number;
name?: string;
applicationType?: string;
category?: string
}

export interface fetchDBRequestType {
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp