@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
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
7
|
var React = require('react');
|
|
6
8
|
var apiClient = require('@elice/api-client');
|
|
7
9
|
var designTokens = require('@elice/design-tokens');
|
|
@@ -24,39 +26,54 @@ var MaterialQuizInfo = require('./MaterialQuizInfo.js');
|
|
|
24
26
|
var QuizResultBadge = require('./QuizResultBadge.js');
|
|
25
27
|
var QuizSubmitStatusText = require('./QuizSubmitStatusText.js');
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
30
|
+
|
|
31
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
32
|
+
|
|
33
|
+
var MaterialQuizSelectOne = function MaterialQuizSelectOne(_ref) {
|
|
34
|
+
var hasInlinePassage = _ref.hasInlinePassage;
|
|
30
35
|
// context
|
|
31
|
-
|
|
32
|
-
course,
|
|
33
|
-
lecture,
|
|
34
|
-
materialQuiz,
|
|
35
|
-
userId
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} = MaterialQuizContext.useMaterialQuizDispatch();
|
|
43
|
-
const theme = material.useTheme();
|
|
36
|
+
var _useMaterialQuizState = MaterialQuizContext.useMaterialQuizState(),
|
|
37
|
+
course = _useMaterialQuizState.course,
|
|
38
|
+
lecture = _useMaterialQuizState.lecture,
|
|
39
|
+
materialQuiz = _useMaterialQuizState.materialQuiz,
|
|
40
|
+
userId = _useMaterialQuizState.userId;
|
|
41
|
+
var _useMaterialQuizDispa = MaterialQuizContext.useMaterialQuizDispatch(),
|
|
42
|
+
onSubmit = _useMaterialQuizDispa.onSubmit,
|
|
43
|
+
onNext = _useMaterialQuizDispa.onNext,
|
|
44
|
+
refreshOrgMaterialQuiz = _useMaterialQuizDispa.refreshOrgMaterialQuiz,
|
|
45
|
+
onDirty = _useMaterialQuizDispa.onDirty;
|
|
46
|
+
var theme = material.useTheme();
|
|
44
47
|
// state
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
49
|
+
var _React$useState = React__default.default.useState(),
|
|
50
|
+
_React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
|
|
51
|
+
selectedAnswer = _React$useState2[0],
|
|
52
|
+
setSelectedAnswer = _React$useState2[1];
|
|
53
|
+
var _React$useState3 = React__default.default.useState(),
|
|
54
|
+
_React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
|
|
55
|
+
materialQuizResponse = _React$useState4[0],
|
|
56
|
+
setMaterialQuizResponse = _React$useState4[1];
|
|
57
|
+
var _React$useState5 = React__default.default.useState('idle'),
|
|
58
|
+
_React$useState6 = _rollupPluginBabelHelpers.slicedToArray(_React$useState5, 2),
|
|
59
|
+
submitStatus = _React$useState6[0],
|
|
60
|
+
setSubmitStatus = _React$useState6[1];
|
|
61
|
+
var _useCaculatePassage = useCaculatePassage.useCaculatePassage(),
|
|
62
|
+
containerRef = _useCaculatePassage.containerRef,
|
|
63
|
+
questionRef = _useCaculatePassage.questionRef;
|
|
53
64
|
// Whether user has clicked any options
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
var _React$useState7 = React__default.default.useState(false),
|
|
66
|
+
_React$useState8 = _rollupPluginBabelHelpers.slicedToArray(_React$useState7, 2),
|
|
67
|
+
isActive = _React$useState8[0],
|
|
68
|
+
setIsActive = _React$useState8[1];
|
|
69
|
+
var _React$useState9 = React__default.default.useState(false),
|
|
70
|
+
_React$useState10 = _rollupPluginBabelHelpers.slicedToArray(_React$useState9, 2),
|
|
71
|
+
hasSubmitted = _React$useState10[0],
|
|
72
|
+
setHasSubmitted = _React$useState10[1];
|
|
73
|
+
var isNextActive = hasSubmitted && typeof onNext === 'function';
|
|
74
|
+
var isDisabled = selectedAnswer === undefined || index.checkUserLectureTestEnded(lecture) || !!userId;
|
|
58
75
|
// answer select handler
|
|
59
|
-
|
|
76
|
+
var handleAnswerSelect = function handleAnswerSelect(index$1) {
|
|
60
77
|
if (index.checkUserLectureTestEnded(lecture) || !!userId) {
|
|
61
78
|
return;
|
|
62
79
|
}
|
|
@@ -66,33 +83,31 @@ const MaterialQuizSelectOne = ({
|
|
|
66
83
|
onDirty(true);
|
|
67
84
|
};
|
|
68
85
|
// quiz response fetcher
|
|
69
|
-
|
|
86
|
+
React__default.default.useEffect(function () {
|
|
70
87
|
if (!userId && (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.lastQuizResponseId)) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
signal
|
|
74
|
-
} = controller;
|
|
88
|
+
var controller = new AbortController();
|
|
89
|
+
var signal = controller.signal;
|
|
75
90
|
apiClient.getOrgMaterialQuizResponseGet({
|
|
76
91
|
quizResponseId: materialQuiz.lastQuizResponseId
|
|
77
92
|
}, {
|
|
78
|
-
signal
|
|
79
|
-
}).then(response
|
|
80
|
-
|
|
93
|
+
signal: signal
|
|
94
|
+
}).then(function (response) {
|
|
95
|
+
var quizResponseAnswer = response.quizResponse.answer;
|
|
81
96
|
setMaterialQuizResponse(response.quizResponse);
|
|
82
97
|
setSelectedAnswer(typeof response.quizResponse.answer === 'string' ? undefined : quizResponseAnswer[0]);
|
|
83
|
-
}).catch(error
|
|
98
|
+
}).catch(function (error) {
|
|
84
99
|
console.error(error);
|
|
85
100
|
});
|
|
86
|
-
return ()
|
|
101
|
+
return function () {
|
|
102
|
+
return controller.abort();
|
|
103
|
+
};
|
|
87
104
|
}
|
|
88
105
|
}, [materialQuiz, userId]);
|
|
89
106
|
// quiz response fetcher
|
|
90
|
-
|
|
107
|
+
React__default.default.useEffect(function () {
|
|
91
108
|
if (userId && materialQuiz) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
signal
|
|
95
|
-
} = controller;
|
|
109
|
+
var controller = new AbortController();
|
|
110
|
+
var signal = controller.signal;
|
|
96
111
|
apiClient.getOrgMaterialQuizResponseList({
|
|
97
112
|
materialQuizId: materialQuiz.id,
|
|
98
113
|
filterUserIds: [userId],
|
|
@@ -101,58 +116,84 @@ const MaterialQuizSelectOne = ({
|
|
|
101
116
|
offset: 0,
|
|
102
117
|
count: 1
|
|
103
118
|
}, {
|
|
104
|
-
signal
|
|
105
|
-
}).then(response
|
|
106
|
-
|
|
107
|
-
|
|
119
|
+
signal: signal
|
|
120
|
+
}).then(function (response) {
|
|
121
|
+
var quizResponse = response.quizResponses[0];
|
|
122
|
+
var quizResponseAnswer = quizResponse === null || quizResponse === void 0 ? void 0 : quizResponse.answer;
|
|
108
123
|
setMaterialQuizResponse(quizResponse);
|
|
109
124
|
setSelectedAnswer(quizResponseAnswer === null || quizResponseAnswer === void 0 ? void 0 : quizResponseAnswer[0]);
|
|
110
|
-
}).catch(error
|
|
125
|
+
}).catch(function (error) {
|
|
111
126
|
console.error(error);
|
|
112
127
|
});
|
|
113
|
-
return ()
|
|
128
|
+
return function () {
|
|
129
|
+
return controller.abort();
|
|
130
|
+
};
|
|
114
131
|
}
|
|
115
132
|
}, [materialQuiz, userId]);
|
|
116
133
|
// submit handler
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
134
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
135
|
+
var _ref2 = _rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
|
|
136
|
+
var _yield$postOrgMateria, quizResponseId, _yield$getOrgMaterial, quizResponse;
|
|
137
|
+
return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
|
|
138
|
+
while (1) switch (_context.prev = _context.next) {
|
|
139
|
+
case 0:
|
|
140
|
+
if (!(!materialQuiz || selectedAnswer === undefined)) {
|
|
141
|
+
_context.next = 2;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
return _context.abrupt("return");
|
|
145
|
+
case 2:
|
|
146
|
+
setSubmitStatus('pending');
|
|
147
|
+
_context.prev = 3;
|
|
148
|
+
_context.next = 6;
|
|
149
|
+
return apiClient.postOrgMaterialQuizResponseAdd({
|
|
150
|
+
materialQuizId: materialQuiz.id,
|
|
151
|
+
answer: [selectedAnswer]
|
|
152
|
+
});
|
|
153
|
+
case 6:
|
|
154
|
+
_yield$postOrgMateria = _context.sent;
|
|
155
|
+
quizResponseId = _yield$postOrgMateria.quizResponseId;
|
|
156
|
+
_context.next = 10;
|
|
157
|
+
return apiClient.getOrgMaterialQuizResponseGet({
|
|
158
|
+
quizResponseId: quizResponseId
|
|
159
|
+
});
|
|
160
|
+
case 10:
|
|
161
|
+
_yield$getOrgMaterial = _context.sent;
|
|
162
|
+
quizResponse = _yield$getOrgMaterial.quizResponse;
|
|
163
|
+
setIsActive(false);
|
|
164
|
+
setMaterialQuizResponse(quizResponse);
|
|
165
|
+
void refreshOrgMaterialQuiz();
|
|
166
|
+
onSubmit(true, index.getQuizResult(quizResponse));
|
|
167
|
+
setSubmitStatus('resolved');
|
|
168
|
+
setHasSubmitted(true);
|
|
169
|
+
onDirty(false);
|
|
170
|
+
_context.next = 26;
|
|
171
|
+
break;
|
|
172
|
+
case 21:
|
|
173
|
+
_context.prev = 21;
|
|
174
|
+
_context.t0 = _context["catch"](3);
|
|
175
|
+
console.error(_context.t0);
|
|
176
|
+
onSubmit(false);
|
|
177
|
+
setSubmitStatus('rejected');
|
|
178
|
+
case 26:
|
|
179
|
+
case "end":
|
|
180
|
+
return _context.stop();
|
|
181
|
+
}
|
|
182
|
+
}, _callee, null, [[3, 21]]);
|
|
183
|
+
}));
|
|
184
|
+
return function handleSubmit() {
|
|
185
|
+
return _ref2.apply(this, arguments);
|
|
186
|
+
};
|
|
187
|
+
}();
|
|
188
|
+
return jsxRuntime.jsx(QuestionBox.default, {
|
|
148
189
|
title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.questionTitle,
|
|
149
190
|
titlePrefix: "Q.",
|
|
150
191
|
onNext: onNext,
|
|
151
192
|
isNextActive: isNextActive,
|
|
152
|
-
submitStatus:
|
|
193
|
+
submitStatus: jsxRuntime.jsx(QuizSubmitStatusText.default, {
|
|
153
194
|
status: submitStatus
|
|
154
195
|
}),
|
|
155
|
-
submitResult:
|
|
196
|
+
submitResult: jsxRuntime.jsx(QuizResultBadge.default, {
|
|
156
197
|
materialQuizResponse: materialQuizResponse
|
|
157
198
|
}),
|
|
158
199
|
bodyContainerRef: containerRef,
|
|
@@ -170,49 +211,54 @@ const MaterialQuizSelectOne = ({
|
|
|
170
211
|
backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? designTokens.base.color.gray6 : theme.palette.primary.main,
|
|
171
212
|
color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? designTokens.base.color.gray3 : theme.palette.primary.contrastText
|
|
172
213
|
}
|
|
173
|
-
}]
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
}],
|
|
215
|
+
children: jsxRuntime.jsxs(material.Stack, {
|
|
216
|
+
height: "100%",
|
|
217
|
+
gap: "1rem",
|
|
218
|
+
children: [hasInlinePassage && jsxRuntime.jsx("div", {
|
|
219
|
+
id: element.MATERIAL_QUIZ_PASSIVE_ID,
|
|
220
|
+
ref: questionRef,
|
|
221
|
+
children: jsxRuntime.jsx(MaterialQuizInfo.default, {
|
|
222
|
+
renderWithBox: false
|
|
223
|
+
})
|
|
224
|
+
}), materialQuiz ? jsxRuntime.jsxs("div", {
|
|
225
|
+
id: element.MATERIAL_QUIZ_ANSWER_ID,
|
|
226
|
+
children: [jsxRuntime.jsx(QuestionRadio.default, {
|
|
227
|
+
selectedValue: selectedAnswer,
|
|
228
|
+
onSelect: handleAnswerSelect,
|
|
229
|
+
disabled: submitStatus === 'pending' || index.checkUserLectureTestEnded(lecture) || !!userId,
|
|
230
|
+
children: materialQuiz.options && course ? materialQuiz.options.map(function (option, index$1) {
|
|
231
|
+
var _a, _b;
|
|
232
|
+
var getIsSelected = function getIsSelected(index, materialQuizResponse) {
|
|
233
|
+
var _a;
|
|
234
|
+
if (!materialQuizResponse) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
var materialQuizResponseAnswer = materialQuizResponse.answer;
|
|
238
|
+
return (_a = materialQuizResponseAnswer === null || materialQuizResponseAnswer === void 0 ? void 0 : materialQuizResponseAnswer.includes(index)) !== null && _a !== void 0 ? _a : false;
|
|
239
|
+
};
|
|
240
|
+
var status = index.getOptionStatus({
|
|
241
|
+
materialQuizResponse: materialQuizResponse,
|
|
242
|
+
isSelected: getIsSelected(index$1, materialQuizResponse),
|
|
243
|
+
isActive: isActive
|
|
244
|
+
});
|
|
245
|
+
var materialQuizAnswerInfo = materialQuiz.answerInfo;
|
|
246
|
+
return jsxRuntime.jsx(QuestionRadioOption.default, {
|
|
247
|
+
value: index$1,
|
|
248
|
+
status: status,
|
|
249
|
+
isAnswer: (_a = !!userId && Array.isArray(materialQuizAnswerInfo) && materialQuizAnswerInfo.includes(index$1)) !== null && _a !== void 0 ? _a : false,
|
|
250
|
+
children: course.preference.renderMarkdownInQuizOptions ? jsxRuntime.jsx(StyledMarkdown.default, {
|
|
251
|
+
children: (_b = option === null || option === void 0 ? void 0 : option.content) !== null && _b !== void 0 ? _b : '',
|
|
252
|
+
paddingx: 0,
|
|
253
|
+
paddingy: 0,
|
|
254
|
+
dark: true
|
|
255
|
+
}) : option === null || option === void 0 ? void 0 : option.content
|
|
256
|
+
}, index$1);
|
|
257
|
+
}) : null
|
|
258
|
+
}), jsxRuntime.jsx(MaterialQuizAnswerExplanation.default, {})]
|
|
259
|
+
}) : null]
|
|
260
|
+
})
|
|
261
|
+
});
|
|
216
262
|
};
|
|
217
263
|
|
|
218
264
|
exports.default = MaterialQuizSelectOne;
|
|
@@ -2,53 +2,60 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var blocks = require('@elice/blocks');
|
|
7
7
|
var designTokens = require('@elice/design-tokens');
|
|
8
8
|
var styled = require('styled-components');
|
|
9
9
|
var MaterialQuizContext = require('./context/MaterialQuizContext.js');
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
14
|
+
|
|
15
|
+
var StyledShimmer = styled__default.default.div.withConfig({
|
|
12
16
|
componentId: "sc-10uz5tw-0"
|
|
13
|
-
})(["display:flex;flex-direction:column;border-radius:", ";overflow:hidden;width:100%;"], ({
|
|
14
|
-
vertical
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
})(["display:flex;flex-direction:column;border-radius:", ";overflow:hidden;width:100%;"], function (_ref) {
|
|
18
|
+
var vertical = _ref.vertical;
|
|
19
|
+
return vertical ? '0' : '8px';
|
|
20
|
+
});
|
|
21
|
+
var StyledShimmerBody = styled__default.default.div.withConfig({
|
|
17
22
|
componentId: "sc-10uz5tw-1"
|
|
18
23
|
})(["padding:1.5rem;background-color:", ";overflow-y:auto;height:100%;"], designTokens.base.color.navy8);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
vertical
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
24
|
+
var MaterialQuizShimmer = function MaterialQuizShimmer() {
|
|
25
|
+
var _useMaterialQuizState = MaterialQuizContext.useMaterialQuizState(),
|
|
26
|
+
vertical = _useMaterialQuizState.vertical;
|
|
27
|
+
return jsxRuntime.jsx(StyledShimmer, {
|
|
28
|
+
vertical: vertical,
|
|
29
|
+
children: jsxRuntime.jsxs(StyledShimmerBody, {
|
|
30
|
+
children: [jsxRuntime.jsx(blocks.Shimmer, {
|
|
31
|
+
dark: true,
|
|
32
|
+
borderRadius: '4px',
|
|
33
|
+
width: "80%",
|
|
34
|
+
height: '40px'
|
|
35
|
+
}), jsxRuntime.jsx(blocks.Vspace, {
|
|
36
|
+
height: 1
|
|
37
|
+
}), jsxRuntime.jsx(blocks.Shimmer, {
|
|
38
|
+
dark: true,
|
|
39
|
+
borderRadius: '4px',
|
|
40
|
+
width: "100%",
|
|
41
|
+
height: '40px'
|
|
42
|
+
}), jsxRuntime.jsx(blocks.Vspace, {
|
|
43
|
+
height: 1
|
|
44
|
+
}), jsxRuntime.jsx(blocks.Shimmer, {
|
|
45
|
+
dark: true,
|
|
46
|
+
borderRadius: '4px',
|
|
47
|
+
width: "100%",
|
|
48
|
+
height: '40px'
|
|
49
|
+
}), jsxRuntime.jsx(blocks.Vspace, {
|
|
50
|
+
height: 1
|
|
51
|
+
}), jsxRuntime.jsx(blocks.Shimmer, {
|
|
52
|
+
dark: true,
|
|
53
|
+
borderRadius: '4px',
|
|
54
|
+
width: "100%",
|
|
55
|
+
height: '40px'
|
|
56
|
+
})]
|
|
57
|
+
})
|
|
58
|
+
});
|
|
52
59
|
};
|
|
53
60
|
|
|
54
61
|
exports.default = MaterialQuizShimmer;
|