@digabi/exam-engine-core 19.19.0 → 20.0.0-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/components/AttachmentContext.d.ts +14 -0
- package/dist/components/AttachmentContext.d.ts.map +1 -0
- package/dist/components/AttachmentContext.js +12 -0
- package/dist/components/AttachmentContext.js.map +1 -0
- package/dist/components/AttachmentLink.d.ts +6 -0
- package/dist/components/AttachmentLink.d.ts.map +1 -0
- package/dist/components/AttachmentLink.js +24 -0
- package/dist/components/AttachmentLink.js.map +1 -0
- package/dist/components/AttachmentLinkAnchor.d.ts +7 -0
- package/dist/components/AttachmentLinkAnchor.d.ts.map +1 -0
- package/dist/components/AttachmentLinkAnchor.js +4 -0
- package/dist/components/AttachmentLinkAnchor.js.map +1 -0
- package/dist/components/AttachmentLinks.d.ts +6 -0
- package/dist/components/AttachmentLinks.d.ts.map +1 -0
- package/dist/components/AttachmentLinks.js +58 -0
- package/dist/components/AttachmentLinks.js.map +1 -0
- package/dist/components/Attachments.d.ts +5 -0
- package/dist/components/Attachments.d.ts.map +1 -0
- package/dist/components/Attachments.js +43 -0
- package/dist/components/Attachments.js.map +1 -0
- package/dist/components/AttachmentsAttachment.d.ts +5 -0
- package/dist/components/AttachmentsAttachment.d.ts.map +1 -0
- package/dist/components/AttachmentsAttachment.js +8 -0
- package/dist/components/AttachmentsAttachment.js.map +1 -0
- package/dist/components/AttachmentsAttachmentTitle.d.ts +6 -0
- package/dist/components/AttachmentsAttachmentTitle.d.ts.map +1 -0
- package/dist/components/AttachmentsAttachmentTitle.js +12 -0
- package/dist/components/AttachmentsAttachmentTitle.js.map +1 -0
- package/dist/components/AttachmentsExternalMaterial.d.ts +9 -0
- package/dist/components/AttachmentsExternalMaterial.d.ts.map +1 -0
- package/dist/components/AttachmentsExternalMaterial.js +40 -0
- package/dist/components/AttachmentsExternalMaterial.js.map +1 -0
- package/dist/components/AttachmentsQuestion.d.ts +5 -0
- package/dist/components/AttachmentsQuestion.d.ts.map +1 -0
- package/dist/components/AttachmentsQuestion.js +16 -0
- package/dist/components/AttachmentsQuestion.js.map +1 -0
- package/dist/components/AttachmentsQuestionTitle.d.ts +6 -0
- package/dist/components/AttachmentsQuestionTitle.d.ts.map +1 -0
- package/dist/components/AttachmentsQuestionTitle.js +13 -0
- package/dist/components/AttachmentsQuestionTitle.js.map +1 -0
- package/dist/components/Audio.d.ts +6 -0
- package/dist/components/Audio.d.ts.map +1 -0
- package/dist/components/Audio.js +29 -0
- package/dist/components/Audio.js.map +1 -0
- package/dist/components/AudioGroup.d.ts +6 -0
- package/dist/components/AudioGroup.d.ts.map +1 -0
- package/dist/components/AudioGroup.js +9 -0
- package/dist/components/AudioGroup.js.map +1 -0
- package/dist/components/AudioPlaybackError.d.ts +7 -0
- package/dist/components/AudioPlaybackError.d.ts.map +1 -0
- package/dist/components/AudioPlaybackError.js +12 -0
- package/dist/components/AudioPlaybackError.js.map +1 -0
- package/dist/components/AudioTest.d.ts +6 -0
- package/dist/components/AudioTest.d.ts.map +1 -0
- package/dist/components/AudioTest.js +29 -0
- package/dist/components/AudioTest.js.map +1 -0
- package/dist/components/ChoiceAnswer.d.ts +12 -0
- package/dist/components/ChoiceAnswer.d.ts.map +1 -0
- package/dist/components/ChoiceAnswer.js +60 -0
- package/dist/components/ChoiceAnswer.js.map +1 -0
- package/dist/components/CommonExamContext.d.ts +16 -0
- package/dist/components/CommonExamContext.d.ts.map +1 -0
- package/dist/components/CommonExamContext.js +22 -0
- package/dist/components/CommonExamContext.js.map +1 -0
- package/dist/components/DropdownAnswer.d.ts +12 -0
- package/dist/components/DropdownAnswer.d.ts.map +1 -0
- package/dist/components/DropdownAnswer.js +85 -0
- package/dist/components/DropdownAnswer.js.map +1 -0
- package/dist/components/Exam.d.ts +40 -0
- package/dist/components/Exam.d.ts.map +1 -0
- package/dist/components/Exam.js +106 -0
- package/dist/components/Exam.js.map +1 -0
- package/dist/components/ExamAttachment.d.ts +5 -0
- package/dist/components/ExamAttachment.d.ts.map +1 -0
- package/dist/components/ExamAttachment.js +8 -0
- package/dist/components/ExamAttachment.js.map +1 -0
- package/dist/components/ExamContext.d.ts +10 -0
- package/dist/components/ExamContext.d.ts.map +1 -0
- package/dist/components/ExamContext.js +11 -0
- package/dist/components/ExamContext.js.map +1 -0
- package/dist/components/ExamFooter.d.ts +6 -0
- package/dist/components/ExamFooter.d.ts.map +1 -0
- package/dist/components/ExamFooter.js +7 -0
- package/dist/components/ExamFooter.js.map +1 -0
- package/dist/components/ExamInstruction.d.ts +6 -0
- package/dist/components/ExamInstruction.d.ts.map +1 -0
- package/dist/components/ExamInstruction.js +6 -0
- package/dist/components/ExamInstruction.js.map +1 -0
- package/dist/components/ExamQuestion.d.ts +5 -0
- package/dist/components/ExamQuestion.d.ts.map +1 -0
- package/dist/components/ExamQuestion.js +16 -0
- package/dist/components/ExamQuestion.js.map +1 -0
- package/dist/components/ExamQuestionInstruction.d.ts +6 -0
- package/dist/components/ExamQuestionInstruction.d.ts.map +1 -0
- package/dist/components/ExamQuestionInstruction.js +6 -0
- package/dist/components/ExamQuestionInstruction.js.map +1 -0
- package/dist/components/ExamQuestionTitle.d.ts +6 -0
- package/dist/components/ExamQuestionTitle.d.ts.map +1 -0
- package/dist/components/ExamQuestionTitle.js +25 -0
- package/dist/components/ExamQuestionTitle.js.map +1 -0
- package/dist/components/ExamSection.d.ts +5 -0
- package/dist/components/ExamSection.d.ts.map +1 -0
- package/dist/components/ExamSection.js +30 -0
- package/dist/components/ExamSection.js.map +1 -0
- package/dist/components/ExamSectionTitle.d.ts +6 -0
- package/dist/components/ExamSectionTitle.d.ts.map +1 -0
- package/dist/components/ExamSectionTitle.js +21 -0
- package/dist/components/ExamSectionTitle.js.map +1 -0
- package/dist/components/ExternalMaterialList.d.ts +10 -0
- package/dist/components/ExternalMaterialList.d.ts.map +1 -0
- package/dist/components/ExternalMaterialList.js +31 -0
- package/dist/components/ExternalMaterialList.js.map +1 -0
- package/dist/components/File.d.ts +6 -0
- package/dist/components/File.d.ts.map +1 -0
- package/dist/components/File.js +15 -0
- package/dist/components/File.js.map +1 -0
- package/dist/components/Formula.d.ts +6 -0
- package/dist/components/Formula.d.ts.map +1 -0
- package/dist/components/Formula.js +12 -0
- package/dist/components/Formula.js.map +1 -0
- package/dist/components/Hints.d.ts +6 -0
- package/dist/components/Hints.d.ts.map +1 -0
- package/dist/components/Hints.js +32 -0
- package/dist/components/Hints.js.map +1 -0
- package/dist/components/Image.d.ts +6 -0
- package/dist/components/Image.d.ts.map +1 -0
- package/dist/components/Image.js +25 -0
- package/dist/components/Image.js.map +1 -0
- package/dist/components/ImageOverlay.d.ts +6 -0
- package/dist/components/ImageOverlay.d.ts.map +1 -0
- package/dist/components/ImageOverlay.js +45 -0
- package/dist/components/ImageOverlay.js.map +1 -0
- package/dist/components/ProgressBar.d.ts +6 -0
- package/dist/components/ProgressBar.d.ts.map +1 -0
- package/dist/components/ProgressBar.js +18 -0
- package/dist/components/ProgressBar.js.map +1 -0
- package/dist/components/QuestionContext.d.ts +14 -0
- package/dist/components/QuestionContext.d.ts.map +1 -0
- package/dist/components/QuestionContext.js +20 -0
- package/dist/components/QuestionContext.js.map +1 -0
- package/dist/components/Reference.d.ts +6 -0
- package/dist/components/Reference.d.ts.map +1 -0
- package/dist/components/Reference.js +63 -0
- package/dist/components/Reference.js.map +1 -0
- package/dist/components/References.d.ts +6 -0
- package/dist/components/References.d.ts.map +1 -0
- package/dist/components/References.js +23 -0
- package/dist/components/References.js.map +1 -0
- package/dist/components/ResponsiveMediaContainer.d.ts +17 -0
- package/dist/components/ResponsiveMediaContainer.d.ts.map +1 -0
- package/dist/components/ResponsiveMediaContainer.js +20 -0
- package/dist/components/ResponsiveMediaContainer.js.map +1 -0
- package/dist/components/RestrictedAudioPlayer.d.ts +11 -0
- package/dist/components/RestrictedAudioPlayer.d.ts.map +1 -0
- package/dist/components/RestrictedAudioPlayer.js +29 -0
- package/dist/components/RestrictedAudioPlayer.js.map +1 -0
- package/dist/components/RichTextAnswer.d.ts +31 -0
- package/dist/components/RichTextAnswer.d.ts.map +1 -0
- package/dist/components/RichTextAnswer.js +70 -0
- package/dist/components/RichTextAnswer.js.map +1 -0
- package/dist/components/SaveIndicator.d.ts +5 -0
- package/dist/components/SaveIndicator.d.ts.map +1 -0
- package/dist/components/SaveIndicator.js +15 -0
- package/dist/components/SaveIndicator.js.map +1 -0
- package/dist/components/Score.d.ts +6 -0
- package/dist/components/Score.d.ts.map +1 -0
- package/dist/components/Score.js +13 -0
- package/dist/components/Score.js.map +1 -0
- package/dist/components/Section.d.ts +3 -0
- package/dist/components/Section.d.ts.map +1 -0
- package/dist/components/Section.js +7 -0
- package/dist/components/Section.js.map +1 -0
- package/dist/components/SectionContext.d.ts +13 -0
- package/dist/components/SectionContext.d.ts.map +1 -0
- package/dist/components/SectionContext.js +21 -0
- package/dist/components/SectionContext.js.map +1 -0
- package/dist/components/SectionInstruction.d.ts +6 -0
- package/dist/components/SectionInstruction.d.ts.map +1 -0
- package/dist/components/SectionInstruction.js +6 -0
- package/dist/components/SectionInstruction.js.map +1 -0
- package/dist/components/TableOfContents.d.ts +13 -0
- package/dist/components/TableOfContents.d.ts.map +1 -0
- package/dist/components/TableOfContents.js +66 -0
- package/dist/components/TableOfContents.js.map +1 -0
- package/dist/components/TextAnswer.d.ts +6 -0
- package/dist/components/TextAnswer.d.ts.map +1 -0
- package/dist/components/TextAnswer.js +16 -0
- package/dist/components/TextAnswer.js.map +1 -0
- package/dist/components/TextAnswerInput.d.ts +37 -0
- package/dist/components/TextAnswerInput.d.ts.map +1 -0
- package/dist/components/TextAnswerInput.js +145 -0
- package/dist/components/TextAnswerInput.js.map +1 -0
- package/dist/components/Video.d.ts +6 -0
- package/dist/components/Video.d.ts.map +1 -0
- package/dist/components/Video.js +15 -0
- package/dist/components/Video.js.map +1 -0
- package/dist/components/exam/ExamineExam.d.ts +5 -0
- package/dist/components/exam/ExamineExam.d.ts.map +1 -0
- package/dist/components/exam/ExamineExam.js +20 -0
- package/dist/components/exam/ExamineExam.js.map +1 -0
- package/dist/components/exam/FinishExam.d.ts +5 -0
- package/dist/components/exam/FinishExam.d.ts.map +1 -0
- package/dist/components/exam/FinishExam.js +17 -0
- package/dist/components/exam/FinishExam.js.map +1 -0
- package/dist/components/results/AnnotationList.d.ts +5 -0
- package/dist/components/results/AnnotationList.d.ts.map +1 -0
- package/dist/components/results/AnnotationList.js +40 -0
- package/dist/components/results/AnnotationList.js.map +1 -0
- package/dist/components/results/ResultsChoiceAnswer.d.ts +6 -0
- package/dist/components/results/ResultsChoiceAnswer.d.ts.map +1 -0
- package/dist/components/results/ResultsChoiceAnswer.js +60 -0
- package/dist/components/results/ResultsChoiceAnswer.js.map +1 -0
- package/dist/components/results/ResultsContext.d.ts +20 -0
- package/dist/components/results/ResultsContext.d.ts.map +1 -0
- package/dist/components/results/ResultsContext.js +68 -0
- package/dist/components/results/ResultsContext.js.map +1 -0
- package/dist/components/results/ResultsDropdownAnswer.d.ts +6 -0
- package/dist/components/results/ResultsDropdownAnswer.d.ts.map +1 -0
- package/dist/components/results/ResultsDropdownAnswer.js +41 -0
- package/dist/components/results/ResultsDropdownAnswer.js.map +1 -0
- package/dist/components/results/ResultsExamQuestion.d.ts +5 -0
- package/dist/components/results/ResultsExamQuestion.d.ts.map +1 -0
- package/dist/components/results/ResultsExamQuestion.js +23 -0
- package/dist/components/results/ResultsExamQuestion.js.map +1 -0
- package/dist/components/results/ResultsExamQuestionAutoScore.d.ts +10 -0
- package/dist/components/results/ResultsExamQuestionAutoScore.d.ts.map +1 -0
- package/dist/components/results/ResultsExamQuestionAutoScore.js +16 -0
- package/dist/components/results/ResultsExamQuestionAutoScore.js.map +1 -0
- package/dist/components/results/ResultsExamQuestionManualScore.d.ts +11 -0
- package/dist/components/results/ResultsExamQuestionManualScore.d.ts.map +1 -0
- package/dist/components/results/ResultsExamQuestionManualScore.js +62 -0
- package/dist/components/results/ResultsExamQuestionManualScore.js.map +1 -0
- package/dist/components/results/ResultsExamQuestionScoresContainer.d.ts +9 -0
- package/dist/components/results/ResultsExamQuestionScoresContainer.d.ts.map +1 -0
- package/dist/components/results/ResultsExamQuestionScoresContainer.js +8 -0
- package/dist/components/results/ResultsExamQuestionScoresContainer.js.map +1 -0
- package/dist/components/results/ResultsExamQuestionTitle.d.ts +6 -0
- package/dist/components/results/ResultsExamQuestionTitle.d.ts.map +1 -0
- package/dist/components/results/ResultsExamQuestionTitle.js +22 -0
- package/dist/components/results/ResultsExamQuestionTitle.js.map +1 -0
- package/dist/components/results/ResultsExamSection.d.ts +5 -0
- package/dist/components/results/ResultsExamSection.d.ts.map +1 -0
- package/dist/components/results/ResultsExamSection.js +17 -0
- package/dist/components/results/ResultsExamSection.js.map +1 -0
- package/dist/components/results/ResultsScoredTextAnswer.d.ts +6 -0
- package/dist/components/results/ResultsScoredTextAnswer.d.ts.map +1 -0
- package/dist/components/results/ResultsScoredTextAnswer.js +22 -0
- package/dist/components/results/ResultsScoredTextAnswer.js.map +1 -0
- package/dist/components/results/ResultsSingleLineAnswer.d.ts +12 -0
- package/dist/components/results/ResultsSingleLineAnswer.d.ts.map +1 -0
- package/dist/components/results/ResultsSingleLineAnswer.js +12 -0
- package/dist/components/results/ResultsSingleLineAnswer.js.map +1 -0
- package/dist/components/results/ResultsTextAnswer.d.ts +6 -0
- package/dist/components/results/ResultsTextAnswer.d.ts.map +1 -0
- package/dist/components/results/ResultsTextAnswer.js +51 -0
- package/dist/components/results/ResultsTextAnswer.js.map +1 -0
- package/dist/components/results/helpers.d.ts +9 -0
- package/dist/components/results/helpers.d.ts.map +1 -0
- package/dist/components/results/helpers.js +10 -0
- package/dist/components/results/helpers.js.map +1 -0
- package/dist/components/results/isExamFinishPageHook.d.ts +2 -0
- package/dist/components/results/isExamFinishPageHook.d.ts.map +1 -0
- package/dist/components/results/isExamFinishPageHook.js +7 -0
- package/dist/components/results/isExamFinishPageHook.js.map +1 -0
- package/dist/components/types.d.ts +110 -0
- package/dist/components/types.d.ts.map +1 -0
- package/dist/components/types.js +1 -0
- package/dist/components/types.js.map +1 -0
- package/dist/components/withContext.d.ts +3 -0
- package/dist/components/withContext.d.ts.map +1 -0
- package/dist/components/withContext.js +12 -0
- package/dist/components/withContext.js.map +1 -0
- package/dist/main-bundle.js +1 -1
- package/dist/store/answers/sagas.d.ts.map +1 -1
- package/dist/store/answers/sagas.js +6 -0
- package/dist/store/answers/sagas.js.map +1 -1
- package/dist/types/ExamServerAPI.d.ts +2 -0
- package/dist/types/ExamServerAPI.d.ts.map +1 -1
- package/package.json +3 -3
@@ -0,0 +1,145 @@
|
|
1
|
+
import classNames from 'classnames';
|
2
|
+
import React from 'react';
|
3
|
+
import { connect } from 'react-redux';
|
4
|
+
import { getNumericAttribute } from '../dom-utils';
|
5
|
+
import * as actions from '../store/answers/actions';
|
6
|
+
import AnswerToolbar from './AnswerToolbar';
|
7
|
+
import { ExamContext } from './ExamContext';
|
8
|
+
import { QuestionContext } from './QuestionContext';
|
9
|
+
import RichTextAnswer from './RichTextAnswer';
|
10
|
+
import { Score } from './Score';
|
11
|
+
const borderWidthPx = 2;
|
12
|
+
const borderHeightPx = 1;
|
13
|
+
export class TextAnswerInput extends React.PureComponent {
|
14
|
+
constructor(props) {
|
15
|
+
super(props);
|
16
|
+
this.onChange = (event) => {
|
17
|
+
const { element, saveAnswer } = this.props;
|
18
|
+
const questionId = getNumericAttribute(element, 'question-id');
|
19
|
+
const displayNumber = element.getAttribute('display-number');
|
20
|
+
const value = event.currentTarget.value.trim();
|
21
|
+
const answer = {
|
22
|
+
type: 'text',
|
23
|
+
questionId,
|
24
|
+
value,
|
25
|
+
characterCount: getCharacterCount(value),
|
26
|
+
displayNumber,
|
27
|
+
};
|
28
|
+
saveAnswer(answer);
|
29
|
+
this.clearErrors();
|
30
|
+
};
|
31
|
+
this.onRichTextChange = (answerHtml, answerText) => {
|
32
|
+
const { element, saveAnswer } = this.props;
|
33
|
+
const questionId = getNumericAttribute(element, 'question-id');
|
34
|
+
const displayNumber = element.getAttribute('display-number');
|
35
|
+
const answer = {
|
36
|
+
type: 'richText',
|
37
|
+
questionId,
|
38
|
+
value: answerHtml,
|
39
|
+
characterCount: getCharacterCount(answerText),
|
40
|
+
displayNumber,
|
41
|
+
};
|
42
|
+
saveAnswer(answer);
|
43
|
+
this.clearErrors();
|
44
|
+
};
|
45
|
+
this.onFocus = () => {
|
46
|
+
this.props.answerFocused(getNumericAttribute(this.props.element, 'question-id'));
|
47
|
+
};
|
48
|
+
this.onBlur = () => {
|
49
|
+
this.props.answerBlurred(getNumericAttribute(this.props.element, 'question-id'));
|
50
|
+
};
|
51
|
+
this.onError = (error) => {
|
52
|
+
this.setState({
|
53
|
+
error,
|
54
|
+
});
|
55
|
+
};
|
56
|
+
this.clearErrors = () => {
|
57
|
+
this.setState({ error: null });
|
58
|
+
};
|
59
|
+
this.ref = React.createRef();
|
60
|
+
this.state = {
|
61
|
+
error: null,
|
62
|
+
};
|
63
|
+
}
|
64
|
+
componentDidMount() {
|
65
|
+
this.resize();
|
66
|
+
}
|
67
|
+
componentDidUpdate() {
|
68
|
+
this.resize();
|
69
|
+
}
|
70
|
+
resize() {
|
71
|
+
const { current } = this.ref;
|
72
|
+
if (current) {
|
73
|
+
if (this.props.type === 'multi-line') {
|
74
|
+
const { scrollX, scrollY } = window;
|
75
|
+
current.style.height = 'auto';
|
76
|
+
current.style.height = current.scrollHeight + borderHeightPx + 'px';
|
77
|
+
window.scrollTo(scrollX, scrollY);
|
78
|
+
}
|
79
|
+
else if (this.props.type === 'single-line') {
|
80
|
+
current.style.width = '0';
|
81
|
+
current.style.width = current.scrollWidth + borderWidthPx + 'px';
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
render() {
|
86
|
+
const { answer, className, element, maxImages, selectAnswerVersion, showAnswerHistory, supportsAnswerHistory, type, } = this.props;
|
87
|
+
const { error } = this.state;
|
88
|
+
const questionId = getNumericAttribute(element, 'question-id');
|
89
|
+
const maxScore = getNumericAttribute(element, 'max-score');
|
90
|
+
const value = answer && answer.value;
|
91
|
+
switch (type) {
|
92
|
+
case 'rich-text':
|
93
|
+
return (React.createElement(React.Fragment, null,
|
94
|
+
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, maxImages: maxImages, questionId: questionId }))),
|
95
|
+
React.createElement(AnswerToolbar, Object.assign({}, {
|
96
|
+
answer,
|
97
|
+
element,
|
98
|
+
selectAnswerVersion,
|
99
|
+
showAnswerHistory,
|
100
|
+
supportsAnswerHistory,
|
101
|
+
error,
|
102
|
+
}))));
|
103
|
+
case 'multi-line':
|
104
|
+
return (React.createElement(React.Fragment, null,
|
105
|
+
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 }),
|
106
|
+
React.createElement(AnswerToolbar, Object.assign({}, {
|
107
|
+
answer,
|
108
|
+
element,
|
109
|
+
selectAnswerVersion,
|
110
|
+
showAnswerHistory,
|
111
|
+
supportsAnswerHistory,
|
112
|
+
}))));
|
113
|
+
case 'single-line':
|
114
|
+
default:
|
115
|
+
return (React.createElement("span", { className: "e-nowrap" },
|
116
|
+
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 }),
|
117
|
+
React.createElement(QuestionContext.Consumer, null, ({ answers }) => answers.length > 1 && React.createElement(Score, { score: maxScore, size: "inline" }))));
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
export function getCharacterCount(answerText) {
|
122
|
+
return answerText.replace(/\s/g, '').length;
|
123
|
+
}
|
124
|
+
function mapStateToProps(state, { element }) {
|
125
|
+
const type = (element.getAttribute('type') || 'single-line');
|
126
|
+
const questionId = getNumericAttribute(element, 'question-id');
|
127
|
+
const answer = state.answers.answersById[questionId];
|
128
|
+
const supportsAnswerHistory = state.answers.supportsAnswerHistory;
|
129
|
+
const showAnswerHistory = state.answers.supportsAnswerHistory && state.answers.serverQuestionIds.has(questionId);
|
130
|
+
const maxImages = getNumericAttribute(element, 'max-images');
|
131
|
+
return {
|
132
|
+
answer,
|
133
|
+
showAnswerHistory,
|
134
|
+
supportsAnswerHistory,
|
135
|
+
type,
|
136
|
+
maxImages: maxImages !== undefined ? maxImages : 50,
|
137
|
+
};
|
138
|
+
}
|
139
|
+
export default connect(mapStateToProps, {
|
140
|
+
saveAnswer: actions.saveAnswer,
|
141
|
+
selectAnswerVersion: actions.selectAnswerVersion,
|
142
|
+
answerFocused: actions.answerFocused,
|
143
|
+
answerBlurred: actions.answerBlurred,
|
144
|
+
})(TextAnswerInput);
|
145
|
+
//# sourceMappingURL=TextAnswerInput.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TextAnswerInput.js","sourceRoot":"","sources":["../../src/components/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,cAAc,CAAA;AAElD,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AAEnD,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,cAA+B,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAc/B,MAAM,aAAa,GAAG,CAAC,CAAA;AACvB,MAAM,cAAc,GAAG,CAAC,CAAA;AAM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AC,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,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,SAAS,GAAG,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;IAE5D,OAAO;QACL,MAAM;QACN,iBAAiB;QACjB,qBAAqB;QACrB,IAAI;QACJ,SAAS,EAAE,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;KACpD,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"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ExamComponentProps } from '../createRenderChildNodes';
|
3
|
+
declare function Video({ element, className }: ExamComponentProps): JSX.Element;
|
4
|
+
declare const _default: React.MemoExoticComponent<typeof Video>;
|
5
|
+
export default _default;
|
6
|
+
//# sourceMappingURL=Video.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Video.d.ts","sourceRoot":"","sources":["../../src/components/Video.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,iBAAS,KAAK,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,kBAAkB,eAaxD;;AAED,wBAAgC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React, { useContext } from 'react';
|
2
|
+
import { getNumericAttribute } from '../dom-utils';
|
3
|
+
import { CommonExamContext } from './CommonExamContext';
|
4
|
+
import ResponsiveMediaContainer from './ResponsiveMediaContainer';
|
5
|
+
function Video({ element, className }) {
|
6
|
+
const src = element.getAttribute('src');
|
7
|
+
const width = getNumericAttribute(element, 'width');
|
8
|
+
const height = getNumericAttribute(element, 'height');
|
9
|
+
const { resolveAttachment } = useContext(CommonExamContext);
|
10
|
+
return (React.createElement(ResponsiveMediaContainer, Object.assign({}, { className, width, height }),
|
11
|
+
React.createElement("video", { className: "video", preload: "metadata", controls: true },
|
12
|
+
React.createElement("source", { src: resolveAttachment(src) }))));
|
13
|
+
}
|
14
|
+
export default React.memo(Video);
|
15
|
+
//# sourceMappingURL=Video.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Video.js","sourceRoot":"","sources":["../../src/components/Video.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,wBAAwB,MAAM,4BAA4B,CAAA;AAGjE,SAAS,KAAK,CAAC,EAAE,OAAO,EAAE,SAAS,EAAsB;IACvD,MAAM,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAE,CAAA;IACxC,MAAM,KAAK,GAAG,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAE,CAAA;IACpD,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAE,CAAA;IACtD,MAAM,EAAE,iBAAiB,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAE3D,OAAO,CACL,oBAAC,wBAAwB,oBAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE;QACxD,+BAAO,SAAS,EAAC,OAAO,EAAC,OAAO,EAAC,UAAU,EAAC,QAAQ;YAClD,gCAAQ,GAAG,EAAE,iBAAiB,CAAC,GAAG,CAAC,GAAI,CACjC,CACiB,CAC5B,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ExamineExam.d.ts","sourceRoot":"","sources":["../../../src/components/exam/ExamineExam.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAKzC,iBAAS,WAAW,sBA4BnB;;AAED,wBAAsC"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import React, { useContext } from 'react';
|
2
|
+
import { useExamTranslation } from '../../i18n';
|
3
|
+
import { ExamContext } from '../context/ExamContext';
|
4
|
+
function ExamineExam() {
|
5
|
+
const { examServerApi } = useContext(ExamContext);
|
6
|
+
const { examineExam } = examServerApi;
|
7
|
+
const { t } = useExamTranslation();
|
8
|
+
const goToInspectAnswers = () => {
|
9
|
+
if (!examineExam) {
|
10
|
+
return;
|
11
|
+
}
|
12
|
+
examineExam();
|
13
|
+
window.scrollTo(0, 0);
|
14
|
+
};
|
15
|
+
return (React.createElement("div", { className: "e-examine-exam" },
|
16
|
+
React.createElement("button", { className: "e-button", id: "examineExam", onClick: goToInspectAnswers, "aria-describedby": "examineExamInstructions" }, t('examine-exam.examine')),
|
17
|
+
React.createElement("div", { className: "e-examine-exam-instructions", id: "examineExamInstructions" }, t('examine-exam.instructions'))));
|
18
|
+
}
|
19
|
+
export default React.memo(ExamineExam);
|
20
|
+
//# sourceMappingURL=ExamineExam.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ExamineExam.js","sourceRoot":"","sources":["../../../src/components/exam/ExamineExam.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAGpD,SAAS,WAAW;IAClB,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IACjD,MAAM,EAAE,WAAW,EAAE,GAAkB,aAAa,CAAA;IACpD,MAAM,EAAE,CAAC,EAAE,GAAG,kBAAkB,EAAE,CAAA;IAElC,MAAM,kBAAkB,GAAG,GAAG,EAAE;QAC9B,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAM;QACR,CAAC;QACD,WAAW,EAAE,CAAA;QACb,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACvB,CAAC,CAAA;IAED,OAAO,CACL,6BAAK,SAAS,EAAC,gBAAgB;QAC7B,gCACE,SAAS,EAAC,UAAU,EACpB,EAAE,EAAC,aAAa,EAChB,OAAO,EAAE,kBAAkB,sBACV,yBAAyB,IAEzC,CAAC,CAAC,sBAAsB,CAAC,CACnB;QACT,6BAAK,SAAS,EAAC,6BAA6B,EAAC,EAAE,EAAC,yBAAyB,IACtE,CAAC,CAAC,2BAA2B,CAAC,CAC3B,CACF,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FinishExam.d.ts","sourceRoot":"","sources":["../../../src/components/exam/FinishExam.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,iBAAS,UAAU,sBAoBlB;;AAED,wBAAqC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import React, { useContext } from 'react';
|
2
|
+
import { useExamTranslation } from '../../i18n';
|
3
|
+
import { ExamContext } from '../context/ExamContext';
|
4
|
+
function FinishExam() {
|
5
|
+
const { examServerApi } = useContext(ExamContext);
|
6
|
+
const { finishExam } = examServerApi;
|
7
|
+
const { t } = useExamTranslation();
|
8
|
+
const goToInspectAnswers = () => {
|
9
|
+
finishExam();
|
10
|
+
window.scrollTo(0, 0);
|
11
|
+
};
|
12
|
+
return (React.createElement("div", { className: "e-finish-exam" },
|
13
|
+
React.createElement("button", { id: "finishExam", onClick: goToInspectAnswers, "aria-describedby": "finishExamInstructions" }, t('finish-exam.finish')),
|
14
|
+
React.createElement("div", { className: "e-finish-exam-instructions", id: "finishExamInstructions" }, t('finish-exam.instructions'))));
|
15
|
+
}
|
16
|
+
export default React.memo(FinishExam);
|
17
|
+
//# sourceMappingURL=FinishExam.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FinishExam.js","sourceRoot":"","sources":["../../../src/components/exam/FinishExam.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,SAAS,UAAU;IACjB,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IACjD,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAA;IACpC,MAAM,EAAE,CAAC,EAAE,GAAG,kBAAkB,EAAE,CAAA;IAElC,MAAM,kBAAkB,GAAG,GAAG,EAAE;QAC9B,UAAU,EAAE,CAAA;QACZ,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACvB,CAAC,CAAA;IAED,OAAO,CACL,6BAAK,SAAS,EAAC,eAAe;QAC5B,gCAAQ,EAAE,EAAC,YAAY,EAAC,OAAO,EAAE,kBAAkB,sBAAmB,wBAAwB,IAC3F,CAAC,CAAC,oBAAoB,CAAC,CACjB;QACT,6BAAK,SAAS,EAAC,4BAA4B,EAAC,EAAE,EAAC,wBAAwB,IACpE,CAAC,CAAC,0BAA0B,CAAC,CAC1B,CACF,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AnnotationList.d.ts","sourceRoot":"","sources":["../../../src/components/results/AnnotationList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;AA0CzC,iBAAS,qBAAqB,uBAoD7B;;AAED,wBAAgD"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import * as _ from 'lodash-es';
|
2
|
+
import React, { useContext } from 'react';
|
3
|
+
import { useTranslation } from 'react-i18next';
|
4
|
+
import { getNumericAttribute } from '../../dom-utils';
|
5
|
+
import { shortDisplayNumber } from '../../shortDisplayNumber';
|
6
|
+
import { mapMaybe } from '../../utils';
|
7
|
+
import { QuestionContext } from '../QuestionContext';
|
8
|
+
import { findScore, ResultsContext } from './ResultsContext';
|
9
|
+
const hasAnnotations = (score) => { var _a, _b, _c, _d; return Boolean(((_b = (_a = score === null || score === void 0 ? void 0 : score.pregrading) === null || _a === void 0 ? void 0 : _a.annotations) === null || _b === void 0 ? void 0 : _b.length) || ((_d = (_c = score === null || score === void 0 ? void 0 : score.censoring) === null || _c === void 0 ? void 0 : _c.annotations) === null || _d === void 0 ? void 0 : _d.length)); };
|
10
|
+
const getPrefix = (answers, answer) => answers.length > 1 ? shortDisplayNumber(answer.getAttribute('display-number')) : '';
|
11
|
+
const AnnotationListComponent = ({ i18nTitleKey, annotations }) => {
|
12
|
+
const { t } = useTranslation();
|
13
|
+
return annotations ? (React.createElement(React.Fragment, null,
|
14
|
+
i18nTitleKey && React.createElement("h5", null, t(i18nTitleKey)),
|
15
|
+
React.createElement("ol", { className: "e-list-data e-pad-l-0 e-font-size-s" }, annotations.map(({ numbering, message }) => (React.createElement("li", { "data-list-number": numbering, key: numbering }, message)))))) : null;
|
16
|
+
};
|
17
|
+
function ResultsAnnotationList() {
|
18
|
+
const { answers } = useContext(QuestionContext);
|
19
|
+
const { scores, singleGrading } = useContext(ResultsContext);
|
20
|
+
const answersAndScores = mapMaybe(answers, (answer) => {
|
21
|
+
const questionId = getNumericAttribute(answer, 'question-id');
|
22
|
+
const score = findScore(scores, questionId);
|
23
|
+
return score && answer && hasAnnotations(score) ? [answer, score] : undefined;
|
24
|
+
});
|
25
|
+
const getListOfAnnotations = (answerElementAndScores, annotationsFrom, listNumberOffset = 0) => _.flatMap(answerElementAndScores, ([answer, score]) => { var _a, _b, _c; return (_c = (_b = (_a = score[annotationsFrom]) === null || _a === void 0 ? void 0 : _a.annotations) === null || _b === void 0 ? void 0 : _b.filter((a) => a.message.length).map((annotation, i) => {
|
26
|
+
const numbering = getPrefix(answers, answer) + String(listNumberOffset + i + 1) + ')';
|
27
|
+
const message = annotation.message;
|
28
|
+
return { numbering, message };
|
29
|
+
})) !== null && _c !== void 0 ? _c : []; });
|
30
|
+
const pregradingAnnotations = getListOfAnnotations(answersAndScores, 'pregrading');
|
31
|
+
const censoringAnnotations = getListOfAnnotations(answersAndScores, 'censoring', pregradingAnnotations.length);
|
32
|
+
return pregradingAnnotations.length || censoringAnnotations.length ? (React.createElement("div", { className: "e-annotation-list e-columns e-mrg-t-2" }, singleGrading ? (React.createElement("div", { className: "e-column e-column--10" },
|
33
|
+
React.createElement(AnnotationListComponent, { annotations: pregradingAnnotations }))) : (React.createElement(React.Fragment, null,
|
34
|
+
React.createElement("div", { className: "e-column e-column--6" },
|
35
|
+
React.createElement(AnnotationListComponent, { i18nTitleKey: 'grading.pregrading-annotations', annotations: pregradingAnnotations })),
|
36
|
+
React.createElement("div", { className: "e-column e-column--6" },
|
37
|
+
React.createElement(AnnotationListComponent, { i18nTitleKey: 'grading.censor-annotations', annotations: censoringAnnotations })))))) : null;
|
38
|
+
}
|
39
|
+
export default React.memo(ResultsAnnotationList);
|
40
|
+
//# sourceMappingURL=AnnotationList.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AnnotationList.js","sourceRoot":"","sources":["../../../src/components/results/AnnotationList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAa5D,MAAM,cAAc,GAAG,CAAC,KAAY,EAAE,EAAE,uBACtC,OAAA,OAAO,CAAC,aAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,WAAW,0CAAE,MAAM,kBAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,0CAAE,WAAW,0CAAE,MAAM,CAAA,CAAC,CAAA,EAAA,CAAA;AAE1F,MAAM,SAAS,GAAG,CAAC,OAAkB,EAAE,MAAe,EAAE,EAAE,CACxD,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AAEtF,MAAM,uBAAuB,GAAG,CAAC,EAAE,YAAY,EAAE,WAAW,EAAuB,EAAE,EAAE;IACrF,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;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C,UAAsB,EAAE,CAAS,EAAE,EAAE;QACzC,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,gBAAgB,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAA;QACrF,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAA;QAClC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAA;IAC/B,CAAC,oCAAK,EAAE,GAAA,CACb,CAAA;IAEH,MAAM,qBAAqB,GAAG,oBAAoB,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAA;IAClF,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,gBAAgB,EAAE,WAAW,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAA;IAE9G,OAAO,qBAAqB,CAAC,MAAM,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CACnE,6BAAK,SAAS,EAAC,uCAAuC,IACnD,aAAa,CAAC,CAAC,CAAC,CACf,6BAAK,SAAS,EAAC,uBAAuB;QACpC,oBAAC,uBAAuB,IAAC,WAAW,EAAE,qBAAqB,GAAI,CAC3D,CACP,CAAC,CAAC,CAAC,CACF;QACE,6BAAK,SAAS,EAAC,sBAAsB;YACnC,oBAAC,uBAAuB,IACtB,YAAY,EAAE,gCAAgC,EAC9C,WAAW,EAAE,qBAAqB,GAClC,CACE;QACN,6BAAK,SAAS,EAAC,sBAAsB;YACnC,oBAAC,uBAAuB,IAAC,YAAY,EAAE,4BAA4B,EAAE,WAAW,EAAE,oBAAoB,GAAI,CACtG,CACL,CACJ,CACG,CACP,CAAC,CAAC,CAAC,IAAI,CAAA;AACV,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ExamComponentProps } from '../../createRenderChildNodes';
|
3
|
+
declare function ResultsChoiceAnswer({ element }: ExamComponentProps): JSX.Element;
|
4
|
+
declare const _default: React.MemoExoticComponent<typeof ResultsChoiceAnswer>;
|
5
|
+
export default _default;
|
6
|
+
//# sourceMappingURL=ResultsChoiceAnswer.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ResultsChoiceAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/results/ResultsChoiceAnswer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAA0B,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAmEzF,iBAAS,mBAAmB,CAAC,EAAE,OAAO,EAAE,EAAE,kBAAkB,eAyC3D;;AAED,wBAA8C"}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import classNames from 'classnames';
|
2
|
+
import React, { useContext } from 'react';
|
3
|
+
import { createRenderChildNodes } from '../../createRenderChildNodes';
|
4
|
+
import { getNumericAttribute, mapChildElements, query } from '../../dom-utils';
|
5
|
+
import ExamAttachment from '../ExamAttachment';
|
6
|
+
import Image from '../Image';
|
7
|
+
import { findMultiChoiceFromGradingStructure, ResultsContext } from './ResultsContext';
|
8
|
+
import ResultsExamQuestionAutoScore from './ResultsExamQuestionAutoScore';
|
9
|
+
const renderChildNodes = createRenderChildNodes({
|
10
|
+
attachment: ExamAttachment,
|
11
|
+
image: Image,
|
12
|
+
});
|
13
|
+
function ChoiceAnswerOption({ selected, element, questionId, direction, isCorrect }) {
|
14
|
+
const className = element.getAttribute('class');
|
15
|
+
const optionId = element.getAttribute('option-id');
|
16
|
+
const content = (React.createElement("div", { className: classNames('e-choice-answer-option e-column', className, {
|
17
|
+
'e-choice-answer-option--selected': selected,
|
18
|
+
}) }, renderChildNodes(element)));
|
19
|
+
const RadioInput = ({ narrow = false }) => (React.createElement("input", { type: "radio", className: classNames('e-radio-button', { 'e-column e-column--narrow': narrow }), name: String(questionId), value: optionId, checked: selected, readOnly: true }));
|
20
|
+
return direction === 'vertical' ? (React.createElement("div", { className: "e-mrg-b-1" },
|
21
|
+
React.createElement("label", { className: classNames('e-columns', {
|
22
|
+
'e-correct-answer-left': isCorrect,
|
23
|
+
'e-columns--inline': query(element, ['image', 'video']) == null /* Force full width for options containing responsive media */,
|
24
|
+
}) },
|
25
|
+
React.createElement(RadioInput, { narrow: true }),
|
26
|
+
content))) : (React.createElement("div", { className: "e-column e-mrg-b-1" },
|
27
|
+
React.createElement("label", { className: classNames('e-block e-text-center', { 'e-correct-answer-bottom': isCorrect }) },
|
28
|
+
React.createElement(RadioInput, null),
|
29
|
+
content)));
|
30
|
+
}
|
31
|
+
function ResultsChoiceAnswer({ element }) {
|
32
|
+
const { answersByQuestionId, gradingStructure } = useContext(ResultsContext);
|
33
|
+
const questionId = getNumericAttribute(element, 'question-id');
|
34
|
+
const answer = answersByQuestionId[questionId];
|
35
|
+
const direction = element.getAttribute('direction') || 'vertical';
|
36
|
+
const className = element.getAttribute('class');
|
37
|
+
const choice = findMultiChoiceFromGradingStructure(gradingStructure, questionId);
|
38
|
+
const scoreValue = answer && choice.options.find((option) => option.id === Number(answer.value)).score;
|
39
|
+
const maxScore = getNumericAttribute(element, 'max-score');
|
40
|
+
return (React.createElement(React.Fragment, null,
|
41
|
+
scoreValue !== undefined && React.createElement(ResultsExamQuestionAutoScore, { score: scoreValue, maxScore: maxScore }),
|
42
|
+
React.createElement("div", { className: classNames('e-choice-answer', className, {
|
43
|
+
'e-columns': direction === 'horizontal',
|
44
|
+
}) }, mapChildElements(element, (childElement) => {
|
45
|
+
const optionId = getNumericAttribute(childElement, 'option-id');
|
46
|
+
const selected = answer != null && Number(answer.value) === optionId;
|
47
|
+
const grading = choice.options.find((option) => option.id === optionId);
|
48
|
+
return (React.createElement(ChoiceAnswerOption, Object.assign({}, {
|
49
|
+
element: childElement,
|
50
|
+
renderChildNodes,
|
51
|
+
questionId,
|
52
|
+
key: optionId,
|
53
|
+
direction,
|
54
|
+
selected,
|
55
|
+
isCorrect: grading.correct,
|
56
|
+
})));
|
57
|
+
}))));
|
58
|
+
}
|
59
|
+
export default React.memo(ResultsChoiceAnswer);
|
60
|
+
//# sourceMappingURL=ResultsChoiceAnswer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ResultsChoiceAnswer.js","sourceRoot":"","sources":["../../../src/components/results/ResultsChoiceAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,sBAAsB,EAAsB,MAAM,8BAA8B,CAAA;AACzF,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC9E,OAAO,cAAc,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,MAAM,UAAU,CAAA;AAC5B,OAAO,EAAE,mCAAmC,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtF,OAAO,4BAA4B,MAAM,gCAAgC,CAAA;AAUzE,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;IAC9C,UAAU,EAAE,cAAc;IAC1B,KAAK,EAAE,KAAK;CACb,CAAC,CAAA;AAEF,SAAS,kBAAkB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAA2B;IAC1G,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;IAC/C,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAE,CAAA;IAEnD,MAAM,OAAO,GAAG,CACd,6BACE,SAAS,EAAE,UAAU,CAAC,iCAAiC,EAAE,SAAS,EAAE;YAClE,kCAAkC,EAAE,QAAQ;SAC7C,CAAC,IAED,gBAAgB,CAAC,OAAO,CAAC,CACtB,CACP,CAAA;IACD,MAAM,UAAU,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,EAAwB,EAAE,EAAE,CAAC,CAC/D,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
import { ExamAnswer, QuestionId } from '../../types/ExamAnswer';
|
3
|
+
import { ChoiceGroupChoice, GradingStructure } from '../../types/GradingStructure';
|
4
|
+
import { Score } from '../../types/Score';
|
5
|
+
import { ResultsProps } from './Results';
|
6
|
+
export interface ResultsContext {
|
7
|
+
answersByQuestionId: Record<QuestionId, ExamAnswer>;
|
8
|
+
gradingStructure: GradingStructure;
|
9
|
+
scores: Score[];
|
10
|
+
gradingText: string | undefined;
|
11
|
+
totalScore: number;
|
12
|
+
singleGrading?: boolean;
|
13
|
+
}
|
14
|
+
export declare const ResultsContext: React.Context<ResultsContext>;
|
15
|
+
export declare const withResultsContext: (Component: React.ComponentType<ResultsProps>) => React.ComponentType<ResultsProps>;
|
16
|
+
export declare function findMultiChoiceFromGradingStructure(gradingStructure: GradingStructure, id: number): ChoiceGroupChoice | undefined;
|
17
|
+
export declare function findScore(scores: Score[], questionId: number): Score | undefined;
|
18
|
+
export declare function calculateQuestionsTotalSumScore(topLevelQuestions: Element[], gradingStructure: GradingStructure, scores: Score[], answersByQuestionId: Record<QuestionId, ExamAnswer>): number;
|
19
|
+
export declare function calculateQuestionSumScore(questionElement: Element, gradingStructure: GradingStructure, scores: Score[], answersById: Record<QuestionId, ExamAnswer>): number;
|
20
|
+
//# sourceMappingURL=ResultsContext.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ResultsContext.d.ts","sourceRoot":"","sources":["../../../src/components/results/ResultsContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAgB,UAAU,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC7E,OAAO,EAAE,iBAAiB,EAAuB,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACvG,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,WAAW,cAAc;IAC7B,mBAAmB,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IACnD,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,eAAO,MAAM,cAAc,+BAA4D,CAAA;AAEvF,eAAO,MAAM,kBAAkB,qFAgB9B,CAAA;AAED,wBAAgB,mCAAmC,CACjD,gBAAgB,EAAE,gBAAgB,EAClC,EAAE,EAAE,MAAM,GACT,iBAAiB,GAAG,SAAS,CAY/B;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAEhF;AAED,wBAAgB,+BAA+B,CAC7C,iBAAiB,EAAE,OAAO,EAAE,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,KAAK,EAAE,EACf,mBAAmB,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,UAOpD;AAED,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,OAAO,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,KAAK,EAAE,EACf,WAAW,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,UAiC5C"}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import * as _ from 'lodash-es';
|
2
|
+
import React from 'react';
|
3
|
+
import { findChildrenAnswers, getNumericAttribute, parentElements, queryAll } from '../../dom-utils';
|
4
|
+
import { withContext } from '../withContext';
|
5
|
+
export const ResultsContext = React.createContext({});
|
6
|
+
export const withResultsContext = withContext(ResultsContext, ({ scores, doc, gradingStructure, gradingText, answers, singleGrading }) => {
|
7
|
+
const answersByQuestionId = _.keyBy(answers, 'questionId');
|
8
|
+
const topLevelQuestions = queryAll(doc.documentElement, 'question', false);
|
9
|
+
const totalScore = calculateQuestionsTotalSumScore(topLevelQuestions, gradingStructure, scores, answersByQuestionId);
|
10
|
+
return {
|
11
|
+
answersByQuestionId,
|
12
|
+
gradingStructure,
|
13
|
+
scores,
|
14
|
+
totalScore,
|
15
|
+
gradingText,
|
16
|
+
singleGrading,
|
17
|
+
};
|
18
|
+
});
|
19
|
+
export function findMultiChoiceFromGradingStructure(gradingStructure, id) {
|
20
|
+
const choiceGroups = gradingStructure.questions.filter((v) => v.type === 'choicegroup');
|
21
|
+
for (let i = 0, length = choiceGroups.length; i < length; i++) {
|
22
|
+
const choiceGroup = choiceGroups[i];
|
23
|
+
for (let j = 0, choicesLength = choiceGroup.choices.length; j < choicesLength; j++) {
|
24
|
+
if (choiceGroup.choices[j].id === id) {
|
25
|
+
return choiceGroup.choices[j];
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
return undefined;
|
30
|
+
}
|
31
|
+
export function findScore(scores, questionId) {
|
32
|
+
return scores.find((a) => a.questionId === questionId);
|
33
|
+
}
|
34
|
+
export function calculateQuestionsTotalSumScore(topLevelQuestions, gradingStructure, scores, answersByQuestionId) {
|
35
|
+
return _.sum(topLevelQuestions.map((question) => calculateQuestionSumScore(question, gradingStructure, scores, answersByQuestionId)));
|
36
|
+
}
|
37
|
+
export function calculateQuestionSumScore(questionElement, gradingStructure, scores, answersById) {
|
38
|
+
const choiceQuestionScore = (questionId, scoredAnswer) => {
|
39
|
+
const choice = findMultiChoiceFromGradingStructure(gradingStructure, questionId);
|
40
|
+
return choice ? choice.options.find((o) => o.id === Number(scoredAnswer.value)).score : 0;
|
41
|
+
};
|
42
|
+
const textQuestionScore = (questionId) => {
|
43
|
+
var _a, _b;
|
44
|
+
const score = findScore(scores, questionId);
|
45
|
+
return score
|
46
|
+
? ((_b = [score.inspection, (_a = score.censoring) === null || _a === void 0 ? void 0 : _a.scores[0], score.autograding, score.pregrading].find(Boolean)) === null || _b === void 0 ? void 0 : _b.score) || 0
|
47
|
+
: 0;
|
48
|
+
};
|
49
|
+
const sumScore = _.sum(findChildrenAnswers(questionElement).map((answer) => {
|
50
|
+
const questionId = getNumericAttribute(answer, 'question-id');
|
51
|
+
const scoredAnswer = answersById[questionId];
|
52
|
+
if (!scoredAnswer) {
|
53
|
+
return 0;
|
54
|
+
}
|
55
|
+
if (scoredAnswer.type === 'choice') {
|
56
|
+
return choiceQuestionScore(questionId, scoredAnswer);
|
57
|
+
}
|
58
|
+
else {
|
59
|
+
return textQuestionScore(questionId);
|
60
|
+
}
|
61
|
+
}));
|
62
|
+
// top level questions may not yield negative scores
|
63
|
+
if (parentElements(questionElement, 'question').length === 0 && sumScore < 0) {
|
64
|
+
return 0;
|
65
|
+
}
|
66
|
+
return sumScore;
|
67
|
+
}
|
68
|
+
//# sourceMappingURL=ResultsContext.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ResultsContext.js","sourceRoot":"","sources":["../../../src/components/results/ResultsContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAIpG,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAY5C,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,aAAa,CAAiB,EAAoB,CAAC,CAAA;AAEvF,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAC3C,cAAc,EACd,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,EAAE;IACzE,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;IAC1D,MAAM,iBAAiB,GAAG,QAAQ,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,EAA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AY,EAAE;YACjB,OAAO,CAAC,CAAA;SACT;QACD,IAAI,YAAY,CAAC,IAAI,KAAK,QAAQ,EAAE;YAClC,OAAO,mBAAmB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAA;SACrD;aAAM;YACL,OAAO,iBAAiB,CAAC,UAAU,CAAC,CAAA;SACrC;IACH,CAAC,CAAC,CACH,CAAA;IACD,oDAAoD;IACpD,IAAI,cAAc,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,GAAG,CAAC,EAAE;QAC5E,OAAO,CAAC,CAAA;KACT;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ExamComponentProps } from '../../createRenderChildNodes';
|
3
|
+
declare function ResultsDropdownAnswer({ element }: ExamComponentProps): JSX.Element | null;
|
4
|
+
declare const _default: React.MemoExoticComponent<typeof ResultsDropdownAnswer>;
|
5
|
+
export default _default;
|
6
|
+
//# sourceMappingURL=ResultsDropdownAnswer.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ResultsDropdownAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/results/ResultsDropdownAnswer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAMzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAGjE,iBAAS,qBAAqB,CAAC,EAAE,OAAO,EAAE,EAAE,kBAAkB,sBAiD7D;;AAED,wBAAgD"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import classNames from 'classnames';
|
2
|
+
import * as _ from 'lodash-es';
|
3
|
+
import React, { useContext } from 'react';
|
4
|
+
import { findChildElement, getNumericAttribute, mapChildElements } from '../../dom-utils';
|
5
|
+
import { shortDisplayNumber } from '../../shortDisplayNumber';
|
6
|
+
import { QuestionContext } from '../QuestionContext';
|
7
|
+
import { findMultiChoiceFromGradingStructure, ResultsContext } from './ResultsContext';
|
8
|
+
import ResultsExamQuestionAutoScore from './ResultsExamQuestionAutoScore';
|
9
|
+
function ResultsDropdownAnswer({ element }) {
|
10
|
+
const { answersByQuestionId, gradingStructure } = useContext(ResultsContext);
|
11
|
+
const { answers } = useContext(QuestionContext);
|
12
|
+
const questionId = getNumericAttribute(element, 'question-id');
|
13
|
+
const answer = answersByQuestionId[questionId];
|
14
|
+
const currentlySelectedItem = answer &&
|
15
|
+
answer.value &&
|
16
|
+
findChildElement(element, (childElement) => answer.value === childElement.getAttribute('option-id'));
|
17
|
+
const choice = findMultiChoiceFromGradingStructure(gradingStructure, questionId);
|
18
|
+
if (currentlySelectedItem) {
|
19
|
+
const correctIds = choice.options.filter((o) => o.correct).map((o) => o.id);
|
20
|
+
const correctAnswers = _.compact(mapChildElements(element, (childElement) => {
|
21
|
+
if (correctIds.includes(getNumericAttribute(childElement, 'option-id'))) {
|
22
|
+
return childElement.textContent;
|
23
|
+
}
|
24
|
+
}));
|
25
|
+
const isAnswerCorrect = correctIds.includes(getNumericAttribute(currentlySelectedItem, 'option-id'));
|
26
|
+
const displayNumber = shortDisplayNumber(element.getAttribute('display-number'));
|
27
|
+
const scoreValue = answer && choice.options.find((option) => option.id === Number(answer.value)).score;
|
28
|
+
const maxScore = getNumericAttribute(element, 'max-score');
|
29
|
+
return (React.createElement(React.Fragment, null,
|
30
|
+
answers.length > 1 && React.createElement("sup", null, displayNumber),
|
31
|
+
React.createElement("span", { className: classNames('e-dropdown-answer__answered', {
|
32
|
+
'e-dropdown-answer__answered--correct': isAnswerCorrect,
|
33
|
+
'e-dropdown-answer__answered--wrong': !isAnswerCorrect,
|
34
|
+
}) }, currentlySelectedItem.textContent),
|
35
|
+
!isAnswerCorrect && React.createElement("span", { className: "e-dropdown-answer__correct" }, correctAnswers.join(',')),
|
36
|
+
scoreValue != null && (React.createElement(ResultsExamQuestionAutoScore, { score: scoreValue, maxScore: maxScore, displayNumber: displayNumber }))));
|
37
|
+
}
|
38
|
+
return null;
|
39
|
+
}
|
40
|
+
export default React.memo(ResultsDropdownAnswer);
|
41
|
+
//# sourceMappingURL=ResultsDropdownAnswer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ResultsDropdownAnswer.js","sourceRoot":"","sources":["../../../src/components/results/ResultsDropdownAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,mCAAmC,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtF,OAAO,4BAA4B,MAAM,gCAAgC,CAAA;AAIzE,SAAS,qBAAqB,CAAC,EAAE,OAAO,EAAsB;IAC5D,MAAM,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAA;IAC5E,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IAC/C,MAAM,UAAU,GAAG,mBAAmB,CAAC,OAAO,EAAE,aAAa,CAAE,CAAA;IAC/D,MAAM,MAAM,GAAG,mBAAmB,CAAC,UAAU,CAA6B,CAAA;IAE1E,MAAM,qBAAqB,GACzB,MAAM;QACN,MAAM,CAAC,KAAK;QACZ,gBAAgB,CAAC,OAAO,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,YAAY,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAA;IAEtG,MAAM,MAAM,GAAG,mCAAmC,CAAC,gBA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AAC,4BAA4B,IAAE,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAQ;YAClG,UAAU,IAAI,IAAI,IAAI,CACrB,oBAAC,4BAA4B,IAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,GAAI,CACtG,CACA,CACJ,CAAA;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ResultsExamQuestion.d.ts","sourceRoot":"","sources":["../../../src/components/results/ResultsExamQuestion.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAKzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;;AA2BjE,wBAAmE"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import classNames from 'classnames';
|
2
|
+
import React, { useContext } from 'react';
|
3
|
+
import { findChildrenAnswers, getNumericAttribute } from '../../dom-utils';
|
4
|
+
import { QuestionContext, withQuestionContext } from '../QuestionContext';
|
5
|
+
import AnnotationList from './AnnotationList';
|
6
|
+
import { ResultsContext } from './ResultsContext';
|
7
|
+
function ResultsExamQuestion({ element, renderChildNodes }) {
|
8
|
+
const { answersByQuestionId } = useContext(ResultsContext);
|
9
|
+
const { displayNumber, level } = useContext(QuestionContext);
|
10
|
+
const hasAnswers = questionHasAnswers(element, answersByQuestionId);
|
11
|
+
return hasAnswers ? (React.createElement("div", { className: classNames('exam-question', {
|
12
|
+
'e-mrg-b-8 e-clearfix': level === 0,
|
13
|
+
'e-mrg-l-8 e-mrg-y-4': level > 0,
|
14
|
+
}), id: displayNumber },
|
15
|
+
renderChildNodes(element),
|
16
|
+
React.createElement(AnnotationList, null))) : null;
|
17
|
+
}
|
18
|
+
function questionHasAnswers(element, answers) {
|
19
|
+
const answerElems = findChildrenAnswers(element);
|
20
|
+
return answerElems.some((e) => answers[getNumericAttribute(e, 'question-id')]);
|
21
|
+
}
|
22
|
+
export default React.memo(withQuestionContext(ResultsExamQuestion));
|
23
|
+
//# sourceMappingURL=ResultsExamQuestion.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ResultsExamQuestion.js","sourceRoot":"","sources":["../../../src/components/results/ResultsExamQuestion.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACzE,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAIjD,SAAS,mBAAmB,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAsB;IAC5E,MAAM,EAAE,mBAAmB,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAA;IAC1D,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IAC5D,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAA;IAEnE,OAAO,UAAU,CAAC,CAAC,CAAC,CAClB,6BACE,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE;YACrC,sBAAsB,EAAE,KAAK,KAAK,CAAC;YACnC,qBAAqB,EAAE,KAAK,GAAG,CAAC;SACjC,CAAC,EACF,EAAE,EAAE,aAAa;QAEhB,gBAAgB,CAAC,OAAO,CAAC;QAC1B,oBAAC,cAAc,OAAG,CACd,CACP,CAAC,CAAC,CAAC,IAAI,CAAA;AACV,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAgB,EAAE,OAAmC;IAC/E,MAAM,WAAW,GAAG,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