Skip to content

Feature extension #1334

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Added removing folder.
  • Loading branch information
Imiss-U1025 committed Nov 22, 2024
commit c8daa8dd36b84ca17efd20a2e8ddcb52362822a1
1 change: 1 addition & 0 deletions client/packages/lowcoder/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2785,6 +2785,7 @@ export const en = {
"switch": "Switch Component: "
},
"module": {
"folderNotEmpty": "Folder is not empty",
"emptyText": "No Data",
"docLink": "Read More About Modules...",
"documentationText" : "Modules are complete Applications, that can get included and repeated in other Applications and it functions just like a single component. As modules can get embedded, they need to be able to interact with your outside apps or websites. This four settings help to support communication with a Module.",
Expand Down
81 changes: 51 additions & 30 deletions client/packages/lowcoder/src/pages/editor/right/ModulePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {showAppSnapshotSelector} from "@lowcoder-ee/redux/selectors/appSnapshotS
import {DraggableTreeNode, DraggableTreeNodeItemRenderProps} from "@lowcoder-ee/components/DraggableTree/types";
import RefTreeComp from "@lowcoder-ee/comps/comps/refTreeComp";
import { EmptyContent } from "components/EmptyContent";
import {moveToFolder} from "@lowcoder-ee/redux/reduxActions/folderActions";
import {deleteFolder, moveToFolder} from "@lowcoder-ee/redux/reduxActions/folderActions";
import {HomeResInfo} from "@lowcoder-ee/util/homeResUtils";
const ItemWrapper = styled.div`
display: flex;
Expand Down Expand Up @@ -585,42 +585,65 @@ export default function ModulePanel() {
// return <ModuleItem onDrag={onDrag} key={id} meta={meta} />
}

function onDelete(type: boolean, id: string) {
function onDelete(type: boolean, id: string, node: NodeType) {
setDeleteFlag(true);
console.log("1111111111111111111111111", type, id, node);
if (type) {
alert(1);
}
else {
CustomModal.confirm({
title: trans("home.moveToTrash"),
content: transToNode("home.moveToTrashSubTitle", {
type: "",
name: "This file",
}),
onConfirm: () => {
if (node.children.length) {
messageInstance.error(trans("module.folderNotEmpty"))
} else {
try {
dispatch(
recycleApplication(
{
applicationId: id,
folderId: popedItemSourceId,
},
deleteFolder(
{folderId: id, parentFolderId: ""},
() => {
messageInstance.success(trans("success"))

messageInstance.success(trans("home.deleteSuccessMsg"));
},
() => {
messageInstance.error(trans("error"))
}
)
)
setDeleteFlag(false)
},
confirmBtnType: "delete",
okText: trans("home.moveToTrash"),
onCancel: () => setDeleteFlag(false)
});
);
} catch (error) {
console.error("Error: Delete module in extension:", error);
throw error;
}
}
} else {
try {
CustomModal.confirm({
title: trans("home.moveToTrash"),
content: transToNode("home.moveToTrashSubTitle", {
type: "",
name: "This file",
}),
onConfirm: () => {
dispatch(
recycleApplication(
{
applicationId: id,
folderId: popedItemSourceId,
},
() => {
messageInstance.success(trans("success"));

},
() => {
messageInstance.error(trans("error"));
}
)
)
setDeleteFlag(false)
},
confirmBtnType: "delete",
okText: trans("home.moveToTrash"),
onCancel: () => setDeleteFlag(false)
});
} catch (error) {
console.error("Error: Delete module in extension:", error);
throw error;
}
}
return true;
}

return (
Expand Down Expand Up @@ -661,9 +684,7 @@ export default function ModulePanel() {
onCopy={() => onCopy(isFolder, id)}
onSelect={() => onSelect(isFolder, id, resComp)}
onDelete={() => {
if (onDelete(isFolder, id)) {
onDeleteTreeItem();
}
(onDelete(isFolder, id, resComp))
}}
{...otherParams}
/>
Expand Down