2021-02-16 10:29:08 +00:00
|
|
|
import styled, { css } from "styled-components";
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### 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
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] 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
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import type {
|
|
|
|
|
TableSizes,
|
|
|
|
|
CellLayoutProperties,
|
|
|
|
|
CellAlignment,
|
|
|
|
|
} from "./Constants";
|
|
|
|
|
import type { Color } from "constants/Colors";
|
|
|
|
|
import { Colors } from "constants/Colors";
|
2021-04-15 05:33:09 +00:00
|
|
|
import { hideScrollbar } from "constants/DefaultTheme";
|
2022-05-04 09:45:57 +00:00
|
|
|
import {
|
|
|
|
|
fontSizeUtility,
|
|
|
|
|
lightenColor,
|
|
|
|
|
darkenColor,
|
|
|
|
|
} from "widgets/WidgetUtils";
|
|
|
|
|
import { FontStyleTypes } from "constants/WidgetConstants";
|
2022-03-31 08:23:07 +00:00
|
|
|
import { Classes } from "@blueprintjs/core";
|
2020-06-03 10:50:10 +00:00
|
|
|
|
2020-08-10 10:01:36 +00:00
|
|
|
export const TableWrapper = styled.div<{
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
tableSizes: TableSizes;
|
2022-05-04 09:45:57 +00:00
|
|
|
accentColor: string;
|
2020-08-13 06:53:21 +00:00
|
|
|
backgroundColor?: Color;
|
2021-01-22 10:12:34 +00:00
|
|
|
triggerRowSelection: boolean;
|
2021-05-14 09:39:57 +00:00
|
|
|
isHeaderVisible?: boolean;
|
2022-05-04 09:45:57 +00:00
|
|
|
borderRadius: string;
|
|
|
|
|
boxShadow?: string;
|
2020-08-10 10:01:36 +00:00
|
|
|
}>`
|
2020-07-20 06:04:05 +00:00
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
2020-06-03 10:50:10 +00:00
|
|
|
background: white;
|
2022-05-04 09:45:57 +00:00
|
|
|
border: ${({ boxShadow }) =>
|
|
|
|
|
boxShadow === "none" ? `1px solid ${Colors.GEYSER_LIGHT}` : `none`};
|
|
|
|
|
border-radius: ${({ borderRadius }) => borderRadius};
|
|
|
|
|
box-shadow: ${({ boxShadow }) => `${boxShadow}`} !important;
|
2020-06-03 10:50:10 +00:00
|
|
|
box-sizing: border-box;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
flex-direction: column;
|
2020-07-24 10:32:31 +00:00
|
|
|
overflow: hidden;
|
2020-06-03 10:50:10 +00:00
|
|
|
.tableWrap {
|
2020-06-16 07:37:39 +00:00
|
|
|
height: 100%;
|
2020-06-03 10:50:10 +00:00
|
|
|
display: block;
|
2021-03-18 05:37:16 +00:00
|
|
|
position: relative;
|
2022-03-30 00:40:56 +00:00
|
|
|
width: ${(props) => props.width}px;
|
2021-03-17 11:45:49 +00:00
|
|
|
overflow-x: auto;
|
2021-04-15 05:33:09 +00:00
|
|
|
${hideScrollbar};
|
2021-04-15 05:01:06 +00:00
|
|
|
.thumb-horizontal {
|
|
|
|
|
height: 4px !important;
|
|
|
|
|
border-radius: ${(props) => props.theme.radii[3]}px;
|
|
|
|
|
background: ${(props) => props.theme.colors.scrollbarLight} !important;
|
|
|
|
|
&:hover {
|
|
|
|
|
height: 6px !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-06-03 10:50:10 +00:00
|
|
|
}
|
|
|
|
|
.table {
|
|
|
|
|
border-spacing: 0;
|
2020-08-17 07:41:50 +00:00
|
|
|
color: ${Colors.THUNDER};
|
2020-06-03 10:50:10 +00:00
|
|
|
position: relative;
|
2020-08-13 06:53:21 +00:00
|
|
|
background: ${Colors.ATHENS_GRAY_DARKER};
|
2020-10-28 14:19:15 +00:00
|
|
|
display: table;
|
|
|
|
|
width: 100%;
|
2021-04-15 05:33:09 +00:00
|
|
|
${hideScrollbar};
|
2020-07-20 06:04:05 +00:00
|
|
|
.thead,
|
2020-06-03 10:50:10 +00:00
|
|
|
.tbody {
|
2020-07-20 06:04:05 +00:00
|
|
|
overflow: hidden;
|
2020-06-03 10:50:10 +00:00
|
|
|
}
|
2020-08-13 06:53:21 +00:00
|
|
|
.tbody {
|
2021-05-14 09:39:57 +00:00
|
|
|
height: ${(props) =>
|
|
|
|
|
props.isHeaderVisible ? props.height - 80 : props.height - 40}px;
|
2021-03-17 11:45:49 +00:00
|
|
|
width: 100%;
|
|
|
|
|
overflow-y: auto;
|
2021-04-15 05:33:09 +00:00
|
|
|
${hideScrollbar};
|
2020-08-13 06:53:21 +00:00
|
|
|
}
|
2020-06-03 10:50:10 +00:00
|
|
|
.tr {
|
2020-07-20 06:04:05 +00:00
|
|
|
overflow: hidden;
|
2021-01-22 10:12:34 +00:00
|
|
|
cursor: ${(props) => props.triggerRowSelection && "pointer"};
|
2021-01-22 09:37:43 +00:00
|
|
|
background: ${Colors.WHITE};
|
2020-06-03 10:50:10 +00:00
|
|
|
&.selected-row {
|
2022-05-04 09:45:57 +00:00
|
|
|
background: ${({ accentColor }) =>
|
|
|
|
|
`${lightenColor(accentColor)}`} !important;
|
2020-06-03 10:50:10 +00:00
|
|
|
}
|
|
|
|
|
&:hover {
|
2022-05-04 09:45:57 +00:00
|
|
|
background: ${({ accentColor }) =>
|
|
|
|
|
`${lightenColor(accentColor)}`} !important;
|
2020-06-03 10:50:10 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.th,
|
|
|
|
|
.td {
|
|
|
|
|
margin: 0;
|
|
|
|
|
border-bottom: 1px solid ${Colors.GEYSER_LIGHT};
|
|
|
|
|
border-right: 1px solid ${Colors.GEYSER_LIGHT};
|
|
|
|
|
position: relative;
|
2020-12-24 04:32:25 +00:00
|
|
|
font-size: ${(props) => props.tableSizes.ROW_FONT_SIZE}px;
|
|
|
|
|
line-height: ${(props) => props.tableSizes.ROW_FONT_SIZE}px;
|
2020-06-03 10:50:10 +00:00
|
|
|
:last-child {
|
|
|
|
|
border-right: 0;
|
|
|
|
|
}
|
|
|
|
|
.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 {
|
|
|
|
|
padding: 0 10px 0 0;
|
2021-05-19 11:02:07 +00:00
|
|
|
height: ${(props) =>
|
|
|
|
|
props.isHeaderVisible ? props.tableSizes.COLUMN_HEADER_HEIGHT : 40}px;
|
|
|
|
|
line-height: ${(props) =>
|
|
|
|
|
props.isHeaderVisible ? props.tableSizes.COLUMN_HEADER_HEIGHT : 40}px;
|
2020-06-03 10:50:10 +00:00
|
|
|
background: ${Colors.ATHENS_GRAY_DARKER};
|
|
|
|
|
}
|
|
|
|
|
.td {
|
2020-12-24 04:32:25 +00:00
|
|
|
height: ${(props) => props.tableSizes.ROW_HEIGHT}px;
|
|
|
|
|
line-height: ${(props) => props.tableSizes.ROW_HEIGHT}px;
|
2021-02-16 10:29:08 +00:00
|
|
|
padding: 0;
|
2020-06-03 10:50:10 +00:00
|
|
|
}
|
2020-11-06 11:18:04 +00:00
|
|
|
.thead {
|
|
|
|
|
position: sticky;
|
|
|
|
|
top: 0;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
}
|
2020-11-06 05:21:29 +00:00
|
|
|
.thead {
|
|
|
|
|
position: sticky;
|
|
|
|
|
top: 0;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
}
|
2020-06-03 10:50:10 +00:00
|
|
|
}
|
2022-05-04 09:45:57 +00:00
|
|
|
|
|
|
|
|
.tbody .tr:last-child .td {
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-03 10:50:10 +00:00
|
|
|
.draggable-header,
|
|
|
|
|
.hidden-header {
|
|
|
|
|
width: 100%;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
color: ${Colors.OXFORD_BLUE};
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
padding-left: 10px;
|
2020-08-10 06:45:31 +00:00
|
|
|
&.sorted {
|
|
|
|
|
padding-left: 5px;
|
|
|
|
|
}
|
2020-06-03 10:50:10 +00:00
|
|
|
}
|
|
|
|
|
.draggable-header {
|
|
|
|
|
cursor: pointer;
|
2021-02-11 06:00:36 +00:00
|
|
|
display: inline-block;
|
2021-04-09 10:34:01 +00:00
|
|
|
width: 100%;
|
2022-03-04 08:56:16 +00:00
|
|
|
height: 32px;
|
2020-06-03 10:50:10 +00:00
|
|
|
&.reorder-line {
|
|
|
|
|
width: 1px;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.hidden-header {
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
}
|
|
|
|
|
.column-menu {
|
|
|
|
|
cursor: pointer;
|
2020-12-24 04:32:25 +00:00
|
|
|
height: ${(props) => props.tableSizes.COLUMN_HEADER_HEIGHT}px;
|
|
|
|
|
line-height: ${(props) => props.tableSizes.COLUMN_HEADER_HEIGHT}px;
|
2020-06-03 10:50:10 +00:00
|
|
|
}
|
|
|
|
|
.th {
|
2021-02-11 06:00:36 +00:00
|
|
|
display: flex !important;
|
2020-06-03 10:50:10 +00:00
|
|
|
justify-content: space-between;
|
|
|
|
|
&.highlight-left {
|
|
|
|
|
border-left: 2px solid ${Colors.GREEN};
|
|
|
|
|
}
|
|
|
|
|
&.highlight-right {
|
|
|
|
|
border-right: 2px solid ${Colors.GREEN};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.input-group {
|
2020-12-24 04:32:25 +00:00
|
|
|
height: ${(props) => props.tableSizes.COLUMN_HEADER_HEIGHT}px;
|
|
|
|
|
line-height: ${(props) => props.tableSizes.COLUMN_HEADER_HEIGHT}px;
|
2020-06-03 10:50:10 +00:00
|
|
|
padding: 0 5px;
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
export const DropDownWrapper = styled.div`
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
background: white;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
padding: 10px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
border: 1px solid ${Colors.ATHENS_GRAY};
|
|
|
|
|
box-shadow: 0px 2px 4px rgba(67, 70, 74, 0.14);
|
|
|
|
|
`;
|
|
|
|
|
|
2020-12-15 11:24:15 +00:00
|
|
|
export const OptionWrapper = styled.div<{
|
|
|
|
|
selected: boolean;
|
|
|
|
|
isHeader?: boolean;
|
|
|
|
|
}>`
|
2020-06-03 10:50:10 +00:00
|
|
|
display: flex;
|
|
|
|
|
width: 100%;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
height: 32px;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
padding: 8px;
|
2020-12-24 04:32:25 +00:00
|
|
|
color: ${(props) => (props.selected ? Colors.WHITE : Colors.OXFORD_BLUE)};
|
2020-06-03 10:50:10 +00:00
|
|
|
font-size: 14px;
|
|
|
|
|
min-width: 200px;
|
2020-12-24 04:32:25 +00:00
|
|
|
cursor: ${(props) => (!props.isHeader ? "pointer" : "default")};
|
2020-06-03 10:50:10 +00:00
|
|
|
border-radius: 4px;
|
|
|
|
|
margin: 3px 0;
|
2020-12-24 04:32:25 +00:00
|
|
|
background: ${(props) => (props.selected ? Colors.GREEN : Colors.WHITE)};
|
2020-06-03 10:50:10 +00:00
|
|
|
&:hover {
|
2020-12-24 04:32:25 +00:00
|
|
|
background: ${(props) => (props.selected ? Colors.GREEN : Colors.POLAR)};
|
2020-06-03 10:50:10 +00:00
|
|
|
}
|
|
|
|
|
.column-type {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
&.non-selectable {
|
2020-12-24 04:32:25 +00:00
|
|
|
background: ${(props) =>
|
2020-12-15 11:24:15 +00:00
|
|
|
!props.isHeader ? Colors.WHITE_SMOKE : Colors.WHITE_CLOUD};
|
2020-06-03 10:50:10 +00:00
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
export const IconOptionWrapper = styled.div`
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
width: 100%;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
`;
|
|
|
|
|
|
2022-04-06 05:37:13 +00:00
|
|
|
export const PaginationWrapper = styled.div`
|
2020-06-03 10:50:10 +00:00
|
|
|
box-sizing: border-box;
|
|
|
|
|
display: flex;
|
|
|
|
|
width: 100%;
|
2022-04-06 05:37:13 +00:00
|
|
|
justify-content: flex-end;
|
2020-06-03 10:50:10 +00:00
|
|
|
align-items: center;
|
2020-08-13 16:41:08 +00:00
|
|
|
padding: 8px 20px;
|
2021-05-10 11:24:50 +00:00
|
|
|
color: ${Colors.GRAY};
|
2020-06-03 10:50:10 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
export const PaginationItemWrapper = styled.div<{
|
|
|
|
|
disabled?: boolean;
|
|
|
|
|
selected?: boolean;
|
2022-05-04 09:45:57 +00:00
|
|
|
borderRadius: string;
|
|
|
|
|
accentColor: string;
|
2020-06-03 10:50:10 +00:00
|
|
|
}>`
|
2021-05-10 11:24:50 +00:00
|
|
|
background: ${(props) => (props.disabled ? Colors.MERCURY : Colors.WHITE)};
|
|
|
|
|
border: 1px solid ${Colors.ALTO2};
|
2020-06-03 10:50:10 +00:00
|
|
|
box-sizing: border-box;
|
2020-08-13 16:41:08 +00:00
|
|
|
width: 24px;
|
|
|
|
|
height: 24px;
|
2020-06-03 10:50:10 +00:00
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
2020-07-03 08:32:21 +00:00
|
|
|
margin: 0 4px;
|
2020-12-24 04:32:25 +00:00
|
|
|
pointer-events: ${(props) => props.disabled && "none"};
|
2020-06-03 10:50:10 +00:00
|
|
|
cursor: pointer;
|
2022-05-04 09:45:57 +00:00
|
|
|
border-radius: ${({ borderRadius }) => borderRadius};
|
2020-06-03 10:50:10 +00:00
|
|
|
&:hover {
|
2022-05-04 09:45:57 +00:00
|
|
|
border-color: ${({ accentColor }) => accentColor};
|
2020-06-03 10:50:10 +00:00
|
|
|
}
|
2021-11-15 06:29:06 +00:00
|
|
|
.bp3-icon svg {
|
2022-03-18 10:53:02 +00:00
|
|
|
fill: ${(props) => (props.disabled ? Colors.GREY_8 : "")};
|
2021-11-15 06:29:06 +00:00
|
|
|
}
|
2020-06-03 10:50:10 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
export const MenuColumnWrapper = styled.div<{ selected: boolean }>`
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
align-items: center;
|
|
|
|
|
width: 100%;
|
2020-12-24 04:32:25 +00:00
|
|
|
background: ${(props) => props.selected && Colors.GREEN};
|
2020-06-03 10:50:10 +00:00
|
|
|
position: relative;
|
|
|
|
|
.title {
|
2020-12-24 04:32:25 +00:00
|
|
|
color: ${(props) => (props.selected ? Colors.WHITE : Colors.OXFORD_BLUE)};
|
2020-06-03 10:50:10 +00:00
|
|
|
margin-left: 10px;
|
|
|
|
|
}
|
|
|
|
|
.sub-menu {
|
|
|
|
|
position: absolute;
|
|
|
|
|
right: 0;
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
2022-04-18 06:09:11 +00:00
|
|
|
export const ActionWrapper = styled.div<{ disabled: boolean }>`
|
2020-07-14 07:55:46 +00:00
|
|
|
margin: 0 5px 0 0;
|
2022-04-18 06:09:11 +00:00
|
|
|
${(props) => (props.disabled ? "cursor: not-allowed;" : null)}
|
2020-07-14 07:55:46 +00:00
|
|
|
&&&&&& {
|
2021-02-16 10:29:08 +00:00
|
|
|
.bp3-button {
|
2022-04-07 16:19:51 +00:00
|
|
|
min-width: 50px;
|
2021-02-16 10:29:08 +00:00
|
|
|
}
|
2020-07-14 07:55:46 +00:00
|
|
|
.bp3-button span {
|
2022-04-07 16:19:51 +00:00
|
|
|
font-weight: 500;
|
2021-09-06 07:06:15 +00:00
|
|
|
text-decoration: none;
|
2020-07-14 07:55:46 +00:00
|
|
|
}
|
2021-08-17 12:54:43 +00:00
|
|
|
&&& .bp3-disabled {
|
2021-11-15 06:29:06 +00:00
|
|
|
background: ${Colors.GREY_1};
|
2022-03-18 10:53:02 +00:00
|
|
|
color: ${Colors.GREY_8};
|
2021-08-17 12:54:43 +00:00
|
|
|
}
|
2020-07-14 07:55:46 +00:00
|
|
|
}
|
2020-06-03 10:50:10 +00:00
|
|
|
`;
|
|
|
|
|
|
2022-04-18 06:09:11 +00:00
|
|
|
export const IconButtonWrapper = styled.div<{ disabled: boolean }>`
|
|
|
|
|
${(props) => (props.disabled ? "cursor: not-allowed;" : null)}
|
|
|
|
|
`;
|
|
|
|
|
|
2021-02-16 10:29:08 +00:00
|
|
|
const JUSTIFY_CONTENT = {
|
|
|
|
|
LEFT: "flex-start",
|
|
|
|
|
CENTER: "center",
|
|
|
|
|
RIGHT: "flex-end",
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-09 10:34:01 +00:00
|
|
|
const TEXT_ALIGN = {
|
|
|
|
|
LEFT: "left",
|
|
|
|
|
CENTER: "center",
|
|
|
|
|
RIGHT: "right",
|
|
|
|
|
};
|
|
|
|
|
|
2021-02-16 10:29:08 +00:00
|
|
|
const ALIGN_ITEMS = {
|
|
|
|
|
TOP: "flex-start",
|
|
|
|
|
CENTER: "center",
|
|
|
|
|
BOTTOM: "flex-end",
|
|
|
|
|
};
|
|
|
|
|
|
2021-04-19 05:01:17 +00:00
|
|
|
const IMAGE_HORIZONTAL_ALIGN = {
|
|
|
|
|
LEFT: "left",
|
|
|
|
|
CENTER: "center",
|
|
|
|
|
RIGHT: "right",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const IMAGE_VERTICAL_ALIGN = {
|
|
|
|
|
TOP: "top",
|
|
|
|
|
CENTER: "center",
|
|
|
|
|
BOTTOM: "bottom",
|
|
|
|
|
};
|
|
|
|
|
|
2021-09-06 07:06:15 +00:00
|
|
|
export const TableStyles = css<{
|
|
|
|
|
cellProperties?: CellLayoutProperties;
|
|
|
|
|
isTextType?: boolean;
|
|
|
|
|
}>`
|
2021-02-16 10:29:08 +00:00
|
|
|
font-weight: ${(props) =>
|
|
|
|
|
props?.cellProperties?.fontStyle?.includes(FontStyleTypes.BOLD)
|
|
|
|
|
? "bold"
|
|
|
|
|
: "normal"};
|
|
|
|
|
color: ${(props) => props?.cellProperties?.textColor};
|
|
|
|
|
font-style: ${(props) =>
|
|
|
|
|
props?.cellProperties?.fontStyle?.includes(FontStyleTypes.ITALIC)
|
|
|
|
|
? "italic"
|
|
|
|
|
: ""};
|
|
|
|
|
text-decoration: ${(props) =>
|
2021-09-06 07:06:15 +00:00
|
|
|
props?.cellProperties?.fontStyle?.includes(FontStyleTypes.UNDERLINE) &&
|
|
|
|
|
props.isTextType
|
2021-02-16 10:29:08 +00:00
|
|
|
? "underline"
|
|
|
|
|
: ""};
|
|
|
|
|
justify-content: ${(props) =>
|
|
|
|
|
props?.cellProperties?.horizontalAlignment &&
|
|
|
|
|
JUSTIFY_CONTENT[props?.cellProperties?.horizontalAlignment]};
|
|
|
|
|
align-items: ${(props) =>
|
|
|
|
|
props?.cellProperties?.verticalAlignment &&
|
|
|
|
|
ALIGN_ITEMS[props?.cellProperties?.verticalAlignment]};
|
|
|
|
|
background: ${(props) => props?.cellProperties?.cellBackground};
|
|
|
|
|
font-size: ${(props) =>
|
|
|
|
|
props?.cellProperties?.textSize &&
|
2022-05-04 09:45:57 +00:00
|
|
|
fontSizeUtility(props?.cellProperties?.textSize)};
|
2021-02-16 10:29:08 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-04-09 10:34:01 +00:00
|
|
|
export const DraggableHeaderWrapper = styled.div<{
|
|
|
|
|
horizontalAlignment?: CellAlignment;
|
|
|
|
|
}>`
|
|
|
|
|
text-align: ${(props) =>
|
|
|
|
|
props?.horizontalAlignment && TEXT_ALIGN[props?.horizontalAlignment]};
|
|
|
|
|
`;
|
|
|
|
|
|
2021-02-16 10:29:08 +00:00
|
|
|
export const CellWrapper = styled.div<{
|
|
|
|
|
isHidden?: boolean;
|
2022-03-04 08:56:16 +00:00
|
|
|
isPadding?: boolean;
|
2021-02-16 10:29:08 +00:00
|
|
|
cellProperties?: CellLayoutProperties;
|
2021-03-24 11:24:10 +00:00
|
|
|
isHyperLink?: boolean;
|
|
|
|
|
useLinkToolTip?: boolean;
|
2021-08-17 12:54:43 +00:00
|
|
|
isCellVisible?: boolean;
|
2021-09-06 07:06:15 +00:00
|
|
|
isTextType?: boolean;
|
2022-04-08 16:32:34 +00:00
|
|
|
lineHeight?: number;
|
2021-02-16 10:29:08 +00:00
|
|
|
}>`
|
2021-08-30 09:29:58 +00:00
|
|
|
display: ${(props) => (props.isCellVisible !== false ? "flex" : "none")};
|
2022-03-04 08:56:16 +00:00
|
|
|
align-items: ${(props) => (props.isPadding ? "center" : "flex-start")};
|
2020-06-03 10:50:10 +00:00
|
|
|
justify-content: flex-start;
|
2022-03-04 08:56:16 +00:00
|
|
|
width: ${(props) => (props.isPadding ? "100%" : "calc(100% - 10px)")};
|
2020-06-18 11:23:11 +00:00
|
|
|
height: 100%;
|
2020-06-03 10:50:10 +00:00
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
2020-06-16 07:37:39 +00:00
|
|
|
white-space: nowrap;
|
2020-12-24 04:32:25 +00:00
|
|
|
opacity: ${(props) => (props.isHidden ? "0.6" : "1")};
|
2021-02-16 10:29:08 +00:00
|
|
|
${TableStyles};
|
2022-03-04 08:56:16 +00:00
|
|
|
padding: ${(props) => (props.isPadding ? "0 10px" : " 0px")};
|
2021-02-16 10:29:08 +00:00
|
|
|
line-height: 28px;
|
2022-04-01 07:07:25 +00:00
|
|
|
.${Classes.POPOVER_WRAPPER}, > span > span > span {
|
|
|
|
|
width: 100%;
|
2022-03-31 08:23:07 +00:00
|
|
|
overflow: hidden;
|
2022-04-01 07:07:25 +00:00
|
|
|
text-overflow: ellipsis;
|
2022-03-31 08:23:07 +00:00
|
|
|
}
|
2021-02-16 10:29:08 +00:00
|
|
|
.image-cell-wrapper {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
2020-06-03 10:50:10 +00:00
|
|
|
.image-cell {
|
2021-02-16 10:29:08 +00:00
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
2020-06-03 10:50:10 +00:00
|
|
|
margin: 0 5px 0 0;
|
|
|
|
|
border-radius: 4px;
|
2021-04-19 05:01:17 +00:00
|
|
|
background-position-x: ${(props) =>
|
|
|
|
|
props?.cellProperties?.horizontalAlignment &&
|
|
|
|
|
IMAGE_HORIZONTAL_ALIGN[props?.cellProperties?.horizontalAlignment]};
|
|
|
|
|
background-position-y: ${(props) =>
|
|
|
|
|
props?.cellProperties?.verticalAlignment &&
|
|
|
|
|
IMAGE_VERTICAL_ALIGN[props?.cellProperties?.verticalAlignment]};
|
2020-06-03 10:50:10 +00:00
|
|
|
background-repeat: no-repeat;
|
2021-02-16 10:29:08 +00:00
|
|
|
background-size: contain;
|
2020-06-03 10:50:10 +00:00
|
|
|
}
|
|
|
|
|
video {
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
}
|
2021-03-24 11:24:10 +00:00
|
|
|
${(props) =>
|
|
|
|
|
props.isHyperLink &&
|
|
|
|
|
`
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
&:hover {
|
2021-11-03 10:45:02 +00:00
|
|
|
color: ${Colors.ROYAL_BLUE};
|
2021-03-24 11:24:10 +00:00
|
|
|
text-decoration: underline;
|
|
|
|
|
}`};
|
2020-06-16 07:37:39 +00:00
|
|
|
&.video-cell {
|
|
|
|
|
height: 100%;
|
|
|
|
|
iframe {
|
|
|
|
|
border: none;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-24 11:24:10 +00:00
|
|
|
.link-text {
|
|
|
|
|
width: 100%;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
2021-05-04 19:48:40 +00:00
|
|
|
text-align: ${(props) =>
|
|
|
|
|
props?.cellProperties?.horizontalAlignment &&
|
|
|
|
|
TEXT_ALIGN[props?.cellProperties?.horizontalAlignment]};
|
2021-03-24 11:24:10 +00:00
|
|
|
}
|
|
|
|
|
.hidden-icon {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
&:hover {
|
|
|
|
|
.hidden-icon {
|
2022-04-05 11:22:33 +00:00
|
|
|
display: flex;
|
2021-03-24 11:24:10 +00:00
|
|
|
}
|
|
|
|
|
}
|
2020-06-03 10:50:10 +00:00
|
|
|
`;
|
2020-07-02 06:26:01 +00:00
|
|
|
|
2022-05-04 09:45:57 +00:00
|
|
|
export const CellCheckboxWrapper = styled(CellWrapper)<{
|
|
|
|
|
isChecked?: boolean;
|
|
|
|
|
accentColor: string;
|
|
|
|
|
borderRadius: string;
|
|
|
|
|
}>`
|
2022-04-19 08:40:42 +00:00
|
|
|
&&& {
|
|
|
|
|
justify-content: center;
|
|
|
|
|
width: 40px;
|
|
|
|
|
padding: 0px;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
2021-07-07 05:52:10 +00:00
|
|
|
& > div {
|
2022-05-04 09:45:57 +00:00
|
|
|
border-radius: ${({ borderRadius }) => borderRadius};
|
|
|
|
|
|
2021-10-26 08:31:27 +00:00
|
|
|
${(props) =>
|
|
|
|
|
props.isChecked
|
|
|
|
|
? `
|
2022-05-04 09:45:57 +00:00
|
|
|
background: ${props.accentColor};
|
2021-10-26 08:31:27 +00:00
|
|
|
&:hover {
|
2022-05-04 09:45:57 +00:00
|
|
|
background: ${darkenColor(props.accentColor)};
|
|
|
|
|
}
|
2021-10-26 08:31:27 +00:00
|
|
|
`
|
|
|
|
|
: `
|
|
|
|
|
border: 1px solid ${Colors.GREY_3};
|
|
|
|
|
&:hover {
|
|
|
|
|
border: 1px solid ${Colors.GREY_5};
|
|
|
|
|
}
|
|
|
|
|
`};
|
2021-07-07 05:52:10 +00:00
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
export const CellCheckbox = styled.div`
|
2021-10-26 08:31:27 +00:00
|
|
|
height: 14px;
|
|
|
|
|
width: 14px;
|
|
|
|
|
background: ${Colors.WHITE};
|
|
|
|
|
cursor: pointer;
|
2021-07-07 05:52:10 +00:00
|
|
|
position: relative;
|
|
|
|
|
.th-svg {
|
|
|
|
|
display: block;
|
|
|
|
|
position: absolute;
|
2021-10-26 08:31:27 +00:00
|
|
|
left: 2px;
|
|
|
|
|
top: 2px;
|
2021-07-07 05:52:10 +00:00
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
2020-08-10 06:47:47 +00:00
|
|
|
export const TableHeaderWrapper = styled.div<{
|
|
|
|
|
serverSidePaginationEnabled: boolean;
|
|
|
|
|
width: number;
|
2020-08-13 16:41:08 +00:00
|
|
|
tableSizes: TableSizes;
|
2020-08-13 06:53:21 +00:00
|
|
|
backgroundColor?: Color;
|
2020-08-10 06:47:47 +00:00
|
|
|
}>`
|
2021-03-18 19:09:13 +00:00
|
|
|
position: relative;
|
2020-07-02 06:26:01 +00:00
|
|
|
display: flex;
|
2023-01-27 06:45:44 +00:00
|
|
|
border-bottom: 1px solid ${Colors.GEYSER_LIGHT};
|
2021-03-18 19:09:13 +00:00
|
|
|
width: ${(props) => props.width - 8}px;
|
2020-08-10 06:47:47 +00:00
|
|
|
.show-page-items {
|
2020-12-24 04:32:25 +00:00
|
|
|
display: ${(props) => (props.width < 700 ? "none" : "flex")};
|
2020-08-10 06:47:47 +00:00
|
|
|
}
|
2020-12-24 04:32:25 +00:00
|
|
|
height: ${(props) => props.tableSizes.TABLE_HEADER_HEIGHT}px;
|
|
|
|
|
min-height: ${(props) => props.tableSizes.TABLE_HEADER_HEIGHT}px;
|
2021-04-15 05:01:06 +00:00
|
|
|
overflow-x: auto;
|
2021-04-15 05:33:09 +00:00
|
|
|
${hideScrollbar};
|
2021-04-15 05:01:06 +00:00
|
|
|
.thumb-horizontal {
|
|
|
|
|
height: 4px !important;
|
|
|
|
|
border-radius: ${(props) => props.theme.radii[3]}px;
|
|
|
|
|
background: ${(props) => props.theme.colors.scrollbarLight};
|
|
|
|
|
&:hover {
|
|
|
|
|
height: 6px !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
export const TableHeaderInnerWrapper = styled.div<{
|
|
|
|
|
serverSidePaginationEnabled: boolean;
|
|
|
|
|
width: number;
|
|
|
|
|
tableSizes: TableSizes;
|
|
|
|
|
backgroundColor?: Color;
|
|
|
|
|
}>`
|
|
|
|
|
position: relative;
|
|
|
|
|
display: flex;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
2021-04-15 11:07:54 +00:00
|
|
|
border-bottom: 1px solid ${Colors.GEYSER_LIGHT};
|
2020-07-02 06:26:01 +00:00
|
|
|
`;
|
2020-07-03 08:26:04 +00:00
|
|
|
|
2020-08-13 16:41:08 +00:00
|
|
|
export const CommonFunctionsMenuWrapper = styled.div<{
|
|
|
|
|
tableSizes: TableSizes;
|
|
|
|
|
}>`
|
2020-07-03 08:26:04 +00:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2020-12-24 04:32:25 +00:00
|
|
|
height: ${(props) => props.tableSizes.TABLE_HEADER_HEIGHT}px;
|
2020-07-03 08:26:04 +00:00
|
|
|
`;
|
2020-07-03 08:32:21 +00:00
|
|
|
|
|
|
|
|
export const RowWrapper = styled.div`
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
2020-08-17 07:41:50 +00:00
|
|
|
font-size: 12px;
|
2020-07-03 08:32:21 +00:00
|
|
|
line-height: 20px;
|
2021-05-10 11:24:50 +00:00
|
|
|
color: ${Colors.GRAY};
|
2020-07-03 08:32:21 +00:00
|
|
|
margin: 0 4px;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
`;
|
2020-07-20 06:04:05 +00:00
|
|
|
|
|
|
|
|
export const TableIconWrapper = styled.div<{
|
|
|
|
|
selected?: boolean;
|
|
|
|
|
disabled?: boolean;
|
|
|
|
|
}>`
|
2020-12-24 04:32:25 +00:00
|
|
|
background: ${(props) =>
|
|
|
|
|
props.selected ? Colors.ATHENS_GRAY : "transparent"};
|
|
|
|
|
box-shadow: ${(props) =>
|
2020-07-20 06:04:05 +00:00
|
|
|
props.selected ? `inset 0px 4px 0px ${Colors.GREEN}` : "none"};
|
|
|
|
|
width: 48px;
|
2021-04-15 11:07:54 +00:00
|
|
|
height: 38px;
|
2020-07-20 06:04:05 +00:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
2020-12-24 04:32:25 +00:00
|
|
|
opacity: ${(props) => (props.disabled ? 0.6 : 1)};
|
|
|
|
|
cursor: ${(props) => !props.disabled && "pointer"};
|
2020-08-20 09:30:19 +00:00
|
|
|
position: relative;
|
2020-07-20 06:04:05 +00:00
|
|
|
&:hover {
|
|
|
|
|
background: ${Colors.ATHENS_GRAY};
|
|
|
|
|
}
|
|
|
|
|
`;
|
2020-08-10 06:45:31 +00:00
|
|
|
|
2020-08-28 14:14:47 +00:00
|
|
|
export const RenderOptionWrapper = styled.div<{ selected: boolean }>`
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
width: 150px;
|
|
|
|
|
position: relative;
|
|
|
|
|
.title {
|
2021-10-11 06:01:05 +00:00
|
|
|
color: ${Colors.GREY_10};
|
2020-08-28 14:14:47 +00:00
|
|
|
width: 120px;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
}
|
|
|
|
|
.type {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 135px;
|
|
|
|
|
font-size: 12px !important;
|
2021-10-11 06:01:05 +00:00
|
|
|
color: ${Colors.GREY_10};
|
2020-08-28 14:14:47 +00:00
|
|
|
}
|
|
|
|
|
`;
|
2020-09-11 10:40:15 +00:00
|
|
|
|
|
|
|
|
export const MenuCategoryWrapper = styled.div`
|
|
|
|
|
display: flex;
|
|
|
|
|
width: 100%;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
color: ${Colors.RIVER_BED};
|
|
|
|
|
`;
|
2020-12-15 11:24:15 +00:00
|
|
|
|
|
|
|
|
export const MenuStyledOptionHeader = styled.div`
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
`;
|
2022-03-04 08:56:16 +00:00
|
|
|
|
|
|
|
|
export const ColumnWrapper = styled.div`
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2022-03-08 06:06:32 +00:00
|
|
|
height: 100%;
|
2022-03-04 08:56:16 +00:00
|
|
|
`;
|