@elice/material-quiz 1.241010.0 → 1.241015.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.
Files changed (69) hide show
  1. package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +1 -0
  2. package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +3 -1
  3. package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.d.ts +11 -0
  4. package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +2 -1
  5. package/cjs/components/material-quiz/MaterialQuizSelectOne.js +1 -0
  6. package/cjs/components/material-quiz/locales/ko.json.js +1 -1
  7. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +29 -16
  8. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.d.ts +6 -1
  9. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +8 -3
  10. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.d.ts +6 -1
  11. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +14 -6
  12. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.d.ts +2 -0
  13. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +86 -41
  14. package/cjs/components/material-quiz-edit/MaterialQuizEdit.d.ts +2 -1
  15. package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +25 -13
  16. package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +71 -6
  17. package/cjs/components/material-quiz-edit/hooks/index.d.ts +1 -0
  18. package/cjs/components/material-quiz-edit/hooks/index.js +7 -0
  19. package/cjs/components/material-quiz-edit/hooks/useMaterialQuizCourse.d.ts +9 -0
  20. package/cjs/components/material-quiz-edit/hooks/useMaterialQuizCourse.js +81 -0
  21. package/cjs/components/material-quiz-edit/locales/en.json.js +1 -1
  22. package/cjs/components/material-quiz-edit/locales/ja.json.js +1 -1
  23. package/cjs/components/material-quiz-edit/locales/ko.json.js +1 -1
  24. package/cjs/components/material-quiz-edit/locales/th.json.js +1 -1
  25. package/cjs/components/shared/QuestionBox.js +14 -6
  26. package/cjs/components/shared/StyledMarkdown.js +1 -1
  27. package/cjs/components/shared/contexts/MaterialQuizApiContext.d.ts +16 -0
  28. package/cjs/components/shared/contexts/MaterialQuizApiContext.js +47 -0
  29. package/cjs/components/shared/index.d.ts +1 -0
  30. package/cjs/components/shared/index.js +4 -0
  31. package/cjs/helpers/index.d.ts +5 -0
  32. package/cjs/helpers/index.js +34 -0
  33. package/cjs/hooks/useCaculatePassage.js +1 -1
  34. package/cjs/index.js +4 -0
  35. package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +1 -0
  36. package/es/components/material-quiz/MaterialQuizSelectMultiple.js +4 -2
  37. package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.d.ts +11 -0
  38. package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +3 -2
  39. package/es/components/material-quiz/MaterialQuizSelectOne.js +1 -0
  40. package/es/components/material-quiz/locales/ko.json.js +1 -1
  41. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +29 -16
  42. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.d.ts +6 -1
  43. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +6 -1
  44. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.d.ts +6 -1
  45. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +10 -2
  46. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.d.ts +2 -0
  47. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +85 -40
  48. package/es/components/material-quiz-edit/MaterialQuizEdit.d.ts +2 -1
  49. package/es/components/material-quiz-edit/MaterialQuizEdit.js +25 -13
  50. package/es/components/material-quiz-edit/MaterialQuizEditContent.js +71 -7
  51. package/es/components/material-quiz-edit/hooks/index.d.ts +1 -0
  52. package/es/components/material-quiz-edit/hooks/index.js +1 -0
  53. package/es/components/material-quiz-edit/hooks/useMaterialQuizCourse.d.ts +9 -0
  54. package/es/components/material-quiz-edit/hooks/useMaterialQuizCourse.js +79 -0
  55. package/es/components/material-quiz-edit/locales/en.json.js +1 -1
  56. package/es/components/material-quiz-edit/locales/ja.json.js +1 -1
  57. package/es/components/material-quiz-edit/locales/ko.json.js +1 -1
  58. package/es/components/material-quiz-edit/locales/th.json.js +1 -1
  59. package/es/components/shared/QuestionBox.js +15 -7
  60. package/es/components/shared/StyledMarkdown.js +1 -1
  61. package/es/components/shared/contexts/MaterialQuizApiContext.d.ts +16 -0
  62. package/es/components/shared/contexts/MaterialQuizApiContext.js +39 -0
  63. package/es/components/shared/index.d.ts +1 -0
  64. package/es/components/shared/index.js +1 -0
  65. package/es/helpers/index.d.ts +5 -0
  66. package/es/helpers/index.js +32 -1
  67. package/es/hooks/useCaculatePassage.js +1 -1
  68. package/es/index.js +1 -0
  69. package/package.json +11 -8
