@roqua/quby-frontend 0.10.3 → 0.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ import { IFieldState, IQuestion } from "../core";
3
3
  interface Props {
4
4
  question: IQuestion;
5
5
  fieldState: IFieldState<any>;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
6
+ setQuestionRef: (key: string, ref: React.RefObject<HTMLElement | null>) => void;
7
7
  }
8
8
  export declare const QuestionWrapper: React.FunctionComponent<React.PropsWithChildren<Props>>;
9
9
  export {};
@@ -1,10 +1,10 @@
1
1
  import React from "react";
2
- import { ICheckBoxQuestion, IFieldState } from "../../core";
2
+ import { ICheckBoxQuestion, IFieldState, SetQuestionRef } from "../../core";
3
3
  type CheckBoxFieldState = IFieldState<Set<string>>;
4
4
  interface Props {
5
5
  question: ICheckBoxQuestion;
6
6
  fieldState: CheckBoxFieldState;
7
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
7
+ setQuestionRef: SetQuestionRef;
8
8
  }
9
9
  export declare const CheckBoxQuestion: React.FunctionComponent<Props>;
10
10
  export {};
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { IStringQuestion, IFieldState } from "../../core";
2
+ import { IFieldState, IStringQuestion, SetQuestionRef } from "../../core";
3
3
  interface Props {
4
4
  question: IStringQuestion;
5
5
  fieldState: IFieldState<string>;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
6
+ setQuestionRef: SetQuestionRef;
7
7
  }
8
8
  export declare const CountrySelectQuestion: React.FunctionComponent<Props>;
9
9
  export {};
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { DatePartsComponent, IFieldState, IDatePartsQuestion } from "../../core";
2
+ import { DatePartsComponent, IDatePartsQuestion, IFieldState, SetQuestionRef } from "../../core";
3
3
  interface Props {
4
4
  question: IDatePartsQuestion;
5
5
  fieldState: IFieldState<Map<DatePartsComponent, string>>;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
6
+ setQuestionRef: SetQuestionRef;
7
7
  }
8
8
  export declare const DatePartsQuestion: React.FunctionComponent<Props>;
9
9
  export {};
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { IFloatQuestion, IFieldState } from "../../core";
2
+ import { IFieldState, IFloatQuestion, SetQuestionRef } from "../../core";
3
3
  interface Props {
4
4
  question: IFloatQuestion;
5
5
  fieldState: IFieldState<number>;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
6
+ setQuestionRef: SetQuestionRef;
7
7
  }
8
8
  export declare const FloatQuestion: React.FunctionComponent<Props>;
9
9
  export {};
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { IIntegerQuestion, IFieldState } from "../../core";
2
+ import { IFieldState, IIntegerQuestion, SetQuestionRef } from "../../core";
3
3
  interface Props {
4
4
  question: IIntegerQuestion;
5
5
  fieldState: IFieldState<number>;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
6
+ setQuestionRef: SetQuestionRef;
7
7
  }
8
8
  export declare const IntegerQuestion: React.FunctionComponent<Props>;
9
9
  export {};
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { IFieldState, ISliderQuestion } from "../../core";
2
+ import { IFieldState, ISliderQuestion, SetQuestionRef } from "../../core";
3
3
  interface Props {
4
4
  question: ISliderQuestion;
5
5
  fieldState: IFieldState<number>;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
6
+ setQuestionRef: SetQuestionRef;
7
7
  }
8
8
  export declare const OldSliderQuestion: React.FunctionComponent<Props>;
9
9
  export {};
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { IFieldState, IRadioQuestion } from "../../core";
2
+ import { IFieldState, IRadioQuestion, SetQuestionRef } from "../../core";
3
3
  interface Props {
4
4
  question: IRadioQuestion;
5
5
  fieldState: IFieldState<string>;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
6
+ setQuestionRef: SetQuestionRef;
7
7
  }
8
8
  export declare const RadioQuestion: React.FunctionComponent<Props>;
9
9
  export {};
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { IFieldState, IScaleQuestion } from "../../core";
2
+ import { IFieldState, IScaleQuestion, SetQuestionRef } from "../../core";
3
3
  interface Props {
4
4
  question: IScaleQuestion;
5
5
  fieldState: IFieldState<string>;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
6
+ setQuestionRef: SetQuestionRef;
7
7
  }
8
8
  export declare const ScaleQuestion: React.FunctionComponent<Props>;
9
9
  export {};
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { IFieldState, ISelectQuestion } from "../../core";
2
+ import { IFieldState, ISelectQuestion, SetQuestionRef } from "../../core";
3
3
  interface Props {
4
4
  question: ISelectQuestion;
5
5
  fieldState: IFieldState<string>;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
6
+ setQuestionRef: SetQuestionRef;
7
7
  }
8
8
  export declare const SelectQuestion: React.FunctionComponent<Props>;
9
9
  export {};
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { IFieldState, ISliderQuestion } from "../../core";
2
+ import { IFieldState, ISliderQuestion, SetQuestionRef } from "../../core";
3
3
  interface Props {
4
4
  question: ISliderQuestion;
5
5
  fieldState: IFieldState<number>;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
6
+ setQuestionRef: SetQuestionRef;
7
7
  }
