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