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
1482c759
Commit
1482c759
authored
Jan 29, 2021
by
李晓静
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加自定义表头样式
parent
1892b352
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
index.tsx
components/apolloTable/component/index.tsx
+8
-9
index.tsx
components/apolloTable/component/operate/index.tsx
+9
-6
No files found.
components/apolloTable/component/index.tsx
View file @
1482c759
...
...
@@ -133,10 +133,9 @@ class AirTable extends React.Component<CommonProps, CommonState> {
nextState
.
columns
=
nextProps
.
columns
;
}
const
operateConfig
=
nextProps
.
operateConfig
;
const
nextGroupConfig
:
any
=
operateConfig
&&
operateConfig
.
menusGroup
&&
operateConfig
.
menusGroup
.
find
((
item
:
any
)
=>
{
const
nextGroupConfig
:
any
=
operateConfig
&&
operateConfig
.
menusGroup
&&
operateConfig
.
menusGroup
.
find
((
item
:
any
)
=>
{
return
item
.
type
===
'group'
;
});
if
(
nextGroupConfig
&&
JSON
.
stringify
(
groupConfig
)
!==
JSON
.
stringify
(
nextGroupConfig
.
value
))
{
...
...
@@ -214,18 +213,18 @@ class AirTable extends React.Component<CommonProps, CommonState> {
cachedFeAttr
,
renderFirstLeft
,
leftMargin
,
selfClass
,
}
=
this
.
props
;
const
sortConfig
=
operateConfig
&&
operateConfig
.
menusGroup
&&
operateConfig
.
menusGroup
.
find
((
item
:
any
)
=>
{
const
sortConfig
=
operateConfig
&&
operateConfig
.
menusGroup
&&
operateConfig
.
menusGroup
.
find
((
item
:
any
)
=>
{
return
item
.
type
===
'sort'
;
});
const
memDataSource
=
memoizeData
(
groupConfig
,
dataSource
);
return
(
<
Provider
value=
{
{
locale
:
this
.
getContext
()
}
}
>
<
div
className=
{
classNames
(
styles
.
container
,
className
)
}
>
{
operateConfig
&&
<
OperateConfig
columns=
{
columns
}
operateConfig=
{
operateConfig
}
/>
}
{
operateConfig
&&
<
OperateConfig
selfClass=
{
selfClass
}
columns=
{
columns
}
operateConfig=
{
operateConfig
}
/>
}
<
div
className=
{
classNames
(
styles
.
tableContainer
,
tableClassName
)
}
>
{
tableOperateConfig
&&
(
<
div
className=
{
styles
.
tableOperateContainer
}
>
...
...
components/apolloTable/component/operate/index.tsx
View file @
1482c759
import
React
,
{
Component
}
from
'react'
;
import
{
Button
}
from
'antd'
;
import
classname
from
'classnames'
;
import
Hide
from
'../hide'
;
import
Filter
from
'../filter'
;
import
Sort
from
'../sort'
;
...
...
@@ -10,6 +11,7 @@ import s from './index.less';
import
{
OperateConfigProps
,
ColumnProps
}
from
'../interface'
;
interface
Props
{
selfClass
?:
string
;
operateConfig
?:
OperateConfigProps
;
columns
:
ColumnProps
[];
}
...
...
@@ -39,7 +41,9 @@ export default class Operate extends Component<Props> {
};
renderBtn
=
(
btn
:
any
)
=>
{
const
{
render
,
label
,
onClick
,
type
,
ghost
,
icon
}
=
btn
;
const
{
render
,
label
,
onClick
,
type
,
ghost
,
icon
,
}
=
btn
;
if
(
typeof
render
===
'function'
)
{
return
render
(
btn
);
}
...
...
@@ -52,12 +56,11 @@ export default class Operate extends Component<Props> {
};
render
()
{
const
{
operateConfig
,
columns
}
=
this
.
props
;
const
{
operateConfig
,
columns
,
selfClass
}
=
this
.
props
;
const
{
menusGroup
,
buttonsGroup
,
renderCustomNode
,
showCondition
}:
any
=
operateConfig
||
{};
const
filter
:
any
=
menusGroup
&&
menusGroup
.
find
((
item
:
any
)
=>
{
const
filter
:
any
=
menusGroup
&&
menusGroup
.
find
((
item
:
any
)
=>
{
return
item
.
type
===
'filter'
;
});
return
(
...
...
@@ -65,7 +68,7 @@ export default class Operate extends Component<Props> {
{
renderCustomNode
&&
typeof
renderCustomNode
===
'function'
?
renderCustomNode
()
:
null
}
<
div
className=
{
s
.
headerContainer
}
>
{
menusGroup
&&
(
<
div
className=
{
s
.
defaultMenus
}
>
<
div
className=
{
classname
(
s
.
defaultMenus
,
selfClass
||
''
)
}
>
{
menusGroup
.
map
((
item
:
any
,
i
:
number
)
=>
{
return
(
<
div
className=
{
s
.
operate
}
key=
{
i
}
>
...
...
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