@elice/material-quiz 1.240718.0-trasncript.1 → 1.240718.0-trasncript.2
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/_virtual/_rollupPluginBabelHelpers.js +423 -0
- package/cjs/components/eb-sortable/EbDraggable.js +42 -33
- package/cjs/components/eb-sortable/EbDroppable.js +27 -20
- package/cjs/components/markdown-editor/index.d.ts +1 -2
- package/cjs/components/markdown-editor/index.js +19 -10
- package/cjs/components/material-quiz/MaterialQuiz.js +114 -83
- package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +36 -29
- package/cjs/components/material-quiz/MaterialQuizInfo.js +151 -149
- package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +175 -127
- package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +360 -286
- package/cjs/components/material-quiz/MaterialQuizSelectOne.js +172 -126
- package/cjs/components/material-quiz/MaterialQuizShimmer.js +46 -39
- package/cjs/components/material-quiz/MaterialQuizText.js +163 -115
- package/cjs/components/material-quiz/QuizResultBadge.js +32 -22
- package/cjs/components/material-quiz/QuizSubmitStatusText.js +21 -16
- 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 +156 -93
- package/cjs/components/material-quiz/index.js +9 -0
- package/cjs/components/material-quiz/locales/index.js +13 -0
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +259 -161
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +134 -100
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +130 -101
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +64 -52
- package/cjs/components/material-quiz/material-quiz-group/context/context.js +5 -1
- package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +47 -36
- package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +280 -232
- package/cjs/components/material-quiz-edit/context.js +8 -2
- package/cjs/components/material-quiz-edit/index.js +7 -0
- package/cjs/components/material-quiz-edit/locales/index.js +13 -0
- package/cjs/components/material-quiz-edit/options/OptionEditor.js +70 -46
- package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +174 -148
- package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +175 -149
- package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +164 -144
- package/cjs/components/material-quiz-edit/options/OptionText.js +90 -82
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +156 -112
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +288 -196
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +88 -75
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +108 -92
- package/cjs/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
- package/cjs/components/material-quiz-edit/utils/editValue.js +21 -12
- package/cjs/components/shared/QuestionBox.js +198 -165
- package/cjs/components/shared/QuizDraggbleDroppedOption.js +11 -12
- package/cjs/components/shared/QuizDraggbleDummyOption.js +23 -16
- package/cjs/components/shared/QuizDraggbleOption.js +65 -59
- package/cjs/components/shared/StyledMarkdown.js +5 -1
- package/cjs/components/shared/index.js +19 -0
- package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +13 -7
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +24 -17
- package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +59 -68
- package/cjs/components/shared/question-radio/QuestionRadio.js +13 -7
- package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/cjs/components/shared/question-radio/QuestionRadioContext.js +24 -17
- package/cjs/components/shared/question-radio/QuestionRadioOption.js +52 -59
- package/cjs/components/shared/utils/getQuestionStatusStyle.js +7 -9
- package/cjs/components/shared/utils/mergeRefs.js +15 -6
- package/cjs/constant/element.js +3 -3
- package/cjs/constant/index.js +9 -0
- package/cjs/helpers/index.js +8 -10
- package/cjs/hooks/index.js +7 -0
- package/cjs/hooks/useCaculatePassage.js +21 -20
- package/es/_virtual/_rollupPluginBabelHelpers.js +408 -0
- package/es/components/eb-sortable/EbDraggable.js +37 -33
- package/es/components/eb-sortable/EbDroppable.js +22 -20
- package/es/components/markdown-editor/index.d.ts +1 -2
- package/es/components/markdown-editor/index.js +15 -10
- package/es/components/material-quiz/MaterialQuiz.js +109 -83
- package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +32 -29
- package/es/components/material-quiz/MaterialQuizInfo.js +148 -150
- package/es/components/material-quiz/MaterialQuizSelectMultiple.js +171 -127
- package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +356 -287
- package/es/components/material-quiz/MaterialQuizSelectOne.js +168 -126
- package/es/components/material-quiz/MaterialQuizShimmer.js +42 -39
- package/es/components/material-quiz/MaterialQuizText.js +158 -115
- package/es/components/material-quiz/QuizResultBadge.js +27 -22
- package/es/components/material-quiz/QuizSubmitStatusText.js +17 -16
- 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 +153 -94
- package/es/components/material-quiz/index.js +2 -0
- package/es/components/material-quiz/locales/index.js +4 -0
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +253 -161
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +129 -100
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +125 -101
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +60 -52
- package/es/components/material-quiz/material-quiz-group/context/context.js +1 -1
- package/es/components/material-quiz-edit/MaterialQuizEdit.js +43 -36
- package/es/components/material-quiz-edit/MaterialQuizEditContent.js +272 -229
- package/es/components/material-quiz-edit/context.js +4 -2
- package/es/components/material-quiz-edit/index.js +1 -0
- package/es/components/material-quiz-edit/locales/index.js +4 -0
- package/es/components/material-quiz-edit/options/OptionEditor.js +64 -46
- package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +170 -148
- package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +171 -149
- package/es/components/material-quiz-edit/options/OptionSelectOne.js +159 -144
- package/es/components/material-quiz-edit/options/OptionText.js +86 -82
- package/es/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
- package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +151 -112
- package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +283 -197
- package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +83 -75
- package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +103 -92
- package/es/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
- package/es/components/material-quiz-edit/utils/editValue.js +17 -12
- package/es/components/shared/QuestionBox.js +192 -165
- package/es/components/shared/QuizDraggbleDroppedOption.js +11 -12
- package/es/components/shared/QuizDraggbleDummyOption.js +19 -16
- package/es/components/shared/QuizDraggbleOption.js +61 -59
- package/es/components/shared/StyledMarkdown.js +1 -1
- package/es/components/shared/index.js +7 -0
- package/es/components/shared/question-checkbox/QuestionCheckbox.js +9 -7
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +20 -17
- package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +54 -68
- package/es/components/shared/question-radio/QuestionRadio.js +9 -7
- package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/es/components/shared/question-radio/QuestionRadioContext.js +20 -17
- package/es/components/shared/question-radio/QuestionRadioOption.js +47 -59
- package/es/components/shared/utils/getQuestionStatusStyle.js +7 -9
- package/es/components/shared/utils/mergeRefs.js +15 -6
- package/es/constant/element.js +3 -3
- package/es/constant/index.js +1 -0
- package/es/helpers/index.js +8 -10
- package/es/hooks/index.js +1 -0
- package/es/hooks/useCaculatePassage.js +21 -20
- package/package.json +12 -15
|
@@ -2,6 +2,8 @@
|
|
|
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');
|
|
5
7
|
var React = require('react');
|
|
6
8
|
var reactHookForm = require('react-hook-form');
|
|
7
9
|
var reactTransitionGroup = require('react-transition-group');
|
|
@@ -20,26 +22,38 @@ var checkTwoDimensionArray = require('./utils/checkTwoDimensionArray.js');
|
|
|
20
22
|
var randomId = require('./utils/randomId.js');
|
|
21
23
|
var context = require('./context.js');
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
26
|
+
|
|
27
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
28
|
+
var flattenDeep__default = /*#__PURE__*/_interopDefaultCompat(flattenDeep);
|
|
29
|
+
|
|
30
|
+
var MIN_TEXT_LENGTH = 1;
|
|
31
|
+
var MAX_TEXT_LENGTH = 128;
|
|
32
|
+
var MaterialQuizEditContent = function MaterialQuizEditContent() {
|
|
33
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
34
|
+
var _useMaterialQuizEditC = context.useMaterialQuizEditContext(),
|
|
35
|
+
disabled = _useMaterialQuizEditC.disabled,
|
|
36
|
+
onFileUploadRequest = _useMaterialQuizEditC.onFileUploadRequest;
|
|
37
|
+
var _useFormContext = reactHookForm.useFormContext(),
|
|
38
|
+
control = _useFormContext.control,
|
|
39
|
+
watch = _useFormContext.watch,
|
|
40
|
+
setValue = _useFormContext.setValue;
|
|
41
|
+
var _watch = watch(['optionType', 'optionsDefault', 'answerInfoDefault', 'answerHint', 'explanationInfo', 'isAutoGrade', 'groups', 'optionsSetEnabled']),
|
|
42
|
+
_watch2 = _rollupPluginBabelHelpers.slicedToArray(_watch, 8),
|
|
43
|
+
watchedOptionType = _watch2[0],
|
|
44
|
+
watchedOptionInfo = _watch2[1],
|
|
45
|
+
watchedAnswerInfo = _watch2[2],
|
|
46
|
+
watchedAnswerHint = _watch2[3],
|
|
47
|
+
watchedExplanationInfo = _watch2[4],
|
|
48
|
+
watchedIsAutoGrade = _watch2[5],
|
|
49
|
+
watchedGroups = _watch2[6],
|
|
50
|
+
optionsSetEnabled = _watch2[7];
|
|
37
51
|
//
|
|
38
52
|
// Change `options` according to `optionType`.
|
|
39
53
|
//
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
54
|
+
React__default.default.useEffect(function () {
|
|
55
|
+
var get = function get() {
|
|
56
|
+
var filteredNotMarkdownOptions = watchedOptionInfo === null || watchedOptionInfo === void 0 ? void 0 : watchedOptionInfo.filter(function (option) {
|
|
43
57
|
var _a;
|
|
44
58
|
return !((_a = option.content) === null || _a === void 0 ? void 0 : _a.includes('![]'));
|
|
45
59
|
});
|
|
@@ -68,7 +82,7 @@ const MaterialQuizEditContent = () => {
|
|
|
68
82
|
}];
|
|
69
83
|
}
|
|
70
84
|
if (filteredNotMarkdownOptions.length) {
|
|
71
|
-
return watchedOptionInfo.map(e
|
|
85
|
+
return watchedOptionInfo.map(function (e) {
|
|
72
86
|
var _a;
|
|
73
87
|
if ((_a = e.title) === null || _a === void 0 ? void 0 : _a.length) {
|
|
74
88
|
return Object.assign(Object.assign({}, e), {
|
|
@@ -102,7 +116,7 @@ const MaterialQuizEditContent = () => {
|
|
|
102
116
|
}];
|
|
103
117
|
}
|
|
104
118
|
if (filteredNotMarkdownOptions.length) {
|
|
105
|
-
return watchedOptionInfo.map(e
|
|
119
|
+
return watchedOptionInfo.map(function (e) {
|
|
106
120
|
var _a, _b;
|
|
107
121
|
if (!((_a = e.content) === null || _a === void 0 ? void 0 : _a.includes('![]')) && !((_b = e.title) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
108
122
|
return Object.assign(Object.assign({}, e), {
|
|
@@ -127,16 +141,16 @@ const MaterialQuizEditContent = () => {
|
|
|
127
141
|
//
|
|
128
142
|
// Change `answerInfo` according to `optionType`.
|
|
129
143
|
//
|
|
130
|
-
|
|
131
|
-
|
|
144
|
+
React__default.default.useEffect(function () {
|
|
145
|
+
var get = function get() {
|
|
132
146
|
switch (watchedOptionType) {
|
|
133
147
|
case types.enums.QuizOptionType.SelectOne:
|
|
134
148
|
if (!Array.isArray(watchedAnswerInfo)) {
|
|
135
149
|
return [0];
|
|
136
150
|
}
|
|
137
151
|
if (checkTwoDimensionArray.checkTwoDimensionArray(watchedAnswerInfo)) {
|
|
138
|
-
|
|
139
|
-
return
|
|
152
|
+
var convertedAnswerInfo = watchedAnswerInfo;
|
|
153
|
+
return flattenDeep__default.default(convertedAnswerInfo).slice(0, 1);
|
|
140
154
|
}
|
|
141
155
|
return watchedAnswerInfo.slice(0, 1);
|
|
142
156
|
case types.enums.QuizOptionType.SelectMultiple:
|
|
@@ -145,7 +159,7 @@ const MaterialQuizEditContent = () => {
|
|
|
145
159
|
return [0];
|
|
146
160
|
}
|
|
147
161
|
if (checkTwoDimensionArray.checkTwoDimensionArray(watchedAnswerInfo)) {
|
|
148
|
-
return
|
|
162
|
+
return flattenDeep__default.default(watchedAnswerInfo);
|
|
149
163
|
}
|
|
150
164
|
return watchedAnswerInfo;
|
|
151
165
|
case types.enums.QuizOptionType.Text:
|
|
@@ -163,8 +177,8 @@ const MaterialQuizEditContent = () => {
|
|
|
163
177
|
//
|
|
164
178
|
// Change `answerHint` according to `optionType`.
|
|
165
179
|
//
|
|
166
|
-
|
|
167
|
-
|
|
180
|
+
React__default.default.useEffect(function () {
|
|
181
|
+
var get = function get() {
|
|
168
182
|
switch (watchedOptionType) {
|
|
169
183
|
case types.enums.QuizOptionType.SelectOne:
|
|
170
184
|
case types.enums.QuizOptionType.SelectMultiple:
|
|
@@ -184,8 +198,8 @@ const MaterialQuizEditContent = () => {
|
|
|
184
198
|
//
|
|
185
199
|
// Change `isAutoGrade` according to `optionType`.
|
|
186
200
|
//
|
|
187
|
-
|
|
188
|
-
|
|
201
|
+
React__default.default.useEffect(function () {
|
|
202
|
+
var get = function get() {
|
|
189
203
|
switch (watchedOptionType) {
|
|
190
204
|
case types.enums.QuizOptionType.SelectOne:
|
|
191
205
|
case types.enums.QuizOptionType.SelectMultiple:
|
|
@@ -205,8 +219,8 @@ const MaterialQuizEditContent = () => {
|
|
|
205
219
|
//
|
|
206
220
|
// Change `groups` according to `optionType`.
|
|
207
221
|
//
|
|
208
|
-
|
|
209
|
-
|
|
222
|
+
React__default.default.useEffect(function () {
|
|
223
|
+
var get = function get() {
|
|
210
224
|
switch (watchedOptionType) {
|
|
211
225
|
case types.enums.QuizOptionType.SelectOne:
|
|
212
226
|
case types.enums.QuizOptionType.SelectMultiple:
|
|
@@ -241,7 +255,7 @@ const MaterialQuizEditContent = () => {
|
|
|
241
255
|
* Input of option info and answer info,
|
|
242
256
|
* according to option type.
|
|
243
257
|
*/
|
|
244
|
-
|
|
258
|
+
var Option = React__default.default.useMemo(function () {
|
|
245
259
|
switch (watchedOptionType) {
|
|
246
260
|
case types.enums.QuizOptionType.SelectOne:
|
|
247
261
|
return OptionSelectOne.default;
|
|
@@ -254,21 +268,22 @@ const MaterialQuizEditContent = () => {
|
|
|
254
268
|
case types.enums.QuizOptionType.Text:
|
|
255
269
|
return OptionText.default;
|
|
256
270
|
default:
|
|
257
|
-
return
|
|
271
|
+
return React__default.default.Fragment;
|
|
258
272
|
}
|
|
259
273
|
}, [watchedOptionType]);
|
|
260
274
|
/**
|
|
261
275
|
* Render input for quiz title.
|
|
262
276
|
*/
|
|
263
|
-
|
|
264
|
-
return
|
|
265
|
-
label:
|
|
277
|
+
var renderQuestionTitleInput = function renderQuestionTitleInput() {
|
|
278
|
+
return jsxRuntime.jsx(blocks.FormInputVerticalLayout, {
|
|
279
|
+
label: jsxRuntime.jsx(blocks.Label, {
|
|
266
280
|
size: "small",
|
|
267
|
-
required: true
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
281
|
+
required: true,
|
|
282
|
+
children: intl$1.formatMessage({
|
|
283
|
+
id: 'content.title'
|
|
284
|
+
})
|
|
285
|
+
}),
|
|
286
|
+
input: jsxRuntime.jsx(reactHookForm.Controller, {
|
|
272
287
|
control: control,
|
|
273
288
|
name: "questionTitle",
|
|
274
289
|
rules: {
|
|
@@ -297,12 +312,11 @@ const MaterialQuizEditContent = () => {
|
|
|
297
312
|
})
|
|
298
313
|
}
|
|
299
314
|
},
|
|
300
|
-
render: ({
|
|
301
|
-
field,
|
|
302
|
-
|
|
303
|
-
}) => {
|
|
315
|
+
render: function render(_ref) {
|
|
316
|
+
var field = _ref.field,
|
|
317
|
+
fieldState = _ref.fieldState;
|
|
304
318
|
var _a;
|
|
305
|
-
return
|
|
319
|
+
return jsxRuntime.jsx(blocks.Input, Object.assign({
|
|
306
320
|
size: "small",
|
|
307
321
|
width: "full",
|
|
308
322
|
minLength: MIN_TEXT_LENGTH,
|
|
@@ -320,149 +334,169 @@ const MaterialQuizEditContent = () => {
|
|
|
320
334
|
/**
|
|
321
335
|
* Render input for quiz description.
|
|
322
336
|
*/
|
|
323
|
-
|
|
324
|
-
return
|
|
325
|
-
label:
|
|
326
|
-
size: "small"
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
337
|
+
var renderQuestionDescriptionInput = function renderQuestionDescriptionInput() {
|
|
338
|
+
return jsxRuntime.jsx(blocks.FormInputVerticalLayout, {
|
|
339
|
+
label: jsxRuntime.jsx(blocks.Label, {
|
|
340
|
+
size: "small",
|
|
341
|
+
children: intl$1.formatMessage({
|
|
342
|
+
id: 'content.description.title'
|
|
343
|
+
})
|
|
344
|
+
}),
|
|
345
|
+
input: jsxRuntime.jsx(reactHookForm.Controller, {
|
|
331
346
|
control: control,
|
|
332
347
|
name: "questionDescription",
|
|
333
|
-
render: ({
|
|
334
|
-
field
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
348
|
+
render: function render(_ref2) {
|
|
349
|
+
var field = _ref2.field;
|
|
350
|
+
return jsxRuntime.jsx(index.MarkdownEditor, Object.assign({
|
|
351
|
+
placeholder: intl$1.formatMessage({
|
|
352
|
+
id: 'content.description.placeholder'
|
|
353
|
+
}),
|
|
354
|
+
onFileUploadRequest: onFileUploadRequest
|
|
355
|
+
}, field));
|
|
356
|
+
}
|
|
341
357
|
})
|
|
342
358
|
});
|
|
343
359
|
};
|
|
344
360
|
/**
|
|
345
361
|
* Render input of option type, option info and answer info.
|
|
346
362
|
*/
|
|
347
|
-
|
|
348
|
-
return
|
|
349
|
-
label:
|
|
363
|
+
var renderOptionInput = function renderOptionInput() {
|
|
364
|
+
return jsxRuntime.jsx(blocks.FormInputVerticalLayout, {
|
|
365
|
+
label: jsxRuntime.jsx(blocks.Label, {
|
|
350
366
|
size: "small",
|
|
351
|
-
required: true
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
367
|
+
required: true,
|
|
368
|
+
children: intl$1.formatMessage({
|
|
369
|
+
id: 'content.option.title'
|
|
370
|
+
})
|
|
371
|
+
}),
|
|
372
|
+
input: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
373
|
+
children: [jsxRuntime.jsx(reactHookForm.Controller, {
|
|
374
|
+
control: control,
|
|
375
|
+
name: "optionType",
|
|
376
|
+
render: function render(_ref3) {
|
|
377
|
+
var field = _ref3.field;
|
|
378
|
+
return jsxRuntime.jsx(material.Tooltip, {
|
|
379
|
+
title: disabled && intl$1.formatMessage({
|
|
380
|
+
id: 'content.option.tooltip.disabled'
|
|
381
|
+
}),
|
|
382
|
+
placement: "top-end",
|
|
383
|
+
children: jsxRuntime.jsxs(material.Stack, {
|
|
384
|
+
direction: "row",
|
|
385
|
+
justifyContent: "space-between",
|
|
386
|
+
marginBottom: "0.5rem",
|
|
387
|
+
children: [jsxRuntime.jsxs(material.TextField, Object.assign({
|
|
388
|
+
select: true,
|
|
389
|
+
disabled: disabled
|
|
390
|
+
}, field, {
|
|
391
|
+
onChange: function onChange(event) {
|
|
392
|
+
var isTextQuizOption = Number(event.target.value) === types.enums.QuizOptionType.Text;
|
|
393
|
+
if (isTextQuizOption) {
|
|
394
|
+
setValue('optionsSetEnabled', false);
|
|
395
|
+
}
|
|
396
|
+
field.onChange(event);
|
|
397
|
+
},
|
|
398
|
+
children: [jsxRuntime.jsx(material.MenuItem, {
|
|
399
|
+
value: types.enums.QuizOptionType.SelectOne,
|
|
400
|
+
children: intl$1.formatMessage({
|
|
401
|
+
id: 'content.option.select.items.selectOne'
|
|
402
|
+
})
|
|
403
|
+
}), jsxRuntime.jsx(material.MenuItem, {
|
|
404
|
+
value: types.enums.QuizOptionType.SelectMultiple,
|
|
405
|
+
children: intl$1.formatMessage({
|
|
406
|
+
id: 'content.option.select.items.selectMultiple'
|
|
407
|
+
})
|
|
408
|
+
}), jsxRuntime.jsx(material.MenuItem, {
|
|
409
|
+
value: types.enums.QuizOptionType.SelectMultipleOrder,
|
|
410
|
+
children: intl$1.formatMessage({
|
|
411
|
+
id: 'content.option.select.items.selectMultipleOrder'
|
|
412
|
+
})
|
|
413
|
+
}), jsxRuntime.jsx(material.MenuItem, {
|
|
414
|
+
value: types.enums.QuizOptionType.Group,
|
|
415
|
+
children: intl$1.formatMessage({
|
|
416
|
+
id: 'content.option.select.items.group'
|
|
417
|
+
})
|
|
418
|
+
}), jsxRuntime.jsx(material.MenuItem, {
|
|
419
|
+
value: types.enums.QuizOptionType.Text,
|
|
420
|
+
children: intl$1.formatMessage({
|
|
421
|
+
id: 'content.option.select.items.text'
|
|
422
|
+
})
|
|
423
|
+
})]
|
|
424
|
+
})), watchedOptionType !== types.enums.QuizOptionType.Text ? jsxRuntime.jsx(reactHookForm.Controller, {
|
|
425
|
+
name: "optionsSetEnabled",
|
|
426
|
+
control: control,
|
|
427
|
+
render: function render(_ref4) {
|
|
428
|
+
var field = _ref4.field;
|
|
429
|
+
return jsxRuntime.jsx(material.Tooltip, {
|
|
430
|
+
title: disabled ? '' : intl$1.formatMessage({
|
|
431
|
+
id: 'content.option.optionsSetEnabled.tooltip'
|
|
432
|
+
}),
|
|
433
|
+
placement: "top",
|
|
434
|
+
children: jsxRuntime.jsx(material.FormControlLabel, {
|
|
435
|
+
disabled: disabled,
|
|
436
|
+
label: intl$1.formatMessage({
|
|
437
|
+
id: 'content.option.optionsSetEnabled.label'
|
|
438
|
+
}),
|
|
439
|
+
control: jsxRuntime.jsx(material.Switch, Object.assign({}, field, {
|
|
440
|
+
checked: field.value
|
|
441
|
+
}))
|
|
442
|
+
})
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
}) : null]
|
|
446
|
+
})
|
|
447
|
+
});
|
|
379
448
|
}
|
|
380
|
-
}),
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
})
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
children:
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
449
|
+
}), watchedOptionType !== types.enums.QuizOptionType.Text && optionsSetEnabled ? jsxRuntime.jsxs(material.Alert, {
|
|
450
|
+
severity: "info",
|
|
451
|
+
sx: {
|
|
452
|
+
marginBottom: '1rem'
|
|
453
|
+
},
|
|
454
|
+
children: [jsxRuntime.jsx(material.AlertTitle, {
|
|
455
|
+
children: intl$1.formatMessage({
|
|
456
|
+
id: 'content.option.alert.randomized.title'
|
|
457
|
+
})
|
|
458
|
+
}), intl$1.formatMessage({
|
|
459
|
+
id: 'content.option.alert.randomized.description'
|
|
460
|
+
})]
|
|
461
|
+
}) : null, jsxRuntime.jsx(reactTransitionGroup.Transition, {
|
|
462
|
+
in: watchedOptionType === types.enums.QuizOptionType.SelectMultipleOrder || watchedOptionType === types.enums.QuizOptionType.Group,
|
|
463
|
+
timeout: 0,
|
|
464
|
+
mountOnEnter: true,
|
|
465
|
+
unmountOnExit: true,
|
|
466
|
+
children: jsxRuntime.jsx(material.Box, {
|
|
467
|
+
marginBottom: "0.5rem",
|
|
468
|
+
children: jsxRuntime.jsx(blocks.StatusText, {
|
|
469
|
+
role: "description",
|
|
470
|
+
preWrap: true,
|
|
471
|
+
children: intl$1.formatMessage({
|
|
472
|
+
id: watchedOptionType === types.enums.QuizOptionType.SelectMultipleOrder ? 'content.option.statusText.dragNDrop' : 'content.option.statusText.dragNDropGroup'
|
|
473
|
+
})
|
|
474
|
+
})
|
|
404
475
|
})
|
|
405
|
-
})
|
|
406
|
-
|
|
407
|
-
control: control,
|
|
408
|
-
render: ({
|
|
409
|
-
field
|
|
410
|
-
}) => React.createElement(material.Tooltip, {
|
|
411
|
-
title: disabled ? '' : intl$1.formatMessage({
|
|
412
|
-
id: 'content.option.optionsSetEnabled.tooltip'
|
|
413
|
-
}),
|
|
414
|
-
placement: "top"
|
|
415
|
-
}, React.createElement(material.FormControlLabel, {
|
|
416
|
-
disabled: disabled,
|
|
417
|
-
label: intl$1.formatMessage({
|
|
418
|
-
id: 'content.option.optionsSetEnabled.label'
|
|
419
|
-
}),
|
|
420
|
-
control: React.createElement(material.Switch, Object.assign({}, field, {
|
|
421
|
-
checked: field.value
|
|
422
|
-
}))
|
|
423
|
-
}))
|
|
424
|
-
}) : null))
|
|
425
|
-
}), watchedOptionType !== types.enums.QuizOptionType.Text && optionsSetEnabled ? React.createElement(material.Alert, {
|
|
426
|
-
severity: "info",
|
|
427
|
-
sx: {
|
|
428
|
-
marginBottom: '1rem'
|
|
429
|
-
}
|
|
430
|
-
}, React.createElement(material.AlertTitle, null, intl$1.formatMessage({
|
|
431
|
-
id: 'content.option.alert.randomized.title'
|
|
432
|
-
})), intl$1.formatMessage({
|
|
433
|
-
id: 'content.option.alert.randomized.description'
|
|
434
|
-
})) : null, React.createElement(reactTransitionGroup.Transition, {
|
|
435
|
-
in: watchedOptionType === types.enums.QuizOptionType.SelectMultipleOrder || watchedOptionType === types.enums.QuizOptionType.Group,
|
|
436
|
-
timeout: 0,
|
|
437
|
-
mountOnEnter: true,
|
|
438
|
-
unmountOnExit: true
|
|
439
|
-
}, React.createElement(material.Box, {
|
|
440
|
-
marginBottom: "0.5rem"
|
|
441
|
-
}, React.createElement(blocks.StatusText, {
|
|
442
|
-
role: "description",
|
|
443
|
-
preWrap: true
|
|
444
|
-
}, intl$1.formatMessage({
|
|
445
|
-
id: watchedOptionType === types.enums.QuizOptionType.SelectMultipleOrder ? 'content.option.statusText.dragNDrop' : 'content.option.statusText.dragNDropGroup'
|
|
446
|
-
})))), React.createElement(Option, null))
|
|
476
|
+
}), jsxRuntime.jsx(Option, {})]
|
|
477
|
+
})
|
|
447
478
|
});
|
|
448
479
|
};
|
|
449
480
|
/**
|
|
450
481
|
* Input of answer hint.
|
|
451
482
|
*/
|
|
452
|
-
|
|
483
|
+
var renderAnswerHintInput = function renderAnswerHintInput() {
|
|
453
484
|
if (watchedOptionType !== types.enums.QuizOptionType.Text) {
|
|
454
485
|
return null;
|
|
455
486
|
}
|
|
456
|
-
return
|
|
457
|
-
label:
|
|
458
|
-
size: "small"
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
487
|
+
return jsxRuntime.jsx(blocks.FormInputVerticalLayout, {
|
|
488
|
+
label: jsxRuntime.jsx(blocks.Label, {
|
|
489
|
+
size: "small",
|
|
490
|
+
children: intl$1.formatMessage({
|
|
491
|
+
id: 'content.answerHint.title'
|
|
492
|
+
})
|
|
493
|
+
}),
|
|
494
|
+
description: jsxRuntime.jsx(blocks.Text, {
|
|
495
|
+
children: intl$1.formatMessage({
|
|
496
|
+
id: 'content.answerHint.description'
|
|
497
|
+
})
|
|
498
|
+
}),
|
|
499
|
+
input: jsxRuntime.jsx(reactHookForm.Controller, {
|
|
466
500
|
control: control,
|
|
467
501
|
name: "answerHint",
|
|
468
502
|
rules: {
|
|
@@ -485,12 +519,11 @@ const MaterialQuizEditContent = () => {
|
|
|
485
519
|
})
|
|
486
520
|
}
|
|
487
521
|
},
|
|
488
|
-
render: ({
|
|
489
|
-
field,
|
|
490
|
-
|
|
491
|
-
}) => {
|
|
522
|
+
render: function render(_ref5) {
|
|
523
|
+
var field = _ref5.field,
|
|
524
|
+
fieldState = _ref5.fieldState;
|
|
492
525
|
var _a, _b;
|
|
493
|
-
return
|
|
526
|
+
return jsxRuntime.jsx(blocks.Input, Object.assign({
|
|
494
527
|
size: "small",
|
|
495
528
|
width: "full",
|
|
496
529
|
minLength: MIN_TEXT_LENGTH,
|
|
@@ -510,70 +543,85 @@ const MaterialQuizEditContent = () => {
|
|
|
510
543
|
/**
|
|
511
544
|
* Input of explanation info.
|
|
512
545
|
*/
|
|
513
|
-
|
|
514
|
-
return
|
|
515
|
-
label:
|
|
516
|
-
size: "small"
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
height: 1
|
|
540
|
-
}), React.createElement(reactHookForm.Controller, {
|
|
541
|
-
control: control,
|
|
542
|
-
name: "explanationInfo.value",
|
|
543
|
-
rules: {
|
|
544
|
-
required: {
|
|
545
|
-
value: true,
|
|
546
|
-
message: intl$1.formatMessage({
|
|
547
|
-
id: 'content.explanationInfo.textarea.placeholder'
|
|
548
|
-
})
|
|
546
|
+
var renderExplanationInfoInput = function renderExplanationInfoInput() {
|
|
547
|
+
return jsxRuntime.jsx(blocks.FormInputVerticalLayout, {
|
|
548
|
+
label: jsxRuntime.jsx(blocks.Label, {
|
|
549
|
+
size: "small",
|
|
550
|
+
children: intl$1.formatMessage({
|
|
551
|
+
id: 'content.explanationInfo.title'
|
|
552
|
+
})
|
|
553
|
+
}),
|
|
554
|
+
description: jsxRuntime.jsx(blocks.Text, {
|
|
555
|
+
children: intl$1.formatMessage({
|
|
556
|
+
id: 'content.explanationInfo.description'
|
|
557
|
+
})
|
|
558
|
+
}),
|
|
559
|
+
input: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
560
|
+
children: [jsxRuntime.jsx(reactHookForm.Controller, {
|
|
561
|
+
control: control,
|
|
562
|
+
name: "explanationInfo.isEnabled",
|
|
563
|
+
render: function render(_ref6) {
|
|
564
|
+
var field = _ref6.field;
|
|
565
|
+
return jsxRuntime.jsx(blocks.Checkbox, Object.assign({
|
|
566
|
+
size: "small"
|
|
567
|
+
}, field, {
|
|
568
|
+
children: intl$1.formatMessage({
|
|
569
|
+
id: 'content.explanationInfo.checkbox.label'
|
|
570
|
+
})
|
|
571
|
+
}));
|
|
549
572
|
}
|
|
550
|
-
},
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
573
|
+
}), jsxRuntime.jsx(reactTransitionGroup.Transition, {
|
|
574
|
+
in: watchedExplanationInfo.isEnabled,
|
|
575
|
+
timeout: 0,
|
|
576
|
+
mountOnEnter: true,
|
|
577
|
+
unmountOnExit: true,
|
|
578
|
+
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
579
|
+
children: [jsxRuntime.jsx(blocks.Vspace, {
|
|
580
|
+
height: 1
|
|
581
|
+
}), jsxRuntime.jsx(reactHookForm.Controller, {
|
|
582
|
+
control: control,
|
|
583
|
+
name: "explanationInfo.value",
|
|
584
|
+
rules: {
|
|
585
|
+
required: {
|
|
586
|
+
value: true,
|
|
587
|
+
message: intl$1.formatMessage({
|
|
588
|
+
id: 'content.explanationInfo.textarea.placeholder'
|
|
589
|
+
})
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
render: function render(_ref7) {
|
|
593
|
+
var field = _ref7.field,
|
|
594
|
+
fieldState = _ref7.fieldState;
|
|
595
|
+
var _a;
|
|
596
|
+
return jsxRuntime.jsxs(blocks.Flex, {
|
|
597
|
+
column: true,
|
|
598
|
+
children: [fieldState.invalid ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
599
|
+
children: [jsxRuntime.jsx(blocks.StatusText, {
|
|
600
|
+
children: (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message,
|
|
601
|
+
role: "danger"
|
|
602
|
+
}), jsxRuntime.jsx(blocks.Vspace, {
|
|
603
|
+
height: 0.5
|
|
604
|
+
})]
|
|
605
|
+
}) : null, jsxRuntime.jsx(index.MarkdownEditor, Object.assign({
|
|
606
|
+
placeholder: intl$1.formatMessage({
|
|
607
|
+
id: 'content.explanationInfo.textarea.errorMessage.required'
|
|
608
|
+
}),
|
|
609
|
+
onFileUploadRequest: onFileUploadRequest
|
|
610
|
+
}, field))]
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
})]
|
|
614
|
+
})
|
|
615
|
+
})]
|
|
616
|
+
})
|
|
571
617
|
});
|
|
572
618
|
};
|
|
573
619
|
//
|
|
574
620
|
//
|
|
575
621
|
//
|
|
576
|
-
return
|
|
622
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
623
|
+
children: [renderQuestionTitleInput(), renderQuestionDescriptionInput(), renderOptionInput(), renderAnswerHintInput(), renderExplanationInfoInput()]
|
|
624
|
+
});
|
|
577
625
|
};
|
|
578
626
|
|
|
579
627
|
exports.default = MaterialQuizEditContent;
|