Commit 0413ff18 authored by zhangwenshuai's avatar zhangwenshuai

自定义组件默认取config的setFormat

parent dd72d6b0
...@@ -191,6 +191,15 @@ const Cell = (props: CellProps) => { ...@@ -191,6 +191,15 @@ const Cell = (props: CellProps) => {
let detailConfig; let detailConfig;
if (typeof renderDetailCell === 'function') { if (typeof renderDetailCell === 'function') {
detailConfig = renderDetailCell({ cellData, rowData: record, columnConfig }); detailConfig = renderDetailCell({ cellData, rowData: record, columnConfig });
const defaultConfig = config[String(columnType)];
if (defaultConfig) {
if (defaultConfig.getFormatter && !detailConfig.getFormatter) {
detailConfig.getFormatter = defaultConfig.getFormatter;
}
if (defaultConfig.setFormatter && !detailConfig.setFormatter) {
detailConfig.setFormatter = defaultConfig.setFormatter;
}
}
empty = false; empty = false;
} else { } else {
detailConfig = config[String(columnType)] || config['1']; detailConfig = config[String(columnType)] || config['1'];
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
align-items: center; align-items: center;
overflow: hidden;
.itemBgTxt { .itemBgTxt {
position: absolute; position: absolute;
z-index: -1; z-index: -1;
......
...@@ -29,7 +29,7 @@ export const Tags = (props: any) => { ...@@ -29,7 +29,7 @@ export const Tags = (props: any) => {
if (mode !== 'multiple') { if (mode !== 'multiple') {
// 单选 // 单选
return ( return (
<div className={s.container}> <div className={s.container} style={{ overflow: 'hidden' }}>
<span className={s.item} style={{ ...itemStyle, background: `#${getColor(value[0])}` }}> <span className={s.item} style={{ ...itemStyle, background: `#${getColor(value[0])}` }}>
<div className={s.itemBgTxt}>{value[0].text}</div> <div className={s.itemBgTxt}>{value[0].text}</div>
</span> </span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment