Skip to content

Vozouli/dev#548

Closed
zouli520 wants to merge 4 commits into
easyops-cn:masterfrom
zouli520:vozouli/dev
Closed

Vozouli/dev#548
zouli520 wants to merge 4 commits into
easyops-cn:masterfrom
zouli520:vozouli/dev

Conversation

@zouli520

@zouli520 zouli520 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

依赖检查

组件之间的依赖声明,是微服务组件架构下的重要信息,请确保其正确性。

请勾选以下两组选项其中之一:

  • 本次 MR 没有使用上游组件(例如框架、后台组件等)的较新版本提供的特性。

或者:

  • 本次 MR 使用了上游组件(例如框架、后台组件等)的较新版本提供的特性。
  • 在对应的文件中更新了该上游组件的依赖版本(或确认了当前声明的依赖版本已包含本次 MR 使用的新特性)。

提交信息检查

Git 提交信息将决定包的版本发布及自动生成的 CHANGELOG,请检查工作内容与提交信息是否相符,并在以下每组选项中都依次确认。

破坏性变更是针对于下游使用者而言,可以通过本次改动对下游使用者的影响来识别变更类型:

  • 下游使用者不做任何改动,仍可以正常工作时,那么它属于普通变更。
  • 反之,下游使用者不做改动就无法正常工作时,那么它属于破坏性变更。

例如,构件修改了一个属性名,小产品 Storyboard 中需要使用新属性名才能工作,那么它就是破坏性变更。
又例如,构件还没有任何下游使用者,那么它的任何变更都是普通变更。

破坏性变更:

  • ⚠️ 本次 MR 包含破坏性变更的提交,请继续确认以下所有选项:
  • 没有更好的兼容方案,必须做破坏性变更。
  • 使用了 feat 作为提交类型。
  • 标注了 BREAKING CHANGE: 你的变更说明
  • 同时更新了本仓库中所有下游使用者的调用。
  • 同时更新了本仓库中所有下游使用者对该子包的依赖为即将发布的 major 版本。
  • 同时为其它仓库的 Migrating 做好了准备,例如文档或批量改动的方法。
  • 手动验证过破坏性变更在 Migrate 后可以正常工作。
  • 破坏性变更所在的提交没有意外携带其它子包的改动。

新特性:

  • 本次 MR 包含新特性的提交,且该提交不带有破坏性变更,并使用了 feat 作为提交类型。
  • 给新特性添加了单元测试。
  • 手动验证过新特性可以正常工作。

问题修复:

  • 本次 MR 包含问题修复的提交,且该提交不带有新特性或破坏性变更,并使用了 fix 作为提交类型。
  • 给问题修复添加了单元测试。
  • 手动验证过问题修复得到解决。

杂项工作:

即所有对下游使用者无任何影响、且没有必要显示在 CHANGELOG 中的改动,例如修改注释、测试用例、开发文档等:

  • 本次 MR 包含杂项工作的提交,且该提交不带有问题修复、新特性或破坏性变更,并使用了 chore, docs, test 等作为提交类型。

Summary by CodeRabbit

改进

  • 表单导出功能增强:支持按列类型(下拉选择、级联选择等)对数组数据进行格式化,将数组元素合并为易读的逗号分隔字符串。

  • 表单验证能力提升:验证器现可访问当前表单列的配置信息,为更灵活的数据校验规则提供支持。

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@zouli520, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 15 minutes and 17 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9d416fbe-b085-4246-8204-d68db72449f8

📥 Commits

Reviewing files that changed from the base of the PR and between 8caeeef and 0aad730.

📒 Files selected for processing (1)
  • bricks/forms/src/dynamic-form-item-v2/excelUtils.tsx

Walkthrough

dynamic-form-item-v2 中,ColumnComponentvalidator 调用上下文新增 column 字段,类型定义与测试同步更新。excelUtils.tsxexportFormData 扩展了列导出配置,按列 type/mode 对数组值进行格式化,并新增 flattenArray 辅助函数处理 cascader 嵌套数组。

Changes

验证器上下文扩展与 Excel 导出格式化

