Commit 728c2b95 authored by zhangwenshuai's avatar zhangwenshuai

update apolloTable detail tag ui

parent 5e44ff54
...@@ -27,6 +27,11 @@ export const transferAttr = (columnType, columnAttrObj) => { ...@@ -27,6 +27,11 @@ export const transferAttr = (columnType, columnAttrObj) => {
columnAttrObj.format = columnAttrObj.format.replace(/y/g, 'Y').replace(/d/g, 'D'); columnAttrObj.format = columnAttrObj.format.replace(/y/g, 'Y').replace(/d/g, 'D');
columnAttrObj.showTime = /H|m|s/.test(columnAttrObj.format); columnAttrObj.showTime = /H|m|s/.test(columnAttrObj.format);
break; break;
case '13':
if (columnAttrObj.isMultiple) {
columnAttrObj.mode = 'multiple';
}
break;
default: default:
break; break;
} }
......
...@@ -112,8 +112,7 @@ export const config: any = { ...@@ -112,8 +112,7 @@ export const config: any = {
cellComp: CellContainer(ApolloMultipleSelect), cellComp: CellContainer(ApolloMultipleSelect),
componentAttr: { componentAttr: {
labelInValue: true, labelInValue: true,
mode: 'tags', mode: 'multiple',
maxTagCount: 3,
}, },
getFormatter: GetFormatter.MULTIPLE_SELECT, getFormatter: GetFormatter.MULTIPLE_SELECT,
setFormatter: SetFormatter.MULTIPLE_SELECT, setFormatter: SetFormatter.MULTIPLE_SELECT,
......
...@@ -14,17 +14,19 @@ ...@@ -14,17 +14,19 @@
.item { .item {
margin-right: 10px; margin-right: 10px;
background: #e9eef9; background: #e9eef9;
border-radius: @borderRadius; border-radius: 12px;
&.multi {
border-radius: @borderRadius;
}
.itemBgTxt { .itemBgTxt {
height: 24px; height: 24px;
padding: 5px 10px; padding: 5px 10px;
line-height: 1; line-height: 1;
font-size: 14px; font-size: 14px;
color: #2e67c5; color: @textGeneralColor;
}
&:last-child { &:last-child {
margin-right: 0; margin-right: 0;
}
} }
} }
} }
......
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
import { Popover } from 'antd'; import { Popover } from 'antd';
import classNames from 'classnames';
import s from './index.less'; import s from './index.less';
import extendIcon from '../../../../assets/extend.png'; import extendIcon from '../../../../assets/extend.png';
export const Tags = (props: any) => { export const Tags = (props: any) => {
const { value, origin, componentAttr } = props; const { value, origin, componentAttr } = props;
if (!Array.isArray(value) || value.length === 0) return null; if (!Array.isArray(value) || value.length === 0) return null;
const { options } = componentAttr || {}; const { options, mode } = componentAttr || {};
const [dotVisible, setDotVisible] = useState(false); const [dotVisible, setDotVisible] = useState(false);
const outer = useRef(null); const outer = useRef(null);
const inner = useRef(null); const inner = useRef(null);
...@@ -41,7 +42,11 @@ export const Tags = (props: any) => { ...@@ -41,7 +42,11 @@ export const Tags = (props: any) => {
color = obj.color || 'e9eef9'; color = obj.color || 'e9eef9';
} }
return ( return (
<span key={index} className={s.item} style={{ ...itemStyle, background: `#${color}` }}> <span
key={index}
className={mode === 'multiple' ? classNames(s.item, s.multi) : s.item}
style={{ ...itemStyle, background: `#${color}` }}
>
<div className={s.itemBgTxt}>{item.text}</div> <div className={s.itemBgTxt}>{item.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