DocSpace-client/packages/asc-web-components/table-container/StyledTableContainer.js

276 lines
5.1 KiB
JavaScript
Raw Normal View History

import styled, { css } from "styled-components";
import Base from "../themes/base";
import { mobile, tablet } from "../utils/device";
import Scrollbar from "../scrollbar";
2021-07-09 08:59:20 +00:00
2021-07-15 07:57:06 +00:00
const StyledTableContainer = styled.div`
-moz-user-select: none;
2021-07-09 08:59:20 +00:00
width: 100%;
2021-07-13 08:07:50 +00:00
max-width: 100%;
margin-top: -18px;
2021-07-15 07:57:06 +00:00
display: grid;
2021-07-09 08:59:20 +00:00
.table-column {
user-select: none;
position: relative;
min-width: 10%;
}
.resize-handle {
display: block;
cursor: ew-resize;
height: 10px;
2021-07-27 13:02:25 +00:00
margin: 14px 8px 0 auto;
2021-07-09 08:59:20 +00:00
z-index: 1;
border-right: 2px solid #d0d5da;
2021-07-09 08:59:20 +00:00
}
.table-container_group-menu {
padding-left: 24px;
margin-left: -24px;
padding-right: 24px;
margin-right: -24px;
border-bottom: 1px solid;
border-image-slice: 1;
border-image-source: linear-gradient(
to right,
#ffffff 24px,
#eceef1 24px,
#eceef1 calc(100% - 24px),
#ffffff calc(100% - 24px)
);
border-top: 0;
}
2021-07-09 08:59:20 +00:00
.content-container {
overflow: hidden;
}
.children-wrap {
display: flex;
flex-direction: column;
}
.table-cell {
height: 47px;
border-bottom: 1px solid #eceef1;
}
.table-container_group-menu {
.table-container_group-menu-checkbox {
width: 22px;
}
}
2021-07-09 08:59:20 +00:00
`;
const StyledTableGroupMenu = styled.div`
position: relative;
background: #fff;
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
z-index: 200;
height: 52px;
box-shadow: 0px 5px 20px rgba(4, 15, 27, 7%);
border-radius: 0px 0px 6px 6px;
margin: 0px -24px;
width: calc(100% + 48px);
@media ${tablet} {
height: 60px;
width: calc(100% + 40px);
}
@media ${mobile} {
height: 52px;
}
.table-container_group-menu-checkbox {
margin-left: 24px;
${(props) => props.checkboxMargin && `margin-left: ${props.checkboxMargin}`}
}
.table-container_group-menu-separator {
border-right: 1px solid #d0d5da;
width: 2px;
height: 20px;
margin: 0 8px;
}
.table-container_group-menu_button {
margin-right: 8px;
}
.table-container_group-menu-combobox {
height: 24px;
width: 16px;
margin: 3px 0px 0px 3px;
.combo-button {
.combo-buttons_arrow-icon {
margin: 1px 16px 0 0;
}
}
}
2021-07-15 07:57:06 +00:00
`;
const StyledTableHeader = styled.div`
position: fixed;
background: #fff;
2021-07-15 07:57:06 +00:00
display: grid;
z-index: 1;
height: 39px;
border-bottom: 1px solid #eceef1;
margin: 0 -24px;
padding: 0 24px;
.table-container_header-checkbox {
${(props) => props.checkboxMargin && `margin-left: ${props.checkboxMargin}`}
}
.table-container_header-cell {
overflow: hidden;
}
2021-07-15 07:57:06 +00:00
`;
const StyledTableHeaderCell = styled.div`
cursor: ${(props) => (props.showIcon ? "pointer" : "default")};
.header-container-text-icon {
padding: 13px 0 0 4px;
display: ${(props) =>
props.isActive && props.showIcon ? "block" : "none"};
${(props) =>
props.sorted &&
css`
transform: scale(1, -1);
padding: 14px 0 0 4px;
`}
}
:hover {
.header-container-text-icon {
${(props) =>
props.showIcon &&
css`
display: block;
`};
}
}
2021-07-27 12:22:51 +00:00
.table-container_header-item {
display: flex;
user-select: none;
}
.header-container-text-wrapper {
display: flex;
}
.header-container-text {
height: 38px;
display: flex;
align-items: center;
}
`;
2021-07-15 07:57:06 +00:00
const StyledTableBody = styled.div`
display: contents;
`;
const StyledTableRow = styled.div`
display: contents;
.table-container_header-checkbox {
svg {
margin: 0;
}
}
.droppable-hover {
background: ${(props) =>
2021-08-25 13:53:26 +00:00
props.dragging
? `${props.theme.dragAndDrop.acceptBackground} !important`
: "none"};
}
`;
2021-07-15 07:57:06 +00:00
const StyledTableCell = styled.div`
/* padding-right: 8px; */
2021-07-15 07:57:06 +00:00
height: 40px;
max-height: 40px;
2021-07-09 08:59:20 +00:00
border-bottom: 1px solid #eceef1;
overflow: hidden;
2021-07-15 07:57:06 +00:00
display: flex;
align-items: center;
.react-svg-icon svg {
margin-top: 2px;
}
.table-container_element {
display: ${(props) => (props.checked ? "none" : "flex")};
}
.table-container_row-checkbox {
display: ${(props) => (props.checked ? "flex" : "none")};
}
${(props) =>
props.hasAccess &&
css`
:hover {
.table-container_element {
display: none;
}
.table-container_row-checkbox {
display: flex;
}
}
`}
2021-07-09 08:59:20 +00:00
`;
const StyledTableSettings = styled.div`
margin: 14px 0 0px 8px;
display: inline-block;
position: relative;
cursor: pointer;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
.table-container_settings-checkbox {
padding: 8px 16px;
}
2021-07-15 07:57:06 +00:00
`;
2021-07-13 08:07:50 +00:00
2021-07-20 13:01:54 +00:00
const StyledEmptyTableContainer = styled.div`
grid-column-start: 1;
grid-column-end: -1;
height: 40px;
`;
const StyledScrollbar = styled(Scrollbar)`
.scroll-body {
display: flex;
}
`;
StyledTableRow.defaultProps = { theme: Base };
2021-07-13 08:07:50 +00:00
export {
StyledTableContainer,
StyledTableRow,
StyledTableBody,
StyledTableHeader,
StyledTableHeaderCell,
2021-07-13 08:07:50 +00:00
StyledTableCell,
StyledTableSettings,
StyledTableGroupMenu,
2021-07-20 13:01:54 +00:00
StyledEmptyTableContainer,
StyledScrollbar,
2021-07-13 08:07:50 +00:00
};