mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-05 21:32:02 -06:00
Compare commits
2 Commits
fix/attrib
...
fix/click-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
055f143c30 | ||
|
|
ba1d36ecd8 |
@@ -1303,7 +1303,6 @@
|
|||||||
"casual": "Lässig",
|
"casual": "Lässig",
|
||||||
"caution_edit_duplicate": "Duplizieren & bearbeiten",
|
"caution_edit_duplicate": "Duplizieren & bearbeiten",
|
||||||
"caution_edit_published_survey": "Eine veröffentlichte Umfrage bearbeiten?",
|
"caution_edit_published_survey": "Eine veröffentlichte Umfrage bearbeiten?",
|
||||||
"caution_explanation_all_data_as_download": "Alle Daten, einschließlich früherer Antworten, stehen als Download zur Verfügung.",
|
|
||||||
"caution_explanation_intro": "Wir verstehen, dass du vielleicht noch Änderungen vornehmen möchtest. Hier erfährst du, was passiert, wenn du das tust:",
|
"caution_explanation_intro": "Wir verstehen, dass du vielleicht noch Änderungen vornehmen möchtest. Hier erfährst du, was passiert, wenn du das tust:",
|
||||||
"caution_explanation_new_responses_separated": "Antworten vor der Änderung werden möglicherweise nicht oder nur teilweise in der Umfragezusammenfassung berücksichtigt.",
|
"caution_explanation_new_responses_separated": "Antworten vor der Änderung werden möglicherweise nicht oder nur teilweise in der Umfragezusammenfassung berücksichtigt.",
|
||||||
"caution_explanation_only_new_responses_in_summary": "Alle Daten, einschließlich früherer Antworten, bleiben auf der Umfrageübersichtsseite als Download verfügbar.",
|
"caution_explanation_only_new_responses_in_summary": "Alle Daten, einschließlich früherer Antworten, bleiben auf der Umfrageübersichtsseite als Download verfügbar.",
|
||||||
|
|||||||
@@ -1303,7 +1303,6 @@
|
|||||||
"casual": "Casual",
|
"casual": "Casual",
|
||||||
"caution_edit_duplicate": "Duplicate & edit",
|
"caution_edit_duplicate": "Duplicate & edit",
|
||||||
"caution_edit_published_survey": "Edit a published survey?",
|
"caution_edit_published_survey": "Edit a published survey?",
|
||||||
"caution_explanation_all_data_as_download": "All data, including past responses are available as download.",
|
|
||||||
"caution_explanation_intro": "We understand you might still want to make changes. Here’s what happens if you do: ",
|
"caution_explanation_intro": "We understand you might still want to make changes. Here’s what happens if you do: ",
|
||||||
"caution_explanation_new_responses_separated": "Responses before the change may not or only partially be included in the survey summary.",
|
"caution_explanation_new_responses_separated": "Responses before the change may not or only partially be included in the survey summary.",
|
||||||
"caution_explanation_only_new_responses_in_summary": "All data, including past responses, remain available as download on the survey summary page.",
|
"caution_explanation_only_new_responses_in_summary": "All data, including past responses, remain available as download on the survey summary page.",
|
||||||
|
|||||||
@@ -1303,7 +1303,6 @@
|
|||||||
"casual": "Décontracté",
|
"casual": "Décontracté",
|
||||||
"caution_edit_duplicate": "Dupliquer et modifier",
|
"caution_edit_duplicate": "Dupliquer et modifier",
|
||||||
"caution_edit_published_survey": "Modifier un sondage publié ?",
|
"caution_edit_published_survey": "Modifier un sondage publié ?",
|
||||||
"caution_explanation_all_data_as_download": "Toutes les données, y compris les réponses passées, sont disponibles en téléchargement.",
|
|
||||||
"caution_explanation_intro": "Nous comprenons que vous souhaitiez encore apporter des modifications. Voici ce qui se passe si vous le faites : ",
|
"caution_explanation_intro": "Nous comprenons que vous souhaitiez encore apporter des modifications. Voici ce qui se passe si vous le faites : ",
|
||||||
"caution_explanation_new_responses_separated": "Les réponses avant le changement peuvent ne pas être ou ne faire partie que partiellement du résumé de l'enquête.",
|
"caution_explanation_new_responses_separated": "Les réponses avant le changement peuvent ne pas être ou ne faire partie que partiellement du résumé de l'enquête.",
|
||||||
"caution_explanation_only_new_responses_in_summary": "Toutes les données, y compris les réponses passées, restent disponibles en téléchargement sur la page de résumé de l'enquête.",
|
"caution_explanation_only_new_responses_in_summary": "Toutes les données, y compris les réponses passées, restent disponibles en téléchargement sur la page de résumé de l'enquête.",
|
||||||
|
|||||||
@@ -1303,7 +1303,6 @@
|
|||||||
"casual": "Casual",
|
"casual": "Casual",
|
||||||
"caution_edit_duplicate": "Duplicar e editar",
|
"caution_edit_duplicate": "Duplicar e editar",
|
||||||
"caution_edit_published_survey": "Editar uma pesquisa publicada?",
|
"caution_edit_published_survey": "Editar uma pesquisa publicada?",
|
||||||
"caution_explanation_all_data_as_download": "Todos os dados, incluindo respostas anteriores, estão disponíveis para download.",
|
|
||||||
"caution_explanation_intro": "Entendemos que você ainda pode querer fazer alterações. Aqui está o que acontece se você fizer:",
|
"caution_explanation_intro": "Entendemos que você ainda pode querer fazer alterações. Aqui está o que acontece se você fizer:",
|
||||||
"caution_explanation_new_responses_separated": "Respostas antes da mudança podem não ser ou apenas parcialmente incluídas no resumo da pesquisa.",
|
"caution_explanation_new_responses_separated": "Respostas antes da mudança podem não ser ou apenas parcialmente incluídas no resumo da pesquisa.",
|
||||||
"caution_explanation_only_new_responses_in_summary": "Todos os dados, incluindo respostas anteriores, permanecem disponíveis para download na página de resumo da pesquisa.",
|
"caution_explanation_only_new_responses_in_summary": "Todos os dados, incluindo respostas anteriores, permanecem disponíveis para download na página de resumo da pesquisa.",
|
||||||
|
|||||||
@@ -1303,7 +1303,6 @@
|
|||||||
"casual": "Casual",
|
"casual": "Casual",
|
||||||
"caution_edit_duplicate": "Duplicar e editar",
|
"caution_edit_duplicate": "Duplicar e editar",
|
||||||
"caution_edit_published_survey": "Editar um inquérito publicado?",
|
"caution_edit_published_survey": "Editar um inquérito publicado?",
|
||||||
"caution_explanation_all_data_as_download": "Todos os dados, incluindo respostas anteriores, estão disponíveis para download.",
|
|
||||||
"caution_explanation_intro": "Entendemos que ainda pode querer fazer alterações. Eis o que acontece se o fizer:",
|
"caution_explanation_intro": "Entendemos que ainda pode querer fazer alterações. Eis o que acontece se o fizer:",
|
||||||
"caution_explanation_new_responses_separated": "Respostas antes da alteração podem não estar incluídas ou estar apenas parcialmente incluídas no resumo do inquérito.",
|
"caution_explanation_new_responses_separated": "Respostas antes da alteração podem não estar incluídas ou estar apenas parcialmente incluídas no resumo do inquérito.",
|
||||||
"caution_explanation_only_new_responses_in_summary": "Todos os dados, incluindo respostas anteriores, permanecem disponíveis para download na página de resumo do inquérito.",
|
"caution_explanation_only_new_responses_in_summary": "Todos os dados, incluindo respostas anteriores, permanecem disponíveis para download na página de resumo do inquérito.",
|
||||||
|
|||||||
@@ -1303,7 +1303,6 @@
|
|||||||
"casual": "隨意",
|
"casual": "隨意",
|
||||||
"caution_edit_duplicate": "複製 & 編輯",
|
"caution_edit_duplicate": "複製 & 編輯",
|
||||||
"caution_edit_published_survey": "編輯已發佈的調查?",
|
"caution_edit_published_survey": "編輯已發佈的調查?",
|
||||||
"caution_explanation_all_data_as_download": "所有數據,包括過去的回應,都可以下載。",
|
|
||||||
"caution_explanation_intro": "我們了解您可能仍然想要進行更改。如果您這樣做,將會發生以下情況:",
|
"caution_explanation_intro": "我們了解您可能仍然想要進行更改。如果您這樣做,將會發生以下情況:",
|
||||||
"caution_explanation_new_responses_separated": "更改前的回應可能未被納入或只有部分包含在調查摘要中。",
|
"caution_explanation_new_responses_separated": "更改前的回應可能未被納入或只有部分包含在調查摘要中。",
|
||||||
"caution_explanation_only_new_responses_in_summary": "所有數據,包括過去的回應,仍可在調查摘要頁面下載。",
|
"caution_explanation_only_new_responses_in_summary": "所有數據,包括過去的回應,仍可在調查摘要頁面下載。",
|
||||||
|
|||||||
@@ -50,12 +50,12 @@ export function RenderSurvey(props: SurveyContainerProps) {
|
|||||||
placement={props.placement}
|
placement={props.placement}
|
||||||
darkOverlay={props.darkOverlay}
|
darkOverlay={props.darkOverlay}
|
||||||
clickOutside={props.clickOutside}
|
clickOutside={props.clickOutside}
|
||||||
|
ignorePlacementForClickOutside={props.ignorePlacementForClickOutside}
|
||||||
onClose={close}
|
onClose={close}
|
||||||
isOpen={isOpen}>
|
isOpen={isOpen}>
|
||||||
{/* @ts-expect-error -- TODO: fix this */}
|
{/* @ts-expect-error -- TODO: fix this */}
|
||||||
<Survey
|
<Survey
|
||||||
{...props}
|
{...props}
|
||||||
clickOutside={props.placement === "center" ? props.clickOutside : true}
|
|
||||||
onClose={close}
|
onClose={close}
|
||||||
onFinished={() => {
|
onFinished={() => {
|
||||||
props.onFinished?.();
|
props.onFinished?.();
|
||||||
|
|||||||
@@ -210,6 +210,36 @@ describe("SurveyContainer", () => {
|
|||||||
expect(onCloseMock).not.toHaveBeenCalled();
|
expect(onCloseMock).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("triggers clickOutside logic if ignorePlacementForClickOutside is true and placement is not center", () => {
|
||||||
|
render(
|
||||||
|
<SurveyContainer
|
||||||
|
mode="modal"
|
||||||
|
placement="bottomRight"
|
||||||
|
clickOutside={true}
|
||||||
|
onClose={onCloseMock}
|
||||||
|
ignorePlacementForClickOutside={true}>
|
||||||
|
{(<TestChild />) as any}
|
||||||
|
</SurveyContainer>
|
||||||
|
);
|
||||||
|
fireEvent.mouseDown(document.body);
|
||||||
|
expect(onCloseMock).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("does not trigger clickOutside logic if ignorePlacementForClickOutside is true and placement is center", () => {
|
||||||
|
render(
|
||||||
|
<SurveyContainer
|
||||||
|
mode="modal"
|
||||||
|
placement="center"
|
||||||
|
clickOutside={false}
|
||||||
|
onClose={onCloseMock}
|
||||||
|
ignorePlacementForClickOutside={true}>
|
||||||
|
{(<TestChild />) as any}
|
||||||
|
</SurveyContainer>
|
||||||
|
);
|
||||||
|
fireEvent.mouseDown(document.body);
|
||||||
|
expect(onCloseMock).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
test("does not trigger clickOutside logic if mode is not modal", () => {
|
test("does not trigger clickOutside logic if mode is not modal", () => {
|
||||||
render(
|
render(
|
||||||
<SurveyContainer mode="inline" placement="center" clickOutside={true} onClose={onCloseMock}>
|
<SurveyContainer mode="inline" placement="center" clickOutside={true} onClose={onCloseMock}>
|
||||||
@@ -234,6 +264,7 @@ describe("SurveyContainer", () => {
|
|||||||
unmount();
|
unmount();
|
||||||
expect(removeEventListenerSpy).toHaveBeenCalledWith("mousedown", expect.any(Function));
|
expect(removeEventListenerSpy).toHaveBeenCalledWith("mousedown", expect.any(Function));
|
||||||
});
|
});
|
||||||
|
|
||||||
test("does not call onClose when modal is not shown (show=false)", () => {
|
test("does not call onClose when modal is not shown (show=false)", () => {
|
||||||
render(
|
render(
|
||||||
<SurveyContainer
|
<SurveyContainer
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ interface SurveyContainerProps {
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
clickOutside?: boolean;
|
clickOutside?: boolean;
|
||||||
|
ignorePlacementForClickOutside?: boolean;
|
||||||
isOpen?: boolean;
|
isOpen?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ export function SurveyContainer({
|
|||||||
children,
|
children,
|
||||||
onClose,
|
onClose,
|
||||||
clickOutside,
|
clickOutside,
|
||||||
|
ignorePlacementForClickOutside,
|
||||||
isOpen = true,
|
isOpen = true,
|
||||||
}: Readonly<SurveyContainerProps>) {
|
}: Readonly<SurveyContainerProps>) {
|
||||||
const modalRef = useRef<HTMLDivElement>(null);
|
const modalRef = useRef<HTMLDivElement>(null);
|
||||||
@@ -27,7 +29,11 @@ export function SurveyContainer({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isModal) return;
|
if (!isModal) return;
|
||||||
if (!isCenter) return;
|
|
||||||
|
// If the placement is not center and we don't want to ignore center placement for click outside, we will return early
|
||||||
|
if (!ignorePlacementForClickOutside && !isCenter) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const handleClickOutside = (e: MouseEvent) => {
|
const handleClickOutside = (e: MouseEvent) => {
|
||||||
if (
|
if (
|
||||||
@@ -44,7 +50,7 @@ export function SurveyContainer({
|
|||||||
return () => {
|
return () => {
|
||||||
document.removeEventListener("mousedown", handleClickOutside);
|
document.removeEventListener("mousedown", handleClickOutside);
|
||||||
};
|
};
|
||||||
}, [clickOutside, onClose, isCenter, isModal, isOpen]);
|
}, [clickOutside, onClose, isCenter, isModal, isOpen, ignorePlacementForClickOutside]);
|
||||||
|
|
||||||
const getPlacementStyle = (placement: TPlacement): string => {
|
const getPlacementStyle = (placement: TPlacement): string => {
|
||||||
switch (placement) {
|
switch (placement) {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export interface SurveyBaseProps {
|
|||||||
isCardBorderVisible?: boolean;
|
isCardBorderVisible?: boolean;
|
||||||
startAtQuestionId?: string;
|
startAtQuestionId?: string;
|
||||||
clickOutside?: boolean;
|
clickOutside?: boolean;
|
||||||
|
ignorePlacementForClickOutside?: boolean;
|
||||||
hiddenFieldsRecord?: TResponseHiddenFieldValue;
|
hiddenFieldsRecord?: TResponseHiddenFieldValue;
|
||||||
shouldResetQuestionId?: boolean;
|
shouldResetQuestionId?: boolean;
|
||||||
fullSizeCards?: boolean;
|
fullSizeCards?: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user