@digabi/exam-engine-core 16.4.1 → 16.4.7-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/components/exam/ChoiceAnswer.d.ts +2 -9
- package/dist/components/exam/ChoiceAnswer.d.ts.map +1 -1
- package/dist/components/exam/ChoiceAnswer.js +15 -20
- package/dist/components/exam/ChoiceAnswer.js.map +1 -1
- package/dist/components/exam/DropdownAnswer.d.ts +2 -9
- package/dist/components/exam/DropdownAnswer.d.ts.map +1 -1
- package/dist/components/exam/DropdownAnswer.js +8 -13
- package/dist/components/exam/DropdownAnswer.js.map +1 -1
- package/dist/components/exam/Hints.d.ts.map +1 -1
- package/dist/components/exam/Hints.js.map +1 -1
- package/dist/components/exam/Question.d.ts.map +1 -1
- package/dist/components/exam/Question.js.map +1 -1
- package/dist/components/exam/Section.d.ts.map +1 -1
- package/dist/components/exam/Section.js.map +1 -1
- package/dist/components/exam/TextAnswer.d.ts.map +1 -1
- package/dist/components/exam/TextAnswer.js +3 -13
- package/dist/components/exam/TextAnswer.js.map +1 -1
- package/dist/components/exam/internal/ErrorIndicator.d.ts.map +1 -1
- package/dist/components/exam/internal/ErrorIndicator.js.map +1 -1
- package/dist/components/exam/internal/TextAnswerInput.d.ts +1 -35
- package/dist/components/exam/internal/TextAnswerInput.d.ts.map +1 -1
- package/dist/components/exam/internal/TextAnswerInput.js +98 -129
- package/dist/components/exam/internal/TextAnswerInput.js.map +1 -1
- package/dist/components/results/internal/QuestionAutoScore.js +1 -1
- package/dist/components/results/internal/QuestionAutoScore.js.map +1 -1
- package/dist/components/results/internal/QuestionManualScore.js +1 -1
- package/dist/components/results/internal/QuestionManualScore.js.map +1 -1
- package/dist/i18n/index.d.ts +0 -6
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/main-bundle.js +9 -30
- package/dist/main.css +1 -1
- package/dist/store/index.d.ts +4 -0
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js.map +1 -1
- package/package.json +12 -12
@@ -1,10 +1,10 @@
|
|
1
1
|
import classNames from 'classnames';
|
2
|
-
import React, { useContext } from 'react';
|
3
|
-
import {
|
2
|
+
import React, { useCallback, useContext } from 'react';
|
3
|
+
import { useDispatch, useSelector } from 'react-redux';
|
4
4
|
import { getNumericAttribute, mapChildElements, query } from '../../dom-utils';
|
5
|
-
import * as actions from '../../store/answers/actions';
|
6
5
|
import { QuestionContext } from '../context/QuestionContext';
|
7
|
-
|
6
|
+
import { saveAnswer } from '../../store/answers/actions';
|
7
|
+
const ChoiceAnswerOption = ({ selected, element, renderChildNodes, questionId, onSelect, direction, value, }) => {
|
8
8
|
const className = element.getAttribute('class');
|
9
9
|
const content = (React.createElement("div", { className: classNames('e-choice-answer-option e-column', className, {
|
10
10
|
'e-choice-answer-option--selected': selected,
|
@@ -18,16 +18,18 @@ function ChoiceAnswerOption({ selected, element, renderChildNodes, questionId, o
|
|
18
18
|
React.createElement("label", { className: "e-block e-text-center" },
|
19
19
|
React.createElement("input", { type: "radio", className: "e-radio-button", name: String(questionId), onChange: onSelect, value: value, checked: selected }),
|
20
20
|
content)));
|
21
|
-
}
|
22
|
-
|
23
|
-
const { questionLabelIds } = useContext(QuestionContext);
|
21
|
+
};
|
22
|
+
const ChoiceAnswer = ({ element, renderChildNodes }) => {
|
24
23
|
const questionId = getNumericAttribute(element, 'question-id');
|
24
|
+
const displayNumber = element.getAttribute('display-number');
|
25
25
|
const direction = element.getAttribute('direction') || 'vertical';
|
26
26
|
const className = element.getAttribute('class');
|
27
|
-
const
|
28
|
-
const
|
29
|
-
|
30
|
-
|
27
|
+
const { questionLabelIds } = useContext(QuestionContext);
|
28
|
+
const answer = useSelector((state) => state.answers.answersById[questionId]);
|
29
|
+
const dispatch = useDispatch();
|
30
|
+
const onSelect = useCallback((event) => {
|
31
|
+
dispatch(saveAnswer({ type: 'choice', questionId, value: event.currentTarget.value, displayNumber }));
|
32
|
+
}, [questionId, displayNumber]);
|
31
33
|
return (React.createElement("div", { className: classNames('e-choice-answer e-mrg-b-4', className, {
|
32
34
|
'e-columns': direction === 'horizontal',
|
33
35
|
}), "data-question-id": questionId, role: "radiogroup", "aria-labelledby": questionLabelIds }, mapChildElements(element, (childElement) => {
|
@@ -46,13 +48,6 @@ function ChoiceAnswer({ answer, saveAnswer, element, renderChildNodes }) {
|
|
46
48
|
value,
|
47
49
|
} }));
|
48
50
|
})));
|
49
|
-
}
|
50
|
-
|
51
|
-
const questionId = getNumericAttribute(element, 'question-id');
|
52
|
-
const answer = state.answers.answersById[questionId];
|
53
|
-
return { answer };
|
54
|
-
}
|
55
|
-
export default connect(mapStateToProps, {
|
56
|
-
saveAnswer: actions.saveAnswer,
|
57
|
-
})(ChoiceAnswer);
|
51
|
+
};
|
52
|
+
export default React.memo(ChoiceAnswer);
|
58
53
|
//# sourceMappingURL=ChoiceAnswer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChoiceAnswer.js","sourceRoot":"","sources":["../../../src/components/exam/ChoiceAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"ChoiceAnswer.js","sourceRoot":"","sources":["../../../src/components/exam/ChoiceAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAG9E,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4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ACpE,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAA;QACxC,MAAM,QAAQ,GAAG,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,CAAA;QAEzD,OAAO,CACL,oBAAC,kBAAkB,OACb;gBACF,OAAO,EAAE,YAAY;gBACrB,QAAQ;gBACR,gBAAgB;gBAChB,UAAU;gBACV,GAAG,EAAE,QAAQ;gBACb,SAAS;gBACT,QAAQ;gBACR,KAAK;aACN,GACD,CACH,CAAA;IACH,CAAC,CAAC,CACE,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA"}
|
@@ -1,12 +1,5 @@
|
|
1
|
-
|
1
|
+
import React from 'react';
|
2
2
|
import { ExamComponentProps } from '../../createRenderChildNodes';
|
3
|
-
|
4
|
-
import { ChoiceAnswer as ChoiceAnswerT } from '../../types/ExamAnswer';
|
5
|
-
interface DropdownAnswerProps extends ExamComponentProps {
|
6
|
-
saveAnswer: typeof actions.saveAnswer;
|
7
|
-
answer?: ChoiceAnswerT;
|
8
|
-
}
|
9
|
-
declare function DropdownAnswer({ element, renderChildNodes, saveAnswer, answer }: DropdownAnswerProps): JSX.Element;
|
10
|
-
declare const _default: import("react-redux").ConnectedComponent<typeof DropdownAnswer, import("react-redux").Omit<DropdownAnswerProps, "saveAnswer" | "answer"> & ExamComponentProps>;
|
3
|
+
declare const _default: React.NamedExoticComponent<ExamComponentProps>;
|
11
4
|
export default _default;
|
12
5
|
//# sourceMappingURL=DropdownAnswer.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DropdownAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/exam/DropdownAnswer.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"DropdownAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/exam/DropdownAnswer.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAkD,MAAM,OAAO,CAAA;AAEtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;;AA2IjE,wBAAyC"}
|
@@ -4,21 +4,23 @@ import classNames from 'classnames';
|
|
4
4
|
import { useSelect } from 'downshift';
|
5
5
|
import * as _ from 'lodash-es';
|
6
6
|
import React, { useContext, useEffect, useRef, useState } from 'react';
|
7
|
-
import {
|
7
|
+
import { useDispatch, useSelector } from 'react-redux';
|
8
8
|
import { findChildElement, getNumericAttribute, mapChildElements, NBSP } from '../../dom-utils';
|
9
9
|
import * as fonts from '../../fonts';
|
10
10
|
import { useExamTranslation } from '../../i18n';
|
11
11
|
import { answerScoreId } from '../../ids';
|
12
|
-
import * as actions from '../../store/answers/actions';
|
13
12
|
import { QuestionContext } from '../context/QuestionContext';
|
14
13
|
import { Score } from '../shared/Score';
|
14
|
+
import { saveAnswer } from '../../store/answers/actions';
|
15
15
|
const menuBorderWidthPx = 2;
|
16
16
|
const roundingErrorCompensationPx = 1;
|
17
17
|
const noAnswer = '';
|
18
18
|
const runningInBrowser = !navigator.userAgent.includes('jsdom/');
|
19
|
-
|
19
|
+
const DropdownAnswer = ({ element, renderChildNodes }) => {
|
20
20
|
const questionId = getNumericAttribute(element, 'question-id');
|
21
21
|
const maxScore = getNumericAttribute(element, 'max-score');
|
22
|
+
const answer = useSelector((state) => state.answers.answersById[questionId]);
|
23
|
+
const dispatch = useDispatch();
|
22
24
|
const displayNumber = element.getAttribute('display-number');
|
23
25
|
const currentlySelectedItem = answer &&
|
24
26
|
answer.value &&
|
@@ -53,7 +55,7 @@ function DropdownAnswer({ element, renderChildNodes, saveAnswer, answer }) {
|
|
53
55
|
itemToString: (item) => (item ? item.textContent : ''),
|
54
56
|
onSelectedItemChange: ({ selectedItem }) => {
|
55
57
|
const value = selectedItem ? selectedItem.getAttribute('option-id') : '';
|
56
|
-
saveAnswer({ type: 'choice', questionId, value, displayNumber });
|
58
|
+
dispatch(saveAnswer({ type: 'choice', questionId, value, displayNumber }));
|
57
59
|
},
|
58
60
|
initialSelectedItem: currentlySelectedItem,
|
59
61
|
});
|
@@ -85,13 +87,6 @@ function DropdownAnswer({ element, renderChildNodes, saveAnswer, answer }) {
|
|
85
87
|
}) },
|
86
88
|
React.createElement("span", { className: classNames('e-dropdown-answer__menu-item-inner e-block', { 'e-nowrap': measuring }) }, item ? renderChildNodes(item) : React.createElement("span", { "aria-label": t.raw('dropdown-answer.clear') }, NBSP))))))),
|
87
89
|
answers.length > 1 && React.createElement(Score, { score: maxScore, size: 'inline', id: scoreId })));
|
88
|
-
}
|
89
|
-
|
90
|
-
const questionId = getNumericAttribute(element, 'question-id');
|
91
|
-
const answer = state.answers.answersById[questionId];
|
92
|
-
return { answer };
|
93
|
-
}
|
94
|
-
export default connect(mapStateToprops, {
|
95
|
-
saveAnswer: actions.saveAnswer,
|
96
|
-
})(DropdownAnswer);
|
90
|
+
};
|
91
|
+
export default React.memo(DropdownAnswer);
|
97
92
|
//# sourceMappingURL=DropdownAnswer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DropdownAnswer.js","sourceRoot":"","sources":["../../../src/components/exam/DropdownAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACtE,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"DropdownAnswer.js","sourceRoot":"","sources":["../../../src/components/exam/DropdownAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa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AwC,EAAE,IAAI,KAAK,YAAY;oBAC/D,sBAAsB,EAAE,gBAAgB,KAAK,CAAC;oBAC9C,mCAAmC,EAAE,gBAAgB,KAAK,CAAC;iBAC5D,CAAC,EACF,GAAG,EAAE,CAAC,KACF,YAAY,CAAC;oBACf,IAAI;oBACJ,KAAK,EAAE,CAAC;iBACT,CAAC;gBAGF,8BAAM,SAAS,EAAE,UAAU,CAAC,4CAA4C,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,IACjG,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,4CAAkB,CAAC,CAAC,GAAG,CAAC,uBAAuB,CAAC,IAAG,IAAI,CAAQ,CAC3F,CACF,CACR,CAAC,CACG,CACF;QACN,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,oBAAC,KAAK,IAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,GAAI,CACzE,CACR,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Hints.d.ts","sourceRoot":"","sources":["../../../src/components/exam/Hints.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAoB,MAAM,8BAA8B,CAAA;
|
1
|
+
{"version":3,"file":"Hints.d.ts","sourceRoot":"","sources":["../../../src/components/exam/Hints.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAoB,MAAM,8BAA8B,CAAA;AAKnF,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,kBAAkB,CAqBtD,CAAA;AAiCD,eAAe,KAAK,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Hints.js","sourceRoot":"","sources":["../../../src/components/exam/Hints.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;
|
1
|
+
{"version":3,"file":"Hints.js","sourceRoot":"","sources":["../../../src/components/exam/Hints.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAG7D,MAAM,KAAK,GAAgD,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,EAAE;IAC3F,MAAM,iBAAiB,GAAG,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACjF,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAC,CAAC,MAAM,CACtF,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,IAAI,CACrD,CAAA;IAED,OAAO,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACnC,6BAAK,SAAS,EAAC,WAAW;QACxB,6BAAK,SAAS,EAAC,sBAAsB,IAAE,gBAAgB,CAAC,OAAO,CAAC,CAAO;QAIvE,6BAAK,SAAS,EAAC,8BAA8B,iBAAa,MAAM,IAC7D,gBAAgB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CACnC,oBAAC,IAAI,OAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,EAAE,GAAG,EAAE,CAAC,GAAI,CACtE,CAAC,CACE,CACF,CACP,CAAC,CAAC,CAAC,CACF,0CAAG,gBAAgB,CAAC,OAAO,CAAC,CAAI,CACjC,CAAA;AACH,CAAC,CAAA;AAED,SAAS,IAAI,CAAC,EACZ,MAAM,EACN,iBAAiB,EACjB,gBAAgB,GAKjB;IACC,MAAM,UAAU,GAAG,mBAAmB,CAAC,MAAM,EAAE,aAAa,CAAE,CAAA;IAC9D,MAAM,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAE,CAAA;IAC5D,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAE,CAAA;IAE9C,OAAO,CACL,2BACE,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE;YACrC,wBAAwB,EAAE,iBAAiB,KAAK,UAAU;SAC3D,CAAC,EACF,OAAO,EAAE,GAAG,EAAE;YACZ,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAc,kCAAkC,UAAU,IAAI,CAAC,CAAA;YACtG,IAAI,QAAQ,EAAE;gBACZ,QAAQ,CAAC,KAAK,EAAE,CAAA;aACjB;QACH,CAAC,sBACiB,UAAU;QAE3B,kBAAkB,CAAC,aAAa,CAAC;;QAAG,gBAAgB,CAAC,IAAI,CAAC,CACzD,CACL,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Question.d.ts","sourceRoot":"","sources":["../../../src/components/exam/Question.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"Question.d.ts","sourceRoot":"","sources":["../../../src/components/exam/Question.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;;AAoBjE,wBAAwD"}
|
@@ -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,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;
|
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,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAG1D,SAAS,QAAQ,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAsB;IACjE,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IAC7D,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAA;IACnD,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IAE5D,OAAO,CAAC,YAAY,IAAI,SAAS,KAAK,WAAW,CAAC,CAAC,CAAC,CAClD,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,IAEhB,gBAAgB,CAAC,OAAO,CAAC,CACtB,CACP,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":"Section.d.ts","sourceRoot":"","sources":["../../../src/components/exam/Section.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;;
|
1
|
+
{"version":3,"file":"Section.d.ts","sourceRoot":"","sources":["../../../src/components/exam/Section.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;;AAqFjE,wBAAsD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Section.js","sourceRoot":"","sources":["../../../src/components/exam/Section.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;
|
1
|
+
{"version":3,"file":"Section.js","sourceRoot":"","sources":["../../../src/components/exam/Section.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,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AAC,iBAAiB,IAAI,CAAC,CAAC,KAAK,EAAE,sBACrE,qCAAqC,IAErD,CAAC,CAAC,qBAAqB,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,iBAAiB,EAAE,CAAC,CACtD,CACL,CACP,CAAC,CAAC,CAAC,CACF,6BAAK,SAAS,EAAC,oCAAoC,IAAE,CAAC,CAAC,sBAAsB,CAAC,CAAO,CACtF,CACG,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/exam/TextAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"TextAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/exam/TextAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAGjE,iBAAS,UAAU,CAAC,KAAK,EAAE,kBAAkB,eAe5C;;AAED,wBAAqC"}
|
@@ -1,23 +1,13 @@
|
|
1
|
-
import React
|
2
|
-
import { findChildElement
|
1
|
+
import React from 'react';
|
2
|
+
import { findChildElement } from '../../dom-utils';
|
3
3
|
import { shortDisplayNumber } from '../../shortDisplayNumber';
|
4
4
|
import TextAnswerInput from './internal/TextAnswerInput';
|
5
5
|
import { ScreenReaderOnly } from '../ScreenReaderOnly';
|
6
|
-
import { QuestionContext } from '../context/QuestionContext';
|
7
|
-
import { answerLengthInfoId } from '../../ids';
|
8
|
-
import { CommonExamContext } from '../context/CommonExamContext';
|
9
6
|
function TextAnswer(props) {
|
10
7
|
const { element, renderChildNodes } = props;
|
11
|
-
const { language } = useContext(CommonExamContext);
|
12
|
-
const { questionLabelIds } = useContext(QuestionContext);
|
13
8
|
const displayNumber = element.getAttribute('display-number');
|
14
9
|
const hint = findChildElement(element, 'hint');
|
15
|
-
const
|
16
|
-
const lang = useLanguageOfInstruction ? language : undefined;
|
17
|
-
const labelledBy = element.hasAttribute('max-length')
|
18
|
-
? questionLabelIds + ' ' + answerLengthInfoId(element)
|
19
|
-
: questionLabelIds;
|
20
|
-
const textAnswer = React.createElement(TextAnswerInput, { ...{ ...props, lang, labelledBy } });
|
10
|
+
const textAnswer = React.createElement(TextAnswerInput, { ...props });
|
21
11
|
return hint ? (React.createElement("label", { className: "e-nowrap" },
|
22
12
|
React.createElement("sup", { className: "e-text-answer-display-number e-color-darkgrey" }, shortDisplayNumber(displayNumber)),
|
23
13
|
React.createElement(ScreenReaderOnly, null, renderChildNodes(hint)),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextAnswer.js","sourceRoot":"","sources":["../../../src/components/exam/TextAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"TextAnswer.js","sourceRoot":"","sources":["../../../src/components/exam/TextAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,eAAe,MAAM,4BAA4B,CAAA;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,SAAS,UAAU,CAAC,KAAyB;IAC3C,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAA;IAC3C,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAE,CAAA;IAC7D,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC9C,MAAM,UAAU,GAAG,oBAAC,eAAe,OAAK,KAAK,GAAI,CAAA;IAEjD,OAAO,IAAI,CAAC,CAAC,CAAC,CACZ,+BAAO,SAAS,EAAC,UAAU;QACzB,6BAAK,SAAS,EAAC,+CAA+C,IAAE,kBAAkB,CAAC,aAAa,CAAC,CAAO;QACxG,oBAAC,gBAAgB,QAAE,gBAAgB,CAAC,IAAI,CAAC,CAAoB;QAC5D,UAAU,CACL,CACT,CAAC,CAAC,CAAC,CACF,UAAU,CACX,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/exam/internal/ErrorIndicator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAA;;
|
1
|
+
{"version":3,"file":"ErrorIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/exam/internal/ErrorIndicator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAA;;AA6EzC,wBAAyC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorIndicator.js","sourceRoot":"","sources":["../../../../src/components/exam/internal/ErrorIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;
|
1
|
+
{"version":3,"file":"ErrorIndicator.js","sourceRoot":"","sources":["../../../../src/components/exam/internal/ErrorIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAA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eAAe,CAAC,CAAA;YAC/D,IAAI,YAAY,EAAE;gBAChB,OAAO,0CAAG,YAAY,CAAC,WAAY,CAAC,IAAI,EAAE,GAAG,GAAG,CAAI,CAAA;aACrD;SACF;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA"}
|
@@ -1,40 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ExamComponentProps } from '../../../createRenderChildNodes';
|
3
|
-
import * as actions from '../../../store/answers/actions';
|
4
|
-
import { RichTextAnswer as RichTextAnswerT, TextAnswer as TextAnswerT } from '../../../types/ExamAnswer';
|
5
|
-
import { ScreenshotError } from '../RichTextAnswer';
|
6
|
-
import { AnswerTooLong } from '../../../validateAnswers';
|
7
|
-
interface Props extends ExamComponentProps {
|
8
|
-
answer?: TextAnswerT | RichTextAnswerT;
|
9
|
-
answerBlurred: typeof actions.answerBlurred;
|
10
|
-
answerFocused: typeof actions.answerFocused;
|
11
|
-
saveAnswer: typeof actions.saveAnswer;
|
12
|
-
selectAnswerVersion: typeof actions.selectAnswerVersion;
|
13
|
-
showAnswerHistory: boolean;
|
14
|
-
supportsAnswerHistory: boolean;
|
15
|
-
type: 'rich-text' | 'multi-line' | 'single-line';
|
16
|
-
validationError?: AnswerTooLong;
|
17
|
-
labelledBy: string;
|
18
|
-
lang?: string;
|
19
|
-
}
|
20
|
-
interface State {
|
21
|
-
screenshotError?: ScreenshotError;
|
22
|
-
}
|
23
|
-
export declare class TextAnswerInput extends React.PureComponent<Props, State> {
|
24
|
-
private ref;
|
25
|
-
constructor(props: Props);
|
26
|
-
componentDidMount(): void;
|
27
|
-
componentDidUpdate(): void;
|
28
|
-
onChange: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
29
|
-
onRichTextChange: (answerHtml: string, answerText: string) => void;
|
30
|
-
onFocus: () => void;
|
31
|
-
onBlur: () => void;
|
32
|
-
onError: (screenshotError: ScreenshotError) => void;
|
33
|
-
clearErrors: () => void;
|
34
|
-
resize(): void;
|
35
|
-
render(): React.ReactNode;
|
36
|
-
}
|
37
3
|
export declare function getCharacterCount(answerText: string): number;
|
38
|
-
declare const _default:
|
4
|
+
declare const _default: React.NamedExoticComponent<ExamComponentProps>;
|
39
5
|
export default _default;
|
40
6
|
//# sourceMappingURL=TextAnswerInput.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextAnswerInput.d.ts","sourceRoot":"","sources":["../../../../src/components/exam/internal/TextAnswerInput.tsx"],"names":[],"mappings":"AACA,OAAO,
|
1
|
+
{"version":3,"file":"TextAnswerInput.d.ts","sourceRoot":"","sources":["../../../../src/components/exam/internal/TextAnswerInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+D,MAAM,OAAO,CAAA;AAEnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AA2LpE,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE5D;;AAED,wBAA0C"}
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import classNames from 'classnames';
|
2
|
-
import React from 'react';
|
3
|
-
import {
|
4
|
-
import { getAttribute, getNumericAttribute } from '../../../dom-utils';
|
5
|
-
import * as actions from '../../../store/answers/actions';
|
2
|
+
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
3
|
+
import { useDispatch, useSelector } from 'react-redux';
|
4
|
+
import { getAttribute, getBooleanAttribute, getNumericAttribute } from '../../../dom-utils';
|
6
5
|
import AnswerToolbar from '../../AnswerToolbar';
|
7
6
|
import { ExamContext } from '../../context/ExamContext';
|
8
7
|
import { QuestionContext } from '../../context/QuestionContext';
|
@@ -10,145 +9,115 @@ import RichTextAnswer from '../RichTextAnswer';
|
|
10
9
|
import { Score } from '../../shared/Score';
|
11
10
|
import { answerLengthInfoId, answerScoreId } from '../../../ids';
|
12
11
|
import AnswerLengthInfo from '../../shared/AnswerLengthInfo';
|
12
|
+
import { CommonExamContext } from '../../context/CommonExamContext';
|
13
|
+
import { answerBlurred, answerFocused, saveAnswer, selectAnswerVersion } from '../../../store/answers/actions';
|
13
14
|
const borderWidthPx = 2;
|
14
15
|
const borderHeightPx = 1;
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
saveAnswer(answer);
|
45
|
-
this.clearErrors();
|
46
|
-
};
|
47
|
-
this.onFocus = () => {
|
48
|
-
this.props.answerFocused(getNumericAttribute(this.props.element, 'question-id'));
|
49
|
-
};
|
50
|
-
this.onBlur = () => {
|
51
|
-
this.props.answerBlurred(getNumericAttribute(this.props.element, 'question-id'));
|
52
|
-
};
|
53
|
-
this.onError = (screenshotError) => {
|
54
|
-
this.setState({
|
55
|
-
screenshotError,
|
56
|
-
});
|
57
|
-
};
|
58
|
-
this.clearErrors = () => {
|
59
|
-
this.setState({ screenshotError: undefined });
|
60
|
-
};
|
61
|
-
this.state = {};
|
62
|
-
this.ref = React.createRef();
|
63
|
-
}
|
64
|
-
componentDidMount() {
|
65
|
-
this.resize();
|
66
|
-
}
|
67
|
-
componentDidUpdate() {
|
68
|
-
this.resize();
|
69
|
-
}
|
70
|
-
resize() {
|
71
|
-
const { current } = this.ref;
|
16
|
+
const TextAnswerInput = ({ element, className }) => {
|
17
|
+
const type = getAttribute(element, 'type');
|
18
|
+
const questionId = getNumericAttribute(element, 'question-id');
|
19
|
+
const displayNumber = getAttribute(element, 'display-number');
|
20
|
+
const maxScore = getNumericAttribute(element, 'max-score');
|
21
|
+
const useLanguageOfInstruction = getBooleanAttribute(element, 'use-language-of-instruction');
|
22
|
+
const maxLength = getNumericAttribute(element, 'max-length');
|
23
|
+
const { language } = useContext(CommonExamContext);
|
24
|
+
const { questionLabelIds, answers } = useContext(QuestionContext);
|
25
|
+
const { examServerApi } = useContext(ExamContext);
|
26
|
+
const [screenshotError, setScreenshotError] = useState();
|
27
|
+
const { answer, supportsAnswerHistory, showAnswerHistory, validationError } = useSelector((state) => {
|
28
|
+
const answer = state.answers.answersById[questionId];
|
29
|
+
const supportsAnswerHistory = state.answers.supportsAnswerHistory;
|
30
|
+
const showAnswerHistory = state.answers.supportsAnswerHistory && state.answers.serverQuestionIds.has(questionId);
|
31
|
+
const validationError = state.answers.validationErrors.find((error) => error.type === 'AnswerTooLong' && error.displayNumber === displayNumber);
|
32
|
+
return { answer, supportsAnswerHistory, showAnswerHistory, validationError };
|
33
|
+
});
|
34
|
+
const dispatch = useDispatch();
|
35
|
+
const ref = useRef(null);
|
36
|
+
const value = answer && answer.value;
|
37
|
+
const scoreId = answerScoreId(element);
|
38
|
+
const invalid = validationError != null;
|
39
|
+
const lang = useLanguageOfInstruction ? language : undefined;
|
40
|
+
const labelledBy = element.hasAttribute('max-length')
|
41
|
+
? questionLabelIds + ' ' + answerLengthInfoId(element)
|
42
|
+
: questionLabelIds;
|
43
|
+
useEffect(() => {
|
44
|
+
const { current } = ref;
|
72
45
|
if (current) {
|
73
|
-
if (
|
46
|
+
if (type === 'multi-line') {
|
74
47
|
const { scrollX, scrollY } = window;
|
75
48
|
current.style.height = 'auto';
|
76
49
|
current.style.height = `${current.scrollHeight + borderHeightPx}px`;
|
77
50
|
window.scrollTo(scrollX, scrollY);
|
78
51
|
}
|
79
|
-
else if (
|
52
|
+
else if (type === 'single-line') {
|
80
53
|
current.style.width = '0';
|
81
54
|
current.style.width = `${current.scrollWidth + borderWidthPx}px`;
|
82
55
|
}
|
83
56
|
}
|
57
|
+
});
|
58
|
+
const onChange = useCallback((event) => {
|
59
|
+
const value = event.currentTarget.value.trim();
|
60
|
+
const answer = {
|
61
|
+
type: 'text',
|
62
|
+
questionId,
|
63
|
+
value,
|
64
|
+
characterCount: getCharacterCount(value),
|
65
|
+
displayNumber,
|
66
|
+
};
|
67
|
+
dispatch(saveAnswer(answer));
|
68
|
+
setScreenshotError(undefined);
|
69
|
+
}, [questionId, displayNumber]);
|
70
|
+
const onRichTextChange = useCallback((answerHtml, answerText) => {
|
71
|
+
const answer = {
|
72
|
+
type: 'richText',
|
73
|
+
questionId,
|
74
|
+
value: answerHtml,
|
75
|
+
characterCount: getCharacterCount(answerText),
|
76
|
+
displayNumber,
|
77
|
+
};
|
78
|
+
dispatch(saveAnswer(answer));
|
79
|
+
setScreenshotError(undefined);
|
80
|
+
}, [questionId, displayNumber]);
|
81
|
+
const onError = useCallback(() => (screenshotError) => setScreenshotError(screenshotError), []);
|
82
|
+
const onFocus = useCallback(() => dispatch(answerFocused(questionId)), [questionId]);
|
83
|
+
const onBlur = useCallback(() => dispatch(answerBlurred(questionId)), [questionId]);
|
84
|
+
const wrappedSelectAnswerVersion = useCallback((questionId, questionText) => dispatch(selectAnswerVersion(questionId, questionText)), []);
|
85
|
+
switch (type) {
|
86
|
+
case 'rich-text':
|
87
|
+
return (React.createElement(React.Fragment, null,
|
88
|
+
maxLength != null && React.createElement(AnswerLengthInfo, { ...{ maxLength, id: answerLengthInfoId(element) } }),
|
89
|
+
React.createElement(RichTextAnswer, { answer: answer, className: classNames('text-answer text-answer--rich-text', className), saveScreenshot: (data) => examServerApi.saveScreenshot(questionId, data), onChange: onRichTextChange, onError: onError, questionId: questionId, lang: lang, invalid: invalid, labelledBy: labelledBy }),
|
90
|
+
React.createElement(AnswerToolbar, { ...{
|
91
|
+
answer,
|
92
|
+
element,
|
93
|
+
selectAnswerVersion: wrappedSelectAnswerVersion,
|
94
|
+
showAnswerHistory,
|
95
|
+
supportsAnswerHistory,
|
96
|
+
screenshotError,
|
97
|
+
validationError,
|
98
|
+
} })));
|
99
|
+
case 'multi-line':
|
100
|
+
return (React.createElement(React.Fragment, null,
|
101
|
+
maxLength != null && React.createElement(AnswerLengthInfo, { ...{ maxLength } }),
|
102
|
+
React.createElement("textarea", { className: classNames('text-answer text-answer--multi-line', className), defaultValue: value, onChange: onChange, onFocus: onFocus, onBlur: onBlur, ref: ref, "data-question-id": questionId, lang: lang, "aria-invalid": invalid, "aria-labelledby": labelledBy }),
|
103
|
+
React.createElement(AnswerToolbar, { ...{
|
104
|
+
answer,
|
105
|
+
element,
|
106
|
+
selectAnswerVersion: wrappedSelectAnswerVersion,
|
107
|
+
showAnswerHistory,
|
108
|
+
supportsAnswerHistory,
|
109
|
+
screenshotError,
|
110
|
+
validationError,
|
111
|
+
} })));
|
112
|
+
case 'single-line':
|
113
|
+
default:
|
114
|
+
return (React.createElement("span", { className: "e-nowrap" },
|
115
|
+
React.createElement("input", { type: "text", className: classNames('text-answer text-answer--single-line', className), defaultValue: value, onChange: onChange, onFocus: onFocus, onBlur: onBlur, ref: ref, "data-question-id": questionId, lang: lang, "aria-describedby": scoreId, "aria-labelledby": labelledBy }),
|
116
|
+
answers.length > 1 && React.createElement(Score, { score: maxScore, size: "inline", id: scoreId })));
|
84
117
|
}
|
85
|
-
|
86
|
-
const { answer, className, element, selectAnswerVersion, showAnswerHistory, supportsAnswerHistory, type, validationError, labelledBy, lang, } = this.props;
|
87
|
-
const { screenshotError } = this.state;
|
88
|
-
const questionId = getNumericAttribute(element, 'question-id');
|
89
|
-
const maxScore = getNumericAttribute(element, 'max-score');
|
90
|
-
const value = answer && answer.value;
|
91
|
-
const scoreId = answerScoreId(element);
|
92
|
-
const maxLength = getNumericAttribute(element, 'max-length');
|
93
|
-
const invalid = validationError != null;
|
94
|
-
switch (type) {
|
95
|
-
case 'rich-text':
|
96
|
-
return (React.createElement(React.Fragment, null,
|
97
|
-
maxLength != null && React.createElement(AnswerLengthInfo, { ...{ maxLength, id: answerLengthInfoId(element) } }),
|
98
|
-
React.createElement(ExamContext.Consumer, null, ({ examServerApi }) => (React.createElement(RichTextAnswer, { answer: answer, className: classNames('text-answer text-answer--rich-text', className), saveScreenshot: (data) => examServerApi.saveScreenshot(questionId, data), onChange: this.onRichTextChange, onError: this.onError, questionId: questionId, lang: lang, invalid: invalid, labelledBy: labelledBy }))),
|
99
|
-
React.createElement(AnswerToolbar, { ...{
|
100
|
-
answer,
|
101
|
-
element,
|
102
|
-
selectAnswerVersion,
|
103
|
-
showAnswerHistory,
|
104
|
-
supportsAnswerHistory,
|
105
|
-
screenshotError,
|
106
|
-
validationError,
|
107
|
-
} })));
|
108
|
-
case 'multi-line':
|
109
|
-
return (React.createElement(React.Fragment, null,
|
110
|
-
maxLength != null && React.createElement(AnswerLengthInfo, { ...{ maxLength } }),
|
111
|
-
React.createElement("textarea", { className: classNames('text-answer text-answer--multi-line', className), defaultValue: value, onChange: this.onChange, onFocus: this.onFocus, onBlur: this.onBlur, ref: this.ref, "data-question-id": questionId, lang: lang, "aria-invalid": invalid, "aria-labelledby": labelledBy }),
|
112
|
-
React.createElement(AnswerToolbar, { ...{
|
113
|
-
answer,
|
114
|
-
element,
|
115
|
-
selectAnswerVersion,
|
116
|
-
showAnswerHistory,
|
117
|
-
supportsAnswerHistory,
|
118
|
-
screenshotError,
|
119
|
-
validationError,
|
120
|
-
} })));
|
121
|
-
case 'single-line':
|
122
|
-
default:
|
123
|
-
return (React.createElement("span", { className: "e-nowrap" },
|
124
|
-
React.createElement("input", { type: "text", className: classNames('text-answer text-answer--single-line', className), defaultValue: value, onChange: this.onChange, onFocus: this.onFocus, onBlur: this.onBlur, ref: this.ref, "data-question-id": questionId, lang: lang, "aria-describedby": scoreId, "aria-labelledby": labelledBy }),
|
125
|
-
React.createElement(QuestionContext.Consumer, null, ({ answers }) => answers.length > 1 && React.createElement(Score, { score: maxScore, size: "inline", id: scoreId }))));
|
126
|
-
}
|
127
|
-
}
|
128
|
-
}
|
118
|
+
};
|
129
119
|
export function getCharacterCount(answerText) {
|
130
120
|
return answerText.replace(/\s/g, '').length;
|
131
121
|
}
|
132
|
-
|
133
|
-
const type = (element.getAttribute('type') || 'single-line');
|
134
|
-
const questionId = getNumericAttribute(element, 'question-id');
|
135
|
-
const displayNumber = getAttribute(element, 'display-number');
|
136
|
-
const answer = state.answers.answersById[questionId];
|
137
|
-
const supportsAnswerHistory = state.answers.supportsAnswerHistory;
|
138
|
-
const showAnswerHistory = state.answers.supportsAnswerHistory && state.answers.serverQuestionIds.has(questionId);
|
139
|
-
const validationError = state.answers.validationErrors.find((error) => error.type === 'AnswerTooLong' && error.displayNumber === displayNumber);
|
140
|
-
return {
|
141
|
-
answer,
|
142
|
-
showAnswerHistory,
|
143
|
-
supportsAnswerHistory,
|
144
|
-
type,
|
145
|
-
validationError,
|
146
|
-
};
|
147
|
-
}
|
148
|
-
export default connect(mapStateToProps, {
|
149
|
-
saveAnswer: actions.saveAnswer,
|
150
|
-
selectAnswerVersion: actions.selectAnswerVersion,
|
151
|
-
answerFocused: actions.answerFocused,
|
152
|
-
answerBlurred: actions.answerBlurred,
|
153
|
-
})(TextAnswerInput);
|
122
|
+
export default React.memo(TextAnswerInput);
|
154
123
|
//# sourceMappingURL=TextAnswerInput.js.map
|