@digabi/exam-engine-core 16.1.2 → 16.2.0
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/dist/__tests__/AnsweringInstructions.test.js +10 -10
- package/dist/__tests__/AnsweringInstructions.test.js.map +1 -1
- package/dist/__tests__/casSaga.test.js +19 -19
- package/dist/__tests__/casSaga.test.js.map +1 -1
- package/dist/__tests__/renderAnnotations.test.js +2 -2
- package/dist/__tests__/renderAnnotations.test.js.map +1 -1
- package/dist/__tests__/results/AnnotationList.test.js +4 -3
- package/dist/__tests__/results/AnnotationList.test.js.map +1 -1
- package/dist/__tests__/results/ResultsContext.test.js +12 -12
- package/dist/__tests__/results/ResultsContext.test.js.map +1 -1
- package/dist/__tests__/results/ResultsExamQuestionAutoScore.test.js +3 -2
- package/dist/__tests__/results/ResultsExamQuestionAutoScore.test.js.map +1 -1
- package/dist/__tests__/results/ResultsExamQuestionManualScore.test.js +4 -3
- package/dist/__tests__/results/ResultsExamQuestionManualScore.test.js.map +1 -1
- package/dist/__tests__/testExamRendering.js +8 -8
- package/dist/__tests__/testExamRendering.js.map +1 -1
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/__tests__/util.test.js +4 -4
- package/dist/__tests__/util.test.js.map +1 -1
- package/dist/__tests__/validateAnswers.test.js +64 -25
- package/dist/__tests__/validateAnswers.test.js.map +1 -1
- package/dist/components/AnswerToolbar.d.ts +7 -5
- package/dist/components/AnswerToolbar.d.ts.map +1 -1
- package/dist/components/AnswerToolbar.js +19 -6
- package/dist/components/AnswerToolbar.js.map +1 -1
- package/dist/components/AnsweringInstructions.d.ts +2 -2
- package/dist/components/AnsweringInstructions.d.ts.map +1 -1
- package/dist/components/AnsweringInstructions.js +2 -2
- package/dist/components/AnsweringInstructions.js.map +1 -1
- package/dist/components/SectionElement.d.ts.map +1 -1
- package/dist/components/SectionElement.js.map +1 -1
- package/dist/components/context/CommonExamContext.d.ts +1 -1
- package/dist/components/context/CommonExamContext.d.ts.map +1 -1
- package/dist/components/context/CommonExamContext.js +1 -1
- package/dist/components/context/CommonExamContext.js.map +1 -1
- package/dist/components/context/QuestionContext.d.ts +1 -0
- package/dist/components/context/QuestionContext.d.ts.map +1 -1
- package/dist/components/context/QuestionContext.js +8 -1
- package/dist/components/context/QuestionContext.js.map +1 -1
- package/dist/components/exam/ChoiceAnswer.d.ts.map +1 -1
- package/dist/components/exam/ChoiceAnswer.js +5 -8
- package/dist/components/exam/ChoiceAnswer.js.map +1 -1
- package/dist/components/exam/DropdownAnswer.d.ts.map +1 -1
- package/dist/components/exam/DropdownAnswer.js +2 -3
- package/dist/components/exam/DropdownAnswer.js.map +1 -1
- package/dist/components/exam/Hints.d.ts.map +1 -1
- package/dist/components/exam/Hints.js +2 -2
- package/dist/components/exam/Hints.js.map +1 -1
- package/dist/components/exam/QuestionInstruction.d.ts.map +1 -1
- package/dist/components/exam/QuestionInstruction.js +3 -1
- package/dist/components/exam/QuestionInstruction.js.map +1 -1
- package/dist/components/exam/QuestionTitle.d.ts.map +1 -1
- package/dist/components/exam/QuestionTitle.js +4 -2
- package/dist/components/exam/QuestionTitle.js.map +1 -1
- package/dist/components/exam/RichTextAnswer.d.ts +5 -2
- package/dist/components/exam/RichTextAnswer.d.ts.map +1 -1
- package/dist/components/exam/RichTextAnswer.js +2 -2
- package/dist/components/exam/RichTextAnswer.js.map +1 -1
- package/dist/components/exam/Section.d.ts.map +1 -1
- package/dist/components/exam/Section.js +11 -1
- package/dist/components/exam/Section.js.map +1 -1
- package/dist/components/exam/SectionTitle.js +3 -3
- package/dist/components/exam/SectionTitle.js.map +1 -1
- package/dist/components/exam/TextAnswer.d.ts.map +1 -1
- package/dist/components/exam/TextAnswer.js +13 -3
- package/dist/components/exam/TextAnswer.js.map +1 -1
- package/dist/components/exam/internal/ErrorIndicator.d.ts.map +1 -1
- package/dist/components/exam/internal/ErrorIndicator.js +29 -13
- package/dist/components/exam/internal/ErrorIndicator.js.map +1 -1
- package/dist/components/exam/internal/TextAnswerInput.d.ts +8 -4
- package/dist/components/exam/internal/TextAnswerInput.d.ts.map +1 -1
- package/dist/components/exam/internal/TextAnswerInput.js +23 -14
- package/dist/components/exam/internal/TextAnswerInput.js.map +1 -1
- package/dist/components/grading-instructions/AutogradedAnswer.d.ts.map +1 -1
- package/dist/components/grading-instructions/AutogradedAnswer.js +3 -0
- package/dist/components/grading-instructions/AutogradedAnswer.js.map +1 -1
- package/dist/components/grading-instructions/GradingInstructions.d.ts.map +1 -1
- package/dist/components/grading-instructions/GradingInstructions.js +3 -2
- package/dist/components/grading-instructions/GradingInstructions.js.map +1 -1
- package/dist/components/grading-instructions/SectionTitle.js +2 -2
- package/dist/components/grading-instructions/SectionTitle.js.map +1 -1
- package/dist/components/results/DropdownAnswer.d.ts.map +1 -1
- package/dist/components/results/DropdownAnswer.js +3 -3
- package/dist/components/results/DropdownAnswer.js.map +1 -1
- package/dist/components/results/QuestionTitle.js +1 -1
- package/dist/components/results/QuestionTitle.js.map +1 -1
- package/dist/components/results/TextAnswer.d.ts.map +1 -1
- package/dist/components/results/TextAnswer.js +3 -0
- package/dist/components/results/TextAnswer.js.map +1 -1
- package/dist/components/shared/AnswerLengthInfo.d.ts +7 -0
- package/dist/components/shared/AnswerLengthInfo.d.ts.map +1 -0
- package/dist/components/shared/AnswerLengthInfo.js +11 -0
- package/dist/components/shared/AnswerLengthInfo.js.map +1 -0
- package/dist/components/shared/TableOfContents.js +3 -3
- package/dist/components/shared/TableOfContents.js.map +1 -1
- package/dist/components/shared/internal/RestrictedAudioPlayer.d.ts.map +1 -1
- package/dist/components/shared/internal/RestrictedAudioPlayer.js +8 -5
- package/dist/components/shared/internal/RestrictedAudioPlayer.js.map +1 -1
- package/dist/i18n/FA.js +4 -4
- package/dist/i18n/FA.js.map +1 -1
- package/dist/i18n/fi-FI.d.ts +4 -3
- package/dist/i18n/fi-FI.d.ts.map +1 -1
- package/dist/i18n/fi-FI.js +4 -3
- package/dist/i18n/fi-FI.js.map +1 -1
- package/dist/i18n/index.d.ts +10 -3
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/sv-FI.d.ts.map +1 -1
- package/dist/i18n/sv-FI.js +4 -3
- package/dist/i18n/sv-FI.js.map +1 -1
- package/dist/ids.d.ts +2 -0
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +2 -0
- package/dist/ids.js.map +1 -1
- package/dist/main-bundle.js +20 -12
- package/dist/main.css +1 -1
- package/dist/parser/parseExamStructure.d.ts +3 -1
- package/dist/parser/parseExamStructure.d.ts.map +1 -1
- package/dist/parser/parseExamStructure.js +1 -0
- package/dist/parser/parseExamStructure.js.map +1 -1
- package/dist/store/answers/actions.d.ts +2 -2
- package/dist/store/answers/actions.d.ts.map +1 -1
- package/dist/store/answers/actions.js.map +1 -1
- package/dist/store/answers/reducer.d.ts +3 -4
- package/dist/store/answers/reducer.d.ts.map +1 -1
- package/dist/store/answers/reducer.js +3 -3
- package/dist/store/answers/reducer.js.map +1 -1
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.js +1 -1
- package/dist/store/index.js.map +1 -1
- package/dist/validateAnswers.d.ts +8 -1
- package/dist/validateAnswers.d.ts.map +1 -1
- package/dist/validateAnswers.js +35 -2
- package/dist/validateAnswers.js.map +1 -1
- package/package.json +4 -4
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Hints.js","sourceRoot":"","sources":["../../../src/components/exam/Hints.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAI7D,MAAM,KAAK,GAAgD,CAAC,EAAE,OAAO,EAAE,gBAAgB,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AA8B,CAAA;
|
1
|
+
{"version":3,"file":"QuestionInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/exam/QuestionInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAGjE,iBAAS,mBAAmB,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,kBAAkB,eAO7E;;AAED,wBAA8C"}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { questionInstructionId } from '../../ids';
|
2
3
|
function QuestionInstruction({ element, renderChildNodes }) {
|
3
|
-
|
4
|
+
const id = questionInstructionId(element);
|
5
|
+
return (React.createElement("div", { className: "exam-question-instruction e-mrg-b-2", id: id }, renderChildNodes(element)));
|
4
6
|
}
|
5
7
|
export default React.memo(QuestionInstruction);
|
6
8
|
//# sourceMappingURL=QuestionInstruction.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QuestionInstruction.js","sourceRoot":"","sources":["../../../src/components/exam/QuestionInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"QuestionInstruction.js","sourceRoot":"","sources":["../../../src/components/exam/QuestionInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AAEjD,SAAS,mBAAmB,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAsB;IAC5E,MAAM,EAAE,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAA;IACzC,OAAO,CACL,6BAAK,SAAS,EAAC,qCAAqC,EAAC,EAAE,EAAE,EAAE,IACxD,gBAAgB,CAAC,OAAO,CAAC,CACtB,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QuestionTitle.d.ts","sourceRoot":"","sources":["../../../src/components/exam/QuestionTitle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAKzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;;
|
1
|
+
{"version":3,"file":"QuestionTitle.d.ts","sourceRoot":"","sources":["../../../src/components/exam/QuestionTitle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAKzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;;AA+BjE,wBAAwC"}
|
@@ -5,11 +5,13 @@ import NotificationIcon from '../NotificationIcon';
|
|
5
5
|
import { QuestionContext } from '../context/QuestionContext';
|
6
6
|
import { Score } from '../shared/Score';
|
7
7
|
import { formatQuestionDisplayNumber } from '../../formatting';
|
8
|
+
import { questionTitleId } from '../../ids';
|
8
9
|
const QuestionTitle = ({ element, renderChildNodes }) => {
|
9
10
|
const { displayNumber, maxScore, level, maxAnswers, childQuestions } = useContext(QuestionContext);
|
10
11
|
const Tag = `h${Math.min(3 + level, 6)}`;
|
12
|
+
const id = questionTitleId(displayNumber);
|
11
13
|
return (React.createElement(React.Fragment, null,
|
12
|
-
React.createElement(Tag, { className: classNames('exam-question-title', { 'e-normal e-font-size-m': level > 0 }) },
|
14
|
+
React.createElement(Tag, { id: id, className: classNames('exam-question-title', { 'e-normal e-font-size-m': level > 0 }) },
|
13
15
|
React.createElement("strong", { className: classNames('exam-question-title__display-number', {
|
14
16
|
'exam-question-title__display-number--indented': level > 0,
|
15
17
|
}) }, formatQuestionDisplayNumber(displayNumber) + ' '),
|
@@ -18,7 +20,7 @@ const QuestionTitle = ({ element, renderChildNodes }) => {
|
|
18
20
|
React.createElement(Score, { score: maxScore, size: level === 0 ? 'large' : 'small' })),
|
19
21
|
maxAnswers != null && childQuestions.length > 0 && (React.createElement("p", { className: "e-italic" },
|
20
22
|
React.createElement(NotificationIcon, null),
|
21
|
-
React.createElement(AnsweringInstructions, { ...{ maxAnswers, childQuestions,
|
23
|
+
React.createElement(AnsweringInstructions, { ...{ maxAnswers, childQuestions, elementType: 'question' } })))));
|
22
24
|
};
|
23
25
|
export default React.memo(QuestionTitle);
|
24
26
|
//# sourceMappingURL=QuestionTitle.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QuestionTitle.js","sourceRoot":"","sources":["../../../src/components/exam/QuestionTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,qBAAqB,MAAM,0BAA0B,CAAA;AAC5D,OAAO,gBAAgB,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEvC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;
|
1
|
+
{"version":3,"file":"QuestionTitle.js","sourceRoot":"","sources":["../../../src/components/exam/QuestionTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,qBAAqB,MAAM,0BAA0B,CAAA;AAC5D,OAAO,gBAAgB,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEvC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,aAAa,GAAgD,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,EAAE;IACnG,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IAClG,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,EAA+B,CAAA;IACrE,MAAM,EAAE,GAAG,eAAe,CAAC,aAAa,CAAC,CAAA;IAEzC,OAAO,CACL;QACE,oBAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,EAAE,wBAAwB,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC;YAChG,gCACE,SAAS,EAAE,UAAU,CAAC,qCAAqC,EAAE;oBAC3D,+CAA+C,EAAE,KAAK,GAAG,CAAC;iBAC3D,CAAC,IAED,2BAA2B,CAAC,aAAa,CAAC,GAAG,GAAG,CAC1C;YACR,gBAAgB,CAAC,OAAO,CAAC;;YAAE,oBAAC,KAAK,IAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAI,CACzF;QACL,UAAU,IAAI,IAAI,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,CAClD,2BAAG,SAAS,EAAC,UAAU;YACrB,oBAAC,gBAAgB,OAAG;YACpB,oBAAC,qBAAqB,OAAK,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,GAAI,CACpF,CACL,CACA,CACJ,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA"}
|
@@ -2,7 +2,7 @@ import { TOptions } from 'i18next';
|
|
2
2
|
import React from 'react';
|
3
3
|
import { RichTextAnswer as RichTextAnswerT } from '../../types/ExamAnswer';
|
4
4
|
import { CommonExamContext } from '../context/CommonExamContext';
|
5
|
-
export interface
|
5
|
+
export interface ScreenshotError {
|
6
6
|
key: 'screenshot-too-big' | 'screenshot-byte-limit-reached' | 'screenshot-upload-failed';
|
7
7
|
options?: TOptions;
|
8
8
|
}
|
@@ -10,9 +10,12 @@ interface Props {
|
|
10
10
|
answer?: RichTextAnswerT;
|
11
11
|
className?: string;
|
12
12
|
questionId: number;
|
13
|
+
invalid: boolean;
|
13
14
|
onChange: (answerHTML: string, answerText: string) => void;
|
14
|
-
onError: (error:
|
15
|
+
onError: (error: ScreenshotError) => void;
|
15
16
|
saveScreenshot: (screenshot: Blob) => Promise<string>;
|
17
|
+
labelledBy: string;
|
18
|
+
lang?: string;
|
16
19
|
}
|
17
20
|
export default class RichTextAnswer extends React.PureComponent<Props> {
|
18
21
|
static contextType: React.Context<CommonExamContext>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RichTextAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/exam/RichTextAnswer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAEhE,MAAM,WAAW,
|
1
|
+
{"version":3,"file":"RichTextAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/exam/RichTextAnswer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAEhE,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,oBAAoB,GAAG,+BAA+B,GAAG,0BAA0B,CAAA;IACxF,OAAO,CAAC,EAAE,QAAQ,CAAA;CACnB;AAED,UAAU,KAAK;IACb,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1D,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IACzC,cAAc,EAAE,CAAC,UAAU,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IACrD,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC;IACpE,MAAM,CAAC,WAAW,mCAAoB;IAC9B,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA;IAC5D,OAAO,CAAC,GAAG,CAAiC;IAC5C,OAAO,CAAC,QAAQ,CAAQ;gBAEZ,KAAK,EAAE,KAAK;IAMxB,iBAAiB,IAAI,IAAI;IA0BzB,eAAe,QAAS,OAAO,KAAG,IAAI,CAarC;IAED,YAAY,SAAU;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,KAAG,IAAI,CAKtE;IAED,kBAAkB,IAAI,IAAI;IAS1B,MAAM,IAAI,KAAK,CAAC,SAAS;CAiB1B"}
|
@@ -53,8 +53,8 @@ export default class RichTextAnswer extends React.PureComponent {
|
|
53
53
|
}
|
54
54
|
}
|
55
55
|
render() {
|
56
|
-
const { className, questionId } = this.props;
|
57
|
-
return (React.createElement("div", { ref: this.ref, className: classNames('text-answer text-answer--multi-line', className), "data-question-id": questionId, role: "textbox", "aria-multiline": "true", tabIndex: 0 }));
|
56
|
+
const { className, questionId, invalid, lang, labelledBy } = this.props;
|
57
|
+
return (React.createElement("div", { ref: this.ref, className: classNames('text-answer text-answer--multi-line', className), "data-question-id": questionId, role: "textbox", "aria-multiline": "true", "aria-invalid": invalid, tabIndex: 0, lang: lang, "aria-labelledby": labelledBy }));
|
58
58
|
}
|
59
59
|
}
|
60
60
|
RichTextAnswer.contextType = CommonExamContext;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RichTextAnswer.js","sourceRoot":"","sources":["../../../src/components/exam/RichTextAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,cAAc,MAAM,wCAAwC,CAAA;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;
|
1
|
+
{"version":3,"file":"RichTextAnswer.js","sourceRoot":"","sources":["../../../src/components/exam/RichTextAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,cAAc,MAAM,wCAAwC,CAAA;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAmBhE,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,KAAK,CAAC,aAAoB;IAMpE,YAAY,KAAY;QACtB,KAAK,CAAC,KAAK,CAAC,CAAA;QA+Bd,oBAAe,GAAG,CAAC,GAAY,EAAQ,EAAE;YACvC,MAAM,GAAG,GAAG,CAAC,GAAG,EAAE;gBAChB,QAAQ,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,iBAAiB,CAAC,EAAE;oBACrC,KAAK,GAAG;wBACN,OAAO,+BAA+B,CAAA;oBACxC,KAAK,GAAG;wBACN,OAAO,oBAAoB,CAAA;oBA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OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;;
|
1
|
+
{"version":3,"file":"Section.d.ts","sourceRoot":"","sources":["../../../src/components/exam/Section.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;;AAsFjE,wBAAsD"}
|
@@ -7,12 +7,22 @@ import { ExamContext } from '../context/ExamContext';
|
|
7
7
|
import ProgressBar from './internal/ProgressBar';
|
8
8
|
import SectionElement from '../SectionElement';
|
9
9
|
import { SectionContext, withSectionContext } from '../context/SectionContext';
|
10
|
+
import { CommonExamContext } from '../context/CommonExamContext';
|
11
|
+
import * as _ from 'lodash-es';
|
12
|
+
function LastSectionNote() {
|
13
|
+
const { t } = useExamTranslation();
|
14
|
+
return (React.createElement("p", null,
|
15
|
+
React.createElement("em", null, t('end-of-exam'))));
|
16
|
+
}
|
10
17
|
function Section({ element, renderChildNodes }) {
|
11
18
|
const casState = useSelector((state) => state.cas, shallowEqual);
|
12
19
|
const { casForbidden, displayNumber } = useContext(SectionContext);
|
20
|
+
const { sections } = useContext(CommonExamContext);
|
21
|
+
const lastSection = element === _.last(sections);
|
13
22
|
return (React.createElement(SectionElement, { className: "exam-section", "aria-labelledby": sectionTitleId(displayNumber) },
|
14
23
|
renderChildNodes(element),
|
15
|
-
casForbidden && React.createElement(CasControls, { ...casState })
|
24
|
+
casForbidden && React.createElement(CasControls, { ...casState }),
|
25
|
+
lastSection && React.createElement(LastSectionNote, null)));
|
16
26
|
}
|
17
27
|
function CasControls(props) {
|
18
28
|
const dispatch = useDispatch();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Section.js","sourceRoot":"","sources":["../../../src/components/exam/Section.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAA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BAA0B,CAAC,CACvB,CACL,CACP,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,CACnC,6BACE,SAAS,EAAC,eAAe,EACzB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,oBAAoB,KAAK,KAAK,CAAC,iBAAiB,IAAI,CAAC,CAAC,cAAc,EAAE;QAE/F,4BAAI,SAAS,EAAC,kBAAkB,GAAG;QACnC,2BAAG,EAAE,EAAC,qCAAqC,IAAE,CAAC,CAAC,uBAAuB,CAAC,CAAK;QAC5E,oBAAC,WAAW,IACV,SAAS,EAAC,WAAW,EACrB,QAAQ,EAAE,oBAAoB,EAC9B,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,GAC1C;QACF,gCACE,SAAS,EAAC,UAAU,EACpB,EAAE,EAAC,qBAAqB,EACxB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,EAC5C,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,oBAAoB,KAAK,KAAK,CAAC,iBAAiB,IAAI,CAAC,CAAC,KAAK,EAAE,sBACrE,qCAAqC,IAErD,CAAC,CAAC,qBAAqB,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,iBAAiB,EAAE,CAAC,CACtD,CACL,CACP,CAAC,CAAC,CAAC,CACF,6BAAK,SAAS,EAAC,oCAAoC,IAAE,CAAC,CAAC,sBAAsB,CAAC,CAAO,CACtF,CACG,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAA"}
|
@@ -6,17 +6,17 @@ import { CommonExamContext } from '../context/CommonExamContext';
|
|
6
6
|
import NotificationIcon from '../NotificationIcon';
|
7
7
|
import { SectionContext } from '../context/SectionContext';
|
8
8
|
function SectionTitle({ element, renderChildNodes }) {
|
9
|
-
const {
|
9
|
+
const { sections } = useContext(CommonExamContext);
|
10
10
|
const { displayNumber, minAnswers, maxAnswers, childQuestions } = useContext(SectionContext);
|
11
11
|
const { t } = useExamTranslation();
|
12
12
|
return (React.createElement(React.Fragment, null,
|
13
13
|
element.hasChildNodes() && (React.createElement("h2", { className: "exam-section-title", id: sectionTitleId(displayNumber) },
|
14
|
-
|
14
|
+
sections.length > 1 && t('section', { displayNumber }),
|
15
15
|
" ",
|
16
16
|
renderChildNodes(element))),
|
17
17
|
maxAnswers != null && (React.createElement("span", { className: "notification notification--inline" },
|
18
18
|
React.createElement(NotificationIcon, null),
|
19
|
-
React.createElement(AnsweringInstructions, { ...{ maxAnswers, minAnswers, childQuestions,
|
19
|
+
React.createElement(AnsweringInstructions, { ...{ maxAnswers, minAnswers, childQuestions, elementType: 'section' } })))));
|
20
20
|
}
|
21
21
|
export default React.memo(SectionTitle);
|
22
22
|
//# sourceMappingURL=SectionTitle.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SectionTitle.js","sourceRoot":"","sources":["../../../src/components/exam/SectionTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,qBAAqB,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,gBAAgB,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE1D,SAAS,YAAY,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAsB;IACrE,MAAM,EAAE,
|
1
|
+
{"version":3,"file":"SectionTitle.js","sourceRoot":"","sources":["../../../src/components/exam/SectionTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,KA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Root":"","sources":["../../../src/components/exam/TextAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"TextAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/exam/TextAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAMjE,iBAAS,UAAU,CAAC,KAAK,EAAE,kBAAkB,eAsB5C;;AAED,wBAAqC"}
|
@@ -1,13 +1,23 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { findChildElement } from '../../dom-utils';
|
1
|
+
import React, { useContext } from 'react';
|
2
|
+
import { findChildElement, getBooleanAttribute } from '../../dom-utils';
|
3
3
|
import { shortDisplayNumber } from '../../shortDisplayNumber';
|
4
4
|
import TextAnswerInput from './internal/TextAnswerInput';
|
5
5
|
import { ScreenReaderOnly } from '../ScreenReaderOnly';
|
6
|
+
import { QuestionContext } from '../context/QuestionContext';
|
7
|
+
import { answerLengthInfoId } from '../../ids';
|
8
|
+
import { CommonExamContext } from '../context/CommonExamContext';
|
6
9
|
function TextAnswer(props) {
|
7
10
|
const { element, renderChildNodes } = props;
|
11
|
+
const { language } = useContext(CommonExamContext);
|
12
|
+
const { questionLabelIds } = useContext(QuestionContext);
|
8
13
|
const displayNumber = element.getAttribute('display-number');
|
9
14
|
const hint = findChildElement(element, 'hint');
|
10
|
-
const
|
15
|
+
const useLanguageOfInstruction = getBooleanAttribute(element, 'use-language-of-instruction');
|
16
|
+
const lang = useLanguageOfInstruction ? language : undefined;
|
17
|
+
const labelledBy = element.hasAttribute('max-length')
|
18
|
+
? questionLabelIds + ' ' + answerLengthInfoId(element)
|
19
|
+
: questionLabelIds;
|
20
|
+
const textAnswer = React.createElement(TextAnswerInput, { ...{ ...props, lang, labelledBy } });
|
11
21
|
return hint ? (React.createElement("label", { className: "e-nowrap" },
|
12
22
|
React.createElement("sup", { className: "e-text-answer-display-number e-color-darkgrey" }, shortDisplayNumber(displayNumber)),
|
13
23
|
React.createElement(ScreenReaderOnly, null, renderChildNodes(hint)),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextAnswer.js","sourceRoot":"","sources":["../../../src/components/exam/TextAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"TextAnswer.js","sourceRoot":"","sources":["../../../src/components/exam/TextAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,eAAe,MAAM,4BAA4B,CAAA;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAEhE,SAAS,UAAU,CAAC,KAAyB;IAC3C,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAA;IAC3C,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAClD,MAAM,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IACxD,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAE,CAAA;IAC7D,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC9C,MAAM,wBAAwB,GAAG,mBAAmB,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAA;IAC5F,MAAM,IAAI,GAAG,wBAAwB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAA;IAC5D,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC;QACnD,CAAC,CAAC,gBAAgB,GAAG,GAAG,GAAG,kBAAkB,CAAC,OAAO,CAAC;QACtD,CAAC,CAAC,gBAAgB,CAAA;IACpB,MAAM,UAAU,GAAG,oBAAC,eAAe,OAAK,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,GAAI,CAAA;IAE1E,OAAO,IAAI,CAAC,CAAC,CAAC,CACZ,+BAAO,SAAS,EAAC,UAAU;QACzB,6BAAK,SAAS,EAAC,+CAA+C,IAAE,kBAAkB,CAAC,aAAa,CAAC,CAAO;QACxG,oBAAC,gBAAgB,QAAE,gBAAgB,CAAC,IAAI,CAAC,CAAoB;QAC5D,UAAU,CACL,CACT,CAAC,CAAC,CAAC,CACF,UAAU,CACX,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/exam/internal/ErrorIndicator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAA;;
|
1
|
+
{"version":3,"file":"ErrorIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/exam/internal/ErrorIndicator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAA;;AA8EzC,wBAAyC"}
|
@@ -6,28 +6,44 @@ import { findChildElement } from '../../../dom-utils';
|
|
6
6
|
import { useExamTranslation } from '../../../i18n';
|
7
7
|
import AnsweringInstructions from '../../AnsweringInstructions';
|
8
8
|
import { CommonExamContext } from '../../context/CommonExamContext';
|
9
|
-
const
|
10
|
-
const
|
9
|
+
const ExtraAnswerError = (props) => {
|
10
|
+
const { t } = useExamTranslation();
|
11
|
+
const { displayNumber, elementType } = props;
|
12
|
+
return (React.createElement("div", null,
|
13
|
+
elementType !== 'exam' && elementType !== 'toc-section'
|
14
|
+
? t(elementType, { displayNumber }) || React.createElement(FallbackTitle, { ...props })
|
15
|
+
: '',
|
16
|
+
' ',
|
17
|
+
React.createElement(AnsweringInstructions, { ...props })));
|
18
|
+
};
|
19
|
+
const AnswerTooLongError = ({ displayNumber, characterCount }) => {
|
11
20
|
const { t } = useExamTranslation();
|
12
|
-
return
|
21
|
+
return (React.createElement("div", null,
|
22
|
+
t('question', { displayNumber }),
|
23
|
+
" ",
|
24
|
+
t('answer-errors.answer-too-long', { count: characterCount })));
|
25
|
+
};
|
26
|
+
const ErrorIndicator = () => {
|
27
|
+
const validationErrors = useSelector((state) => state.answers.validationErrors);
|
28
|
+
return validationErrors.length > 0 ? (React.createElement("div", { className: "error-indicator e-columns e-columns--inline e-bg-color-error e-color-off-white e-font-size-xs e-pad-1 e-mrg-r-1", role: "alert" },
|
13
29
|
React.createElement("div", { className: "e-column e-column--narrow" },
|
14
30
|
React.createElement(FontAwesomeIcon, { size: "lg", icon: faExclamationTriangle, fixedWidth: true, className: "e-mrg-r-1" })),
|
15
|
-
React.createElement("div", { className: "e-column e-column--gapless" },
|
16
|
-
const
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
31
|
+
React.createElement("div", { className: "e-column e-column--gapless" }, validationErrors.map((validationError) => {
|
32
|
+
const key = validationError.type + validationError.displayNumber;
|
33
|
+
switch (validationError.type) {
|
34
|
+
case 'ExtraAnswer':
|
35
|
+
return React.createElement(ExtraAnswerError, { ...{ ...validationError, key } });
|
36
|
+
default:
|
37
|
+
return React.createElement(AnswerTooLongError, { ...{ ...validationError, key } });
|
38
|
+
}
|
23
39
|
})))) : null;
|
24
40
|
};
|
25
|
-
const FallbackTitle = ({
|
41
|
+
const FallbackTitle = ({ elementType, displayNumber }) => {
|
26
42
|
// Hack. M/N exams have set the section translation title to an empty string,
|
27
43
|
// so they can hide the "Osa 1:" text within the exam. In these cases, display
|
28
44
|
// the text content of the corresponding <e:section-title> instead. Hopefully
|
29
45
|
// we can delete this code on some day. 💩
|
30
|
-
if (
|
46
|
+
if (elementType === 'section') {
|
31
47
|
const { root } = useContext(CommonExamContext);
|
32
48
|
const section = findChildElement(root, (e) => e.localName === 'section' && e.getAttribute('display-number') === displayNumber);
|
33
49
|
if (section) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorIndicator.js","sourceRoot":"","sources":["../../../../src/components/exam/internal/ErrorIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAGlD,OAAO,qBAAqB,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAEnE,MAAM,
|
1
|
+
{"version":3,"file":"ErrorIndicator.js","sourceRoot":"","sources":["../../../../src/components/exam/internal/ErrorIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAGlD,OAAO,qBAAqB,MAAM,6BA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 @@ import React from 'react';
|
|
2
2
|
import { ExamComponentProps } from '../../../createRenderChildNodes';
|
3
3
|
import * as actions from '../../../store/answers/actions';
|
4
4
|
import { RichTextAnswer as RichTextAnswerT, TextAnswer as TextAnswerT } from '../../../types/ExamAnswer';
|
5
|
-
import {
|
5
|
+
import { ScreenshotError } from '../RichTextAnswer';
|
6
|
+
import { AnswerTooLong } from '../../../validateAnswers';
|
6
7
|
interface Props extends ExamComponentProps {
|
7
8
|
answer?: TextAnswerT | RichTextAnswerT;
|
8
9
|
answerBlurred: typeof actions.answerBlurred;
|
@@ -12,9 +13,12 @@ interface Props extends ExamComponentProps {
|
|
12
13
|
showAnswerHistory: boolean;
|
13
14
|
supportsAnswerHistory: boolean;
|
14
15
|
type: 'rich-text' | 'multi-line' | 'single-line';
|
16
|
+
validationError?: AnswerTooLong;
|
17
|
+
labelledBy: string;
|
18
|
+
lang?: string;
|
15
19
|
}
|
16
20
|
interface State {
|
17
|
-
|
21
|
+
screenshotError?: ScreenshotError;
|
18
22
|
}
|
19
23
|
export declare class TextAnswerInput extends React.PureComponent<Props, State> {
|
20
24
|
private ref;
|
@@ -25,12 +29,12 @@ export declare class TextAnswerInput extends React.PureComponent<Props, State> {
|
|
25
29
|
onRichTextChange: (answerHtml: string, answerText: string) => void;
|
26
30
|
onFocus: () => void;
|
27
31
|
onBlur: () => void;
|
28
|
-
onError: (
|
32
|
+
onError: (screenshotError: ScreenshotError) => void;
|
29
33
|
clearErrors: () => void;
|
30
34
|
resize(): void;
|
31
35
|
render(): React.ReactNode;
|
32
36
|
}
|
33
37
|
export declare function getCharacterCount(answerText: string): number;
|
34
|
-
declare const _default: import("react-redux").ConnectedComponent<typeof TextAnswerInput, import("react-redux").Omit<React.ClassAttributes<TextAnswerInput> & Props, "type" | "saveAnswer" | "selectAnswerVersion" | "answerFocused" | "answerBlurred" | "supportsAnswerHistory" | "answer" | "showAnswerHistory"> & ExamComponentProps>;
|
38
|
+
declare const _default: import("react-redux").ConnectedComponent<typeof TextAnswerInput, import("react-redux").Omit<React.ClassAttributes<TextAnswerInput> & Props, "type" | "saveAnswer" | "selectAnswerVersion" | "answerFocused" | "answerBlurred" | "supportsAnswerHistory" | "answer" | "validationError" | "showAnswerHistory"> & ExamComponentProps>;
|
35
39
|
export default _default;
|
36
40
|
//# sourceMappingURL=TextAnswerInput.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextAnswerInput.d.ts","sourceRoot":"","sources":["../../../../src/components/exam/internal/TextAnswerInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAGpE,OAAO,KAAK,OAAO,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAIxG,OAAuB,EAAE,
|
1
|
+
{"version":3,"file":"TextAnswerInput.d.ts","sourceRoot":"","sources":["../../../../src/components/exam/internal/TextAnswerInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAGpE,OAAO,KAAK,OAAO,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAIxG,OAAuB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAGnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAGxD,UAAU,KAAM,SAAQ,kBAAkB;IACxC,MAAM,CAAC,EAAE,WAAW,GAAG,eAAe,CAAA;IACtC,aAAa,EAAE,OAAO,OAAO,CAAC,aAAa,CAAA;IAC3C,aAAa,EAAE,OAAO,OAAO,CAAC,aAAa,CAAA;IAC3C,UAAU,EAAE,OAAO,OAAO,CAAC,UAAU,CAAA;IACrC,mBAAmB,EAAE,OAAO,OAAO,CAAC,mBAAmB,CAAA;IACvD,iBAAiB,EAAE,OAAO,CAAA;IAC1B,qBAAqB,EAAE,OAAO,CAAA;IAC9B,IAAI,EAAE,WAAW,GAAG,YAAY,GAAG,aAAa,CAAA;IAChD,eAAe,CAAC,EAAE,aAAa,CAAA;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAKD,UAAU,KAAK;IACb,eAAe,CAAC,EAAE,eAAe,CAAA;CAClC;AAED,qBAAa,eAAgB,SAAQ,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC;IACpE,OAAO,CAAC,GAAG,CAAyD;gBAExD,KAAK,EAAE,KAAK;IAMxB,iBAAiB,IAAI,IAAI;IAIzB,kBAAkB,IAAI,IAAI;IAI1B,QAAQ,UAAW,MAAM,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,KAAG,IAAI,CAclF;IAED,gBAAgB,eAAgB,MAAM,cAAc,MAAM,KAAG,IAAI,CAahE;IAED,OAAO,QAAO,IAAI,CAEjB;IAED,MAAM,QAAO,IAAI,CAEhB;IAED,OAAO,oBAAqB,eAAe,KAAG,IAAI,CAIjD;IAED,WAAW,QAAO,IAAI,CAErB;IAED,MAAM,IAAI,IAAI;IAgBd,MAAM,IAAI,KAAK,CAAC,SAAS;CA2G1B;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE5D;;AAsBD,wBAKmB"}
|
@@ -1,14 +1,15 @@
|
|
1
1
|
import classNames from 'classnames';
|
2
2
|
import React from 'react';
|
3
3
|
import { connect } from 'react-redux';
|
4
|
-
import { getNumericAttribute } from '../../../dom-utils';
|
4
|
+
import { getAttribute, getNumericAttribute } from '../../../dom-utils';
|
5
5
|
import * as actions from '../../../store/answers/actions';
|
6
6
|
import AnswerToolbar from '../../AnswerToolbar';
|
7
7
|
import { ExamContext } from '../../context/ExamContext';
|
8
8
|
import { QuestionContext } from '../../context/QuestionContext';
|
9
9
|
import RichTextAnswer from '../RichTextAnswer';
|
10
10
|
import { Score } from '../../shared/Score';
|
11
|
-
import { answerScoreId } from '../../../ids';
|
11
|
+
import { answerLengthInfoId, answerScoreId } from '../../../ids';
|
12
|
+
import AnswerLengthInfo from '../../shared/AnswerLengthInfo';
|
12
13
|
const borderWidthPx = 2;
|
13
14
|
const borderHeightPx = 1;
|
14
15
|
export class TextAnswerInput extends React.PureComponent {
|
@@ -49,18 +50,16 @@ export class TextAnswerInput extends React.PureComponent {
|
|
49
50
|
this.onBlur = () => {
|
50
51
|
this.props.answerBlurred(getNumericAttribute(this.props.element, 'question-id'));
|
51
52
|
};
|
52
|
-
this.onError = (
|
53
|
+
this.onError = (screenshotError) => {
|
53
54
|
this.setState({
|
54
|
-
|
55
|
+
screenshotError,
|
55
56
|
});
|
56
57
|
};
|
57
58
|
this.clearErrors = () => {
|
58
|
-
this.setState({
|
59
|
+
this.setState({ screenshotError: undefined });
|
59
60
|
};
|
61
|
+
this.state = {};
|
60
62
|
this.ref = React.createRef();
|
61
|
-
this.state = {
|
62
|
-
error: null,
|
63
|
-
};
|
64
63
|
}
|
65
64
|
componentDidMount() {
|
66
65
|
this.resize();
|
@@ -84,38 +83,45 @@ export class TextAnswerInput extends React.PureComponent {
|
|
84
83
|
}
|
85
84
|
}
|
86
85
|
render() {
|
87
|
-
const { answer, className, element, selectAnswerVersion, showAnswerHistory, supportsAnswerHistory, type } = this.props;
|
88
|
-
const {
|
86
|
+
const { answer, className, element, selectAnswerVersion, showAnswerHistory, supportsAnswerHistory, type, validationError, labelledBy, lang, } = this.props;
|
87
|
+
const { screenshotError } = this.state;
|
89
88
|
const questionId = getNumericAttribute(element, 'question-id');
|
90
89
|
const maxScore = getNumericAttribute(element, 'max-score');
|
91
90
|
const value = answer && answer.value;
|
92
91
|
const scoreId = answerScoreId(element);
|
92
|
+
const maxLength = getNumericAttribute(element, 'max-length');
|
93
|
+
const invalid = validationError != null;
|
93
94
|
switch (type) {
|
94
95
|
case 'rich-text':
|
95
96
|
return (React.createElement(React.Fragment, null,
|
96
|
-
|
97
|
+
maxLength != null && React.createElement(AnswerLengthInfo, { ...{ maxLength, id: answerLengthInfoId(element) } }),
|
98
|
+
React.createElement(ExamContext.Consumer, null, ({ examServerApi }) => (React.createElement(RichTextAnswer, { answer: answer, className: classNames('text-answer text-answer--rich-text', className), saveScreenshot: (data) => examServerApi.saveScreenshot(questionId, data), onChange: this.onRichTextChange, onError: this.onError, questionId: questionId, lang: lang, invalid: invalid, labelledBy: labelledBy }))),
|
97
99
|
React.createElement(AnswerToolbar, { ...{
|
98
100
|
answer,
|
99
101
|
element,
|
100
102
|
selectAnswerVersion,
|
101
103
|
showAnswerHistory,
|
102
104
|
supportsAnswerHistory,
|
103
|
-
|
105
|
+
screenshotError,
|
106
|
+
validationError,
|
104
107
|
} })));
|
105
108
|
case 'multi-line':
|
106
109
|
return (React.createElement(React.Fragment, null,
|
107
|
-
React.createElement(
|
110
|
+
maxLength != null && React.createElement(AnswerLengthInfo, { ...{ maxLength } }),
|
111
|
+
React.createElement("textarea", { className: classNames('text-answer text-answer--multi-line', className), defaultValue: value, onChange: this.onChange, onFocus: this.onFocus, onBlur: this.onBlur, ref: this.ref, "data-question-id": questionId, lang: lang, "aria-invalid": invalid, "aria-labelledby": labelledBy }),
|
108
112
|
React.createElement(AnswerToolbar, { ...{
|
109
113
|
answer,
|
110
114
|
element,
|
111
115
|
selectAnswerVersion,
|
112
116
|
showAnswerHistory,
|
113
117
|
supportsAnswerHistory,
|
118
|
+
screenshotError,
|
119
|
+
validationError,
|
114
120
|
} })));
|
115
121
|
case 'single-line':
|
116
122
|
default:
|
117
123
|
return (React.createElement("span", { className: "e-nowrap" },
|
118
|
-
React.createElement("input", { type: "text", className: classNames('text-answer text-answer--single-line', className), defaultValue: value, onChange: this.onChange, onFocus: this.onFocus, onBlur: this.onBlur, ref: this.ref, "data-question-id": questionId, "aria-describedby": scoreId }),
|
124
|
+
React.createElement("input", { type: "text", className: classNames('text-answer text-answer--single-line', className), defaultValue: value, onChange: this.onChange, onFocus: this.onFocus, onBlur: this.onBlur, ref: this.ref, "data-question-id": questionId, lang: lang, "aria-describedby": scoreId, "aria-labelledby": labelledBy }),
|
119
125
|
React.createElement(QuestionContext.Consumer, null, ({ answers }) => answers.length > 1 && React.createElement(Score, { score: maxScore, size: "inline", id: scoreId }))));
|
120
126
|
}
|
121
127
|
}
|
@@ -126,14 +132,17 @@ export function getCharacterCount(answerText) {
|
|
126
132
|
function mapStateToProps(state, { element }) {
|
127
133
|
const type = (element.getAttribute('type') || 'single-line');
|
128
134
|
const questionId = getNumericAttribute(element, 'question-id');
|
135
|
+
const displayNumber = getAttribute(element, 'display-number');
|
129
136
|
const answer = state.answers.answersById[questionId];
|
130
137
|
const supportsAnswerHistory = state.answers.supportsAnswerHistory;
|
131
138
|
const showAnswerHistory = state.answers.supportsAnswerHistory && state.answers.serverQuestionIds.has(questionId);
|
139
|
+
const validationError = state.answers.validationErrors.find((error) => error.type === 'AnswerTooLong' && error.displayNumber === displayNumber);
|
132
140
|
return {
|
133
141
|
answer,
|
134
142
|
showAnswerHistory,
|
135
143
|
supportsAnswerHistory,
|
136
144
|
type,
|
145
|
+
validationError,
|
137
146
|
};
|
138
147
|
}
|
139
148
|
export default connect(mapStateToProps, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextAnswerInput.js","sourceRoot":"","sources":["../../../../src/components/exam/internal/TextAnswerInput.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;
|
1
|
+
{"version":3,"file":"TextAnswerInput.js","sourceRoot":"","sources":["../../../../src/components/exam/internal/TextAnswerInput.ts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IAAI,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,aAAa,CAA+C,CAAA;IAC1G,MAAM,UAAU,GAAG,mBAAmB,CAAC,OAAO,EAAE,aAAa,CAAE,CAAA;IAC/D,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;IAC7D,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,CAA8C,CAAA;IACjG,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,CAAC,qBAAqB,CAAA;IACjE,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,qBAAqB,IAAI,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IAChH,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CACzD,CAAC,KAAK,EAA0B,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,eAAe,IAAI,KAAK,CAAC,aAAa,KAAK,aAAa,CAC3G,CAAA;IAED,OAAO;QACL,MAAM;QACN,iBAAiB;QACjB,qBAAqB;QACrB,IAAI;QACJ,eAAe;KAChB,CAAA;AACH,CAAC;AAED,eAAe,OAAO,CAAC,eAAe,EAAE;IACtC,UAAU,EAAE,OAAO,CAAC,UAAU;IAC9B,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;IAChD,aAAa,EAAE,OAAO,CAAC,aAAa;IACpC,aAAa,EAAE,OAAO,CAAC,aAAa;CACrC,CAAC,CAAC,eAAe,CAAC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AutogradedAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/AutogradedAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;
|
1
|
+
{"version":3,"file":"AutogradedAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/AutogradedAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAOjE,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA+BlD,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
@@ -3,10 +3,13 @@ import { QuestionContext } from '../context/QuestionContext';
|
|
3
3
|
import { findChildElement, getAttribute, getNumericAttribute } from '../../dom-utils';
|
4
4
|
import { Score } from '../shared/Score';
|
5
5
|
import AnswerGradingInstruction from './AnswerGradingInstruction';
|
6
|
+
import AnswerLengthInfo from '../shared/AnswerLengthInfo';
|
6
7
|
const AutogradedAnswer = ({ element, renderChildNodes }) => {
|
7
8
|
const { answers } = useContext(QuestionContext);
|
8
9
|
const gradingInstructions = findChildElement(element, 'answer-grading-instruction');
|
10
|
+
const maxLength = getNumericAttribute(element, 'max-length');
|
9
11
|
const content = (React.createElement(React.Fragment, null,
|
12
|
+
maxLength != null && React.createElement(AnswerLengthInfo, { ...{ maxLength } }),
|
10
13
|
gradingInstructions && React.createElement(AnswerGradingInstruction, { ...{ element: gradingInstructions, renderChildNodes } }),
|
11
14
|
React.createElement("ul", null, renderChildNodes(element))));
|
12
15
|
if (answers.length === 1) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AutogradedAnswer.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/AutogradedAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,i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AAE,WAAW,CAAE,CAAA;QAE3D,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAE9C,OAAO,CACL,6BAAK,SAAS,EAAC,WAAW;YACxB,2BAAG,SAAS,EAAC,qBAAqB;gBAChC,8BAAM,SAAS,EAAC,0DAA0D;oBAAE,aAAa;wBAAS;gBACjG,IAAI,IAAI,gBAAgB,CAAC,IAAI,CAAC;;gBAAE,oBAAC,KAAK,IAAC,KAAK,EAAE,QAAQ,GAAI,CACzD;YACH,OAAO,CACJ,CACP,CAAA;KACF;AACH,CAAC,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"GradingInstructions.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstructions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;
|
1
|
+
{"version":3,"file":"GradingInstructions.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstructions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AA+G9C,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC,iBAGhD,CAAA;;AAED,wBAAqE"}
|
@@ -35,11 +35,12 @@ const renderIfWithinGradingInstructionContent = renderIf(({ element }) => queryA
|
|
35
35
|
'hint',
|
36
36
|
'question-title',
|
37
37
|
]) != null);
|
38
|
+
const renderIfNotWithinExternalMaterial = renderIf(({ element }) => queryAncestors(element, ['external-material']) == null);
|
38
39
|
const renderChildNodes = createRenderChildNodes({
|
39
40
|
'accepted-answer': AutogradedAnswerOption,
|
40
41
|
attachment: RenderExamElements,
|
41
|
-
'attachment-link': mkAttachmentLink('plain'),
|
42
|
-
'attachment-links': mkAttachmentLinks('plain'),
|
42
|
+
'attachment-link': renderIfNotWithinExternalMaterial(mkAttachmentLink('plain')),
|
43
|
+
'attachment-links': renderIfNotWithinExternalMaterial(mkAttachmentLinks('plain')),
|
43
44
|
audio: Recording,
|
44
45
|
'audio-group': RenderExamElements,
|
45
46
|
'choice-answer': AutogradedAnswer,
|