@elice/material-quiz 1.240718.0-trasncript.1 → 1.240718.0-trasncript.2
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/cjs/_virtual/_rollupPluginBabelHelpers.js +423 -0
- package/cjs/components/eb-sortable/EbDraggable.js +42 -33
- package/cjs/components/eb-sortable/EbDroppable.js +27 -20
- package/cjs/components/markdown-editor/index.d.ts +1 -2
- package/cjs/components/markdown-editor/index.js +19 -10
- package/cjs/components/material-quiz/MaterialQuiz.js +114 -83
- package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +36 -29
- package/cjs/components/material-quiz/MaterialQuizInfo.js +151 -149
- package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +175 -127
- package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +360 -286
- package/cjs/components/material-quiz/MaterialQuizSelectOne.js +172 -126
- package/cjs/components/material-quiz/MaterialQuizShimmer.js +46 -39
- package/cjs/components/material-quiz/MaterialQuizText.js +163 -115
- package/cjs/components/material-quiz/QuizResultBadge.js +32 -22
- package/cjs/components/material-quiz/QuizSubmitStatusText.js +21 -16
- package/cjs/components/material-quiz/constants/color.js +5 -5
- package/cjs/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
- package/cjs/components/material-quiz/context/MaterialQuizContext.js +156 -93
- package/cjs/components/material-quiz/index.js +9 -0
- package/cjs/components/material-quiz/locales/index.js +13 -0
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +259 -161
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +134 -100
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +130 -101
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +64 -52
- package/cjs/components/material-quiz/material-quiz-group/context/context.js +5 -1
- package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +47 -36
- package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +280 -232
- package/cjs/components/material-quiz-edit/context.js +8 -2
- package/cjs/components/material-quiz-edit/index.js +7 -0
- package/cjs/components/material-quiz-edit/locales/index.js +13 -0
- package/cjs/components/material-quiz-edit/options/OptionEditor.js +70 -46
- package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +174 -148
- package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +175 -149
- package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +164 -144
- package/cjs/components/material-quiz-edit/options/OptionText.js +90 -82
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +156 -112
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +288 -196
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +88 -75
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +108 -92
- package/cjs/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
- package/cjs/components/material-quiz-edit/utils/editValue.js +21 -12
- package/cjs/components/shared/QuestionBox.js +198 -165
- package/cjs/components/shared/QuizDraggbleDroppedOption.js +11 -12
- package/cjs/components/shared/QuizDraggbleDummyOption.js +23 -16
- package/cjs/components/shared/QuizDraggbleOption.js +65 -59
- package/cjs/components/shared/StyledMarkdown.js +5 -1
- package/cjs/components/shared/index.js +19 -0
- package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +13 -7
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +24 -17
- package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +59 -68
- package/cjs/components/shared/question-radio/QuestionRadio.js +13 -7
- package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/cjs/components/shared/question-radio/QuestionRadioContext.js +24 -17
- package/cjs/components/shared/question-radio/QuestionRadioOption.js +52 -59
- package/cjs/components/shared/utils/getQuestionStatusStyle.js +7 -9
- package/cjs/components/shared/utils/mergeRefs.js +15 -6
- package/cjs/constant/element.js +3 -3
- package/cjs/constant/index.js +9 -0
- package/cjs/helpers/index.js +8 -10
- package/cjs/hooks/index.js +7 -0
- package/cjs/hooks/useCaculatePassage.js +21 -20
- package/es/_virtual/_rollupPluginBabelHelpers.js +408 -0
- package/es/components/eb-sortable/EbDraggable.js +37 -33
- package/es/components/eb-sortable/EbDroppable.js +22 -20
- package/es/components/markdown-editor/index.d.ts +1 -2
- package/es/components/markdown-editor/index.js +15 -10
- package/es/components/material-quiz/MaterialQuiz.js +109 -83
- package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +32 -29
- package/es/components/material-quiz/MaterialQuizInfo.js +148 -150
- package/es/components/material-quiz/MaterialQuizSelectMultiple.js +171 -127
- package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +356 -287
- package/es/components/material-quiz/MaterialQuizSelectOne.js +168 -126
- package/es/components/material-quiz/MaterialQuizShimmer.js +42 -39
- package/es/components/material-quiz/MaterialQuizText.js +158 -115
- package/es/components/material-quiz/QuizResultBadge.js +27 -22
- package/es/components/material-quiz/QuizSubmitStatusText.js +17 -16
- package/es/components/material-quiz/constants/color.js +5 -5
- package/es/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
- package/es/components/material-quiz/context/MaterialQuizContext.js +153 -94
- package/es/components/material-quiz/index.js +2 -0
- package/es/components/material-quiz/locales/index.js +4 -0
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +253 -161
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +129 -100
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +125 -101
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +60 -52
- package/es/components/material-quiz/material-quiz-group/context/context.js +1 -1
- package/es/components/material-quiz-edit/MaterialQuizEdit.js +43 -36
- package/es/components/material-quiz-edit/MaterialQuizEditContent.js +272 -229
- package/es/components/material-quiz-edit/context.js +4 -2
- package/es/components/material-quiz-edit/index.js +1 -0
- package/es/components/material-quiz-edit/locales/index.js +4 -0
- package/es/components/material-quiz-edit/options/OptionEditor.js +64 -46
- package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +170 -148
- package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +171 -149
- package/es/components/material-quiz-edit/options/OptionSelectOne.js +159 -144
- package/es/components/material-quiz-edit/options/OptionText.js +86 -82
- package/es/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
- package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +151 -112
- package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +283 -197
- package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +83 -75
- package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +103 -92
- package/es/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
- package/es/components/material-quiz-edit/utils/editValue.js +17 -12
- package/es/components/shared/QuestionBox.js +192 -165
- package/es/components/shared/QuizDraggbleDroppedOption.js +11 -12
- package/es/components/shared/QuizDraggbleDummyOption.js +19 -16
- package/es/components/shared/QuizDraggbleOption.js +61 -59
- package/es/components/shared/StyledMarkdown.js +1 -1
- package/es/components/shared/index.js +7 -0
- package/es/components/shared/question-checkbox/QuestionCheckbox.js +9 -7
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +20 -17
- package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +54 -68
- package/es/components/shared/question-radio/QuestionRadio.js +9 -7
- package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/es/components/shared/question-radio/QuestionRadioContext.js +20 -17
- package/es/components/shared/question-radio/QuestionRadioOption.js +47 -59
- package/es/components/shared/utils/getQuestionStatusStyle.js +7 -9
- package/es/components/shared/utils/mergeRefs.js +15 -6
- package/es/constant/element.js +3 -3
- package/es/constant/index.js +1 -0
- package/es/helpers/index.js +8 -10
- package/es/hooks/index.js +1 -0
- package/es/hooks/useCaculatePassage.js +21 -20
- package/package.json +12 -15
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { base } from '@elice/design-tokens';
|
|
3
4
|
import styled from 'styled-components';
|
|
@@ -5,12 +6,11 @@ import { WRONG_BACKGROUND_COLOR, CORRECT_BACKGROUND_COLOR } from '../../material
|
|
|
5
6
|
import { getQuestionStatusStyle } from '../utils/getQuestionStatusStyle.js';
|
|
6
7
|
import { useQuestionRadioContext } from './QuestionRadioContext.js';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
var StyledQuestionRadioOption = styled.div.withConfig({
|
|
9
10
|
componentId: "sc-cy66me-0"
|
|
10
|
-
})(["display:flex;align-items:center;padding:0.875rem 1rem;border-radius:8px;background-color:", ";overflow-x:auto;&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], ({
|
|
11
|
-
checked,
|
|
12
|
-
|
|
13
|
-
}) => {
|
|
11
|
+
})(["display:flex;align-items:center;padding:0.875rem 1rem;border-radius:8px;background-color:", ";overflow-x:auto;&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], function (_ref) {
|
|
12
|
+
var checked = _ref.checked,
|
|
13
|
+
status = _ref.status;
|
|
14
14
|
switch (status) {
|
|
15
15
|
case 'correct':
|
|
16
16
|
return CORRECT_BACKGROUND_COLOR;
|
|
@@ -21,17 +21,18 @@ const StyledQuestionRadioOption = styled.div.withConfig({
|
|
|
21
21
|
default:
|
|
22
22
|
return checked ? base.color.primary1 : base.color.navy6;
|
|
23
23
|
}
|
|
24
|
-
}, ({
|
|
25
|
-
disabled
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
}, function (_ref2) {
|
|
25
|
+
var disabled = _ref2.disabled;
|
|
26
|
+
return disabled ? 'not-allowed' : 'pointer';
|
|
27
|
+
}, function (_ref3) {
|
|
28
|
+
var isAnswer = _ref3.isAnswer;
|
|
29
|
+
return isAnswer ? "border: 3px solid ".concat(base.color.green5) : '';
|
|
30
|
+
});
|
|
31
|
+
var StyledQuestionRadioInput = styled.input.withConfig({
|
|
30
32
|
componentId: "sc-cy66me-1"
|
|
31
|
-
})(["flex:none;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:relative;border-radius:50%;width:1rem;height:1rem;margin-right:0.875rem;border:2px solid ", ";", ""], ({
|
|
32
|
-
checked,
|
|
33
|
-
|
|
34
|
-
}) => {
|
|
33
|
+
})(["flex:none;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:relative;border-radius:50%;width:1rem;height:1rem;margin-right:0.875rem;border:2px solid ", ";", ""], function (_ref4) {
|
|
34
|
+
var checked = _ref4.checked,
|
|
35
|
+
status = _ref4.status;
|
|
35
36
|
switch (status) {
|
|
36
37
|
case 'correct':
|
|
37
38
|
return base.color.green9;
|
|
@@ -40,11 +41,10 @@ const StyledQuestionRadioInput = styled.input.withConfig({
|
|
|
40
41
|
default:
|
|
41
42
|
return checked ? base.color.primary6 : base.color.gray3;
|
|
42
43
|
}
|
|
43
|
-
}, ({
|
|
44
|
-
status,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
let bgColor;
|
|
44
|
+
}, function (_ref5) {
|
|
45
|
+
var status = _ref5.status,
|
|
46
|
+
checked = _ref5.checked;
|
|
47
|
+
var bgColor;
|
|
48
48
|
switch (status) {
|
|
49
49
|
case 'correct':
|
|
50
50
|
bgColor = base.color.green9;
|
|
@@ -56,57 +56,45 @@ const StyledQuestionRadioInput = styled.input.withConfig({
|
|
|
56
56
|
bgColor = checked ? base.color.primary6 : status ? base.color.gray3 : 'transparent';
|
|
57
57
|
break;
|
|
58
58
|
}
|
|
59
|
-
return
|
|
60
|
-
&:after {
|
|
61
|
-
content: '';
|
|
62
|
-
position: absolute;
|
|
63
|
-
top: 50%;
|
|
64
|
-
left: 50%;
|
|
65
|
-
transform: translate(-50%, -50%);
|
|
66
|
-
width: 70%;
|
|
67
|
-
height: 70%;
|
|
68
|
-
border-radius: 50%;
|
|
69
|
-
background-color: ${bgColor};
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
59
|
+
return "\n &:after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 70%;\n height: 70%;\n border-radius: 50%;\n background-color: ".concat(bgColor, ";\n }\n ");
|
|
72
60
|
});
|
|
73
|
-
|
|
61
|
+
var StyledLabel = styled.label.withConfig({
|
|
74
62
|
componentId: "sc-cy66me-2"
|
|
75
63
|
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], base.size.body3, getQuestionStatusStyle());
|
|
76
|
-
|
|
77
|
-
value,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
} = useQuestionRadioContext();
|
|
87
|
-
return React.createElement(StyledQuestionRadioOption, {
|
|
64
|
+
var QuestionRadioOption = React.memo(function (_ref6) {
|
|
65
|
+
var value = _ref6.value,
|
|
66
|
+
status = _ref6.status,
|
|
67
|
+
isAnswer = _ref6.isAnswer,
|
|
68
|
+
children = _ref6.children;
|
|
69
|
+
var _useQuestionRadioCont = useQuestionRadioContext(),
|
|
70
|
+
selectedValue = _useQuestionRadioCont.selectedValue,
|
|
71
|
+
disabled = _useQuestionRadioCont.disabled,
|
|
72
|
+
onSelect = _useQuestionRadioCont.onSelect;
|
|
73
|
+
return jsxs(StyledQuestionRadioOption, {
|
|
88
74
|
isAnswer: isAnswer,
|
|
89
75
|
disabled: disabled,
|
|
90
76
|
checked: selectedValue === value,
|
|
91
|
-
onClick: e
|
|
77
|
+
onClick: function onClick(e) {
|
|
92
78
|
e.preventDefault();
|
|
93
79
|
if (disabled) {
|
|
94
80
|
return;
|
|
95
81
|
}
|
|
96
82
|
onSelect(value);
|
|
97
83
|
},
|
|
98
|
-
status: status
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
84
|
+
status: status,
|
|
85
|
+
children: [jsx(StyledQuestionRadioInput, {
|
|
86
|
+
id: value,
|
|
87
|
+
type: "radio",
|
|
88
|
+
readOnly: true,
|
|
89
|
+
checked: selectedValue === value,
|
|
90
|
+
status: status
|
|
91
|
+
}), jsx(StyledLabel, {
|
|
92
|
+
htmlFor: value,
|
|
93
|
+
checked: selectedValue === value,
|
|
94
|
+
status: status,
|
|
95
|
+
children: children
|
|
96
|
+
})]
|
|
97
|
+
});
|
|
110
98
|
});
|
|
111
99
|
|
|
112
100
|
export { QuestionRadioOption as default };
|
|
@@ -6,10 +6,9 @@ import { WRONG_TEXT_COLOR, CORRECT_TEXT_COLOR } from '../../material-quiz/consta
|
|
|
6
6
|
* Get shared question custom style depend on checked, status values.
|
|
7
7
|
*/
|
|
8
8
|
function getQuestionStatusStyle() {
|
|
9
|
-
return css(["&,& p,& p.elicemd.elicemd--theme-dark{color:", ";table tbody > tr:nth-child(odd) > td{background-color:", ";}}"], ({
|
|
10
|
-
checked,
|
|
11
|
-
|
|
12
|
-
}) => {
|
|
9
|
+
return css(["&,& p,& p.elicemd.elicemd--theme-dark{color:", ";table tbody > tr:nth-child(odd) > td{background-color:", ";}}"], function (_ref) {
|
|
10
|
+
var checked = _ref.checked,
|
|
11
|
+
status = _ref.status;
|
|
13
12
|
switch (status) {
|
|
14
13
|
case 'correct':
|
|
15
14
|
return CORRECT_TEXT_COLOR;
|
|
@@ -18,11 +17,10 @@ function getQuestionStatusStyle() {
|
|
|
18
17
|
default:
|
|
19
18
|
return checked ? base.color.primary6 : base.color.navy0;
|
|
20
19
|
}
|
|
21
|
-
}, ({
|
|
22
|
-
checked,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return checked || status !== 'answer' ? `rgba(0, 0, 0, 0.08);` : null;
|
|
20
|
+
}, function (_ref2) {
|
|
21
|
+
var checked = _ref2.checked,
|
|
22
|
+
status = _ref2.status;
|
|
23
|
+
return checked || status !== 'answer' ? "rgba(0, 0, 0, 0.08);" : null;
|
|
26
24
|
});
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { typeof as _typeof } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
|
|
3
|
+
var mergeRefs = function mergeRefs() {
|
|
4
|
+
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5
|
+
refs[_key] = arguments[_key];
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
return function (element) {
|
|
8
|
+
return refs.forEach(function (ref) {
|
|
9
|
+
if (typeof ref === 'function') {
|
|
10
|
+
ref(element);
|
|
11
|
+
} else if (ref && _typeof(ref) === 'object') {
|
|
12
|
+
ref.current = element;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
};
|
|
8
17
|
|
|
9
18
|
export { mergeRefs };
|
package/es/constant/element.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var MATERIAL_QUIZ_CONTAINER_ID = 'MATERIAL_QUIZ_CONTAINER_ID';
|
|
2
|
+
var MATERIAL_QUIZ_PASSIVE_ID = 'MATERIAL_QUIZ_PASSIVE_ID';
|
|
3
|
+
var MATERIAL_QUIZ_ANSWER_ID = 'MATERIAL_QUIZ_ANSWER_ID';
|
|
4
4
|
|
|
5
5
|
export { MATERIAL_QUIZ_ANSWER_ID, MATERIAL_QUIZ_CONTAINER_ID, MATERIAL_QUIZ_PASSIVE_ID };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MATERIAL_QUIZ_ANSWER_ID, MATERIAL_QUIZ_CONTAINER_ID, MATERIAL_QUIZ_PASSIVE_ID } from './element.js';
|
package/es/helpers/index.js
CHANGED
|
@@ -20,12 +20,11 @@ function getQuizResultStatus(materialQuizResponse) {
|
|
|
20
20
|
}
|
|
21
21
|
return QuizResultStatus.NotSubmitted;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
isSelected,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const status = getQuizResultStatus(materialQuizResponse);
|
|
23
|
+
var getOptionStatus = function getOptionStatus(_ref) {
|
|
24
|
+
var isSelected = _ref.isSelected,
|
|
25
|
+
isActive = _ref.isActive,
|
|
26
|
+
materialQuizResponse = _ref.materialQuizResponse;
|
|
27
|
+
var status = getQuizResultStatus(materialQuizResponse);
|
|
29
28
|
if (isActive) {
|
|
30
29
|
return;
|
|
31
30
|
}
|
|
@@ -42,9 +41,8 @@ const getOptionStatus = ({
|
|
|
42
41
|
function checkUserLectureTestEnded(lecture) {
|
|
43
42
|
return (lecture === null || lecture === void 0 ? void 0 : lecture.testAdmissionStatus) === enums.TestAdmissionStatus.Completed;
|
|
44
43
|
}
|
|
45
|
-
function shouldResetOptions({
|
|
46
|
-
materialQuizResponse
|
|
47
|
-
}) {
|
|
44
|
+
function shouldResetOptions(_ref2) {
|
|
45
|
+
var materialQuizResponse = _ref2.materialQuizResponse;
|
|
48
46
|
// when score is given(correct, wrong), reset selected option in order to select options from scratch
|
|
49
47
|
// score condition
|
|
50
48
|
// normal quiz - score is always given(not a null) as long as a user submits the answer
|
|
@@ -52,7 +50,7 @@ function shouldResetOptions({
|
|
|
52
50
|
return [(materialQuizResponse === null || materialQuizResponse === void 0 ? void 0 : materialQuizResponse.score) !== null].every(Boolean);
|
|
53
51
|
}
|
|
54
52
|
function getQuizResult(materialQuizResponse) {
|
|
55
|
-
|
|
53
|
+
var status = getQuizResultStatus(materialQuizResponse);
|
|
56
54
|
switch (status) {
|
|
57
55
|
case QuizResultStatus.Correct:
|
|
58
56
|
return true;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useCaculatePassage } from './useCaculatePassage.js';
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
+
import { slicedToArray as _slicedToArray } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
1
2
|
import { useEffect } from 'react';
|
|
2
3
|
import { useMeasure } from 'react-use';
|
|
3
4
|
import { useMaterialQuizState, useMaterialQuizDispatch } from '../components/material-quiz/context/MaterialQuizContext.js';
|
|
4
5
|
import { MATERIAL_QUIZ_CONTAINER_ID } from '../constant/element.js';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
materialQuiz,
|
|
9
|
-
vertical
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
height
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
useEffect(()
|
|
7
|
+
var useCaculatePassage = function useCaculatePassage() {
|
|
8
|
+
var _useMaterialQuizState = useMaterialQuizState(),
|
|
9
|
+
materialQuiz = _useMaterialQuizState.materialQuiz,
|
|
10
|
+
vertical = _useMaterialQuizState.vertical;
|
|
11
|
+
var _useMaterialQuizDispa = useMaterialQuizDispatch(),
|
|
12
|
+
setIsLongPassage = _useMaterialQuizDispa.setIsLongPassage,
|
|
13
|
+
setIsInitialLoading = _useMaterialQuizDispa.setIsInitialLoading;
|
|
14
|
+
var _useMeasure = useMeasure(),
|
|
15
|
+
_useMeasure2 = _slicedToArray(_useMeasure, 2),
|
|
16
|
+
questionRef = _useMeasure2[0],
|
|
17
|
+
questionDetailHeight = _useMeasure2[1].height;
|
|
18
|
+
var _useMeasure3 = useMeasure(),
|
|
19
|
+
_useMeasure4 = _slicedToArray(_useMeasure3, 2),
|
|
20
|
+
containerRef = _useMeasure4[0],
|
|
21
|
+
containerHeight = _useMeasure4[1].height;
|
|
22
|
+
useEffect(function () {
|
|
22
23
|
var _a, _b;
|
|
23
|
-
|
|
24
|
+
var currentContainerHeight = vertical ? (_b = (_a = document.getElementById(MATERIAL_QUIZ_CONTAINER_ID)) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0 : containerHeight;
|
|
24
25
|
if (currentContainerHeight && questionDetailHeight && materialQuiz) {
|
|
25
26
|
setIsLongPassage(questionDetailHeight > currentContainerHeight);
|
|
26
27
|
// add timeout for forcing caculate layout and render in the parent
|
|
27
28
|
// finish before turning off loading
|
|
28
|
-
setTimeout(()
|
|
29
|
+
setTimeout(function () {
|
|
29
30
|
setIsInitialLoading(false);
|
|
30
31
|
}, 300);
|
|
31
32
|
} else if (materialQuiz && !materialQuiz.questionDescription) {
|
|
@@ -33,8 +34,8 @@ const useCaculatePassage = () => {
|
|
|
33
34
|
}
|
|
34
35
|
}, [containerHeight, questionDetailHeight, materialQuiz, setIsLongPassage, vertical, setIsInitialLoading]);
|
|
35
36
|
return {
|
|
36
|
-
questionRef,
|
|
37
|
-
containerRef
|
|
37
|
+
questionRef: questionRef,
|
|
38
|
+
containerRef: containerRef
|
|
38
39
|
};
|
|
39
40
|
};
|
|
40
41
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-quiz",
|
|
3
|
-
"version": "1.240718.0-trasncript.
|
|
3
|
+
"version": "1.240718.0-trasncript.2",
|
|
4
4
|
"description": "User view and editing components of Elice material quiz",
|
|
5
5
|
"repository": "https://git.elicer.io/elice/frontend/library/elice-material",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -17,10 +17,8 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"start": "run-s watch",
|
|
19
19
|
"prebuild": "run-s clean",
|
|
20
|
-
"build": "
|
|
21
|
-
"
|
|
22
|
-
"build:cjs": "rollup -c ../../rollup.config.ts --configPlugin typescript -f cjs",
|
|
23
|
-
"watch": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es -w",
|
|
20
|
+
"build": "cross-env NODE_ENV=production rollup -c ../../rollup.config.ts --configPlugin typescript -f es -f cjs",
|
|
21
|
+
"watch": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es -f cjs -w",
|
|
24
22
|
"lint": "eslint --ext .ts,.tsx ./src --max-warnings=0",
|
|
25
23
|
"clean": "del-cli \"es/*\" \"cjs/*\" \"dist/*\""
|
|
26
24
|
},
|
|
@@ -41,7 +39,7 @@
|
|
|
41
39
|
"@fortawesome/pro-regular-svg-icons": "^6",
|
|
42
40
|
"@fortawesome/pro-solid-svg-icons": "^6",
|
|
43
41
|
"@mui/lab": "^5.0.0-alpha.112",
|
|
44
|
-
"@mui/material": "^5.
|
|
42
|
+
"@mui/material": "^5.10.16",
|
|
45
43
|
"@mui/x-data-grid": "^6.7.0",
|
|
46
44
|
"@mui/x-date-pickers": "^6.7.0",
|
|
47
45
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
@@ -60,23 +58,23 @@
|
|
|
60
58
|
},
|
|
61
59
|
"devDependencies": {
|
|
62
60
|
"@elice/api-client": "^1.240619.0",
|
|
63
|
-
"@elice/blocks": "^1.
|
|
61
|
+
"@elice/blocks": "^1.240529.0",
|
|
64
62
|
"@elice/design-tokens": "^1.220803.0",
|
|
65
63
|
"@elice/icons": "^1.230814.0",
|
|
66
64
|
"@elice/icons-legacy": "npm:@elice/icons@0.230814.0",
|
|
67
65
|
"@elice/intl": "0.240425.0-rc.2",
|
|
68
66
|
"@elice/markdown": "^1.240124.0",
|
|
69
|
-
"@elice/material-shared-types": "1.240718.0-trasncript.
|
|
70
|
-
"@elice/material-shared-utils": "1.240718.0-trasncript.
|
|
67
|
+
"@elice/material-shared-types": "1.240718.0-trasncript.2",
|
|
68
|
+
"@elice/material-shared-utils": "1.240718.0-trasncript.2",
|
|
71
69
|
"@elice/mui-system": "^5.240108.1",
|
|
72
|
-
"@elice/types": "
|
|
70
|
+
"@elice/types": "1.240709.0",
|
|
73
71
|
"@elice/wysiwyg": "1.240716.1",
|
|
74
|
-
"@emotion/react": "^11.10.
|
|
75
|
-
"@emotion/styled": "^11.10.
|
|
72
|
+
"@emotion/react": "^11.10.5",
|
|
73
|
+
"@emotion/styled": "^11.10.5",
|
|
76
74
|
"@fortawesome/pro-regular-svg-icons": "^6.4.2",
|
|
77
75
|
"@fortawesome/pro-solid-svg-icons": "^6.4.2",
|
|
78
76
|
"@mui/lab": "^5.0.0-alpha.112",
|
|
79
|
-
"@mui/material": "^5.
|
|
77
|
+
"@mui/material": "^5.10.16",
|
|
80
78
|
"@mui/x-data-grid": "^6.7.0",
|
|
81
79
|
"@mui/x-date-pickers": "^6.7.0",
|
|
82
80
|
"@types/classnames": "^2.3.1",
|
|
@@ -89,6 +87,5 @@
|
|
|
89
87
|
"react": "^17.0.2",
|
|
90
88
|
"react-use": "^17.2.4",
|
|
91
89
|
"styled-components": "^5.3.0"
|
|
92
|
-
}
|
|
93
|
-
"gitHead": "8d0acefda30430959f8f115ad467d2449f86d8a7"
|
|
90
|
+
}
|
|
94
91
|
}
|