repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,49 @@ +# AI功能接口 + +## AI生成简单页面 + +<a id=AI生成简单页面> </a> + +### 基本信息 + +**Path:** /app-center/api/ai/chat + +**Method:** POST + +**接口描述:** + +<p>异常响应实例</p> +<p><span class="colour" style="color:rgb(0, 0, 0)">{ "data":</span><span class="colour" style="color:rgb(0, 128, 128)"><span class="colour" style="color:r...
_:hammer_and_wrench: Refactor suggestion_ **Convert HTML error example to Markdown format** The error response example uses HTML formatting with inline styles. Convert it to a proper Markdown code block for better maintainability and consistency. Replace with: ```diff -<p>异常响应实例</p> -<p><span class="colour" style="...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,49 @@ +# AI功能接口 + +## AI生成简单页面 + +<a id=AI生成简单页面> </a> + +### 基本信息 + +**Path:** /app-center/api/ai/chat + +**Method:** POST + +**接口描述:** + +<p>异常响应实例</p> +<p><span class="colour" style="color:rgb(0, 0, 0)">{ "data":</span><span class="colour" style="color:rgb(0, 128, 128)"><span class="colour" style="color:r...
_:hammer_and_wrench: Refactor suggestion_ **Convert response data HTML table to Markdown format** Similar to the request body table, the response data documentation uses an HTML table with complex styling. Convert it to a native Markdown table. Replace with: ```diff -<table> - <thead class="ant-table-thead"> - ...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,22 @@ +### 一、创建引入AI插件的设计器 + +AI生成页面的能力,以可拔插插件的形式,依附在设计器上。同时,AI生成的页面,也将在设计器的画布中渲染出来。 +所以要使用AI生成页面的能力,需要先创建引入了AI插件的设计器,如下图所示。创建设计器参考[此文档](../about-designer/create-designer.md) +![引入AI插件](./imgs/addAiPlugin.png)
_:bulb: Codebase verification_ **Add descriptive English alt text for accessibility and documentation clarity** All referenced images exist in the correct location, but the alt text is currently in Chinese which may not be accessible to all users of the English documentation. Update the alt text to be more descriptiv...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,32 @@ +# 行内绑定状态变量 + +## 使用说明 + +设计器提供了一种功能,允许使用定义变量来动态计算组件的位置。这些计算结果随后可以直接应用到组件的行内样式style属性中,从而实现动态样式的调整和布局的优化。 + +## 操作步骤 + +1. 添加变量,例如:bgcolor,用来控制背景颜色。 + + **图 1** 添加变量 + ![addVar](./imgs/addVar.png) + +2. 画布中选中组件,在组件属性设置面板选择“样式”。 +3. 单击行内样式的编辑框后的![变量绑定图标](./imgs/icon-code.png)。 +4. 在弹框中进行变量绑定。 + + ...
_:warning: Potential issue_ **Fix broken image reference** The image path references a non-existent directory 'not-found'. ```diff - ![绑定变量](not-found/绑定变量.png) + ![绑定变量](./imgs/bindVariable.png) ``` Please ensure the image file exists in the correct location and follows the same naming convention as other image...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,47 @@ +# 循环渲染 + +页面可能有若干份重复的、动态生成的内容,例如商品列表页、表格数据。这时候需要用到循环渲染。您可以在高级面板中指定循环数据绑定的变量、迭代的变量名、索引变量名、以及唯一的key。 + +1. 拖拽组件至画布,例如拖拽一个“段落“组件。 +2. 添加变量,例如loop.isLogin。 + + **图 1** 添加变量 + + ![addVar-17](./imgs/addVar-17.png)
_:hammer_and_wrench: Refactor suggestion_ **Add alt text to improve accessibility** Please add descriptive alt text to all images to improve accessibility. For example: ```diff -![addVar-17](./imgs/addVar-17.png) +![Adding a new variable in the TinyEngine interface](./imgs/addVar-17.png) -![绑定变量-18](./imgs/bindVari...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,45 @@ +## 前言 + +SMB项目立项之初即采取TinyEngine设计器进行开发以及项目管理,其中很多区块以及页面都是在设计器上开发完成的,在积累使用设计器进行应用开发经验的同时也帮助不断完善设计器。下面主要介绍下SMB项目中如何使用设计器进行应用开发。 + +## 基于TinyEngine设计器开发的SMB项目 + +在使用TinyEngine设计器开发SMB项目初期,主要是先了解设计器所具备的能力,重点关注点在组件、区块、页面三个模块。 +这里以SMB项目中的首页举例,首先看下SMB项目中使用设计器搭建的首页部分内容 + +![Alt text](./imgs/smbHome.png)
_:hammer_and_wrench: Refactor suggestion_ **Improve image alt text for accessibility** The current alt text "Alt text" is not descriptive. Consider updating to meaningful descriptions that explain what each image shows. Example improvements: ```diff -![Alt text](./imgs/smbHome.png) +![SMB Project Homepage Screenshot...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,69 @@ +# 如何导入组件库 + +## 介绍 +组件是页面搭建最小的可复用单元,组件库是一系列已经封装好的可复用组件的集合。通过导入第三方组件库,可以利用已经开发好的功能,无需从头开始编写,大大节省了开发时间。同时,这些组件通常经过优化,具有较高的性能和可扩展性。 + +## 导入组件库 + +### 录入组件库基本信息 +![组件库信息](./imgs/componentLibInfo.png) + +| 字段名称 | 描述 | +| --- | --- | +| 组件库名称 | 填写组件库名称,用于列表展示和搜索。 | +| npm包名 | 发布到npm仓库中的组件库包名,可在packag...
_:hammer_and_wrench: Refactor suggestion_ **Fix malformed component ID description** The component ID description contains raw HTML tags which may not render correctly in markdown. Consider using markdown code formatting instead. ```diff -| 组件ID | 决定组件的使用方式<tiny-input></tiny-input> | +| 组件ID | 决定组件的使用方式,例如:`<tiny-i...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,123 @@ +# 注册表 + +## 什么是注册表 + +在 新架构介绍中,我们引入了注册表的概念,二次低代码平台开发用户通过注册表配置元服务元应用,TinyEngine底层引擎读取注册表的配置,完成元应用元服务的定制,然后加载对应的元应用元服务,完成低代码平台的启动。 + +所以注册表就是完成元应用元服务注册、配置、覆盖的TinyEngine提供的底层核心功能。 + +注册表的作用: + +- 接收元应用元服务的配置,传递到低代码底层引擎,完成低代码平台的定制化。 +- 合并默认的元应用元服务的配置项以及用户的自定义配置项。 +- 提供查询能力,使得元服务与元服务之间能够相互通信,或者相关状态变量。 + +...
_:warning: Potential issue_ **Fix variable name typo** The variable name used in `defineEntry()` doesn't match the declared variable name. ```diff -defineEntry(registry) +defineEntry(register) ``` > Committable suggestion skipped: line range outside the PR's diff. <!-- This is an auto-generated comment by CodeRab...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,192 @@ +# 区块发布方案 + +## 介绍 + +### 背景 + +区块发布,就是把区块的实时数据当前状态固定下来,并用相应逻辑将区块schema构建为前端可用的webcomponent,并且将构建结果(区块web component)和区块数据快照保存在block_histories表中的一个动作; + +为了区块webcomponent 能够快捷引用, 服务端将区块的web component 作为一个npm包发布到npm仓库, 同时设计器通过unpkg cdn的方式加载, 利用unpkg服务的版本浮动特性, 解决设计器引入高版本区块时需重新构建的问题。 + +### npm发布 + +通过注册n...
_:hammer_and_wrench: Refactor suggestion_ **Add security considerations for npm token handling.** When discussing npm token generation and usage, include security best practices. Add the following security notes: 1. Use read-only tokens when possible 2. Never commit tokens to version control 3. Rotate tokens period...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,393 @@ +# 区块局域网发布方案 + +在TinyEngine开源后,对私有化部署存在诉求的用户越来越多,而当前TinyEngine多项内容都依托在公网中,当前官网提供的[区块发布方案](./block-release-solution.md),为公网环境下的发布,不能完全满足部分用户的需求。因此需要提供用户能够在内网环境下,也能够正常使用TinyEngine全部功能的方案。 + +现在提出区块发布私有化的两种解决方案给用户自行选择: + +- 公司内部搭建unpkg(npm cdn)和私仓环境,将区块发布到npm私仓中; +- 将区块发布到数据库中,从库中直接读取区块产物。 + +**我们推荐使用第一种...
_:hammer_and_wrench: Refactor suggestion_ **Fix table formatting issues** The table has inconsistent pipe alignments and hard tabs. Convert to proper markdown table format: ```diff -| id |int(10) |自增id -|------ |------ |------| -| file_name |varchar(255) |文件名 -|package_name |varchar...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,117 @@ + +# app-service + +## 传入schema生成代码 + +<a id=传入schema生成代码> </a> + +### 基本信息 + +**Path:** /api/schema2code + +**Method:** POST + +**接口描述:** + + +### 请求参数 + +**Headers** + +| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 | +| ------------ | ---------------- | -------- | ---- | ---- | +| Content-Type | appli...
_:hammer_and_wrench: Refactor suggestion_ **Document error responses and status codes** The API documentation should include possible error responses and HTTP status codes for better error handling by clients. Add a section like: ```markdown ### Error Responses | Status Code | Description | Example Response | |---...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,266 @@ +# 数据源管理 + +## 修改数据源 + +<a id=修改数据源> </a> + +### 基本信息 + +**Path:** /app-center/api/sources/update/:id + +**Method:** POST + +**接口描述:** + + +### 请求参数 + +**Headers** + +| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 | +| ------------ | ---------------- | -------- | ---- | ---- | +| Content-Type | applicati...
_:hammer_and_wrench: Refactor suggestion_ **Document validation rules and constraints** The API documentation should clearly specify validation rules for input parameters. Add validation rules section: ```markdown ### Validation Rules | Parameter | Rules | |-----------|-------| | name | - Must start with letter or...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,266 @@ +# 数据源管理 + +## 修改数据源 + +<a id=修改数据源> </a> + +### 基本信息 + +**Path:** /app-center/api/sources/update/:id + +**Method:** POST + +**接口描述:** + + +### 请求参数 + +**Headers** + +| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 | +| ------------ | ---------------- | -------- | ---- | ---- | +| Content-Type | applicati...
_:warning: Potential issue_ **Fix inconsistent parameter types in response schema** There are inconsistencies in the parameter types between request and response: - `tpl` is `number` in request but `string` in response - `app` is `number` in request but `string` in response Update the response schema to match reques...
tiny-engine
github_2023
javascript
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,45 @@ +const fs = require('fs') +const path = require('path') + +// 读取 catalog.json 文件 +const catalog = require('./catalog.json') + +// 生成 markdown 文件 +function generateMarkdown(catalog) { + let markdown = '# 目录\n' + + catalog.chapters.forEach((chapter) => { + markdown += `\n## ${chapter.title}\n\n` + +...
_🛠️ Refactor suggestion_ **Add error handling for file write operations.** Writing to the filesystem could fail for various reasons (permissions, disk space, etc.). It's important to handle these potential errors gracefully. ```diff // 写入到 markdown 文件 function writeToFile(markdown) { const outputPath = path.join(...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,157 @@ +# 快速上手 + +本篇会讲解两种上手模式:一种是使用Cli工具快速搭建本地项目进行低代码平台开发,另外一种是下载/克隆源码,直接在源码上进行开发。 + +## 一、环境准备 + +在开始上手之前,先确保我们的开发环境以及⼯具齐全: + +- Node.js v18+版本 +- pnpm 包管理⼯具 +- 前端项目代码编辑器 +- git 代码版本管理⼯具 +- chrome浏览器 110+ 版本 +- 以及其他必要的开发前端开发环境、⼯具等。 + + + +## 二、Tiny Engine CLI + + TinyEngine提供了CLI⼯具⽅便⽤户⼆次开发,通过CLI,⼀⾏命令即可基于T...
_🛠️ Refactor suggestion_ **Detailed CLI Setup Instructions with Minor Version Reference Suggestion** The section on using the TinyEngine CLI (lines 18–28) is well written. Note that the command in line 31 uses: ``` npx @opentiny/tiny-engine-cli@latest create ``` According to long-term learnings, the stable vers...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,549 @@ +# 自定义页面出码插件 + +页面出码是整体应用出码中的核心组成部分。关于页面出码也有很多的定制化需求,比如 vue 出码可以选择 composition api 的风格、可以选择 options 的风格,可以选择 return jsx 的出码风格。为了满足二次开发用户自定义页面出码的需求。我们提供两种自定的方式,下面是具体介绍: + +## 自定义插件替换页面出码与区块出码 + +第一种方式,假如用户想出码成 vue options 风格的页面,与官方的出码存在较大差异,则官方建议自定义插件。替换官方的页面出码插件与区块出码插件。 +例如: + +```javascript +import {...
_🛠️ Refactor suggestion_ _⚠️ Potential issue_ **Correct Method Definition in Code Example.** In the code block (lines 10–43), the method definition for `run` is written as ```javascript run: (schema, context) { // ... 自定义出码逻辑 ... } ``` This syntax is invalid in an object literal. Please either use the shor...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,348 @@ +# 插件开发 + +## 插件相关概念 + +在设计器中,插件的范围包括顶部工具栏、左侧插件栏。 +![插件示意图](./imgs/plugin1.png) + +官方实现了很多插件,但是可能无法满足部分人的需求,所以,我们提供插件定制功能,通过插件定制和使用我们提供的能力,可以满足绝大部分人的需求。 + +插件提供的能力: + +- 获取 schema 或操作 schema +- 通过画布暴露的逻辑与画布交互 +- 通过插件面板实现其他自定义逻辑 + +## 插件从开发到上线使用的完整流程 + +- 开发插件 +- 联调 +- 发布插件 +- 在生态中心中录入插件(左侧插件则到插件生态中录入,...
_🛠️ Refactor suggestion_ _⚠️ Potential issue_ **Typo in Insertion API Example:** The code sample for inserting a node (lines 279–296) contains a typo: the function name is spelled as `insertNodde` (line 284). Please correct this to `insertNode` to ensure consistency with the API definition. ```diff - insertNod...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,176 @@ +# 画布模块API + +### 元服务useCanvas + +- `statePageState`:提供reactive对象`statePageState`,描述页面状态主数据,具体数据结构如下: + +``` +{ + currentVm: null, + currentSchema: null, // 当前画布渲染的schema + currentType: null, + pageSchema: null, // 当前画布的原始页面数据 + properties: null, + dataSource: null, + dataSourceMap: null, + isSaved: b...
_🛠️ Refactor suggestion_ _⚠️ Potential issue_ **Canvas API Methods Listing:** The code block (lines 60–136) details the numerous methods available within `canvasApi`. **Critical Issue:** There is a typographical error on line 75 where `setState,,` appears with an extra comma. This could cause confusion in document...
tiny-engine
github_2023
others
917
opentiny
coderabbitai[bot]
@@ -0,0 +1,176 @@ +# 画布模块API + +### 元服务useCanvas +
_🛠️ Refactor suggestion_ **Adjust Heading Levels for Consistency** The file begins with an H1 (`# 画布模块API`), but the subheader on line 3 uses an H3 (`### 元服务useCanvas`). To maintain a logical and accessible heading hierarchy, consider changing the H3 to an H2. ```diff -### 元服务useCanvas +## 元服务useCanvas ``` <!--...
tiny-engine
github_2023
javascript
1,221
opentiny
coderabbitai[bot]
@@ -135,7 +135,7 @@ const handleCopyEvent = (event) => { } const handlerClipboardEvent = (event) => { - const { schema, parent } = getCurrent() + const { schema, parent } = multiSelectedStates.value.slice(-1)[0]
_⚠️ Potential issue_ **Handle empty selection to avoid runtime error.** When `multiSelectedStates.value` is empty, `slice(-1)[0]` returns `undefined`, causing a destructuring error. Consider adding a guard clause, for example: ```diff - const { schema, parent } = multiSelectedStates.value.slice(-1)[0] + const last...
tiny-engine
github_2023
others
1,221
opentiny
SonyLeo
@@ -107,7 +107,15 @@ export default { const containerPanel = ref(null) const insertContainer = ref(false) - const { multiSelectedStates, multiStateLength, toggleMultiSelection } = useMultiSelect() + const { multiSelectedStates, multiStateLength } = useMultiSelect() + + const computedSelectState = c...
建议 multiSelectedStates.value.length 替换为 multiStateLength.value useMultiSelect 中已经定义并导出 multiSelectedStates 的长度 multiStateLength,辛苦看一下
tiny-engine
github_2023
others
1,226
opentiny
coderabbitai[bot]
@@ -181,6 +181,7 @@ export default { state.dividerStyle = { width: '1px', height: `${height}px`, + // FIXME verLeft自带了px left: `${state.verLeft}px`,
_⚠️ Potential issue_ **Fix redundant "px" unit in style value** The `verLeft` property already includes a "px" unit as mentioned in the FIXME comment, but it's being appended again when used in the style object. This will result in invalid CSS like "100pxpx". Apply this fix to correct the CSS value: ```diff - // F...
tiny-engine
github_2023
others
1,214
opentiny
hexqi
@@ -53,33 +53,36 @@ </span> </div> </tiny-form-item> - - <tiny-form-item v-if="pageSettingState.currentPageData.group !== 'publicPages'" prop="isDefault"> - <tiny-checkbox v-model="pageSettingState.currentPageData.isDefault">设为默认页</tiny-checkbox> + <tiny-form-item + v-...
没有子页面时不需要显示这个表单项
tiny-engine
github_2023
javascript
1,214
opentiny
hexqi
@@ -37,7 +37,7 @@ export const requestEvent = (url, params) => { * @returns { Promise } * */ -export const handlePageUpdate = (pageId, params, routerChange, isCurEditPage) => { +export const handlePageUpdate = (pageId, params, routerChange, isCurEditPage, isUpdateTree = true) => {
参数个数太多了需要优化
tiny-engine
github_2023
others
1,214
opentiny
hexqi
@@ -53,33 +53,36 @@ </span> </div> </tiny-form-item> - - <tiny-form-item v-if="pageSettingState.currentPageData.group !== 'publicPages'" prop="isDefault"> - <tiny-checkbox v-model="pageSettingState.currentPageData.isDefault">设为默认页</tiny-checkbox> + <tiny-form-item + v-...
建议有配置默认页时,下面可以再加一行显示实际跳转地址,类似上面当前路由的展示,例如:访问/test 路由默认跳转 /test/{selectedPage}
tiny-engine
github_2023
javascript
1,184
opentiny
gene9831
@@ -34,11 +34,22 @@ const formatScript = (string) => { const options = { parser: 'babel', plugins: [parserBabel], - ...prettierConfig + ...prettierConfig, + filePath: 'tiny-engine.js' } try { - // 低码中的编辑器大多只会输入js值,并不是一个完整的javascript表达式,无法格式化,因此需要特殊处理预格式化该种情形 - newStr = prettier.format(...
代码编辑写入表达时,比如填写应用状态的值,一般代码顶层也只会有一个表达式,只需要在这种场景(判断代码顶层只有一个表达式)采用这种方法去掉格式化自动添加的分号";"。其他编写js代码场景,比如js面板,就正常使用prettier的格式化
tiny-engine
github_2023
javascript
1,184
opentiny
gene9831
@@ -34,11 +34,27 @@ const formatScript = (string) => { const options = { parser: 'babel', plugins: [parserBabel], - ...prettierConfig + ...prettierConfig, + filePath: 'tiny-engine.js' } try { - // 低码中的编辑器大多只会输入js值,并不是一个完整的javascript表达式,无法格式化,因此需要特殊处理预格式化该种情形 - newStr = prettier.format(...
这里没有处理`\r\n`的情况,正则应该为`\r?\n`
tiny-engine
github_2023
javascript
1,184
opentiny
gene9831
@@ -34,11 +34,27 @@ const formatScript = (string) => { const options = { parser: 'babel', plugins: [parserBabel], - ...prettierConfig + ...prettierConfig, + filePath: 'tiny-engine.js' } try { - // 低码中的编辑器大多只会输入js值,并不是一个完整的javascript表达式,无法格式化,因此需要特殊处理预格式化该种情形 - newStr = prettier.format(...
- `.`并不能匹配到换行符,可以替换成`[\s\S]` - 如果首行是注释,比如`// test`,第二行为`[1,2,3]`类似这种的表达式,在去掉包裹的`!()`字符后,会有缩进存在,这里似乎没有处理缩进。可以查看下面的例子https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBCAFAekwAngZxgB0oBtARgBoAmSgZgF0BKESkCABxgEtp9lQAQwBOwiAHcACiIT8UggDbjBAT35sARsMFgA1nBgBlQQFs4AGW5Q4yAGaL8cNhA0ArOGBgB1bR2QgOYThHYQA3G01tPQNDDh0rAHNkGGEAV...
tiny-engine
github_2023
javascript
1,184
opentiny
hexqi
@@ -34,11 +34,27 @@ const formatScript = (string) => { const options = { parser: 'babel', plugins: [parserBabel], - ...prettierConfig + ...prettierConfig, + filePath: 'tiny-engine.js'
这个filePath是必要的吗,这个是用来做什么的?
tiny-engine
github_2023
others
1,184
opentiny
coderabbitai[bot]
@@ -398,14 +410,16 @@ cancel() } - const confirm = () => { - let variableContent = state.isEditorEditMode ? editor.value?.getEditor().getValue() : state.variable + const confirm = async () => { + const editorInstance = editor.value?.getEditor() + await editorInstance.getAction('editor...
_⚠️ Potential issue_ **Use `const` for variable that is never reassigned.** The variable `variableContent` is never reassigned and should use `const` instead of `let`. ```diff - let variableContent = state.isEditorEditMode ? editorInstance.getValue() : state.variable + const variableContent = state.isEdito...
tiny-engine
github_2023
others
1,224
opentiny
chilingling
@@ -87,7 +87,7 @@ export default { const paramsPropPath = (index) => `${index}.params` const paramsStringValidator = (rule, value, callback) => { - if (value && value.split(',').some((param) => !verifyJsVarName(param))) { + if (value && value !== '$rowIndex' && value.split(',').some((param) => !ve...
换成这个正则表达式进行校验 `/^[a-zA-Z_$][0-9a-zA-Z_$]*$/` 允许 `$` 符号开头的变量
tiny-engine
github_2023
others
1,157
opentiny
hexqi
@@ -1,10 +1,19 @@ <template> <div> + <div v-if="componentName === 'TinyTabs'" class="tabs-header">
ContainerConfigurator定位应该是一个通用的设置器组件,需要通过传入配置的方式来实现,不能与TinyTabs组件相绑定
tiny-engine
github_2023
others
1,157
opentiny
hexqi
@@ -1,10 +1,19 @@ <template> <div> + <div v-if="componentName === 'TinyTabs'" class="tabs-header"> + <div>页签标题</div> + <div class="tabs-header-id">页签值</div> + </div> <meta-list-items class="list" :optionsList="children" @dragEnd="dragEnd"> <template #content="{ data }"> <div cla...
有个Bug: 在输入框无法鼠标选中文本,因为会触发拖动,应该只有图标可以拖动
tiny-engine
github_2023
typescript
1,145
opentiny
chilingling
@@ -10,7 +10,7 @@ * */ -import { defineComponent, h, inject, provide, Ref, Suspense } from 'vue' +import { defineComponent, h, inject, provide, type Ref, Suspense } from 'vue'
`import type { Ref } form 'vue'` 会不会更推荐一点?
tiny-engine
github_2023
javascript
1,146
opentiny
coderabbitai[bot]
@@ -127,6 +127,81 @@ export const handleContextInjectHook = (schema, globalHooks) => { value: `${injectLowcode}\n${injectLowcodeWrap}\n${wrapStoresStatement}` }) } +// 提取组件名称处理相关函数 +const componentNameUtils = { + extractComponents(jsContent) { + // Match standalone components and those within namespaces + ...
_:hammer_and_wrench: Refactor suggestion_ **Good implementation of JSX component extraction utility** The componentNameUtils object provides a clean way to extract component names from JSX content. The regex pattern correctly identifies components starting with capital letters, which follows JSX convention. However,...
tiny-engine
github_2023
javascript
1,146
opentiny
coderabbitai[bot]
@@ -127,6 +127,80 @@ export const handleContextInjectHook = (schema, globalHooks) => { value: `${injectLowcode}\n${injectLowcodeWrap}\n${wrapStoresStatement}` }) } +// 提取组件名称处理相关函数 +const componentNameUtils = { + extractComponents(jsContent) { + if (!jsContent) return [] + // 匹配以大写字母开头的组件标签,支持命名空间(如 Tin...
_🛠️ Refactor suggestion_ **Well-structured hook for handling JSX components** The hook correctly extracts component names from JSX content and adds the necessary imports. The implementation looks clean and follows the pattern of other hooks in the file. However, the traverseSchema function lacks depth control and e...
tiny-engine
github_2023
javascript
1,146
opentiny
chilingling
@@ -127,6 +127,80 @@ export const handleContextInjectHook = (schema, globalHooks) => { value: `${injectLowcode}\n${injectLowcodeWrap}\n${wrapStoresStatement}` }) } +// 提取组件名称处理相关函数 +const componentNameUtils = { + extractComponents(jsContent) { + if (!jsContent) return [] + // 匹配以大写字母开头的组件标签,支持命名空间(如 Tin...
这里应该已经有 schema 递归了: https://github.com/opentiny/tiny-engine/blob/66a6d000040db6d23c230b9b0bfe76367ac2545d/packages/vue-generator/src/generator/vue/sfc/generateAttribute.js#L269-L275 看看能不能在这个函数这里处理?
tiny-engine
github_2023
javascript
1,146
opentiny
coderabbitai[bot]
@@ -253,7 +253,19 @@ export const handleAttrKeyHook = (schemaData) => { } }) } - +// 提取组件名称处理相关函数 +const componentNameUtils = { + extractComponents(jsContent) { + if (!jsContent) return [] + // 匹配以大写字母开头的组件标签,支持命名空间(如 Tiny.Button) + const tagMatches = jsContent.match(/<([A-Z][a-zA-Z0-9]*(?:\.[A-Z][a-...
_💡 Verification agent_ <details> <summary>🧩 Analysis chain</summary> **Consider adding support for multi-word components with hyphens.** The current regex pattern will match standard React/Vue components with uppercase first letters, but might miss hyphenated component names like `my-custom-component` which are va...
tiny-engine
github_2023
others
1,215
opentiny
coderabbitai[bot]
@@ -282,9 +298,13 @@ class MysqlConnection { isOfficial = 0, isDefault = 0, tiny_reserved = 0, - tenant = 1, - createBy = 86, - updatedBy = 86 + component_metadata = null, + library_id = 1, + tenant_id = 1, + renter_id = 1, + site_id = 1, + created_by = ...
_⚠️ Potential issue_ **Mismatch between destructured fields and table schema.** Fields like `library_id`, `tenant_id`, `renter_id`, `site_id`, `created_by`, and `last_updated_by` do not appear in the existing CREATE TABLE statement. This will cause insert errors or missing column errors if the table isn’t migrated a...
tiny-engine
github_2023
others
1,215
opentiny
coderabbitai[bot]
@@ -335,7 +359,7 @@ class MysqlConnection { * @param {object} component 组件数据 */ initDB(component) { - const selectSqlContent = `SELECT * FROM ${this.config.database}.${componentsTableName} WHERE component = '${component.component}'` + const selectSqlContent = `SELECT * FROM ${this.config.database}.${co...
_⚠️ Potential issue_ **Querying non-existent column `name_en`.** `initDB` uses `name_en` in its WHERE clause, but this column is undefined in the existing table definition. Verify that the column truly exists or update the query to match the actual schema. <!-- This is an auto-generated comment by CodeRabbit -->
tiny-engine
github_2023
others
1,215
opentiny
coderabbitai[bot]
@@ -308,15 +328,19 @@ class MysqlConnection { '${isOfficial}', '${isDefault}', '${tiny_reserved}', - '${tenant}', - '${createBy}', - '${updatedBy}' + '${component_metadata}', + '${library_id}', + '${tenant_id}', + '${renter_id}', + '${site_id}', + '${created_by}', + '${last_...
_⚠️ Potential issue_ **Inserting into non-existent columns.** The insert statement references `name_en`, `library_id`, `tenant_id`, `renter_id`, `site_id`, `created_by`, and `last_updated_by`, but those columns are missing from the table definition. Either add these columns or update the SQL to match the actual sche...
tiny-engine
github_2023
others
1,215
opentiny
chilingling
@@ -202,9 +202,10 @@ class MysqlConnection { /** * 新建的组件关联物料资产包 + * @deprecated 物料资产包已废弃,使用relationMaterialHistory替代
考虑 `buildMaterial` 要不要兼容 nodejs 后端,如果要的话,可能需要独立出来两个 connection,默认链接 java 版本的 connection.mjs,用户可以手动修改,连接到 nodejs 段的 connection-node.mjs。
tiny-engine
github_2023
javascript
1,167
opentiny
coderabbitai[bot]
@@ -161,7 +161,7 @@ export const preprocessRegistry = (registry) => { export const generateRegistry = (registry) => { Object.entries(registry).forEach(([key, value]) => { - if (typeof value === 'object' && value) { + if (typeof value === 'object' && value && !isRef(value)) {
_⚠️ Potential issue_ **Critical fix for Vue reactive refs handling.** The addition of `!isRef(value)` prevents the function from recursively traversing Vue ref objects, which could lead to infinite recursion or unintended behavior when processing the registry. This is an important fix for proper integration with Vue'...
tiny-engine
github_2023
others
1,167
opentiny
coderabbitai[bot]
@@ -46,14 +50,25 @@ export default { components: { MonacoEditor: VueMonaco, TinyButton: Button, - CloseIcon, - LinkButton + PluginPanel + }, + props: { + fixedPanels: { + type: Array + } }, - emits: ['close'], + emits: ['close', 'fix-panel'],
_💡 Verification agent_ <details> <summary>❓ Verification inconclusive</summary> **Verify usage of 'fix-panel' event** The component declares 'fix-panel' in emits, but there's no code that actually emits this event. Either remove it if unused or implement the emission. --- 🏁 Script executed: ```shell #!/bin/bash...
tiny-engine
github_2023
others
1,167
opentiny
coderabbitai[bot]
@@ -99,6 +116,28 @@ export default { isFullScreen: false }) + const { getPluginWidth } = useLayout() + + const firstPanelOffset = computed(() => { + return getPluginWidth(props.fixedName) + }) + + const secondPanelAlign = computed(() => { + return props.align.includes('left') ? 'left...
_⚠️ Potential issue_ **Fix CSS syntax for inline style mapping.** `return \`${secondPanelAlign.value} : ${firstPanelOffset.value}px\`` might yield `"left : 300px"`, which is invalid CSS. Use a valid property name without extra spacing or use an object form of `:style`. ```diff - return `${secondPanelAlign.value} :...
tiny-engine
github_2023
others
1,136
opentiny
coderabbitai[bot]
@@ -138,6 +138,16 @@ export default { clearSelect() } + const delNode = (data) => { + const { clearSelect } = useCanvas().canvasApi.value + useCanvas().operateNode({ + type: 'delete', + id: data.id + }) + clearSelect() + useHistory().addHistory() + }
_:hammer_and_wrench: Refactor suggestion_ **Add error handling to delNode method.** The deletion operation should handle potential failures gracefully. ```diff const delNode = (data) => { + try { const { clearSelect } = useCanvas().canvasApi.value useCanvas().operateNode({ type...
tiny-engine
github_2023
javascript
1,143
opentiny
coderabbitai[bot]
@@ -29,6 +29,9 @@ export default defineConfig({ formats: ['es'] }, rollupOptions: { + output: { + banner: 'import "./style.css"' + },
_:bulb: Verification agent_ <details> <summary>🧩 Analysis chain</summary> **Verify that style.css is generated during build.** The banner imports "./style.css", but we should ensure this file is generated during the build process. Run this script to check if the CSS file is generated: --- 🏁 Script executed: ``...
tiny-engine
github_2023
javascript
1,143
opentiny
coderabbitai[bot]
@@ -62,3 +62,13 @@ export function createPlugin(name) { chalk.green(`create finish, run the follow command to start project: \ncd ${name} && npm install && npm run dev`) ) } + +export function createTheme(name) { + const sourcePath = path.join(__dirname, '../template/theme/') + const destPath = path.join(cwd...
_:hammer_and_wrench: Refactor suggestion_ **Add error handling and validation to createTheme function.** The function should validate the theme name and check for existing directories, similar to `createPlatform`. Apply this diff to add the necessary checks: ```diff export function createTheme(name) { + if (fs.pa...
tiny-engine
github_2023
javascript
1,143
opentiny
coderabbitai[bot]
@@ -47,6 +40,13 @@ export default defineService({ const appId = getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id const theme = localStorage.getItem(`tiny-engine-theme-${appId}`) || getMergeMeta('engine.config').theme || DEFAULT_THEME.label + THEME_DATA = getMergeRegistry('themes') + DEFAUL...
_:bulb: Verification agent_ _:hammer_and_wrench: Refactor suggestion_ <details> <summary>🧩 Analysis chain</summary> **Potential fallback needed for empty registry** If `getMergeRegistry('themes')` returns an empty array, accessing `[0]` will fail. Consider adding a fallback to avoid runtime errors. Possible f...
tiny-engine
github_2023
javascript
1,143
opentiny
chilingling
@@ -62,3 +62,20 @@ export function createPlugin(name) { chalk.green(`create finish, run the follow command to start project: \ncd ${name} && npm install && npm run dev`) ) } + +export function createTheme(name, themeName) { + const sourcePath = path.join(__dirname, '../template/theme/') + const destPath = pa...
可以抽取个变量复用一下 ```javascript const themePath = path.resolve(destPath, 'src/common.less') ```
tiny-engine
github_2023
javascript
1,143
opentiny
chilingling
@@ -67,10 +89,25 @@ program const typeMapper = { platform: createPlatform, - plugin: createPlugin + plugin: createPlugin, + theme: createTheme + } + + let themeName = '' + if (type === 'theme') {
看看这里是不是可以跟上面 79 行 `projectName` 的逻辑合并。 projectName 里面的 tips 提示根据 type 进行判断提示
tiny-engine
github_2023
javascript
1,143
opentiny
chilingling
@@ -47,6 +40,13 @@ export default defineService({ const appId = getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id const theme = localStorage.getItem(`tiny-engine-theme-${appId}`) || getMergeMeta('engine.config').theme || DEFAULT_THEME.label + THEME_DATA = getMergeRegistry('themes') + DEFAUL...
这里 `theme` 的值不应该叫 `label`,当时值叫 `label` 是因为 radio 的值映射字段是 `label`。但是值映射成 `label` 会很容易造成误解。我们应该尽快改过来。
tiny-engine
github_2023
others
1,143
opentiny
chilingling
@@ -47,15 +74,37 @@ export default { return options }) const baseContent = computed(() => (props.position === COLLAPSE ? '' : state.themeLabel)) - const baseIcon = computed(() => (props.position === COLLAPSE ? '' : state.theme)) + const baseIcon = computed(() => (props.position === COLLAPSE ? '' ...
`return (THEME_DATA.length === filterList.length`
tiny-engine
github_2023
others
1,143
opentiny
chilingling
@@ -47,15 +74,37 @@ export default { return options }) const baseContent = computed(() => (props.position === COLLAPSE ? '' : state.themeLabel)) - const baseIcon = computed(() => (props.position === COLLAPSE ? '' : state.theme)) + const baseIcon = computed(() => (props.position === COLLAPSE ? '' ...
`['light', 'dark'].includes(item.label)`
tiny-engine
github_2023
others
1,143
opentiny
chilingling
@@ -1,27 +1,54 @@ <template> <div class="toolbar-theme-switch"> - <toolbar-base :content="baseContent" :icon="baseIcon" :options="optionsData" @click-api="toChangeTheme"> - <template v-if="position === 'collapse'"> - <div class="toolbar-theme-switch-radio"> - <div class="toolbar-theme-switch...
`TinyPopover`
tiny-engine
github_2023
javascript
1,143
opentiny
chilingling
@@ -62,3 +62,20 @@ export function createPlugin(name) { chalk.green(`create finish, run the follow command to start project: \ncd ${name} && npm install && npm run dev`) ) } + +export function createTheme(name, themeName) { + const sourcePath = path.join(__dirname, '../template/theme/') + const destPath = pa...
这里不仅仅只有 `common.less` 需要替换吧?`package.json`、`vite.config.js` 文件好像也有相关的名字需要替换
tiny-engine
github_2023
others
1,143
opentiny
coderabbitai[bot]
@@ -0,0 +1,29 @@ +{ + "name": "theme-custom", + "version": "2.0.0", + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "vite build" + }, + "type": "module", + "main": "dist/index.js", + "files": [ + "dist" + ], + "repository": { + "type": "git", + "url": "https://github.c...
_🛠️ Refactor suggestion_ **Repository path might need dynamic updating.** The `directory` field in the repository section points to a static path: ``` "directory": "packages/theme/custom" ``` This should probably be updated dynamically based on the theme name during creation, similar to how you're updating the them...
tiny-engine
github_2023
javascript
1,143
opentiny
coderabbitai[bot]
@@ -46,7 +39,14 @@ export default defineService({ init: () => { const appId = getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id const theme = - localStorage.getItem(`tiny-engine-theme-${appId}`) || getMergeMeta('engine.config').theme || DEFAULT_THEME.label + localStorage.getItem(`tiny-engin...
_⚠️ Potential issue_ **Fix potential 'undefined' access to DEFAULT_THEME.type** Line 42 tries to access `DEFAULT_THEME.type` before `DEFAULT_THEME` is initialized on line 44. If the user has a theme in localStorage or engine.config, this could cause a runtime error. Move this line after `DEFAULT_THEME` is initializ...
tiny-engine
github_2023
javascript
1,143
opentiny
coderabbitai[bot]
@@ -62,3 +62,23 @@ export function createPlugin(name) { chalk.green(`create finish, run the follow command to start project: \ncd ${name} && npm install && npm run dev`) ) } + +export function createTheme(name, themeName) { + const sourcePath = path.join(__dirname, '../template/theme/') + const destPath = pa...
_💡 Verification agent_ <details> <summary>🧩 Analysis chain</summary> **Update all relevant files with theme name replacements.** Currently, only `common.less` is being updated with the theme name. Consider checking and updating other files in the theme template (like `package.json` and `vite.config.js`) that might...
tiny-engine
github_2023
javascript
1,143
opentiny
chilingling
@@ -11,10 +11,23 @@ */ import { Command, Option } from 'commander' import { input, select } from '@inquirer/prompts' -import { createPlatform, createPlugin } from './commands/create.js' +import { createPlatform, createPlugin, createTheme } from './commands/create.js' const program = new Command() +const setNam...
这里做一个 Map 管理类型。 ``` const messageMap = { theme: { message: 'xxx', validateMessage: 'xxx' } } ```
tiny-engine
github_2023
javascript
1,143
opentiny
chilingling
@@ -11,10 +11,23 @@ */ import { Command, Option } from 'commander' import { input, select } from '@inquirer/prompts' -import { createPlatform, createPlugin } from './commands/create.js' +import { createPlatform, createPlugin, createTheme } from './commands/create.js' const program = new Command() +const setNam...
叫 `getName` 是不是更语义化一点?
tiny-engine
github_2023
javascript
1,143
opentiny
chilingling
@@ -11,10 +11,23 @@ */ import { Command, Option } from 'commander' import { input, select } from '@inquirer/prompts' -import { createPlatform, createPlugin } from './commands/create.js' +import { createPlatform, createPlugin, createTheme } from './commands/create.js'
需要在 README 加文档
tiny-engine
github_2023
javascript
1,143
opentiny
coderabbitai[bot]
@@ -50,27 +82,26 @@ program name: 'plugin', value: 'plugin', description: 'create a new tiny-engine plugin 创建一个新的 tiny-engine 插件' + }, + { + name: 'theme', + value: 'theme', + description: 'create a new tiny-engine theme 创建一个新的 tiny-engine 主题' ...
_💡 Verification agent_ <details> <summary>🧩 Analysis chain</summary> **Verify the `getName` function call** When calling `getName(type)`, the type parameter is 'theme', not a boolean, but the function seems to use it as a boolean. This might lead to unexpected behavior. ```diff - const themeName = type === 't...
tiny-engine
github_2023
javascript
1,143
opentiny
coderabbitai[bot]
@@ -46,7 +39,14 @@ export default defineService({ init: () => { const appId = getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id const theme = - localStorage.getItem(`tiny-engine-theme-${appId}`) || getMergeMeta('engine.config').theme || DEFAULT_THEME.label + localStorage.getItem(`tiny-engin...
_🛠️ Refactor suggestion_ **Initialize themeState after ensuring DEFAULT_THEME is valid** This initialization should come after you've ensured `DEFAULT_THEME` is properly set, including the fallback for empty registries. Move this block after the DEFAULT_THEME fallback check to ensure it always has valid values. <...
tiny-engine
github_2023
javascript
1,143
opentiny
coderabbitai[bot]
@@ -11,10 +11,35 @@ */ import { Command, Option } from 'commander' import { input, select } from '@inquirer/prompts' -import { createPlatform, createPlugin } from './commands/create.js' +import { createPlatform, createPlugin, createTheme } from './commands/create.js' const program = new Command() +const messag...
_🛠️ Refactor suggestion_ **Function parameter type should be more explicit.** The `getName` function uses the `type` parameter as a boolean in its implementation, but the name and usage suggest it should accept a string. Consider either: 1. Renaming the parameter to `isTheme` to clarify it's a boolean flag 2. Refact...
tiny-engine
github_2023
javascript
1,143
opentiny
lichunn
@@ -46,7 +39,14 @@ export default defineService({ init: () => { const appId = getMetaApi(META_SERVICE.GlobalService).getBaseInfo().id const theme = - localStorage.getItem(`tiny-engine-theme-${appId}`) || getMergeMeta('engine.config').theme || DEFAULT_THEME.label + localStorage.getItem(`tiny-engin...
themeState似乎没必要再赋予默认值?因为下面themeChange(theme)已经赋予theme对应的主题并且有默认值兼容了
tiny-engine
github_2023
javascript
1,143
opentiny
coderabbitai[bot]
@@ -1,37 +1,30 @@ -import { reactive } from 'vue' -import { defineService, getMetaApi, getMergeMeta, META_SERVICE } from '@opentiny/tiny-engine-meta-register' +import { reactive, ref } from 'vue' +import { + defineService, + getMetaApi, + getMergeMeta, + META_SERVICE, + getMergeRegistry +} from '@opentiny/tiny-eng...
_🛠️ Refactor suggestion_ **Improved reactive state management for theme data** The change from static constants to reactive variables is a good improvement for dynamic theme management. However, initializing `themeState` as an empty object and `DEFAULT_THEME` as null introduces potential initialization issues. Con...
tiny-engine
github_2023
javascript
1,143
opentiny
coderabbitai[bot]
@@ -1,37 +1,34 @@ -import { reactive } from 'vue' -import { defineService, getMetaApi, getMergeMeta, META_SERVICE } from '@opentiny/tiny-engine-meta-register' +import { reactive, ref } from 'vue' +import { + defineService, + getMetaApi, + getMergeMeta, + META_SERVICE, + getMergeRegistry +} from '@opentiny/tiny-eng...
_🛠️ Refactor suggestion_ **Improve error handling in themeChange function** The `themeChange` function might fail if `getTheme(theme)` returns null or undefined. Add defensive coding to handle potential null values: ```diff const themeChange = (theme) => { - themeState.theme = getTheme(theme).type - themeState....
tiny-engine
github_2023
javascript
1,143
opentiny
coderabbitai[bot]
@@ -1,37 +1,34 @@ -import { reactive } from 'vue' -import { defineService, getMetaApi, getMergeMeta, META_SERVICE } from '@opentiny/tiny-engine-meta-register' +import { reactive, ref } from 'vue' +import { + defineService, + getMetaApi, + getMergeMeta, + META_SERVICE, + getMergeRegistry +} from '@opentiny/tiny-eng...
_🛠️ Refactor suggestion_ **Add null check in getTheme function** The `getTheme` function assumes that THEME_DATA.value is an array and DEFAULT_THEME is initialized, but both assumptions might not be true. Add checks to handle cases when these variables are not initialized: ```diff -return THEME_DATA.value.find((i...
tiny-engine
github_2023
javascript
1,201
opentiny
chilingling
@@ -91,33 +84,39 @@ export const useMultiSelect = () => { const selectState = getMultiSelectionState(element) if (!selectState) { - return false // 如果没有有效的 selectState,返回 false + return // 如果没有有效的 selectState,返回 false
备注更新一下,你现在返回 `undefined` 了
tiny-engine
github_2023
javascript
1,201
opentiny
chilingling
@@ -91,33 +84,39 @@ export const useMultiSelect = () => { const selectState = getMultiSelectionState(element) if (!selectState) { - return false // 如果没有有效的 selectState,返回 false + return // 如果没有有效的 selectState,返回 false } const nodeId = selectState?.id const isExistNode = multiSelec...
这里为什么要使用 `toRaw`
tiny-engine
github_2023
javascript
1,201
opentiny
chilingling
@@ -91,33 +84,39 @@ export const useMultiSelect = () => { const selectState = getMultiSelectionState(element) if (!selectState) { - return false // 如果没有有效的 selectState,返回 false + return // 如果没有有效的 selectState,返回 false } const nodeId = selectState?.id const isExistNode = multiSelec...
为什么需要移除子节点?
tiny-engine
github_2023
javascript
1,201
opentiny
chilingling
@@ -412,7 +412,8 @@ const setSelectRect = (element, multiNodeId) => { if (multiNodeId) { multiSelectedStates.value.map((state) => { if (state.id === multiNodeId) { - return Object.assign(state, selectState) + const { schema, ...rest } = selectState + return Object.assign(state, rest)
我理解这里要设置到 state 的是 上面 404 到 409 行的数据吧? 是不是抽取一个公共变量存储好一点?不然后面 selectState 增加了字段之后,会有数据污染
tiny-engine
github_2023
javascript
1,179
opentiny
coderabbitai[bot]
@@ -13,5 +13,5 @@ export const generateStyleTag = (schema, config = {}) => { langDesc = `lang=${langDesc}`
_⚠️ Potential issue_ **Potential bug in lang attribute assignment.** The current code assigns `langDesc = 'lang=${langDesc}'` which uses `langDesc` in its own definition. Since `langDesc` is initialized as an empty string (line 5), this would result in an attribute like `lang=` with no value. This appears to be a bug...
tiny-engine
github_2023
others
1,169
opentiny
chilingling
@@ -115,6 +120,7 @@ export default { const { clientX, clientY } = event const element = getElement(event.target) closeMenu() + viewerSwitcher.value?.closePopover()
看看以下实现会不会更好? 1. 在 mousedown 事件派发通知。 ```javascript // 监听画布的 mousedown 事件。 win.addEventListener('mousedown', (event) => { // 发布画布 mousedown 事件,通知订阅者 publish({ topic: 'canvas-mousedown', data: { event } }) }) ``` 2. 在 `CanvasViewerSwitcher` 中订阅 `canvas-mousedown` 事件;并在订阅事件中关闭预览下拉列表弹窗。
tiny-engine
github_2023
others
1,199
opentiny
coderabbitai[bot]
@@ -11,33 +11,49 @@ const materialsDir = 'materials' const bundle = fs.readJSONSync(bundlePath) const { components, snippets, blocks } = bundle.data.materials -const capitalize = (str) => `${str.charAt(0).toUpperCase()}${str.slice(1)}` -const toPascalCase = (str) => str.split('-').map(capitalize).join('') +const ca...
_🛠️ Refactor suggestion_ **Add optional chaining for snippetName.** The new matching logic correctly allows components to exist in multiple snippets, but there's a potential issue in line 29: ```javascript const snippetComponentName = item?.schema?.componentName || item.snippetName; ``` You're using optional chai...
tiny-engine
github_2023
others
1,199
opentiny
chilingling
@@ -11,33 +11,49 @@ const materialsDir = 'materials' const bundle = fs.readJSONSync(bundlePath) const { components, snippets, blocks } = bundle.data.materials -const capitalize = (str) => `${str.charAt(0).toUpperCase()}${str.slice(1)}` -const toPascalCase = (str) => str.split('-').map(capitalize).join('') +const ca...
项目的约定是不要分号,麻烦去除一下
tiny-engine
github_2023
others
1,199
opentiny
chilingling
@@ -11,33 +11,49 @@ const materialsDir = 'materials' const bundle = fs.readJSONSync(bundlePath) const { components, snippets, blocks } = bundle.data.materials -const capitalize = (str) => `${str.charAt(0).toUpperCase()}${str.slice(1)}` -const toPascalCase = (str) => str.split('-').map(capitalize).join('') +const ca...
这里的逻辑可以尝试一下是不是有优化空间(需验证): 1. 预处理 snippet: ```javascript const snippetsMap = {} snippets.forEach((snippetItem) => { if (!Array.isArray(snippetItem?.children)) { return; } snippetItem.children.forEach((item) => { const key = item?.schema?.componentName || item.snippetName ...
tiny-engine
github_2023
others
1,152
opentiny
coderabbitai[bot]
@@ -335,7 +359,7 @@ class MysqlConnection { * @param {object} component 组件数据 */ initDB(component) { - const selectSqlContent = `SELECT * FROM ${this.config.database}.${componentsTableName} WHERE component = '${component.component}'` + const selectSqlContent = `SELECT * FROM ${this.config.database}.${co...
_:warning: Potential issue_ **Mismatch between “name_en” and “component.component”.** The query filters on `name_en`, yet we're passing the property `component.component`. If `component.component` doesn’t match the stored `name_en`, the lookup will fail. Apply this diff to maintain consistency with the actual store...
tiny-engine
github_2023
others
1,152
opentiny
coderabbitai[bot]
@@ -308,15 +328,19 @@ class MysqlConnection { '${isOfficial}', '${isDefault}', '${tiny_reserved}', - '${tenant}', - '${createBy}', - '${updatedBy}' + '${component_metadata}', + '${library_id}', + '${tenant_id}', + '${renter_id}', + '${site_id}', + '${created_by}', + '${last_...
_:warning: Potential issue_ **Schema mismatch for “name_en” and “component_metadata”.** This insert statement references `name_en` and `component_metadata`, but the table definition does not declare a `name_en` column. This will fail unless the table schema is updated accordingly. A possible fix in your CREATE TABL...
tiny-engine
github_2023
others
1,152
opentiny
coderabbitai[bot]
@@ -215,6 +216,20 @@ class MysqlConnection { }) } + /** + * 新建的组件关联物料资产包 + * @param {number} id 新建的组件id + */ + relationMaterialHistory(id) { + const uniqSql = `SELECT * FROM \`r_material_history_component\` WHERE \`material_history_id\`=${materialHistoryId} AND \`component_id\`=${id}` + this.que...
_:warning: Potential issue_ **Use parameterized queries to prevent SQL injection.** Directly concatenating `id` into the SQL statement may be risky if the value is not guaranteed to be an integer. Parameterized queries will secure this method and help avoid potential injection vulnerabilities. Possible fix using pl...
tiny-engine
github_2023
others
1,200
opentiny
chilingling
@@ -50,7 +50,10 @@ const splitMaterials = () => { fs.outputJsonSync(blockPath, block, { spaces: 2 }) }) - + const packageJsonPath = path.join(process.cwd(), materialsDir, 'packages.json');
1. 团队代码风格统一不要末尾分号,麻烦处理一下 2. `buildMaterials` 脚本有兴趣一起处理一下吗?build 的时候,读取该 packages.json 文件,写入回去 `bundle.json`
tiny-engine
github_2023
others
1,208
opentiny
coderabbitai[bot]
@@ -416,9 +416,7 @@ export default { const pageSchema = getSchema() const stateName = state.variable.replace(`${CONSTANTS.STATE}`, '') const staticData = state.variableContent.map(({ _id, ...other }) => other) - - updateSchema({ ...pageSchema.state, [stateName]: staticData }) -...
_⚠️ Potential issue_ **Important change to schema update structure.** The modification correctly fixes the bug where data source initialization state was not properly updated. By nesting properties under a `state` key rather than spreading them at the root level, this ensures the schema maintains the correct hierarch...
tiny-engine
github_2023
javascript
996
opentiny
chilingling
@@ -646,42 +646,43 @@ const updateBlock = (block = {}) => { * @returns */ const generateBlockDeps = (children, deps = { scripts: [], styles: new Set() }) => { - children.forEach((child) => { - const component = useMaterial().getMaterial(child.componentName) - - if (!component) return - - const { npm, com...
建议使用 early return ```javascript if (!Array.isArray(children)) { return } children.forEach(....) ```
tiny-engine
github_2023
others
996
opentiny
chilingling
@@ -186,6 +188,9 @@ export default { } publishBlock(params) setVisible(false) + if (formState.needToSave) {
这里需要增加判断,只有当前发布的区块为画布中正在编辑的区块,才设置为已保存状态。
tiny-engine
github_2023
others
996
opentiny
chilingling
@@ -172,6 +172,13 @@ export default { const setVisible = (visible) => emit('update:visible', visible) + const { setSaved } = useCanvas() + + const isSameBlock = computed(() => { + const currentBlock = useBlock().getCurrentBlock() + return props.block?.id && props.block?.id === currentBlock?.id
`props.block?.id === currentBlock?.id` 这样就好
tiny-engine
github_2023
others
996
opentiny
hexqi
@@ -172,6 +172,13 @@ export default { const setVisible = (visible) => emit('update:visible', visible) + const { setSaved } = useCanvas() + + const isSameBlock = computed(() => {
这里没必要把isSameBlock变成响应式变量,直接作为一个普通方法,部署区块时直接调用一次就可以了,isSameBlock.value --> isSameBlock()
tiny-engine
github_2023
others
1,192
opentiny
coderabbitai[bot]
@@ -63,9 +63,7 @@ async function updatePkgJson() { const defaultScripts = { dev: "concurrently 'pnpm:serve:mock' 'pnpm:serve:frontend'", 'serve:frontend': 'cross-env vite', - 'serve:mock': 'node node_modules/@opentiny/tiny-engine-mock/dist/app.js', - 'build:alpha': 'cross-env NODE_OPTIONS=--max-old-s...
_💡 Verification agent_ <details> <summary>🧩 Analysis chain</summary> **Build scripts removed from template defaults** The `defaultScripts` object now only includes development and serving scripts, with `'build:alpha'` and `build` scripts having been removed. This change aligns with the transition from a release ca...
tiny-engine
github_2023
javascript
1,166
opentiny
hexqi
@@ -0,0 +1,111 @@ +import { ref, computed, toRaw } from 'vue' +import { useCanvas } from '@opentiny/tiny-engine-meta-register' +import { NODE_TAG, NODE_UID } from '../../../common' +import { getRect, getDocument } from '../container' + +const initMultiState = { id: 'body' } + +// 初始化多选节点 +const multiSelectedStates = re...
这里没必要再转一次set,直接用数组就行了, nodeIds.includes
tiny-engine
github_2023
javascript
1,166
opentiny
hexqi
@@ -0,0 +1,111 @@ +import { ref, computed, toRaw } from 'vue' +import { useCanvas } from '@opentiny/tiny-engine-meta-register' +import { NODE_TAG, NODE_UID } from '../../../common' +import { getRect, getDocument } from '../container' + +const initMultiState = { id: 'body' } + +// 初始化多选节点 +const multiSelectedStates = re...
append场景是否需要和else里面一致先判断node是否是数组? 另外不建议添加这个append参数,将两种场景混在一个函数里面,有点职责不清,建议通过增加addMultiSelection或者直接传完整的nodes
tiny-engine
github_2023
javascript
1,166
opentiny
gene9831
@@ -0,0 +1,111 @@ +import { ref, computed, toRaw } from 'vue' +import { useCanvas } from '@opentiny/tiny-engine-meta-register' +import { NODE_TAG, NODE_UID } from '../../../common' +import { getRect, getDocument } from '../container' + +const initMultiState = { id: 'body' } + +// 初始化多选节点 +const multiSelectedStates = re...
`map` + `includes` 可以直接使用 `Array.prototype.some()` 替代
tiny-engine
github_2023
javascript
1,166
opentiny
gene9831
@@ -0,0 +1,111 @@ +import { ref, computed, toRaw } from 'vue' +import { useCanvas } from '@opentiny/tiny-engine-meta-register' +import { NODE_TAG, NODE_UID } from '../../../common' +import { getRect, getDocument } from '../container' + +const initMultiState = { id: 'body' } + +// 初始化多选节点 +const multiSelectedStates = re...
这里也可以使用 `Array.prototype.some()` 替代
tiny-engine
github_2023
others
1,166
opentiny
chilingling
@@ -212,16 +213,18 @@ export default { // 多选组合键触发 if (element) { - const selectedState = getMultiState(element, doc) + const selectedState = getMultiSelectionState(element) if ((event.ctrlKey || event.metaKey) && event.button === 0) { - ...
考虑一下将逻辑内聚到 useMultiSelect 内部: 1. mousedown 回调触发,调用 `toggleMultiSelection` 事件。 2. `toggleMultiSelection` 事件进行相关的逻辑处理: 是否是 ctrl key、是否触发多选、是否取消多选等等。
tiny-engine
github_2023
javascript
1,185
opentiny
chilingling
@@ -93,9 +92,17 @@ const clear = () => { }) } +const toggleSaveBadgeStatus = () => {
考虑一下将判断是否已保存的逻辑内聚到 `@opentiny/tiny-engine-toolbar-save` 插件(以下简称保存插件)中。 以下是思路: 1. 梳理页面初始化的逻辑 a. 从url初始化整个设计器进来(这里可能是页面,也可能是区块) b. 在页面管理和区块管理中进行页面、区块之间的切换 2. 页面初始化的时候派发初始化事件,比如:`pageOrBlockInit`,并带上完成的页面或者区块 schema。 3. 在保存插件中,订阅初始化事件,接收初始化时候的 schema。重置保存状态为已保存等等初始化逻辑。 4. 在保存插件中,订阅 schemaChange、schemaImport...
tiny-engine
github_2023
javascript
1,185
opentiny
chilingling
@@ -71,6 +71,7 @@ export const saveCommon = (value) => { if (isBlock()) { resetBlockCanvasState({ ...pageState, pageSchema }) } else { + localStorage.setItem(constants.PAGE_ORIGIN_SCHEMA, JSON.stringify(pageSchema))
不需要存到 localStorage
tiny-engine
github_2023
others
1,185
opentiny
chilingling
@@ -101,14 +99,62 @@ export default { visible: false, code: '', originalCode: '', - disabled: false, - timeValue: 5, checked: false, + timeValue: 5, preservationTime: null }) const editor = ref(null) + const { isSaved, setSaved, getSchemaDiff } = useCan...
不需要 diff。 第 122 行直接拿到字符串。 ```javascript initSchema.value = JSON.stringify(schema) ``` 这里直接比对: ```javascript const hasChange = JSON.stringify(useCanvas().getSchema()) === initSchema.value ```
tiny-engine
github_2023
others
1,185
opentiny
chilingling
@@ -101,14 +99,62 @@ export default { visible: false, code: '', originalCode: '', - disabled: false, - timeValue: 5, checked: false, + timeValue: 5, preservationTime: null }) const editor = ref(null) + const { isSaved, setSaved, getSchemaDiff } = useCan...
1. 用 `const ` 2. 命名看看用 `originSchema` 是不是更合适一点?`initSchema`看起来像是一个动作方法名
tiny-engine
github_2023
others
1,187
opentiny
chilingling
@@ -52,18 +52,22 @@ export default { getHistoryList(pageId) }) - const previewHistory = (item) => { - item && - previewPage({ + const previewHistory = async (item) => { + if (item) { + const theme = getMetaApi(META_SERVICE.ThemeSwitch)?.getThemeState()?.theme + const p...
逻辑有问题,上面 63-64 行的 pageInfo 仅赋值了 `name`,这里 `getFamily` 内部的实现逻辑会判断 `page_content` 是否存在内容,如果不存在,则会请求最新的页面 schema。所以无法预览到历史页面的内容。
tiny-engine
github_2023
javascript
1,182
opentiny
chilingling
@@ -5,6 +5,26 @@ const defaultOption = { path: './src/router' } +const setDefaultRoute = (routes) => {
需要增加对应的场景用例单测,方便后面增删逻辑或者重构的时候确保相关的场景仍正常。
tiny-engine
github_2023
javascript
1,182
opentiny
chilingling
@@ -15,16 +35,11 @@ const flattenRoutes = (routes, parentPath = '') => { name: `${route.name}`, path: fullPath, component: route.component, - children: flattenRoutes(route.children) - } - const redirectChild = route.children.find((item) => item.isDefault) - - if (route.c...
`route?.children?.length`