feat: input-table 增加 rowClassNameExpr 配置 Closes #3672 (#3688)

* feat: input-table 增加 rowClassNameExpr 配置 Closes #3672

* 加上 rowClassName
This commit is contained in:
吴多益 2022-03-03 19:01:39 +08:00 committed by GitHub
parent 42c658178e
commit d6f96747e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 2 deletions

View File

@ -591,6 +591,34 @@ order: 54
}
```
## 高亮行
> 1.8.0 及以上版本
通过 `rowClassNameExpr` 来添加类,比如下面的例子中,如果输入的内容是 `a` 则背景色为绿色`
```schema: scope="body"
{
"type": "form",
"api": "/api/mock2/form/saveForm",
"body": [
{
"type": "input-table",
"name": "table",
"addable": true,
"editable": true,
"rowClassNameExpr": "<%= data.a === 'a' ? 'bg-success' : '' %>",
"columns": [
{
"name": "a",
"label": "A"
}
]
}
]
}
```
## 属性表
| 属性名 | 类型 | 默认值 | 说明 |

View File

@ -1082,7 +1082,9 @@ export default class FormTable extends React.Component<TableProps, TableState> {
prefixRow,
formInited,
perPage,
classnames: cx
classnames: cx,
rowClassName,
rowClassNameExpr
} = this.props;
if (formInited === false) {
@ -1131,7 +1133,9 @@ export default class FormTable extends React.Component<TableProps, TableState> {
expandConfig,
canAccessSuperData,
reUseRow: false,
offset
offset,
rowClassName,
rowClassNameExpr
}
)}
{(addable && showAddBtn !== false) || showPager ? (