@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,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 reactSortableHoc = require('react-sortable-hoc');
|
|
@@ -15,50 +16,52 @@ var context = require('../context.js');
|
|
|
15
16
|
var randomId = require('../utils/randomId.js');
|
|
16
17
|
var OptionEditor = require('./OptionEditor.js');
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
20
|
+
|
|
21
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
22
|
+
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
23
|
+
|
|
24
|
+
var MIN_OPTION_INFO_COUNT = 2;
|
|
25
|
+
var MAX_OPTION_INFO_COUNT = 20;
|
|
26
|
+
var StyledWrap = styled__default.default.div.withConfig({
|
|
21
27
|
componentId: "sc-vizer2-0"
|
|
22
28
|
})(["& > ul{display:flex;flex-direction:column;gap:0.75rem;}"]);
|
|
23
|
-
|
|
29
|
+
var StyledInputGroup = styled__default.default(blocks.SortableListGroup).withConfig({
|
|
24
30
|
componentId: "sc-vizer2-1"
|
|
25
31
|
})(["width:100%;.em-option-editor{margin-bottom:0.5rem;&:last-of-type{margin-bottom:0;}}"]);
|
|
26
|
-
|
|
32
|
+
var StyledInputPrefixRadioOption = styled__default.default(blocks.RadioOption).withConfig({
|
|
27
33
|
componentId: "sc-vizer2-2"
|
|
28
34
|
})([".eb-radio-option__label{display:none;}"]);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
disabled
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
const watchedAnswerInfo = reactHookForm.useWatch({
|
|
50
|
-
control,
|
|
35
|
+
var OptionSelectOne = function OptionSelectOne() {
|
|
36
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
37
|
+
var _useMaterialQuizEditC = context.useMaterialQuizEditContext(),
|
|
38
|
+
disabled = _useMaterialQuizEditC.disabled;
|
|
39
|
+
var _useFormContext = reactHookForm.useFormContext(),
|
|
40
|
+
control = _useFormContext.control,
|
|
41
|
+
getValues = _useFormContext.getValues,
|
|
42
|
+
setValue = _useFormContext.setValue;
|
|
43
|
+
var _useFieldArray = reactHookForm.useFieldArray({
|
|
44
|
+
name: 'optionsDefault',
|
|
45
|
+
keyName: 'id',
|
|
46
|
+
shouldUnregister: true
|
|
47
|
+
}),
|
|
48
|
+
optionInfoFields = _useFieldArray.fields,
|
|
49
|
+
appendOptionInfoFieldItem = _useFieldArray.append,
|
|
50
|
+
removeOptionInfoFieldItem = _useFieldArray.remove,
|
|
51
|
+
moveOptionInfoFieldItem = _useFieldArray.move;
|
|
52
|
+
var watchedAnswerInfo = reactHookForm.useWatch({
|
|
53
|
+
control: control,
|
|
51
54
|
name: 'answerInfoDefault'
|
|
52
55
|
});
|
|
53
|
-
|
|
54
|
-
control,
|
|
56
|
+
var watchedOptions = reactHookForm.useWatch({
|
|
57
|
+
control: control,
|
|
55
58
|
name: 'optionsDefault'
|
|
56
59
|
});
|
|
57
60
|
/**
|
|
58
61
|
* Update answer info.
|
|
59
62
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
var updateAnswerInfo = function updateAnswerInfo(index) {
|
|
64
|
+
var prevAnswerInfo = getValues('answerInfoDefault');
|
|
62
65
|
if (!Array.isArray(prevAnswerInfo)) {
|
|
63
66
|
return;
|
|
64
67
|
}
|
|
@@ -70,7 +73,7 @@ const OptionSelectOne = () => {
|
|
|
70
73
|
/**
|
|
71
74
|
* Append option info.
|
|
72
75
|
*/
|
|
73
|
-
|
|
76
|
+
var appendOptionInfo = function appendOptionInfo() {
|
|
74
77
|
appendOptionInfoFieldItem({
|
|
75
78
|
id: randomId.createRandomId(),
|
|
76
79
|
title: '',
|
|
@@ -80,10 +83,10 @@ const OptionSelectOne = () => {
|
|
|
80
83
|
/**
|
|
81
84
|
* Remove item from option info at index.
|
|
82
85
|
*/
|
|
83
|
-
|
|
86
|
+
var removeOptionInfo = function removeOptionInfo(index) {
|
|
84
87
|
// set answer info to 0 index,
|
|
85
88
|
// if this option is selected as answer.
|
|
86
|
-
|
|
89
|
+
var curAnswerInfo = getValues('answerInfoDefault');
|
|
87
90
|
if (Array.isArray(curAnswerInfo) && curAnswerInfo.includes(index)) {
|
|
88
91
|
updateAnswerInfo(0);
|
|
89
92
|
}
|
|
@@ -92,16 +95,19 @@ const OptionSelectOne = () => {
|
|
|
92
95
|
/**
|
|
93
96
|
* Sort options based on the old and new index.
|
|
94
97
|
*/
|
|
95
|
-
|
|
96
|
-
oldIndex,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
var handleSortEnd = function handleSortEnd(_ref) {
|
|
99
|
+
var oldIndex = _ref.oldIndex,
|
|
100
|
+
newIndex = _ref.newIndex;
|
|
101
|
+
var prevAnswerInfo = lodashEs.cloneDeep(watchedAnswerInfo);
|
|
102
|
+
var prevOptions = lodashEs.cloneDeep(watchedOptions).map(function (option, index) {
|
|
103
|
+
return Object.assign(Object.assign({}, option), {
|
|
104
|
+
isAnswer: prevAnswerInfo.includes(index)
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
var updatedOptions = reactSortableHoc.arrayMove(prevOptions, oldIndex, newIndex);
|
|
108
|
+
var updatedAnswer = updatedOptions.findIndex(function (option) {
|
|
109
|
+
return option.isAnswer;
|
|
110
|
+
});
|
|
105
111
|
setValue('answerInfoDefault', [updatedAnswer]);
|
|
106
112
|
moveOptionInfoFieldItem(oldIndex, newIndex);
|
|
107
113
|
};
|
|
@@ -111,109 +117,123 @@ const OptionSelectOne = () => {
|
|
|
111
117
|
if (!Array.isArray(watchedAnswerInfo)) {
|
|
112
118
|
return null;
|
|
113
119
|
}
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
return jsxRuntime.jsxs(StyledWrap, {
|
|
121
|
+
children: [jsxRuntime.jsx(reactHookForm.Controller, {
|
|
122
|
+
name: "answerInfoDefault",
|
|
123
|
+
control: control,
|
|
124
|
+
rules: {
|
|
125
|
+
validate: function validate(v) {
|
|
126
|
+
if (Array.isArray(v) && v.length < 1) {
|
|
127
|
+
return intl$1.formatMessage({
|
|
128
|
+
id: 'content.option.errorMessage.required'
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return true;
|
|
123
132
|
}
|
|
124
|
-
|
|
133
|
+
},
|
|
134
|
+
render: function render(_ref2) {
|
|
135
|
+
var fieldState = _ref2.fieldState;
|
|
136
|
+
var _a;
|
|
137
|
+
return jsxRuntime.jsx(reactTransitionGroup.Transition, {
|
|
138
|
+
in: fieldState.invalid,
|
|
139
|
+
timeout: 0,
|
|
140
|
+
mountOnEnter: true,
|
|
141
|
+
unmountOnExit: true,
|
|
142
|
+
children: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
143
|
+
children: [jsxRuntime.jsx(blocks.StatusText, {
|
|
144
|
+
children: (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message,
|
|
145
|
+
role: "danger"
|
|
146
|
+
}), jsxRuntime.jsx(blocks.Vspace, {
|
|
147
|
+
height: 0.5
|
|
148
|
+
})]
|
|
149
|
+
})
|
|
150
|
+
});
|
|
125
151
|
}
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
152
|
+
}), jsxRuntime.jsx(StyledInputGroup, {
|
|
153
|
+
useDragHandle: true,
|
|
154
|
+
pressDelay: 100,
|
|
155
|
+
onSortEnd: handleSortEnd,
|
|
156
|
+
children: optionInfoFields.map(function (_ref3, index) {
|
|
157
|
+
var id = _ref3.id;
|
|
158
|
+
return jsxRuntime.jsx(reactHookForm.Controller, {
|
|
159
|
+
control: control,
|
|
160
|
+
name: "optionsDefault.".concat(index, ".content"),
|
|
161
|
+
rules: {
|
|
162
|
+
required: {
|
|
163
|
+
value: true,
|
|
164
|
+
message: intl$1.formatMessage({
|
|
165
|
+
id: 'option.common.select.errorMessage.required'
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
render: function render(_ref4) {
|
|
170
|
+
var field = _ref4.field,
|
|
171
|
+
fieldState = _ref4.fieldState;
|
|
172
|
+
var _a;
|
|
173
|
+
return jsxRuntime.jsx(OptionEditor.default, Object.assign({
|
|
174
|
+
index: index,
|
|
175
|
+
invalid: fieldState.invalid,
|
|
176
|
+
invalidText: (_a = fieldState === null || fieldState === void 0 ? void 0 : fieldState.error) === null || _a === void 0 ? void 0 : _a.message,
|
|
177
|
+
placeholder: intl$1.formatMessage({
|
|
178
|
+
id: 'option.common.select.placeholder'
|
|
179
|
+
}),
|
|
180
|
+
readOnly: disabled,
|
|
181
|
+
prefix: jsxRuntime.jsxs(blocks.Radio, {
|
|
182
|
+
value: watchedAnswerInfo[0],
|
|
183
|
+
disabled: disabled,
|
|
184
|
+
onChange: updateAnswerInfo,
|
|
185
|
+
children: [jsxRuntime.jsx(StyledInputPrefixRadioOption, {
|
|
186
|
+
value: index
|
|
187
|
+
}), jsxRuntime.jsx(React__default.default.Fragment, {})]
|
|
188
|
+
}),
|
|
189
|
+
suffix: jsxRuntime.jsx(blocks.Tooltip, {
|
|
190
|
+
title: optionInfoFields.length <= MIN_OPTION_INFO_COUNT ? intl$1.formatMessage({
|
|
191
|
+
id: 'option.common.select.tooltip.minOptionInfoItem'
|
|
192
|
+
}) : undefined,
|
|
193
|
+
placement: "top-start",
|
|
194
|
+
children: jsxRuntime.jsx("span", {
|
|
195
|
+
children: jsxRuntime.jsx(blocks.IconButton, {
|
|
196
|
+
icon: icons.eilMathsignMultiplyBasic,
|
|
197
|
+
size: "tiny",
|
|
198
|
+
role: "grey9",
|
|
199
|
+
border: false,
|
|
200
|
+
transparent: true,
|
|
201
|
+
disabled: optionInfoFields.length <= MIN_OPTION_INFO_COUNT || disabled,
|
|
202
|
+
onClick: function onClick() {
|
|
203
|
+
return removeOptionInfo(index);
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
})
|
|
208
|
+
}, field));
|
|
209
|
+
}
|
|
210
|
+
}, id);
|
|
211
|
+
})
|
|
212
|
+
}), jsxRuntime.jsx(blocks.Vspace, {
|
|
213
|
+
height: 0.5
|
|
214
|
+
}), jsxRuntime.jsx(blocks.Tooltip, {
|
|
215
|
+
title: optionInfoFields.length >= MAX_OPTION_INFO_COUNT ? intl$1.formatMessage({
|
|
216
|
+
id: 'option.common.select.tooltip.maxOptionInfoItem'
|
|
217
|
+
}) : undefined,
|
|
218
|
+
placement: "bottom",
|
|
219
|
+
children: jsxRuntime.jsx("span", {
|
|
220
|
+
children: jsxRuntime.jsx(blocks.Button, {
|
|
221
|
+
block: true,
|
|
222
|
+
size: "micro",
|
|
223
|
+
borderDashed: true,
|
|
191
224
|
transparent: true,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
}, React.createElement("span", null, React.createElement(blocks.Button, {
|
|
205
|
-
block: true,
|
|
206
|
-
size: "micro",
|
|
207
|
-
borderDashed: true,
|
|
208
|
-
transparent: true,
|
|
209
|
-
icon: React.createElement(blocks.Icon, {
|
|
210
|
-
icon: icons.eilMathsignAddCircle
|
|
211
|
-
}),
|
|
212
|
-
disabled: optionInfoFields.length >= MAX_OPTION_INFO_COUNT || disabled,
|
|
213
|
-
onClick: appendOptionInfo
|
|
214
|
-
}, intl$1.formatMessage({
|
|
215
|
-
id: 'option.common.select.addButton'
|
|
216
|
-
})))));
|
|
225
|
+
icon: jsxRuntime.jsx(blocks.Icon, {
|
|
226
|
+
icon: icons.eilMathsignAddCircle
|
|
227
|
+
}),
|
|
228
|
+
disabled: optionInfoFields.length >= MAX_OPTION_INFO_COUNT || disabled,
|
|
229
|
+
onClick: appendOptionInfo,
|
|
230
|
+
children: intl$1.formatMessage({
|
|
231
|
+
id: 'option.common.select.addButton'
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
})
|
|
235
|
+
})]
|
|
236
|
+
});
|
|
217
237
|
};
|
|
218
238
|
|
|
219
239
|
exports.default = OptionSelectOne;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _styled = require('@emotion/styled/base');
|
|
6
|
-
var
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var reactHookForm = require('react-hook-form');
|
|
8
8
|
var blocks = require('@elice/blocks');
|
|
9
9
|
var designTokens = require('@elice/design-tokens');
|
|
@@ -11,104 +11,112 @@ var intl = require('@elice/intl');
|
|
|
11
11
|
var react = require('@emotion/react');
|
|
12
12
|
var context = require('../context.js');
|
|
13
13
|
|
|
14
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
|
+
|
|
16
|
+
var _styled__default = /*#__PURE__*/_interopDefaultCompat(_styled);
|
|
17
|
+
|
|
14
18
|
//
|
|
15
19
|
//
|
|
16
20
|
//
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
var MIN_TEXT_LENGTH = 1;
|
|
22
|
+
var MAX_TEXT_LENGTH = 128;
|
|
19
23
|
//
|
|
20
24
|
//
|
|
21
25
|
//
|
|
22
|
-
|
|
26
|
+
var StyledInput = /*#__PURE__*/_styled__default.default(blocks.Input, {
|
|
23
27
|
target: "edimfaf0"
|
|
24
|
-
})("&>:first-child{", ({
|
|
25
|
-
disabled
|
|
26
|
-
|
|
28
|
+
})("&>:first-child{", function (_ref) {
|
|
29
|
+
var disabled = _ref.disabled;
|
|
30
|
+
return disabled && /*#__PURE__*/react.css("background-color:", designTokens.base.color.gray2, ";");
|
|
31
|
+
}, ";}");
|
|
27
32
|
//
|
|
28
33
|
//
|
|
29
34
|
//
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
disabled
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const watchedIsAutoGrade = reactHookForm.useWatch({
|
|
39
|
-
control,
|
|
35
|
+
var OptionText = function OptionText() {
|
|
36
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
37
|
+
var _useMaterialQuizEditC = context.useMaterialQuizEditContext(),
|
|
38
|
+
disabled = _useMaterialQuizEditC.disabled;
|
|
39
|
+
var _useFormContext = reactHookForm.useFormContext(),
|
|
40
|
+
control = _useFormContext.control;
|
|
41
|
+
var watchedIsAutoGrade = reactHookForm.useWatch({
|
|
42
|
+
control: control,
|
|
40
43
|
name: 'isAutoGrade'
|
|
41
44
|
});
|
|
42
45
|
//
|
|
43
46
|
//
|
|
44
47
|
//
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
49
|
+
children: [jsxRuntime.jsx(reactHookForm.Controller, {
|
|
50
|
+
control: control,
|
|
51
|
+
name: "answerInfoDefault",
|
|
52
|
+
rules: {
|
|
53
|
+
required: {
|
|
54
|
+
value: watchedIsAutoGrade,
|
|
55
|
+
message: intl$1.formatMessage({
|
|
56
|
+
id: 'option.text.answerInfo.errorMessage.required'
|
|
57
|
+
})
|
|
58
|
+
},
|
|
59
|
+
minLength: {
|
|
60
|
+
value: MIN_TEXT_LENGTH,
|
|
61
|
+
message: intl$1.formatMessage({
|
|
62
|
+
id: 'common.errorMessage.range'
|
|
63
|
+
}, {
|
|
64
|
+
min: MIN_TEXT_LENGTH,
|
|
65
|
+
max: MAX_TEXT_LENGTH
|
|
66
|
+
})
|
|
67
|
+
},
|
|
68
|
+
maxLength: {
|
|
69
|
+
value: MAX_TEXT_LENGTH,
|
|
70
|
+
message: intl$1.formatMessage({
|
|
71
|
+
id: 'common.errorMessage.range'
|
|
72
|
+
}, {
|
|
73
|
+
min: MIN_TEXT_LENGTH,
|
|
74
|
+
max: MAX_TEXT_LENGTH
|
|
75
|
+
})
|
|
76
|
+
}
|
|
54
77
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
78
|
+
render: function render(_ref2) {
|
|
79
|
+
var field = _ref2.field,
|
|
80
|
+
fieldState = _ref2.fieldState;
|
|
81
|
+
var _a;
|
|
82
|
+
return jsxRuntime.jsx(StyledInput, Object.assign({
|
|
83
|
+
size: "small",
|
|
84
|
+
width: "full",
|
|
85
|
+
minLength: MIN_TEXT_LENGTH,
|
|
86
|
+
maxLength: MAX_TEXT_LENGTH,
|
|
87
|
+
readOnly: disabled,
|
|
88
|
+
disabled: !watchedIsAutoGrade,
|
|
89
|
+
invalid: fieldState.invalid,
|
|
90
|
+
invalidText: (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message,
|
|
91
|
+
helpText: intl$1.formatMessage({
|
|
92
|
+
id: 'option.text.answerInfo.hintText'
|
|
93
|
+
})
|
|
94
|
+
}, field, {
|
|
95
|
+
value: field.value
|
|
96
|
+
}));
|
|
72
97
|
}
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}), React.createElement(blocks.Vspace, {
|
|
96
|
-
height: 0.5
|
|
97
|
-
}), React.createElement(reactHookForm.Controller, {
|
|
98
|
-
control: control,
|
|
99
|
-
name: "isAutoGrade",
|
|
100
|
-
render: ({
|
|
101
|
-
field
|
|
102
|
-
}) => React.createElement(blocks.Checkbox, Object.assign({
|
|
103
|
-
size: "small"
|
|
104
|
-
}, field, {
|
|
105
|
-
value: !field.value,
|
|
106
|
-
checked: !field.value,
|
|
107
|
-
onChange: v => field.onChange(!v)
|
|
108
|
-
}), intl$1.formatMessage({
|
|
109
|
-
id: 'option.text.isAutoGrade.checkbox.label'
|
|
110
|
-
}))
|
|
111
|
-
}));
|
|
98
|
+
}), jsxRuntime.jsx(blocks.Vspace, {
|
|
99
|
+
height: 0.5
|
|
100
|
+
}), jsxRuntime.jsx(reactHookForm.Controller, {
|
|
101
|
+
control: control,
|
|
102
|
+
name: "isAutoGrade",
|
|
103
|
+
render: function render(_ref3) {
|
|
104
|
+
var field = _ref3.field;
|
|
105
|
+
return jsxRuntime.jsx(blocks.Checkbox, Object.assign({
|
|
106
|
+
size: "small"
|
|
107
|
+
}, field, {
|
|
108
|
+
value: !field.value,
|
|
109
|
+
checked: !field.value,
|
|
110
|
+
onChange: function onChange(v) {
|
|
111
|
+
return field.onChange(!v);
|
|
112
|
+
},
|
|
113
|
+
children: intl$1.formatMessage({
|
|
114
|
+
id: 'option.text.isAutoGrade.checkbox.label'
|
|
115
|
+
})
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
112
120
|
};
|
|
113
121
|
|
|
114
122
|
exports.default = OptionText;
|
|
@@ -2,22 +2,23 @@
|
|
|
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 OptionGroupAnswerInfo = require('./OptionGroupAnswerInfo.js');
|
|
8
8
|
var OptionGroupGroupInfo = require('./OptionGroupGroupInfo.js');
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
var OptionGroup = function OptionGroup() {
|
|
11
11
|
//
|
|
12
12
|
//
|
|
13
13
|
//
|
|
14
|
-
return
|
|
14
|
+
return jsxRuntime.jsxs(blocks.Flex, {
|
|
15
15
|
column: true,
|
|
16
|
-
margintop: "1.5rem"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
margintop: "1.5rem",
|
|
17
|
+
children: [jsxRuntime.jsx(OptionGroupGroupInfo.default, {}), jsxRuntime.jsx(blocks.Hr, {
|
|
18
|
+
marginStart: "1.5rem",
|
|
19
|
+
marginEnd: "1.5rem"
|
|
20
|
+
}), jsxRuntime.jsx(OptionGroupAnswerInfo.default, {})]
|
|
21
|
+
});
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
exports.default = OptionGroup;
|