Commit fdc31de8 by zhaochengxiang

配置

parent 501537f3
...@@ -49,8 +49,18 @@ module.exports = { ...@@ -49,8 +49,18 @@ module.exports = {
libraryTarget: 'umd', libraryTarget: 'umd',
chunkLoadingGlobal: `webpackJsonp_${name}`, chunkLoadingGlobal: `webpackJsonp_${name}`,
globalObject: 'window', globalObject: 'window',
} },
} module: {
rules: [
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
],
},
},
}, },
devServer: { devServer: {
headers: { headers: {
......
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
"@testing-library/jest-dom": "^5.11.4", "@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0", "@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10", "@testing-library/user-event": "^12.1.10",
"@types/jest": "^27.4.1", "@types/jest": "^27.5.1",
"@types/node": "^17.0.21", "@types/node": "^17.0.35",
"@types/react": "^17.0.39", "@types/react": "^18.0.9",
"@types/react-dom": "^17.0.12", "@types/react-dom": "^18.0.4",
"ahooks": "^3.1.7", "ahooks": "^3.1.7",
"antd": "4.18.2", "antd": "4.18.2",
"axios": "^0.19.0", "axios": "^0.19.0",
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
"local-storage": "^2.0.0", "local-storage": "^2.0.0",
"react": "^17.0.1", "react": "^17.0.1",
"react-contexify": "^5.0.0", "react-contexify": "^5.0.0",
"react-contextmenu": "^2.14.0", "react-contextmenu": "2.14.0",
"react-data-grid": "^7.0.0-beta.12", "react-data-grid": "^7.0.0-beta.12",
"react-dnd": "^14.0.2", "react-dnd": "^14.0.2",
"react-dnd-html5-backend": "^14.0.0", "react-dnd-html5-backend": "^14.0.0",
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
"redux-saga": "^1.0.5", "redux-saga": "^1.0.5",
"showdown": "^1.9.1", "showdown": "^1.9.1",
"smooth-scroll": "^16.1.3", "smooth-scroll": "^16.1.3",
"typescript": "^4.6.2", "typescript": "^4.6.4",
"web-vitals": "^1.0.1" "web-vitals": "^1.0.1"
}, },
"scripts": { "scripts": {
......
...@@ -366,42 +366,3 @@ svg { ...@@ -366,42 +366,3 @@ svg {
max-height: 70vh; max-height: 70vh;
overflow: auto; overflow: auto;
} }
//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;
&: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 {
.rdg-cell {
box-shadow: none !important;
color: #363636 !important;
border-block-end: 1px solid #f0f0f0 !important;
border-inline-end: none !important;
outline: none !important;
}
}
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
} }
} }
:global(.react-contextmenu-wrapper) { .virtualTable {
display: contents; background-color: #000 !important;
} }
.contextMenu { .contextMenu {
......
...@@ -47,14 +47,6 @@ interface Props<Row> { ...@@ -47,14 +47,6 @@ interface Props<Row> {
onSelectedRowsChange?: (selectedRows: Array<any>) => void onSelectedRowsChange?: (selectedRows: Array<any>) => void
} }
function RowRenderer<Row, SR>(id: string) {
return (props: RowRendererProps<Row, SR>) => (
<ContextMenuTrigger id={id} collect={() => ({ rowIdx: props.rowIdx })}>
<GridRow {...props} />
</ContextMenuTrigger>
);
}
const CheckboxFormatter = forwardRef<HTMLInputElement, CheckboxFormatterProps>( const CheckboxFormatter = forwardRef<HTMLInputElement, CheckboxFormatterProps>(
function CheckboxFormatter({ onChange, ...props }: CheckboxFormatterProps, ref) { function CheckboxFormatter({ onChange, ...props }: CheckboxFormatterProps, ref) {
function handleChange(e: CheckboxChangeEvent) { function handleChange(e: CheckboxChangeEvent) {
...@@ -225,11 +217,9 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat ...@@ -225,11 +217,9 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
}, [loadMoreRows, rows]) }, [loadMoreRows, rows])
const contextMenuId = contextMenu?.id ?? nanoid() const contextMenuId = contextMenu?.id ?? nanoid()
return ( return (
<> <div className={css.virtualTable}>
<DataGrid <DataGrid
// className='virtual-table'
ref={gridRef} ref={gridRef}
{...rest} {...rest}
...@@ -239,19 +229,23 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat ...@@ -239,19 +229,23 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
components={{ components={{
sortIcon: SortIcon, sortIcon: SortIcon,
checkboxFormatter: CheckboxFormatter, checkboxFormatter: CheckboxFormatter,
rowRenderer: (props) => { // rowRenderer: (props) => {
return ( // return (
contextMenu ? <ContextMenuTrigger id={contextMenuId} collect={() => ({ rowIdx: props?.rowIdx })} disable={props.row.__type__===RowType.Detail}> // contextMenu ? <ContextMenuTrigger
<GridRow // id={contextMenuId}
id={props.row.id} // collect={() => ({ rowIdx: props?.rowIdx })}
onContextMenu={(e: React.MouseEvent) => { // disable={props.row.__type__===RowType.Detail}
setContextItem(props.row); // >
}} // <GridRow
{...props} // id={props.row.id}
/> // onContextMenu={(e: React.MouseEvent) => {
</ContextMenuTrigger> : <React.Fragment></React.Fragment> // setContextItem(props.row);
) // }}
}, // {...props}
// />
// </ContextMenuTrigger> : <React.Fragment></React.Fragment>
// )
// },
noRowsFallback: <div style={{ textAlign: 'center', gridColumn: '1/-1' }}> noRowsFallback: <div style={{ textAlign: 'center', gridColumn: '1/-1' }}>
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
</div>, </div>,
...@@ -278,15 +272,15 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat ...@@ -278,15 +272,15 @@ function FC<Row extends RowData, SR, K extends React.Key = React.Key>(props: Dat
// 滚动 // 滚动
onScroll={loadMoreRows ? handleScroll : undefined} onScroll={loadMoreRows ? handleScroll : undefined}
/> />
{contextMenu && createPortal( {/* {contextMenu && createPortal(
<div className={classNames(css.contextMenu)}> <div className={classNames(css.contextMenu)}>
<ContextMenu id={contextMenuId} rtl={false}> <ContextMenu id={contextMenuId} rtl={false}>
{contextMenu.menu(contextItem)} {contextMenu.menu(contextItem)}
</ContextMenu> </ContextMenu>
</div>, </div>,
document.body document.body
)} )} */}
</> </div>
); );
} }
......
{ {
"compilerOptions": { "compilerOptions": {
"target": "es2016", "target": "es5",
"module": "esnext",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"lib": [ "lib": [
"dom", "dom",
"dom.iterable", "dom.iterable",
"esnext" "esnext"
], ],
"allowJs": true, "allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
......
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