fix: omit props passing to DOM element (#7181)

This commit is contained in:
Rishabh Rathod 2021-09-07 18:42:04 +05:30 committed by GitHub
parent a2a5439741
commit 027ed55611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 60 additions and 9 deletions

View File

@ -30,7 +30,8 @@ import { getViewModePageList } from "selectors/editorSelectors";
import { APP_MODE } from "entities/App"; import { APP_MODE } from "entities/App";
const ThreadContainer = styled(animated.div).withConfig({ const ThreadContainer = styled(animated.div).withConfig({
shouldForwardProp: (prop) => !["visible", "inline"].includes(prop), shouldForwardProp: (prop) =>
!["visible", "inline", "maxHeight"].includes(prop),
})<{ })<{
visible?: boolean; visible?: boolean;
inline?: boolean; inline?: boolean;

View File

@ -10,6 +10,7 @@ import {
import { isEmail } from "utils/formhelpers"; import { isEmail } from "utils/formhelpers";
import { AsyncControllableInput } from "@blueprintjs/core/lib/esm/components/forms/asyncControllableInput"; import { AsyncControllableInput } from "@blueprintjs/core/lib/esm/components/forms/asyncControllableInput";
import _ from "lodash";
export type Validator = ( export type Validator = (
value: string, value: string,
@ -85,16 +86,26 @@ const boxStyles = (
const StyledInput = styled((props) => { const StyledInput = styled((props) => {
// we are removing non input related props before passing them in the components // we are removing non input related props before passing them in the components
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable @typescript-eslint/no-unused-vars
const { dataType, inputRef, inputStyle, theme, ...inputProps } = props; const { dataType, inputRef, ...inputProps } = props;
const omitProps = [
"inputStyle",
"rightSideComponentWidth",
"theme",
"validator",
"isValid",
"cypressSelector",
];
return props.asyncControl ? ( return props.asyncControl ? (
<AsyncControllableInput <AsyncControllableInput
{...inputProps} {..._.omit(inputProps, omitProps)}
dataType={dataType} datatype={dataType}
inputRef={inputRef} inputRef={inputRef}
/> />
) : ( ) : (
<input ref={inputRef} {...inputProps} /> <input ref={inputRef} {..._.omit(inputProps, omitProps)} />
); );
})< })<
TextInputProps & { TextInputProps & {

View File

@ -7,6 +7,7 @@ import { IconName } from "@blueprintjs/icons";
import { ComponentProps } from "components/designSystems/appsmith/BaseComponent"; import { ComponentProps } from "components/designSystems/appsmith/BaseComponent";
import { ThemeProp } from "components/ads/common"; import { ThemeProp } from "components/ads/common";
import { WIDGET_PADDING } from "constants/WidgetConstants"; import { WIDGET_PADDING } from "constants/WidgetConstants";
import _ from "lodash";
import { import {
ButtonBorderRadius, ButtonBorderRadius,
ButtonBorderRadiusTypes, ButtonBorderRadiusTypes,
@ -34,7 +35,19 @@ export interface ButtonStyleProps {
hasOnClickAction?: boolean; hasOnClickAction?: boolean;
} }
export const StyledButton = styled(Button)<ThemeProp & ButtonStyleProps>` export const StyledButton = styled((props) => (
<Button
{..._.omit(props, [
"buttonVariant",
"buttonStyle",
"borderRadius",
"boxShadow",
"boxShadowColor",
"dimension",
"hasOnClickAction",
])}
/>
))<ThemeProp & ButtonStyleProps>`
background-image: none !important; background-image: none !important;
height: ${({ dimension }) => (dimension ? `${dimension}px` : "auto")}; height: ${({ dimension }) => (dimension ? `${dimension}px` : "auto")};

View File

@ -23,6 +23,7 @@ import {
import { ThemeProp, Variant } from "components/ads/common"; import { ThemeProp, Variant } from "components/ads/common";
import { Toaster } from "components/ads/Toast"; import { Toaster } from "components/ads/Toast";
import ReCAPTCHA from "react-google-recaptcha"; import ReCAPTCHA from "react-google-recaptcha";
import _ from "lodash";
import { import {
ButtonBoxShadow, ButtonBoxShadow,
ButtonBoxShadowTypes, ButtonBoxShadowTypes,
@ -163,7 +164,19 @@ const ButtonContainer = styled.div`
} }
`; `;
const StyledButton = styled(Button)<ThemeProp & ButtonStyleProps>` const StyledButton = styled((props) => (
<Button
{..._.omit(props, [
"prevButtonStyle",
"borderRadius",
"boxShadow",
"boxShadowColor",
"buttonColor",
"buttonStyle",
"buttonVariant",
])}
/>
))<ThemeProp & ButtonStyleProps>`
height: 100%; height: 100%;
background-image: none !important; background-image: none !important;
font-weight: ${(props) => props.theme.fontWeights[2]}; font-weight: ${(props) => props.theme.fontWeights[2]};

View File

@ -52,7 +52,20 @@ import {
*/ */
const InputComponentWrapper = styled((props) => ( const InputComponentWrapper = styled((props) => (
<ControlGroup {..._.omit(props, ["hasError", "numeric"])} /> <ControlGroup
{..._.omit(props, [
"hasError",
"numeric",
"labelTextColor",
"allowCurrencyChange",
"compactMode",
"labelStyle",
"labelTextSize",
"multiline",
"numeric",
"inputType",
])}
/>
))<{ ))<{
numeric: boolean; numeric: boolean;
multiline: string; multiline: string;