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(client): support linkage style in table and form #4467

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

sheldon66
Copy link
Contributor

@sheldon66 sheldon66 commented May 23, 2024

需求

支持Table和Form的Field使用联动规则框架配置color和backgroundColor样式

规则类型

样式联动规则与原有联动规则虽然框架是同一套,但是数据是隔离的,所以规则数据的存储应与x-linkage-rules分开,目前设计存储在x-style-linkage-rules
同时,为联动规则增加类型字段

type RuleType = 'style' | 'default' // style-样式联动规则  default-普通联动规则

规则计算

增加规则计算函数, 可以计算规则中所有满足条件的action中的value

样式渲染

Table

在BodyCellComponent组件中渲染联动样式,在columns的onCell函数将当前record作为props传递给BodyCellComponent,
在BodyCellComponent读取当前record,并执行规则计算逻辑

Form

FormItem渲染样式,使用formilyJS的onFormValuesChange,当form数据有变动时执行规则计算逻辑

问题修复

Removed linkage rule setting in table column.
Fixed FormItem style not refreshing after settings change.
Replaced color select component with color picker component.

@CLAassistant
Copy link

CLAassistant commented May 23, 2024

CLA assistant check
All committers have signed the CLA.

@chenos chenos requested a review from zhangzhonghe May 24, 2024 01:10
@zhangzhonghe zhangzhonghe added the need test The PR has missing test cases. label May 27, 2024
@zhangzhonghe
Copy link
Contributor

能再补充一些测试用例吗?现在这个功能的测试覆盖比较低

@zhangzhonghe
Copy link
Contributor

zhangzhonghe commented Jun 2, 2024

@sheldon66 如果需要补充 E2E 用例,可以临时参考一下这里的文档:https://nocobase.feishu.cn/wiki/CHoiw4aPOih55Bkb9dXcMdgjnre?from=from_copylink

@zhangzhonghe zhangzhonghe removed the need test The PR has missing test cases. label Jun 12, 2024
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.

None yet

3 participants