@@ -35,6 +35,7 @@ var MaterialQuizAnswerExplanation = function MaterialQuizAnswerExplanation() {
35
35
  margintop: "1rem",
36
36
  children: jsxRuntime.jsx(StyledAccordion, {
37
37
  dark: true,
38
+ defaultExpanded: true,
38
39
  header: jsxRuntime.jsx(blocks.Text, {
39
40
  bold: true,
40
41
  role: "navy0",
@@ -19,6 +19,7 @@ require('../shared/question-radio/QuestionRadio.js');
19
19
  require('../shared/question-radio/QuestionRadioOption.js');
20
20
  var QuestionCheckbox = require('../shared/question-checkbox/QuestionCheckbox.js');
21
21
  var QuestionCheckboxOption = require('../shared/question-checkbox/QuestionCheckboxOption.js');
22
+ require('../shared/contexts/MaterialQuizApiContext.js');
22
23
  var QuestionBox = require('../shared/QuestionBox.js');
23
24
  var StyledMarkdown = require('../shared/StyledMarkdown.js');
24
25
  var MaterialQuizContext = require('./context/MaterialQuizContext.js');
@@ -249,7 +250,8 @@ var MaterialQuizSelectMultiple = function MaterialQuizSelectMultiple(_ref) {
249
250
  var materialQuizResponseAnswer = materialQuizResponse.answer;
250
251
  return (_a = materialQuizResponseAnswer.includes(index)) !== null && _a !== void 0 ? _a : false;
251
252
  };
252
- var status = index.getOptionStatus({
253
+ var checked = selectedAnswer.includes(index$1);
254
+ var status = !checked ? undefined : index.getQuizSelectMultipleOptionResultStatus(index$1, materialQuizResponse) || index.getOptionStatus({
253
255
  materialQuizResponse: materialQuizResponse,
254
256
  isSelected: getIsSelected(index$1, materialQuizResponse),
255
257
  isActive: isActive
@@ -1,4 +1,15 @@
1
1
  import React from 'react';
2
+ interface Option {
3
+ initialOrder: number;
4
+ order: number;
5
+ value: string;
6
+ }
7
+ interface Dummy {
8
+ initialOrder: null;
9
+ order: null;
10
+ value: null;
11
+ }
12
+ export type Answer = Option | Dummy;
2
13
  declare const MaterialQuizSelectMultipleOrder: React.FC<{
3
14
  hasInlinePassage: boolean;
4
15
  }>;
@@ -505,10 +505,11 @@ var MaterialQuizSelectMultipleOrder = function MaterialQuizSelectMultipleOrder(_
505
505
  return jsxRuntime.jsx(StyledQuizAnswersDropZone, {
506
506
  children: answerList.map(function (option, index$1) {
507
507
  var getRole = function getRole() {
508
+ var _a;
508
509
  if (isActive) {
509
510
  return 'default';
510
511
  }
511
- var status = index.getQuizResultStatus(materialQuizResponse);
512
+ var status = (_a = index.getQuizSelectMultipleOrderOptionResultStatus(option, materialQuizResponse)) !== null && _a !== void 0 ? _a : index.getQuizResultStatus(materialQuizResponse);
512
513
  switch (status) {
513
514
  case index.QuizResultStatus.Correct:
514
515
  return 'correct';
@@ -19,6 +19,7 @@ var QuestionRadio = require('../shared/question-radio/QuestionRadio.js');
19
19
  var QuestionRadioOption = require('../shared/question-radio/QuestionRadioOption.js');
20
20
  require('../shared/question-checkbox/QuestionCheckbox.js');
21
21
  require('../shared/question-checkbox/QuestionCheckboxOption.js');
22
+ require('../shared/contexts/MaterialQuizApiContext.js');
22
23
  var QuestionBox = require('../shared/QuestionBox.js');
23
24
  var StyledMarkdown = require('../shared/StyledMarkdown.js');
24
25
  var MaterialQuizContext = require('./context/MaterialQuizContext.js');
@@ -2,6 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var messageKo = {"materialQuiz.anchorLabel.question":"지문","materialQuiz.anchorLabel.answer":"답안","materialQuiz.error":"퀴즈를 불러오는데 실패했습니다.\n잠시 후 다시 시도해주세요.","materialQuiz.submit":"제출","materialQuiz.resubmit":"다시 제출","materialQuiz.submittedAnswer":"제출한 답","materialQuiz.answer":"정답","materialQuiz.next":"다음 문제로 이동 >","materialQuiz.selectOne.answer.title":"아래 보기에서 골라주세요.","materialQuiz.selectMultiple.answer.title":"아래 보기에서 골라주세요. (중복 선택 가능)","materialQuiz.selectMultipleOrder.answer.title":"답안을 드래그 앤 드롭하세요.","materialQuiz.text.answer.title":"답안을 작성해 주세요.","materialQuiz.empty.title":"퀴즈가 준비 중 입니다.","materialQuiz.empty.description":"퀴즈 게시 후 다시 확인해주세요!","materialQuiz.survey.empty.title":"설문조사 준비 중 입니다.","materialQuiz.survey.empty.description":"설문지 게시 후 다시 확인해주세요!","materialQuiz.submitStatus.success":"제출되었습니다.","materialQuiz.submitStatus.failure":"제출에 실패하였습니다.","materialQuiz.resultStatus.correct":"정답","materialQuiz.resultStatus.wrong":"다시 한번 풀어보세요.","materialQuiz.resultStatus.submitted":"제출완료","materialQuiz.explanation.close":"퀴즈해설 닫기","materialQuiz.explanation.show":"퀴즈 해설 보기","materialQuiz.explanation.empty":"작성된 해설이 없습니다.","materialQuiz.text.placeholder":"답안을 작성해 주세요.","materialQuiz.text.correct":"정답입니다.","materialQuiz.text.wrong":"오답입니다. 다시 답안을 제출해보세요.","materialQuiz.order.answerEmpty":"항목을 다시 이곳으로 옮길 수 있습니다.","materialQuiz.bottomSheet.title":"보기","materialQuiz.bottomSheet.optionEmpty":"모든 보기를 그룹에 배치하였습니다.","materialQuiz.dropzone.desktop.answerEmpty":"보기를 영역에 끌어 넣어주세요.","materialQuiz.dropzone.mobile.answerEmpty":"이곳을 클릭하여 보기를 넣어주세요.","materialQuiz.dropzone.optionEmpty":"보기","materialQuiz.dropzone.optionReset":"답안 초기화"};
5
+ var messageKo = {"materialQuiz.anchorLabel.question":"지문","materialQuiz.anchorLabel.answer":"답안","materialQuiz.error":"퀴즈를 불러오는데 실패했습니다.\n잠시 후 다시 시도해주세요.","materialQuiz.submit":"제출","materialQuiz.resubmit":"다시 제출","materialQuiz.submittedAnswer":"제출한 답","materialQuiz.answer":"정답","materialQuiz.next":"다음 문제로 이동 >","materialQuiz.selectOne.answer.title":"아래 보기에서 골라주세요.","materialQuiz.selectMultiple.answer.title":"아래 보기에서 골라주세요. (중복 선택 가능)","materialQuiz.selectMultipleOrder.answer.title":"답안을 드래그 앤 드롭하세요.","materialQuiz.text.answer.title":"답안을 작성해 주세요.","materialQuiz.empty.title":"퀴즈가 준비 중 입니다.","materialQuiz.empty.description":"퀴즈 게시 후 다시 확인해주세요!","materialQuiz.survey.empty.title":"설문조사 준비 중 입니다.","materialQuiz.survey.empty.description":"설문지 게시 후 다시 확인해주세요!","materialQuiz.submitStatus.success":"제출되었습니다.","materialQuiz.submitStatus.failure":"제출에 실패하였습니다.","materialQuiz.resultStatus.correct":"정답","materialQuiz.resultStatus.wrong":"다시 한번 풀어보세요.","materialQuiz.resultStatus.submitted":"제출완료","materialQuiz.explanation.close":"퀴즈해설 닫기","materialQuiz.explanation.show":"퀴즈 해설 보기","materialQuiz.explanation.empty":"작성된 해설이 없습니다.","materialQuiz.text.placeholder":"답안을 작성해 주세요.","materialQuiz.text.correct":"정답입니다.","materialQuiz.text.wrong":"오답입니다. 다시 답안을 제출해보세요.","materialQuiz.order.answerEmpty":"항목을 다시 이곳으로 옮길 수 있습니다.","materialQuiz.bottomSheet.title":"보기","materialQuiz.bottomSheet.optionEmpty":"모든 보기를 그룹에 배치하였습니다.","materialQuiz.dropzone.desktop.answerEmpty":"보기를 영역에 끌어 넣어 주세요.","materialQuiz.dropzone.mobile.answerEmpty":"이곳을 클릭하여 보기를 넣어 주세요.","materialQuiz.dropzone.optionEmpty":"보기","materialQuiz.dropzone.optionReset":"답안 초기화"};
6
6
 
7
7
  exports.default = messageKo;
@@ -64,18 +64,22 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
64
64
  _React$useState8 = _rollupPluginBabelHelpers.slicedToArray(_React$useState7, 2),
65
65
  currentOptionList = _React$useState8[0],
66
66
  setCurrentOptionList = _React$useState8[1];
67
- var _React$useState9 = React__default.default.useState(),
67
+ var _React$useState9 = React__default.default.useState(false),
68
68
  _React$useState10 = _rollupPluginBabelHelpers.slicedToArray(_React$useState9, 2),
69
- materialQuizResponse = _React$useState10[0],
70
- setMaterialQuizResponse = _React$useState10[1];
71
- var _React$useState11 = React__default.default.useState('idle'),
69
+ isActive = _React$useState10[0],
70
+ setIsActive = _React$useState10[1];
71
+ var _React$useState11 = React__default.default.useState(),
72
72
  _React$useState12 = _rollupPluginBabelHelpers.slicedToArray(_React$useState11, 2),
73
- submitStatus = _React$useState12[0],
74
- setSubmitStatus = _React$useState12[1];
75
- var _React$useState13 = React__default.default.useState(false),
73
+ materialQuizResponse = _React$useState12[0],
74
+ setMaterialQuizResponse = _React$useState12[1];
75
+ var _React$useState13 = React__default.default.useState('idle'),
76
76
  _React$useState14 = _rollupPluginBabelHelpers.slicedToArray(_React$useState13, 2),
77
- hasSubmitted = _React$useState14[0],
78
- setHasSubmitted = _React$useState14[1];
77
+ submitStatus = _React$useState14[0],
78
+ setSubmitStatus = _React$useState14[1];
79
+ var _React$useState15 = React__default.default.useState(false),
80
+ _React$useState16 = _rollupPluginBabelHelpers.slicedToArray(_React$useState15, 2),
81
+ hasSubmitted = _React$useState16[0],
82
+ setHasSubmitted = _React$useState16[1];
79
83
  var isNextActive = hasSubmitted && typeof onNext === 'function';
80
84
  var isDisabled = !flattenDeep__default.default(currentAnswerList).length || !!userId;
81
85
  var _useCaculatePassage = useCaculatePassage.useCaculatePassage(),
@@ -182,19 +186,20 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
182
186
  onSubmit(true, index.getQuizResult(quizResponse));
183
187
  setSubmitStatus('resolved');
184
188
  onDirty(false);
185
- _context.next = 25;
189
+ setIsActive(false);
190
+ _context.next = 26;
186
191
  break;
187
- case 20:
188
- _context.prev = 20;
192
+ case 21:
193
+ _context.prev = 21;
189
194
  _context.t0 = _context["catch"](3);
190
195
  console.error(_context.t0);
191
196
  onSubmit(false);
192
197
  setSubmitStatus('rejected');
193
- case 25:
198
+ case 26:
194
199
  case "end":
195
200
  return _context.stop();
196
201
  }
197
- }, _callee, null, [[3, 20]]);
202
+ }, _callee, null, [[3, 21]]);
198
203
  }));
199
204
  return function handleSubmit() {
200
205
  return _ref.apply(this, arguments);
@@ -243,6 +248,7 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
243
248
  });
244
249
  onDirty(true);
245
250
  setHasSubmitted(false);
251
+ setIsActive(true);
246
252
  };
247
253
  /**
248
254
  *
@@ -271,6 +277,7 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
271
277
  return [].concat(_rollupPluginBabelHelpers.toConsumableArray(prevOptionList), [selectedOption]);
272
278
  });
273
279
  onDirty(true);
280
+ setIsActive(true);
274
281
  };
275
282
  //
276
283
  //
@@ -388,9 +395,15 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
388
395
  }],
389
396
  children: [renderQuizInfo(), vertical || isVisibleSideBySide ? jsxRuntime.jsx("div", {
390
397
  id: element.MATERIAL_QUIZ_ANSWER_ID,
391
- children: jsxRuntime.jsx(MaterialQuizGroupMobile.default, {})
398
+ children: jsxRuntime.jsx(MaterialQuizGroupMobile.default, {
399
+ isActive: isActive,
400
+ materialQuizResponse: materialQuizResponse
401
+ })
392
402
  }) : jsxRuntime.jsx(jsxRuntime.Fragment, {
393
- children: jsxRuntime.jsx(MaterialQuizGroupDesktop.default, {})
403
+ children: jsxRuntime.jsx(MaterialQuizGroupDesktop.default, {
404
+ isActive: isActive,
405
+ materialQuizResponse: materialQuizResponse
406
+ })
394
407
  }), jsxRuntime.jsx(MaterialQuizAnswerExplanation.default, {})]
395
408
  })
396
409
  });
@@ -1,3 +1,8 @@
1
1
  import React from 'react';
2
- declare const MaterialQuizGroupDesktop: React.FC;
2
+ import type { GetOrgMaterialQuizResponseGetResponses } from '@elice/types';
3
+ interface MaterialQuizGroupDesktopProps {
4
+ isActive: boolean;
5
+ materialQuizResponse?: GetOrgMaterialQuizResponseGetResponses['quizResponse'];
6
+ }
7
+ declare const MaterialQuizGroupDesktop: React.FC<MaterialQuizGroupDesktopProps>;
3
8
  export default MaterialQuizGroupDesktop;
@@ -10,6 +10,7 @@ var designTokens = require('@elice/design-tokens');
10
10
  var icons = require('@elice/icons');
11
11
  var intl = require('@elice/intl');
12
12
  var styled = require('styled-components');
13
+ var index = require('../../../helpers/index.js');
13
14
  var EbDroppable = require('../../eb-sortable/EbDroppable.js');
14
15
  var MaterialQuizContext = require('../context/MaterialQuizContext.js');
15
16
  var context = require('./context/context.js');
@@ -51,7 +52,9 @@ var StyledQuizOptionsDropzone = styled__default.default(EbDroppable.default).wit
51
52
  //
52
53
  //
53
54
  //
54
- var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop() {
55
+ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
56
+ var isActive = _ref3.isActive,
57
+ materialQuizResponse = _ref3.materialQuizResponse;
55
58
  var intl$1 = intl.useRawEliceIntl();
56
59
  var _useMaterialQuizState = MaterialQuizContext.useMaterialQuizState(),
57
60
  userId = _useMaterialQuizState.userId;
@@ -118,10 +121,12 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop() {
118
121
  accept: ".quiz-answer",
119
122
  disabled: !!userId,
120
123
  isGroupAnswer: isGroupAnswer,
121
- children: isGroupAnswer ? (_b = currentAnswerList[dropzoneIndex]) === null || _b === void 0 ? void 0 : _b.map(function (answer, index) {
124
+ children: isGroupAnswer ? (_b = currentAnswerList[dropzoneIndex]) === null || _b === void 0 ? void 0 : _b.map(function (answer, index$1) {
125
+ var status = isActive ? undefined : index.getQuizGroupOptionResultStatus(dropzoneIndex, index$1, materialQuizResponse);
122
126
  return jsxRuntime.jsx(MaterialQuizGroupOptionItem.default, {
127
+ status: status,
123
128
  option: answer
124
- }, index);
129
+ }, index$1);
125
130
  }) : jsxRuntime.jsx(blocks.Text, {
126
131
  role: "gray5",
127
132
  bold: true,
@@ -1,3 +1,8 @@
1
1
  import React from 'react';
2
- declare const MaterialQuizGroupMobile: React.FC;
2
+ import type { GetOrgMaterialQuizResponseGetResponses } from '@elice/types';
3
+ interface MaterialQuizGroupMobileProps {
4
+ isActive: boolean;
5
+ materialQuizResponse?: GetOrgMaterialQuizResponseGetResponses['quizResponse'];
6
+ }
7
+ declare const MaterialQuizGroupMobile: React.FC<MaterialQuizGroupMobileProps>;
3
8
  export default MaterialQuizGroupMobile;
@@ -9,6 +9,7 @@ var blocks = require('@elice/blocks');
9
9
  var designTokens = require('@elice/design-tokens');
10
10
  var intl = require('@elice/intl');
11
11
  var styled = require('styled-components');
12
+ var index = require('../../../helpers/index.js');
12
13
  var MaterialQuizContext = require('../context/MaterialQuizContext.js');
13
14
  var context = require('./context/context.js');
14
15
  var MaterialQuizGroupOptionItem = require('./MaterialQuizGroupOptionItem.js');
@@ -18,6 +19,9 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
18
19
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
19
20
  var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
20
21
 
22
+ //
23
+ //
24
+ //
21
25
  var StyledQuizGroupWrapper = styled__default.default.div.withConfig({
22
26
  componentId: "sc-bftjpj-0"
23
27
  })(["display:flex;flex-direction:column;overflow:hidden;width:100%;padding:1rem;background:", ";border-radius:0.5rem;&:hover{cursor:pointer;}&:not(:last-child){margin-bottom:1rem;}"], designTokens.base.color.white);
@@ -37,7 +41,9 @@ var StyledBottomSheetWrapper = styled__default.default(StyledQuizOptionList).wit
37
41
  isCurrentOptionList = _ref2.isCurrentOptionList;
38
42
  return vertical && isCurrentOptionList ? 'flex-start' : 'center';
39
43
  });
40
- var MaterialQuizGroupMobile = function MaterialQuizGroupMobile() {
44
+ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
45
+ var isActive = _ref3.isActive,
46
+ materialQuizResponse = _ref3.materialQuizResponse;
41
47
  var intl$1 = intl.useRawEliceIntl();
42
48
  // context
43
49
  var _useMaterialQuizState = MaterialQuizContext.useMaterialQuizState(),
@@ -79,12 +85,12 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile() {
79
85
  var renderGroupList = function renderGroupList() {
80
86
  var _a;
81
87
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
82
- children: (_a = materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.groups) === null || _a === void 0 ? void 0 : _a.map(function (group, index) {
88
+ children: (_a = materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.groups) === null || _a === void 0 ? void 0 : _a.map(function (group, index$1) {
83
89
  var _a;
84
- var isCurrentOptionList = Boolean((_a = currentAnswerList === null || currentAnswerList === void 0 ? void 0 : currentAnswerList[index]) === null || _a === void 0 ? void 0 : _a.length);
90
+ var isCurrentOptionList = Boolean((_a = currentAnswerList === null || currentAnswerList === void 0 ? void 0 : currentAnswerList[index$1]) === null || _a === void 0 ? void 0 : _a.length);
85
91
  return jsxRuntime.jsxs(StyledQuizGroupWrapper, {
86
92
  onClick: function onClick() {
87
- return setDropzoneIndex(index);
93
+ return setDropzoneIndex(index$1);
88
94
  },
89
95
  children: [jsxRuntime.jsx(blocks.Text, {
90
96
  size: "small",
@@ -94,9 +100,11 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile() {
94
100
  height: 0.5
95
101
  }), jsxRuntime.jsx(StyledQuizOptionList, {
96
102
  isCurrentOptionList: isCurrentOptionList,
97
- children: isCurrentOptionList ? currentAnswerList[index].map(function (answer) {
103
+ children: isCurrentOptionList ? currentAnswerList[index$1].map(function (answer, answerIndex) {
104
+ var status = isActive ? undefined : index.getQuizGroupOptionResultStatus(index$1, answerIndex, materialQuizResponse);
98
105
  return jsxRuntime.jsx(MaterialQuizGroupOptionItem.default, {
99
106
  option: answer,
107
+ status: status,
100
108
  onClose: function onClose() {
101
109
  var targetId = answer.order;
102
110
  updateCurrentOption(targetId);
@@ -113,7 +121,7 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile() {
113
121
  })
114
122
  })
115
123
  })]
116
- }, index);
124
+ }, index$1);
117
125
  })
118
126
  });
119
127
  };
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { QuizGroupOption } from './context/context';
3
+ type Status = 'correct' | 'wrong' | 'answer';
3
4
  interface MaterialQuizGroupOptionProps {
4
5
  option: QuizGroupOption;
6
+ status?: Status;
5
7
  onClose?: () => void;
6
8
  }
7
9
  declare const MaterialQuizGroupOptionItem: React.FC<MaterialQuizGroupOptionProps>;
@@ -2,55 +2,92 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _styled = require('@emotion/styled/base');
5
6
  var jsxRuntime = require('react/jsx-runtime');
6
- var blocks = require('@elice/blocks');
7
7
  var designTokens = require('@elice/design-tokens');
8
- var icons = require('@elice/icons');
9
8
  var markdown = require('@elice/markdown');
10
- var styled = require('styled-components');
9
+ var muiElements = require('@elice/mui-elements');
10
+ var muiSystem = require('@elice/mui-system');
11
+ var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
12
+ var material = require('@mui/material');
11
13
  var index = require('../../../helpers/index.js');
12
14
  var EbDraggable = require('../../eb-sortable/EbDraggable.js');
13
15
  var MaterialQuizContext = require('../context/MaterialQuizContext.js');
14
16
 
15
17
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
16
18
 
17
- var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
19
+ var _styled__default = /*#__PURE__*/_interopDefaultCompat(_styled);
18
20
 
19
- var StyledDraggbleOption = styled__default.default(EbDraggable.default).withConfig({
20
- componentId: "sc-1b3vxse-0"
21
- })(["display:flex;flex-direction:column;flex-shrink:", ";overflow:hidden;max-width:", ";height:fit-content;border-radius:0.5rem;background:", ";"], function (_ref) {
21
+ //
22
+ //
23
+ //
24
+ var StyledDraggbleOption = /*#__PURE__*/_styled__default.default(EbDraggable.default, {
25
+ target: "ex64yhy3"
26
+ })("display:flex;flex-direction:column;position:relative;flex-shrink:", function (_ref) {
22
27
  var vertical = _ref.vertical;
23
28
  return vertical ? 0 : 1;
24
- }, function (_ref2) {
29
+ }, ";overflow:hidden;max-width:", function (_ref2) {
25
30
  var vertical = _ref2.vertical;
26
31
  return vertical ? '10.25rem' : '11.5rem';
27
- }, designTokens.base.color.navy8);
28
- var StyledOptionTitle = styled__default.default.div.withConfig({
29
- componentId: "sc-1b3vxse-1"
30
- })(["display:flex;justify-content:center;align-items:center;width:", ";height:", ";padding:0.5rem;background:", ";"], function (_ref3) {
31
- var vertical = _ref3.vertical,
32
- isOptionContent = _ref3.isOptionContent;
33
- return isOptionContent ? '100%' : vertical ? '10.25rem' : '11.5rem';
34
- }, function (_ref4) {
32
+ }, ";height:fit-content;border-radius:0.75rem;border:", function (_ref3) {
33
+ var status = _ref3.status,
34
+ theme = _ref3.theme;
35
+ switch (status) {
36
+ case 'correct':
37
+ return "3px solid ".concat(theme.palette.success.light);
38
+ case 'wrong':
39
+ return "3px solid ".concat(theme.palette.error.light);
40
+ default:
41
+ return '3px solid transparent';
42
+ }
43
+ }, ";");
44
+ var StyledOptionTitle = /*#__PURE__*/_styled__default.default("div", {
45
+ target: "ex64yhy2"
46
+ })("display:flex;justify-content:center;align-items:center;width:", function (_ref4) {
35
47
  var vertical = _ref4.vertical,
36
48
  isOptionContent = _ref4.isOptionContent;
49
+ return isOptionContent ? '100%' : vertical ? '10.25rem' : '11.5rem';
50
+ }, ";height:", function (_ref5) {
51
+ var vertical = _ref5.vertical,
52
+ isOptionContent = _ref5.isOptionContent;
37
53
  return isOptionContent ? 'auto' : vertical ? '10.25rem' : '11.5rem';
38
- }, designTokens.base.color.white);
39
- var StyledOptionContent = styled__default.default.div.withConfig({
40
- componentId: "sc-1b3vxse-2"
41
- })(["display:flex;align-items:center;width:", ";height:", ";background:", ";& p{line-height:1;}"], function (_ref5) {
42
- var vertical = _ref5.vertical;
54
+ }, ";padding:0.5rem;background:", designTokens.base.color.white, ";background-color:", function (_ref6) {
55
+ var status = _ref6.status,
56
+ isOptionContent = _ref6.isOptionContent;
57
+ if (!isOptionContent) {
58
+ return 'auto';
59
+ }
60
+ switch (status) {
61
+ case 'correct':
62
+ return muiSystem.colors.green[50];
63
+ case 'wrong':
64
+ return muiSystem.colors.red[50];
65
+ default:
66
+ return 'auto';
67
+ }
68
+ }, ";");
69
+ var StyledOptionContent = /*#__PURE__*/_styled__default.default("div", {
70
+ target: "ex64yhy1"
71
+ })("display:flex;align-items:center;width:", function (_ref7) {
72
+ var vertical = _ref7.vertical;
43
73
  return vertical ? '10.25rem' : '11.5rem';
44
- }, function (_ref6) {
45
- var vertical = _ref6.vertical;
74
+ }, ";height:", function (_ref8) {
75
+ var vertical = _ref8.vertical;
46
76
  return vertical ? '10.25rem' : '11.5rem';
47
- }, designTokens.base.color.navy8);
48
- var StyledOptionRemoveIcon = styled__default.default(blocks.IconButton).withConfig({
49
- componentId: "sc-1b3vxse-3"
50
- })(["position:absolute;top:0.5rem;right:0.5rem;border-radius:1rem;"]);
51
- var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref7) {
52
- var option = _ref7.option,
53
- onClose = _ref7.onClose;
77
+ }, ";background:", designTokens.base.color.navy8, ";& p{line-height:1;}");
78
+ var StyledIconButton = /*#__PURE__*/_styled__default.default(material.IconButton, {
79
+ target: "ex64yhy0"
80
+ })("border-radius:50%;width:1.5rem;height:1.5rem;position:absolute;top:0.5rem;right:0.5rem;background-color:", function (_ref9) {
81
+ var theme = _ref9.theme;
82
+ return theme.palette.action.active;
83
+ }, ";align-self:flex-end;");
84
+ //
85
+ //
86
+ //
87
+ var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref10) {
88
+ var option = _ref10.option,
89
+ status = _ref10.status,
90
+ onClose = _ref10.onClose;
54
91
  var _a;
55
92
  var _useMaterialQuizState = MaterialQuizContext.useMaterialQuizState(),
56
93
  vertical = _useMaterialQuizState.vertical,
@@ -64,14 +101,17 @@ var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref7) {
64
101
  if (!!userId) {
65
102
  return null;
66
103
  }
67
- return jsxRuntime.jsx(StyledOptionRemoveIcon, {
68
- icon: icons.eilMathsignMultiplyBasic,
69
- role: "gray1",
70
- size: "micro",
104
+ return jsxRuntime.jsx(StyledIconButton, {
105
+ size: "small",
106
+ color: "inverse",
71
107
  onClick: function onClick(e) {
72
108
  e.stopPropagation();
73
109
  onClose();
74
- }
110
+ },
111
+ children: jsxRuntime.jsx(muiElements.EliceIcon, {
112
+ icon: proSolidSvgIcons.faXmark,
113
+ fontSize: "inherit"
114
+ })
75
115
  });
76
116
  };
77
117
  //
@@ -82,7 +122,8 @@ var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref7) {
82
122
  id: option.order.toString(),
83
123
  className: "quiz-answer",
84
124
  vertical: vertical,
85
- children: [isOptionContent ? jsxRuntime.jsx(StyledOptionContent, {
125
+ status: status,
126
+ children: [renderRemoveItem(), isOptionContent ? jsxRuntime.jsx(StyledOptionContent, {
86
127
  vertical: vertical,
87
128
  children: jsxRuntime.jsx(markdown.MarkdownSSR, {
88
129
  children: (_a = index.addAltTextToImage(option.options)) !== null && _a !== void 0 ? _a : '',
@@ -92,15 +133,19 @@ var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref7) {
92
133
  })
93
134
  }) : null, isOptionTitle ? jsxRuntime.jsx(StyledOptionTitle, {
94
135
  vertical: vertical,
136
+ status: status,
95
137
  isOptionContent: isOptionContent,
96
- children: jsxRuntime.jsx(blocks.Text, {
97
- size: vertical ? 'small' : 'default',
138
+ children: jsxRuntime.jsx(material.Typography, {
139
+ variant: vertical ? 'body2' : 'body1',
98
140
  textAlign: "center",
99
- wordBreak: "break-all",
100
- bold: true,
141
+ fontWeight: "bold",
142
+ color: status === 'correct' ? 'success.main' : status === 'wrong' ? 'error.main' : 'unset',
143
+ sx: {
144
+ wordBreak: 'break-all'
145
+ },
101
146
  children: option.options.title
102
147
  })
103
- }) : null, renderRemoveItem()]
148
+ }) : null]
104
149
  });
105
150
  };
106
151
 
@@ -2,9 +2,10 @@ import React from 'react';
2
2
  import type { MarkdownEditorFileUploadReqFn } from '@elice/markdown';
3
3
  import type { GetOrgMaterialQuizGetResponses } from '@elice/types';
4
4
  import type { FormState } from 'react-hook-form';
5
+ import type { MaterialQuizApiProviderProps } from '../shared';
5
6
  export type MaterialQuizEditValue = Pick<GetOrgMaterialQuizGetResponses['materialQuiz'], 'id' | 'questionTitle' | 'questionDescription' | 'optionType' | 'optionsDefault' | 'answerInfoDefault' | 'answerHint' | 'isAutoGrade' | 'explanationInfo' | 'groups' | 'optionsSetEnabled'>;
6
7
  export type MaterialQuizEditFormState = Pick<FormState<Record<string, any>>, 'isDirty' | 'isValid'>;
7
- export interface MaterialQuizEditProps {
8
+ export interface MaterialQuizEditProps extends MaterialQuizApiProviderProps {
8
9
  /** Value of material quiz edit form. */
9
10
  value: MaterialQuizEditValue;
10
11
  /**
@@ -7,6 +7,14 @@ var React = require('react');
7
7
  var reactHookForm = require('react-hook-form');
8
8
  var intl = require('@elice/intl');
9
9
  var materialSharedUtils = require('@elice/material-shared-utils');
10
+ require('../shared/QuizDraggbleDroppedOption.js');
11
+ require('../shared/QuizDraggbleDummyOption.js');
12
+ require('../shared/QuizDraggbleOption.js');
13
+ require('../shared/question-radio/QuestionRadio.js');
14
+ require('../shared/question-radio/QuestionRadioOption.js');
15
+ require('../shared/question-checkbox/QuestionCheckbox.js');
16
+ require('../shared/question-checkbox/QuestionCheckboxOption.js');
17
+ var MaterialQuizApiContext = require('../shared/contexts/MaterialQuizApiContext.js');
10
18
  var editValue = require('./utils/editValue.js');
11
19
  var context = require('./context.js');
12
20
  var en = require('./locales/en.json.js');
@@ -18,7 +26,8 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
18
26
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
19
27
 
20
28
  var MaterialQuizEdit = React.forwardRef(function (_ref, ref) {
21
- var value = _ref.value,
29
+ var eliceCourseApiConfiguration = _ref.eliceCourseApiConfiguration,
30
+ value = _ref.value,
22
31
  _ref$disabled = _ref.disabled,
23
32
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
24
33
  onChange = _ref.onChange,
@@ -82,18 +91,21 @@ var MaterialQuizEdit = React.forwardRef(function (_ref, ref) {
82
91
  //
83
92
  //
84
93
  //
85
- return jsxRuntime.jsx(intl.RawEliceIntlProvider, {
86
- value: __intl,
87
- children: jsxRuntime.jsx("form", {
88
- ref: formElRef,
89
- children: jsxRuntime.jsx(context.default.Provider, {
90
- value: {
91
- disabled: disabled,
92
- onFileUploadRequest: onFileUploadRequest
93
- },
94
- children: jsxRuntime.jsx(reactHookForm.FormProvider, Object.assign({}, useFormMethods, {
95
- children: jsxRuntime.jsx(MaterialQuizEditContent.default, {})
96
- }))
94
+ return jsxRuntime.jsx(MaterialQuizApiContext.MaterialQuizApiProvider, {
95
+ eliceCourseApiConfiguration: eliceCourseApiConfiguration,
96
+ children: jsxRuntime.jsx(intl.RawEliceIntlProvider, {
97
+ value: __intl,
98
+ children: jsxRuntime.jsx("form", {
99
+ ref: formElRef,
100
+ children: jsxRuntime.jsx(context.default.Provider, {
101
+ value: {
102
+ disabled: disabled,
103
+ onFileUploadRequest: onFileUploadRequest
104
+ },
105
+ children: jsxRuntime.jsx(reactHookForm.FormProvider, Object.assign({}, useFormMethods, {
106
+ children: jsxRuntime.jsx(MaterialQuizEditContent.default, {})
107
+ }))
108
+ })
97
109
  })
98
110
  })
99
111
  });