@elice/material-quiz 1.241126.0-disabled.0 → 1.241126.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.
@@ -114,7 +114,7 @@ var MaterialQuizSelectMultipleOrder = function MaterialQuizSelectMultipleOrder(_
114
114
  var isNextActive = hasSubmitted && typeof onNext === 'function';
115
115
  var isDisabled = (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.correctOptionCount) !== answerList.filter(function (answer) {
116
116
  return answer.order !== null;
117
- }).length || index.checkUserLectureTestEnded(lecture) || !!userId;
117
+ }).length || !!userId;
118
118
  var isTestLecture = (lecture === null || lecture === void 0 ? void 0 : lecture.lectureType) === types.enums.LectureType.Test;
119
119
  // ref
120
120
  var optionBoxRef = React__default.default.useRef(null);
@@ -473,11 +473,11 @@ var MaterialQuizSelectMultipleOrder = function MaterialQuizSelectMultipleOrder(_
473
473
  var renderQuizDragOption = function renderQuizDragOption() {
474
474
  return jsxRuntime.jsxs(StyledQuizOptionsDropZone, {
475
475
  id: "quiz-options-dropzone",
476
- disabled: isDisabled,
476
+ disabled: !!userId,
477
477
  accept: ".quiz-answer",
478
478
  children: [optionList.map(function (option, index) {
479
479
  return jsxRuntime.jsx(QuizDraggbleOption.default, {
480
- disabled: isDisabled,
480
+ disabled: !!userId,
481
481
  id: "quiz-option-".concat(index),
482
482
  className: "quiz-option",
483
483
  content: option.value,
@@ -534,7 +534,7 @@ var MaterialQuizSelectMultipleOrder = function MaterialQuizSelectMultipleOrder(_
534
534
  id: "option-answer-".concat(index$1),
535
535
  content: option.value,
536
536
  role: getRole(),
537
- disabled: isDisabled,
537
+ disabled: !!userId,
538
538
  indexOrder: index$1 + 1,
539
539
  isMarkdown: !!(course === null || course === void 0 ? void 0 : course.preference.renderMarkdownInQuizOptions)
540
540
  }, "option-answer-".concat(index$1));
@@ -41,8 +41,7 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
41
41
  materialQuiz = _useMaterialQuizState.materialQuiz,
42
42
  userId = _useMaterialQuizState.userId,
43
43
  vertical = _useMaterialQuizState.vertical,
44
- isLongPassage = _useMaterialQuizState.isLongPassage,
45
- lecture = _useMaterialQuizState.lecture;
44
+ isLongPassage = _useMaterialQuizState.isLongPassage;
46
45
  var _useMaterialQuizDispa = MaterialQuizContext.useMaterialQuizDispatch(),
47
46
  onSubmit = _useMaterialQuizDispa.onSubmit,
48
47
  onNext = _useMaterialQuizDispa.onNext,
@@ -82,7 +81,7 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
82
81
  hasSubmitted = _React$useState16[0],
83
82
  setHasSubmitted = _React$useState16[1];
84
83
  var isNextActive = hasSubmitted && typeof onNext === 'function';
85
- var isDisabled = !flattenDeep__default.default(currentAnswerList).length || index.checkUserLectureTestEnded(lecture) || !!userId;
84
+ var isDisabled = !flattenDeep__default.default(currentAnswerList).length || !!userId;
86
85
  var _useCaculatePassage = useCaculatePassage.useCaculatePassage(),
87
86
  questionRef = _useCaculatePassage.questionRef,
88
87
  containerRef = _useCaculatePassage.containerRef;
@@ -359,7 +358,6 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
359
358
  optionList: optionList,
360
359
  currentOptionList: currentOptionList,
361
360
  currentAnswerList: currentAnswerList,
362
- isDisabled: isDisabled,
363
361
  onUpdateAnswer: setCurrentAnswerList,
364
362
  onUpdateOption: setCurrentOptionList,
365
363
  onUpdateHasSubmitted: setHasSubmitted,
@@ -65,7 +65,6 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
65
65
  groupList = _React$useContext.groupList,
66
66
  currentAnswerList = _React$useContext.currentAnswerList,
67
67
  currentOptionList = _React$useContext.currentOptionList,
68
- isDisabled = _React$useContext.isDisabled,
69
68
  updateCurrentAnswer = _React$useContext.updateCurrentAnswer,
70
69
  updateCurrentOption = _React$useContext.updateCurrentOption,
71
70
  handleAnswerReset = _React$useContext.handleAnswerReset;
@@ -124,13 +123,12 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
124
123
  }), jsxRuntime.jsx(StyledQuizAnswerDropzone, {
125
124
  id: "quiz-answer-dropzone-".concat(dropzoneIndex),
126
125
  accept: ".quiz-answer",
127
- disabled: isDisabled,
126
+ disabled: !!userId,
128
127
  isGroupAnswer: isGroupAnswer,
129
128
  children: isGroupAnswer ? (_b = currentAnswerList[dropzoneIndex]) === null || _b === void 0 ? void 0 : _b.map(function (answer, index$1) {
130
129
  var isHideStatus = !userId && (isActive || isTestLecture);
131
130
  var status = isHideStatus ? undefined : index.getQuizGroupOptionResultStatus(dropzoneIndex, index$1, answer.order, materialQuizResponse, materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.answerInfo);
132
131
  return jsxRuntime.jsx(MaterialQuizGroupOptionItem.default, {
133
- disabled: isDisabled,
134
132
  status: status,
135
133
  option: answer
136
134
  }, index$1);
@@ -182,7 +180,7 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
182
180
  children: [jsxRuntime.jsx(blocks.Button, {
183
181
  role: "white",
184
182
  size: "small",
185
- disabled: isDisabled,
183
+ disabled: !!userId,
186
184
  onClick: handleAnswerReset,
187
185
  children: intl$1.formatMessage({
188
186
  id: 'materialQuiz.dropzone.optionReset'
@@ -194,8 +192,7 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
194
192
  accept: ".quiz-answer",
195
193
  children: currentOptionList.length ? currentOptionList.map(function (option, index) {
196
194
  return jsxRuntime.jsx(MaterialQuizGroupOptionItem.default, {
197
- option: option,
198
- disabled: isDisabled
195
+ option: option
199
196
  }, index);
200
197
  }) : jsxRuntime.jsx(blocks.Flex, {
201
198
  justify: "center",
@@ -55,7 +55,6 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
55
55
  var _React$useContext = React__default.default.useContext(context.default),
56
56
  currentOptionList = _React$useContext.currentOptionList,
57
57
  currentAnswerList = _React$useContext.currentAnswerList,
58
- isDisabled = _React$useContext.isDisabled,
59
58
  updateCurrentAnswer = _React$useContext.updateCurrentAnswer,
60
59
  updateCurrentOption = _React$useContext.updateCurrentOption,
61
60
  handleAnswerReset = _React$useContext.handleAnswerReset;
@@ -72,7 +71,7 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
72
71
  children: [jsxRuntime.jsx(blocks.Button, {
73
72
  role: "white",
74
73
  size: "small",
75
- disabled: isDisabled,
74
+ disabled: !!userId,
76
75
  onClick: handleAnswerReset,
77
76
  block: true,
78
77
  children: intl$1.formatMessage({
@@ -109,7 +108,6 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
109
108
  var status = isHideStatus ? undefined : index.getQuizGroupOptionResultStatus(index$1, answerIndex, answer.order, materialQuizResponse, materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.answerInfo);
110
109
  return jsxRuntime.jsx(MaterialQuizGroupOptionItem.default, {
111
110
  option: answer,
112
- disabled: isDisabled,
113
111
  status: status,
114
112
  onClose: function onClose() {
115
113
  var targetId = answer.order;
@@ -162,8 +160,7 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
162
160
  updateCurrentAnswer(targetId, dropzoneIndex);
163
161
  },
164
162
  children: jsxRuntime.jsx(MaterialQuizGroupOptionItem.default, {
165
- option: option,
166
- disabled: isDisabled
163
+ option: option
167
164
  }, index)
168
165
  }, index);
169
166
  }) : jsxRuntime.jsx(blocks.Text, {
@@ -3,7 +3,6 @@ import type { QuizGroupOption } from './context/context';
3
3
  type Status = 'correct' | 'wrong' | 'answer';
4
4
  interface MaterialQuizGroupOptionProps {
5
5
  option: QuizGroupOption;
6
- disabled?: boolean;
7
6
  status?: Status;
8
7
  onClose?: () => void;
9
8
  }
@@ -40,23 +40,20 @@ var StyledDraggbleOption = /*#__PURE__*/_styled__default.default(EbDraggable.def
40
40
  default:
41
41
  return '3px solid transparent';
42
42
  }
43
- }, ";cursor:", function (_ref4) {
44
- var disabled = _ref4.disabled;
45
- return disabled ? 'not-allowed !important' : 'auto';
46
43
  }, ";");
47
44
  var StyledOptionTitle = /*#__PURE__*/_styled__default.default("div", {
48
45
  target: "ex64yhy2"
49
- })("display:flex;justify-content:center;align-items:center;width:", function (_ref5) {
46
+ })("display:flex;justify-content:center;align-items:center;width:", function (_ref4) {
47
+ var vertical = _ref4.vertical,
48
+ isOptionContent = _ref4.isOptionContent;
49
+ return isOptionContent ? '100%' : vertical ? '10.25rem' : '11.5rem';
50
+ }, ";height:", function (_ref5) {
50
51
  var vertical = _ref5.vertical,
51
52
  isOptionContent = _ref5.isOptionContent;
52
- return isOptionContent ? '100%' : vertical ? '10.25rem' : '11.5rem';
53
- }, ";height:", function (_ref6) {
54
- var vertical = _ref6.vertical,
55
- isOptionContent = _ref6.isOptionContent;
56
53
  return isOptionContent ? 'auto' : vertical ? '10.25rem' : '11.5rem';
57
- }, ";padding:0.5rem;background:", designTokens.base.color.white, ";background-color:", function (_ref7) {
58
- var status = _ref7.status,
59
- isOptionContent = _ref7.isOptionContent;
54
+ }, ";padding:0.5rem;background:", designTokens.base.color.white, ";background-color:", function (_ref6) {
55
+ var status = _ref6.status,
56
+ isOptionContent = _ref6.isOptionContent;
60
57
  if (!isOptionContent) {
61
58
  return 'auto';
62
59
  }
@@ -71,27 +68,26 @@ var StyledOptionTitle = /*#__PURE__*/_styled__default.default("div", {
71
68
  }, ";");
72
69
  var StyledOptionContent = /*#__PURE__*/_styled__default.default("div", {
73
70
  target: "ex64yhy1"
74
- })("display:flex;align-items:center;width:", function (_ref8) {
75
- var vertical = _ref8.vertical;
71
+ })("display:flex;align-items:center;width:", function (_ref7) {
72
+ var vertical = _ref7.vertical;
76
73
  return vertical ? '10.25rem' : '11.5rem';
77
- }, ";height:", function (_ref9) {
78
- var vertical = _ref9.vertical;
74
+ }, ";height:", function (_ref8) {
75
+ var vertical = _ref8.vertical;
79
76
  return vertical ? '10.25rem' : '11.5rem';
80
77
  }, ";background:", designTokens.base.color.navy8, ";& p{line-height:1;}");
81
78
  var StyledIconButton = /*#__PURE__*/_styled__default.default(material.IconButton, {
82
79
  target: "ex64yhy0"
83
- })("border-radius:50%;width:1.5rem;height:1.5rem;position:absolute;top:0.5rem;right:0.5rem;background-color:", function (_ref10) {
84
- var theme = _ref10.theme;
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;
85
82
  return theme.palette.action.active;
86
83
  }, ";align-self:flex-end;");
87
84
  //
88
85
  //
89
86
  //
90
- var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref11) {
91
- var option = _ref11.option,
92
- status = _ref11.status,
93
- disabled = _ref11.disabled,
94
- onClose = _ref11.onClose;
87
+ var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref10) {
88
+ var option = _ref10.option,
89
+ status = _ref10.status,
90
+ onClose = _ref10.onClose;
95
91
  var _a;
96
92
  var _useMaterialQuizState = MaterialQuizContext.useMaterialQuizState(),
97
93
  vertical = _useMaterialQuizState.vertical,
@@ -122,7 +118,7 @@ var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref11) {
122
118
  //
123
119
  //
124
120
  return jsxRuntime.jsxs(StyledDraggbleOption, {
125
- disabled: disabled || vertical,
121
+ disabled: !!userId || vertical,
126
122
  id: option.order.toString(),
127
123
  className: "quiz-answer",
128
124
  vertical: vertical,
@@ -11,7 +11,6 @@ interface QuizGroupContextValue {
11
11
  optionList: QuizGroupOption[];
12
12
  currentOptionList: QuizGroupOption[];
13
13
  currentAnswerList: QuizGroupOption[][];
14
- isDisabled: boolean;
15
14
  onDirty: (value: boolean) => void;
16
15
  onUpdateAnswer: (value: React.SetStateAction<QuizGroupOption[][]>) => void;
17
16
  onUpdateOption: (value: React.SetStateAction<QuizGroupOption[]>) => void;
@@ -47,11 +47,8 @@ var StyledOrder = styled__default.default.div.withConfig({
47
47
  })(["width:1.5rem;height:1.5rem;display:flex;border-radius:4px;align-items:center;justify-content:center;color:", ";background-color:", ";flex:none;margin-left:0.5rem;"], designTokens.base.color.navy0, designTokens.base.color.navy4);
48
48
  var StyledQuizDraggbleOption = styled__default.default(EbDraggable.default).withConfig({
49
49
  componentId: "sc-19b0zkq-3"
50
- })(["display:flex;border-radius:8px;border:1px solid ", ";background-color:", ";overflow:hidden;cursor:", ";&:not(:last-of-type){margin-bottom:1rem;}", "{background-color:", ";color:", ";}", "{background-color:", ";& *{color:", ";}}", "{background-color:", ";color:", ";}&.ui-draggable-dragging{z-index:1000 !important;color:", " !important;border:none !important;", "{background-color:", ";}", "{background-color:", ";border:1px solid ", " !important;}", "{color:", ";background-color:", ";}& *{color:", " !important;}}&.ui-draggable-dragging.quiz-answer{width:calc(100% - 1rem * 2);}"], designTokens.base.color.navy4, designTokens.base.color.navy5, function (_ref3) {
51
- var disabled = _ref3.disabled;
52
- return disabled ? 'not-allowed !important' : 'auto';
53
- }, StyledQuizDraggbleOptionHandle, function (_ref4) {
54
- var role = _ref4.role;
50
+ })(["display:flex;border-radius:8px;border:1px solid ", ";background-color:", ";overflow:hidden;&:not(:last-of-type){margin-bottom:1rem;}", "{background-color:", ";color:", ";}", "{background-color:", ";& *{color:", ";}}", "{background-color:", ";color:", ";}&.ui-draggable-dragging{z-index:1000 !important;color:", " !important;border:none !important;", "{background-color:", ";}", "{background-color:", ";border:1px solid ", " !important;}", "{color:", ";background-color:", ";}& *{color:", " !important;}}&.ui-draggable-dragging.quiz-answer{width:calc(100% - 1rem * 2);}"], designTokens.base.color.navy4, designTokens.base.color.navy5, StyledQuizDraggbleOptionHandle, function (_ref3) {
51
+ var role = _ref3.role;
55
52
  switch (role) {
56
53
  case 'answer':
57
54
  return designTokens.base.color.primary4;
@@ -63,8 +60,8 @@ var StyledQuizDraggbleOption = styled__default.default(EbDraggable.default).with
63
60
  default:
64
61
  return designTokens.base.color.navy3;
65
62
  }
66
- }, function (_ref5) {
67
- var role = _ref5.role;
63
+ }, function (_ref4) {
64
+ var role = _ref4.role;
68
65
  switch (role) {
69
66
  case 'answer':
70
67
  return designTokens.base.color.primary9;
@@ -76,8 +73,8 @@ var StyledQuizDraggbleOption = styled__default.default(EbDraggable.default).with
76
73
  default:
77
74
  return designTokens.base.color.navy5;
78
75
  }
79
- }, StyledQuizDraggbleOptionContent, function (_ref6) {
80
- var role = _ref6.role;
76
+ }, StyledQuizDraggbleOptionContent, function (_ref5) {
77
+ var role = _ref5.role;
81
78
  switch (role) {
82
79
  case 'answer':
83
80
  return designTokens.base.color.primary1;
@@ -89,8 +86,8 @@ var StyledQuizDraggbleOption = styled__default.default(EbDraggable.default).with
89
86
  default:
90
87
  return designTokens.base.color.navy5;
91
88
  }
92
- }, function (_ref7) {
93
- var role = _ref7.role;
89
+ }, function (_ref6) {
90
+ var role = _ref6.role;
94
91
  switch (role) {
95
92
  case 'answer':
96
93
  return designTokens.base.color.primary9;
@@ -102,8 +99,8 @@ var StyledQuizDraggbleOption = styled__default.default(EbDraggable.default).with
102
99
  default:
103
100
  return designTokens.base.color.navy0;
104
101
  }
105
- }, StyledOrder, function (_ref8) {
106
- var role = _ref8.role;
102
+ }, StyledOrder, function (_ref7) {
103
+ var role = _ref7.role;
107
104
  switch (role) {
108
105
  case 'answer':
109
106
  return designTokens.base.color.primary3;
@@ -115,8 +112,8 @@ var StyledQuizDraggbleOption = styled__default.default(EbDraggable.default).with
115
112
  default:
116
113
  return designTokens.base.color.navy4;
117
114
  }
118
- }, function (_ref9) {
119
- var role = _ref9.role;
115
+ }, function (_ref8) {
116
+ var role = _ref8.role;
120
117
  switch (role) {
121
118
  case 'answer':
122
119
  return designTokens.base.color.primary9;
@@ -132,17 +129,17 @@ var StyledQuizDraggbleOption = styled__default.default(EbDraggable.default).with
132
129
  //
133
130
  //
134
131
  //
135
- var QuizDraggbleOption = function QuizDraggbleOption(_ref10) {
136
- var id = _ref10.id,
137
- className = _ref10.className,
138
- content = _ref10.content,
139
- _ref10$disabled = _ref10.disabled,
140
- disabled = _ref10$disabled === void 0 ? false : _ref10$disabled,
141
- _ref10$role = _ref10.role,
142
- role = _ref10$role === void 0 ? 'default' : _ref10$role,
143
- indexOrder = _ref10.indexOrder,
144
- _ref10$isMarkdown = _ref10.isMarkdown,
145
- isMarkdown = _ref10$isMarkdown === void 0 ? false : _ref10$isMarkdown;
132
+ var QuizDraggbleOption = function QuizDraggbleOption(_ref9) {
133
+ var id = _ref9.id,
134
+ className = _ref9.className,
135
+ content = _ref9.content,
136
+ _ref9$disabled = _ref9.disabled,
137
+ disabled = _ref9$disabled === void 0 ? false : _ref9$disabled,
138
+ _ref9$role = _ref9.role,
139
+ role = _ref9$role === void 0 ? 'default' : _ref9$role,
140
+ indexOrder = _ref9.indexOrder,
141
+ _ref9$isMarkdown = _ref9.isMarkdown,
142
+ isMarkdown = _ref9$isMarkdown === void 0 ? false : _ref9$isMarkdown;
146
143
  var _useMaterialQuizState = MaterialQuizContext.useMaterialQuizState(),
147
144
  vertical = _useMaterialQuizState.vertical;
148
145
  //
@@ -105,7 +105,7 @@ var MaterialQuizSelectMultipleOrder = function MaterialQuizSelectMultipleOrder(_
105
105
  var isNextActive = hasSubmitted && typeof onNext === 'function';
106
106
  var isDisabled = (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.correctOptionCount) !== answerList.filter(function (answer) {
107
107
  return answer.order !== null;
108
- }).length || checkUserLectureTestEnded(lecture) || !!userId;
108
+ }).length || !!userId;
109
109
  var isTestLecture = (lecture === null || lecture === void 0 ? void 0 : lecture.lectureType) === enums.LectureType.Test;
110
110
  // ref
111
111
  var optionBoxRef = React.useRef(null);
@@ -464,11 +464,11 @@ var MaterialQuizSelectMultipleOrder = function MaterialQuizSelectMultipleOrder(_
464
464
  var renderQuizDragOption = function renderQuizDragOption() {
465
465
  return jsxs(StyledQuizOptionsDropZone, {
466
466
  id: "quiz-options-dropzone",
467
- disabled: isDisabled,
467
+ disabled: !!userId,
468
468
  accept: ".quiz-answer",
469
469
  children: [optionList.map(function (option, index) {
470
470
  return jsx(QuizDraggbleOption, {
471
- disabled: isDisabled,
471
+ disabled: !!userId,
472
472
  id: "quiz-option-".concat(index),
473
473
  className: "quiz-option",
474
474
  content: option.value,
@@ -525,7 +525,7 @@ var MaterialQuizSelectMultipleOrder = function MaterialQuizSelectMultipleOrder(_
525
525
  id: "option-answer-".concat(index),
526
526
  content: option.value,
527
527
  role: getRole(),
528
- disabled: isDisabled,
528
+ disabled: !!userId,
529
529
  indexOrder: index + 1,
530
530
  isMarkdown: !!(course === null || course === void 0 ? void 0 : course.preference.renderMarkdownInQuizOptions)
531
531
  }, "option-answer-".concat(index));
@@ -9,7 +9,7 @@ import { useTheme } from '@mui/material';
9
9
  import cloneDeep from 'lodash-es/cloneDeep';
10
10
  import flattenDeep from 'lodash-es/flattenDeep';
11
11
  import { MATERIAL_QUIZ_ANSWER_ID, MATERIAL_QUIZ_PASSIVE_ID } from '../../../constant/element.js';
12
- import { checkUserLectureTestEnded, getQuizResult } from '../../../helpers/index.js';
12
+ import { getQuizResult } from '../../../helpers/index.js';
13
13
  import { useCaculatePassage } from '../../../hooks/useCaculatePassage.js';
14
14
  import QuestionBox from '../../shared/QuestionBox.js';
15
15
  import { useMaterialQuizState, useMaterialQuizDispatch } from '../context/MaterialQuizContext.js';
@@ -31,8 +31,7 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
31
31
  materialQuiz = _useMaterialQuizState.materialQuiz,
32
32
  userId = _useMaterialQuizState.userId,
33
33
  vertical = _useMaterialQuizState.vertical,
34
- isLongPassage = _useMaterialQuizState.isLongPassage,
35
- lecture = _useMaterialQuizState.lecture;
34
+ isLongPassage = _useMaterialQuizState.isLongPassage;
36
35
  var _useMaterialQuizDispa = useMaterialQuizDispatch(),
37
36
  onSubmit = _useMaterialQuizDispa.onSubmit,
38
37
  onNext = _useMaterialQuizDispa.onNext,
@@ -72,7 +71,7 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
72
71
  hasSubmitted = _React$useState16[0],
73
72
  setHasSubmitted = _React$useState16[1];
74
73
  var isNextActive = hasSubmitted && typeof onNext === 'function';
75
- var isDisabled = !flattenDeep(currentAnswerList).length || checkUserLectureTestEnded(lecture) || !!userId;
74
+ var isDisabled = !flattenDeep(currentAnswerList).length || !!userId;
76
75
  var _useCaculatePassage = useCaculatePassage(),
77
76
  questionRef = _useCaculatePassage.questionRef,
78
77
  containerRef = _useCaculatePassage.containerRef;
@@ -349,7 +348,6 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
349
348
  optionList: optionList,
350
349
  currentOptionList: currentOptionList,
351
350
  currentAnswerList: currentAnswerList,
352
- isDisabled: isDisabled,
353
351
  onUpdateAnswer: setCurrentAnswerList,
354
352
  onUpdateOption: setCurrentOptionList,
355
353
  onUpdateHasSubmitted: setHasSubmitted,
@@ -56,7 +56,6 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
56
56
  groupList = _React$useContext.groupList,
57
57
  currentAnswerList = _React$useContext.currentAnswerList,
58
58
  currentOptionList = _React$useContext.currentOptionList,
59
- isDisabled = _React$useContext.isDisabled,
60
59
  updateCurrentAnswer = _React$useContext.updateCurrentAnswer,
61
60
  updateCurrentOption = _React$useContext.updateCurrentOption,
62
61
  handleAnswerReset = _React$useContext.handleAnswerReset;
@@ -115,13 +114,12 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
115
114
  }), jsx(StyledQuizAnswerDropzone, {
116
115
  id: "quiz-answer-dropzone-".concat(dropzoneIndex),
117
116
  accept: ".quiz-answer",
118
- disabled: isDisabled,
117
+ disabled: !!userId,
119
118
  isGroupAnswer: isGroupAnswer,
120
119
  children: isGroupAnswer ? (_b = currentAnswerList[dropzoneIndex]) === null || _b === void 0 ? void 0 : _b.map(function (answer, index) {
121
120
  var isHideStatus = !userId && (isActive || isTestLecture);
122
121
  var status = isHideStatus ? undefined : getQuizGroupOptionResultStatus(dropzoneIndex, index, answer.order, materialQuizResponse, materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.answerInfo);
123
122
  return jsx(MaterialQuizGroupOptionItem, {
124
- disabled: isDisabled,
125
123
  status: status,
126
124
  option: answer
127
125
  }, index);
@@ -173,7 +171,7 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
173
171
  children: [jsx(Button, {
174
172
  role: "white",
175
173
  size: "small",
176
- disabled: isDisabled,
174
+ disabled: !!userId,
177
175
  onClick: handleAnswerReset,
178
176
  children: intl.formatMessage({
179
177
  id: 'materialQuiz.dropzone.optionReset'
@@ -185,8 +183,7 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
185
183
  accept: ".quiz-answer",
186
184
  children: currentOptionList.length ? currentOptionList.map(function (option, index) {
187
185
  return jsx(MaterialQuizGroupOptionItem, {
188
- option: option,
189
- disabled: isDisabled
186
+ option: option
190
187
  }, index);
191
188
  }) : jsx(Flex, {
192
189
  justify: "center",
@@ -46,7 +46,6 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
46
46
  var _React$useContext = React.useContext(QuizGroupContext),
47
47
  currentOptionList = _React$useContext.currentOptionList,
48
48
  currentAnswerList = _React$useContext.currentAnswerList,
49
- isDisabled = _React$useContext.isDisabled,
50
49
  updateCurrentAnswer = _React$useContext.updateCurrentAnswer,
51
50
  updateCurrentOption = _React$useContext.updateCurrentOption,
52
51
  handleAnswerReset = _React$useContext.handleAnswerReset;
@@ -63,7 +62,7 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
63
62
  children: [jsx(Button, {
64
63
  role: "white",
65
64
  size: "small",
66
- disabled: isDisabled,
65
+ disabled: !!userId,
67
66
  onClick: handleAnswerReset,
68
67
  block: true,
69
68
  children: intl.formatMessage({
@@ -100,7 +99,6 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
100
99
  var status = isHideStatus ? undefined : getQuizGroupOptionResultStatus(index, answerIndex, answer.order, materialQuizResponse, materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.answerInfo);
101
100
  return jsx(MaterialQuizGroupOptionItem, {
102
101
  option: answer,
103
- disabled: isDisabled,
104
102
  status: status,
105
103
  onClose: function onClose() {
106
104
  var targetId = answer.order;
@@ -153,8 +151,7 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
153
151
  updateCurrentAnswer(targetId, dropzoneIndex);
154
152
  },
155
153
  children: jsx(MaterialQuizGroupOptionItem, {
156
- option: option,
157
- disabled: isDisabled
154
+ option: option
158
155
  }, index)
159
156
  }, index);
160
157
  }) : jsx(Text, {
@@ -3,7 +3,6 @@ import type { QuizGroupOption } from './context/context';
3
3
  type Status = 'correct' | 'wrong' | 'answer';
4
4
  interface MaterialQuizGroupOptionProps {
5
5
  option: QuizGroupOption;
6
- disabled?: boolean;
7
6
  status?: Status;
8
7
  onClose?: () => void;
9
8
  }
@@ -32,23 +32,20 @@ var StyledDraggbleOption = /*#__PURE__*/_styled(EbDraggable, {
32
32
  default:
33
33
  return '3px solid transparent';
34
34
  }
35
- }, ";cursor:", function (_ref4) {
36
- var disabled = _ref4.disabled;
37
- return disabled ? 'not-allowed !important' : 'auto';
38
35
  }, ";");
39
36
  var StyledOptionTitle = /*#__PURE__*/_styled("div", {
40
37
  target: "ex64yhy2"
41
- })("display:flex;justify-content:center;align-items:center;width:", function (_ref5) {
38
+ })("display:flex;justify-content:center;align-items:center;width:", function (_ref4) {
39
+ var vertical = _ref4.vertical,
40
+ isOptionContent = _ref4.isOptionContent;
41
+ return isOptionContent ? '100%' : vertical ? '10.25rem' : '11.5rem';
42
+ }, ";height:", function (_ref5) {
42
43
  var vertical = _ref5.vertical,
43
44
  isOptionContent = _ref5.isOptionContent;
44
- return isOptionContent ? '100%' : vertical ? '10.25rem' : '11.5rem';
45
- }, ";height:", function (_ref6) {
46
- var vertical = _ref6.vertical,
47
- isOptionContent = _ref6.isOptionContent;
48
45
  return isOptionContent ? 'auto' : vertical ? '10.25rem' : '11.5rem';
49
- }, ";padding:0.5rem;background:", base.color.white, ";background-color:", function (_ref7) {
50
- var status = _ref7.status,
51
- isOptionContent = _ref7.isOptionContent;
46
+ }, ";padding:0.5rem;background:", base.color.white, ";background-color:", function (_ref6) {
47
+ var status = _ref6.status,
48
+ isOptionContent = _ref6.isOptionContent;
52
49
  if (!isOptionContent) {
53
50
  return 'auto';
54
51
  }
@@ -63,27 +60,26 @@ var StyledOptionTitle = /*#__PURE__*/_styled("div", {
63
60
  }, ";");
64
61
  var StyledOptionContent = /*#__PURE__*/_styled("div", {
65
62
  target: "ex64yhy1"
66
- })("display:flex;align-items:center;width:", function (_ref8) {
67
- var vertical = _ref8.vertical;
63
+ })("display:flex;align-items:center;width:", function (_ref7) {
64
+ var vertical = _ref7.vertical;
68
65
  return vertical ? '10.25rem' : '11.5rem';
69
- }, ";height:", function (_ref9) {
70
- var vertical = _ref9.vertical;
66
+ }, ";height:", function (_ref8) {
67
+ var vertical = _ref8.vertical;
71
68
  return vertical ? '10.25rem' : '11.5rem';
72
69
  }, ";background:", base.color.navy8, ";& p{line-height:1;}");
73
70
  var StyledIconButton = /*#__PURE__*/_styled(IconButton, {
74
71
  target: "ex64yhy0"
75
- })("border-radius:50%;width:1.5rem;height:1.5rem;position:absolute;top:0.5rem;right:0.5rem;background-color:", function (_ref10) {
76
- var theme = _ref10.theme;
72
+ })("border-radius:50%;width:1.5rem;height:1.5rem;position:absolute;top:0.5rem;right:0.5rem;background-color:", function (_ref9) {
73
+ var theme = _ref9.theme;
77
74
  return theme.palette.action.active;
78
75
  }, ";align-self:flex-end;");
79
76
  //
80
77
  //
81
78
  //
82
- var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref11) {
83
- var option = _ref11.option,
84
- status = _ref11.status,
85
- disabled = _ref11.disabled,
86
- onClose = _ref11.onClose;
79
+ var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref10) {
80
+ var option = _ref10.option,
81
+ status = _ref10.status,
82
+ onClose = _ref10.onClose;
87
83
  var _a;
88
84
  var _useMaterialQuizState = useMaterialQuizState(),
89
85
  vertical = _useMaterialQuizState.vertical,
@@ -114,7 +110,7 @@ var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref11) {
114
110
  //
115
111
  //
116
112
  return jsxs(StyledDraggbleOption, {
117
- disabled: disabled || vertical,
113
+ disabled: !!userId || vertical,
118
114
  id: option.order.toString(),
119
115
  className: "quiz-answer",
120
116
  vertical: vertical,
@@ -11,7 +11,6 @@ interface QuizGroupContextValue {
11
11
  optionList: QuizGroupOption[];
12
12
  currentOptionList: QuizGroupOption[];
13
13
  currentAnswerList: QuizGroupOption[][];
14
- isDisabled: boolean;
15
14
  onDirty: (value: boolean) => void;
16
15
  onUpdateAnswer: (value: React.SetStateAction<QuizGroupOption[][]>) => void;
17
16
  onUpdateOption: (value: React.SetStateAction<QuizGroupOption[]>) => void;
@@ -39,11 +39,8 @@ var StyledOrder = styled.div.withConfig({
39
39
  })(["width:1.5rem;height:1.5rem;display:flex;border-radius:4px;align-items:center;justify-content:center;color:", ";background-color:", ";flex:none;margin-left:0.5rem;"], base.color.navy0, base.color.navy4);
40
40
  var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
41
41
  componentId: "sc-19b0zkq-3"
42
- })(["display:flex;border-radius:8px;border:1px solid ", ";background-color:", ";overflow:hidden;cursor:", ";&:not(:last-of-type){margin-bottom:1rem;}", "{background-color:", ";color:", ";}", "{background-color:", ";& *{color:", ";}}", "{background-color:", ";color:", ";}&.ui-draggable-dragging{z-index:1000 !important;color:", " !important;border:none !important;", "{background-color:", ";}", "{background-color:", ";border:1px solid ", " !important;}", "{color:", ";background-color:", ";}& *{color:", " !important;}}&.ui-draggable-dragging.quiz-answer{width:calc(100% - 1rem * 2);}"], base.color.navy4, base.color.navy5, function (_ref3) {
43
- var disabled = _ref3.disabled;
44
- return disabled ? 'not-allowed !important' : 'auto';
45
- }, StyledQuizDraggbleOptionHandle, function (_ref4) {
46
- var role = _ref4.role;
42
+ })(["display:flex;border-radius:8px;border:1px solid ", ";background-color:", ";overflow:hidden;&:not(:last-of-type){margin-bottom:1rem;}", "{background-color:", ";color:", ";}", "{background-color:", ";& *{color:", ";}}", "{background-color:", ";color:", ";}&.ui-draggable-dragging{z-index:1000 !important;color:", " !important;border:none !important;", "{background-color:", ";}", "{background-color:", ";border:1px solid ", " !important;}", "{color:", ";background-color:", ";}& *{color:", " !important;}}&.ui-draggable-dragging.quiz-answer{width:calc(100% - 1rem * 2);}"], base.color.navy4, base.color.navy5, StyledQuizDraggbleOptionHandle, function (_ref3) {
43
+ var role = _ref3.role;
47
44
  switch (role) {
48
45
  case 'answer':
49
46
  return base.color.primary4;
@@ -55,8 +52,8 @@ var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
55
52
  default:
56
53
  return base.color.navy3;
57
54
  }
58
- }, function (_ref5) {
59
- var role = _ref5.role;
55
+ }, function (_ref4) {
56
+ var role = _ref4.role;
60
57
  switch (role) {
61
58
  case 'answer':
62
59
  return base.color.primary9;
@@ -68,8 +65,8 @@ var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
68
65
  default:
69
66
  return base.color.navy5;
70
67
  }
71
- }, StyledQuizDraggbleOptionContent, function (_ref6) {
72
- var role = _ref6.role;
68
+ }, StyledQuizDraggbleOptionContent, function (_ref5) {
69
+ var role = _ref5.role;
73
70
  switch (role) {
74
71
  case 'answer':
75
72
  return base.color.primary1;
@@ -81,8 +78,8 @@ var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
81
78
  default:
82
79
  return base.color.navy5;
83
80
  }
84
- }, function (_ref7) {
85
- var role = _ref7.role;
81
+ }, function (_ref6) {
82
+ var role = _ref6.role;
86
83
  switch (role) {
87
84
  case 'answer':
88
85
  return base.color.primary9;
@@ -94,8 +91,8 @@ var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
94
91
  default:
95
92
  return base.color.navy0;
96
93
  }
97
- }, StyledOrder, function (_ref8) {
98
- var role = _ref8.role;
94
+ }, StyledOrder, function (_ref7) {
95
+ var role = _ref7.role;
99
96
  switch (role) {
100
97
  case 'answer':
101
98
  return base.color.primary3;
@@ -107,8 +104,8 @@ var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
107
104
  default:
108
105
  return base.color.navy4;
109
106
  }
110
- }, function (_ref9) {
111
- var role = _ref9.role;
107
+ }, function (_ref8) {
108
+ var role = _ref8.role;
112
109
  switch (role) {
113
110
  case 'answer':
114
111
  return base.color.primary9;
@@ -124,17 +121,17 @@ var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
124
121
  //
125
122
  //
126
123
  //
127
- var QuizDraggbleOption = function QuizDraggbleOption(_ref10) {
128
- var id = _ref10.id,
129
- className = _ref10.className,
130
- content = _ref10.content,
131
- _ref10$disabled = _ref10.disabled,
132
- disabled = _ref10$disabled === void 0 ? false : _ref10$disabled,
133
- _ref10$role = _ref10.role,
134
- role = _ref10$role === void 0 ? 'default' : _ref10$role,
135
- indexOrder = _ref10.indexOrder,
136
- _ref10$isMarkdown = _ref10.isMarkdown,
137
- isMarkdown = _ref10$isMarkdown === void 0 ? false : _ref10$isMarkdown;
124
+ var QuizDraggbleOption = function QuizDraggbleOption(_ref9) {
125
+ var id = _ref9.id,
126
+ className = _ref9.className,
127
+ content = _ref9.content,
128
+ _ref9$disabled = _ref9.disabled,
129
+ disabled = _ref9$disabled === void 0 ? false : _ref9$disabled,
130
+ _ref9$role = _ref9.role,
131
+ role = _ref9$role === void 0 ? 'default' : _ref9$role,
132
+ indexOrder = _ref9.indexOrder,
133
+ _ref9$isMarkdown = _ref9.isMarkdown,
134
+ isMarkdown = _ref9$isMarkdown === void 0 ? false : _ref9$isMarkdown;
138
135
  var _useMaterialQuizState = useMaterialQuizState(),
139
136
  vertical = _useMaterialQuizState.vertical;
140
137
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-quiz",
3
- "version": "1.241126.0-disabled.0",
3
+ "version": "1.241126.0",
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",