@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,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
7
|
var React = require('react');
|
|
6
8
|
var reactHookForm = require('react-hook-form');
|
|
7
9
|
var blocks = require('@elice/blocks');
|
|
@@ -13,28 +15,34 @@ var randomId = require('./utils/randomId.js');
|
|
|
13
15
|
var context = require('./context.js');
|
|
14
16
|
var MaterialSurveyEditOptionSelect = require('./MaterialSurveyEditOptionSelect.js');
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
19
|
+
|
|
20
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
21
|
+
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
22
|
+
|
|
23
|
+
var MIN_TEXT_LENGTH = 1;
|
|
24
|
+
var MAX_TEXT_LENGTH = 128;
|
|
25
|
+
var StyledSurveyOptionTypeSelectWrap = styled__default.default.div.withConfig({
|
|
19
26
|
componentId: "sc-r4ms68-0"
|
|
20
27
|
})(["display:flex;max-width:12rem;"]);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
disabled,
|
|
25
|
-
onFileUploadRequest
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
var MaterialSurveyEditContent = function MaterialSurveyEditContent() {
|
|
29
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
30
|
+
var _useMaterialSurveyEdi = context.useMaterialSurveyEditContext(),
|
|
31
|
+
disabled = _useMaterialSurveyEdi.disabled,
|
|
32
|
+
onFileUploadRequest = _useMaterialSurveyEdi.onFileUploadRequest;
|
|
33
|
+
var _useFormContext = reactHookForm.useFormContext(),
|
|
34
|
+
control = _useFormContext.control,
|
|
35
|
+
watch = _useFormContext.watch,
|
|
36
|
+
setValue = _useFormContext.setValue;
|
|
37
|
+
var _watch = watch(['questionInfoList.0.optionType', 'questionInfoList.0.optionInfo']),
|
|
38
|
+
_watch2 = _rollupPluginBabelHelpers.slicedToArray(_watch, 2),
|
|
39
|
+
watchedOptionType = _watch2[0],
|
|
40
|
+
watchedOptionInfo = _watch2[1];
|
|
33
41
|
//
|
|
34
42
|
// Change `optionInfo` according to `optionType`.
|
|
35
43
|
//
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
React__default.default.useEffect(function () {
|
|
45
|
+
var get = function get() {
|
|
38
46
|
switch (watchedOptionType) {
|
|
39
47
|
case types.enums.SurveyOptionType.SelectOne:
|
|
40
48
|
case types.enums.SurveyOptionType.SelectMultiple:
|
|
@@ -69,28 +77,29 @@ const MaterialSurveyEditContent = () => {
|
|
|
69
77
|
* Input of option info and answer info,
|
|
70
78
|
* according to option type.
|
|
71
79
|
*/
|
|
72
|
-
|
|
80
|
+
var Option = React__default.default.useMemo(function () {
|
|
73
81
|
switch (watchedOptionType) {
|
|
74
82
|
case types.enums.SurveyOptionType.SelectOne:
|
|
75
83
|
case types.enums.SurveyOptionType.SelectMultiple:
|
|
76
84
|
return MaterialSurveyEditOptionSelect.default;
|
|
77
85
|
case types.enums.SurveyOptionType.Text:
|
|
78
86
|
default:
|
|
79
|
-
return
|
|
87
|
+
return React__default.default.Fragment;
|
|
80
88
|
}
|
|
81
89
|
}, [watchedOptionType]);
|
|
82
90
|
/**
|
|
83
91
|
* Render input for survey title.
|
|
84
92
|
*/
|
|
85
|
-
|
|
86
|
-
return
|
|
87
|
-
label:
|
|
93
|
+
var renderQuestionTitleInput = function renderQuestionTitleInput() {
|
|
94
|
+
return jsxRuntime.jsx(blocks.FormInputVerticalLayout, {
|
|
95
|
+
label: jsxRuntime.jsx(blocks.Label, {
|
|
88
96
|
size: "small",
|
|
89
|
-
required: true
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
required: true,
|
|
98
|
+
children: intl$1.formatMessage({
|
|
99
|
+
id: 'content.title'
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
input: jsxRuntime.jsx(reactHookForm.Controller, {
|
|
94
103
|
control: control,
|
|
95
104
|
name: "questionInfoList.0.questionTitle",
|
|
96
105
|
rules: {
|
|
@@ -119,12 +128,11 @@ const MaterialSurveyEditContent = () => {
|
|
|
119
128
|
})
|
|
120
129
|
}
|
|
121
130
|
},
|
|
122
|
-
render: ({
|
|
123
|
-
field,
|
|
124
|
-
|
|
125
|
-
}) => {
|
|
131
|
+
render: function render(_ref) {
|
|
132
|
+
var field = _ref.field,
|
|
133
|
+
fieldState = _ref.fieldState;
|
|
126
134
|
var _a;
|
|
127
|
-
return
|
|
135
|
+
return jsxRuntime.jsx(blocks.Input, Object.assign({
|
|
128
136
|
size: "small",
|
|
129
137
|
width: "full",
|
|
130
138
|
minLength: MIN_TEXT_LENGTH,
|
|
@@ -142,79 +150,93 @@ const MaterialSurveyEditContent = () => {
|
|
|
142
150
|
/**
|
|
143
151
|
* Render input for survey description.
|
|
144
152
|
*/
|
|
145
|
-
|
|
146
|
-
return
|
|
147
|
-
label:
|
|
148
|
-
size: "small"
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
+
var renderQuestionDescriptionInput = function renderQuestionDescriptionInput() {
|
|
154
|
+
return jsxRuntime.jsx(blocks.FormInputVerticalLayout, {
|
|
155
|
+
label: jsxRuntime.jsx(blocks.Label, {
|
|
156
|
+
size: "small",
|
|
157
|
+
children: intl$1.formatMessage({
|
|
158
|
+
id: 'content.description.title'
|
|
159
|
+
})
|
|
160
|
+
}),
|
|
161
|
+
input: jsxRuntime.jsx(reactHookForm.Controller, {
|
|
153
162
|
control: control,
|
|
154
163
|
name: "questionInfoList.0.questionDescription",
|
|
155
|
-
render: ({
|
|
156
|
-
field
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
164
|
+
render: function render(_ref2) {
|
|
165
|
+
var field = _ref2.field;
|
|
166
|
+
return jsxRuntime.jsx(index.MarkdownEditor, Object.assign({
|
|
167
|
+
placeholder: intl$1.formatMessage({
|
|
168
|
+
id: 'content.description.placeholder'
|
|
169
|
+
}),
|
|
170
|
+
onFileUploadRequest: onFileUploadRequest
|
|
171
|
+
}, field));
|
|
172
|
+
}
|
|
163
173
|
})
|
|
164
174
|
});
|
|
165
175
|
};
|
|
166
176
|
/**
|
|
167
177
|
* Render input of option type, option info and answer info.
|
|
168
178
|
*/
|
|
169
|
-
|
|
170
|
-
return
|
|
171
|
-
label:
|
|
179
|
+
var renderOptionInput = function renderOptionInput() {
|
|
180
|
+
return jsxRuntime.jsx(blocks.FormInputVerticalLayout, {
|
|
181
|
+
label: jsxRuntime.jsx(blocks.Label, {
|
|
172
182
|
size: "small",
|
|
173
|
-
required: true
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
183
|
+
required: true,
|
|
184
|
+
children: intl$1.formatMessage({
|
|
185
|
+
id: 'content.option.title'
|
|
186
|
+
})
|
|
187
|
+
}),
|
|
188
|
+
input: jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
189
|
+
children: [jsxRuntime.jsx(reactHookForm.Controller, {
|
|
190
|
+
control: control,
|
|
191
|
+
name: "questionInfoList.0.optionType",
|
|
192
|
+
render: function render(_ref3) {
|
|
193
|
+
var field = _ref3.field;
|
|
194
|
+
return jsxRuntime.jsx(blocks.Tooltip, {
|
|
195
|
+
title: disabled ? intl$1.formatMessage({
|
|
196
|
+
id: 'content.option.tooltip.disabled'
|
|
197
|
+
}) : undefined,
|
|
198
|
+
placement: "top-end",
|
|
199
|
+
children: jsxRuntime.jsx(StyledSurveyOptionTypeSelectWrap, {
|
|
200
|
+
children: jsxRuntime.jsxs(blocks.Select, Object.assign({
|
|
201
|
+
size: "small",
|
|
202
|
+
width: "small",
|
|
203
|
+
readOnly: disabled
|
|
204
|
+
}, field, {
|
|
205
|
+
onChange: function onChange(v) {
|
|
206
|
+
return field.onChange(Number(v));
|
|
207
|
+
},
|
|
208
|
+
children: [jsxRuntime.jsx("option", {
|
|
209
|
+
value: types.enums.SurveyOptionType.SelectOne,
|
|
210
|
+
children: intl$1.formatMessage({
|
|
211
|
+
id: 'content.option.select.items.selectOne'
|
|
212
|
+
})
|
|
213
|
+
}), jsxRuntime.jsx("option", {
|
|
214
|
+
value: types.enums.SurveyOptionType.SelectMultiple,
|
|
215
|
+
children: intl$1.formatMessage({
|
|
216
|
+
id: 'content.option.select.items.selectMultiple'
|
|
217
|
+
})
|
|
218
|
+
}), jsxRuntime.jsx("option", {
|
|
219
|
+
value: types.enums.SurveyOptionType.Text,
|
|
220
|
+
children: intl$1.formatMessage({
|
|
221
|
+
id: 'content.option.select.items.text'
|
|
222
|
+
})
|
|
223
|
+
})]
|
|
224
|
+
}))
|
|
225
|
+
})
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}), jsxRuntime.jsx(blocks.Vspace, {
|
|
229
|
+
height: 0.5
|
|
230
|
+
}), jsxRuntime.jsx(Option, {})]
|
|
231
|
+
})
|
|
212
232
|
});
|
|
213
233
|
};
|
|
214
234
|
//
|
|
215
235
|
//
|
|
216
236
|
//
|
|
217
|
-
return
|
|
237
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
238
|
+
children: [renderQuestionTitleInput(), renderQuestionDescriptionInput(), renderOptionInput()]
|
|
239
|
+
});
|
|
218
240
|
};
|
|
219
241
|
|
|
220
242
|
exports.default = MaterialSurveyEditContent;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var reactHookForm = require('react-hook-form');
|
|
7
7
|
var blocks = require('@elice/blocks');
|
|
8
8
|
var icons = require('@elice/icons');
|
|
@@ -11,35 +11,36 @@ var styled = require('styled-components');
|
|
|
11
11
|
var randomId = require('./utils/randomId.js');
|
|
12
12
|
var context = require('./context.js');
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
|
+
|
|
16
|
+
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
17
|
+
|
|
18
|
+
var MIN_OPTION_INFO_COUNT = 2;
|
|
19
|
+
var MAX_OPTION_INFO_COUNT = 20;
|
|
20
|
+
var StyledWrap = styled__default.default.div.withConfig({
|
|
17
21
|
componentId: "sc-1eiyk6z-0"
|
|
18
22
|
})([""]);
|
|
19
|
-
|
|
23
|
+
var StyledInputGroup = styled__default.default.div.withConfig({
|
|
20
24
|
componentId: "sc-1eiyk6z-1"
|
|
21
25
|
})(["width:100%;.eb-input{margin-bottom:0.5rem;&:last-of-type{margin-bottom:0;}}"]);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
disabled
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
keyName: 'id',
|
|
37
|
-
shouldUnregister: true
|
|
38
|
-
});
|
|
26
|
+
var OptionSelectOne = function OptionSelectOne() {
|
|
27
|
+
var intl$1 = intl.useRawEliceIntl();
|
|
28
|
+
var _useMaterialSurveyEdi = context.useMaterialSurveyEditContext(),
|
|
29
|
+
disabled = _useMaterialSurveyEdi.disabled;
|
|
30
|
+
var _useFormContext = reactHookForm.useFormContext(),
|
|
31
|
+
control = _useFormContext.control;
|
|
32
|
+
var _useFieldArray = reactHookForm.useFieldArray({
|
|
33
|
+
name: 'questionInfoList.0.optionInfo',
|
|
34
|
+
keyName: 'id',
|
|
35
|
+
shouldUnregister: true
|
|
36
|
+
}),
|
|
37
|
+
optionInfoFields = _useFieldArray.fields,
|
|
38
|
+
appendOptionInfoFieldItem = _useFieldArray.append,
|
|
39
|
+
removeOptionInfoFieldItem = _useFieldArray.remove;
|
|
39
40
|
/**
|
|
40
41
|
* Append option info.
|
|
41
42
|
*/
|
|
42
|
-
|
|
43
|
+
var appendOptionInfo = function appendOptionInfo() {
|
|
43
44
|
appendOptionInfoFieldItem({
|
|
44
45
|
id: randomId.createRandomId(),
|
|
45
46
|
value: ''
|
|
@@ -48,76 +49,88 @@ const OptionSelectOne = () => {
|
|
|
48
49
|
/**
|
|
49
50
|
* Remove item from option info at index.
|
|
50
51
|
*/
|
|
51
|
-
|
|
52
|
+
var removeOptionInfo = function removeOptionInfo(index) {
|
|
52
53
|
removeOptionInfoFieldItem(index);
|
|
53
54
|
};
|
|
54
55
|
//
|
|
55
56
|
//
|
|
56
57
|
//
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
58
|
+
return jsxRuntime.jsxs(StyledWrap, {
|
|
59
|
+
children: [jsxRuntime.jsx(StyledInputGroup, {
|
|
60
|
+
children: optionInfoFields.map(function (_ref, index) {
|
|
61
|
+
var id = _ref.id;
|
|
62
|
+
return jsxRuntime.jsx(reactHookForm.Controller, {
|
|
63
|
+
control: control,
|
|
64
|
+
name: "questionInfoList.0.optionInfo.".concat(index, ".value"),
|
|
65
|
+
rules: {
|
|
66
|
+
required: {
|
|
67
|
+
value: true,
|
|
68
|
+
message: intl$1.formatMessage({
|
|
69
|
+
id: 'option.common.select.errorMessage.required'
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
render: function render(_ref2) {
|
|
74
|
+
var field = _ref2.field,
|
|
75
|
+
fieldState = _ref2.fieldState;
|
|
76
|
+
var _a;
|
|
77
|
+
return jsxRuntime.jsx(blocks.Input, Object.assign({
|
|
78
|
+
size: "small",
|
|
79
|
+
width: "full",
|
|
80
|
+
placeholder: intl$1.formatMessage({
|
|
81
|
+
id: 'option.common.select.placeholder'
|
|
82
|
+
}),
|
|
83
|
+
suffix: jsxRuntime.jsx(blocks.Tooltip, {
|
|
84
|
+
title: optionInfoFields.length <= MIN_OPTION_INFO_COUNT ? intl$1.formatMessage({
|
|
85
|
+
id: 'option.common.select.tooltip.minOptionInfoItem'
|
|
86
|
+
}) : undefined,
|
|
87
|
+
placement: "top-start",
|
|
88
|
+
children: jsxRuntime.jsx("span", {
|
|
89
|
+
children: jsxRuntime.jsx(blocks.IconButton, {
|
|
90
|
+
icon: icons.eilMathsignMultiplyBasic,
|
|
91
|
+
role: "grey9",
|
|
92
|
+
size: "tiny",
|
|
93
|
+
border: false,
|
|
94
|
+
transparent: true,
|
|
95
|
+
disabled: optionInfoFields.length <= MIN_OPTION_INFO_COUNT || disabled,
|
|
96
|
+
onClick: function onClick() {
|
|
97
|
+
return removeOptionInfo(index);
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
readOnly: disabled,
|
|
103
|
+
invalid: fieldState.invalid,
|
|
104
|
+
invalidText: (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message
|
|
105
|
+
}, field));
|
|
106
|
+
}
|
|
107
|
+
}, id);
|
|
108
|
+
})
|
|
109
|
+
}), jsxRuntime.jsx(blocks.Vspace, {
|
|
110
|
+
height: 0.5
|
|
111
|
+
}), jsxRuntime.jsx(blocks.Tooltip, {
|
|
112
|
+
title: optionInfoFields.length >= MAX_OPTION_INFO_COUNT ? intl$1.formatMessage({
|
|
113
|
+
id: 'option.common.select.tooltip.maxOptionInfoItem'
|
|
114
|
+
}) : undefined,
|
|
115
|
+
placement: "bottom",
|
|
116
|
+
children: jsxRuntime.jsx("span", {
|
|
117
|
+
children: jsxRuntime.jsx(blocks.Button, {
|
|
118
|
+
block: true,
|
|
119
|
+
size: "micro",
|
|
120
|
+
borderDashed: true,
|
|
92
121
|
transparent: true,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
id: 'option.common.select.tooltip.maxOptionInfoItem'
|
|
106
|
-
}) : undefined,
|
|
107
|
-
placement: "bottom"
|
|
108
|
-
}, React.createElement("span", null, React.createElement(blocks.Button, {
|
|
109
|
-
block: true,
|
|
110
|
-
size: "micro",
|
|
111
|
-
borderDashed: true,
|
|
112
|
-
transparent: true,
|
|
113
|
-
icon: React.createElement(blocks.Icon, {
|
|
114
|
-
icon: icons.eilMathsignAddCircle
|
|
115
|
-
}),
|
|
116
|
-
disabled: optionInfoFields.length >= MAX_OPTION_INFO_COUNT || disabled,
|
|
117
|
-
onClick: appendOptionInfo
|
|
118
|
-
}, intl$1.formatMessage({
|
|
119
|
-
id: 'option.common.select.addButton'
|
|
120
|
-
})))));
|
|
122
|
+
icon: jsxRuntime.jsx(blocks.Icon, {
|
|
123
|
+
icon: icons.eilMathsignAddCircle
|
|
124
|
+
}),
|
|
125
|
+
disabled: optionInfoFields.length >= MAX_OPTION_INFO_COUNT || disabled,
|
|
126
|
+
onClick: appendOptionInfo,
|
|
127
|
+
children: intl$1.formatMessage({
|
|
128
|
+
id: 'option.common.select.addButton'
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
})]
|
|
133
|
+
});
|
|
121
134
|
};
|
|
122
135
|
|
|
123
136
|
exports.default = OptionSelectOne;
|
|
@@ -4,8 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
10
|
+
|
|
11
|
+
var MaterialSurveyEditContext = React__default.default.createContext(null);
|
|
12
|
+
var useMaterialSurveyEditContext = function useMaterialSurveyEditContext() {
|
|
13
|
+
return React__default.default.useContext(MaterialSurveyEditContext);
|
|
14
|
+
};
|
|
9
15
|
|
|
10
16
|
exports.default = MaterialSurveyEditContext;
|
|
11
17
|
exports.useMaterialSurveyEditContext = useMaterialSurveyEditContext;
|
|
@@ -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;
|
|
@@ -7,14 +7,18 @@ var randomId = require('./randomId.js');
|
|
|
7
7
|
*/
|
|
8
8
|
function manipulateValue(v) {
|
|
9
9
|
return Object.assign(Object.assign({}, v), {
|
|
10
|
-
questionInfoList: v.questionInfoList.map(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
questionInfoList: v.questionInfoList.map(function (questionInfo) {
|
|
11
|
+
return Object.assign(Object.assign({}, questionInfo), {
|
|
12
|
+
// convert string array to object array
|
|
13
|
+
// - ref: https://github.com/react-hook-form/react-hook-form/issues/7622#issuecomment-1018893318
|
|
14
|
+
optionInfo: Array.isArray(questionInfo.optionInfo) ? questionInfo.optionInfo.map(function (option) {
|
|
15
|
+
return {
|
|
16
|
+
id: randomId.createRandomId(),
|
|
17
|
+
value: option
|
|
18
|
+
};
|
|
19
|
+
}) : []
|
|
20
|
+
});
|
|
21
|
+
})
|
|
18
22
|
});
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
@@ -22,10 +26,12 @@ function manipulateValue(v) {
|
|
|
22
26
|
*/
|
|
23
27
|
function restoreValue(v) {
|
|
24
28
|
return Object.assign(Object.assign({}, v), {
|
|
25
|
-
questionInfoList: v.questionInfoList.map(questionInfo
|
|
29
|
+
questionInfoList: v.questionInfoList.map(function (questionInfo) {
|
|
26
30
|
var _a;
|
|
27
|
-
|
|
28
|
-
optionInfo: ((_a = questionInfo.optionInfo) === null || _a === void 0 ? void 0 : _a.length) ? questionInfo.optionInfo.map(
|
|
31
|
+
var newQuestionInfo = Object.assign(Object.assign({}, questionInfo), {
|
|
32
|
+
optionInfo: ((_a = questionInfo.optionInfo) === null || _a === void 0 ? void 0 : _a.length) ? questionInfo.optionInfo.map(function (option) {
|
|
33
|
+
return option.value;
|
|
34
|
+
}) : null
|
|
29
35
|
});
|
|
30
36
|
if (!newQuestionInfo.optionInfo) {
|
|
31
37
|
delete newQuestionInfo.optionInfo;
|
|
@@ -5,7 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var markdown = require('@elice/markdown');
|
|
6
6
|
var styled = require('styled-components');
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
9
|
+
|
|
10
|
+
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
11
|
+
|
|
12
|
+
var StyledMarkdown = styled__default.default(markdown.Markdown).withConfig({
|
|
9
13
|
componentId: "sc-h8kc9g-0"
|
|
10
14
|
})(["p{margin:0 !important;}"]);
|
|
11
15
|
|