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
2ec9b0ad
Commit
2ec9b0ad
authored
May 23, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定义行高
parent
3f2087eb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
index.less
src/index.less
+4
-0
ModelTable.jsx
src/view/Manage/Model/Component/ModelTable.jsx
+1
-0
test-table.tsx
src/view/Manage/VirtualTable/test-table.tsx
+9
-6
No files found.
src/index.less
View file @
2ec9b0ad
...
...
@@ -397,6 +397,10 @@ svg {
}
.rdg-row {
&:hover {
background-color: #fafafa;
}
.rdg-cell {
box-shadow: none !important;
color: #363636 !important;
...
...
src/view/Manage/Model/Component/ModelTable.jsx
View file @
2ec9b0ad
...
...
@@ -592,6 +592,7 @@ const ModelTable = (props) => {
checkable
columns=
{
columns
}
rows=
{
modelId
?(
subData
||
[]):(
data
||
[])
}
rowHeight=
{
modelId
?
39
:
51
}
rowExpandable=
{
(
row
)
=>
{
return
row
?.
alreadyCheckedOut
;
}
}
...
...
src/view/Manage/VirtualTable/test-table.tsx
View file @
2ec9b0ad
...
...
@@ -6,6 +6,7 @@ import type { RowRendererProps, DataGridHandle, CheckboxFormatterProps } from 'r
import
classNames
from
'classnames'
;
import
{
Checkbox
,
Empty
}
from
'antd'
;
import
type
{
CheckboxChangeEvent
}
from
'antd/es/checkbox'
;
import
{
DownOutlined
,
UpOutlined
}
from
'@ant-design/icons'
;
import
{
nanoid
}
from
'nanoid'
;
import
{
downNode
,
upNode
}
from
'./test-table-helper'
;
...
...
@@ -45,6 +46,8 @@ interface Props<Row> {
loadMoreRows
?:
(
length
:
number
)
=>
Promise
<
Row
[]
>
|
undefined
selectedRows
?:
Array
<
any
>
onSelectedRowsChange
?:
(
selectedRows
:
Array
<
any
>
)
=>
void
rowHeight
?:
number
expandedRowHeight
?:
number
}
const
CheckboxFormatter
=
forwardRef
<
HTMLInputElement
,
CheckboxFormatterProps
>
(
...
...
@@ -97,7 +100,7 @@ export function getExpandingCol<Row extends RowData, SR>({ colSpan, expand, expa
});
}
}
>
{
row
.
__expanded__
?
'
\
u25BC'
:
'
\
u25B6'
}
{
row
.
__expanded__
?
<
UpOutlined
/>
:
<
DownOutlined
/>
}
</
div
>
);
}
...
...
@@ -113,7 +116,7 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
getComparator
,
loadMoreRows
,
onSelectedRowsChange
,
contextMenu
,
columns
,
rows
,
checkable
,
selectedRows
,
...
rest
}
=
props
contextMenu
,
columns
,
rows
,
checkable
,
selectedRows
,
rowHeight
=
45
,
expandedRowHeight
=
1000
,
...
rest
}
=
props
const
rowKeyGetter
=
(
row
:
Row
):
K
=>
{
return
row
.
id
as
K
;
...
...
@@ -143,6 +146,7 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
// 已排序行
const
[
sortColumns
,
setSortColumns
]
=
useState
<
readonly
SortColumn
[]
>
([]);
// 排序列图标状态
const
[
_rows
,
_setRows
]
=
useState
<
readonly
Row
[]
>
([])
useEffect
(()
=>
{
const
newRows
=
[...
rows
];
...
...
@@ -192,7 +196,7 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
return
cols
}
else
if
(
checkable
)
{
const
cols
:
readonly
Column
<
Row
,
SR
>
[]
=
[
{
...
SelectColumn
,
frozen
:
false
},
{
...
SelectColumn
,
key
:
'select'
,
frozen
:
false
},
...
columns
,
]
return
cols
...
...
@@ -201,7 +205,6 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
return
columns
},
[
columns
,
expandRow
,
_rows
,
checkable
,
checkAll
,
setCheckAll
])
// 取得选中
const
getSelected
=
useCallback
(()
=>
{
const
selected
=
_rows
.
filter
((
item
)
=>
item
.
__selected__
===
true
).
map
(
item
=>
item
.
id
)
...
...
@@ -252,7 +255,7 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
onRowsChange=
{
onRowsChange
}
// headerRowHeight={45}
rowHeight=
{
(
args
)
=>
(
args
.
type
===
'ROW'
&&
args
.
row
.
__type__
===
RowType
.
Detail
?
300
:
45
)
}
rowHeight=
{
(
args
)
=>
(
args
.
type
===
'ROW'
&&
args
.
row
.
__type__
===
RowType
.
Detail
?
expandedRowHeight
:
rowHeight
)
}
// defaultColumnOptions={{
// sortable: true,
...
...
@@ -263,7 +266,7 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
sortColumns=
{
sortColumns
}
onSortColumnsChange=
{
setSortColumns
}
selectedRows=
{
new
Set
(
selectedRows
||
[])
}
selectedRows=
{
_selectedRows
}
onSelectedRowsChange=
{
(
values
:
Set
<
any
>
)
=>
{
console
.
log
(
'values'
,
values
);
onSelectedRowsChange
&&
onSelectedRowsChange
(
Array
.
from
(
values
));
...
...
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