Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pro-blocks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
pro-blocks
Commits
6138c036
Commit
6138c036
authored
Aug 07, 2018
by
陈帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add hideCheckAll in TagSelect
parent
d2de675e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
5 deletions
+11
-5
src/components/TagSelect/index.d.ts
src/components/TagSelect/index.d.ts
+1
-0
src/components/TagSelect/index.js
src/components/TagSelect/index.js
+9
-4
src/components/TagSelect/index.md
src/components/TagSelect/index.md
+1
-1
No files found.
src/components/TagSelect/index.d.ts
View file @
6138c036
...
...
@@ -6,6 +6,7 @@ export interface ITagSelectProps {
expandable
?:
boolean
;
value
?:
string
[]
|
number
[];
style
?:
React
.
CSSProperties
;
hideCheckAll
?:
boolean
;
}
export
default
class
TagSelect
extends
React
.
Component
<
ITagSelectProps
,
any
>
{
...
...
src/components/TagSelect/index.js
View file @
6138c036
...
...
@@ -15,6 +15,9 @@ const TagSelectOption = ({ children, checked, onChange, value }) => (
TagSelectOption
.
isTagSelectOption
=
true
;
class
TagSelect
extends
Component
{
static
defaultProps
=
{
hideCheckAll
:
false
,
};
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
...
...
@@ -87,7 +90,7 @@ class TagSelect extends Component {
render
()
{
const
{
value
,
expand
}
=
this
.
state
;
const
{
children
,
className
,
style
,
expandable
}
=
this
.
props
;
const
{
children
,
hideCheckAll
,
className
,
style
,
expandable
}
=
this
.
props
;
const
checkedAll
=
this
.
getAllTags
().
length
===
value
.
length
;
...
...
@@ -97,9 +100,11 @@ class TagSelect extends Component {
});
return
(
<
div
className
=
{
cls
}
style
=
{
style
}
>
<
CheckableTag
checked
=
{
checkedAll
}
key
=
"
tag-select-__all__
"
onChange
=
{
this
.
onSelectAll
}
>
全部
<
/CheckableTag
>
{
hideCheckAll
?
null
:
(
<
CheckableTag
checked
=
{
checkedAll
}
key
=
"
tag-select-__all__
"
onChange
=
{
this
.
onSelectAll
}
>
全部
<
/CheckableTag
>
)}
{
value
&&
React
.
Children
.
map
(
children
,
child
=>
{
if
(
this
.
isTagSelectOption
(
child
))
{
...
...
src/components/TagSelect/index.md
View file @
6138c036
...
...
@@ -19,7 +19,7 @@ order: 13
| defaultValue |默认选中的项 |string[]
\|
number[] | |
| onChange | 标签选择的回调函数 | Function(checkedTags) | |
| expandable | 是否展示
`展开/收起`
按钮 | Boolean | false |
| hideCheckAll | 隐藏
`全部`
按钮 | Boolean | false |
### TagSelectOption
...
...
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