nocobase icon indicating copy to clipboard operation
nocobase copied to clipboard

feat(client): support linkage style in table and form

Open sheldon66 opened this issue 1 year ago • 3 comments

需求

支持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.

sheldon66 avatar May 23 '24 07:05 sheldon66

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 23 '24 07:05 CLAassistant

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

zhangzhonghe avatar May 27 '24 01:05 zhangzhonghe

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

zhangzhonghe avatar Jun 02 '24 09:06 zhangzhonghe