Commit 673845c2 by zhaochengxiang

模型虚拟滚动问题

parent e74484de
...@@ -7,24 +7,6 @@ module.exports = { ...@@ -7,24 +7,6 @@ module.exports = {
{ {
plugin: CracoLessPlugin, plugin: CracoLessPlugin,
options: { options: {
modifyLessRule(lessRule, context) {
// You have to exclude these file suffixes first,
// if you want to modify the less module's suffix
lessRule.exclude = /\.m\.less$/;
return lessRule;
},
modifyLessModuleRule(lessModuleRule, context) {
// Configure the file suffix
lessModuleRule.test = /\.m\.less$/;
// Configure the generated local ident name.
const cssLoader = lessModuleRule.use.find(loaderByName("css-loader"));
cssLoader.options.modules = {
localIdentName: "[local]_[hash:base64:5]",
};
return lessModuleRule;
},
lessLoaderOptions: { lessLoaderOptions: {
lessOptions: { lessOptions: {
modifyVars: { modifyVars: {
......
.virtual-table {
.rdg {
border: none !important;
}
.rdg-header-row {
.rdg-cell {
box-shadow: none !important;
background-color: #f2f5fc!important;
border-block-end: none !important;
border-inline-end: none !important;
font-weight: normal !important;
outline: none !important;
top: 0 !important;
padding-inline: 0 !important;
padding-left: 8px !important;
padding-right: 8px !important;
&:before {
position: absolute;
top: 50%;
right: 0;
width: 1px;
height: 1.6em;
background-color: rgba(0,0,0,.06);
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
transition: background-color .3s;
content: "";
}
}
}
.rdg-row {
&:hover {
background-color: #fafafa;
}
.rdg-cell {
box-shadow: none !important;
color: #363636 !important;
border-block-end: 1px solid #f0f0f0 !important;
border-inline-end: none !important;
outline: none !important;
padding-inline: 0 !important;
padding-left: 8px !important;
padding-right: 8px !important;
}
}
.react-contextmenu-wrapper {
display: contents;
}
}
\ No newline at end of file
...@@ -10,6 +10,8 @@ import { DownOutlined, UpOutlined } from '@ant-design/icons'; ...@@ -10,6 +10,8 @@ import { DownOutlined, UpOutlined } from '@ant-design/icons';
import { nanoid } from 'nanoid'; import { nanoid } from 'nanoid';
import { downNode, upNode } from './virtual-table-helper'; import { downNode, upNode } from './virtual-table-helper';
import './index.less';
export enum RowAction { export enum RowAction {
None, Expand, Select None, Expand, Select
} }
...@@ -209,10 +211,9 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat ...@@ -209,10 +211,9 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
const contextMenuId = contextMenu?.id ?? nanoid() const contextMenuId = contextMenu?.id ?? nanoid()
return ( return (
<React.Fragment> <div className='virtual-table'>
<DataGrid <DataGrid
ref={gridRef} ref={gridRef}
{...rest} {...rest}
columns={cols} columns={cols}
rows={_rows} rows={_rows}
...@@ -244,14 +245,9 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat ...@@ -244,14 +245,9 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
}} }}
onRowsChange={onRowsChange} onRowsChange={onRowsChange}
// headerRowHeight={45} headerRowHeight={38}
rowHeight={(args) => (args.type === 'ROW' && args.row.__type__ === RowType.Detail ? (expandable?.expandedRowHeight||100) : rowHeight)} rowHeight={(args) => (args.type === 'ROW' && args.row.__type__ === RowType.Detail ? (expandable?.expandedRowHeight||100) : rowHeight)}
// defaultColumnOptions={{
// sortable: true,
// resizable: true
// }}
// 排序 // 排序
sortColumns={sortColumns} sortColumns={sortColumns}
onSortColumnsChange={setSortColumns} onSortColumnsChange={setSortColumns}
...@@ -270,7 +266,7 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat ...@@ -270,7 +266,7 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
, ,
document.body document.body
)} )}
</React.Fragment> </div>
); );
} }
......
.rdg {
border: none !important;
}
.rdg-header-row {
.rdg-cell {
box-shadow: none !important;
background-color: #f2f5fc!important;
border-block-end: none !important;
border-inline-end: none !important;
font-weight: normal !important;
outline: none !important;
top: 0 !important;
padding-inline: 0 !important;
padding-left: 8px !important;
padding-right: 8px !important;
&:before {
position: absolute;
top: 50%;
right: 0;
width: 1px;
height: 1.6em;
background-color: rgba(0,0,0,.06);
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
transition: background-color .3s;
content: "";
}
}
}
.rdg-row {
&:hover {
background-color: #fafafa;
}
.rdg-cell {
box-shadow: none !important;
color: #363636 !important;
border-block-end: 1px solid #f0f0f0 !important;
border-inline-end: none !important;
outline: none !important;
padding-inline: 0 !important;
padding-left: 8px !important;
padding-right: 8px !important;
}
}
.react-contextmenu-wrapper {
display: contents;
}
.react-contextmenu { .react-contextmenu {
background-color: #fff; background-color: #fff;
background-clip: padding-box; background-clip: padding-box;
...@@ -65,7 +12,8 @@ ...@@ -65,7 +12,8 @@
min-inline-size: 160px; min-inline-size: 160px;
outline: none; outline: none;
opacity: 0; opacity: 0;
padding-block: 5px; padding-top: 5px;
padding-bottom: 5px;
padding-inline: 0; padding-inline: 0;
pointer-events: none; pointer-events: none;
text-align: start; text-align: start;
...@@ -82,8 +30,9 @@ ...@@ -82,8 +30,9 @@
cursor: pointer; cursor: pointer;
font-weight: 400; font-weight: 400;
line-height: 1.5; line-height: 1.5;
padding-block: 3px; padding-top: 3px;
padding-inline: 20px; padding-bottom: 3px;
padding-left: 20px;
text-align: inherit; text-align: inherit;
white-space: nowrap; white-space: nowrap;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment