@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
|
@@ -2,114 +2,105 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
5
|
var React = require('react');
|
|
7
6
|
var $ = require('jquery');
|
|
8
7
|
require('jquery-ui/ui/widgets/draggable');
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
className = _ref.className,
|
|
25
|
-
onStart = _ref.onStart,
|
|
26
|
-
onStop = _ref.onStop,
|
|
27
|
-
onDrag = _ref.onDrag,
|
|
28
|
-
onCreate = _ref.onCreate;
|
|
29
|
-
var rootEl = React__default.default.useRef(null);
|
|
30
|
-
var onStartCallback = React__default.default.useCallback(function (event, ui) {
|
|
9
|
+
const EbDraggable = ({
|
|
10
|
+
children,
|
|
11
|
+
id,
|
|
12
|
+
disabled = false,
|
|
13
|
+
revert = true,
|
|
14
|
+
clone = false,
|
|
15
|
+
className,
|
|
16
|
+
onStart,
|
|
17
|
+
onStop,
|
|
18
|
+
onDrag,
|
|
19
|
+
onCreate
|
|
20
|
+
}) => {
|
|
21
|
+
const rootEl = React.useRef(null);
|
|
22
|
+
const onStartCallback = React.useCallback((event, ui) => {
|
|
31
23
|
if (onStart) {
|
|
32
24
|
return onStart(event, ui);
|
|
33
25
|
} else {
|
|
34
|
-
return
|
|
26
|
+
return () => {
|
|
35
27
|
return;
|
|
36
28
|
};
|
|
37
29
|
}
|
|
38
30
|
}, [onStart]);
|
|
39
|
-
|
|
31
|
+
const onStopCallback = React.useCallback((event, ui) => {
|
|
40
32
|
if (onStop) {
|
|
41
33
|
return onStop(event, ui);
|
|
42
34
|
} else {
|
|
43
|
-
return
|
|
35
|
+
return () => {
|
|
44
36
|
return;
|
|
45
37
|
};
|
|
46
38
|
}
|
|
47
39
|
}, [onStop]);
|
|
48
|
-
|
|
40
|
+
const onDragCallback = React.useCallback((event, ui) => {
|
|
49
41
|
if (onDrag) {
|
|
50
42
|
return onDrag(event, ui);
|
|
51
43
|
} else {
|
|
52
|
-
return
|
|
44
|
+
return () => {
|
|
53
45
|
return;
|
|
54
46
|
};
|
|
55
47
|
}
|
|
56
48
|
}, [onDrag]);
|
|
57
|
-
|
|
49
|
+
const onCreateCallback = React.useCallback((event, ui) => {
|
|
58
50
|
if (onCreate) {
|
|
59
51
|
return onCreate(event, ui);
|
|
60
52
|
} else {
|
|
61
|
-
return
|
|
53
|
+
return () => {
|
|
62
54
|
return;
|
|
63
55
|
};
|
|
64
56
|
}
|
|
65
57
|
}, [onCreate]);
|
|
66
|
-
|
|
58
|
+
React.useEffect(() => {
|
|
67
59
|
if (!rootEl.current) {
|
|
68
60
|
return;
|
|
69
61
|
}
|
|
70
|
-
|
|
62
|
+
const draggableEl = $(rootEl.current);
|
|
71
63
|
draggableEl.draggable(Object.assign(Object.assign(Object.assign(Object.assign({}, disabled ? {
|
|
72
|
-
disabled
|
|
64
|
+
disabled
|
|
73
65
|
} : null), revert ? {
|
|
74
|
-
revert
|
|
66
|
+
revert
|
|
75
67
|
} : null), clone ? {
|
|
76
68
|
helper: 'clone'
|
|
77
69
|
} : null), {
|
|
78
70
|
zIndex: 200,
|
|
79
71
|
revertDuration: 0,
|
|
80
|
-
start:
|
|
72
|
+
start: (event, ui) => {
|
|
81
73
|
if (!onStartCallback) {
|
|
82
74
|
return;
|
|
83
75
|
}
|
|
84
76
|
onStartCallback(event, ui);
|
|
85
77
|
},
|
|
86
|
-
stop:
|
|
78
|
+
stop: (event, ui) => {
|
|
87
79
|
if (!onStopCallback) {
|
|
88
80
|
return;
|
|
89
81
|
}
|
|
90
82
|
// draggableEl.draggable('cancel');
|
|
91
83
|
onStopCallback(event, ui);
|
|
92
84
|
},
|
|
93
|
-
drag:
|
|
85
|
+
drag: (event, ui) => {
|
|
94
86
|
onDragCallback(event, ui);
|
|
95
87
|
},
|
|
96
|
-
create:
|
|
88
|
+
create: (event, ui) => {
|
|
97
89
|
onCreateCallback(event, ui);
|
|
98
90
|
}
|
|
99
91
|
}));
|
|
100
|
-
return
|
|
92
|
+
return () => {
|
|
101
93
|
draggableEl.draggable('destroy');
|
|
102
94
|
};
|
|
103
95
|
}, [clone, disabled, onCreateCallback, onDragCallback, onStartCallback, onStopCallback, revert]);
|
|
104
|
-
return
|
|
96
|
+
return React.createElement("div", {
|
|
105
97
|
ref: rootEl,
|
|
106
98
|
id: id,
|
|
107
99
|
className: className,
|
|
108
100
|
style: {
|
|
109
101
|
cursor: disabled ? 'auto' : 'move'
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
});
|
|
102
|
+
}
|
|
103
|
+
}, children);
|
|
113
104
|
};
|
|
114
105
|
|
|
115
106
|
exports.default = EbDraggable;
|
|
@@ -2,61 +2,54 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
5
|
var React = require('react');
|
|
7
6
|
var $ = require('jquery');
|
|
8
7
|
require('jquery-ui/ui/widgets/droppable');
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
accept = _ref.accept,
|
|
21
|
-
className = _ref.className,
|
|
22
|
-
onDrop = _ref.onDrop;
|
|
23
|
-
var rootEl = React__default.default.useRef(null);
|
|
24
|
-
var onDropCallback = React__default.default.useCallback(function (event, ui) {
|
|
9
|
+
const EbDroppable = ({
|
|
10
|
+
children,
|
|
11
|
+
id,
|
|
12
|
+
disabled = false,
|
|
13
|
+
accept,
|
|
14
|
+
className,
|
|
15
|
+
onDrop
|
|
16
|
+
}) => {
|
|
17
|
+
const rootEl = React.useRef(null);
|
|
18
|
+
const onDropCallback = React.useCallback((event, ui) => {
|
|
25
19
|
if (onDrop) {
|
|
26
20
|
return onDrop(event, ui);
|
|
27
21
|
} else {
|
|
28
|
-
return
|
|
22
|
+
return () => {
|
|
29
23
|
return;
|
|
30
24
|
};
|
|
31
25
|
}
|
|
32
26
|
}, [onDrop]);
|
|
33
|
-
|
|
27
|
+
React.useEffect(() => {
|
|
34
28
|
if (!rootEl.current) {
|
|
35
29
|
return;
|
|
36
30
|
}
|
|
37
|
-
|
|
31
|
+
const draggableEl = $(rootEl.current);
|
|
38
32
|
draggableEl.droppable(Object.assign(Object.assign(Object.assign({}, disabled ? {
|
|
39
|
-
disabled
|
|
33
|
+
disabled
|
|
40
34
|
} : null), accept ? {
|
|
41
|
-
accept
|
|
35
|
+
accept
|
|
42
36
|
} : null), {
|
|
43
|
-
drop:
|
|
37
|
+
drop: (event, ui) => {
|
|
44
38
|
if (!onDropCallback) {
|
|
45
39
|
return;
|
|
46
40
|
}
|
|
47
41
|
onDropCallback(event, ui);
|
|
48
42
|
}
|
|
49
43
|
}));
|
|
50
|
-
return
|
|
44
|
+
return () => {
|
|
51
45
|
draggableEl.droppable('destroy');
|
|
52
46
|
};
|
|
53
47
|
}, [accept, disabled, onDropCallback]);
|
|
54
|
-
return
|
|
48
|
+
return React.createElement("div", {
|
|
55
49
|
ref: rootEl,
|
|
56
50
|
id: id,
|
|
57
|
-
className: className
|
|
58
|
-
|
|
59
|
-
});
|
|
51
|
+
className: className
|
|
52
|
+
}, children);
|
|
60
53
|
};
|
|
61
54
|
|
|
62
55
|
exports.default = EbDroppable;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { EliceWysiwygEditorProps } from '@elice/wysiwyg';
|
|
2
|
-
export declare const MarkdownEditor: ({ value, onChange, ...props }: EliceWysiwygEditorProps) => JSX.Element;
|
|
3
|
+
export declare const MarkdownEditor: ({ value, onChange, ...props }: EliceWysiwygEditorProps) => React.JSX.Element;
|
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
4
3
|
var tslib = require('tslib');
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
4
|
var React = require('react');
|
|
7
5
|
var reactUse = require('react-use');
|
|
8
6
|
var wysiwyg = require('@elice/wysiwyg');
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var value = _a.value,
|
|
17
|
-
onChange = _a.onChange,
|
|
8
|
+
const STATE_SYNC_DEBOUNCE_TIME = 50;
|
|
9
|
+
const MarkdownEditor = _a => {
|
|
10
|
+
var {
|
|
11
|
+
value,
|
|
12
|
+
onChange
|
|
13
|
+
} = _a,
|
|
18
14
|
props = tslib.__rest(_a, ["value", "onChange"]);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
__setValue = _React$useState2[1];
|
|
23
|
-
reactUse.useDebounce(function () {
|
|
24
|
-
return __setValue(value);
|
|
25
|
-
}, STATE_SYNC_DEBOUNCE_TIME, [value]);
|
|
26
|
-
reactUse.useDebounce(function () {
|
|
15
|
+
const [__value, __setValue] = React.useState(value);
|
|
16
|
+
reactUse.useDebounce(() => __setValue(value), STATE_SYNC_DEBOUNCE_TIME, [value]);
|
|
17
|
+
reactUse.useDebounce(() => {
|
|
27
18
|
if (__value !== value && typeof onChange === 'function') {
|
|
28
19
|
onChange(__value !== null && __value !== void 0 ? __value : '');
|
|
29
20
|
}
|
|
30
21
|
}, STATE_SYNC_DEBOUNCE_TIME, [__value]);
|
|
31
|
-
return
|
|
22
|
+
return React.createElement(wysiwyg.EliceWysiwygEditor, Object.assign({
|
|
32
23
|
value: value,
|
|
33
24
|
onChange: __setValue
|
|
34
25
|
}, props));
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
7
5
|
var React = require('react');
|
|
8
6
|
var reactUse = require('react-use');
|
|
9
7
|
var designTokens = require('@elice/design-tokens');
|
|
@@ -19,152 +17,123 @@ var ko = require('./locales/ko.json.js');
|
|
|
19
17
|
var MaterialQuizShimmer = require('./MaterialQuizShimmer.js');
|
|
20
18
|
var MaterialQuizInfo = require('./MaterialQuizInfo.js');
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
25
|
-
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
26
|
-
|
|
27
|
-
var eliceTheme = muiSystem.createEliceTheme({
|
|
20
|
+
const eliceTheme = muiSystem.createEliceTheme({
|
|
28
21
|
paletteMode: 'dark',
|
|
29
22
|
paletteName: 'purple'
|
|
30
23
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
var AsyncMaterialQuizText = React__default.default.lazy(function () {
|
|
38
|
-
return Promise.resolve().then(function () { return require('./MaterialQuizText.js'); });
|
|
39
|
-
});
|
|
40
|
-
var AsyncMaterialQuizSelectOne = React__default.default.lazy(function () {
|
|
41
|
-
return Promise.resolve().then(function () { return require('./MaterialQuizSelectOne.js'); });
|
|
42
|
-
});
|
|
43
|
-
var AsyncMaterialQuizGroup = React__default.default.lazy(function () {
|
|
44
|
-
return Promise.resolve().then(function () { return require('./material-quiz-group/index.js'); });
|
|
45
|
-
});
|
|
24
|
+
const AsyncMaterialQuizSelectMultiple = React.lazy(() => Promise.resolve().then(function () { return require('./MaterialQuizSelectMultiple.js'); }));
|
|
25
|
+
const AsyncMaterialQuizSelectMultipleOrder = React.lazy(() => Promise.resolve().then(function () { return require('./MaterialQuizSelectMultipleOrder.js'); }));
|
|
26
|
+
const AsyncMaterialQuizText = React.lazy(() => Promise.resolve().then(function () { return require('./MaterialQuizText.js'); }));
|
|
27
|
+
const AsyncMaterialQuizSelectOne = React.lazy(() => Promise.resolve().then(function () { return require('./MaterialQuizSelectOne.js'); }));
|
|
28
|
+
const AsyncMaterialQuizGroup = React.lazy(() => Promise.resolve().then(function () { return require('./material-quiz-group/index.js'); }));
|
|
46
29
|
// 746px
|
|
47
|
-
|
|
48
|
-
|
|
30
|
+
const MAX_CONTENT_WIDTH = '46.625rem';
|
|
31
|
+
const StyledMaterialQuizInfo = styled.div.withConfig({
|
|
49
32
|
componentId: "sc-1eyn8fb-0"
|
|
50
33
|
})([""]);
|
|
51
|
-
|
|
34
|
+
const StyledMaterialQuizContent = styled.div.withConfig({
|
|
52
35
|
componentId: "sc-1eyn8fb-1"
|
|
53
|
-
})(["position:relative;z-index:0;min-width:0;margin:", ";height:100%;"],
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var LoadingContainer = styled__default.default.div.withConfig({
|
|
36
|
+
})(["position:relative;z-index:0;min-width:0;margin:", ";height:100%;"], ({
|
|
37
|
+
vertical
|
|
38
|
+
}) => vertical ? 'unset' : 'auto');
|
|
39
|
+
const LoadingContainer = styled.div.withConfig({
|
|
58
40
|
componentId: "sc-1eyn8fb-2"
|
|
59
41
|
})(["position:absolute;width:100%;height:100%;top:0;left:0;z-index:1;max-width:none !important;background-color:", ";"], designTokens.base.color.navy8);
|
|
60
|
-
|
|
42
|
+
const StyledMaterialQuizWrapper = styled.div.withConfig({
|
|
61
43
|
componentId: "sc-1eyn8fb-3"
|
|
62
|
-
})(["-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;width:100%;height:100%;flex-direction:", ";position:relative;& > *{flex:", ";max-width:", ";}gap:1rem;", "{height:", ";overflow-y:", ";& > div{max-height:unset;}}"],
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
var isLoadingLayout = isFetchingData || isInitialLoading;
|
|
96
|
-
var isVisibleSideBySide = !vertical && isLongPassage;
|
|
97
|
-
var isRenderQuestionWithPassage = (vertical || !isLongPassage || isQuizGroupType) && !!materialQuiz;
|
|
98
|
-
React__default.default.useEffect(function () {
|
|
44
|
+
})(["-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;width:100%;height:100%;flex-direction:", ";position:relative;& > *{flex:", ";max-width:", ";}gap:1rem;", "{height:", ";overflow-y:", ";& > div{max-height:unset;}}"], ({
|
|
45
|
+
vertical
|
|
46
|
+
}) => vertical ? 'column' : 'row', ({
|
|
47
|
+
vertical
|
|
48
|
+
}) => vertical ? 'auto' : '1', ({
|
|
49
|
+
vertical,
|
|
50
|
+
isQuizGroupType,
|
|
51
|
+
isLongPassage
|
|
52
|
+
}) => !isLongPassage && !vertical && !isQuizGroupType ? `${MAX_CONTENT_WIDTH}` : 'unset', StyledMaterialQuizInfo, ({
|
|
53
|
+
vertical
|
|
54
|
+
}) => vertical ? 'auto' : '100%', ({
|
|
55
|
+
vertical
|
|
56
|
+
}) => vertical ? 'intial' : 'auto');
|
|
57
|
+
const MaterialQuiz = () => {
|
|
58
|
+
const {
|
|
59
|
+
materialQuiz,
|
|
60
|
+
vertical,
|
|
61
|
+
course,
|
|
62
|
+
isLongPassage,
|
|
63
|
+
isInitialLoading
|
|
64
|
+
} = MaterialQuizContext.useMaterialQuizState();
|
|
65
|
+
const {
|
|
66
|
+
setVertical
|
|
67
|
+
} = MaterialQuizContext.useMaterialQuizDispatch();
|
|
68
|
+
const [ref, {
|
|
69
|
+
width
|
|
70
|
+
}] = reactUse.useMeasure();
|
|
71
|
+
const isQuizGroupType = Boolean((materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.optionType) === types.enums.QuizOptionType.Group);
|
|
72
|
+
const isFetchingData = !materialQuiz || !course;
|
|
73
|
+
const isLoadingLayout = isFetchingData || isInitialLoading;
|
|
74
|
+
const isVisibleSideBySide = !vertical && isLongPassage;
|
|
75
|
+
const isRenderQuestionWithPassage = (vertical || !isLongPassage || isQuizGroupType) && !!materialQuiz;
|
|
76
|
+
React.useEffect(() => {
|
|
99
77
|
if (width > 0) {
|
|
100
78
|
setVertical(width <= designTokens.base.screen.medium);
|
|
101
79
|
}
|
|
102
80
|
}, [width, setVertical]);
|
|
103
|
-
|
|
81
|
+
const renderQuestionOption = () => {
|
|
104
82
|
if (isFetchingData) {
|
|
105
83
|
return null;
|
|
106
84
|
}
|
|
107
85
|
switch (materialQuiz.optionType) {
|
|
108
86
|
case types.enums.QuizOptionType.SelectOne:
|
|
109
|
-
return
|
|
87
|
+
return React.createElement(AsyncMaterialQuizSelectOne, {
|
|
110
88
|
hasInlinePassage: isRenderQuestionWithPassage
|
|
111
89
|
});
|
|
112
90
|
case types.enums.QuizOptionType.SelectMultiple:
|
|
113
|
-
return
|
|
91
|
+
return React.createElement(AsyncMaterialQuizSelectMultiple, {
|
|
114
92
|
hasInlinePassage: isRenderQuestionWithPassage
|
|
115
93
|
});
|
|
116
94
|
case types.enums.QuizOptionType.Text:
|
|
117
|
-
return
|
|
95
|
+
return React.createElement(AsyncMaterialQuizText, {
|
|
118
96
|
hasInlinePassage: isRenderQuestionWithPassage
|
|
119
97
|
});
|
|
120
98
|
case types.enums.QuizOptionType.SelectMultipleOrder:
|
|
121
|
-
return
|
|
99
|
+
return React.createElement(AsyncMaterialQuizSelectMultipleOrder, {
|
|
122
100
|
hasInlinePassage: isRenderQuestionWithPassage
|
|
123
101
|
});
|
|
124
102
|
case types.enums.QuizOptionType.Group:
|
|
125
|
-
return
|
|
103
|
+
return React.createElement(AsyncMaterialQuizGroup, null);
|
|
126
104
|
}
|
|
127
105
|
};
|
|
128
|
-
return
|
|
129
|
-
fallback: null
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}), jsxRuntime.jsx(StyledMaterialQuizContent, {
|
|
140
|
-
id: element.MATERIAL_QUIZ_CONTAINER_ID,
|
|
141
|
-
vertical: vertical,
|
|
142
|
-
children: renderQuestionOption()
|
|
143
|
-
})]
|
|
144
|
-
})
|
|
145
|
-
});
|
|
106
|
+
return React.createElement(React.Suspense, {
|
|
107
|
+
fallback: null
|
|
108
|
+
}, React.createElement(StyledMaterialQuizWrapper, {
|
|
109
|
+
ref: ref,
|
|
110
|
+
vertical: vertical,
|
|
111
|
+
isQuizGroupType: isQuizGroupType,
|
|
112
|
+
isLongPassage: isLongPassage
|
|
113
|
+
}, isLoadingLayout && React.createElement(LoadingContainer, null, React.createElement(MaterialQuizShimmer.default, null)), isVisibleSideBySide && React.createElement(StyledMaterialQuizInfo, null, React.createElement(MaterialQuizInfo.default, null)), React.createElement(StyledMaterialQuizContent, {
|
|
114
|
+
id: element.MATERIAL_QUIZ_CONTAINER_ID,
|
|
115
|
+
vertical: vertical
|
|
116
|
+
}, renderQuestionOption())));
|
|
146
117
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
})
|
|
167
|
-
});
|
|
118
|
+
const MaterialQuizContainer = ({
|
|
119
|
+
materialQuizId,
|
|
120
|
+
userId,
|
|
121
|
+
onDirty,
|
|
122
|
+
onSubmit,
|
|
123
|
+
onNext,
|
|
124
|
+
__intl
|
|
125
|
+
}) => {
|
|
126
|
+
return React.createElement(intl.RawEliceIntlProvider, {
|
|
127
|
+
value: __intl
|
|
128
|
+
}, React.createElement(material.ThemeProvider, {
|
|
129
|
+
theme: eliceTheme
|
|
130
|
+
}, React.createElement(MaterialQuizContext.MaterialQuizProvider, {
|
|
131
|
+
materialQuizId: materialQuizId,
|
|
132
|
+
userId: userId,
|
|
133
|
+
onDirty: onDirty,
|
|
134
|
+
onSubmit: onSubmit,
|
|
135
|
+
onNext: onNext
|
|
136
|
+
}, React.createElement(MaterialQuiz, null))));
|
|
168
137
|
};
|
|
169
138
|
var MaterialQuiz$1 = new intl.IntlComponentBuilder(MaterialQuizContainer).add('en', en.default).add('ko', ko.default).addAsync('th', Promise.resolve().then(function () { return require('./locales/th.json.js'); })).addAsync('ja', Promise.resolve().then(function () { return require('./locales/ja.json.js'); })).build();
|
|
170
139
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var React = require('react');
|
|
6
6
|
var blocks = require('@elice/blocks');
|
|
7
7
|
var designTokens = require('@elice/design-tokens');
|
|
8
8
|
var intl = require('@elice/intl');
|
|
@@ -12,49 +12,42 @@ var wysiwyg = require('@elice/wysiwyg');
|
|
|
12
12
|
var styled = require('styled-components');
|
|
13
13
|
var MaterialQuizContext = require('./context/MaterialQuizContext.js');
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
18
|
-
|
|
19
|
-
var StyledMarkdownSSR = styled__default.default(markdown.MarkdownSSR).withConfig({
|
|
15
|
+
const StyledMarkdownSSR = styled(markdown.MarkdownSSR).withConfig({
|
|
20
16
|
componentId: "sc-18kg5i5-0"
|
|
21
17
|
})(["p{margin:0 !important;}", ""], wysiwyg.EliceWysiwygEditorTheme.resetMarkdownSSR);
|
|
22
|
-
|
|
18
|
+
const StyledAccordion = styled(blocks.Accordion).withConfig({
|
|
23
19
|
componentId: "sc-18kg5i5-1"
|
|
24
20
|
})(["border-radius:8px;overflow:hidden;background-color:", " !important;border-radius:8px;overflow:hidden;& > *:first-child{background-color:", " !important;}& > *:last-child{background-color:", " !important;}"], designTokens.base.color.navy5, designTokens.base.color.navy7, designTokens.base.color.navy7);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
lecture
|
|
28
|
-
materialQuiz
|
|
29
|
-
|
|
21
|
+
const MaterialQuizAnswerExplanation = () => {
|
|
22
|
+
const {
|
|
23
|
+
lecture,
|
|
24
|
+
materialQuiz
|
|
25
|
+
} = MaterialQuizContext.useMaterialQuizState();
|
|
26
|
+
const intl$1 = intl.useRawEliceIntl();
|
|
30
27
|
if (!materialQuiz || !materialQuiz.explanationInfo.isEnabled || !materialQuiz.isResponded || (lecture === null || lecture === void 0 ? void 0 : lecture.lectureType) === types.enums.LectureType.Test && (lecture === null || lecture === void 0 ? void 0 : lecture.testUserStatus) !== types.enums.LectureTestUserStatus.Completed) {
|
|
31
28
|
return null;
|
|
32
29
|
}
|
|
33
|
-
return
|
|
30
|
+
return React.createElement(blocks.Flex, {
|
|
34
31
|
column: true,
|
|
35
|
-
margintop: "1rem"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
})
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
});
|
|
32
|
+
margintop: "1rem"
|
|
33
|
+
}, React.createElement(StyledAccordion, {
|
|
34
|
+
dark: true,
|
|
35
|
+
header: React.createElement(blocks.Text, {
|
|
36
|
+
bold: true,
|
|
37
|
+
role: "navy0"
|
|
38
|
+
}, intl$1.formatMessage({
|
|
39
|
+
id: 'materialQuiz.explanation.show'
|
|
40
|
+
}))
|
|
41
|
+
}, materialQuiz.explanationInfo.isEnabled ? React.createElement(StyledMarkdownSSR, {
|
|
42
|
+
dark: true,
|
|
43
|
+
children: materialQuiz.explanationInfo.value
|
|
44
|
+
}) : React.createElement(blocks.Text, {
|
|
45
|
+
role: "info",
|
|
46
|
+
lineHeight: 1.4,
|
|
47
|
+
userSelect: "none"
|
|
48
|
+
}, intl$1.formatMessage({
|
|
49
|
+
id: 'materialQuiz.explanation.empty'
|
|
50
|
+
}))));
|
|
58
51
|
};
|
|
59
52
|
|
|
60
53
|
exports.default = MaterialQuizAnswerExplanation;
|