Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
submodule
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
web_component
submodule
Commits
25570e23
Commit
25570e23
authored
Jul 17, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update tag
parent
b93eb567
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
index.tsx
components/apolloTable/component/base/detail/tag/index.tsx
+18
-15
No files found.
components/apolloTable/component/base/detail/tag/index.tsx
View file @
25570e23
...
@@ -3,6 +3,20 @@ import { Popover } from 'antd';
...
@@ -3,6 +3,20 @@ import { Popover } from 'antd';
import
classNames
from
'classnames'
;
import
classNames
from
'classnames'
;
import
s
from
'./index.less'
;
import
s
from
'./index.less'
;
const
getColor
=
(
item
:
any
,
options
:
any
[])
=>
{
let
color
=
''
;
if
(
item
.
text
===
item
.
value
)
{
return
'transparent'
;
}
if
(
options
&&
Array
.
isArray
(
options
)
&&
options
.
length
>
0
)
{
const
obj
=
options
.
find
((
ls
)
=>
{
return
String
(
ls
.
id
)
===
String
(
item
.
value
);
})
||
{};
color
=
obj
.
color
||
'e9eef9'
;
}
return
`#
${
color
}
`
;
};
export
const
Tags
=
(
props
:
any
)
=>
{
export
const
Tags
=
(
props
:
any
)
=>
{
const
{
value
,
origin
,
componentAttr
,
columnConfig
}
=
props
;
const
{
value
,
origin
,
componentAttr
,
columnConfig
}
=
props
;
if
(
!
Array
.
isArray
(
value
)
||
value
.
length
===
0
)
return
null
;
if
(
!
Array
.
isArray
(
value
)
||
value
.
length
===
0
)
return
null
;
...
@@ -18,23 +32,12 @@ export const Tags = (props: any) => {
...
@@ -18,23 +32,12 @@ export const Tags = (props: any) => {
innerStyle
.
flexWrap
=
'wrap'
;
innerStyle
.
flexWrap
=
'wrap'
;
itemStyle
.
marginBottom
=
'5px'
;
itemStyle
.
marginBottom
=
'5px'
;
}
}
const
getColor
=
(
item
:
any
)
=>
{
let
color
=
''
;
if
(
options
&&
Array
.
isArray
(
options
)
&&
options
.
length
>
0
)
{
const
obj
=
options
.
find
((
ls
)
=>
{
return
String
(
ls
.
id
)
===
String
(
item
.
value
);
})
||
{};
color
=
obj
.
color
||
'e9eef9'
;
}
return
color
;
};
if
(
mode
!==
'multiple'
)
{
if
(
mode
!==
'multiple'
)
{
// 单选
// 单选
return
(
return
(
<
div
className=
{
s
.
container
}
style=
{
{
overflow
:
'hidden'
}
}
>
<
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
],
options
)
}
}
>
<
div
className=
{
s
.
itemBgTxt
}
>
{
value
[
0
].
text
}
</
div
>
<
div
className=
{
s
.
itemBgTxt
}
>
{
value
[
0
].
text
}
</
div
>
</
span
>
</
span
>
</
div
>
</
div
>
...
@@ -78,7 +81,7 @@ export const Tags = (props: any) => {
...
@@ -78,7 +81,7 @@ export const Tags = (props: any) => {
<
span
<
span
className=
{
s
.
popItem
}
className=
{
s
.
popItem
}
key=
{
index
}
key=
{
index
}
style=
{
{
background
:
`#${getColor(item)}`
}
}
style=
{
{
background
:
getColor
(
item
,
options
)
}
}
>
>
<
div
className=
{
s
.
popItemBgTxt
}
>
{
item
.
text
}
</
div
>
<
div
className=
{
s
.
popItemBgTxt
}
>
{
item
.
text
}
</
div
>
</
span
>
</
span
>
...
@@ -93,7 +96,7 @@ export const Tags = (props: any) => {
...
@@ -93,7 +96,7 @@ export const Tags = (props: any) => {
<
span
<
span
key=
{
index
}
key=
{
index
}
className=
{
classNames
(
s
.
item
,
s
.
multi
)
}
className=
{
classNames
(
s
.
item
,
s
.
multi
)
}
style=
{
{
...
itemStyle
,
background
:
`#${getColor(item)}`
}
}
style=
{
{
...
itemStyle
,
background
:
getColor
(
item
,
options
)
}
}
>
>
<
div
className=
{
s
.
itemBgTxt
}
>
{
item
.
text
}
</
div
>
<
div
className=
{
s
.
itemBgTxt
}
>
{
item
.
text
}
</
div
>
</
span
>
</
span
>
...
@@ -108,7 +111,7 @@ export const Tags = (props: any) => {
...
@@ -108,7 +111,7 @@ export const Tags = (props: any) => {
<
span
<
span
key=
{
index
}
key=
{
index
}
className=
{
classNames
(
s
.
item
,
s
.
multi
)
}
className=
{
classNames
(
s
.
item
,
s
.
multi
)
}
style=
{
{
...
itemStyle
,
background
:
`#${getColor(item)}`
}
}
style=
{
{
...
itemStyle
,
background
:
getColor
(
item
,
options
)
}
}
>
>
<
div
className=
{
s
.
itemBgTxt
}
>
{
item
.
text
}
</
div
>
<
div
className=
{
s
.
itemBgTxt
}
>
{
item
.
text
}
</
div
>
</
span
>
</
span
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment