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
5e44ff54
Commit
5e44ff54
authored
Jun 03, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update apolloTableContentMenu
parent
135695f3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
4 deletions
+59
-4
Cell.less
components/apolloTable/component/Cell.less
+9
-0
Cell.tsx
components/apolloTable/component/Cell.tsx
+44
-4
Table.tsx
components/apolloTable/component/Table.tsx
+2
-0
index.tsx
components/apolloTable/component/index.tsx
+2
-0
interface.tsx
components/apolloTable/component/interface.tsx
+2
-0
No files found.
components/apolloTable/component/Cell.less
View file @
5e44ff54
...
@@ -52,3 +52,12 @@
...
@@ -52,3 +52,12 @@
top: 0;
top: 0;
left: 0;
left: 0;
}
}
.menuPop {
width: 110px;
:global(.ant-popover-inner-content) {
padding: @paddingSmX 0;
border-radius: @borderRadius;
background: #333333;
}
}
components/apolloTable/component/Cell.tsx
View file @
5e44ff54
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Checkbox
,
message
}
from
'antd'
;
import
{
Checkbox
,
message
,
Popover
}
from
'antd'
;
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
{
config
}
from
'./base/config'
;
import
{
config
}
from
'./base/config'
;
import
{
getEditComponent
}
from
'./base'
;
import
{
getEditComponent
}
from
'./base'
;
...
@@ -28,6 +28,7 @@ const Cell = (props: CellProps) => {
...
@@ -28,6 +28,7 @@ const Cell = (props: CellProps) => {
cellEditable
,
cellEditable
,
rowSelection
,
rowSelection
,
columns
,
columns
,
contentMenu
,
}
=
props
;
}
=
props
;
const
{
const
{
columnType
,
columnType
,
...
@@ -93,7 +94,8 @@ const Cell = (props: CellProps) => {
...
@@ -93,7 +94,8 @@ const Cell = (props: CellProps) => {
};
};
const
selfRenderDetailCell
=
()
=>
{
const
selfRenderDetailCell
=
()
=>
{
let
empty
=
!
cellData
||
cellData
.
length
===
0
||
(
cellData
.
length
===
1
&&
!
cellData
[
0
].
text
&&
!
cellData
[
0
].
value
);
let
empty
=
!
cellData
||
cellData
.
length
===
0
||
(
cellData
.
length
===
1
&&
!
cellData
[
0
].
text
&&
!
cellData
[
0
].
value
);
let
detailConfig
;
let
detailConfig
;
if
(
typeof
renderDetailCell
===
'function'
)
{
if
(
typeof
renderDetailCell
===
'function'
)
{
detailConfig
=
renderDetailCell
({
cellData
,
rowData
:
record
,
columnConfig
});
detailConfig
=
renderDetailCell
({
cellData
,
rowData
:
record
,
columnConfig
});
...
@@ -152,7 +154,7 @@ const Cell = (props: CellProps) => {
...
@@ -152,7 +154,7 @@ const Cell = (props: CellProps) => {
return
<
Checkbox
checked=
{
checked
}
onClick=
{
onToggle
}
/>;
return
<
Checkbox
checked=
{
checked
}
onClick=
{
onToggle
}
/>;
};
};
return
(
const
detail
=
(
<
div
<
div
className=
{
s
.
detailCell
}
className=
{
s
.
detailCell
}
onDoubleClick=
{
()
=>
{
onDoubleClick=
{
()
=>
{
...
@@ -162,7 +164,16 @@ const Cell = (props: CellProps) => {
...
@@ -162,7 +164,16 @@ const Cell = (props: CellProps) => {
>
>
{
rowSelection
&&
columnIndex
===
0
&&
<
div
className=
{
s
.
checkbox
}
>
{
getCheckbox
()
}
</
div
>
}
{
rowSelection
&&
columnIndex
===
0
&&
<
div
className=
{
s
.
checkbox
}
>
{
getCheckbox
()
}
</
div
>
}
{
showIndex
&&
columnIndex
===
0
&&
<
div
className=
{
s
.
num
}
>
{
getIndex
()
}
</
div
>
}
{
showIndex
&&
columnIndex
===
0
&&
<
div
className=
{
s
.
num
}
>
{
getIndex
()
}
</
div
>
}
{
showExpand
&&
columnIndex
===
0
&&
<
div
className=
{
s
.
expand
}
><
img
onClick=
{
showExpand
.
bind
(
null
,{
rowId
:
record
.
id
})
}
className=
{
s
.
expandIcon
}
alt=
""
src=
{
expandIcon
}
/></
div
>
}
{
showExpand
&&
columnIndex
===
0
&&
(
<
div
className=
{
s
.
expand
}
>
<
img
onClick=
{
showExpand
.
bind
(
null
,
{
rowId
:
record
.
id
})
}
className=
{
s
.
expandIcon
}
alt=
""
src=
{
expandIcon
}
/>
</
div
>
)
}
{
empty
?
(
{
empty
?
(
emptyPlaceholder
||
'-'
emptyPlaceholder
||
'-'
)
:
(
)
:
(
...
@@ -180,6 +191,35 @@ const Cell = (props: CellProps) => {
...
@@ -180,6 +191,35 @@ const Cell = (props: CellProps) => {
)
}
)
}
</
div
>
</
div
>
);
);
console
.
log
(
'contentMenu'
,
contentMenu
);
return
contentMenu
?
(
<
Popover
overlayClassName=
{
s
.
menuPop
}
trigger=
"contextMenu"
placement=
"rightTop"
content=
{
<
div
role=
"presentation"
className=
{
style
.
menuContainer
}
>
{
contentMenu
.
map
((
item
:
any
,
i
:
number
)
=>
{
return
(
<
div
key=
{
i
}
role=
"presentation"
className=
{
style
.
menu
}
onClick=
{
item
.
onClick
.
bind
(
null
,
record
)
}
>
{
item
.
label
}
</
div
>
);
})
}
</
div
>
}
>
{
detail
}
</
Popover
>
)
:
(
detail
);
};
};
const
selfRenderEditCell
=
()
=>
{
const
selfRenderEditCell
=
()
=>
{
...
...
components/apolloTable/component/Table.tsx
View file @
5e44ff54
...
@@ -305,6 +305,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -305,6 +305,7 @@ export default class AirTable extends Component<TableProps, TableState> {
emptyPlaceholder
,
emptyPlaceholder
,
cellEditable
,
cellEditable
,
rowSelection
,
rowSelection
,
contentMenu
,
}
=
this
.
props
;
}
=
this
.
props
;
if
(
showColumns
.
length
===
0
||
showData
.
length
===
0
)
{
if
(
showColumns
.
length
===
0
||
showData
.
length
===
0
)
{
return
;
return
;
...
@@ -331,6 +332,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -331,6 +332,7 @@ export default class AirTable extends Component<TableProps, TableState> {
emptyPlaceholder=
{
emptyPlaceholder
}
emptyPlaceholder=
{
emptyPlaceholder
}
cellEditable=
{
cellEditable
}
cellEditable=
{
cellEditable
}
rowSelection=
{
position
===
'right'
?
false
:
rowSelection
}
rowSelection=
{
position
===
'right'
?
false
:
rowSelection
}
contentMenu=
{
contentMenu
}
/>
/>
);
);
};
};
...
...
components/apolloTable/component/index.tsx
View file @
5e44ff54
...
@@ -60,6 +60,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
...
@@ -60,6 +60,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
noDataPlaceholder
,
noDataPlaceholder
,
columnWidth
,
columnWidth
,
headerHeight
,
headerHeight
,
contentMenu
,
}
=
this
.
props
;
}
=
this
.
props
;
const
sortConfig
=
operateConfig
const
sortConfig
=
operateConfig
&&
operateConfig
.
menusGroup
&&
operateConfig
.
menusGroup
...
@@ -93,6 +94,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
...
@@ -93,6 +94,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
loading=
{
loading
}
loading=
{
loading
}
rowSelection=
{
rowSelection
}
rowSelection=
{
rowSelection
}
noDataPlaceholder=
{
noDataPlaceholder
}
noDataPlaceholder=
{
noDataPlaceholder
}
contentMenu=
{
contentMenu
}
/>
/>
</
div
>
</
div
>
{
paginationConfig
&&
<
Pagination
{
...
paginationConfig
}
/>
}
{
paginationConfig
&&
<
Pagination
{
...
paginationConfig
}
/>
}
...
...
components/apolloTable/component/interface.tsx
View file @
5e44ff54
...
@@ -70,6 +70,7 @@ export interface TableProps extends LoadConfigProps {
...
@@ -70,6 +70,7 @@ export interface TableProps extends LoadConfigProps {
loading
?:
boolean
;
loading
?:
boolean
;
rowSelection
?:
any
;
rowSelection
?:
any
;
noDataPlaceholder
?:
any
;
noDataPlaceholder
?:
any
;
contentMenu
?:
any
;
}
}
export
interface
TableState
{
export
interface
TableState
{
columns
:
ColumnProps
[];
columns
:
ColumnProps
[];
...
@@ -111,6 +112,7 @@ export interface CellProps {
...
@@ -111,6 +112,7 @@ export interface CellProps {
emptyPlaceholder
?:
string
;
emptyPlaceholder
?:
string
;
cellEditable
?:
boolean
;
cellEditable
?:
boolean
;
rowSelection
?:
any
;
rowSelection
?:
any
;
contentMenu
?:
any
;
}
}
export
interface
EditCellProps
{
export
interface
EditCellProps
{
...
...
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