@pie-element/match 11.0.5-esm.0 → 11.1.0-next.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/CHANGELOG.md +63 -0
- package/configure/CHANGELOG.md +63 -0
- package/configure/lib/add-row.js +27 -73
- package/configure/lib/add-row.js.map +1 -1
- package/configure/lib/answer-config-block.js +262 -335
- package/configure/lib/answer-config-block.js.map +1 -1
- package/configure/lib/common.js +18 -33
- package/configure/lib/common.js.map +1 -1
- package/configure/lib/configure.js +330 -420
- package/configure/lib/configure.js.map +1 -1
- package/configure/lib/defaults.js +5 -4
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/general-config-block.js +123 -190
- package/configure/lib/general-config-block.js.map +1 -1
- package/configure/lib/index.js +117 -190
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/row.js +269 -377
- package/configure/lib/row.js.map +1 -1
- package/configure/lib/utils.js +4 -15
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +15 -14
- package/controller/CHANGELOG.md +49 -0
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +173 -301
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +6 -6
- package/lib/answer-grid.js +142 -242
- package/lib/answer-grid.js.map +1 -1
- package/lib/index.js +59 -108
- package/lib/index.js.map +1 -1
- package/lib/main.js +123 -191
- package/lib/main.js.map +1 -1
- package/package.json +18 -29
- package/esm/configure.js +0 -3936
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -428
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -472
- package/esm/element.js.map +0 -1
|
@@ -1,500 +1,410 @@
|
|
|
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
|
-
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
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
|
-
|
|
7
|
+
exports.default = exports.Config = void 0;
|
|
24
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
-
|
|
26
9
|
var _utils = require("./utils");
|
|
27
|
-
|
|
28
10
|
var _react = _interopRequireDefault(require("react"));
|
|
29
|
-
|
|
30
|
-
var _styles = require("@material-ui/core/styles");
|
|
31
|
-
|
|
11
|
+
var _styles = require("@mui/material/styles");
|
|
32
12
|
var _configUi = require("@pie-lib/config-ui");
|
|
33
|
-
|
|
34
|
-
var _editableHtml = _interopRequireDefault(require("@pie-lib/editable-html"));
|
|
35
|
-
|
|
36
|
-
var _drag = require("@pie-lib/drag");
|
|
37
|
-
|
|
13
|
+
var _editableHtmlTipTap = _interopRequireDefault(require("@pie-lib/editable-html-tip-tap"));
|
|
38
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
39
|
-
|
|
40
15
|
var _debug = _interopRequireDefault(require("debug"));
|
|
41
|
-
|
|
42
16
|
var _generalConfigBlock = _interopRequireDefault(require("./general-config-block"));
|
|
43
|
-
|
|
44
17
|
var _answerConfigBlock = _interopRequireDefault(require("./answer-config-block"));
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
(0, _inherits2["default"])(Configure, _React$Component);
|
|
77
|
-
|
|
78
|
-
var _super = _createSuper(Configure);
|
|
79
|
-
|
|
80
|
-
function Configure(props) {
|
|
81
|
-
var _this;
|
|
82
|
-
|
|
83
|
-
(0, _classCallCheck2["default"])(this, Configure);
|
|
84
|
-
_this = _super.call(this, props);
|
|
85
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onTabChange", function (event, value) {
|
|
86
|
-
_this.setState({
|
|
18
|
+
const log = (0, _debug.default)('@pie-element:match:configure');
|
|
19
|
+
const {
|
|
20
|
+
Panel,
|
|
21
|
+
toggle,
|
|
22
|
+
radio,
|
|
23
|
+
dropdown
|
|
24
|
+
} = _configUi.settings;
|
|
25
|
+
const MainLayout = (0, _styles.styled)('div')(() => ({
|
|
26
|
+
'& .promptHolder': {
|
|
27
|
+
width: '100%'
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
const PromptHolder = (0, _styles.styled)('div')(({
|
|
31
|
+
theme
|
|
32
|
+
}) => ({
|
|
33
|
+
width: '100%',
|
|
34
|
+
paddingTop: theme.spacing(2),
|
|
35
|
+
marginBottom: theme.spacing(2)
|
|
36
|
+
}));
|
|
37
|
+
const ErrorText = (0, _styles.styled)('div')(({
|
|
38
|
+
theme
|
|
39
|
+
}) => ({
|
|
40
|
+
fontSize: theme.typography.fontSize - 2,
|
|
41
|
+
color: theme.palette.error.main,
|
|
42
|
+
paddingTop: theme.spacing(1)
|
|
43
|
+
}));
|
|
44
|
+
class Configure extends _react.default.Component {
|
|
45
|
+
constructor(props) {
|
|
46
|
+
super(props);
|
|
47
|
+
(0, _defineProperty2.default)(this, "onTabChange", (event, value) => {
|
|
48
|
+
this.setState({
|
|
87
49
|
activeTab: value
|
|
88
50
|
});
|
|
89
51
|
});
|
|
90
|
-
(0, _defineProperty2
|
|
91
|
-
|
|
52
|
+
(0, _defineProperty2.default)(this, "onChangeTabIndex", index => {
|
|
53
|
+
this.setState({
|
|
92
54
|
activeTab: index
|
|
93
55
|
});
|
|
94
56
|
});
|
|
95
|
-
(0, _defineProperty2
|
|
96
|
-
|
|
57
|
+
(0, _defineProperty2.default)(this, "onChange", model => {
|
|
58
|
+
this.props.onModelChanged(model);
|
|
97
59
|
});
|
|
98
|
-
(0, _defineProperty2
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
60
|
+
(0, _defineProperty2.default)(this, "onFeedbackChange", feedback => {
|
|
61
|
+
const {
|
|
62
|
+
model,
|
|
63
|
+
onModelChanged
|
|
64
|
+
} = this.props;
|
|
102
65
|
model.feedback = feedback;
|
|
103
66
|
onModelChanged(model);
|
|
104
67
|
});
|
|
105
|
-
(0, _defineProperty2
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
68
|
+
(0, _defineProperty2.default)(this, "onDeleteRow", rowIndex => {
|
|
69
|
+
const {
|
|
70
|
+
model
|
|
71
|
+
} = this.props;
|
|
72
|
+
const newModel = {
|
|
73
|
+
...model
|
|
74
|
+
};
|
|
110
75
|
newModel.rows.splice(rowIndex, 1);
|
|
111
|
-
|
|
112
|
-
_this.onChange(newModel);
|
|
76
|
+
this.onChange(newModel);
|
|
113
77
|
});
|
|
114
|
-
(0, _defineProperty2
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
78
|
+
(0, _defineProperty2.default)(this, "onAddRow", () => {
|
|
79
|
+
const {
|
|
80
|
+
model,
|
|
81
|
+
configuration
|
|
82
|
+
} = this.props;
|
|
83
|
+
const newModel = {
|
|
84
|
+
...model
|
|
85
|
+
};
|
|
86
|
+
const {
|
|
87
|
+
maxQuestions
|
|
88
|
+
} = configuration || {};
|
|
124
89
|
if (maxQuestions && (newModel.rows || []).length >= maxQuestions) {
|
|
125
|
-
|
|
90
|
+
this.setState({
|
|
126
91
|
dialog: {
|
|
127
92
|
open: true,
|
|
128
|
-
text:
|
|
93
|
+
text: `There can be maximum ${maxQuestions} question row` + (maxQuestions > 1 ? 's' : '') + '.'
|
|
129
94
|
}
|
|
130
95
|
});
|
|
131
|
-
|
|
132
96
|
return;
|
|
133
97
|
}
|
|
134
|
-
|
|
135
98
|
newModel.rows = newModel.rows.concat({
|
|
136
|
-
id:
|
|
137
|
-
title:
|
|
99
|
+
id: this.rowIdCounter + 1,
|
|
100
|
+
title: `Question Text ${(newModel.rows || []).length + 1}`,
|
|
138
101
|
values: new Array(model.layout - 1).fill(false)
|
|
139
102
|
});
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
_this.onChange(newModel);
|
|
103
|
+
this.rowIdCounter += 1;
|
|
104
|
+
this.onChange(newModel);
|
|
143
105
|
});
|
|
144
|
-
(0, _defineProperty2
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
106
|
+
(0, _defineProperty2.default)(this, "onLayoutChange", newLayout => {
|
|
107
|
+
const {
|
|
108
|
+
model
|
|
109
|
+
} = this.props;
|
|
110
|
+
const oldLayout = model.layout;
|
|
111
|
+
const newModel = {
|
|
112
|
+
...model
|
|
113
|
+
};
|
|
150
114
|
if (newLayout > oldLayout) {
|
|
151
|
-
for (
|
|
152
|
-
newModel.headers.push(
|
|
115
|
+
for (let i = 0; i < newLayout - oldLayout; i++) {
|
|
116
|
+
newModel.headers.push(`Column ${newModel.headers.length + 1}`);
|
|
153
117
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
for (var _i = 0; _i < newLayout - oldLayout; _i++) {
|
|
118
|
+
newModel.rows.forEach(row => {
|
|
119
|
+
for (let i = 0; i < newLayout - oldLayout; i++) {
|
|
157
120
|
row.values.push(false);
|
|
158
121
|
}
|
|
159
122
|
});
|
|
160
123
|
} else if (newLayout < oldLayout) {
|
|
161
124
|
newModel.headers.splice(newLayout);
|
|
162
|
-
newModel.rows.forEach(
|
|
125
|
+
newModel.rows.forEach(row => {
|
|
163
126
|
row.values.splice(newLayout - 1);
|
|
164
127
|
});
|
|
165
128
|
}
|
|
166
|
-
|
|
167
129
|
newModel.layout = newLayout;
|
|
168
|
-
|
|
169
|
-
_this.onChange(newModel);
|
|
130
|
+
this.onChange(newModel);
|
|
170
131
|
});
|
|
171
|
-
(0, _defineProperty2
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
132
|
+
(0, _defineProperty2.default)(this, "onResponseTypeChange", newChoiceMode => {
|
|
133
|
+
const {
|
|
134
|
+
model
|
|
135
|
+
} = this.props;
|
|
136
|
+
const newModel = {
|
|
137
|
+
...model
|
|
138
|
+
};
|
|
176
139
|
|
|
140
|
+
// if we're switching to radio and we have more than one true, reset
|
|
177
141
|
if (newChoiceMode === 'radio') {
|
|
178
|
-
newModel.rows.forEach(
|
|
179
|
-
|
|
180
|
-
return current === true ? total + 1 : total;
|
|
181
|
-
});
|
|
182
|
-
|
|
142
|
+
newModel.rows.forEach(row => {
|
|
143
|
+
const trueCount = row.values.reduce((total, current) => current === true ? total + 1 : total);
|
|
183
144
|
if (trueCount > 1) {
|
|
184
145
|
row.values = new Array(model.layout - 1).fill(false);
|
|
185
146
|
}
|
|
186
147
|
});
|
|
187
148
|
}
|
|
188
|
-
|
|
189
149
|
newModel.choiceMode = newChoiceMode;
|
|
190
|
-
|
|
191
|
-
_this.onChange(newModel);
|
|
150
|
+
this.onChange(newModel);
|
|
192
151
|
});
|
|
193
|
-
(0, _defineProperty2
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
_this.props.onModelChanged(_this.props.model);
|
|
152
|
+
(0, _defineProperty2.default)(this, "onPartialScoringChange", partialScoring => {
|
|
153
|
+
this.props.model.partialScoring = partialScoring;
|
|
154
|
+
this.props.onModelChanged(this.props.model);
|
|
197
155
|
});
|
|
198
|
-
(0, _defineProperty2
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
156
|
+
(0, _defineProperty2.default)(this, "onPromptChanged", prompt => {
|
|
157
|
+
this.props.onModelChanged({
|
|
158
|
+
...this.props.model,
|
|
159
|
+
prompt
|
|
160
|
+
});
|
|
202
161
|
});
|
|
203
|
-
(0, _defineProperty2
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
162
|
+
(0, _defineProperty2.default)(this, "onTeacherInstructionsChanged", teacherInstructions => {
|
|
163
|
+
this.props.onModelChanged({
|
|
164
|
+
...this.props.model,
|
|
165
|
+
teacherInstructions
|
|
166
|
+
});
|
|
207
167
|
});
|
|
208
|
-
(0, _defineProperty2
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
168
|
+
(0, _defineProperty2.default)(this, "onRationaleChanged", rationale => {
|
|
169
|
+
this.props.onModelChanged({
|
|
170
|
+
...this.props.model,
|
|
171
|
+
rationale
|
|
172
|
+
});
|
|
212
173
|
});
|
|
213
|
-
|
|
214
|
-
|
|
174
|
+
let maxId = 0;
|
|
215
175
|
if (props.model.rows && props.model.rows.length > 0) {
|
|
216
|
-
maxId = Math.max
|
|
217
|
-
return row.id;
|
|
218
|
-
})));
|
|
176
|
+
maxId = Math.max(...props.model.rows.map(row => row.id));
|
|
219
177
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
_this.state = {
|
|
178
|
+
this.rowIdCounter = maxId + 1;
|
|
179
|
+
this.state = {
|
|
223
180
|
activeTab: 0,
|
|
224
181
|
dialog: {
|
|
225
182
|
open: false,
|
|
226
183
|
text: ''
|
|
227
184
|
}
|
|
228
185
|
};
|
|
229
|
-
return _this;
|
|
230
186
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
var newModel = _objectSpread(_objectSpread({}, this.props.model), {}, {
|
|
241
|
-
rows: updatedRows
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
this.props.onModelChanged(newModel);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}, {
|
|
248
|
-
key: "validateRowsID",
|
|
249
|
-
value: function validateRowsID(rows) {
|
|
250
|
-
var wasChanged = false;
|
|
251
|
-
var updatedRows = (rows || []).map(function (row, index) {
|
|
252
|
-
if (row.id !== index + 1) {
|
|
253
|
-
wasChanged = true;
|
|
254
|
-
return _objectSpread(_objectSpread({}, row), {}, {
|
|
255
|
-
id: index + 1
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return row;
|
|
260
|
-
});
|
|
261
|
-
return {
|
|
262
|
-
updatedRows: updatedRows,
|
|
263
|
-
wasChanged: wasChanged
|
|
187
|
+
componentDidMount() {
|
|
188
|
+
const {
|
|
189
|
+
updatedRows,
|
|
190
|
+
wasChanged
|
|
191
|
+
} = this.validateRowsID(this.props.model.rows);
|
|
192
|
+
if (wasChanged) {
|
|
193
|
+
const newModel = {
|
|
194
|
+
...this.props.model,
|
|
195
|
+
rows: updatedRows
|
|
264
196
|
};
|
|
197
|
+
this.props.onModelChanged(newModel);
|
|
265
198
|
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
358
|
-
model: model,
|
|
359
|
-
configuration: configuration,
|
|
360
|
-
onChangeModel: function onChangeModel(model) {
|
|
361
|
-
return onModelChanged(model);
|
|
362
|
-
},
|
|
363
|
-
onChangeConfiguration: function onChangeConfiguration(config) {
|
|
364
|
-
return onConfigurationChanged(config);
|
|
365
|
-
},
|
|
366
|
-
groups: {
|
|
367
|
-
Settings: panelSettings,
|
|
368
|
-
Properties: panelProperties
|
|
369
|
-
}
|
|
370
|
-
})
|
|
371
|
-
}, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
372
|
-
label: teacherInstructions.label,
|
|
373
|
-
className: classes.promptHolder
|
|
374
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
375
|
-
className: classes.prompt,
|
|
376
|
-
markup: model.teacherInstructions || '',
|
|
377
|
-
onChange: this.onTeacherInstructionsChanged,
|
|
378
|
-
imageSupport: imageSupport,
|
|
379
|
-
error: teacherInstructionsError,
|
|
380
|
-
nonEmpty: false,
|
|
381
|
-
toolbarOpts: toolbarOpts,
|
|
382
|
-
pluginProps: (0, _utils.getPluginProps)(teacherInstructions === null || teacherInstructions === void 0 ? void 0 : teacherInstructions.inputConfiguration, baseInputConfiguration),
|
|
383
|
-
spellCheck: spellCheckEnabled,
|
|
384
|
-
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
385
|
-
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
386
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
387
|
-
languageCharactersProps: [{
|
|
388
|
-
language: 'spanish'
|
|
389
|
-
}, {
|
|
390
|
-
language: 'special'
|
|
391
|
-
}]
|
|
392
|
-
}), teacherInstructionsError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
393
|
-
className: classes.errorText
|
|
394
|
-
}, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
395
|
-
label: prompt.label,
|
|
396
|
-
className: classes.promptHolder
|
|
397
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
398
|
-
className: classes.prompt,
|
|
399
|
-
markup: model.prompt,
|
|
400
|
-
onChange: this.onPromptChanged,
|
|
401
|
-
imageSupport: imageSupport,
|
|
402
|
-
error: promptError,
|
|
403
|
-
nonEmpty: false,
|
|
404
|
-
disableUnderline: true,
|
|
405
|
-
toolbarOpts: toolbarOpts,
|
|
406
|
-
pluginProps: (0, _utils.getPluginProps)(prompt === null || prompt === void 0 ? void 0 : prompt.inputConfiguration, baseInputConfiguration),
|
|
407
|
-
spellCheck: spellCheckEnabled,
|
|
408
|
-
maxImageWidth: maxImageWidth && maxImageWidth.prompt,
|
|
409
|
-
maxImageHeight: maxImageHeight && maxImageHeight.prompt,
|
|
410
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
411
|
-
languageCharactersProps: [{
|
|
412
|
-
language: 'spanish'
|
|
413
|
-
}, {
|
|
414
|
-
language: 'special'
|
|
415
|
-
}]
|
|
416
|
-
}), promptError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
417
|
-
className: classes.errorText
|
|
418
|
-
}, promptError)), /*#__PURE__*/_react["default"].createElement(_generalConfigBlock["default"], {
|
|
419
|
-
model: model,
|
|
420
|
-
configuration: configuration,
|
|
421
|
-
onResponseTypeChange: this.onResponseTypeChange,
|
|
422
|
-
onLayoutChange: this.onLayoutChange
|
|
423
|
-
}), /*#__PURE__*/_react["default"].createElement(_answerConfigBlock["default"], {
|
|
199
|
+
}
|
|
200
|
+
validateRowsID(rows) {
|
|
201
|
+
let wasChanged = false;
|
|
202
|
+
const updatedRows = (rows || []).map((row, index) => {
|
|
203
|
+
if (row.id !== index + 1) {
|
|
204
|
+
wasChanged = true;
|
|
205
|
+
return {
|
|
206
|
+
...row,
|
|
207
|
+
id: index + 1
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
return row;
|
|
211
|
+
});
|
|
212
|
+
return {
|
|
213
|
+
updatedRows,
|
|
214
|
+
wasChanged
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
render() {
|
|
218
|
+
const {
|
|
219
|
+
model,
|
|
220
|
+
imageSupport,
|
|
221
|
+
onModelChanged,
|
|
222
|
+
configuration,
|
|
223
|
+
onConfigurationChanged,
|
|
224
|
+
uploadSoundSupport
|
|
225
|
+
} = this.props;
|
|
226
|
+
const {
|
|
227
|
+
baseInputConfiguration = {},
|
|
228
|
+
contentDimensions = {},
|
|
229
|
+
feedback = {},
|
|
230
|
+
lockChoiceOrder = {},
|
|
231
|
+
maxImageWidth = {},
|
|
232
|
+
maxImageHeight = {},
|
|
233
|
+
partialScoring = {},
|
|
234
|
+
prompt = {},
|
|
235
|
+
rationale = {},
|
|
236
|
+
settingsPanelDisabled,
|
|
237
|
+
scoringType = {},
|
|
238
|
+
spellCheck = {},
|
|
239
|
+
studentInstructions = {},
|
|
240
|
+
teacherInstructions = {},
|
|
241
|
+
withRubric = {},
|
|
242
|
+
language = {},
|
|
243
|
+
languageChoices = {}
|
|
244
|
+
} = configuration || {};
|
|
245
|
+
const {
|
|
246
|
+
errors,
|
|
247
|
+
extraCSSRules,
|
|
248
|
+
feedbackEnabled,
|
|
249
|
+
promptEnabled,
|
|
250
|
+
rationaleEnabled,
|
|
251
|
+
spellCheckEnabled,
|
|
252
|
+
teacherInstructionsEnabled,
|
|
253
|
+
toolbarEditorPosition
|
|
254
|
+
} = model || {};
|
|
255
|
+
const {
|
|
256
|
+
prompt: promptError,
|
|
257
|
+
rationale: rationaleError,
|
|
258
|
+
teacherInstructions: teacherInstructionsError
|
|
259
|
+
} = errors || {};
|
|
260
|
+
const {
|
|
261
|
+
dialog
|
|
262
|
+
} = this.state;
|
|
263
|
+
const toolbarOpts = {
|
|
264
|
+
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
265
|
+
};
|
|
266
|
+
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
267
|
+
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
268
|
+
const panelSettings = {
|
|
269
|
+
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
270
|
+
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
271
|
+
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
272
|
+
'language.enabled': language.settings && toggle(language.label, true),
|
|
273
|
+
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
|
|
274
|
+
};
|
|
275
|
+
const panelProperties = {
|
|
276
|
+
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
277
|
+
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
278
|
+
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
279
|
+
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
280
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
281
|
+
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
|
|
282
|
+
rubricEnabled: withRubric?.settings && toggle(withRubric?.label)
|
|
283
|
+
};
|
|
284
|
+
log('[render] model', model);
|
|
285
|
+
return /*#__PURE__*/_react.default.createElement(MainLayout, null, /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
|
|
286
|
+
extraCSSRules: extraCSSRules,
|
|
287
|
+
dimensions: contentDimensions,
|
|
288
|
+
hideSettings: settingsPanelDisabled,
|
|
289
|
+
settings: /*#__PURE__*/_react.default.createElement(Panel, {
|
|
424
290
|
model: model,
|
|
425
291
|
configuration: configuration,
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
spellCheck: spellCheckEnabled,
|
|
432
|
-
uploadSoundSupport: uploadSoundSupport
|
|
433
|
-
}), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
434
|
-
label: rationale.label,
|
|
435
|
-
className: classes.promptHolder
|
|
436
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
437
|
-
className: classes.prompt,
|
|
438
|
-
markup: model.rationale || '',
|
|
439
|
-
onChange: this.onRationaleChanged,
|
|
440
|
-
imageSupport: imageSupport,
|
|
441
|
-
error: rationaleError,
|
|
442
|
-
toolbarOpts: toolbarOpts,
|
|
443
|
-
pluginProps: (0, _utils.getPluginProps)(rationale === null || rationale === void 0 ? void 0 : rationale.inputConfiguration, baseInputConfiguration),
|
|
444
|
-
spellCheck: spellCheckEnabled,
|
|
445
|
-
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
446
|
-
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
447
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
448
|
-
languageCharactersProps: [{
|
|
449
|
-
language: 'spanish'
|
|
450
|
-
}, {
|
|
451
|
-
language: 'special'
|
|
452
|
-
}]
|
|
453
|
-
}), rationaleError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
454
|
-
className: classes.errorText
|
|
455
|
-
}, rationaleError)), feedbackEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.FeedbackConfig, {
|
|
456
|
-
feedback: model.feedback,
|
|
457
|
-
onChange: this.onFeedbackChange,
|
|
458
|
-
toolbarOpts: toolbarOpts
|
|
459
|
-
}), /*#__PURE__*/_react["default"].createElement(_configUi.AlertDialog, {
|
|
460
|
-
open: dialog.open,
|
|
461
|
-
title: "Warning",
|
|
462
|
-
text: dialog.text,
|
|
463
|
-
onConfirm: function onConfirm() {
|
|
464
|
-
return _this2.setState({
|
|
465
|
-
dialog: {
|
|
466
|
-
open: false
|
|
467
|
-
}
|
|
468
|
-
});
|
|
292
|
+
onChangeModel: model => onModelChanged(model),
|
|
293
|
+
onChangeConfiguration: config => onConfigurationChanged(config),
|
|
294
|
+
groups: {
|
|
295
|
+
Settings: panelSettings,
|
|
296
|
+
Properties: panelProperties
|
|
469
297
|
}
|
|
470
|
-
})
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}(_react
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
298
|
+
})
|
|
299
|
+
}, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(_configUi.InputContainer, {
|
|
300
|
+
label: teacherInstructions.label,
|
|
301
|
+
className: "promptHolder"
|
|
302
|
+
}, /*#__PURE__*/_react.default.createElement(PromptHolder, null, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
303
|
+
className: "prompt",
|
|
304
|
+
markup: model.teacherInstructions || '',
|
|
305
|
+
onChange: this.onTeacherInstructionsChanged,
|
|
306
|
+
imageSupport: imageSupport,
|
|
307
|
+
error: teacherInstructionsError,
|
|
308
|
+
nonEmpty: false,
|
|
309
|
+
toolbarOpts: toolbarOpts,
|
|
310
|
+
pluginProps: (0, _utils.getPluginProps)(teacherInstructions?.inputConfiguration, baseInputConfiguration),
|
|
311
|
+
spellCheck: spellCheckEnabled,
|
|
312
|
+
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
313
|
+
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
314
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
315
|
+
languageCharactersProps: [{
|
|
316
|
+
language: 'spanish'
|
|
317
|
+
}, {
|
|
318
|
+
language: 'special'
|
|
319
|
+
}]
|
|
320
|
+
}), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError))), promptEnabled && /*#__PURE__*/_react.default.createElement(_configUi.InputContainer, {
|
|
321
|
+
label: prompt.label,
|
|
322
|
+
className: "promptHolder"
|
|
323
|
+
}, /*#__PURE__*/_react.default.createElement(PromptHolder, null, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
324
|
+
className: "prompt",
|
|
325
|
+
markup: model.prompt,
|
|
326
|
+
onChange: this.onPromptChanged,
|
|
327
|
+
imageSupport: imageSupport,
|
|
328
|
+
error: promptError,
|
|
329
|
+
nonEmpty: false,
|
|
330
|
+
disableUnderline: true,
|
|
331
|
+
toolbarOpts: toolbarOpts,
|
|
332
|
+
pluginProps: (0, _utils.getPluginProps)(prompt?.inputConfiguration, baseInputConfiguration),
|
|
333
|
+
spellCheck: spellCheckEnabled,
|
|
334
|
+
maxImageWidth: maxImageWidth && maxImageWidth.prompt,
|
|
335
|
+
maxImageHeight: maxImageHeight && maxImageHeight.prompt,
|
|
336
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
337
|
+
languageCharactersProps: [{
|
|
338
|
+
language: 'spanish'
|
|
339
|
+
}, {
|
|
340
|
+
language: 'special'
|
|
341
|
+
}]
|
|
342
|
+
}), promptError && /*#__PURE__*/_react.default.createElement(ErrorText, null, promptError))), /*#__PURE__*/_react.default.createElement(_generalConfigBlock.default, {
|
|
343
|
+
model: model,
|
|
344
|
+
configuration: configuration,
|
|
345
|
+
onResponseTypeChange: this.onResponseTypeChange,
|
|
346
|
+
onLayoutChange: this.onLayoutChange
|
|
347
|
+
}), /*#__PURE__*/_react.default.createElement(_answerConfigBlock.default, {
|
|
348
|
+
model: model,
|
|
349
|
+
configuration: configuration,
|
|
350
|
+
imageSupport: imageSupport,
|
|
351
|
+
onChange: this.onChange,
|
|
352
|
+
onAddRow: this.onAddRow,
|
|
353
|
+
onDeleteRow: this.onDeleteRow,
|
|
354
|
+
toolbarOpts: toolbarOpts,
|
|
355
|
+
spellCheck: spellCheckEnabled,
|
|
356
|
+
uploadSoundSupport: uploadSoundSupport
|
|
357
|
+
}), rationaleEnabled && /*#__PURE__*/_react.default.createElement(_configUi.InputContainer, {
|
|
358
|
+
label: rationale.label,
|
|
359
|
+
className: "promptHolder"
|
|
360
|
+
}, /*#__PURE__*/_react.default.createElement(PromptHolder, null, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
361
|
+
className: "prompt",
|
|
362
|
+
markup: model.rationale || '',
|
|
363
|
+
onChange: this.onRationaleChanged,
|
|
364
|
+
imageSupport: imageSupport,
|
|
365
|
+
error: rationaleError,
|
|
366
|
+
toolbarOpts: toolbarOpts,
|
|
367
|
+
pluginProps: (0, _utils.getPluginProps)(rationale?.inputConfiguration, baseInputConfiguration),
|
|
368
|
+
spellCheck: spellCheckEnabled,
|
|
369
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
370
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
371
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
372
|
+
languageCharactersProps: [{
|
|
373
|
+
language: 'spanish'
|
|
374
|
+
}, {
|
|
375
|
+
language: 'special'
|
|
376
|
+
}]
|
|
377
|
+
}), rationaleError && /*#__PURE__*/_react.default.createElement(ErrorText, null, rationaleError))), feedbackEnabled && /*#__PURE__*/_react.default.createElement(_configUi.FeedbackConfig, {
|
|
378
|
+
feedback: model.feedback,
|
|
379
|
+
onChange: this.onFeedbackChange,
|
|
380
|
+
toolbarOpts: toolbarOpts
|
|
381
|
+
}), /*#__PURE__*/_react.default.createElement(_configUi.AlertDialog, {
|
|
382
|
+
open: dialog.open,
|
|
383
|
+
title: "Warning",
|
|
384
|
+
text: dialog.text,
|
|
385
|
+
onConfirm: () => this.setState({
|
|
386
|
+
dialog: {
|
|
387
|
+
open: false
|
|
388
|
+
}
|
|
389
|
+
})
|
|
390
|
+
})));
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
(0, _defineProperty2.default)(Configure, "propTypes", {
|
|
394
|
+
onModelChanged: _propTypes.default.func,
|
|
395
|
+
onConfigurationChanged: _propTypes.default.func,
|
|
396
|
+
model: _propTypes.default.object.isRequired,
|
|
397
|
+
configuration: _propTypes.default.object.isRequired,
|
|
398
|
+
imageSupport: _propTypes.default.shape({
|
|
399
|
+
add: _propTypes.default.func.isRequired,
|
|
400
|
+
delete: _propTypes.default.func.isRequired
|
|
485
401
|
}),
|
|
486
|
-
uploadSoundSupport: _propTypes
|
|
487
|
-
add: _propTypes
|
|
488
|
-
|
|
402
|
+
uploadSoundSupport: _propTypes.default.shape({
|
|
403
|
+
add: _propTypes.default.func.isRequired,
|
|
404
|
+
delete: _propTypes.default.func.isRequired
|
|
489
405
|
})
|
|
490
406
|
});
|
|
491
|
-
(0, _defineProperty2
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
var Config = Configure;
|
|
495
|
-
exports.Config = Config;
|
|
496
|
-
|
|
497
|
-
var _default = (0, _drag.withDragContext)((0, _styles.withStyles)(styles)(Configure));
|
|
498
|
-
|
|
499
|
-
exports["default"] = _default;
|
|
407
|
+
(0, _defineProperty2.default)(Configure, "defaultProps", {});
|
|
408
|
+
const Config = exports.Config = Configure;
|
|
409
|
+
var _default = exports.default = Configure;
|
|
500
410
|
//# sourceMappingURL=configure.js.map
|