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