Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
Details
Activity
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
zhaochengxiang
szse
Commits
1d6f0c2a
Commit
1d6f0c2a
authored
Jan 24, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整样式
parent
b55a142a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
36 deletions
+70
-36
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+2
-4
SuggestTable.jsx
src/view/Manage/Model/Component/SuggestTable.jsx
+62
-32
SuggestTable.less
src/view/Manage/Model/Component/SuggestTable.less
+6
-0
No files found.
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
1d6f0c2a
...
...
@@ -1213,15 +1213,13 @@ const ImportActionTable = (props) => {
editingKey!=='' && <React.Fragment>
{
suggests && suggests.length>0 && (
<React.Fragment>
<SuggestTable suggests={suggests} onSelect={onSuggestChange} />
</React.Fragment>
<SuggestTable suggests={suggests} onSelect={onSuggestChange} />
)
}
</React.Fragment>
}
{
suggestHaveMore && <div className='flex
m
t-3' style={{ justifyContent: 'center' }}>
suggestHaveMore && <div className='flex
p
t-3' style={{ justifyContent: 'center' }}>
<Button onClick={loadMoreSuggests}>加载更多</Button>
</div>
}
...
...
src/view/Manage/Model/Component/SuggestTable.jsx
View file @
1d6f0c2a
import
React
,
{
useState
}
from
'react'
;
import
{
Table
,
Tooltip
}
from
'antd'
;
import
{
Resizable
}
from
'react-resizable'
;
import
ResizeObserver
from
'rc-resize-observer'
;
import
{
isSzseEnv
}
from
'../../../../util'
;
import
{
dispatch
}
from
'../../../../model'
;
import
'./SuggestTable.less'
;
const
ResizeableHeaderCell
=
props
=>
{
const
{
onResize
,
width
,
onClick
,
...
restProps
}
=
props
;
...
...
@@ -38,7 +41,7 @@ const ResizeableHeaderCell = props => {
const
SuggestTable
=
(
props
)
=>
{
const
{
suggests
,
onSelect
}
=
props
;
const
cols
=
[
{
title
:
'中文名称'
,
...
...
@@ -96,6 +99,7 @@ const SuggestTable = (props) => {
title
:
'使用次数'
,
dataIndex
:
'referencesCount'
,
width
:
80
,
ellipsis
:
true
,
render
:
(
_
,
record
)
=>
{
return
(
<
span
>
{
record
.
recommendedStats
?.
referencesCount
}
</
span
>
...
...
@@ -166,38 +170,64 @@ const SuggestTable = (props) => {
};
return
(
<
Table
rowSelection=
{
rowSelection
}
dataSource=
{
suggests
||
[]
}
pagination=
{
false
}
rowClassName=
{
(
record
,
index
)
=>
{
return
'pointer'
;
}
}
components=
{
{
header
:
{
cell
:
ResizeableHeaderCell
,
}
}
}
columns=
{
columns
.
map
((
col
,
index
)
=>
({
...
col
,
onHeaderCell
:
column
=>
({
width
:
column
.
width
,
onResize
:
handleResize
(
index
),
}),
}))
}
onRow=
{
(
record
,
index
)
=>
{
return
{
onClick
:
(
e
)
=>
{
onSelect
&&
onSelect
(
record
);
<
div
className=
'suggest-table'
>
<
ResizeObserver
onResize=
{
({
width
})
=>
{
let
newColumns
=
[...
cols
];
newColumns
.
forEach
((
column
,
index
)
=>
{
if
(
!
column
.
width
)
{
const
rowWidth
=
(
columns
.
reduce
((
preVal
,
col
)
=>
(
col
.
width
?
col
.
width
:
0
)
+
preVal
,
0
))
+
50
;
if
(
width
>
rowWidth
)
{
column
.
width
=
width
-
rowWidth
;
}
else
{
column
.
width
=
200
;
}
}
});
setColumns
(
newColumns
);
}
}
>
<
Table
rowSelection=
{
rowSelection
}
dataSource=
{
suggests
||
[]
}
pagination=
{
false
}
loading=
{
false
}
rowClassName=
{
(
record
,
index
)
=>
{
return
'pointer'
;
}
}
components=
{
{
header
:
{
cell
:
ResizeableHeaderCell
,
}
}
}
columns=
{
columns
.
map
((
column
,
index
)
=>
{
return
{
...
column
,
onHeaderCell
:
(
column
:
{
width
:
any
;
})
=>
({
width
:
column
.
width
,
onResize
:
handleResize
(
index
),
}),
};
})
}
}
}
}
scroll=
{
{
x
:
'max-content'
}
}
/>
onRow=
{
(
record
,
index
)
=>
{
return
{
onClick
:
(
e
)
=>
{
onSelect
&&
onSelect
(
record
);
}
}
}
}
/>
</
ResizeObserver
>
</
div
>
);
}
...
...
src/view/Manage/Model/Component/SuggestTable.less
0 → 100644
View file @
1d6f0c2a
.suggest-table {
.yy-table {
margin: 0 !important;
}
}
\ No newline at end of file
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