Layer / File(s) Summary
validator 上下文新增 column 字段
bricks/forms/src/interfaces/dynamic-form-item-v2.ts, bricks/forms/src/dynamic-form-item-v2/ColumnComponent.tsx, bricks/forms/src/dynamic-form-item-v2/ColumnComponent.spec.tsx
fullValue 类型新增可选 column?: ColumnColumnComponent 构建 rules 时将 column 注入 validator 上下文并加入 useMemo 依赖;测试断言同步补充 column 字段。
Excel 导出按列类型格式化数组值
bricks/forms/src/dynamic-form-item-v2/excelUtils.tsx
exportFormData headers 额外记录 typemode,导出行构建时对数组值按 select(多选/标签)、cascader(嵌套展平)、其他数组分支逗号拼接;新增 flattenArray 递归展平辅助函数。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • easyops-cn/next-basics#541: 同样修改了 excelUtils.tsx 中的 exportFormData 函数(该 PR 初始实现该函数,本 PR 在其基础上扩展数组格式化逻辑),两者在同一函数的实现层面存在直接关联。

Suggested labels

eve: release after merged

Suggested reviewers

  • tcsuhaibo
🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning Pull request title is vague and non-descriptive; 'Vozouli/dev' appears to be a branch name rather than a meaningful summary of the changes. Replace title with a clear, concise description of the main change, such as 'Add column context to validator callbacks in dynamic form items' or similar.
Description check ⚠️ Warning The pull request description contains only the template with no actual content filled in; no sections (简单描述, Todo, or commit message verification) are completed. Complete the required sections: verify dependency checks, confirm commit message type (feat/fix/chore), add testing confirmations, and provide a brief description of changes made.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 (1)
bricks/forms/src/dynamic-form-item-v2/excelUtils.tsx (1)

44-45: ⚡ Quick win

类型安全性问题:避免使用 as any 绕过类型检查。

使用 (col as any) 访问 typemode 属性会绕过 TypeScript 的类型检查,可能导致运行时错误。建议确认 Column 接口是否已包含这些属性,或者使用更安全的类型断言。

♻️ 建议的改进方案

如果 Column 接口已包含 typeprops,可以这样访问:

  const headers = columns.map((col) => ({
    key: col.name,
    header: col.label || col.name,
-   type: (col as any).type,
-   mode: (col as any).props?.mode,
+   type: col.type,
+   mode: col.props?.mode,
  }));

如果接口中缺少这些字段,应该更新 Column 接口定义,或使用类型守卫进行安全检查。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bricks/forms/src/dynamic-form-item-v2/excelUtils.tsx` around lines 44 - 45,
The code uses unsafe `as any` type casts when accessing the `type` property and
`mode` property from the `col` object in the excelUtils.tsx file, which bypasses
TypeScript's type checking and can lead to runtime errors. To fix this, verify
that the `Column` interface definition already includes both `type` and `props`
properties with their respective types, and if so, access these properties
directly on the `col` object without the `as any` cast. If the `Column`
interface is missing these properties, update the interface definition to
include them with appropriate types, or alternatively implement a type guard
function to safely check and access these properties before using them.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bricks/forms/src/dynamic-form-item-v2/excelUtils.tsx`:
- Around line 59-61: The cascader export format is inconsistent with its import
logic, causing data loss. In the cascader export block (using flattenArray and
join with ', '), the nested array structure is flattened and joined with commas,
but in validateAndTransformValue's cascader import handling (line 263), the
value is split by '/' instead of commas. Change the cascader export to either
use JSON.stringify to preserve the nested structure, or modify the import logic
in validateAndTransformValue to split by ', ' instead of '/' to maintain
consistency. Ensure the chosen approach preserves the original data structure
through the export-import cycle.

---

Nitpick comments:
In `@bricks/forms/src/dynamic-form-item-v2/excelUtils.tsx`:
- Around line 44-45: The code uses unsafe `as any` type casts when accessing the
`type` property and `mode` property from the `col` object in the excelUtils.tsx
file, which bypasses TypeScript's type checking and can lead to runtime errors.
To fix this, verify that the `Column` interface definition already includes both
`type` and `props` properties with their respective types, and if so, access
these properties directly on the `col` object without the `as any` cast. If the
`Column` interface is missing these properties, update the interface definition
to include them with appropriate types, or alternatively implement a type guard
function to safely check and access these properties before using them.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0e671756-5c75-475d-a634-0628f8070604

📥 Commits

Reviewing files that changed from the base of the PR and between 0185086 and 8caeeef.

📒 Files selected for processing (4)
  • bricks/forms/src/dynamic-form-item-v2/ColumnComponent.spec.tsx
  • bricks/forms/src/dynamic-form-item-v2/ColumnComponent.tsx
  • bricks/forms/src/dynamic-form-item-v2/excelUtils.tsx
  • bricks/forms/src/interfaces/dynamic-form-item-v2.ts

Comment thread bricks/forms/src/dynamic-form-item-v2/excelUtils.tsx Outdated
@zouli520 zouli520 closed this Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant