fix: resolved disabled captcha click.

This commit is contained in:
Arsalan 2022-03-22 12:22:39 +05:30
parent f2ea8b1838
commit bef9d2d81b
2 changed files with 7 additions and 3 deletions

View File

@ -303,7 +303,7 @@ interface ButtonComponentProps extends ComponentProps {
function RecaptchaV2Component(
props: {
children: any;
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
isDisabled?: boolean;
recaptchaType?: RecaptchaType;
handleError: (event: React.MouseEvent<HTMLElement>, error: string) => void;
} & RecaptchaProps,
@ -314,6 +314,7 @@ function RecaptchaV2Component(
props.handleRecaptchaV2Loading && props.handleRecaptchaV2Loading(isloading);
};
const handleBtnClick = async (event: React.MouseEvent<HTMLElement>) => {
if (props.isDisabled) return;
if (isInvalidKey) {
// Handle incorrent google recaptcha site key
props.handleError(event, createMessage(GOOGLE_RECAPTCHA_KEY_ERROR));
@ -352,7 +353,7 @@ function RecaptchaV2Component(
function RecaptchaV3Component(
props: {
children: any;
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
isDisabled?: boolean;
recaptchaType?: RecaptchaType;
handleError: (event: React.MouseEvent<HTMLElement>, error: string) => void;
} & RecaptchaProps,
@ -363,6 +364,7 @@ function RecaptchaV3Component(
};
const handleBtnClick = (event: React.MouseEvent<HTMLElement>) => {
if (props.isDisabled) return;
if (status === ScriptStatus.READY) {
(window as any).grecaptcha.ready(() => {
try {
@ -405,6 +407,7 @@ function RecaptchaV3Component(
function BtnWrapper(
props: {
children: any;
isDisabled?: boolean;
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
} & RecaptchaProps,
) {
@ -436,6 +439,7 @@ function ButtonComponent(props: ButtonComponentProps & RecaptchaProps) {
clickWithRecaptcha={props.clickWithRecaptcha}
googleRecaptchaKey={props.googleRecaptchaKey}
handleRecaptchaV2Loading={props.handleRecaptchaV2Loading}
isDisabled={props.isDisabled}
onClick={props.onClick}
recaptchaType={props.recaptchaType}
>

View File

@ -223,7 +223,7 @@ class TableWidget extends BaseWidget<TableWidgetProps, WidgetState> {
borderRadius: cellProperties.borderRadius,
boxShadow: cellProperties.boxShadow,
boxShadowColor: cellProperties.boxShadowColor,
iconName: cellProperties.iconName,
iconName: cellProperties.iconName || "add",
iconAlign: cellProperties.iconAlign,
isCellVisible: cellProperties.isCellVisible ?? true,
label: cellProperties.menuButtonLabel ?? "Open menu",