@digabi/exam-engine-core 20.2.2 → 20.2.4-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__tests__/testExamRendering.js +37 -0
- package/dist/__tests__/testExamRendering.js.map +1 -1
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/components/context/TOCContext.d.ts +9 -0
- package/dist/components/context/TOCContext.d.ts.map +1 -0
- package/dist/components/context/TOCContext.js +3 -0
- package/dist/components/context/TOCContext.js.map +1 -0
- package/dist/components/exam/Exam.d.ts +1 -1
- package/dist/components/exam/Exam.d.ts.map +1 -1
- package/dist/components/exam/Exam.js +97 -108
- package/dist/components/exam/Exam.js.map +1 -1
- package/dist/components/exam/Question.d.ts.map +1 -1
- package/dist/components/exam/Question.js +14 -6
- package/dist/components/exam/Question.js.map +1 -1
- package/dist/components/exam/SectionTitle.d.ts.map +1 -1
- package/dist/components/exam/SectionTitle.js +10 -2
- package/dist/components/exam/SectionTitle.js.map +1 -1
- package/dist/components/shared/TOCQuestion.d.ts +4 -0
- package/dist/components/shared/TOCQuestion.d.ts.map +1 -0
- package/dist/components/shared/TOCQuestion.js +77 -0
- package/dist/components/shared/TOCQuestion.js.map +1 -0
- package/dist/components/shared/TOCSection.d.ts +7 -0
- package/dist/components/shared/TOCSection.d.ts.map +1 -0
- package/dist/components/shared/TOCSection.js +15 -0
- package/dist/components/shared/TOCSection.js.map +1 -0
- package/dist/components/shared/TOCSectionTitle.d.ts +4 -0
- package/dist/components/shared/TOCSectionTitle.d.ts.map +1 -0
- package/dist/components/shared/TOCSectionTitle.js +34 -0
- package/dist/components/shared/TOCSectionTitle.js.map +1 -0
- package/dist/components/shared/TableOfContents.d.ts.map +1 -1
- package/dist/components/shared/TableOfContents.js +30 -104
- package/dist/components/shared/TableOfContents.js.map +1 -1
- package/dist/components/shared/VersionNumber.d.ts.map +1 -1
- package/dist/components/shared/VersionNumber.js +7 -3
- package/dist/components/shared/VersionNumber.js.map +1 -1
- package/dist/dom-utils.d.ts +1 -0
- package/dist/dom-utils.d.ts.map +1 -1
- package/dist/dom-utils.js +17 -1
- package/dist/dom-utils.js.map +1 -1
- package/dist/main-bundle.js +1 -1
- package/dist/main.css +1 -1
- package/package.json +2 -2
@@ -0,0 +1,9 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
type TOCContextType = {
|
3
|
+
visibleTOCElements: string[];
|
4
|
+
isInSidebar: boolean;
|
5
|
+
addRef: (object: HTMLDivElement) => void;
|
6
|
+
};
|
7
|
+
export declare const TOCContext: import("react").Context<TOCContextType>;
|
8
|
+
export {};
|
9
|
+
//# sourceMappingURL=TOCContext.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TOCContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/TOCContext.ts"],"names":[],"mappings":";AAEA,KAAK,cAAc,GAAG;IACpB,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,WAAW,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAA;CACzC,CAAA;AAED,eAAO,MAAM,UAAU,yCAAsC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TOCContext.js","sourceRoot":"","sources":["../../../src/components/context/TOCContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAQrC,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC,EAAoB,CAAC,CAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ExamAnswer, ExamServerAPI, InitialCasStatus, RestrictedAudioPlaybackStats } from '../../index';
|
3
|
-
import { TextAnswer as TextAnswerType
|
3
|
+
import { RichTextAnswer, TextAnswer as TextAnswerType } from '../../types/ExamAnswer';
|
4
4
|
/** Props common to taking the exams and viewing results */
|
5
5
|
export interface CommonExamProps {
|
6
6
|
/** Initial answers */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Exam.d.ts","sourceRoot":"","sources":["../../../src/components/exam/Exam.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"Exam.d.ts","sourceRoot":"","sources":["../../../src/components/exam/Exam.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAA;AAOzE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAIvG,OAAO,EAAE,cAAc,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAA;AA4CrF,2DAA2D;AAC3D,MAAM,WAAW,eAAe;IAC9B,sBAAsB;IACtB,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,uCAAuC;IACvC,cAAc,EAAE,MAAM,CAAA;IACtB,iEAAiE;IACjE,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;IAC/C,mBAAmB;IACnB,GAAG,EAAE,WAAW,CAAA;IAChB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,aAAa,EAAE,CAAC,UAAU,EAAE,cAAc,GAAG,cAAc,KAAK,IAAI,CAAA;IACpE,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,uDAAuD;AACvD,MAAM,WAAW,SAAU,SAAQ,eAAe;IAChD,2CAA2C;IAC3C,SAAS,EAAE,gBAAgB,CAAA;IAC3B,oEAAoE;IACpE,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B;;;OAGG;IACH,4BAA4B,EAAE,4BAA4B,EAAE,CAAA;IAC5D,qCAAqC;IACrC,aAAa,EAAE,aAAa,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,OAAO,CAAA;IACrB,aAAa,EAAE,aAAa,CAAA;CAC7B;;AAoOD,wBAAuE"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { createRef, useContext, useEffect } from 'react';
|
1
|
+
import React, { createRef, useContext, useEffect, useState } from 'react';
|
2
2
|
import { I18nextProvider } from 'react-i18next';
|
3
3
|
import { Provider } from 'react-redux';
|
4
4
|
import { createRenderChildNodes } from '../../createRenderChildNodes';
|
@@ -9,47 +9,47 @@ import { parseExamStructure } from '../../parser/parseExamStructure';
|
|
9
9
|
import { scrollToHash } from '../../scrollToHash';
|
10
10
|
import { initializeExamStore } from '../../store';
|
11
11
|
import { useCached } from '../../useCached';
|
12
|
+
import DocumentTitle from '../DocumentTitle';
|
13
|
+
import RenderChildNodes from '../RenderChildNodes';
|
14
|
+
import SectionElement from '../SectionElement';
|
15
|
+
import { CommonExamContext, withCommonExamContext } from '../context/CommonExamContext';
|
16
|
+
import { withExamContext } from '../context/ExamContext';
|
17
|
+
import { TOCContext } from '../context/TOCContext';
|
12
18
|
import mkAttachmentLink from '../shared/AttachmentLink';
|
13
19
|
import mkAttachmentLinks from '../shared/AttachmentLinks';
|
14
20
|
import Audio from '../shared/Audio';
|
15
21
|
import AudioGroup from '../shared/AudioGroup';
|
16
22
|
import AudioTest from '../shared/AudioTest';
|
23
|
+
import ExamTranslation from '../shared/ExamTranslation';
|
24
|
+
import File from '../shared/File';
|
25
|
+
import { Footer } from '../shared/Footer';
|
26
|
+
import Formula from '../shared/Formula';
|
27
|
+
import Image from '../shared/Image';
|
28
|
+
import ImageOverlay from '../shared/ImageOverlay';
|
29
|
+
import { QuestionNumber } from '../shared/QuestionNumber';
|
30
|
+
import References from '../shared/References';
|
31
|
+
import { mkTableOfContents } from '../shared/TableOfContents';
|
32
|
+
import { VersionNumber } from '../shared/VersionNumber';
|
33
|
+
import Video from '../shared/Video';
|
34
|
+
import ExamAttachment from './Attachment';
|
17
35
|
import ChoiceAnswer from './ChoiceAnswer';
|
18
|
-
import { CommonExamContext, withCommonExamContext } from '../context/CommonExamContext';
|
19
|
-
import DocumentTitle from '../DocumentTitle';
|
20
36
|
import DropdownAnswer from './DropdownAnswer';
|
21
|
-
import ErrorIndicator from './internal/ErrorIndicator';
|
22
|
-
import ExamAttachment from './Attachment';
|
23
|
-
import { withExamContext } from '../context/ExamContext';
|
24
37
|
import ExamFooter from './ExamFooter';
|
25
38
|
import ExamInstruction from './ExamInstruction';
|
39
|
+
import ExternalMaterial from './ExternalMaterial';
|
40
|
+
import GoToExamineAnswersButton from './GoToExamineAnswersButton';
|
41
|
+
import Hints from './Hints';
|
26
42
|
import Question from './Question';
|
27
43
|
import QuestionInstruction from './QuestionInstruction';
|
28
44
|
import QuestionTitle from './QuestionTitle';
|
29
45
|
import Section from './Section';
|
30
|
-
import SectionTitle from './SectionTitle';
|
31
|
-
import ExternalMaterial from './ExternalMaterial';
|
32
|
-
import File from '../shared/File';
|
33
|
-
import Formula from '../shared/Formula';
|
34
|
-
import Hints from './Hints';
|
35
|
-
import Image from '../shared/Image';
|
36
|
-
import ImageOverlay from '../shared/ImageOverlay';
|
37
|
-
import References from '../shared/References';
|
38
|
-
import SaveIndicator from './internal/SaveIndicator';
|
39
|
-
import SectionElement from '../SectionElement';
|
40
46
|
import SectionInstruction from './SectionInstruction';
|
41
|
-
import
|
42
|
-
import TextAnswer from './TextAnswer';
|
43
|
-
import Video from '../shared/Video';
|
44
|
-
import RenderChildNodes from '../RenderChildNodes';
|
45
|
-
import { QuestionNumber } from '../shared/QuestionNumber';
|
46
|
-
import ExamTranslation from '../shared/ExamTranslation';
|
47
|
-
import * as _ from 'lodash-es';
|
47
|
+
import SectionTitle from './SectionTitle';
|
48
48
|
import { StudentNameHeader } from './StudentNameHeader';
|
49
|
+
import TextAnswer from './TextAnswer';
|
49
50
|
import { UndoView } from './UndoView';
|
50
|
-
import
|
51
|
-
import
|
52
|
-
import { VersionNumber } from '../shared/VersionNumber';
|
51
|
+
import ErrorIndicator from './internal/ErrorIndicator';
|
52
|
+
import SaveIndicator from './internal/SaveIndicator';
|
53
53
|
const renderChildNodes = createRenderChildNodes({
|
54
54
|
attachment: ExamAttachment,
|
55
55
|
'attachment-link': mkAttachmentLink('link'),
|
@@ -103,99 +103,88 @@ const Exam = ({ doc, casStatus, answers, restrictedAudioPlaybackStats, examServe
|
|
103
103
|
const i18n = useCached(() => initI18n(language, examCode, dayCode));
|
104
104
|
useEffect(changeLanguage(i18n, language));
|
105
105
|
useEffect(scrollToHash, []);
|
106
|
+
const [allRefs, setAllRefs] = useState([]);
|
107
|
+
const addRef = (ref) => {
|
108
|
+
if (!allRefs.includes(ref)) {
|
109
|
+
setAllRefs(prevRefs => {
|
110
|
+
const nextAllRefs = [...prevRefs, ref];
|
111
|
+
return nextAllRefs;
|
112
|
+
});
|
113
|
+
}
|
114
|
+
};
|
115
|
+
useEffect(() => {
|
116
|
+
const observer = new IntersectionObserver(callback);
|
117
|
+
const observableElements = allRefs;
|
118
|
+
observableElements.forEach(element => observer.observe(element));
|
119
|
+
return () => {
|
120
|
+
observableElements.forEach(element => observer.unobserve(element));
|
121
|
+
};
|
122
|
+
}, [allRefs]);
|
123
|
+
const callback = (entries) => entries.forEach(entry => {
|
124
|
+
const dataTOCId = entry.target.getAttribute('data-toc-id');
|
125
|
+
setVisibleElements(prevEntries => entry.isIntersecting ? [...prevEntries, dataTOCId] : prevEntries.filter(entries => entries !== dataTOCId));
|
126
|
+
});
|
127
|
+
const [visibleElements, setVisibleElements] = useState([]);
|
106
128
|
const isInViewport = (element) => {
|
129
|
+
const offset = 100; // must be at least this far away from viewport edges
|
107
130
|
const rect = element.getBoundingClientRect();
|
108
|
-
return rect.top >=
|
131
|
+
return rect.top >= offset && rect.bottom <= window.innerHeight - offset;
|
109
132
|
};
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
const elementBeginsInView = elementTop < scrollY + window.innerHeight && elementTop > scrollY;
|
122
|
-
const elementEndsInView = elementBottom < scrollY + window.innerHeight && elementBottom > scrollY;
|
123
|
-
const elementFillsView = elementTop < scrollY && elementBottom > scrollY + window.innerHeight;
|
124
|
-
if (elementBeginsInView || elementEndsInView || elementFillsView) {
|
125
|
-
const currentSectionId = (_a = element.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.replace('section-title-', '');
|
126
|
-
if (currentSectionId) {
|
127
|
-
const naviSectionHeader = document.querySelector(`.table-of-contents #toc-section-title-${currentSectionId}`);
|
128
|
-
const sectionAnswerInstructions = document.querySelector(`.table-of-contents .answer-instructions-container.section-${currentSectionId}`);
|
129
|
-
naviSectionHeader === null || naviSectionHeader === void 0 ? void 0 : naviSectionHeader.classList.add('current');
|
130
|
-
sectionAnswerInstructions === null || sectionAnswerInstructions === void 0 ? void 0 : sectionAnswerInstructions.classList.add('current');
|
131
|
-
}
|
132
|
-
const currentQuestionNumber = (_b = element.querySelector('.anchor')) === null || _b === void 0 ? void 0 : _b.id.replace('question-nr-', '');
|
133
|
-
const naviQuestionTitle = currentQuestionNumber &&
|
134
|
-
document.querySelector(`.table-of-contents li[data-list-number="${currentQuestionNumber}."]`);
|
135
|
-
if (naviQuestionTitle) {
|
136
|
-
naviQuestionTitle.classList.add('current');
|
137
|
-
const isVisible = isInViewport(naviQuestionTitle);
|
138
|
-
if (!isVisible && !!sideNavigation) {
|
139
|
-
const navHeight = sideNavigation.getBoundingClientRect().height;
|
140
|
-
const scrollToPos = naviQuestionTitle.offsetTop - navHeight / 2;
|
141
|
-
sideNavigation.scrollTo({ behavior: 'smooth', top: scrollToPos });
|
142
|
-
}
|
133
|
+
useEffect(() => {
|
134
|
+
visibleElements.forEach(element => {
|
135
|
+
const displayNumber = element.replace('question-', '');
|
136
|
+
const naviQuestionTitle = document.querySelector(`.table-of-contents li[data-list-number="${displayNumber}."]`);
|
137
|
+
if (naviQuestionTitle) {
|
138
|
+
const isVisible = isInViewport(naviQuestionTitle);
|
139
|
+
const sideNavigation = document.querySelector(`.sidebar-toc-container .table-of-contents`);
|
140
|
+
if (!isVisible && !!sideNavigation) {
|
141
|
+
const navHeight = sideNavigation.getBoundingClientRect().height;
|
142
|
+
const scrollToPos = naviQuestionTitle.offsetTop - navHeight / 2;
|
143
|
+
sideNavigation.scrollTo({ behavior: 'smooth', top: scrollToPos });
|
143
144
|
}
|
144
145
|
}
|
145
146
|
});
|
146
|
-
};
|
147
|
-
window.addEventListener('scroll', _.throttle(handleExamScroll, 100, { trailing: false }));
|
148
|
-
const handleTOCScroll = (e) => {
|
149
|
-
const toc = e.currentTarget;
|
150
|
-
if (toc.scrollHeight <= toc.clientHeight) {
|
151
|
-
return;
|
152
|
-
}
|
153
|
-
const deltaY = e.deltaY;
|
154
|
-
const hitsTop = deltaY < 0 && toc.scrollTop === 0;
|
155
|
-
const hitsBottom = deltaY > 0 && toc.scrollTop >= toc.scrollHeight - toc.clientHeight;
|
156
|
-
if (hitsTop || hitsBottom) {
|
157
|
-
e.preventDefault();
|
158
|
-
}
|
159
|
-
};
|
160
|
-
useEffect(() => {
|
161
|
-
const toc = document.querySelector('.sidebar-toc-container .table-of-contents');
|
162
|
-
toc === null || toc === void 0 ? void 0 : toc.addEventListener('wheel', handleTOCScroll, { passive: false });
|
163
|
-
return () => toc === null || toc === void 0 ? void 0 : toc.addEventListener('wheel', handleTOCScroll, { passive: false });
|
164
|
-
}, []);
|
147
|
+
}, [visibleElements]);
|
165
148
|
// TODO: Remove 'isNewKoeVersion' checks when old Koe version is not supported anymore
|
149
|
+
// Here "old" means versions where student can not examine answers on a separate page after answering questions
|
166
150
|
const isNewKoeVersion = examServerApi.examineExam !== undefined;
|
167
151
|
const isPreview = studentName === '[Kokelaan Nimi]';
|
168
152
|
return (React.createElement(Provider, { store: store },
|
169
153
|
React.createElement(I18nextProvider, { i18n: i18n },
|
170
|
-
React.createElement(
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
React.createElement(
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
React.createElement(
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
React.createElement(
|
198
|
-
|
154
|
+
React.createElement(TOCContext.Provider, { value: {
|
155
|
+
visibleTOCElements: visibleElements,
|
156
|
+
isInSidebar: true,
|
157
|
+
addRef
|
158
|
+
} },
|
159
|
+
React.createElement("main", { className: "e-exam", lang: subjectLanguage, "aria-labelledby": examTitleId, ref: examRef },
|
160
|
+
React.createElement(React.StrictMode, null),
|
161
|
+
examStylesheet && React.createElement("link", { rel: "stylesheet", href: resolveAttachment(examStylesheet) }),
|
162
|
+
React.createElement("div", { className: "e-toc-and-exam" },
|
163
|
+
tableOfContents && (React.createElement("div", { className: "sidebar-toc-container", "aria-hidden": "true" },
|
164
|
+
React.createElement(TableOfContentsSidebar, { element: tableOfContents, renderChildNodes }))),
|
165
|
+
React.createElement("div", { className: "main-exam-container" },
|
166
|
+
React.createElement("div", { className: "main-exam" },
|
167
|
+
React.createElement(StudentNameHeader, { studentName: studentName }),
|
168
|
+
React.createElement(SectionElement, { "aria-labelledby": examTitleId },
|
169
|
+
examTitle && React.createElement(DocumentTitle, { id: examTitleId }, renderChildNodes(examTitle)),
|
170
|
+
date && (React.createElement("p", null,
|
171
|
+
React.createElement("strong", null, dateTimeFormatter.format(date)))),
|
172
|
+
examInstruction && React.createElement(ExamInstruction, { element: examInstruction, renderChildNodes }),
|
173
|
+
tableOfContents && (React.createElement("div", { className: "main-toc-container" },
|
174
|
+
React.createElement(TableOfContents, { element: tableOfContents,
|
175
|
+
renderChildNodes }))),
|
176
|
+
externalMaterial && (React.createElement(ExternalMaterial, { element: externalMaterial, renderChildNodes, forceRender: true }))),
|
177
|
+
renderChildNodes(root),
|
178
|
+
(isPreview || isNewKoeVersion) && (React.createElement("div", { className: "e-examine-exam" },
|
179
|
+
React.createElement(GoToExamineAnswersButton, null),
|
180
|
+
React.createElement(ProceedToExamineAnswersText, null)))))),
|
181
|
+
(isPreview || isNewKoeVersion) && (React.createElement(Footer, null,
|
182
|
+
React.createElement("div", { className: "e-footer-version-number-container" },
|
183
|
+
React.createElement(VersionNumber, null)))),
|
184
|
+
React.createElement("div", { className: "e-indicators-container" },
|
185
|
+
React.createElement(ErrorIndicator, null),
|
186
|
+
React.createElement(SaveIndicator, null)),
|
187
|
+
showUndoView && isNewKoeVersion && React.createElement(UndoView, { ...undoViewProps }))))));
|
199
188
|
};
|
200
189
|
const ProceedToExamineAnswersText = () => {
|
201
190
|
const { t } = useExamTranslation();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Exam.js","sourceRoot":"","sources":["../../../src/components/exam/Exam.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"Exam.js","sourceRoot":"","sources":["../../../src/components/exam/Exam.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MA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,EAAE,CAAA;IAClC,OAAO,CACL,6BAAK,SAAS,EAAC,6BAA6B,EAAC,EAAE,EAAC,yBAAyB,IACtE,CAAC,CAAC,2BAA2B,CAAC,CAC3B,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Question.d.ts","sourceRoot":"","sources":["../../../src/components/exam/Question.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"Question.d.ts","sourceRoot":"","sources":["../../../src/components/exam/Question.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAyD,MAAM,OAAO,CAAA;AAW7E,eAAO,MAAM,qBAAqB;cACtB,OAAO;sBACC,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI;EACkB,CAAA;;AAyF1D,wBAAwD"}
|
@@ -1,13 +1,14 @@
|
|
1
|
+
import { faCompressAlt } from '@fortawesome/free-solid-svg-icons';
|
2
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
1
3
|
import classNames from 'classnames';
|
2
4
|
import React, { createContext, useContext, useEffect, useState } from 'react';
|
3
5
|
import { useSelector } from 'react-redux';
|
4
|
-
import { QuestionContext, withQuestionContext } from '../context/QuestionContext';
|
5
|
-
import { SectionContext } from '../context/SectionContext';
|
6
|
-
import { faCompressAlt } from '@fortawesome/free-solid-svg-icons';
|
7
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
8
|
-
import { useExamTranslation } from '../../i18n';
|
9
6
|
import { getNumericAttribute, query } from '../../dom-utils';
|
7
|
+
import { useExamTranslation } from '../../i18n';
|
10
8
|
import { ExamContext } from '../context/ExamContext';
|
9
|
+
import { QuestionContext, withQuestionContext } from '../context/QuestionContext';
|
10
|
+
import { SectionContext } from '../context/SectionContext';
|
11
|
+
import { TOCContext } from '../context/TOCContext';
|
11
12
|
export const ExpandQuestionContext = createContext({ expanded: false, toggleWriterMode: () => undefined });
|
12
13
|
function Question({ element, renderChildNodes }) {
|
13
14
|
const casStatus = useSelector((state) => state.cas.casStatus);
|
@@ -50,12 +51,19 @@ function Question({ element, renderChildNodes }) {
|
|
50
51
|
}
|
51
52
|
return () => window.removeEventListener('keydown', preventTabKey);
|
52
53
|
}, [expanded]);
|
54
|
+
const ref = React.createRef();
|
55
|
+
const { addRef } = useContext(TOCContext);
|
56
|
+
useEffect(() => {
|
57
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && level === 0 && addRef) {
|
58
|
+
addRef(ref.current);
|
59
|
+
}
|
60
|
+
}, []);
|
53
61
|
return !casForbidden || casStatus === 'forbidden' ? (React.createElement(ExpandQuestionContext.Provider, { value: { expanded, toggleWriterMode } },
|
54
62
|
React.createElement("div", { className: classNames('e-exam-question', {
|
55
63
|
'e-level-0 e-pad-b-8 e-clearfix': level === 0,
|
56
64
|
'e-mrg-l-8 e-mrg-y-4': level > 0,
|
57
65
|
'e-expanded': expanded
|
58
|
-
}), "data-annotation-anchor": displayNumber },
|
66
|
+
}), "data-annotation-anchor": displayNumber, "data-toc-id": `question-${displayNumber}`, ref: ref },
|
59
67
|
React.createElement("div", { className: "anchor", id: `question-nr-${displayNumber}` }),
|
60
68
|
expanded ? (React.createElement("div", { className: "full-screen", "data-full-screen-id": displayNumber },
|
61
69
|
React.createElement("button", { className: "expand close", onClick: () => toggleWriterMode(false) },
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Question.js","sourceRoot":"","sources":["../../../src/components/exam/Question.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;
|
1
|
+
{"version":3,"file":"Question.js","sourceRoot":"","sources":["../../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GAAG,EAAE,GAAG;YAER,6BAAK,SAAS,EAAC,QAAQ,EAAC,EAAE,EAAE,eAAe,aAAa,EAAE,GAAI;YAE7D,QAAQ,CAAC,CAAC,CAAC,CACV,6BAAK,SAAS,EAAC,aAAa,yBAAsB,aAAa;gBAC7D,gCAAQ,SAAS,EAAC,cAAc,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC;oBACrE,oBAAC,eAAe,IAAC,IAAI,EAAE,aAAa,GAAI;oBACvC,CAAC,CAAC,oBAAoB,CAAC,CACjB;gBACR,gBAAgB,CAAC,OAAO,CAAC,CACtB,CACP,CAAC,CAAC,CAAC,CACF,gBAAgB,CAAC,OAAO,CAAC,CAC1B,CACG,CACyB,CAClC,CAAC,CAAC,CAAC,IAAI,CAAA;AACV,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SectionTitle.d.ts","sourceRoot":"","sources":["../../../src/components/exam/SectionTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"SectionTitle.d.ts","sourceRoot":"","sources":["../../../src/components/exam/SectionTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AASjE,iBAAS,YAAY,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,kBAAkB,qBAmCtE;;AAED,wBAAuC"}
|
@@ -1,16 +1,24 @@
|
|
1
|
-
import React, { useContext } from 'react';
|
1
|
+
import React, { useContext, useEffect } from 'react';
|
2
2
|
import { useExamTranslation } from '../../i18n';
|
3
3
|
import { sectionTitleId } from '../../ids';
|
4
4
|
import AnsweringInstructions from '../AnsweringInstructions';
|
5
5
|
import { CommonExamContext } from '../context/CommonExamContext';
|
6
6
|
import NotificationIcon from '../NotificationIcon';
|
7
7
|
import { SectionContext } from '../context/SectionContext';
|
8
|
+
import { TOCContext } from '../context/TOCContext';
|
8
9
|
function SectionTitle({ element, renderChildNodes }) {
|
9
10
|
const { sections } = useContext(CommonExamContext);
|
10
11
|
const { displayNumber, minAnswers, maxAnswers, childQuestions } = useContext(SectionContext);
|
11
12
|
const { t } = useExamTranslation();
|
13
|
+
const ref = React.createRef();
|
14
|
+
const { addRef } = useContext(TOCContext);
|
15
|
+
useEffect(() => {
|
16
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && addRef) {
|
17
|
+
addRef(ref.current);
|
18
|
+
}
|
19
|
+
}, []);
|
12
20
|
return (React.createElement(React.Fragment, null,
|
13
|
-
element.hasChildNodes() && (React.createElement("h2", { className: "exam-section-title", id: sectionTitleId(displayNumber) },
|
21
|
+
element.hasChildNodes() && (React.createElement("h2", { className: "exam-section-title", id: sectionTitleId(displayNumber), "data-toc-id": `section-${displayNumber}`, ref: ref },
|
14
22
|
sections.length > 1 && t('section', { displayNumber }),
|
15
23
|
" ",
|
16
24
|
renderChildNodes(element))),
|
@@ -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;
|
1
|
+
{"version":3,"file":"SectionTitle.js","sourceRoot":"","sources":["../../../src/components/exam/SectionTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEpD,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,gBAA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S,GAAM,CAC5F,CACR,CACA,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TOCQuestion.d.ts","sourceRoot":"","sources":["../../../src/components/shared/TOCQuestion.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAWjE,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,kBAAkB,CA8GnE,CAAA"}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import { faPaperclip } from '@fortawesome/free-solid-svg-icons';
|
2
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
3
|
+
import classNames from 'classnames';
|
4
|
+
import React, { useContext } from 'react';
|
5
|
+
import { useSelector } from 'react-redux';
|
6
|
+
import { findChildElement, getAttribute, query, queryAncestors, useIsElementInViewport } from '../../dom-utils';
|
7
|
+
import { useExamTranslation } from '../../i18n';
|
8
|
+
import { url } from '../../url';
|
9
|
+
import { CommonExamContext } from '../context/CommonExamContext';
|
10
|
+
import { QuestionContext } from '../context/QuestionContext';
|
11
|
+
import { Indicator } from './AnswerIndicator';
|
12
|
+
import { TOCContext } from '../context/TOCContext';
|
13
|
+
export const TOCQuestion = ({ element, renderChildNodes }) => {
|
14
|
+
var _a;
|
15
|
+
const { attachmentsURL } = useContext(CommonExamContext);
|
16
|
+
const { displayNumber, maxScore, level } = useContext(QuestionContext);
|
17
|
+
const { t } = useExamTranslation();
|
18
|
+
const showAttachmentLinks = true;
|
19
|
+
const { isInSidebar } = useContext(TOCContext);
|
20
|
+
const questionTitle = findChildElement(element, 'question-title');
|
21
|
+
const externalMaterial = showAttachmentLinks && displayNumber != null && query(element, 'external-material');
|
22
|
+
const subquestions = [];
|
23
|
+
let answersById = {};
|
24
|
+
let hasQuestionValidationError = false;
|
25
|
+
if (isInSidebar) {
|
26
|
+
const answers = useSelector((state) => state.answers);
|
27
|
+
answersById = (answers === null || answers === void 0 ? void 0 : answers.answersById) || {};
|
28
|
+
const subquestionNodes = element.querySelectorAll('[question-id]');
|
29
|
+
const questionValidationErrors = (_a = answers.validationErrors) === null || _a === void 0 ? void 0 : _a.filter(i => (i === null || i === void 0 ? void 0 : i.elementType) === 'question');
|
30
|
+
hasQuestionValidationError = !!(questionValidationErrors === null || questionValidationErrors === void 0 ? void 0 : questionValidationErrors.find(i => i.displayNumber === displayNumber));
|
31
|
+
subquestionNodes.forEach(e => {
|
32
|
+
var _a;
|
33
|
+
const id = Number(e.getAttribute('question-id'));
|
34
|
+
const type = e.getAttribute('type') || '';
|
35
|
+
const subQuestionDisplayNumber = e.getAttribute('display-number') || '';
|
36
|
+
const hasError = !!(questionValidationErrors === null || questionValidationErrors === void 0 ? void 0 : questionValidationErrors.find(i => i.displayNumber === subQuestionDisplayNumber));
|
37
|
+
const childQuestionHasError = questionValidationErrors
|
38
|
+
.flatMap(i => ('childQuestions' in i ? i.childQuestions : []))
|
39
|
+
.includes(subQuestionDisplayNumber);
|
40
|
+
const hasAnswer = !!((_a = answersById[id]) === null || _a === void 0 ? void 0 : _a.value);
|
41
|
+
if (id) {
|
42
|
+
subquestions.push({
|
43
|
+
id,
|
44
|
+
type,
|
45
|
+
error: hasError || (childQuestionHasError && hasAnswer),
|
46
|
+
displayNumber: Number(subQuestionDisplayNumber)
|
47
|
+
});
|
48
|
+
}
|
49
|
+
});
|
50
|
+
}
|
51
|
+
const subQuestionError = !!subquestions.find(i => i.error);
|
52
|
+
const subquestionsAnswered = subquestions === null || subquestions === void 0 ? void 0 : subquestions.filter(i => { var _a; return (_a = answersById[i.id]) === null || _a === void 0 ? void 0 : _a.value; }).length;
|
53
|
+
const maxAnswers = Number(element.getAttribute('max-answers'));
|
54
|
+
const requiredAnswers = maxAnswers || subquestions.length;
|
55
|
+
const isVisible = useIsElementInViewport('question', displayNumber);
|
56
|
+
return (React.createElement("li", { "data-list-number": `${displayNumber}.`, onClick: () => (isInSidebar ? (window.location.href = `#question-nr-${displayNumber}`) : undefined), className: classNames(`level-${level}`, { error: hasQuestionValidationError, current: isVisible }) },
|
57
|
+
React.createElement("span", { className: "e-column e-question-title" },
|
58
|
+
React.createElement("a", { href: url('', { hash: `question-nr-${displayNumber}` }), tabIndex: isInSidebar ? -1 : undefined },
|
59
|
+
React.createElement("span", null, renderChildNodes(questionTitle)))),
|
60
|
+
React.createElement("div", { className: classNames('numeric-answer-indicator', {
|
61
|
+
error: subQuestionError,
|
62
|
+
ok: subquestionsAnswered === requiredAnswers
|
63
|
+
}) },
|
64
|
+
subquestionsAnswered,
|
65
|
+
"/",
|
66
|
+
requiredAnswers),
|
67
|
+
!isInSidebar && externalMaterial && (React.createElement("span", { className: "e-column e-column--narrow e-external-material" },
|
68
|
+
React.createElement("a", { href: url(attachmentsURL, {
|
69
|
+
hash: getAttribute(queryAncestors(externalMaterial, 'question'), 'display-number')
|
70
|
+
}), target: "attachments" }, t('material')))),
|
71
|
+
React.createElement("span", { className: "e-column e-column--narrow table-of-contents--score-column" }, t('points', { count: maxScore })),
|
72
|
+
isInSidebar && (React.createElement("span", { className: "e-column e-column--narrow e-external-material" }, externalMaterial && React.createElement(FontAwesomeIcon, { size: "sm", icon: faPaperclip, fixedWidth: true }))),
|
73
|
+
React.createElement("div", { className: "answers" },
|
74
|
+
subquestions.map(i => (React.createElement(Indicator, { key: i.id, type: i.type, id: i.id, answer: answersById[i.id], error: i.error, displayNumber: i.displayNumber }))),
|
75
|
+
' ')));
|
76
|
+
};
|
77
|
+
//# sourceMappingURL=TOCQuestion.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TOCQuestion.js","sourceRoot":"","sources":["../../../src/components/shared/TOCQuestion.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAC/D,OAAO,EAAE,eAAe,E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IACR,GAAG,EAAE,CAAC,CAAC,EAAE,EACT,IAAI,EAAE,CAAC,CAAC,IAAI,EACZ,EAAE,EAAE,CAAC,CAAC,EAAE,EACR,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EACzB,KAAK,EAAE,CAAC,CAAC,KAAK,EACd,aAAa,EAAE,CAAC,CAAC,aAAa,GAC9B,CACH,CAAC;YAAE,GAAG,CACH,CACH,CACN,CAAA;AACH,CAAC,CAAA"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ExamComponentProps } from '../../createRenderChildNodes';
|
3
|
+
import { AnswersState } from '../../store/answers/reducer';
|
4
|
+
export declare const TOCSection: React.FunctionComponent<ExamComponentProps & {
|
5
|
+
answers: AnswersState;
|
6
|
+
}>;
|
7
|
+
//# sourceMappingURL=TOCSection.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TOCSection.d.ts","sourceRoot":"","sources":["../../../src/components/shared/TOCSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAiB,MAAM,8BAA8B,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAM1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,iBAAiB,CAAC,kBAAkB,GAAG;IAAE,OAAO,EAAE,YAAY,CAAA;CAAE,CAwB9F,CAAA"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React, { useContext } from 'react';
|
2
|
+
import { SectionContext } from '../context/SectionContext';
|
3
|
+
import { findChildElement } from '../../dom-utils';
|
4
|
+
import { TOCSectionTitle } from './TOCSectionTitle';
|
5
|
+
import { tocSectionTitleId } from '../../ids';
|
6
|
+
export const TOCSection = ({ element, answers, renderChildNodes }) => {
|
7
|
+
const { displayNumber } = useContext(SectionContext);
|
8
|
+
const sectionTitle = findChildElement(element, 'section-title');
|
9
|
+
return (React.createElement("li", { "data-section-id": displayNumber },
|
10
|
+
sectionTitle && (React.createElement(TOCSectionTitle, { element: sectionTitle,
|
11
|
+
renderChildNodes,
|
12
|
+
answers })),
|
13
|
+
React.createElement("ol", { className: "e-list-data e-pad-l-0", "aria-labelledby": sectionTitle && tocSectionTitleId(displayNumber) }, renderChildNodes(element, 1 /* RenderOptions.SkipHTML */))));
|
14
|
+
};
|
15
|
+
//# sourceMappingURL=TOCSection.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TOCSection.js","sourceRoot":"","sources":["../../../src/components/shared/TOCSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE7C,MAAM,CAAC,MAAM,UAAU,GAA4E,CAAC,EAClG,OAAO,EACP,OAAO,EACP,gBAAgB,EACjB,EAAE,EAAE;IACH,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAA;IACpD,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAA;IAE/D,OAAO,CACL,+CAAqB,aAAa;QAC/B,YAAY,IAAI,CACf,oBAAC,eAAe,IAEZ,OAAO,EAAE,YAAY;YACrB,gBAAgB;YAChB,OAAO,GAET,CACH;QACD,4BAAI,SAAS,EAAC,uBAAuB,qBAAkB,YAAY,IAAI,iBAAiB,CAAC,aAAa,CAAC,IACpG,gBAAgB,CAAC,OAAO,iCAAyB,CAC/C,CACF,CACN,CAAA;AACH,CAAC,CAAA"}
|