From 78e794ac357a832bd8c99cab6b038e951f490127 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Tue, 9 Apr 2024 09:39:56 +0530 Subject: [PATCH 01/16] update plaintext --- .../src/ce/selectors/featureFlagsSelectors.ts | 3 + app/client/src/utils/hooks/useFeatureFlag.ts | 3 + .../wds/WDSTableWidget/component/Constants.ts | 2 +- .../component/TableStyledWrappers.tsx | 5 +- .../component/cellComponents/CheckboxCell.tsx | 4 - .../component/cellComponents/DateCell.tsx | 14 -- .../cellComponents/InlineCellEditor.tsx | 121 +----------------- .../cellComponents/PlainTextCell.tsx | 67 ++++------ .../component/cellComponents/SwitchCell.tsx | 4 - .../component/styles.module.css | 4 +- .../config/propertyPaneConfig/styleConfig.ts | 54 ++------ .../WDSTableWidget/widget/utilities.test.ts | 4 +- .../wds/WDSTableWidget/widget/utilities.ts | 6 +- 13 files changed, 56 insertions(+), 235 deletions(-) diff --git a/app/client/src/ce/selectors/featureFlagsSelectors.ts b/app/client/src/ce/selectors/featureFlagsSelectors.ts index 80ef0ca73dc..51570ad45a7 100644 --- a/app/client/src/ce/selectors/featureFlagsSelectors.ts +++ b/app/client/src/ce/selectors/featureFlagsSelectors.ts @@ -22,6 +22,9 @@ export const selectFeatureFlagCheck = ( ): boolean => { const flagValues = selectFeatureFlags(state); + if (flagName === "ab_wds_enabled") return true; + if (flagName === "release_anvil_enabled") return true; + if (flagName in flagValues) { return flagValues[flagName]; } diff --git a/app/client/src/utils/hooks/useFeatureFlag.ts b/app/client/src/utils/hooks/useFeatureFlag.ts index 72355076a25..371892ac4dc 100644 --- a/app/client/src/utils/hooks/useFeatureFlag.ts +++ b/app/client/src/utils/hooks/useFeatureFlag.ts @@ -5,6 +5,9 @@ import { selectFeatureFlags } from "@appsmith/selectors/featureFlagsSelectors"; export function useFeatureFlag(flagName: FeatureFlag): boolean { const flagValues = useSelector(selectFeatureFlags); + if (flagName === "ab_wds_enabled") return true; + if (flagName === "release_anvil_enabled") return true; + if (flagName in flagValues) { return flagValues[flagName]; } diff --git a/app/client/src/widgets/wds/WDSTableWidget/component/Constants.ts b/app/client/src/widgets/wds/WDSTableWidget/component/Constants.ts index 703c84edbee..e22ccea8d62 100644 --- a/app/client/src/widgets/wds/WDSTableWidget/component/Constants.ts +++ b/app/client/src/widgets/wds/WDSTableWidget/component/Constants.ts @@ -113,7 +113,7 @@ export type CompactMode = keyof typeof CompactModeTypes; export type Condition = keyof typeof ConditionFunctions | ""; export type Operator = keyof typeof OperatorTypes; export type CellAlignment = keyof typeof CellAlignmentTypes; -export type VerticalAlignment = keyof typeof VerticalAlignmentTypes; +export type VerticalAlignment = "start" | "center" | "end"; export type ImageSize = keyof typeof ImageSizes; export interface ReactTableFilter { diff --git a/app/client/src/widgets/wds/WDSTableWidget/component/TableStyledWrappers.tsx b/app/client/src/widgets/wds/WDSTableWidget/component/TableStyledWrappers.tsx index a95fa837374..792e28b5470 100644 --- a/app/client/src/widgets/wds/WDSTableWidget/component/TableStyledWrappers.tsx +++ b/app/client/src/widgets/wds/WDSTableWidget/component/TableStyledWrappers.tsx @@ -173,8 +173,6 @@ export const CellWrapper = styled.div<{ 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) { @@ -223,8 +221,7 @@ export const CellWrapper = styled.div<{ 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]}; diff --git a/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/CheckboxCell.tsx b/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/CheckboxCell.tsx index b1200db9313..74ed4f0de3a 100644 --- a/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/CheckboxCell.tsx +++ b/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/CheckboxCell.tsx @@ -27,10 +27,6 @@ const CheckboxCellWrapper = styled(CellWrapper)<{ props.horizontalAlignment && JUSTIFY_CONTENT[props.horizontalAlignment]} !important; - align-items: ${(props) => - props.verticalAlignment && - ALIGN_ITEMS[props.verticalAlignment]} !important; - & .bp3-checkbox { gap: 0px; } diff --git a/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/DateCell.tsx b/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/DateCell.tsx index a60ae8f6a18..9de8be73eb4 100644 --- a/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/DateCell.tsx +++ b/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/DateCell.tsx @@ -71,8 +71,6 @@ const Container = styled.div<{ height: 100%; width: 100%; display: flex; - align-items: ${(props) => - props.verticalAlignment && ALIGN_ITEMS[props.verticalAlignment]}; `; const FOCUS_CLASS = "has-focus"; @@ -114,18 +112,6 @@ const Wrapper = styled.div<{ : `${TABLE_SIZES[props.compactMode].ROW_HEIGHT}px`; } }}; - ${(props) => { - switch (props.verticalAlignment) { - case "TOP": - return `top: 0;`; - case "BOTTOM": - return `bottom: 0;`; - case "CENTER": - return ` - top: calc(50% - (${TABLE_SIZES[props.compactMode].ROW_HEIGHT}/2)px); - `; - } - }} &&&&& { .bp3-input, diff --git a/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/InlineCellEditor.tsx b/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/InlineCellEditor.tsx index e8530500958..5a402e7eba7 100644 --- a/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/InlineCellEditor.tsx +++ b/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/InlineCellEditor.tsx @@ -21,6 +21,7 @@ import { import { limitDecimalValue } from "widgets/CurrencyInputWidget/component/utilities"; import * as Sentry from "@sentry/react"; import { getLocale } from "utils/helpers"; +import { TextArea } from "@design-system/widgets"; const FOCUS_CLASS = "has-focus"; @@ -38,88 +39,9 @@ const Wrapper = styled.div<{ ${(props) => (!props.isEditableCellValid ? Colors.DANGER_SOLID : "#fff")}; background: #fff; position: absolute; - width: ${(props) => - props.paddedInput - ? `calc(100% - ${EDITABLE_CELL_PADDING_OFFSET}px)` - : "100%"}; - left: 50%; - transform: translate(-50%, 0); overflow: hidden; border-radius: 3px; - height: ${(props) => { - if (props.allowCellWrapping) { - return props.paddedInput - ? `calc(100% - ${EDITABLE_CELL_PADDING_OFFSET}px)` - : "100%"; - } else { - return props.paddedInput - ? `${ - TABLE_SIZES[props.compactMode].ROW_HEIGHT - - EDITABLE_CELL_PADDING_OFFSET - }px` - : `${TABLE_SIZES[props.compactMode].ROW_HEIGHT}px`; - } - }}; - ${(props) => { - switch (props.verticalAlignment) { - case "TOP": - return `top: 0;`; - case "BOTTOM": - return `bottom: 0;`; - case "CENTER": - return ` - top: calc(50% - (${TABLE_SIZES[props.compactMode].ROW_HEIGHT}/2)px); - `; - } - }} - - &&&&& { - .bp3-input, - .bp3-input:focus { - border: none; - /* - * using !important since underlying - * component styles has !important - */ - box-shadow: none !important; - padding: 0px 5px 0px 6px; - min-height: 34px; - font-size: ${(props) => props.textSize}; - } - - .currency-change-dropdown-trigger { - border: none; - height: ${(props) => - TABLE_SIZES[props.compactMode].EDITABLE_CELL_HEIGHT}px; - padding: 0 0 0 5px; - margin-right: 0; - } - - .bp3-button-group.bp3-vertical { - display: none; - } - - textarea.bp3-input { - &, - &:focus { - line-height: 28px; - padding: ${(props) => - TABLE_SIZES[props.compactMode].VERTICAL_EDITOR_PADDING}px - 6px 0px 6px; - } - } - - .text-input-wrapper { - height: calc(100% + 4px); - border: none; - box-shadow: none !important; - } - } - - &.${FOCUS_CLASS} { - ${(props) => - props.isEditableCellValid && `border: 1px solid ${props.accentColor}`} - } + inset: 0; `; function convertToNumber(inputValue: string) { @@ -265,40 +187,9 @@ export function InlineCellEditor({ }, [value]); return ( - - - +