8
8
  export declare const SliderQuestion: React.FunctionComponent<Props>;
9
9
  export {};
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { ISplitToUnitsQuestion, IFieldState } from "../../core";
2
+ import { IFieldState, ISplitToUnitsQuestion, SetQuestionRef } from "../../core";
3
3
  interface Props {
4
4
  question: ISplitToUnitsQuestion;
5
5
  fieldState: IFieldState<number>;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
6
+ setQuestionRef: SetQuestionRef;
7
7
  }
8
8
  export declare const SplitToUnitsQuestion: React.FunctionComponent<Props>;
9
9
  export {};
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { IFieldState, IStringQuestion } from "../../core";
2
+ import { IFieldState, IStringQuestion, SetQuestionRef } from "../../core";
3
3
  interface Props {
4
4
  question: IStringQuestion;
5
5
  fieldState: IFieldState<string>;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
6
+ setQuestionRef: SetQuestionRef;
7
7
  }
8
8
  export declare const StringQuestion: React.FunctionComponent<Props>;
9
9
  export {};
@@ -3,7 +3,7 @@ import { ITextareaQuestion, IFieldState } from "../../core";
3
3
  interface Props {
4
4
  question: ITextareaQuestion;
5
5
  fieldState: IFieldState<string>;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
6
+ setQuestionRef: (key: string, ref: React.RefObject<HTMLElement | null>) => void;
7
7
  }
8
8
  export declare const TextareaQuestion: React.FunctionComponent<Props>;
9
9
  export {};
@@ -1,9 +1,10 @@
1
1
  import React from "react";
2
2
  import { Response, Questionnaire, IDisplayOptions } from ".";
3
+ export type SetQuestionRef = (key: string, ref: React.RefObject<HTMLElement | null>) => void;
3
4
  export interface IQubyContext {
4
5
  questionnaire: Questionnaire;
5
6
  response: Response;
6
- setQuestionRef: (key: string, ref: React.RefObject<HTMLElement>) => void;
7
+ setQuestionRef: SetQuestionRef;
7
8
  displayOptions: IDisplayOptions;
8
9
  }
9
10
  export declare const QubyContext: React.Context<IQubyContext>;
@@ -9,6 +9,10 @@ export type IValidation = IRequiresAnswerValidation | IValidIntegerValidation |
9
9
  export interface IRequiresAnswerValidation {
10
10
  type: "requires_answer";
11
11
  fieldKey: string;
12
+ dependsOnQuestions?: string[];
13
+ dependsOnOptions?: {
14
+ [key: string]: string[];
15
+ };
12
16
  }
13
17
  export interface IValidIntegerValidation {
14
18
  type: "valid_integer";
@@ -230,6 +234,12 @@ export interface IVisibilityIfEqual {
230
234
  fieldKey: string;
231
235
  value: string;
232
236
  }
237
+ export interface IVisibilityNumericCompare {
238
+ type: "numeric_compare";
239
+ fieldKey: string;
240
+ op: "gt" | "gteq" | "lt" | "lteq" | "eq";
241
+ value: number;
242
+ }
233
243
  export interface IVisibilityIfContains {
234
244
  type: "contains";
235
245
  fieldKey: string;
@@ -256,7 +266,7 @@ export interface IVisibilityThenHide {
256
266
  type: "hide_question";
257
267
  fieldKey: string;
258
268
  }
259
- export type VisibilityIf = IVisibilityIfEqual | IVisibilityIfContains | IVisibilityConditionAlways | IVisibilityConditionFlagEqual | IVisibilityConditionAnswered;
269
+ export type VisibilityIf = IVisibilityIfEqual | IVisibilityNumericCompare | IVisibilityIfContains | IVisibilityConditionAlways | IVisibilityConditionFlagEqual | IVisibilityConditionAnswered;
260
270
  export type VisibilityThen = IVisibilityThenShow | IVisibilityThenHide;
261
271
  export interface IVisibilityRule {
262
272
  condition: VisibilityIf;
@@ -10,6 +10,9 @@ export declare abstract class BaseValidator<T> {
10
10
  }
11
11
  export declare class RequiresAnswerValidator extends BaseValidator<IRequiresAnswerValidation> {
12
12
  validate(response: ValidatableResponse): void;
13
+ ignoreDueToDependsOn(response: ValidatableResponse): boolean;
14
+ dependsOnQuestionAnswered(response: ValidatableResponse): boolean;
15
+ dependsOnOptionSelected(response: ValidatableResponse): boolean;
13
16
  }
14
17
  export declare class ValidDateValidator extends BaseValidator<IValidDateValidation> {
15
18
  validate(response: ValidatableResponse): void;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
2
  import { Response, Questionnaire } from "../core";
3
- export declare const useQuestionShortkeys: (response: Response, questionnaire: Questionnaire, qubyRef: React.RefObject<HTMLDivElement>) => void;
3
+ export declare const useQuestionShortkeys: (response: Response, questionnaire: Questionnaire, qubyRef: React.RefObject<HTMLDivElement | null>) => void;