@elice/material-quiz 1.220803.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/cjs/components/eb-sortable/EbDraggable.d.ts +18 -0
- package/cjs/components/eb-sortable/EbDraggable.js +112 -0
- package/cjs/components/eb-sortable/EbDroppable.d.ts +13 -0
- package/cjs/components/eb-sortable/EbDroppable.js +60 -0
- package/cjs/components/eb-sortable/EbSortable.d.ts +17 -0
- package/cjs/components/material-quiz/MaterialQuiz.d.ts +4 -0
- package/cjs/components/material-quiz/MaterialQuiz.i18n.d.ts +25 -0
- package/cjs/components/material-quiz/MaterialQuiz.i18n.js +55 -0
- package/cjs/components/material-quiz/MaterialQuiz.js +114 -0
- package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.d.ts +3 -0
- package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +55 -0
- package/cjs/components/material-quiz/MaterialQuizError.d.ts +3 -0
- package/cjs/components/material-quiz/MaterialQuizInfo.d.ts +3 -0
- package/cjs/components/material-quiz/MaterialQuizInfo.js +74 -0
- package/cjs/components/material-quiz/MaterialQuizSelectMultiple.d.ts +3 -0
- package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +203 -0
- package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.d.ts +3 -0
- package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +468 -0
- package/cjs/components/material-quiz/MaterialQuizSelectOne.d.ts +3 -0
- package/cjs/components/material-quiz/MaterialQuizSelectOne.js +191 -0
- package/cjs/components/material-quiz/MaterialQuizShimmer.d.ts +3 -0
- package/cjs/components/material-quiz/MaterialQuizShimmer.js +61 -0
- package/cjs/components/material-quiz/MaterialQuizText.d.ts +3 -0
- package/cjs/components/material-quiz/MaterialQuizText.js +181 -0
- package/cjs/components/material-quiz/QuizResultBadge.d.ts +7 -0
- package/cjs/components/material-quiz/QuizResultBadge.js +48 -0
- package/cjs/components/material-quiz/QuizSubmitStatusText.d.ts +7 -0
- package/cjs/components/material-quiz/QuizSubmitStatusText.js +38 -0
- package/cjs/components/material-quiz/context/MaterialQuizContext.d.ts +31 -0
- package/cjs/components/material-quiz/context/MaterialQuizContext.js +134 -0
- package/cjs/components/material-quiz/index.d.ts +3 -0
- package/cjs/components/material-quiz-edit/MaterialQuizEdit.d.ts +25 -0
- package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +91 -0
- package/cjs/components/material-quiz-edit/MaterialQuizEditContent.d.ts +3 -0
- package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +463 -0
- package/cjs/components/material-quiz-edit/context.d.ts +6 -0
- package/cjs/components/material-quiz-edit/context.js +15 -0
- package/cjs/components/material-quiz-edit/index.d.ts +2 -0
- package/cjs/components/material-quiz-edit/locales.d.ts +34 -0
- package/cjs/components/material-quiz-edit/locales.js +73 -0
- package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.d.ts +3 -0
- package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +204 -0
- package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.d.ts +3 -0
- package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +205 -0
- package/cjs/components/material-quiz-edit/options/OptionSelectOne.d.ts +3 -0
- package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +207 -0
- package/cjs/components/material-quiz-edit/options/OptionText.d.ts +3 -0
- package/cjs/components/material-quiz-edit/options/OptionText.js +99 -0
- package/cjs/components/material-quiz-edit/utils/editValue.d.ts +15 -0
- package/cjs/components/material-quiz-edit/utils/editValue.js +37 -0
- package/cjs/components/material-quiz-edit/utils/randomId.d.ts +4 -0
- package/cjs/components/material-quiz-edit/utils/randomId.js +12 -0
- package/cjs/components/shared/QuestionBox.d.ts +16 -0
- package/cjs/components/shared/QuestionBox.js +111 -0
- package/cjs/components/shared/QuizDraggbleDroppedOption.d.ts +12 -0
- package/cjs/components/shared/QuizDraggbleDroppedOption.js +31 -0
- package/cjs/components/shared/QuizDraggbleDummyOption.d.ts +8 -0
- package/cjs/components/shared/QuizDraggbleDummyOption.js +36 -0
- package/cjs/components/shared/QuizDraggbleOption.d.ts +14 -0
- package/cjs/components/shared/QuizDraggbleOption.js +191 -0
- package/cjs/components/shared/StyledMarkdown.d.ts +3 -0
- package/cjs/components/shared/StyledMarkdown.js +14 -0
- package/cjs/components/shared/index.d.ts +7 -0
- package/cjs/components/shared/question-checkbox/QuestionCheckbox.d.ts +8 -0
- package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +26 -0
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +9 -0
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +42 -0
- package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.d.ts +9 -0
- package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +188 -0
- package/cjs/components/shared/question-radio/QuestionRadio.d.ts +8 -0
- package/cjs/components/shared/question-radio/QuestionRadio.js +26 -0
- package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +9 -0
- package/cjs/components/shared/question-radio/QuestionRadioContext.js +42 -0
- package/cjs/components/shared/question-radio/QuestionRadioOption.d.ts +9 -0
- package/cjs/components/shared/question-radio/QuestionRadioOption.js +156 -0
- package/cjs/helpers/index.d.ts +50 -0
- package/cjs/helpers/index.js +86 -0
- package/cjs/index.d.ts +3 -0
- package/cjs/index.js +27 -0
- package/es/components/eb-sortable/EbDraggable.d.ts +18 -0
- package/es/components/eb-sortable/EbDraggable.js +105 -0
- package/es/components/eb-sortable/EbDroppable.d.ts +13 -0
- package/es/components/eb-sortable/EbDroppable.js +53 -0
- package/es/components/eb-sortable/EbSortable.d.ts +17 -0
- package/es/components/material-quiz/MaterialQuiz.d.ts +4 -0
- package/es/components/material-quiz/MaterialQuiz.i18n.d.ts +25 -0
- package/es/components/material-quiz/MaterialQuiz.i18n.js +50 -0
- package/es/components/material-quiz/MaterialQuiz.js +106 -0
- package/es/components/material-quiz/MaterialQuizAnswerExplanation.d.ts +3 -0
- package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +48 -0
- package/es/components/material-quiz/MaterialQuizError.d.ts +3 -0
- package/es/components/material-quiz/MaterialQuizInfo.d.ts +3 -0
- package/es/components/material-quiz/MaterialQuizInfo.js +68 -0
- package/es/components/material-quiz/MaterialQuizSelectMultiple.d.ts +3 -0
- package/es/components/material-quiz/MaterialQuizSelectMultiple.js +197 -0
- package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.d.ts +3 -0
- package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +461 -0
- package/es/components/material-quiz/MaterialQuizSelectOne.d.ts +3 -0
- package/es/components/material-quiz/MaterialQuizSelectOne.js +185 -0
- package/es/components/material-quiz/MaterialQuizShimmer.d.ts +3 -0
- package/es/components/material-quiz/MaterialQuizShimmer.js +54 -0
- package/es/components/material-quiz/MaterialQuizText.d.ts +3 -0
- package/es/components/material-quiz/MaterialQuizText.js +174 -0
- package/es/components/material-quiz/QuizResultBadge.d.ts +7 -0
- package/es/components/material-quiz/QuizResultBadge.js +42 -0
- package/es/components/material-quiz/QuizSubmitStatusText.d.ts +7 -0
- package/es/components/material-quiz/QuizSubmitStatusText.js +32 -0
- package/es/components/material-quiz/context/MaterialQuizContext.d.ts +31 -0
- package/es/components/material-quiz/context/MaterialQuizContext.js +124 -0
- package/es/components/material-quiz/index.d.ts +3 -0
- package/es/components/material-quiz-edit/MaterialQuizEdit.d.ts +25 -0
- package/es/components/material-quiz-edit/MaterialQuizEdit.js +86 -0
- package/es/components/material-quiz-edit/MaterialQuizEditContent.d.ts +3 -0
- package/es/components/material-quiz-edit/MaterialQuizEditContent.js +456 -0
- package/es/components/material-quiz-edit/context.d.ts +6 -0
- package/es/components/material-quiz-edit/context.js +6 -0
- package/es/components/material-quiz-edit/index.d.ts +2 -0
- package/es/components/material-quiz-edit/locales.d.ts +34 -0
- package/es/components/material-quiz-edit/locales.js +68 -0
- package/es/components/material-quiz-edit/options/OptionSelectMultiple.d.ts +3 -0
- package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +197 -0
- package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.d.ts +3 -0
- package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +198 -0
- package/es/components/material-quiz-edit/options/OptionSelectOne.d.ts +3 -0
- package/es/components/material-quiz-edit/options/OptionSelectOne.js +200 -0
- package/es/components/material-quiz-edit/options/OptionText.d.ts +3 -0
- package/es/components/material-quiz-edit/options/OptionText.js +93 -0
- package/es/components/material-quiz-edit/utils/editValue.d.ts +15 -0
- package/es/components/material-quiz-edit/utils/editValue.js +32 -0
- package/es/components/material-quiz-edit/utils/randomId.d.ts +4 -0
- package/es/components/material-quiz-edit/utils/randomId.js +8 -0
- package/es/components/shared/QuestionBox.d.ts +16 -0
- package/es/components/shared/QuestionBox.js +101 -0
- package/es/components/shared/QuizDraggbleDroppedOption.d.ts +12 -0
- package/es/components/shared/QuizDraggbleDroppedOption.js +25 -0
- package/es/components/shared/QuizDraggbleDummyOption.d.ts +8 -0
- package/es/components/shared/QuizDraggbleDummyOption.js +29 -0
- package/es/components/shared/QuizDraggbleOption.d.ts +14 -0
- package/es/components/shared/QuizDraggbleOption.js +184 -0
- package/es/components/shared/StyledMarkdown.d.ts +3 -0
- package/es/components/shared/StyledMarkdown.js +8 -0
- package/es/components/shared/index.d.ts +7 -0
- package/es/components/shared/question-checkbox/QuestionCheckbox.d.ts +8 -0
- package/es/components/shared/question-checkbox/QuestionCheckbox.js +19 -0
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +9 -0
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +33 -0
- package/es/components/shared/question-checkbox/QuestionCheckboxOption.d.ts +9 -0
- package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +181 -0
- package/es/components/shared/question-radio/QuestionRadio.d.ts +8 -0
- package/es/components/shared/question-radio/QuestionRadio.js +19 -0
- package/es/components/shared/question-radio/QuestionRadioContext.d.ts +9 -0
- package/es/components/shared/question-radio/QuestionRadioContext.js +33 -0
- package/es/components/shared/question-radio/QuestionRadioOption.d.ts +9 -0
- package/es/components/shared/question-radio/QuestionRadioOption.js +149 -0
- package/es/helpers/index.d.ts +50 -0
- package/es/helpers/index.js +78 -0
- package/es/index.d.ts +3 -0
- package/es/index.js +10 -0
- package/package.json +75 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var apiClient = require('@elice/api-client');
|
|
7
|
+
var materialSharedUtils = require('@elice/material-shared-utils');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
|
+
|
|
13
|
+
const StateContext = React__default["default"].createContext(undefined);
|
|
14
|
+
const DispatchContext = React__default["default"].createContext(undefined);
|
|
15
|
+
StateContext.displayName = 'MaterialQuizStateContext';
|
|
16
|
+
DispatchContext.displayName = 'MaterialQuizDispatchContext';
|
|
17
|
+
|
|
18
|
+
function MaterialQuizProvider({
|
|
19
|
+
materialQuizId,
|
|
20
|
+
userId,
|
|
21
|
+
onSubmit = () => void 0,
|
|
22
|
+
onNext,
|
|
23
|
+
children
|
|
24
|
+
}) {
|
|
25
|
+
const [course, setCourse] = React__default["default"].useState();
|
|
26
|
+
const [lecture, setLecture] = React__default["default"].useState();
|
|
27
|
+
const [materialQuiz, setMaterialQuiz] = React__default["default"].useState();
|
|
28
|
+
const [initStatus, setInitStatus] = React__default["default"].useState('idle');
|
|
29
|
+
const [vertical, setVertical] = React__default["default"].useState(false);
|
|
30
|
+
const canInit = materialSharedUtils.useMaterialConfigApiClientUpdate(apiClient.config.init);
|
|
31
|
+
const init = React__default["default"].useCallback(async () => {
|
|
32
|
+
const controller = new AbortController();
|
|
33
|
+
const {
|
|
34
|
+
signal
|
|
35
|
+
} = controller;
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
setInitStatus('pending'); // fetch materialQuiz
|
|
39
|
+
|
|
40
|
+
const {
|
|
41
|
+
materialQuiz
|
|
42
|
+
} = await apiClient.getOrgMaterialQuizGet({
|
|
43
|
+
materialQuizId
|
|
44
|
+
}, {
|
|
45
|
+
signal
|
|
46
|
+
}); // fetch course
|
|
47
|
+
|
|
48
|
+
const {
|
|
49
|
+
course
|
|
50
|
+
} = await apiClient.getOrgCourseGet({
|
|
51
|
+
courseId: materialQuiz.courseId
|
|
52
|
+
}, {
|
|
53
|
+
signal
|
|
54
|
+
}); // fetch lecture
|
|
55
|
+
|
|
56
|
+
const {
|
|
57
|
+
lecture
|
|
58
|
+
} = await apiClient.getOrgLectureGet({
|
|
59
|
+
lectureId: materialQuiz.lectureId
|
|
60
|
+
}, {
|
|
61
|
+
signal
|
|
62
|
+
});
|
|
63
|
+
setMaterialQuiz(materialQuiz);
|
|
64
|
+
setCourse(course);
|
|
65
|
+
setLecture(lecture);
|
|
66
|
+
setInitStatus('resolved');
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error(error);
|
|
69
|
+
setInitStatus('rejected');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return () => controller.abort();
|
|
73
|
+
}, [materialQuizId]);
|
|
74
|
+
React__default["default"].useEffect(() => {
|
|
75
|
+
if (canInit) {
|
|
76
|
+
void init();
|
|
77
|
+
}
|
|
78
|
+
}, [canInit, init]); //
|
|
79
|
+
//
|
|
80
|
+
// materialQuiz refresher
|
|
81
|
+
|
|
82
|
+
const refreshOrgMaterialQuiz = React__default["default"].useCallback(signal => {
|
|
83
|
+
return apiClient.getOrgMaterialQuizGet({
|
|
84
|
+
materialQuizId
|
|
85
|
+
}, {
|
|
86
|
+
signal
|
|
87
|
+
}).then(response => {
|
|
88
|
+
setMaterialQuiz(response.materialQuiz);
|
|
89
|
+
}).catch(error => {
|
|
90
|
+
console.error(error);
|
|
91
|
+
});
|
|
92
|
+
}, [materialQuizId]);
|
|
93
|
+
return React__default["default"].createElement(StateContext.Provider, {
|
|
94
|
+
value: {
|
|
95
|
+
course,
|
|
96
|
+
lecture,
|
|
97
|
+
materialQuiz,
|
|
98
|
+
userId,
|
|
99
|
+
vertical,
|
|
100
|
+
initStatus
|
|
101
|
+
}
|
|
102
|
+
}, React__default["default"].createElement(DispatchContext.Provider, {
|
|
103
|
+
value: {
|
|
104
|
+
onSubmit,
|
|
105
|
+
onNext,
|
|
106
|
+
refreshOrgMaterialQuiz,
|
|
107
|
+
setVertical
|
|
108
|
+
}
|
|
109
|
+
}, children));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function useMaterialQuizState() {
|
|
113
|
+
const context = React__default["default"].useContext(StateContext);
|
|
114
|
+
|
|
115
|
+
if (context === undefined) {
|
|
116
|
+
throw new Error('useMaterialQuizState must be used within a MaterialQuizProvider');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return context;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function useMaterialQuizDispatch() {
|
|
123
|
+
const context = React__default["default"].useContext(DispatchContext);
|
|
124
|
+
|
|
125
|
+
if (context === undefined) {
|
|
126
|
+
throw new Error('useMaterialQuizDispatch must be used within a MaterialQuizProvider');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return context;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
exports.MaterialQuizProvider = MaterialQuizProvider;
|
|
133
|
+
exports.useMaterialQuizDispatch = useMaterialQuizDispatch;
|
|
134
|
+
exports.useMaterialQuizState = useMaterialQuizState;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MarkdownEditorFileUploadReqFn } from '@elice/markdown';
|
|
3
|
+
import type { GetOrgMaterialQuizGetResponses } from '@elice/types';
|
|
4
|
+
import type { FormState } from 'react-hook-form';
|
|
5
|
+
export declare type MaterialQuizEditValue = Pick<GetOrgMaterialQuizGetResponses['materialQuiz'], 'id' | 'questionTitle' | 'questionDescription' | 'optionType' | 'optionInfo' | 'answerInfo' | 'answerHint' | 'isAutoGrade' | 'explanationInfo'>;
|
|
6
|
+
export declare type MaterialQuizEditFormState = Pick<FormState<Record<string, any>>, 'isDirty' | 'isValid'>;
|
|
7
|
+
export interface MaterialQuizEditProps {
|
|
8
|
+
/** Value of material quiz edit form. */
|
|
9
|
+
value: MaterialQuizEditValue;
|
|
10
|
+
/**
|
|
11
|
+
* Is editing disabled?
|
|
12
|
+
* When true, cannot change `optionType`, `optionInfo` and `answerInfo`.
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Locale of edit form. */
|
|
16
|
+
locale: string;
|
|
17
|
+
/** Handle form change event. */
|
|
18
|
+
onChange: (value: MaterialQuizEditValue) => void;
|
|
19
|
+
/** Handle form state changes. (`FormState` from react-hook-form) */
|
|
20
|
+
onFormStateChange?: (state: MaterialQuizEditFormState) => void;
|
|
21
|
+
/** Handle file upload. */
|
|
22
|
+
onFileUploadRequest: MarkdownEditorFileUploadReqFn;
|
|
23
|
+
}
|
|
24
|
+
declare const MaterialQuizEdit: React.ForwardRefExoticComponent<MaterialQuizEditProps & React.RefAttributes<HTMLFormElement>>;
|
|
25
|
+
export default MaterialQuizEdit;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactHookForm = require('react-hook-form');
|
|
5
|
+
var reactIntl = require('react-intl');
|
|
6
|
+
var reactUse = require('react-use');
|
|
7
|
+
var editValue = require('./utils/editValue.js');
|
|
8
|
+
var context = require('./context.js');
|
|
9
|
+
var locales = require('./locales.js');
|
|
10
|
+
var MaterialQuizEditContent = require('./MaterialQuizEditContent.js');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
15
|
+
|
|
16
|
+
const MaterialQuizEdit = React.forwardRef(({
|
|
17
|
+
value,
|
|
18
|
+
disabled = false,
|
|
19
|
+
locale = 'en',
|
|
20
|
+
onChange,
|
|
21
|
+
onFormStateChange,
|
|
22
|
+
onFileUploadRequest
|
|
23
|
+
}, ref) => {
|
|
24
|
+
const formElRef = React__default["default"].useRef(null);
|
|
25
|
+
const useFormMethods = reactHookForm.useForm({
|
|
26
|
+
defaultValues: editValue.manipulateValue(value),
|
|
27
|
+
mode: 'onBlur'
|
|
28
|
+
});
|
|
29
|
+
const watchedMaterialQuizEditValue = useFormMethods.watch();
|
|
30
|
+
const {
|
|
31
|
+
isDirty,
|
|
32
|
+
isValid
|
|
33
|
+
} = useFormMethods.formState; //
|
|
34
|
+
// Reset from value, when `value` changes.
|
|
35
|
+
// TODO: will be removed, since `CourseLecturesMaterialTemplate` removed at `elice-web`.
|
|
36
|
+
//
|
|
37
|
+
|
|
38
|
+
reactUse.useDeepCompareEffect(() => {
|
|
39
|
+
useFormMethods.reset(editValue.manipulateValue(value), {
|
|
40
|
+
keepDirty: true,
|
|
41
|
+
keepErrors: true,
|
|
42
|
+
keepIsValid: true,
|
|
43
|
+
keepTouched: true,
|
|
44
|
+
keepValues: true
|
|
45
|
+
});
|
|
46
|
+
void useFormMethods.trigger();
|
|
47
|
+
}, [value]); //
|
|
48
|
+
// Emit `onChange` handler when form value changed.
|
|
49
|
+
// TODO: will be removed, since `CourseLecturesMaterialTemplate` removed at `elice-web`.
|
|
50
|
+
//
|
|
51
|
+
|
|
52
|
+
reactUse.useDeepCompareEffect(() => onChange(editValue.restoreValue(watchedMaterialQuizEditValue)), [watchedMaterialQuizEditValue]); //
|
|
53
|
+
// Emit `onFormStateChange` handler when form state change.
|
|
54
|
+
//
|
|
55
|
+
|
|
56
|
+
React__default["default"].useEffect(() => {
|
|
57
|
+
if (typeof onFormStateChange === 'function') {
|
|
58
|
+
onFormStateChange({
|
|
59
|
+
isDirty,
|
|
60
|
+
isValid
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
64
|
+
[isDirty, isValid]); //
|
|
65
|
+
// Set ref.
|
|
66
|
+
//
|
|
67
|
+
|
|
68
|
+
React__default["default"].useImperativeHandle(ref, () => Object.assign(Object.assign({}, formElRef.current), {
|
|
69
|
+
reset: () => {
|
|
70
|
+
useFormMethods.reset(editValue.manipulateValue(value));
|
|
71
|
+
void useFormMethods.trigger();
|
|
72
|
+
}
|
|
73
|
+
}), [useFormMethods, value]); //
|
|
74
|
+
//
|
|
75
|
+
//
|
|
76
|
+
|
|
77
|
+
return React__default["default"].createElement("form", {
|
|
78
|
+
ref: formElRef
|
|
79
|
+
}, React__default["default"].createElement(context["default"].Provider, {
|
|
80
|
+
value: {
|
|
81
|
+
disabled,
|
|
82
|
+
onFileUploadRequest
|
|
83
|
+
}
|
|
84
|
+
}, React__default["default"].createElement(reactIntl.IntlProvider, {
|
|
85
|
+
locale: locale,
|
|
86
|
+
defaultLocale: "en",
|
|
87
|
+
messages: locale in locales ? locales[locale] : locales.en
|
|
88
|
+
}, React__default["default"].createElement(reactHookForm.FormProvider, Object.assign({}, useFormMethods), React__default["default"].createElement(MaterialQuizEditContent, null)))));
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
module.exports = MaterialQuizEdit;
|