Skip to content
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

feat: the function of adding and deleting nodes in the outline tree, support undo. #1136

Closed
wants to merge 29 commits into from

Conversation

1degrees
Copy link
Contributor

@1degrees 1degrees commented Feb 21, 2025

the function of adding and deleting nodes in the outline tree, support undo.
(大纲树增加删除功能,支持撤销)

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Chores

    • Removed obsolete linting configurations to streamline development processes.
  • New Features

    • Upgraded the demo package version for improved performance and new capabilities.
  • Documentation

    • Added extensive new documentation covering user guides, developer tutorials, and practical use cases.
    • Introduced detailed walkthroughs on application creation, designer customization, block management, AI integrations, and API usage.
    • Expanded content on workflows, internationalization, and deployment options to help users navigate and leverage the platform efficiently.

Copy link
Contributor

coderabbitai bot commented Feb 21, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request removes obsolete ESLint configuration files and bumps the version of the designer-demo package. In addition, it introduces an extensive set of new and updated documentation files. These changes cover user guides, developer tutorials, API references, and practical cases for various aspects of the TinyEngine low-code platform, including designer usage, component management, plugin development, code generation, and customization of meta services and plugin UIs.

Changes

File(s) Change Summary
.eslintignore, .eslintrc.js Deleted obsolete ESLint configuration files.
designer-demo/package.json Updated version from 2.2.0 to 2.3.0.
docs/README.md Added new README with a structured table of contents for user guides and platform documentation.
docs/about-applications/* New documentation on creating applications (blank/template methods) and developing applications via a visual designer.
docs/about-designer/* Added guides on creating a designer and customizing it (including material packages, themes, and DSL customization).
docs/about-materials/* Introduced documentation for material asset package creation, management, and an overview of materials.
docs/advanced-features/* Added multiple documents covering advanced panel settings, block management, conditional rendering, data source integration (mock/remote), slot usage, AI ChatGPT integration, Page JS/event binding, loop rendering, and util method usage.
docs/api/** Extensive new API documentation for backend and frontend endpoints, including AI functions, app services, data source management, DSL code generation, Canvas API, global layout API, main package API, material API, and settings panel API.
docs/basic-features/* New guides on designer UI modules, frontend application flow, inline style variable binding, internationalization, designer introduction, outline tree, page preview, page management, state management, style settings, and using components.
docs/catalog.json Introduced a JSON catalog to organize documentation chapters, sections, and articles.
docs/development-getting-started/* Added introductory and quick start guides for setting up and debugging TinyEngine (including Java backend integration).
docs/ecosystem-center/* New docs on ecosystem center overview, importing component libraries, publishing blocks, and publishing additional ecosystems (themes, plugins, tools, DSL).
docs/extension-capabilities-overview/* Documents covering meta-services, new architecture (TinyEngine 洛书架构), and registry configuration for extensibility.
docs/extension-capabilities-tutorial/* Comprehensive tutorials for AI plugin configuration, code output customization (including custom page output and official API usage), plugin UI customization, configurator component development, and plugin development.
docs/generateCatalogMd.js Added a script to generate markdown documentation from the JSON catalog.
docs/getting-started/*, docs/practical-cases/*, docs/solutions/* New guides, case studies, and solution documents covering introductory topics, practical design cases (e.g., graphical element arrangement, PDM metadata approval workflows), and block release solutions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Designer
    participant CodeGenService
    participant Plugin
    User->>Designer: Initiates code generation
    Designer->>CodeGenService: Calls generateApp(config)
    CodeGenService->>Plugin: Executes code generation plugins
    Plugin-->>CodeGenService: Returns modified schema
    CodeGenService->>Designer: Sends generated code
    Designer->>User: Displays generated code
Loading
sequenceDiagram
    participant User
    participant Designer
    participant AIChatAPI
    User->>Designer: Opens AI chat window
    Designer->>AIChatAPI: Sends POST /app-center/api/ai/chat
    AIChatAPI-->>Designer: Returns generated page content
    Designer->>User: Renders AI-generated page
Loading

Suggested labels

bug

Suggested reviewers

  • gene9831
  • chilingling

Poem

I'm a little rabbit, hopping through code,
Skipping past ESLint files that once overloaded.
New docs bloom like carrots in rows so neat,
Version bumped high with every line complete.
Through APIs and guides my heart now sings—
Hop along, dear coder, to fresh, budding things!
🐰✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

 ERR_PNPM_OPTIONAL_DEPS_REQUIRE_PROD_DEPS  Optional dependencies cannot be installed without production dependencies

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the enhancement New feature or request label Feb 21, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/plugins/tree/src/Main.vue (2)

30-31: Add confirmation dialog before node deletion.

To prevent accidental deletions, consider adding a confirmation dialog before executing the delete operation.

-              <svg-icon name="delete" @mouseup="delNode(row.rawData)"></svg-icon>
+              <svg-icon name="delete" @mouseup="confirmDelete(row.rawData)"></svg-icon>

Add the confirmation method:

const confirmDelete = (data) => {
  // Use your UI framework's confirmation dialog
  if (confirm('Are you sure you want to delete this node?')) {
    delNode(data)
  }
}

259-270: Add visual distinction for destructive action.

Consider adding a distinct hover color for the delete icon to indicate its destructive nature.

   svg.icon-eye,
   svg.icon-delete,
   svg.icon-eye-invisible {
     visibility: hidden;
   }
   .tree-row:hover {
     svg.icon-eye,
-    svg.icon-delete,
     svg.icon-eye-invisible {
       visibility: unset;
     }
+    svg.icon-delete {
+      visibility: unset;
+      &:hover {
+        color: var(--te-color-error);
+      }
+    }
   }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8d51ad4 and 8adc9a1.

📒 Files selected for processing (1)
  • packages/plugins/tree/src/Main.vue (5 hunks)
🔇 Additional comments (1)
packages/plugins/tree/src/Main.vue (1)

30-31: LGTM! Well-structured implementation of node deletion with undo support.

The changes effectively implement the node deletion feature with proper integration of history management for undo support. The code maintains consistency with the existing patterns and provides a good user experience.

Also applies to: 141-149, 259-270

Comment on lines +141 to +144
const delNode = (data) => {
const { clearSelect } = useCanvas().canvasApi.value
useCanvas().operateNode({
type: 'delete',
id: data.id
})
clearSelect()
useHistory().addHistory()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add error handling to delNode method.

The deletion operation should handle potential failures gracefully.

     const delNode = (data) => {
+      try {
         const { clearSelect } = useCanvas().canvasApi.value
         useCanvas().operateNode({
           type: 'delete',
           id: data.id
         })
         clearSelect()
         useHistory().addHistory()
+      } catch (error) {
+        console.error('Failed to delete node:', error)
+        // Use your UI framework's error notification
+        useMessage().error('Failed to delete node')
+      }
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const delNode = (data) => {
const { clearSelect } = useCanvas().canvasApi.value
useCanvas().operateNode({
type: 'delete',
id: data.id
})
clearSelect()
useHistory().addHistory()
}
const delNode = (data) => {
try {
const { clearSelect } = useCanvas().canvasApi.value
useCanvas().operateNode({
type: 'delete',
id: data.id
})
clearSelect()
useHistory().addHistory()
} catch (error) {
console.error('Failed to delete node:', error)
// Use your UI framework's error notification
useMessage().error('Failed to delete node')
}
}

@chilingling
Copy link
Member

@gene9831 Please help with the review.

gene9831
gene9831 previously approved these changes Mar 12, 2025
@gene9831
Copy link
Collaborator

可以在pr comment中补充个图片或者gif,展示效果

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


You can add a picture or gif in the pr comment to display the effect

@chilingling
Copy link
Member

@1degrees git commit 没有正确配置成 GitHub 用户,看看要不要修改一下 。(配置正确的话,后续可以通过代码的 git comit 记录索引到对应的GitHub用户)
image

hexqi and others added 21 commits March 13, 2025 16:56
修复拖拽Header组件会导致内容消失的 bug
修改样式问题
1.区块设置->事件设置 去掉无必要滚动条显示
2.数据源下拉校验错位
…vas (opentiny#1169)

修复嵌套路由预览下拉列表弹出后,无法通过点击画布内部来关闭的 bug
…opentiny#1172)

允许页面未锁定时通过点击大纲树 hover 和 选中节点。
* fix: 修复暗色主题部分不兼容的样式
处理区块字段 assets为undefined的情况
暗色主题下样式调整
1.下拉框面板背景
2.折叠面板图标
3.消息提示文字颜色
4.固定面板图标
5.按钮hover背景
* fix: 修复页面区块预览失效问题

* fix:fix review
Co-authored-by: 张啸 <xiaozhang20@iflytek.com>
修复: 数据源绑定时,将数据源初始化的State 和原有State错误更新,导致功能无效,Schame沉余无用数据
* fix:拆包之后packages字段丢失

* feat:合并物料时将package信息写入bundle.json

---------

Co-authored-by: mjzhu4 <mjzhu4@kxdigit.com>
chilingling and others added 8 commits March 13, 2025 16:56
修复文案为空时 i18n 下的文案为 null 导致出码异常,新增判断条件,默认为空对象
…ets. Also, there can be two components within one snippet (with the same componentName but different snippetName) (opentiny#1212)

* 拆包的时候一个组件在多个分组里面也可以一个分组里面存在两个组件(componentName相同, snippetName不同)
…nodes (opentiny#1201)

1. 多选节点进行点击回退剩余一个元素时,框选效果异常
2. 快捷键剪切失效
1. 修改plugin下模块外层类名
2. 复选框选中状态和默认状态大小调整
3. 部分模块滚动条修改
4. 弹窗关闭图标样式调整
…o CLI. (opentiny#1143)

1.修改主题切换逻辑,默认值改成从注册表中的themes获取。
只有亮色和暗色两种默认主题的情况下,保持原来的逻辑,点击直接切换主题
用户添加了自定义主题,出现选择列表,在列表中切换主题
2.添加新主题模板
在终端中,用命令创建新主题,选择theme类型,添加主题模板,输入主题名称:demo-theme
在demo-theme下可以看到新创建的主题,cd demo-theme && pnpm i
将主题接入设计器
…#1145)

项目ts改造基础,使用eslint9+typescript。在@vue/eslint-config-typescript默认配置上进行修改
@1degrees 1degrees force-pushed the feat/outlineTreeAddDelBtn branch from 61f7067 to 2031b1a Compare March 13, 2025 09:03
@1degrees 1degrees closed this Mar 13, 2025
@1degrees 1degrees deleted the feat/outlineTreeAddDelBtn branch March 13, 2025 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants