milestone: publish alpha version (#637)

- document folder
- full-text search
- blob storage
- basic edgeless support

Co-authored-by: tzhangchi <terry.zhangchi@outlook.com>
Co-authored-by: QiShaoXuan <qishaoxuan777@gmail.com>
Co-authored-by: DiamondThree <diamond.shx@gmail.com>
Co-authored-by: MingLiang Wang <mingliangwang0o0@gmail.com>
Co-authored-by: JimmFly <yangjinfei001@gmail.com>
Co-authored-by: Yifeng Wang <doodlewind@toeverything.info>
Co-authored-by: Himself65 <himself65@outlook.com>
Co-authored-by: lawvs <18554747+lawvs@users.noreply.github.com>
Co-authored-by: Qi <474021214@qq.com>
This commit is contained in:
DarkSky
2022-12-30 21:40:15 +08:00
committed by GitHub
parent cc790dcbc2
commit 6c2c7dcd48
296 changed files with 16139 additions and 2072 deletions
+30
View File
@@ -0,0 +1,30 @@
import { PropsWithChildren, Children, ReactNode, HTMLAttributes } from 'react';
import { StyledTable } from './styles';
const childrenHasEllipsis = (children: ReactNode | ReactNode[]): boolean => {
return Children.toArray(children).some(child => {
if (typeof child === 'object' && 'props' in child) {
if (!child.props.ellipsis && child.props.children) {
return childrenHasEllipsis(child.props.children);
}
return child.props.ellipsis ?? false;
}
return false;
});
};
export const Table = ({
children,
...props
}: PropsWithChildren<HTMLAttributes<HTMLTableElement>>) => {
const tableLayout = childrenHasEllipsis(children) ? 'fixed' : 'auto';
return (
<StyledTable tableLayout={tableLayout} {...props}>
{children}
</StyledTable>
);
};
export default Table;
+11
View File
@@ -0,0 +1,11 @@
import { HTMLAttributes, PropsWithChildren } from 'react';
import { StyledTableBody } from '@/ui/table/styles';
export const TableBody = ({
children,
...props
}: PropsWithChildren<HTMLAttributes<HTMLTableSectionElement>>) => {
return <StyledTableBody {...props}>{children}</StyledTableBody>;
};
export default TableBody;
+14
View File
@@ -0,0 +1,14 @@
import { HTMLAttributes, PropsWithChildren } from 'react';
import { TableCellProps } from './interface';
import { StyledTableCell } from './styles';
export const TableCell = ({
children,
...props
}: PropsWithChildren<
TableCellProps & HTMLAttributes<HTMLTableCellElement>
>) => {
return <StyledTableCell {...props}>{children}</StyledTableCell>;
};
export default TableCell;
+11
View File
@@ -0,0 +1,11 @@
import { HTMLAttributes, PropsWithChildren } from 'react';
import { StyledTableHead } from './styles';
export const TableHead = ({
children,
...props
}: PropsWithChildren<HTMLAttributes<HTMLTableSectionElement>>) => {
return <StyledTableHead {...props}>{children}</StyledTableHead>;
};
export default TableHead;
+11
View File
@@ -0,0 +1,11 @@
import { HTMLAttributes, PropsWithChildren } from 'react';
import { StyledTableRow } from './styles';
export const TableRow = ({
children,
...props
}: PropsWithChildren<HTMLAttributes<HTMLTableRowElement>>) => {
return <StyledTableRow {...props}>{children}</StyledTableRow>;
};
export default TableRow;
+12
View File
@@ -0,0 +1,12 @@
// import Table from '@mui/material/Table';
// import TableBody from '@mui/material/TableBody';
// import TableCell from '@mui/material/TableCell';
// import TableHead from '@mui/material/TableHead';
// import TableRow from '@mui/material/TableRow';
//
export * from './Table';
export * from './TableRow';
export * from './TableHead';
export * from './TableCell';
export * from './TableBody';
+8
View File
@@ -0,0 +1,8 @@
import { CSSProperties } from 'react';
export type TableCellProps = {
align?: 'left' | 'right' | 'center';
ellipsis?: boolean;
proportion?: number;
style?: CSSProperties;
};
+74
View File
@@ -0,0 +1,74 @@
import { styled, textEllipsis } from '@/styles';
import { TableCellProps } from './interface';
export const StyledTable = styled.table<{ tableLayout: 'auto' | 'fixed' }>(
({ theme, tableLayout }) => {
return {
fontSize: theme.font.base,
color: theme.colors.textColor,
tableLayout,
width: '100%',
borderCollapse: 'separate',
borderSpacing: '0 25px',
};
}
);
export const StyledTableBody = styled.tbody(() => {
return {
fontWeight: 400,
};
});
export const StyledTableCell = styled.td<
Pick<TableCellProps, 'ellipsis' | 'align' | 'proportion'>
>(({ align = 'left', ellipsis = false, proportion }) => {
const width = proportion ? `${proportion * 100}%` : 'auto';
return {
width,
height: '52px',
lineHeight: '52px',
padding: '0 30px',
boxSizing: 'border-box',
textAlign: align,
verticalAlign: 'middle',
...(ellipsis ? textEllipsis(1) : {}),
overflowWrap: 'break-word',
};
});
export const StyledTableHead = styled.thead(() => {
return {
fontWeight: 500,
tr: {
':hover': {
td: {
background: 'unset',
},
},
},
};
});
export const StyledTableRow = styled.tr(({ theme }) => {
return {
marginBottom: '25px',
td: {
transition: 'background .15s',
},
'td:first-of-type': {
borderTopLeftRadius: '10px',
borderBottomLeftRadius: '10px',
},
'td:last-of-type': {
borderTopRightRadius: '10px',
borderBottomRightRadius: '10px',
},
':hover': {
td: {
background: theme.colors.hoverBackground,
},
},
};
});