Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawan Kumar authored and Pawan Kumar committed May 10, 2024
1 parent c70107e commit c0dc998
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ interface RowType {

export function Row(props: RowType) {
const {
accentColor,
borderRadius,
columns,
isAddRowInProgress,
multiRowSelection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface StaticTableProps {
): TableBodyProps;
pageSize: number;
rows: ReactTableRowType<Record<string, unknown>>[];
height: number;
height: number;
}

export const StaticTableBody = (props: StaticTableProps) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
import type {
Row as ReactTableRowType,
TableBodyPropGetter,
TableBodyProps,
Row as ReactTableRowType,
TableBodyPropGetter,
TableBodyProps,
} from "react-table";
import React from "react";

import type { HeaderComponentProps } from "../Table";
import type { ReactTableColumnProps } from "../Constants";

export type TableBodyContextType = {
accentColor: string;
borderRadius: string;
multiRowSelection: boolean;
prepareRow?(row: ReactTableRowType<Record<string, unknown>>): void;
selectTableRow?: (row: {
original: Record<string, unknown>;
index: number;
}) => void;
selectedRowIndex: number;
selectedRowIndices: number[];
columns: ReactTableColumnProps[];
width: number;
rows: ReactTableRowType<Record<string, unknown>>[];
primaryColumnId?: string;
isAddRowInProgress: boolean;
getTableBodyProps?(
propGetter?: TableBodyPropGetter<Record<string, unknown>> | undefined,
): TableBodyProps;
totalColumnsWidth?: number;
} & Partial<HeaderComponentProps>;
export const TableBodyContext = React.createContext<TableBodyContextType>({
accentColor: "",
borderRadius: "",
multiRowSelection: false,
selectedRowIndex: -1,
selectedRowIndices: [],
columns: [],
width: 0,
rows: [],
primaryColumnId: "",
isAddRowInProgress: false,
totalColumnsWidth: 0,
});
accentColor: string;
borderRadius: string;
multiRowSelection: boolean;
prepareRow?(row: ReactTableRowType<Record<string, unknown>>): void;
selectTableRow?: (row: {
original: Record<string, unknown>;
index: number;
}) => void;
selectedRowIndex: number;
selectedRowIndices: number[];
columns: ReactTableColumnProps[];
width: number;
rows: ReactTableRowType<Record<string, unknown>>[];
primaryColumnId?: string;
isAddRowInProgress: boolean;
getTableBodyProps?(
propGetter?: TableBodyPropGetter<Record<string, unknown>> | undefined,
): TableBodyProps;
totalColumnsWidth?: number;
} & Partial<HeaderComponentProps>;

export const TableBodyContext = React.createContext<TableBodyContextType>({
accentColor: "",
borderRadius: "",
multiRowSelection: false,
selectedRowIndex: -1,
selectedRowIndices: [],
columns: [],
width: 0,
rows: [],
primaryColumnId: "",
isAddRowInProgress: false,
totalColumnsWidth: 0,
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from "react";

import { TableBodyContext } from './context'
import { TableBodyContext } from "./context";
import { StaticTableBody } from "./StaticTableBody";
import type { TableBodyContextType } from "./context";
import { VirtualTableBody, VirtualTableBodyProps } from "./VirtualTableBody";
import type { VirtualTableBodyProps } from "./VirtualTableBody";
import { VirtualTableBody } from "./VirtualTableBody";

export const TableBody = (
props: VirtualTableBodyProps & TableBodyContextType & { useVirtual: boolean },
Expand Down Expand Up @@ -81,4 +82,4 @@ export const TableBody = (
);
};

export { TableBodyContext };
export { TableBodyContext };
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
import styled, { css } from "styled-components";
import type {
TableSizes,
CellLayoutProperties,
CellAlignment,
VerticalAlignment,
ImageSize,
} from "./Constants";
import {
JUSTIFY_CONTENT,
ALIGN_ITEMS,
IMAGE_HORIZONTAL_ALIGN,
IMAGE_VERTICAL_ALIGN,
TEXT_ALIGN,
TABLE_SIZES,
ImageSizes,
MULTISELECT_CHECKBOX_WIDTH,
} from "./Constants";
import type { Color } from "constants/Colors";
import { Colors } from "constants/Colors";
import { invisible } from "constants/DefaultTheme";
import { lightenColor, darkenColor } from "widgets/WidgetUtils";
import { FontStyleTypes } from "constants/WidgetConstants";
import { Classes } from "@blueprintjs/core";
import type { TableVariant } from "../constants";
import { Layers } from "constants/Layers";

const BORDER_RADIUS = "border-radius: 4px;";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,7 @@
import React, { memo } from "react";
import type { BaseCellComponentProps, CellAlignment } from "../Constants";
import { ALIGN_ITEMS, JUSTIFY_CONTENT } from "../Constants";
import { CellWrapper, TooltipContentWrapper } from "../TableStyledWrappers";
import CheckboxComponent from "widgets/CheckboxWidget/component/index";
import { LabelPosition } from "components/constants";
import styled from "styled-components";
import { Tooltip } from "@blueprintjs/core";
import type { BaseCellComponentProps } from "../Constants";
import { Checkbox } from "@design-system/widgets";

const UnsavedChangesMarker = styled.div<{ accentColor: string }>`
position: absolute;
top: -1px;
right: -3px;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid ${(props) => props.accentColor};
transform: rotateZ(45deg);
`;

const CheckboxCellWrapper = styled(CellWrapper)<{
horizontalAlignment?: CellAlignment;
}>`
& div {
& .bp3-checkbox {
gap: 0px;
}
}
& .bp3-disabled {
cursor: grab !important;
& .bp3-control-indicator::before {
cursor: grab !important;
}
}
& > .bp3-popover-wrapper {
overflow: unset;
}
`;

type CheckboxCellProps = BaseCellComponentProps & {
value: boolean;
accentColor: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@ import type { TableWidgetProps } from "widgets/wds/WDSTableWidget/constants";
import { ColumnTypes, ICON_NAMES } from "widgets/wds/WDSTableWidget/constants";
import {
hideByColumnType,
hideByMenuItemsSource,
hideIfMenuItemsSourceDataIsFalsy,
updateIconAlignment,
updateMenuItemsSource,
} from "../../../widget/propertyUtils";
import { IconNames } from "@blueprintjs/icons";
import { MenuItemsSource } from "widgets/MenuButtonWidget/constants";
import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";
import configureMenuItemsConfig from "./childPanels/configureMenuItemsConfig";

export default {
sectionName: "Basic",
Expand All @@ -34,7 +28,6 @@ export default {
updateHook: updateIconAlignment,
dependencies: ["primaryColumns", "columnOrder"],
controlType: "ICON_SELECT",

defaultIconName: "add",
isJSConvertible: true,
isBindProperty: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { ValidationTypes } from "constants/WidgetValidation";
import type { TableWidgetProps } from "widgets/wds/WDSTableWidget/constants";
import { ColumnTypes } from "widgets/wds/WDSTableWidget/constants";
import {
hideByColumnType,
updateColumnOrderWhenFrozen,
} from "../../../widget/propertyUtils";
import { StickyType } from "widgets/wds/WDSTableWidget/component/Constants";
import { hideByColumnType } from "../../../widget/propertyUtils";
import { BUTTON_VARIANTS } from "@design-system/widgets";
import capitalize from "lodash/capitalize";

Expand All @@ -19,7 +15,6 @@ export default {
helpText: "Controls the visibility of the cell in the column",
defaultValue: true,
controlType: "SWITCH",

isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
Expand All @@ -36,7 +31,6 @@ export default {
helpText: "Controls the disabled state of the button",
defaultValue: false,
controlType: "SWITCH",

isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
Expand All @@ -60,7 +54,6 @@ export default {
helpText: "Decides if menu items will consume lesser space",
label: "Compact",
controlType: "SWITCH",

isJSConvertible: true,
isBindProperty: true,
validation: {
Expand All @@ -82,7 +75,6 @@ export default {
helpText: "Allows content of the cell to be wrapped",
defaultValue: false,
controlType: "SWITCH",

isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
Expand Down Expand Up @@ -110,7 +102,6 @@ export const GeneralStyle = {
propertyName: "buttonVariant",
label: "Button variant",
controlType: "DROP_DOWN",

fullWidth: true,
helpText: "Sets the variant of the button",
options: Object.values(BUTTON_VARIANTS).map((variant) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default {
updateHook: updateIconAlignment,
dependencies: ["primaryColumns", "columnOrder"],
controlType: "ICON_SELECT",

isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export function getDefaultColumnProperties(
isDerived: !!isDerived,
label: id,
isSaveVisible: true,
isDiscardVisible: true,
isDiscardVisible: true,
sticky: StickyType.NONE,
validation: {},
currencyCode: "USD",
Expand Down

0 comments on commit c0dc998

Please sign in to comment.