@pie-element/likert 2.3.4-next.3 → 3.0.0-beta.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/configure/lib/choiceGenerator.js +78 -105
- package/configure/lib/choiceGenerator.js.map +1 -1
- package/configure/lib/defaults.js +2 -4
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +84 -149
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/likertEntities.js +3 -6
- package/configure/lib/likertEntities.js.map +1 -1
- package/configure/lib/main.js +279 -390
- package/configure/lib/main.js.map +1 -1
- package/configure/package.json +10 -7
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +39 -84
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/lib/choice-input.js +68 -144
- package/lib/choice-input.js.map +1 -1
- package/lib/index.js +48 -91
- package/lib/index.js.map +1 -1
- package/lib/likert.js +75 -132
- package/lib/likert.js.map +1 -1
- package/lib/likertEntities.js +1 -2
- package/lib/likertEntities.js.map +1 -1
- package/lib/main.js +24 -69
- package/lib/main.js.map +1 -1
- package/lib/session-updater.js +0 -2
- package/lib/session-updater.js.map +1 -1
- package/package.json +11 -8
- package/esm/configure.js +0 -17471
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -96
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -13272
- package/esm/element.js.map +0 -1
- package/esm/package.json +0 -3
package/configure/lib/main.js
CHANGED
|
@@ -1,342 +1,275 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
7
|
+
exports.default = exports.Main = void 0;
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
-
|
|
18
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
|
|
20
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
-
|
|
22
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
-
|
|
24
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
-
|
|
26
10
|
var _react = _interopRequireDefault(require("react"));
|
|
27
|
-
|
|
28
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
29
|
-
|
|
30
12
|
var _editableHtml = _interopRequireDefault(require("@pie-lib/editable-html"));
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
var _RadioGroup = _interopRequireDefault(require("@material-ui/core/RadioGroup"));
|
|
35
|
-
|
|
36
|
-
var _FormControlLabel = _interopRequireDefault(require("@material-ui/core/FormControlLabel"));
|
|
37
|
-
|
|
13
|
+
var _Radio = _interopRequireDefault(require("@mui/material/Radio"));
|
|
14
|
+
var _RadioGroup = _interopRequireDefault(require("@mui/material/RadioGroup"));
|
|
15
|
+
var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
|
|
38
16
|
var _configUi = require("@pie-lib/config-ui");
|
|
39
|
-
|
|
40
|
-
var _styles = require("@material-ui/core/styles");
|
|
41
|
-
|
|
17
|
+
var _styles = require("@mui/material/styles");
|
|
42
18
|
var _merge = _interopRequireDefault(require("lodash/merge"));
|
|
43
|
-
|
|
44
19
|
var _likertEntities = require("./likertEntities");
|
|
45
|
-
|
|
46
20
|
var _choiceGenerator = _interopRequireDefault(require("./choiceGenerator"));
|
|
47
|
-
|
|
48
21
|
var _renderUi = require("@pie-lib/render-ui");
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
22
|
+
const {
|
|
23
|
+
Panel,
|
|
24
|
+
toggle,
|
|
25
|
+
radio
|
|
26
|
+
} = _configUi.settings;
|
|
27
|
+
const PromptHolder = (0, _styles.styled)(_configUi.InputContainer)(({
|
|
28
|
+
theme
|
|
29
|
+
}) => ({
|
|
30
|
+
width: '100%',
|
|
31
|
+
paddingTop: theme.spacing(2),
|
|
32
|
+
marginBottom: theme.spacing(2)
|
|
33
|
+
}));
|
|
34
|
+
const RadioButtonsWrapper = (0, _styles.styled)('div')({
|
|
35
|
+
display: 'flex',
|
|
36
|
+
flexDirection: 'column'
|
|
37
|
+
});
|
|
38
|
+
const RadioButtonsColumnHeader = (0, _styles.styled)('p')(({
|
|
39
|
+
theme
|
|
40
|
+
}) => ({
|
|
41
|
+
color: theme.palette.grey[400],
|
|
42
|
+
fontSize: theme.typography.fontSize - 2
|
|
43
|
+
}));
|
|
44
|
+
const LikertLabelHolder = (0, _styles.styled)('div')(({
|
|
45
|
+
theme
|
|
46
|
+
}) => ({
|
|
47
|
+
display: 'flex',
|
|
48
|
+
width: '100%',
|
|
49
|
+
alignItems: 'flex-start',
|
|
50
|
+
marginBottom: theme.spacing(2)
|
|
51
|
+
}));
|
|
52
|
+
const LikertOptionsHolder = (0, _styles.styled)('div')(({
|
|
53
|
+
theme
|
|
54
|
+
}) => ({
|
|
55
|
+
display: 'flex',
|
|
56
|
+
width: '100%',
|
|
57
|
+
justifyContent: 'space-around',
|
|
58
|
+
marginBottom: theme.spacing(2.5)
|
|
59
|
+
}));
|
|
60
|
+
const LikertLabelInput = (0, _styles.styled)(_configUi.InputContainer)({
|
|
61
|
+
width: 'calc(100% - 200px)',
|
|
62
|
+
marginRight: 0
|
|
63
|
+
});
|
|
64
|
+
const ErrorMessage = (0, _styles.styled)('p')(({
|
|
65
|
+
theme
|
|
66
|
+
}) => ({
|
|
67
|
+
color: theme.palette.error.main,
|
|
68
|
+
fontSize: theme.typography.fontSize - 2
|
|
69
|
+
}));
|
|
70
|
+
const StyledNumberTextField = (0, _styles.styled)(_configUi.NumberTextField)({
|
|
71
|
+
width: '100%'
|
|
72
|
+
});
|
|
73
|
+
const FlexRow = (0, _styles.styled)('div')({
|
|
74
|
+
display: 'flex',
|
|
75
|
+
flexDirection: 'row'
|
|
76
|
+
});
|
|
77
|
+
const LikertValueHolder = (0, _styles.styled)('div')(({
|
|
78
|
+
theme
|
|
79
|
+
}) => ({
|
|
80
|
+
paddingLeft: theme.spacing(2.5),
|
|
81
|
+
width: '150px'
|
|
82
|
+
}));
|
|
83
|
+
const StyledEditableHtml = (0, _styles.styled)(_editableHtml.default)(({
|
|
84
|
+
theme
|
|
85
|
+
}) => ({
|
|
86
|
+
paddingTop: theme.spacing(2)
|
|
87
|
+
}));
|
|
88
|
+
const InputFormGroupIndex = (0, _styles.styled)('span')(({
|
|
89
|
+
theme
|
|
90
|
+
}) => ({
|
|
91
|
+
width: '30px',
|
|
92
|
+
paddingTop: theme.spacing(4)
|
|
93
|
+
}));
|
|
94
|
+
const ErrorText = (0, _styles.styled)('div')(({
|
|
95
|
+
theme
|
|
96
|
+
}) => ({
|
|
97
|
+
fontSize: theme.typography.fontSize - 2,
|
|
98
|
+
color: theme.palette.error.main,
|
|
99
|
+
paddingTop: theme.spacing(1)
|
|
100
|
+
}));
|
|
101
|
+
const CustomColorRadio = (0, _styles.styled)(_Radio.default)({
|
|
102
|
+
color: `${_renderUi.color.tertiary()} !important`
|
|
103
|
+
});
|
|
104
|
+
const LikertOrientation = props => {
|
|
105
|
+
const {
|
|
106
|
+
model,
|
|
107
|
+
onChangeModel
|
|
108
|
+
} = props;
|
|
109
|
+
const onChangeLikertOrientation = e => {
|
|
110
|
+
const likertOrientation = e.target.value;
|
|
111
|
+
onChangeModel({
|
|
112
|
+
...model,
|
|
113
|
+
likertOrientation
|
|
114
|
+
});
|
|
136
115
|
};
|
|
137
|
-
|
|
138
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
139
|
-
className: classes.radioButtonsWrapper
|
|
140
|
-
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
141
|
-
className: classes.radioButtonsColumnHeader
|
|
142
|
-
}, "Likert Orientation"), /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
116
|
+
return /*#__PURE__*/_react.default.createElement(RadioButtonsWrapper, null, /*#__PURE__*/_react.default.createElement(RadioButtonsColumnHeader, null, "Likert Orientation"), /*#__PURE__*/_react.default.createElement(_RadioGroup.default, {
|
|
143
117
|
"aria-label": "likertOrientation",
|
|
144
118
|
name: "likertOrientation",
|
|
145
119
|
value: model.likertOrientation,
|
|
146
120
|
onChange: onChangeLikertOrientation
|
|
147
|
-
}, /*#__PURE__*/_react
|
|
121
|
+
}, /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, {
|
|
148
122
|
value: _likertEntities.LIKERT_ORIENTATION.horizontal,
|
|
149
|
-
control: /*#__PURE__*/_react
|
|
150
|
-
className: classes.customColor
|
|
151
|
-
}),
|
|
123
|
+
control: /*#__PURE__*/_react.default.createElement(CustomColorRadio, null),
|
|
152
124
|
label: "Horizontal"
|
|
153
|
-
}), /*#__PURE__*/_react
|
|
125
|
+
}), /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, {
|
|
154
126
|
value: _likertEntities.LIKERT_ORIENTATION.vertical,
|
|
155
|
-
control: /*#__PURE__*/_react
|
|
156
|
-
className: classes.customColor
|
|
157
|
-
}),
|
|
127
|
+
control: /*#__PURE__*/_react.default.createElement(CustomColorRadio, null),
|
|
158
128
|
label: "Vertical"
|
|
159
129
|
})));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
onChangeModel(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
130
|
+
};
|
|
131
|
+
const LikertScale = props => {
|
|
132
|
+
const {
|
|
133
|
+
model,
|
|
134
|
+
onChangeModel
|
|
135
|
+
} = props;
|
|
136
|
+
const onChangeLikertScale = e => {
|
|
137
|
+
const likertScale = e.target.value;
|
|
138
|
+
onChangeModel({
|
|
139
|
+
...model,
|
|
140
|
+
likertScale,
|
|
141
|
+
choices: (0, _choiceGenerator.default)(likertScale, model.likertType)
|
|
142
|
+
});
|
|
172
143
|
};
|
|
173
|
-
|
|
174
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
175
|
-
className: classes.radioButtonsWrapper
|
|
176
|
-
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
177
|
-
className: classes.radioButtonsColumnHeader
|
|
178
|
-
}, "Likert Scale"), /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
144
|
+
return /*#__PURE__*/_react.default.createElement(RadioButtonsWrapper, null, /*#__PURE__*/_react.default.createElement(RadioButtonsColumnHeader, null, "Likert Scale"), /*#__PURE__*/_react.default.createElement(_RadioGroup.default, {
|
|
179
145
|
"aria-label": "likertScale",
|
|
180
146
|
name: "likertScale",
|
|
181
147
|
value: model.likertScale,
|
|
182
148
|
onChange: onChangeLikertScale
|
|
183
|
-
}, /*#__PURE__*/_react
|
|
149
|
+
}, /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, {
|
|
184
150
|
value: _likertEntities.LIKERT_SCALE.likert3,
|
|
185
|
-
control: /*#__PURE__*/_react
|
|
186
|
-
className: classes.customColor
|
|
187
|
-
}),
|
|
151
|
+
control: /*#__PURE__*/_react.default.createElement(CustomColorRadio, null),
|
|
188
152
|
label: "Likert 3"
|
|
189
|
-
}), /*#__PURE__*/_react
|
|
153
|
+
}), /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, {
|
|
190
154
|
value: _likertEntities.LIKERT_SCALE.likert5,
|
|
191
|
-
control: /*#__PURE__*/_react
|
|
192
|
-
className: classes.customColor
|
|
193
|
-
}),
|
|
155
|
+
control: /*#__PURE__*/_react.default.createElement(CustomColorRadio, null),
|
|
194
156
|
label: "Likert 5"
|
|
195
|
-
}), /*#__PURE__*/_react
|
|
157
|
+
}), /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, {
|
|
196
158
|
value: _likertEntities.LIKERT_SCALE.likert7,
|
|
197
|
-
control: /*#__PURE__*/_react
|
|
198
|
-
className: classes.customColor
|
|
199
|
-
}),
|
|
159
|
+
control: /*#__PURE__*/_react.default.createElement(CustomColorRadio, null),
|
|
200
160
|
label: "Likert 7"
|
|
201
161
|
})));
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
onChangeModel(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
162
|
+
};
|
|
163
|
+
const LikertType = props => {
|
|
164
|
+
const {
|
|
165
|
+
model,
|
|
166
|
+
onChangeModel
|
|
167
|
+
} = props;
|
|
168
|
+
const onChangeLikertType = e => {
|
|
169
|
+
const likertType = e.target.value;
|
|
170
|
+
onChangeModel({
|
|
171
|
+
...model,
|
|
172
|
+
likertType,
|
|
173
|
+
choices: (0, _choiceGenerator.default)(model.likertScale, likertType)
|
|
174
|
+
});
|
|
214
175
|
};
|
|
215
|
-
|
|
216
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
217
|
-
className: classes.radioButtonsWrapper
|
|
218
|
-
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
219
|
-
className: classes.radioButtonsColumnHeader
|
|
220
|
-
}, "Label Type"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
221
|
-
className: classes.flexRow
|
|
222
|
-
}, /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
176
|
+
return /*#__PURE__*/_react.default.createElement(RadioButtonsWrapper, null, /*#__PURE__*/_react.default.createElement(RadioButtonsColumnHeader, null, "Label Type"), /*#__PURE__*/_react.default.createElement(FlexRow, null, /*#__PURE__*/_react.default.createElement(_RadioGroup.default, {
|
|
223
177
|
"aria-label": "likertLabelType",
|
|
224
178
|
name: "likertLabelType",
|
|
225
179
|
value: model.likertType,
|
|
226
180
|
onChange: onChangeLikertType
|
|
227
|
-
}, /*#__PURE__*/_react
|
|
181
|
+
}, /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, {
|
|
228
182
|
value: _likertEntities.LIKERT_TYPE.agreement,
|
|
229
|
-
control: /*#__PURE__*/_react
|
|
230
|
-
className: classes.customColor
|
|
231
|
-
}),
|
|
183
|
+
control: /*#__PURE__*/_react.default.createElement(CustomColorRadio, null),
|
|
232
184
|
label: "Agreement"
|
|
233
|
-
}), /*#__PURE__*/_react
|
|
185
|
+
}), /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, {
|
|
234
186
|
value: _likertEntities.LIKERT_TYPE.frequency,
|
|
235
|
-
control: /*#__PURE__*/_react
|
|
236
|
-
className: classes.customColor
|
|
237
|
-
}),
|
|
187
|
+
control: /*#__PURE__*/_react.default.createElement(CustomColorRadio, null),
|
|
238
188
|
label: "Frequency"
|
|
239
|
-
}), /*#__PURE__*/_react
|
|
189
|
+
}), /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, {
|
|
240
190
|
value: _likertEntities.LIKERT_TYPE.yesNo,
|
|
241
|
-
control: /*#__PURE__*/_react
|
|
242
|
-
className: classes.customColor
|
|
243
|
-
}),
|
|
191
|
+
control: /*#__PURE__*/_react.default.createElement(CustomColorRadio, null),
|
|
244
192
|
label: "Yes/No"
|
|
245
|
-
})), /*#__PURE__*/_react
|
|
193
|
+
})), /*#__PURE__*/_react.default.createElement(_RadioGroup.default, {
|
|
246
194
|
"aria-label": "likertLabelType",
|
|
247
195
|
name: "likertLabelType",
|
|
248
196
|
value: model.likertType,
|
|
249
197
|
onChange: onChangeLikertType
|
|
250
|
-
}, /*#__PURE__*/_react
|
|
198
|
+
}, /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, {
|
|
251
199
|
value: _likertEntities.LIKERT_TYPE.importance,
|
|
252
|
-
control: /*#__PURE__*/_react
|
|
253
|
-
className: classes.customColor
|
|
254
|
-
}),
|
|
200
|
+
control: /*#__PURE__*/_react.default.createElement(CustomColorRadio, null),
|
|
255
201
|
label: "Importance"
|
|
256
|
-
}), /*#__PURE__*/_react
|
|
202
|
+
}), /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, {
|
|
257
203
|
value: _likertEntities.LIKERT_TYPE.likelihood,
|
|
258
|
-
control: /*#__PURE__*/_react
|
|
259
|
-
className: classes.customColor
|
|
260
|
-
}),
|
|
204
|
+
control: /*#__PURE__*/_react.default.createElement(CustomColorRadio, null),
|
|
261
205
|
label: "Likelihood"
|
|
262
|
-
}), /*#__PURE__*/_react
|
|
206
|
+
}), /*#__PURE__*/_react.default.createElement(_FormControlLabel.default, {
|
|
263
207
|
value: _likertEntities.LIKERT_TYPE.like,
|
|
264
|
-
control: /*#__PURE__*/_react
|
|
265
|
-
className: classes.customColor
|
|
266
|
-
}),
|
|
208
|
+
control: /*#__PURE__*/_react.default.createElement(CustomColorRadio, null),
|
|
267
209
|
label: "Like"
|
|
268
210
|
}))));
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
var buildValuesMap = function buildValuesMap(model) {
|
|
272
|
-
return model.choices.reduce(function (acc, choice) {
|
|
273
|
-
var accClone = _objectSpread({}, acc);
|
|
274
|
-
|
|
275
|
-
var choiceValue = parseInt(choice.value);
|
|
276
|
-
|
|
277
|
-
if (!accClone[choiceValue]) {
|
|
278
|
-
accClone[choiceValue] = 0;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
return _objectSpread(_objectSpread({}, accClone), {}, (0, _defineProperty2["default"])({}, choiceValue, accClone[choiceValue] + 1));
|
|
282
|
-
}, {});
|
|
283
211
|
};
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
212
|
+
const buildValuesMap = model => model.choices.reduce((acc, choice) => {
|
|
213
|
+
const accClone = {
|
|
214
|
+
...acc
|
|
215
|
+
};
|
|
216
|
+
const choiceValue = parseInt(choice.value);
|
|
217
|
+
if (!accClone[choiceValue]) {
|
|
218
|
+
accClone[choiceValue] = 0;
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
...accClone,
|
|
222
|
+
[choiceValue]: accClone[choiceValue] + 1
|
|
223
|
+
};
|
|
224
|
+
}, {});
|
|
225
|
+
const Design = props => {
|
|
226
|
+
const {
|
|
227
|
+
configuration,
|
|
228
|
+
imageSupport,
|
|
229
|
+
model,
|
|
230
|
+
onChangeModel,
|
|
231
|
+
onChoiceChanged,
|
|
232
|
+
onConfigurationChanged,
|
|
233
|
+
onPromptChanged,
|
|
234
|
+
onTeacherInstructionsChanged,
|
|
235
|
+
uploadSoundSupport
|
|
236
|
+
} = props;
|
|
237
|
+
const {
|
|
238
|
+
contentDimensions = {},
|
|
239
|
+
prompt = {},
|
|
240
|
+
scoringType = {},
|
|
241
|
+
settingsPanelDisabled,
|
|
242
|
+
spellCheck = {},
|
|
243
|
+
teacherInstructions = {},
|
|
244
|
+
baseInputConfiguration = {},
|
|
245
|
+
likertChoice = {}
|
|
246
|
+
} = configuration || {};
|
|
247
|
+
const {
|
|
248
|
+
errors = {},
|
|
249
|
+
extraCSSRules,
|
|
250
|
+
spellCheckEnabled,
|
|
251
|
+
teacherInstructionsEnabled
|
|
252
|
+
} = model || {};
|
|
253
|
+
const {
|
|
254
|
+
prompt: promptError,
|
|
255
|
+
teacherInstructions: teacherInstructionsError
|
|
256
|
+
} = errors;
|
|
257
|
+
const valuesMap = buildValuesMap(model);
|
|
258
|
+
const panelProperties = {
|
|
325
259
|
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
326
260
|
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
327
261
|
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric'])
|
|
328
262
|
};
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
263
|
+
const getPluginProps = (props = {}) => {
|
|
264
|
+
return Object.assign({
|
|
265
|
+
...baseInputConfiguration
|
|
266
|
+
}, props || {});
|
|
333
267
|
};
|
|
334
|
-
|
|
335
|
-
return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
268
|
+
return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
|
|
336
269
|
extraCSSRules: extraCSSRules,
|
|
337
270
|
dimensions: contentDimensions,
|
|
338
271
|
hideSettings: settingsPanelDisabled,
|
|
339
|
-
settings: /*#__PURE__*/_react
|
|
272
|
+
settings: /*#__PURE__*/_react.default.createElement(Panel, {
|
|
340
273
|
model: model,
|
|
341
274
|
onChangeModel: onChangeModel,
|
|
342
275
|
configuration: configuration,
|
|
@@ -345,11 +278,9 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
345
278
|
Properties: panelProperties
|
|
346
279
|
}
|
|
347
280
|
})
|
|
348
|
-
}, teacherInstructionsEnabled && /*#__PURE__*/_react
|
|
349
|
-
label: teacherInstructions.label
|
|
350
|
-
|
|
351
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
352
|
-
className: classes.prompt,
|
|
281
|
+
}, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(PromptHolder, {
|
|
282
|
+
label: teacherInstructions.label
|
|
283
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtml.default, {
|
|
353
284
|
markup: model.teacherInstructions || '',
|
|
354
285
|
onChange: onTeacherInstructionsChanged,
|
|
355
286
|
imageSupport: imageSupport,
|
|
@@ -357,14 +288,10 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
357
288
|
error: teacherInstructionsError,
|
|
358
289
|
spellCheck: spellCheckEnabled,
|
|
359
290
|
uploadSoundSupport: uploadSoundSupport,
|
|
360
|
-
pluginProps: getPluginProps(teacherInstructions
|
|
361
|
-
}), teacherInstructionsError && /*#__PURE__*/_react
|
|
362
|
-
|
|
363
|
-
},
|
|
364
|
-
label: prompt.label,
|
|
365
|
-
className: classes.promptHolder
|
|
366
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
367
|
-
className: classes.prompt,
|
|
291
|
+
pluginProps: getPluginProps(teacherInstructions?.inputConfiguration)
|
|
292
|
+
}), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError)), /*#__PURE__*/_react.default.createElement(PromptHolder, {
|
|
293
|
+
label: prompt.label
|
|
294
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtml.default, {
|
|
368
295
|
markup: model.prompt,
|
|
369
296
|
onChange: onPromptChanged,
|
|
370
297
|
imageSupport: imageSupport,
|
|
@@ -373,127 +300,89 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
373
300
|
spellCheck: spellCheckEnabled,
|
|
374
301
|
disableUnderline: true,
|
|
375
302
|
uploadSoundSupport: uploadSoundSupport,
|
|
376
|
-
pluginProps: getPluginProps(prompt
|
|
377
|
-
}), promptError && /*#__PURE__*/_react
|
|
378
|
-
className: classes.errorText
|
|
379
|
-
}, promptError)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
380
|
-
className: classes.likertOptionsHolder
|
|
381
|
-
}, /*#__PURE__*/_react["default"].createElement(LikertScale, {
|
|
303
|
+
pluginProps: getPluginProps(prompt?.inputConfiguration)
|
|
304
|
+
}), promptError && /*#__PURE__*/_react.default.createElement(ErrorText, null, promptError)), /*#__PURE__*/_react.default.createElement(LikertOptionsHolder, null, /*#__PURE__*/_react.default.createElement(LikertScale, {
|
|
382
305
|
model: model,
|
|
383
306
|
onChangeModel: onChangeModel
|
|
384
|
-
}), /*#__PURE__*/_react
|
|
307
|
+
}), /*#__PURE__*/_react.default.createElement(LikertType, {
|
|
385
308
|
model: model,
|
|
386
309
|
onChangeModel: onChangeModel
|
|
387
|
-
}), /*#__PURE__*/_react
|
|
310
|
+
}), /*#__PURE__*/_react.default.createElement(LikertOrientation, {
|
|
388
311
|
model: model,
|
|
389
312
|
onChangeModel: onChangeModel
|
|
390
|
-
})), model.choices.map(
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
},
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
}, /*#__PURE__*/_react["default"].createElement(_configUi.NumberTextField, {
|
|
415
|
-
label: 'Likert Value',
|
|
416
|
-
value: choice.value,
|
|
417
|
-
className: classes.width100,
|
|
418
|
-
max: 100,
|
|
419
|
-
min: -100,
|
|
420
|
-
onChange: function onChange(e, t) {
|
|
421
|
-
onChoiceChanged(index, _objectSpread(_objectSpread({}, choice), {}, {
|
|
422
|
-
value: t
|
|
423
|
-
}));
|
|
424
|
-
},
|
|
425
|
-
imageSupport: imageSupport
|
|
426
|
-
}), valuesMap[choice.value] && valuesMap[choice.value] > 1 && /*#__PURE__*/_react["default"].createElement("p", {
|
|
427
|
-
className: classes.errorMessage
|
|
428
|
-
}, "Value should be unique")));
|
|
429
|
-
}));
|
|
430
|
-
});
|
|
431
|
-
|
|
432
|
-
var Main = /*#__PURE__*/function (_React$Component) {
|
|
433
|
-
(0, _inherits2["default"])(Main, _React$Component);
|
|
434
|
-
|
|
435
|
-
var _super = _createSuper(Main);
|
|
436
|
-
|
|
437
|
-
function Main() {
|
|
438
|
-
var _this;
|
|
439
|
-
|
|
440
|
-
(0, _classCallCheck2["default"])(this, Main);
|
|
441
|
-
|
|
442
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
443
|
-
args[_key] = arguments[_key];
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
447
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChoiceChanged", function (index, choice) {
|
|
448
|
-
var _this$props = _this.props,
|
|
449
|
-
model = _this$props.model,
|
|
450
|
-
onModelChanged = _this$props.onModelChanged;
|
|
451
|
-
model.choices = model.choices.map(function (choice) {
|
|
452
|
-
return (0, _merge["default"])({}, choice);
|
|
313
|
+
})), model.choices.map((choice, index) => /*#__PURE__*/_react.default.createElement(LikertLabelHolder, {
|
|
314
|
+
key: `choice-${index}`
|
|
315
|
+
}, /*#__PURE__*/_react.default.createElement(InputFormGroupIndex, null, index + 1, "."), /*#__PURE__*/_react.default.createElement(LikertLabelInput, {
|
|
316
|
+
key: `likert-label-${index}`,
|
|
317
|
+
label: 'Likert Label'
|
|
318
|
+
}, /*#__PURE__*/_react.default.createElement(StyledEditableHtml, {
|
|
319
|
+
markup: choice.label || '',
|
|
320
|
+
onChange: c => onChoiceChanged(index, {
|
|
321
|
+
...choice,
|
|
322
|
+
label: c
|
|
323
|
+
}),
|
|
324
|
+
imageSupport: imageSupport,
|
|
325
|
+
spellCheck: spellCheckEnabled,
|
|
326
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
327
|
+
pluginProps: getPluginProps(likertChoice?.inputConfiguration)
|
|
328
|
+
})), /*#__PURE__*/_react.default.createElement(LikertValueHolder, null, /*#__PURE__*/_react.default.createElement(StyledNumberTextField, {
|
|
329
|
+
label: 'Likert Value',
|
|
330
|
+
value: choice.value,
|
|
331
|
+
max: 100,
|
|
332
|
+
min: -100,
|
|
333
|
+
onChange: (e, t) => {
|
|
334
|
+
onChoiceChanged(index, {
|
|
335
|
+
...choice,
|
|
336
|
+
value: t
|
|
453
337
|
});
|
|
338
|
+
},
|
|
339
|
+
imageSupport: imageSupport
|
|
340
|
+
}), valuesMap[choice.value] && valuesMap[choice.value] > 1 && /*#__PURE__*/_react.default.createElement(ErrorMessage, null, "Value should be unique")))));
|
|
341
|
+
};
|
|
342
|
+
class Main extends _react.default.Component {
|
|
343
|
+
constructor(...args) {
|
|
344
|
+
super(...args);
|
|
345
|
+
(0, _defineProperty2.default)(this, "onChoiceChanged", (index, choice) => {
|
|
346
|
+
const {
|
|
347
|
+
model,
|
|
348
|
+
onModelChanged
|
|
349
|
+
} = this.props;
|
|
350
|
+
model.choices = model.choices.map(choice => (0, _merge.default)({}, choice));
|
|
454
351
|
model.choices.splice(index, 1, choice);
|
|
455
352
|
onModelChanged(model);
|
|
456
353
|
});
|
|
457
|
-
(0, _defineProperty2
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
354
|
+
(0, _defineProperty2.default)(this, "onPromptChanged", prompt => {
|
|
355
|
+
this.props.onModelChanged({
|
|
356
|
+
...this.props.model,
|
|
357
|
+
prompt
|
|
358
|
+
});
|
|
461
359
|
});
|
|
462
|
-
(0, _defineProperty2
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
360
|
+
(0, _defineProperty2.default)(this, "onTeacherInstructionsChanged", teacherInstructions => {
|
|
361
|
+
this.props.onModelChanged({
|
|
362
|
+
...this.props.model,
|
|
363
|
+
teacherInstructions
|
|
364
|
+
});
|
|
466
365
|
});
|
|
467
|
-
return _this;
|
|
468
366
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}));
|
|
479
|
-
}
|
|
480
|
-
}]);
|
|
481
|
-
return Main;
|
|
482
|
-
}(_react["default"].Component);
|
|
483
|
-
|
|
367
|
+
render() {
|
|
368
|
+
return /*#__PURE__*/_react.default.createElement(Design, (0, _extends2.default)({}, this.props, {
|
|
369
|
+
onChangeModel: this.props.onModelChanged,
|
|
370
|
+
onChoiceChanged: this.onChoiceChanged,
|
|
371
|
+
onPromptChanged: this.onPromptChanged,
|
|
372
|
+
onTeacherInstructionsChanged: this.onTeacherInstructionsChanged
|
|
373
|
+
}));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
484
376
|
exports.Main = Main;
|
|
485
|
-
(0, _defineProperty2
|
|
486
|
-
model: _propTypes
|
|
487
|
-
disableSidePanel: _propTypes
|
|
488
|
-
onModelChanged: _propTypes
|
|
489
|
-
onConfigurationChanged: _propTypes
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
"delete": _propTypes["default"].func.isRequired
|
|
377
|
+
(0, _defineProperty2.default)(Main, "propTypes", {
|
|
378
|
+
model: _propTypes.default.object.isRequired,
|
|
379
|
+
disableSidePanel: _propTypes.default.bool,
|
|
380
|
+
onModelChanged: _propTypes.default.func.isRequired,
|
|
381
|
+
onConfigurationChanged: _propTypes.default.func.isRequired,
|
|
382
|
+
imageSupport: _propTypes.default.shape({
|
|
383
|
+
add: _propTypes.default.func.isRequired,
|
|
384
|
+
delete: _propTypes.default.func.isRequired
|
|
494
385
|
})
|
|
495
386
|
});
|
|
496
|
-
var
|
|
497
|
-
var _default = Styled;
|
|
498
|
-
exports["default"] = _default;
|
|
387
|
+
var _default = exports.default = Main;
|
|
499
388
|
//# sourceMappingURL=main.js.map
|