PromucFlow_constructor/app/client/src/widgets/TableWidgetV2/component/TableStyledWrappers.tsx

802 lines
19 KiB
TypeScript
Raw Normal View History

import styled, { css } from "styled-components";
import {
TableSizes,
CellLayoutProperties,
JUSTIFY_CONTENT,
ALIGN_ITEMS,
IMAGE_HORIZONTAL_ALIGN,
IMAGE_VERTICAL_ALIGN,
TEXT_ALIGN,
TABLE_SIZES,
CellAlignment,
VerticalAlignment,
ImageSize,
ImageSizes,
MULTISELECT_CHECKBOX_WIDTH,
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
TABLE_SCROLLBAR_HEIGHT,
TABLE_SCROLLBAR_WIDTH,
} from "./Constants";
import { Colors, Color } from "constants/Colors";
import { hideScrollbar, invisible } from "constants/DefaultTheme";
import { lightenColor, darkenColor } from "widgets/WidgetUtils";
import { FontStyleTypes } from "constants/WidgetConstants";
import { Classes } from "@blueprintjs/core";
import { TableVariant, TableVariantTypes } from "../constants";
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
import { Layers } from "constants/Layers";
const BORDER_RADIUS = "border-radius: 4px;";
const HEADER_CONTROL_FONT_SIZE = "12px";
export const TableWrapper = styled.div<{
width: number;
height: number;
tableSizes: TableSizes;
accentColor: string;
backgroundColor?: Color;
triggerRowSelection: boolean;
isHeaderVisible?: boolean;
borderRadius: string;
boxShadow?: string;
borderColor?: string;
borderWidth?: number;
isResizingColumn?: boolean;
variant?: TableVariant;
isAddRowInProgress: boolean;
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
multiRowSelection?: boolean;
}>`
width: 100%;
height: 100%;
background: white;
border-style: solid;
border-width: ${({ borderWidth }) => `${borderWidth}px`};
border-color: ${({ borderColor }) => borderColor};
border-radius: ${({ borderRadius }) => borderRadius};
box-shadow: ${({ boxShadow }) => `${boxShadow}`} !important;
box-sizing: border-box;
display: flex;
justify-content: space-between;
flex-direction: column;
overflow: hidden;
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
.simplebar-track {
opacity: 0.7;
&.simplebar-horizontal {
height: ${TABLE_SCROLLBAR_HEIGHT}px;
.simplebar-scrollbar {
height: 5px;
}
&.simplebar-hover {
height: 10px;
& .simplebar-scrollbar {
height: 8px;
}
}
}
&.simplebar-vertical {
direction: rtl;
top: ${(props) => props.tableSizes.TABLE_HEADER_HEIGHT - 10}px;
width: ${TABLE_SCROLLBAR_WIDTH}px;
&.simplebar-hover {
width: 10px;
& .simplebar-scrollbar {
width: 11px;
}
}
}
}
.tableWrap {
height: 100%;
display: block;
position: relative;
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
width: 100%;
overflow: auto hidden;
&.virtual {
${hideScrollbar};
}
}
.table {
border-spacing: 0;
color: ${Colors.THUNDER};
position: relative;
display: table;
width: 100%;
${hideScrollbar};
.tbody {
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
height: fit-content;
width: fit-content;
}
.tr {
cursor: ${(props) => props.triggerRowSelection && "pointer"};
background: ${Colors.WHITE};
&.selected-row {
background: ${({ accentColor }) =>
`${lightenColor(accentColor)}`} !important;
&:hover {
background: ${({ accentColor }) =>
`${lightenColor(accentColor, "0.9")}`} !important;
}
}
${(props) => {
if (!props.isAddRowInProgress) {
return `&:hover {
background: var(--wds-color-bg-hover) !important;
}`;
}
}}
&.new-row {
background: ${({ accentColor }) =>
`${lightenColor(accentColor)}`} !important;
}
}
.th,
.td {
margin: 0;
border-bottom: ${(props) =>
props.variant === TableVariantTypes.DEFAULT ||
props.variant === undefined ||
props.variant === TableVariantTypes.VARIANT3
? "1px solid var(--wds-color-border-onaccent)"
: "none"};
border-right: ${(props) =>
props.variant === TableVariantTypes.DEFAULT ||
props.variant === undefined ||
props.isResizingColumn
? "1px solid var(--wds-color-border-onaccent)"
: "none"};
position: relative;
font-size: ${(props) => props.tableSizes.ROW_FONT_SIZE}px;
line-height: ${(props) => props.tableSizes.ROW_FONT_SIZE}px;
:last-child {
border-right: 0;
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
.resizer {
right: 5px;
}
}
.resizer {
display: inline-block;
width: 10px;
height: 100%;
position: absolute;
right: 0;
top: 0;
transform: translateX(50%);
z-index: 1;
${"" /* prevents from scrolling while dragging on touch devices */}
touch-action:none;
&.isResizing {
cursor: isResizing;
}
}
}
.th {
font-size: 14px;
}
.th {
padding: 0 10px 0 0;
height: ${(props) =>
props.isHeaderVisible ? props.tableSizes.COLUMN_HEADER_HEIGHT : 40}px;
line-height: ${(props) =>
props.isHeaderVisible ? props.tableSizes.COLUMN_HEADER_HEIGHT : 40}px;
background: var(--wds-color-bg);
font-weight: bold;
}
.td {
min-height: ${(props) => props.tableSizes.ROW_HEIGHT}px;
padding: 0;
}
.thead {
position: sticky;
top: 0;
z-index: 1;
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
width: fit-content;
}
}
.virtual-list {
${hideScrollbar};
}
.column-freeze {
.body {
position: relative;
z-index: 0;
}
[role="columnheader"] {
background-color: var(--wds-color-bg) !important;
}
[data-sticky-td] {
position: sticky;
position: -webkit-sticky;
background-color: inherit;
border-bottom: ${(props) =>
props.variant === TableVariantTypes.VARIANT2
? "none"
: "1px solid var(--wds-color-border-onaccent)"};
& .draggable-header {
cursor: pointer;
}
&.hidden-cell,
&:has(> .hidden-header) {
z-index: 0;
position: unset !important;
}
&:has(> .hidden-header) .resizer {
position: relative;
}
}
[data-sticky-last-left-td] {
left: 0px;
border-right: 3px solid var(--wds-color-border);
&.hidden-cell,
&:has(> .hidden-header) {
border-right: 0.5px solid var(--wds-color-border);
}
}
[data-sticky-first-right-td] {
right: 0px;
border-left: 3px solid var(--wds-color-border);
&.hidden-cell,
&:has(> .hidden-header) {
border-left: none;
}
}
& .sticky-right-modifier {
border-left: 3px solid var(--wds-color-border);
}
}
.tbody .tr:last-child .td {
border-bottom: none;
}
.draggable-header,
.hidden-header {
width: 100%;
text-overflow: ellipsis;
overflow: hidden;
color: ${Colors.OXFORD_BLUE};
padding-left: 10px;
&.sorted {
padding-left: 5px;
}
}
.draggable-header {
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
cursor: grab;
display: inline-block;
width: 100%;
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
height: ${(props) => props.tableSizes.COLUMN_HEADER_HEIGHT};
&.reorder-line {
width: 1px;
height: 100%;
}
}
.hidden-header {
opacity: 0.6;
${invisible};
}
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
.header-menu {
cursor: pointer;
width: 24px;
display: flex;
align-items: center;
.bp3-popover2-target {
display: block;
}
&.hide {
&:hover {
.bp3-popover2-target {
display: block;
}
}
.bp3-popover2-target {
display: none;
}
}
}
.column-menu {
cursor: pointer;
height: ${(props) => props.tableSizes.COLUMN_HEADER_HEIGHT}px;
line-height: ${(props) => props.tableSizes.COLUMN_HEADER_HEIGHT}px;
}
.th {
display: flex !important;
justify-content: space-between;
&.highlight-left {
border-left: 2px solid ${Colors.GREEN};
}
&.highlight-right {
border-right: 2px solid ${Colors.GREEN};
}
fix: column dragging and column reordering (#20928) ## Description This PR implements the following changes: - Move the drag events from the Parent component's useEffect to the `HeaderCell` component. - Refactored the code. Inside the table component, we refactored the code such that when SSP is disabled the component uses `StaticTable` and when SSP enabled then we use `VirtualTable`. - It also includes the fix for the following issue. Whenever the user has a scroll to the bottom of the page, on clicking of add new button it is expected that the scroll should move to the top but it wasn't happening. > Add a TL;DR when description is extra long (helps content team) Fixes #20858 > if no issue exists, please create an issue and ask the maintainers about this first ## Type of change - Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? - Manual - Test cases: - Column name should appear on update from the property pane - reorder whenever SSP is enabled - On column re-size - When a col is frozen - When a col is unfrozen - When all the headers or one of them is removed - When sorted also should work - Enable multi-row selection - When in preview mode and back and forth(Check the above cases) - When in Deployed mode - Dragging of columns from the column header should work as expected both in Deploy and Published mode. - Cypress ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-03-05 14:19:44 +00:00
& .draggable-header--dragging {
background: #efefef;
border-radius: 4px;
z-index: 100;
width: 100%;
text-overflow: none;
overflow: none;
}
}
.input-group {
height: ${(props) => props.tableSizes.COLUMN_HEADER_HEIGHT}px;
line-height: ${(props) => props.tableSizes.COLUMN_HEADER_HEIGHT}px;
padding: 0 5px;
}
`;
export const DropDownWrapper = styled.div`
display: flex;
flex-direction: column;
background: white;
z-index: 1;
padding: 10px;
${BORDER_RADIUS}
border: 1px solid ${Colors.ATHENS_GRAY};
box-shadow: 0px 2px 4px rgba(67, 70, 74, 0.14);
`;
export const OptionWrapper = styled.div<{
selected: boolean;
isHeader?: boolean;
}>`
display: flex;
width: 100%;
justify-content: space-between;
height: 32px;
box-sizing: border-box;
padding: 8px;
color: ${(props) => (props.selected ? Colors.WHITE : Colors.OXFORD_BLUE)};
font-size: 14px;
min-width: 200px;
cursor: ${(props) => (!props.isHeader ? "pointer" : "default")};
${BORDER_RADIUS}
margin: 3px 0;
background: ${(props) => (props.selected ? Colors.GREEN : Colors.WHITE)};
&:hover {
background: ${(props) => (props.selected ? Colors.GREEN : Colors.POLAR)};
}
.column-type {
width: 100%;
}
&.non-selectable {
background: ${(props) =>
!props.isHeader ? Colors.WHITE_SMOKE : Colors.WHITE_CLOUD};
}
`;
export const IconOptionWrapper = styled.div`
display: flex;
justify-content: space-between;
width: 100%;
cursor: pointer;
`;
export const PaginationWrapper = styled.div`
box-sizing: border-box;
display: flex;
width: 100%;
justify-content: flex-end;
align-items: center;
padding: 8px;
color: var(--wds-color-text-light);
`;
export const PaginationItemWrapper = styled.div<{
disabled?: boolean;
selected?: boolean;
borderRadius: string;
accentColor: string;
}>`
background: ${(props) =>
props.disabled ? `var(--wds-color-bg-disabled)` : `var(--wds-color-bg)`};
border: 1px solid
${(props) =>
props.disabled
? `var(--wds-color-border-disabled)`
: `var(--wds-color-border)`};
box-sizing: border-box;
width: 24px;
height: 24px;
display: flex;
justify-content: center;
align-items: center;
margin: 0 4px;
cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
border-radius: ${({ borderRadius }) => borderRadius};
& > * {
pointer-events: ${(props) => props.disabled && "none"};
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
& svg {
fill: ${(props) =>
props.disabled
? `var(--wds-color-icon-disabled)`
: `var(--wds-color-icon)`};
}
${({ disabled }) =>
!disabled &&
`&:hover {
border-color: var(--wds-color-border-hover);
background-color: var(--wds-color-bg-hover);
}`}
`;
export const MenuColumnWrapper = styled.div<{ selected: boolean }>`
display: flex;
justify-content: flex-start;
align-items: center;
width: 100%;
background: ${(props) => props.selected && Colors.GREEN};
position: relative;
.title {
color: ${(props) => (props.selected ? Colors.WHITE : Colors.OXFORD_BLUE)};
margin-left: 10px;
}
.sub-menu {
position: absolute;
right: 0;
}
`;
export const ActionWrapper = styled.div<{ disabled: boolean }>`
margin: 0 5px 0 0;
${(props) => (props.disabled ? "cursor: not-allowed;" : null)}
&&&&&& {
.bp3-button {
border: none;
}
.bp3-button span {
font-weight: 400;
text-decoration: none;
}
&&& .bp3-disabled {
background: ${Colors.GREY_1};
color: ${Colors.GREY_4};
}
}
`;
export const IconButtonWrapper = styled.div<{ disabled: boolean }>`
${(props) => (props.disabled ? "cursor: not-allowed;" : null)}
align-items: center;
display: flex;
}
`;
export const TableStyles = css<{
cellProperties?: CellLayoutProperties;
isTextType?: boolean;
}>``;
export const CELL_WRAPPER_LINE_HEIGHT = 28;
export const CellWrapper = styled.div<{
isHidden?: boolean;
isHyperLink?: boolean;
isCellVisible?: boolean;
isTextType?: boolean;
compactMode?: string;
allowCellWrapping?: boolean;
horizontalAlignment?: CellAlignment;
verticalAlignment?: VerticalAlignment;
fontStyle?: string;
textColor?: string;
cellBackground?: string;
textSize?: string;
disablePadding?: boolean;
imageSize?: ImageSize;
isCellDisabled?: boolean;
}>`
display: ${(props) => (props.isCellVisible !== false ? "flex" : "none")};
align-items: center;
justify-content: flex-start;
width: 100%;
height: 100%;
${(props) => (props.isHidden ? invisible : "")};
font-weight: ${(props) =>
props.fontStyle?.includes(FontStyleTypes.BOLD) ? "bold" : "normal"};
color: ${(props) => props.textColor};
font-style: ${(props) =>
props.fontStyle?.includes(FontStyleTypes.ITALIC) ? "italic" : ""};
text-decoration: ${(props) =>
props.fontStyle?.includes(FontStyleTypes.UNDERLINE) && props.isTextType
? "underline"
: ""};
justify-content: ${(props) =>
props.horizontalAlignment && JUSTIFY_CONTENT[props.horizontalAlignment]};
text-align: ${(props) =>
props.horizontalAlignment && TEXT_ALIGN[props.horizontalAlignment]};
align-items: ${(props) =>
props.verticalAlignment && ALIGN_ITEMS[props.verticalAlignment]};
background: ${(props) => {
if (props.isCellDisabled) {
return props.cellBackground
? lightenColor(props.cellBackground)
: "var(--wds-color-bg-disabled)";
} else {
return props.cellBackground;
}
}};
&:hover,
.selected-row & {
background: ${(props) =>
props.cellBackground && !props.isCellDisabled
? darkenColor(props.cellBackground, 5)
: ""};
}
font-size: ${(props) => props.textSize};
padding: ${(props) =>
props.disablePadding
? 0
: `${
props.compactMode
? `${TABLE_SIZES[props.compactMode].VERTICAL_PADDING}px 10px`
: `${0}px 10px`
}`};
line-height: ${CELL_WRAPPER_LINE_HEIGHT}px;
.${Classes.POPOVER_WRAPPER} {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
}
${(props) =>
props.allowCellWrapping
? `
white-space: break-spaces;
word-break: break-word;
`
: `
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;`}
.image-cell-wrapper {
width: 100%;
height: 100%;
display: flex;
align-items: ${(props) =>
props.verticalAlignment && IMAGE_VERTICAL_ALIGN[props.verticalAlignment]};
justify-content: ${(props) =>
props.horizontalAlignment &&
IMAGE_HORIZONTAL_ALIGN[props.horizontalAlignment]};
}
.image-cell {
height: ${(props) =>
props.imageSize ? ImageSizes[props.imageSize] : ImageSizes.DEFAULT};
margin: 0 5px 0 0;
${BORDER_RADIUS}
object-fit: contain;
}
video {
${BORDER_RADIUS}
}
${(props) =>
props.isHyperLink &&
`
cursor: pointer;
&:hover {
color: ${Colors.ROYAL_BLUE};
text-decoration: underline;
}`};
&.video-cell {
height: 100%;
iframe {
border: none;
${BORDER_RADIUS}
}
}
.link-text {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-word;
text-align: ${(props) =>
props.horizontalAlignment && TEXT_ALIGN[props.horizontalAlignment]};
}
.hidden-icon {
display: none;
}
&:hover {
.hidden-icon {
display: inline;
}
}
`;
export const CellCheckboxWrapper = styled(CellWrapper)<{
isChecked?: boolean;
accentColor?: string;
borderRadius?: string;
}>`
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
left: 0;
z-index: ${Layers.modalWidget};
justify-content: center;
width: ${MULTISELECT_CHECKBOX_WIDTH}px;
height: auto;
& > div {
border-radius: ${({ borderRadius }) => borderRadius};
${(props) =>
props.isChecked
? `
background: ${props.accentColor};
&:hover {
background: ${darkenColor(props.accentColor)};
}
`
: `
border: 1px solid ${Colors.GREY_3};
&:hover {
border: 1px solid ${Colors.GREY_5};
}
`};
}
`;
export const CellCheckbox = styled.div`
height: 14px;
width: 14px;
background: ${Colors.WHITE};
cursor: pointer;
position: relative;
.th-svg {
display: block;
position: absolute;
left: 2px;
top: 2px;
}
`;
const MIN_WIDTH_TO_SHOW_PAGE_ITEMS = 700;
export const TableHeaderWrapper = styled.div<{
serverSidePaginationEnabled: boolean;
width: number;
tableSizes: TableSizes;
backgroundColor?: Color;
}>`
position: relative;
display: flex;
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
width: 100%;
.show-page-items {
display: ${(props) =>
props.width < MIN_WIDTH_TO_SHOW_PAGE_ITEMS ? "none" : "flex"};
}
height: ${(props) => props.tableSizes.TABLE_HEADER_HEIGHT}px;
min-height: ${(props) => props.tableSizes.TABLE_HEADER_HEIGHT}px;
`;
export const TableHeaderInnerWrapper = styled.div<{
serverSidePaginationEnabled: boolean;
width: number;
tableSizes: TableSizes;
backgroundColor?: Color;
variant?: TableVariant;
}>`
position: relative;
display: flex;
width: 100%;
height: 100%;
border-bottom: ${(props) =>
props.variant !== "VARIANT2" &&
`1px solid var(--wds-color-border-onaccent)`};
`;
export const CommonFunctionsMenuWrapper = styled.div<{
tableSizes: TableSizes;
}>`
display: flex;
align-items: center;
height: 100%;
& .bp3-popover-target,
& .bp3-popover-wrapper {
height: 100%;
}
& .bp3-popover-target {
display: flex;
align-items: center;
}
`;
export const TableHeaderContentWrapper = styled.div`
display: flex;
align-items: center;
justify-content: center;
font-size: ${HEADER_CONTROL_FONT_SIZE};
line-height: 20px;
color: ${Colors.GRAY};
margin: 0 4px;
white-space: nowrap;
`;
export const TableIconWrapper = styled.div<{
selected?: boolean;
disabled?: boolean;
}>`
background: ${(props) =>
props.selected ? Colors.ATHENS_GRAY : "transparent"};
box-shadow: ${(props) =>
props.selected ? `inset 0px 4px 0px ${Colors.GREEN}` : "none"};
width: 48px;
height: 38px;
display: flex;
align-items: center;
justify-content: center;
${(props) => (props.disabled ? invisible : "")};
cursor: ${(props) => !props.disabled && "pointer"};
position: relative;
&:hover {
background: ${Colors.ATHENS_GRAY};
}
`;
export const RenderOptionWrapper = styled.div<{ selected: boolean }>`
display: flex;
justify-content: space-between;
align-items: center;
width: 150px;
position: relative;
.title {
color: ${Colors.GREY_10};
width: 120px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.type {
position: absolute;
left: 135px;
font-size: ${HEADER_CONTROL_FONT_SIZE} !important;
color: ${Colors.GREY_10};
}
`;
export const MenuCategoryWrapper = styled.div`
display: flex;
width: 100%;
align-items: center;
justify-content: space-between;
color: ${Colors.RIVER_BED};
`;
export const MenuStyledOptionHeader = styled.div`
font-weight: 600;
`;
export const TooltipContentWrapper = styled.div<{ width?: number }>`
word-break: break-all;
max-width: ${(props) => props.width}px;
`;
export const EmptyRow = styled.div`
display: flex;
flex: 1 0 auto;
`;
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
export const EmptyCell = styled.div<{ width: number; sticky?: string }>`
width: ${(props) => props.width}px;
boxsizing: border-box;
flex: ${(props) => props.width} 0 auto;
feat: added column freeze and unfreeze functionality to table widget (#18757) **PRD**: https://www.notion.so/appsmith/Ability-to-freeze-columns-dd118f7ed2e14e008ee305056b79874a?d=300f4968889244da9f737e1bfd8c06dc#2ddaf28e10a0475cb69f1af77b938d0b This PR adds the following features to the table widget: - Freeze the columns to the left or right of the table.(Both canvas and page view mode). - Unfreeze the frozen columns. (Both canvas and page view mode). - Columns that are left frozen, will get unfrozen at a position after the last left frozen column. (Both canvas and page view mode). - Columns that are right frozen, will get unfrozen at a position before the first right frozen column. (Both canvas and page view mode). - Column order can be persisted in the Page view mode. - Users can also unfreeze the columns that are frozen by the developers. - Columns that are frozen cannot be reordered(Both canvas and page view mode) - **Property pane changes (Columns property)**: - If the column is frozen to the left then that column should appear at top of the list. - If the column is frozen to the right then that column should appear at the bottom of the list. - The columns that are frozen cannot be moved or re-ordered in the list. They remain fixed in their position. - In-Page mode, If there is a change in frozen or unfrozen columns in multiple tables then the order of columns and frozen and unfrozen columns should get persisted on refresh i.e. changes should get persisted across refreshes.
2023-02-15 11:42:46 +00:00
z-index: ${(props) => (props.sticky ? Layers.dragPreview : 0)};
`;