@elice/material-survey 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.
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +399 -0
- package/cjs/components/markdown-editor/index.d.ts +1 -2
- package/cjs/components/markdown-editor/index.js +19 -10
- package/cjs/components/material-survey/MaterialSurvey.js +82 -57
- package/cjs/components/material-survey/MaterialSurveyInfo.js +69 -59
- package/cjs/components/material-survey/MaterialSurveySelectMultiple.js +131 -90
- package/cjs/components/material-survey/MaterialSurveySelectOne.js +125 -86
- package/cjs/components/material-survey/MaterialSurveyShimmer.js +47 -40
- package/cjs/components/material-survey/MaterialSurveyText.js +114 -75
- package/cjs/components/material-survey/SurveyResultBadge.js +17 -10
- package/cjs/components/material-survey/SurveySubmitStatusText.js +21 -16
- package/cjs/components/material-survey/context/MaterialSurveyContext.d.ts +1 -1
- package/cjs/components/material-survey/context/MaterialSurveyContext.js +115 -74
- package/cjs/components/material-survey/index.js +9 -0
- package/cjs/components/material-survey/locales/index.js +13 -0
- package/cjs/components/material-survey-edit/MaterialSurveyEdit.js +49 -36
- package/cjs/components/material-survey-edit/MaterialSurveyEditContent.js +113 -91
- package/cjs/components/material-survey-edit/MaterialSurveyEditOptionSelect.js +100 -87
- package/cjs/components/material-survey-edit/context.js +8 -2
- package/cjs/components/material-survey-edit/index.js +7 -0
- package/cjs/components/material-survey-edit/locales/index.js +13 -0
- package/cjs/components/material-survey-edit/utils/editValue.js +17 -11
- package/cjs/components/shared/StyledMarkdown.js +5 -1
- package/cjs/components/shared/SurveyContentBox.js +85 -74
- package/cjs/components/shared/index.js +13 -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 +66 -89
- 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 +59 -80
- package/es/_virtual/_rollupPluginBabelHelpers.js +386 -0
- package/es/components/markdown-editor/index.d.ts +1 -2
- package/es/components/markdown-editor/index.js +15 -10
- package/es/components/material-survey/MaterialSurvey.js +77 -57
- package/es/components/material-survey/MaterialSurveyInfo.js +65 -59
- package/es/components/material-survey/MaterialSurveySelectMultiple.js +127 -90
- package/es/components/material-survey/MaterialSurveySelectOne.js +121 -86
- package/es/components/material-survey/MaterialSurveyShimmer.js +43 -40
- package/es/components/material-survey/MaterialSurveyText.js +109 -75
- package/es/components/material-survey/SurveyResultBadge.js +13 -10
- package/es/components/material-survey/SurveySubmitStatusText.js +17 -16
- package/es/components/material-survey/context/MaterialSurveyContext.d.ts +1 -1
- package/es/components/material-survey/context/MaterialSurveyContext.js +112 -75
- package/es/components/material-survey/index.js +2 -0
- package/es/components/material-survey/locales/index.js +4 -0
- package/es/components/material-survey-edit/MaterialSurveyEdit.js +45 -36
- package/es/components/material-survey-edit/MaterialSurveyEditContent.js +107 -90
- package/es/components/material-survey-edit/MaterialSurveyEditOptionSelect.js +96 -87
- package/es/components/material-survey-edit/context.js +4 -2
- package/es/components/material-survey-edit/index.js +1 -0
- package/es/components/material-survey-edit/locales/index.js +4 -0
- package/es/components/material-survey-edit/utils/editValue.js +17 -11
- package/es/components/shared/StyledMarkdown.js +1 -1
- package/es/components/shared/SurveyContentBox.js +81 -74
- package/es/components/shared/index.js +4 -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 +61 -89
- 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 +54 -80
- package/package.json +9 -12
|
@@ -2,24 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var blocks = require('@elice/blocks');
|
|
7
8
|
var intl = require('@elice/intl');
|
|
8
9
|
var index = require('../../helpers/index.js');
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
14
|
+
|
|
15
|
+
var SurveyResultBadge = function SurveyResultBadge(_ref) {
|
|
16
|
+
var materialSurveyResponse = _ref.materialSurveyResponse;
|
|
17
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
18
|
+
var status = React__default.default.useMemo(function () {
|
|
19
|
+
return index.getSurveyResultStatus(materialSurveyResponse);
|
|
20
|
+
}, [materialSurveyResponse]);
|
|
15
21
|
switch (status) {
|
|
16
22
|
case index.SurveyResultStatus.Submitted:
|
|
17
|
-
return
|
|
23
|
+
return jsxRuntime.jsx(blocks.BadgeNext, {
|
|
18
24
|
type: "quiet",
|
|
19
|
-
role: "primary"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
role: "primary",
|
|
26
|
+
children: intl$1.formatMessage({
|
|
27
|
+
id: 'materialSurvey.resultStatus.submitted'
|
|
28
|
+
})
|
|
29
|
+
});
|
|
23
30
|
default:
|
|
24
31
|
return null;
|
|
25
32
|
}
|
|
@@ -2,34 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var blocks = require('@elice/blocks');
|
|
7
7
|
var intl = require('@elice/intl');
|
|
8
8
|
var muiSystem = require('@elice/mui-system');
|
|
9
9
|
var styled = require('styled-components');
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
14
|
+
|
|
15
|
+
var StyledSuccessStatusText = styled__default.default(blocks.StatusText).withConfig({
|
|
12
16
|
componentId: "sc-szxa5m-0"
|
|
13
17
|
})(["color:", ";"], muiSystem.colors.green[400]);
|
|
14
|
-
|
|
15
|
-
status
|
|
16
|
-
|
|
17
|
-
const intl$1 = intl.useRawEliceIntl();
|
|
18
|
+
var SurveySubmitStatusText = function SurveySubmitStatusText(_ref) {
|
|
19
|
+
var status = _ref.status;
|
|
20
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
18
21
|
switch (status) {
|
|
19
22
|
case 'resolved':
|
|
20
|
-
return
|
|
23
|
+
return jsxRuntime.jsx(StyledSuccessStatusText, {
|
|
21
24
|
role: "success",
|
|
22
|
-
size: "small"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
size: "small",
|
|
26
|
+
children: intl$1.formatMessage({
|
|
27
|
+
id: 'materialSurvey.submitStatus.success'
|
|
28
|
+
})
|
|
29
|
+
});
|
|
26
30
|
case 'rejected':
|
|
27
|
-
return
|
|
31
|
+
return jsxRuntime.jsx(blocks.StatusText, {
|
|
28
32
|
role: "danger",
|
|
29
|
-
size: "small"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
size: "small",
|
|
34
|
+
children: intl$1.formatMessage({
|
|
35
|
+
id: 'materialSurvey.submitStatus.failure'
|
|
36
|
+
})
|
|
37
|
+
});
|
|
33
38
|
default:
|
|
34
39
|
return null;
|
|
35
40
|
}
|
|
@@ -25,7 +25,7 @@ interface DispatchContextType {
|
|
|
25
25
|
setVertical: React.Dispatch<React.SetStateAction<boolean>>;
|
|
26
26
|
onNext?: () => void;
|
|
27
27
|
}
|
|
28
|
-
declare function MaterialSurveyProvider({ materialSurveyId, userId, onSubmit, onNext, children, }: MaterialSurveyProviderProps):
|
|
28
|
+
declare function MaterialSurveyProvider({ materialSurveyId, userId, onSubmit, onNext, children, }: MaterialSurveyProviderProps): JSX.Element;
|
|
29
29
|
declare function useMaterialSurveyState(): State;
|
|
30
30
|
declare function useMaterialSurveyDispatch(): DispatchContextType;
|
|
31
31
|
export { MaterialSurveyProvider, useMaterialSurveyState, useMaterialSurveyDispatch, };
|
|
@@ -1,102 +1,143 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
3
5
|
var React = require('react');
|
|
4
6
|
var apiClient = require('@elice/api-client');
|
|
5
7
|
var materialSharedUtils = require('@elice/material-shared-utils');
|
|
6
8
|
var types = require('@elice/types');
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
13
|
+
|
|
14
|
+
var StateContext = React__default.default.createContext(undefined);
|
|
15
|
+
var DispatchContext = React__default.default.createContext(undefined);
|
|
10
16
|
StateContext.displayName = 'MaterialSurveyStateContext';
|
|
11
17
|
DispatchContext.displayName = 'MaterialSurveyDispatchContext';
|
|
12
|
-
function MaterialSurveyProvider({
|
|
13
|
-
materialSurveyId,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
throw new Error('materialSurvey is not ready');
|
|
42
|
-
}
|
|
43
|
-
// fetch course
|
|
44
|
-
const {
|
|
45
|
-
course
|
|
46
|
-
} = await apiClient.getOrgCourseGet({
|
|
47
|
-
courseId: materialLecturePage.courseId
|
|
48
|
-
}, {
|
|
49
|
-
signal
|
|
50
|
-
});
|
|
51
|
-
// fetch lecture
|
|
52
|
-
const {
|
|
53
|
-
lecture
|
|
54
|
-
} = await apiClient.getOrgLectureGet({
|
|
55
|
-
lectureId: materialLecturePage.lectureId
|
|
18
|
+
function MaterialSurveyProvider(_ref) {
|
|
19
|
+
var materialSurveyId = _ref.materialSurveyId,
|
|
20
|
+
userId = _ref.userId,
|
|
21
|
+
_ref$onSubmit = _ref.onSubmit,
|
|
22
|
+
onSubmit = _ref$onSubmit === void 0 ? function () {
|
|
23
|
+
return void 0;
|
|
24
|
+
} : _ref$onSubmit,
|
|
25
|
+
onNext = _ref.onNext,
|
|
26
|
+
children = _ref.children;
|
|
27
|
+
var _React$useState = React__default.default.useState(),
|
|
28
|
+
_React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
|
|
29
|
+
course = _React$useState2[0],
|
|
30
|
+
setCourse = _React$useState2[1];
|
|
31
|
+
var _React$useState3 = React__default.default.useState(),
|
|
32
|
+
_React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
|
|
33
|
+
lecture = _React$useState4[0],
|
|
34
|
+
setLecture = _React$useState4[1];
|
|
35
|
+
var _React$useState5 = React__default.default.useState('idle'),
|
|
36
|
+
_React$useState6 = _rollupPluginBabelHelpers.slicedToArray(_React$useState5, 2),
|
|
37
|
+
initStatus = _React$useState6[0],
|
|
38
|
+
setInitStatus = _React$useState6[1];
|
|
39
|
+
var _React$useState7 = React__default.default.useState(false),
|
|
40
|
+
_React$useState8 = _rollupPluginBabelHelpers.slicedToArray(_React$useState7, 2),
|
|
41
|
+
vertical = _React$useState8[0],
|
|
42
|
+
setVertical = _React$useState8[1];
|
|
43
|
+
var canInit = materialSharedUtils.useMaterialConfigApiClientUpdate(apiClient.config.init);
|
|
44
|
+
var _useMaterialFetchRaw = materialSharedUtils.useMaterialFetchRaw(types.enums.LectureMaterialType.Survey, React__default.default.useCallback(function (signal) {
|
|
45
|
+
return apiClient.getOrgMaterialSurveyGet({
|
|
46
|
+
materialSurveyId: materialSurveyId
|
|
56
47
|
}, {
|
|
57
|
-
signal
|
|
48
|
+
signal: signal
|
|
58
49
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
}, [materialSurveyId]), canInit),
|
|
51
|
+
materialSurvey = _useMaterialFetchRaw.materialSurvey,
|
|
52
|
+
materialLecturePage = _useMaterialFetchRaw.materialLecturePage,
|
|
53
|
+
refreshOrgMaterialSurvey = _useMaterialFetchRaw.refetch;
|
|
54
|
+
var doInitilize = React__default.default.useCallback( /*#__PURE__*/_rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
|
|
55
|
+
var controller, signal, _yield$getOrgCourseGe, _course, _yield$getOrgLectureG, _lecture;
|
|
56
|
+
return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
|
|
57
|
+
while (1) switch (_context.prev = _context.next) {
|
|
58
|
+
case 0:
|
|
59
|
+
controller = new AbortController();
|
|
60
|
+
signal = controller.signal;
|
|
61
|
+
_context.prev = 2;
|
|
62
|
+
setInitStatus('pending');
|
|
63
|
+
if (materialLecturePage) {
|
|
64
|
+
_context.next = 6;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
throw new Error('materialSurvey is not ready');
|
|
68
|
+
case 6:
|
|
69
|
+
_context.next = 8;
|
|
70
|
+
return apiClient.getOrgCourseGet({
|
|
71
|
+
courseId: materialLecturePage.courseId
|
|
72
|
+
}, {
|
|
73
|
+
signal: signal
|
|
74
|
+
});
|
|
75
|
+
case 8:
|
|
76
|
+
_yield$getOrgCourseGe = _context.sent;
|
|
77
|
+
_course = _yield$getOrgCourseGe.course;
|
|
78
|
+
_context.next = 12;
|
|
79
|
+
return apiClient.getOrgLectureGet({
|
|
80
|
+
lectureId: materialLecturePage.lectureId
|
|
81
|
+
}, {
|
|
82
|
+
signal: signal
|
|
83
|
+
});
|
|
84
|
+
case 12:
|
|
85
|
+
_yield$getOrgLectureG = _context.sent;
|
|
86
|
+
_lecture = _yield$getOrgLectureG.lecture;
|
|
87
|
+
setCourse(_course);
|
|
88
|
+
setLecture(_lecture);
|
|
89
|
+
setInitStatus('resolved');
|
|
90
|
+
_context.next = 23;
|
|
91
|
+
break;
|
|
92
|
+
case 19:
|
|
93
|
+
_context.prev = 19;
|
|
94
|
+
_context.t0 = _context["catch"](2);
|
|
95
|
+
console.error(_context.t0);
|
|
96
|
+
setInitStatus('rejected');
|
|
97
|
+
case 23:
|
|
98
|
+
return _context.abrupt("return", function () {
|
|
99
|
+
return controller.abort();
|
|
100
|
+
});
|
|
101
|
+
case 24:
|
|
102
|
+
case "end":
|
|
103
|
+
return _context.stop();
|
|
104
|
+
}
|
|
105
|
+
}, _callee, null, [[2, 19]]);
|
|
106
|
+
})), [materialLecturePage]);
|
|
107
|
+
React__default.default.useEffect(function () {
|
|
69
108
|
if (canInit && materialLecturePage) {
|
|
70
109
|
void doInitilize();
|
|
71
110
|
}
|
|
72
111
|
}, [canInit, materialLecturePage, doInitilize]);
|
|
73
|
-
return
|
|
112
|
+
return jsxRuntime.jsx(StateContext.Provider, {
|
|
74
113
|
value: {
|
|
75
|
-
course,
|
|
76
|
-
lecture,
|
|
114
|
+
course: course,
|
|
115
|
+
lecture: lecture,
|
|
77
116
|
materialSurvey: materialSurvey !== null && materialSurvey !== void 0 ? materialSurvey : undefined,
|
|
78
|
-
userId,
|
|
79
|
-
vertical,
|
|
80
|
-
initStatus
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
117
|
+
userId: userId,
|
|
118
|
+
vertical: vertical,
|
|
119
|
+
initStatus: initStatus
|
|
120
|
+
},
|
|
121
|
+
children: jsxRuntime.jsx(DispatchContext.Provider, {
|
|
122
|
+
value: {
|
|
123
|
+
onSubmit: onSubmit,
|
|
124
|
+
onNext: onNext,
|
|
125
|
+
refreshOrgMaterialSurvey: refreshOrgMaterialSurvey,
|
|
126
|
+
setVertical: setVertical
|
|
127
|
+
},
|
|
128
|
+
children: children
|
|
129
|
+
})
|
|
130
|
+
});
|
|
90
131
|
}
|
|
91
132
|
function useMaterialSurveyState() {
|
|
92
|
-
|
|
133
|
+
var context = React__default.default.useContext(StateContext);
|
|
93
134
|
if (context === undefined) {
|
|
94
135
|
throw new Error('useMaterialSurveyState must be used within a MaterialSurveyProvider');
|
|
95
136
|
}
|
|
96
137
|
return context;
|
|
97
138
|
}
|
|
98
139
|
function useMaterialSurveyDispatch() {
|
|
99
|
-
|
|
140
|
+
var context = React__default.default.useContext(DispatchContext);
|
|
100
141
|
if (context === undefined) {
|
|
101
142
|
throw new Error('useMaterialSurveyDispatch must be used within a MaterialSurveyProvider');
|
|
102
143
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var en = require('./en.json.js');
|
|
4
|
+
var ko = require('./ko.json.js');
|
|
5
|
+
var th = require('./th.json.js');
|
|
6
|
+
var ja = require('./ja.json.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.messageEn = en.default;
|
|
11
|
+
exports.messageKo = ko.default;
|
|
12
|
+
exports.messageTh = th.default;
|
|
13
|
+
exports.messageJa = ja.default;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var reactHookForm = require('react-hook-form');
|
|
7
8
|
var intl = require('@elice/intl');
|
|
@@ -12,32 +13,35 @@ var en = require('./locales/en.json.js');
|
|
|
12
13
|
var ko = require('./locales/ko.json.js');
|
|
13
14
|
var MaterialSurveyEditContent = require('./MaterialSurveyEditContent.js');
|
|
14
15
|
|
|
16
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
17
|
+
|
|
18
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
19
|
+
|
|
15
20
|
//
|
|
16
21
|
//
|
|
17
22
|
//
|
|
18
|
-
|
|
19
|
-
value,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
var MaterialSurveyEdit = React.forwardRef(function (_ref, ref) {
|
|
24
|
+
var value = _ref.value,
|
|
25
|
+
_ref$disabled = _ref.disabled,
|
|
26
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
27
|
+
onChange = _ref.onChange,
|
|
28
|
+
onFormStateChange = _ref.onFormStateChange,
|
|
29
|
+
onFileUploadRequest = _ref.onFileUploadRequest,
|
|
30
|
+
__intl = _ref.__intl;
|
|
31
|
+
var formElRef = React__default.default.useRef(null);
|
|
32
|
+
var useFormMethods = reactHookForm.useForm({
|
|
28
33
|
defaultValues: editValue.manipulateValue(value),
|
|
29
34
|
mode: 'onBlur'
|
|
30
35
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
isDirty,
|
|
34
|
-
isValid
|
|
35
|
-
} = useFormMethods.formState;
|
|
36
|
+
var watchedMaterialSurveyEditValue = useFormMethods.watch();
|
|
37
|
+
var _useFormMethods$formS = useFormMethods.formState,
|
|
38
|
+
isDirty = _useFormMethods$formS.isDirty,
|
|
39
|
+
isValid = _useFormMethods$formS.isValid;
|
|
36
40
|
//
|
|
37
41
|
// Reset from value, when `value` changes.
|
|
38
42
|
// TODO: will be removed, since `CourseLecturesMaterialTemplate` removed at `elice-web`.
|
|
39
43
|
//
|
|
40
|
-
materialSharedUtils.useDeepClonedCompareEffect(()
|
|
44
|
+
materialSharedUtils.useDeepClonedCompareEffect(function () {
|
|
41
45
|
useFormMethods.reset(editValue.manipulateValue(value), {
|
|
42
46
|
keepDirty: true,
|
|
43
47
|
keepErrors: true,
|
|
@@ -51,15 +55,17 @@ const MaterialSurveyEdit = React.forwardRef(({
|
|
|
51
55
|
// Emit `onChange` handler when form value changed.
|
|
52
56
|
// TODO: will be removed, since `CourseLecturesMaterialTemplate` removed at `elice-web`.
|
|
53
57
|
//
|
|
54
|
-
materialSharedUtils.useDeepClonedCompareEffect(
|
|
58
|
+
materialSharedUtils.useDeepClonedCompareEffect(function () {
|
|
59
|
+
return onChange(editValue.restoreValue(watchedMaterialSurveyEditValue));
|
|
60
|
+
}, [watchedMaterialSurveyEditValue]);
|
|
55
61
|
//
|
|
56
62
|
// Emit `onFormStateChange` handler when form state change.
|
|
57
63
|
//
|
|
58
|
-
|
|
64
|
+
React__default.default.useEffect(function () {
|
|
59
65
|
if (typeof onFormStateChange === 'function') {
|
|
60
66
|
onFormStateChange({
|
|
61
|
-
isDirty,
|
|
62
|
-
isValid
|
|
67
|
+
isDirty: isDirty,
|
|
68
|
+
isValid: isValid
|
|
63
69
|
});
|
|
64
70
|
}
|
|
65
71
|
},
|
|
@@ -68,25 +74,32 @@ const MaterialSurveyEdit = React.forwardRef(({
|
|
|
68
74
|
//
|
|
69
75
|
// Set ref.
|
|
70
76
|
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
React__default.default.useImperativeHandle(ref, function () {
|
|
78
|
+
return Object.assign(Object.assign({}, formElRef.current), {
|
|
79
|
+
reset: function reset() {
|
|
80
|
+
useFormMethods.reset(editValue.manipulateValue(value));
|
|
81
|
+
void useFormMethods.trigger();
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}, [useFormMethods, value]);
|
|
77
85
|
//
|
|
78
86
|
//
|
|
79
87
|
//
|
|
80
|
-
return
|
|
81
|
-
value: __intl
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
return jsxRuntime.jsx(intl.RawEliceIntlProvider, {
|
|
89
|
+
value: __intl,
|
|
90
|
+
children: jsxRuntime.jsx("form", {
|
|
91
|
+
ref: formElRef,
|
|
92
|
+
children: jsxRuntime.jsx(context.default.Provider, {
|
|
93
|
+
value: {
|
|
94
|
+
disabled: disabled,
|
|
95
|
+
onFileUploadRequest: onFileUploadRequest
|
|
96
|
+
},
|
|
97
|
+
children: jsxRuntime.jsx(reactHookForm.FormProvider, Object.assign({}, useFormMethods, {
|
|
98
|
+
children: jsxRuntime.jsx(MaterialSurveyEditContent.default, {})
|
|
99
|
+
}))
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
});
|
|
90
103
|
});
|
|
91
104
|
var MaterialSurveyEdit$1 = new intl.IntlComponentBuilder(MaterialSurveyEdit).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();
|
|
92
105
|
|