@planning-inspectorate/dynamic-forms 3.10.12 → 3.10.13
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.
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @typedef {(questionKeyTuples: QuestionKeyTuples) => boolean} CombinationFunc */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @param {import('
|
|
5
|
+
* @param {import('../../journey/journey-response.js').JourneyResponse} response
|
|
6
6
|
* @returns {{and: CombinationFunc, or: CombinationFunc}}
|
|
7
7
|
*/
|
|
8
8
|
export const logicalCombinations = (response) => ({
|
|
@@ -18,7 +18,7 @@ export const logicalCombinations = (response) => ({
|
|
|
18
18
|
* @example
|
|
19
19
|
* .withCondition(whenQuestionHasAnswer(question.q1, 'answer-1'))
|
|
20
20
|
*
|
|
21
|
-
* @param {import('
|
|
21
|
+
* @param {import('../../questions/question.js').Question} question
|
|
22
22
|
* @param {unknown} expectedValue
|
|
23
23
|
* @returns {import('../../section.js').QuestionCondition}
|
|
24
24
|
*/
|
|
@@ -29,8 +29,8 @@ export const whenQuestionHasAnswer = (question, expectedValue) => {
|
|
|
29
29
|
/**
|
|
30
30
|
* Does the question have the expected answer?
|
|
31
31
|
*
|
|
32
|
-
* @param {import('
|
|
33
|
-
* @param {import('
|
|
32
|
+
* @param {import('../../journey/journey-response.js').JourneyResponse} response
|
|
33
|
+
* @param {import('../../questions/question.js').Question|{optionJoinString: string}} question
|
|
34
34
|
* @param {unknown} expectedValue
|
|
35
35
|
* @returns {boolean}
|
|
36
36
|
*/
|
|
@@ -53,7 +53,7 @@ export const questionHasAnswer = (response, question, expectedValue) => {
|
|
|
53
53
|
/**
|
|
54
54
|
* Checks if any item in the specified answer field matches a condition.
|
|
55
55
|
*
|
|
56
|
-
* @param {JourneyResponse} response - The response object containing answers.
|
|
56
|
+
* @param {import('../../journey/journey-response.js').JourneyResponse} response - The response object containing answers.
|
|
57
57
|
* @param {any} question - The question containing the fieldName.
|
|
58
58
|
* @param {(item: any) => boolean} [conditionFn] - A function to test each item. Returns true to indicate a match.
|
|
59
59
|
* @returns {boolean} True if at least one item matches the condition.
|
|
@@ -70,7 +70,7 @@ export const questionArrayMeetsCondition = (response, question, conditionFn = ()
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
* @param {import('
|
|
73
|
+
* @param {import('../../journey/journey-response.js').JourneyResponse} response
|
|
74
74
|
* @param {QuestionKeyTuples} questionKeyTuples
|
|
75
75
|
* @param {Object} [options]
|
|
76
76
|
* @param {'and' | 'or'} options.logicalCombinator
|
|
@@ -87,8 +87,8 @@ export const questionsHaveAnswers = (
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
* @param {import('
|
|
91
|
-
* @param {import('
|
|
90
|
+
* @param {import('../../journey/journey-response.js').JourneyResponse} response
|
|
91
|
+
* @param {import('../../questions/question.js').Question} question
|
|
92
92
|
* @returns {boolean}
|
|
93
93
|
*/
|
|
94
94
|
export const questionHasNonEmptyStringAnswer = (response, question) => {
|
|
@@ -98,8 +98,8 @@ export const questionHasNonEmptyStringAnswer = (response, question) => {
|
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
|
-
* @param {import('
|
|
102
|
-
* @param {import('
|
|
101
|
+
* @param {import('../../journey/journey-response.js').JourneyResponse} response
|
|
102
|
+
* @param {import('../../questions/question.js').Question} question
|
|
103
103
|
* @returns {boolean}
|
|
104
104
|
*/
|
|
105
105
|
export const questionHasNonEmptyNumberAnswer = (response, question) => {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export function logicalCombinations(response: import("
|
|
1
|
+
export function logicalCombinations(response: import("../../journey/journey-response.js").JourneyResponse): {
|
|
2
2
|
and: CombinationFunc;
|
|
3
3
|
or: CombinationFunc;
|
|
4
4
|
};
|
|
5
|
-
export function whenQuestionHasAnswer(question: import("
|
|
6
|
-
export function questionHasAnswer(response: import("
|
|
5
|
+
export function whenQuestionHasAnswer(question: import("../../questions/question.js").Question, expectedValue: unknown): import("../../section.js").QuestionCondition;
|
|
6
|
+
export function questionHasAnswer(response: import("../../journey/journey-response.js").JourneyResponse, question: import("../../questions/question.js").Question | {
|
|
7
7
|
optionJoinString: string;
|
|
8
8
|
}, expectedValue: unknown): boolean;
|
|
9
|
-
export function questionArrayMeetsCondition(response: JourneyResponse, question: any, conditionFn?: (item: any) => boolean): boolean;
|
|
10
|
-
export function questionsHaveAnswers(response: import("
|
|
9
|
+
export function questionArrayMeetsCondition(response: import("../../journey/journey-response.js").JourneyResponse, question: any, conditionFn?: (item: any) => boolean): boolean;
|
|
10
|
+
export function questionsHaveAnswers(response: import("../../journey/journey-response.js").JourneyResponse, questionKeyTuples: QuestionKeyTuples, { logicalCombinator }?: {
|
|
11
11
|
logicalCombinator: "and" | "or";
|
|
12
12
|
}): boolean;
|
|
13
|
-
export function questionHasNonEmptyStringAnswer(response: import("
|
|
14
|
-
export function questionHasNonEmptyNumberAnswer(response: import("
|
|
13
|
+
export function questionHasNonEmptyStringAnswer(response: import("../../journey/journey-response.js").JourneyResponse, question: import("../../questions/question.js").Question): boolean;
|
|
14
|
+
export function questionHasNonEmptyNumberAnswer(response: import("../../journey/journey-response.js").JourneyResponse, question: import("../../questions/question.js").Question): boolean;
|
|
15
15
|
export type QuestionKeyTuples = [any, unknown][];
|
|
16
16
|
export type CombinationFunc = (questionKeyTuples: QuestionKeyTuples) => boolean;
|
|
17
17
|
//# sourceMappingURL=question-has-answer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question-has-answer.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/question-has-answer.js"],"names":[],"mappings":"AAOO,8CAHI,OAAO,
|
|
1
|
+
{"version":3,"file":"question-has-answer.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/question-has-answer.js"],"names":[],"mappings":"AAOO,8CAHI,OAAO,mCAAmC,EAAE,eAAe,GACzD;IAAC,GAAG,EAAE,eAAe,CAAC;IAAC,EAAE,EAAE,eAAe,CAAA;CAAC,CAOtD;AAYK,gDAJI,OAAO,6BAA6B,EAAE,QAAQ,iBAC9C,OAAO,GACL,OAAO,kBAAkB,EAAE,iBAAiB,CAIxD;AAUM,4CALI,OAAO,mCAAmC,EAAE,eAAe,YAC3D,OAAO,6BAA6B,EAAE,QAAQ,GAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAC,iBACzE,OAAO,GACL,OAAO,CAgBnB;AAUM,sDALI,OAAO,mCAAmC,EAAE,eAAe,YAC3D,GAAG,gBACH,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,GACpB,OAAO,CAWnB;AASM,+CANI,OAAO,mCAAmC,EAAE,eAAe,qBAC3D,iBAAiB,0BAEzB;IAA8B,iBAAiB,EAAvC,KAAK,GAAG,IAAI;CACpB,GAAU,OAAO,CAUnB;AAOM,0DAJI,OAAO,mCAAmC,EAAE,eAAe,YAC3D,OAAO,6BAA6B,EAAE,QAAQ,GAC5C,OAAO,CAMnB;AAOM,0DAJI,OAAO,mCAAmC,EAAE,eAAe,YAC3D,OAAO,6BAA6B,EAAE,QAAQ,GAC5C,OAAO,CAMnB;gCA5Ga,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE;8BAChB,CAAC,iBAAiB,EAAE,iBAAiB,KAAK,OAAO"}
|