@elice/material-quiz 1.241128.0 → 1.241202.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +5 -4
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +4 -3
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +5 -5
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +4 -4
- package/cjs/components/material-quiz/material-quiz-group/context/context.d.ts +1 -1
- package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +5 -4
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +4 -3
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +5 -5
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +4 -4
- package/es/components/material-quiz/material-quiz-group/context/context.d.ts +1 -1
- package/package.json +3 -3
|
@@ -114,7 +114,8 @@ 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 ||
|
|
117
|
+
}).length || !!userId;
|
|
118
|
+
var isOptionDisabled = index.checkUserLectureTestEnded(lecture);
|
|
118
119
|
var isTestLecture = (lecture === null || lecture === void 0 ? void 0 : lecture.lectureType) === types.enums.LectureType.Test;
|
|
119
120
|
// ref
|
|
120
121
|
var optionBoxRef = React__default.default.useRef(null);
|
|
@@ -473,11 +474,11 @@ var MaterialQuizSelectMultipleOrder = function MaterialQuizSelectMultipleOrder(_
|
|
|
473
474
|
var renderQuizDragOption = function renderQuizDragOption() {
|
|
474
475
|
return jsxRuntime.jsxs(StyledQuizOptionsDropZone, {
|
|
475
476
|
id: "quiz-options-dropzone",
|
|
476
|
-
disabled:
|
|
477
|
+
disabled: isOptionDisabled,
|
|
477
478
|
accept: ".quiz-answer",
|
|
478
479
|
children: [optionList.map(function (option, index) {
|
|
479
480
|
return jsxRuntime.jsx(QuizDraggbleOption.default, {
|
|
480
|
-
disabled:
|
|
481
|
+
disabled: isOptionDisabled,
|
|
481
482
|
id: "quiz-option-".concat(index),
|
|
482
483
|
className: "quiz-option",
|
|
483
484
|
content: option.value,
|
|
@@ -534,7 +535,7 @@ var MaterialQuizSelectMultipleOrder = function MaterialQuizSelectMultipleOrder(_
|
|
|
534
535
|
id: "option-answer-".concat(index$1),
|
|
535
536
|
content: option.value,
|
|
536
537
|
role: getRole(),
|
|
537
|
-
disabled:
|
|
538
|
+
disabled: isOptionDisabled,
|
|
538
539
|
indexOrder: index$1 + 1,
|
|
539
540
|
isMarkdown: !!(course === null || course === void 0 ? void 0 : course.preference.renderMarkdownInQuizOptions)
|
|
540
541
|
}, "option-answer-".concat(index$1));
|
|
@@ -82,7 +82,8 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
|
|
|
82
82
|
hasSubmitted = _React$useState16[0],
|
|
83
83
|
setHasSubmitted = _React$useState16[1];
|
|
84
84
|
var isNextActive = hasSubmitted && typeof onNext === 'function';
|
|
85
|
-
var isDisabled = !flattenDeep__default.default(currentAnswerList).length ||
|
|
85
|
+
var isDisabled = !flattenDeep__default.default(currentAnswerList).length || !!userId;
|
|
86
|
+
var isOptionDisabled = index.checkUserLectureTestEnded(lecture);
|
|
86
87
|
var _useCaculatePassage = useCaculatePassage.useCaculatePassage(),
|
|
87
88
|
questionRef = _useCaculatePassage.questionRef,
|
|
88
89
|
containerRef = _useCaculatePassage.containerRef;
|
|
@@ -359,7 +360,7 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
|
|
|
359
360
|
optionList: optionList,
|
|
360
361
|
currentOptionList: currentOptionList,
|
|
361
362
|
currentAnswerList: currentAnswerList,
|
|
362
|
-
|
|
363
|
+
isOptionDisabled: isOptionDisabled,
|
|
363
364
|
onUpdateAnswer: setCurrentAnswerList,
|
|
364
365
|
onUpdateOption: setCurrentOptionList,
|
|
365
366
|
onUpdateHasSubmitted: setHasSubmitted,
|
|
@@ -382,7 +383,7 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
|
|
|
382
383
|
bodyContainerRef: containerRef,
|
|
383
384
|
footerActions: [{
|
|
384
385
|
border: false,
|
|
385
|
-
disabled: isDisabled,
|
|
386
|
+
disabled: isDisabled || isOptionDisabled,
|
|
386
387
|
loading: submitStatus === 'pending',
|
|
387
388
|
tabIndex: 0,
|
|
388
389
|
transparent: false,
|
|
@@ -65,7 +65,7 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
|
|
|
65
65
|
groupList = _React$useContext.groupList,
|
|
66
66
|
currentAnswerList = _React$useContext.currentAnswerList,
|
|
67
67
|
currentOptionList = _React$useContext.currentOptionList,
|
|
68
|
-
|
|
68
|
+
isOptionDisabled = _React$useContext.isOptionDisabled,
|
|
69
69
|
updateCurrentAnswer = _React$useContext.updateCurrentAnswer,
|
|
70
70
|
updateCurrentOption = _React$useContext.updateCurrentOption,
|
|
71
71
|
handleAnswerReset = _React$useContext.handleAnswerReset;
|
|
@@ -124,13 +124,13 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
|
|
|
124
124
|
}), jsxRuntime.jsx(StyledQuizAnswerDropzone, {
|
|
125
125
|
id: "quiz-answer-dropzone-".concat(dropzoneIndex),
|
|
126
126
|
accept: ".quiz-answer",
|
|
127
|
-
disabled:
|
|
127
|
+
disabled: isOptionDisabled,
|
|
128
128
|
isGroupAnswer: isGroupAnswer,
|
|
129
129
|
children: isGroupAnswer ? (_b = currentAnswerList[dropzoneIndex]) === null || _b === void 0 ? void 0 : _b.map(function (answer, index$1) {
|
|
130
130
|
var isHideStatus = !userId && (isActive || isTestLecture);
|
|
131
131
|
var status = isHideStatus ? undefined : index.getQuizGroupOptionResultStatus(dropzoneIndex, index$1, answer.order, materialQuizResponse, materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.answerInfo);
|
|
132
132
|
return jsxRuntime.jsx(MaterialQuizGroupOptionItem.default, {
|
|
133
|
-
disabled:
|
|
133
|
+
disabled: isOptionDisabled,
|
|
134
134
|
status: status,
|
|
135
135
|
option: answer
|
|
136
136
|
}, index$1);
|
|
@@ -182,7 +182,7 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
|
|
|
182
182
|
children: [jsxRuntime.jsx(blocks.Button, {
|
|
183
183
|
role: "white",
|
|
184
184
|
size: "small",
|
|
185
|
-
disabled:
|
|
185
|
+
disabled: isOptionDisabled,
|
|
186
186
|
onClick: handleAnswerReset,
|
|
187
187
|
children: intl$1.formatMessage({
|
|
188
188
|
id: 'materialQuiz.dropzone.optionReset'
|
|
@@ -195,7 +195,7 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
|
|
|
195
195
|
children: currentOptionList.length ? currentOptionList.map(function (option, index) {
|
|
196
196
|
return jsxRuntime.jsx(MaterialQuizGroupOptionItem.default, {
|
|
197
197
|
option: option,
|
|
198
|
-
disabled:
|
|
198
|
+
disabled: isOptionDisabled
|
|
199
199
|
}, index);
|
|
200
200
|
}) : jsxRuntime.jsx(blocks.Flex, {
|
|
201
201
|
justify: "center",
|
|
@@ -55,7 +55,7 @@ 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
|
-
|
|
58
|
+
isOptionDisabled = _React$useContext.isOptionDisabled,
|
|
59
59
|
updateCurrentAnswer = _React$useContext.updateCurrentAnswer,
|
|
60
60
|
updateCurrentOption = _React$useContext.updateCurrentOption,
|
|
61
61
|
handleAnswerReset = _React$useContext.handleAnswerReset;
|
|
@@ -72,7 +72,7 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
|
|
|
72
72
|
children: [jsxRuntime.jsx(blocks.Button, {
|
|
73
73
|
role: "white",
|
|
74
74
|
size: "small",
|
|
75
|
-
disabled:
|
|
75
|
+
disabled: isOptionDisabled,
|
|
76
76
|
onClick: handleAnswerReset,
|
|
77
77
|
block: true,
|
|
78
78
|
children: intl$1.formatMessage({
|
|
@@ -109,7 +109,7 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
|
|
|
109
109
|
var status = isHideStatus ? undefined : index.getQuizGroupOptionResultStatus(index$1, answerIndex, answer.order, materialQuizResponse, materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.answerInfo);
|
|
110
110
|
return jsxRuntime.jsx(MaterialQuizGroupOptionItem.default, {
|
|
111
111
|
option: answer,
|
|
112
|
-
disabled:
|
|
112
|
+
disabled: isOptionDisabled,
|
|
113
113
|
status: status,
|
|
114
114
|
onClose: function onClose() {
|
|
115
115
|
var targetId = answer.order;
|
|
@@ -163,7 +163,7 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
|
|
|
163
163
|
},
|
|
164
164
|
children: jsxRuntime.jsx(MaterialQuizGroupOptionItem.default, {
|
|
165
165
|
option: option,
|
|
166
|
-
disabled:
|
|
166
|
+
disabled: isOptionDisabled
|
|
167
167
|
}, index)
|
|
168
168
|
}, index);
|
|
169
169
|
}) : jsxRuntime.jsx(blocks.Text, {
|
|
@@ -11,7 +11,7 @@ interface QuizGroupContextValue {
|
|
|
11
11
|
optionList: QuizGroupOption[];
|
|
12
12
|
currentOptionList: QuizGroupOption[];
|
|
13
13
|
currentAnswerList: QuizGroupOption[][];
|
|
14
|
-
|
|
14
|
+
isOptionDisabled: boolean;
|
|
15
15
|
onDirty: (value: boolean) => void;
|
|
16
16
|
onUpdateAnswer: (value: React.SetStateAction<QuizGroupOption[][]>) => void;
|
|
17
17
|
onUpdateOption: (value: React.SetStateAction<QuizGroupOption[]>) => void;
|
|
@@ -105,7 +105,8 @@ 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 ||
|
|
108
|
+
}).length || !!userId;
|
|
109
|
+
var isOptionDisabled = checkUserLectureTestEnded(lecture);
|
|
109
110
|
var isTestLecture = (lecture === null || lecture === void 0 ? void 0 : lecture.lectureType) === enums.LectureType.Test;
|
|
110
111
|
// ref
|
|
111
112
|
var optionBoxRef = React.useRef(null);
|
|
@@ -464,11 +465,11 @@ var MaterialQuizSelectMultipleOrder = function MaterialQuizSelectMultipleOrder(_
|
|
|
464
465
|
var renderQuizDragOption = function renderQuizDragOption() {
|
|
465
466
|
return jsxs(StyledQuizOptionsDropZone, {
|
|
466
467
|
id: "quiz-options-dropzone",
|
|
467
|
-
disabled:
|
|
468
|
+
disabled: isOptionDisabled,
|
|
468
469
|
accept: ".quiz-answer",
|
|
469
470
|
children: [optionList.map(function (option, index) {
|
|
470
471
|
return jsx(QuizDraggbleOption, {
|
|
471
|
-
disabled:
|
|
472
|
+
disabled: isOptionDisabled,
|
|
472
473
|
id: "quiz-option-".concat(index),
|
|
473
474
|
className: "quiz-option",
|
|
474
475
|
content: option.value,
|
|
@@ -525,7 +526,7 @@ var MaterialQuizSelectMultipleOrder = function MaterialQuizSelectMultipleOrder(_
|
|
|
525
526
|
id: "option-answer-".concat(index),
|
|
526
527
|
content: option.value,
|
|
527
528
|
role: getRole(),
|
|
528
|
-
disabled:
|
|
529
|
+
disabled: isOptionDisabled,
|
|
529
530
|
indexOrder: index + 1,
|
|
530
531
|
isMarkdown: !!(course === null || course === void 0 ? void 0 : course.preference.renderMarkdownInQuizOptions)
|
|
531
532
|
}, "option-answer-".concat(index));
|
|
@@ -72,7 +72,8 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
|
|
|
72
72
|
hasSubmitted = _React$useState16[0],
|
|
73
73
|
setHasSubmitted = _React$useState16[1];
|
|
74
74
|
var isNextActive = hasSubmitted && typeof onNext === 'function';
|
|
75
|
-
var isDisabled = !flattenDeep(currentAnswerList).length ||
|
|
75
|
+
var isDisabled = !flattenDeep(currentAnswerList).length || !!userId;
|
|
76
|
+
var isOptionDisabled = checkUserLectureTestEnded(lecture);
|
|
76
77
|
var _useCaculatePassage = useCaculatePassage(),
|
|
77
78
|
questionRef = _useCaculatePassage.questionRef,
|
|
78
79
|
containerRef = _useCaculatePassage.containerRef;
|
|
@@ -349,7 +350,7 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
|
|
|
349
350
|
optionList: optionList,
|
|
350
351
|
currentOptionList: currentOptionList,
|
|
351
352
|
currentAnswerList: currentAnswerList,
|
|
352
|
-
|
|
353
|
+
isOptionDisabled: isOptionDisabled,
|
|
353
354
|
onUpdateAnswer: setCurrentAnswerList,
|
|
354
355
|
onUpdateOption: setCurrentOptionList,
|
|
355
356
|
onUpdateHasSubmitted: setHasSubmitted,
|
|
@@ -372,7 +373,7 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
|
|
|
372
373
|
bodyContainerRef: containerRef,
|
|
373
374
|
footerActions: [{
|
|
374
375
|
border: false,
|
|
375
|
-
disabled: isDisabled,
|
|
376
|
+
disabled: isDisabled || isOptionDisabled,
|
|
376
377
|
loading: submitStatus === 'pending',
|
|
377
378
|
tabIndex: 0,
|
|
378
379
|
transparent: false,
|
|
@@ -56,7 +56,7 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
|
|
|
56
56
|
groupList = _React$useContext.groupList,
|
|
57
57
|
currentAnswerList = _React$useContext.currentAnswerList,
|
|
58
58
|
currentOptionList = _React$useContext.currentOptionList,
|
|
59
|
-
|
|
59
|
+
isOptionDisabled = _React$useContext.isOptionDisabled,
|
|
60
60
|
updateCurrentAnswer = _React$useContext.updateCurrentAnswer,
|
|
61
61
|
updateCurrentOption = _React$useContext.updateCurrentOption,
|
|
62
62
|
handleAnswerReset = _React$useContext.handleAnswerReset;
|
|
@@ -115,13 +115,13 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
|
|
|
115
115
|
}), jsx(StyledQuizAnswerDropzone, {
|
|
116
116
|
id: "quiz-answer-dropzone-".concat(dropzoneIndex),
|
|
117
117
|
accept: ".quiz-answer",
|
|
118
|
-
disabled:
|
|
118
|
+
disabled: isOptionDisabled,
|
|
119
119
|
isGroupAnswer: isGroupAnswer,
|
|
120
120
|
children: isGroupAnswer ? (_b = currentAnswerList[dropzoneIndex]) === null || _b === void 0 ? void 0 : _b.map(function (answer, index) {
|
|
121
121
|
var isHideStatus = !userId && (isActive || isTestLecture);
|
|
122
122
|
var status = isHideStatus ? undefined : getQuizGroupOptionResultStatus(dropzoneIndex, index, answer.order, materialQuizResponse, materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.answerInfo);
|
|
123
123
|
return jsx(MaterialQuizGroupOptionItem, {
|
|
124
|
-
disabled:
|
|
124
|
+
disabled: isOptionDisabled,
|
|
125
125
|
status: status,
|
|
126
126
|
option: answer
|
|
127
127
|
}, index);
|
|
@@ -173,7 +173,7 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
|
|
|
173
173
|
children: [jsx(Button, {
|
|
174
174
|
role: "white",
|
|
175
175
|
size: "small",
|
|
176
|
-
disabled:
|
|
176
|
+
disabled: isOptionDisabled,
|
|
177
177
|
onClick: handleAnswerReset,
|
|
178
178
|
children: intl.formatMessage({
|
|
179
179
|
id: 'materialQuiz.dropzone.optionReset'
|
|
@@ -186,7 +186,7 @@ var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop(_ref3) {
|
|
|
186
186
|
children: currentOptionList.length ? currentOptionList.map(function (option, index) {
|
|
187
187
|
return jsx(MaterialQuizGroupOptionItem, {
|
|
188
188
|
option: option,
|
|
189
|
-
disabled:
|
|
189
|
+
disabled: isOptionDisabled
|
|
190
190
|
}, index);
|
|
191
191
|
}) : jsx(Flex, {
|
|
192
192
|
justify: "center",
|
|
@@ -46,7 +46,7 @@ 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
|
-
|
|
49
|
+
isOptionDisabled = _React$useContext.isOptionDisabled,
|
|
50
50
|
updateCurrentAnswer = _React$useContext.updateCurrentAnswer,
|
|
51
51
|
updateCurrentOption = _React$useContext.updateCurrentOption,
|
|
52
52
|
handleAnswerReset = _React$useContext.handleAnswerReset;
|
|
@@ -63,7 +63,7 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
|
|
|
63
63
|
children: [jsx(Button, {
|
|
64
64
|
role: "white",
|
|
65
65
|
size: "small",
|
|
66
|
-
disabled:
|
|
66
|
+
disabled: isOptionDisabled,
|
|
67
67
|
onClick: handleAnswerReset,
|
|
68
68
|
block: true,
|
|
69
69
|
children: intl.formatMessage({
|
|
@@ -100,7 +100,7 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
|
|
|
100
100
|
var status = isHideStatus ? undefined : getQuizGroupOptionResultStatus(index, answerIndex, answer.order, materialQuizResponse, materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.answerInfo);
|
|
101
101
|
return jsx(MaterialQuizGroupOptionItem, {
|
|
102
102
|
option: answer,
|
|
103
|
-
disabled:
|
|
103
|
+
disabled: isOptionDisabled,
|
|
104
104
|
status: status,
|
|
105
105
|
onClose: function onClose() {
|
|
106
106
|
var targetId = answer.order;
|
|
@@ -154,7 +154,7 @@ var MaterialQuizGroupMobile = function MaterialQuizGroupMobile(_ref3) {
|
|
|
154
154
|
},
|
|
155
155
|
children: jsx(MaterialQuizGroupOptionItem, {
|
|
156
156
|
option: option,
|
|
157
|
-
disabled:
|
|
157
|
+
disabled: isOptionDisabled
|
|
158
158
|
}, index)
|
|
159
159
|
}, index);
|
|
160
160
|
}) : jsx(Text, {
|
|
@@ -11,7 +11,7 @@ interface QuizGroupContextValue {
|
|
|
11
11
|
optionList: QuizGroupOption[];
|
|
12
12
|
currentOptionList: QuizGroupOption[];
|
|
13
13
|
currentAnswerList: QuizGroupOption[][];
|
|
14
|
-
|
|
14
|
+
isOptionDisabled: boolean;
|
|
15
15
|
onDirty: (value: boolean) => void;
|
|
16
16
|
onUpdateAnswer: (value: React.SetStateAction<QuizGroupOption[][]>) => void;
|
|
17
17
|
onUpdateOption: (value: React.SetStateAction<QuizGroupOption[]>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-quiz",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.241202.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",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"@elice/icons-legacy": "npm:@elice/icons@0.230814.0",
|
|
73
73
|
"@elice/intl": "0.241127.0",
|
|
74
74
|
"@elice/markdown": "1.241015.0",
|
|
75
|
-
"@elice/material-shared-types": "1.
|
|
76
|
-
"@elice/material-shared-utils": "1.
|
|
75
|
+
"@elice/material-shared-types": "1.241202.0",
|
|
76
|
+
"@elice/material-shared-utils": "1.241202.0",
|
|
77
77
|
"@elice/mui-elements": "^5.240820.0",
|
|
78
78
|
"@elice/mui-system": "^5.240820.0",
|
|
79
79
|
"@elice/openapi-client-course": "^1.230814.0",
|