@pie-element/graphing 8.3.4-next.3 → 9.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/configure.js +305 -405
- package/configure/lib/configure.js.map +1 -1
- package/configure/lib/correct-response.js +396 -513
- package/configure/lib/correct-response.js.map +1 -1
- package/configure/lib/defaults.js +4 -4
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/graphing-config.js +312 -359
- package/configure/lib/graphing-config.js.map +1 -1
- package/configure/lib/index.js +130 -189
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/utils.js +43 -88
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +11 -8
- package/controller/lib/defaults.js +5 -5
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +180 -267
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +301 -311
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +5 -5
- package/lib/index.js +48 -96
- package/lib/index.js.map +1 -1
- package/lib/main.js +143 -210
- package/lib/main.js.map +1 -1
- package/lib/utils.js +5 -19
- package/lib/utils.js.map +1 -1
- package/package.json +12 -9
- package/esm/configure.js +0 -46697
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -22888
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -8518
- package/esm/element.js.map +0 -1
- package/esm/package.json +0 -3
|
@@ -1,428 +1,328 @@
|
|
|
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 _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
7
|
+
exports.default = exports.Configure = void 0;
|
|
22
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
9
|
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
|
|
26
|
-
var _styles = require("@material-ui/core/styles");
|
|
27
|
-
|
|
28
|
-
var _configUi = require("@pie-lib/config-ui");
|
|
29
|
-
|
|
30
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
11
|
var _debug = _interopRequireDefault(require("debug"));
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
12
|
+
var _intersection = _interopRequireDefault(require("lodash/intersection"));
|
|
13
|
+
var _styles = require("@mui/material/styles");
|
|
14
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
15
|
+
var _configUi = require("@pie-lib/config-ui");
|
|
36
16
|
var _editableHtml = _interopRequireDefault(require("@pie-lib/editable-html"));
|
|
37
|
-
|
|
38
17
|
var _graphingConfig = _interopRequireDefault(require("./graphing-config"));
|
|
39
|
-
|
|
40
18
|
var _correctResponse = _interopRequireDefault(require("./correct-response"));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
var Configure = /*#__PURE__*/function (_React$Component) {
|
|
85
|
-
(0, _inherits2["default"])(Configure, _React$Component);
|
|
86
|
-
|
|
87
|
-
var _super = _createSuper(Configure);
|
|
88
|
-
|
|
89
|
-
function Configure() {
|
|
90
|
-
var _this;
|
|
91
|
-
|
|
92
|
-
(0, _classCallCheck2["default"])(this, Configure);
|
|
93
|
-
|
|
94
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
95
|
-
args[_key] = arguments[_key];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
99
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRationaleChange", function (rationale) {
|
|
100
|
-
var _this$props = _this.props,
|
|
101
|
-
onModelChanged = _this$props.onModelChanged,
|
|
102
|
-
model = _this$props.model;
|
|
103
|
-
onModelChanged(_objectSpread(_objectSpread({}, model), {}, {
|
|
104
|
-
rationale: rationale
|
|
105
|
-
}));
|
|
19
|
+
const {
|
|
20
|
+
Panel,
|
|
21
|
+
toggle,
|
|
22
|
+
radio,
|
|
23
|
+
checkboxes,
|
|
24
|
+
textField,
|
|
25
|
+
dropdown
|
|
26
|
+
} = _configUi.settings;
|
|
27
|
+
const log = (0, _debug.default)('@pie-element:graphing:configure');
|
|
28
|
+
const StyledInputContainer = (0, _styles.styled)(_configUi.InputContainer)(({
|
|
29
|
+
theme
|
|
30
|
+
}) => ({
|
|
31
|
+
width: '100%',
|
|
32
|
+
paddingTop: theme.spacing(2),
|
|
33
|
+
marginBottom: theme.spacing(2)
|
|
34
|
+
}));
|
|
35
|
+
const Description = (0, _styles.styled)(_Typography.default)(({
|
|
36
|
+
theme
|
|
37
|
+
}) => ({
|
|
38
|
+
marginBottom: theme.spacing(2.5)
|
|
39
|
+
}));
|
|
40
|
+
const ErrorText = (0, _styles.styled)('div')(({
|
|
41
|
+
theme
|
|
42
|
+
}) => ({
|
|
43
|
+
fontSize: theme.typography.fontSize - 2,
|
|
44
|
+
color: theme.palette.error.main,
|
|
45
|
+
paddingTop: theme.spacing(1)
|
|
46
|
+
}));
|
|
47
|
+
class Configure extends _react.default.Component {
|
|
48
|
+
constructor(...args) {
|
|
49
|
+
super(...args);
|
|
50
|
+
(0, _defineProperty2.default)(this, "onRationaleChange", rationale => {
|
|
51
|
+
const {
|
|
52
|
+
onModelChanged,
|
|
53
|
+
model
|
|
54
|
+
} = this.props;
|
|
55
|
+
onModelChanged({
|
|
56
|
+
...model,
|
|
57
|
+
rationale
|
|
58
|
+
});
|
|
106
59
|
});
|
|
107
|
-
(0, _defineProperty2
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
60
|
+
(0, _defineProperty2.default)(this, "onPromptChange", prompt => {
|
|
61
|
+
const {
|
|
62
|
+
onModelChanged,
|
|
63
|
+
model
|
|
64
|
+
} = this.props;
|
|
65
|
+
onModelChanged({
|
|
66
|
+
...model,
|
|
67
|
+
prompt
|
|
68
|
+
});
|
|
114
69
|
});
|
|
115
|
-
(0, _defineProperty2
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
70
|
+
(0, _defineProperty2.default)(this, "onTeacherInstructionsChange", teacherInstructions => {
|
|
71
|
+
const {
|
|
72
|
+
onModelChanged,
|
|
73
|
+
model
|
|
74
|
+
} = this.props;
|
|
75
|
+
onModelChanged({
|
|
76
|
+
...model,
|
|
77
|
+
teacherInstructions
|
|
78
|
+
});
|
|
122
79
|
});
|
|
123
|
-
return _this;
|
|
124
80
|
}
|
|
125
|
-
|
|
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
|
-
down: false
|
|
160
|
-
};
|
|
161
|
-
}
|
|
81
|
+
componentDidMount() {
|
|
82
|
+
const {
|
|
83
|
+
configuration,
|
|
84
|
+
onModelChanged,
|
|
85
|
+
model
|
|
86
|
+
} = this.props;
|
|
87
|
+
const {
|
|
88
|
+
availableTools,
|
|
89
|
+
title,
|
|
90
|
+
graphDimensions
|
|
91
|
+
} = configuration || {};
|
|
92
|
+
let {
|
|
93
|
+
arrows,
|
|
94
|
+
titleEnabled: showTitle,
|
|
95
|
+
dimensionsEnabled: showDimensions
|
|
96
|
+
} = model || {};
|
|
97
|
+
|
|
98
|
+
// This is used for offering support for old models which have the property arrows: boolean
|
|
99
|
+
// Same thing is set in the controller: packages/graphing/controller/src/index.js - model
|
|
100
|
+
if (typeof arrows === 'boolean') {
|
|
101
|
+
if (arrows) {
|
|
102
|
+
arrows = {
|
|
103
|
+
left: true,
|
|
104
|
+
right: true,
|
|
105
|
+
up: true,
|
|
106
|
+
down: true
|
|
107
|
+
};
|
|
108
|
+
} else {
|
|
109
|
+
arrows = {
|
|
110
|
+
left: false,
|
|
111
|
+
right: false,
|
|
112
|
+
up: false,
|
|
113
|
+
down: false
|
|
114
|
+
};
|
|
162
115
|
}
|
|
163
|
-
|
|
164
|
-
var toolbarTools = (0, _intersection["default"])(availableTools || [], model.toolbarTools || []);
|
|
165
|
-
var titleEnabled = showTitle === undefined || showTitle === null ? title.enabled : showTitle;
|
|
166
|
-
var dimensionsEnabled = showDimensions === undefined || showDimensions === null ? graphDimensions.enabled : showDimensions;
|
|
167
|
-
onModelChanged && onModelChanged(_objectSpread(_objectSpread({}, model), {}, {
|
|
168
|
-
arrows: arrows,
|
|
169
|
-
toolbarTools: toolbarTools,
|
|
170
|
-
titleEnabled: titleEnabled,
|
|
171
|
-
dimensionsEnabled: dimensionsEnabled
|
|
172
|
-
}));
|
|
173
116
|
}
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
283
|
-
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
284
|
-
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
285
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
286
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
287
|
-
scoringType: scoringType.settings && radio(scoringType.label, ['dichotomous', 'partial scoring']),
|
|
288
|
-
rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label),
|
|
289
|
-
instruction: instruction.settings && textField(instruction.label)
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
var getPluginProps = function getPluginProps() {
|
|
293
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
294
|
-
return _objectSpread(_objectSpread({}, baseInputConfiguration), props);
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
298
|
-
extraCSSRules: extraCSSRules,
|
|
299
|
-
dimensions: contentDimensions,
|
|
300
|
-
hideSettings: settingsPanelDisabled,
|
|
301
|
-
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
302
|
-
model: model,
|
|
303
|
-
configuration: configuration,
|
|
304
|
-
onChangeModel: onModelChanged,
|
|
305
|
-
onChangeConfiguration: onConfigurationChanged,
|
|
306
|
-
groups: {
|
|
307
|
-
Settings: panelItemType,
|
|
308
|
-
Properties: panelProperties
|
|
309
|
-
}
|
|
310
|
-
})
|
|
311
|
-
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
312
|
-
component: "div",
|
|
313
|
-
type: "body1",
|
|
314
|
-
className: classes.description
|
|
315
|
-
}, (instruction === null || instruction === void 0 ? void 0 : instruction.label) || ''), teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
316
|
-
label: teacherInstructions.label,
|
|
317
|
-
className: classes.promptHolder
|
|
318
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
319
|
-
className: classes.prompt,
|
|
320
|
-
markup: model.teacherInstructions || '',
|
|
321
|
-
onChange: this.onTeacherInstructionsChange,
|
|
322
|
-
imageSupport: imageSupport,
|
|
323
|
-
error: teacherInstructionsError,
|
|
324
|
-
nonEmpty: false,
|
|
325
|
-
pluginProps: getPluginProps(teacherInstructions === null || teacherInstructions === void 0 ? void 0 : teacherInstructions.inputConfiguration),
|
|
326
|
-
spellCheck: spellCheckEnabled,
|
|
327
|
-
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
328
|
-
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
329
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
330
|
-
languageCharactersProps: [{
|
|
331
|
-
language: 'spanish'
|
|
332
|
-
}, {
|
|
333
|
-
language: 'special'
|
|
334
|
-
}],
|
|
335
|
-
mathMlOptions: mathMlOptions
|
|
336
|
-
}), teacherInstructionsError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
337
|
-
className: classes.errorText
|
|
338
|
-
}, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
339
|
-
label: prompt.label,
|
|
340
|
-
className: classes.promptHolder
|
|
341
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
342
|
-
className: classes.prompt,
|
|
343
|
-
markup: model.prompt,
|
|
344
|
-
onChange: this.onPromptChange,
|
|
345
|
-
imageSupport: imageSupport,
|
|
346
|
-
error: promptError,
|
|
347
|
-
nonEmpty: false,
|
|
348
|
-
spellCheck: spellCheckEnabled,
|
|
349
|
-
pluginProps: getPluginProps(prompt === null || prompt === void 0 ? void 0 : prompt.inputConfiguration),
|
|
350
|
-
disableUnderline: true,
|
|
351
|
-
maxImageWidth: defaultImageMaxWidth,
|
|
352
|
-
maxImageHeight: defaultImageMaxHeight,
|
|
353
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
354
|
-
languageCharactersProps: [{
|
|
355
|
-
language: 'spanish'
|
|
356
|
-
}, {
|
|
357
|
-
language: 'special'
|
|
358
|
-
}],
|
|
359
|
-
mathMlOptions: mathMlOptions
|
|
360
|
-
}), promptError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
361
|
-
className: classes.errorText
|
|
362
|
-
}, promptError)), /*#__PURE__*/_react["default"].createElement(_graphingConfig["default"], {
|
|
363
|
-
authoring: authoring,
|
|
364
|
-
availableTools: availableTools,
|
|
365
|
-
gridConfigurations: gridConfigurations,
|
|
366
|
-
graphDimensions: graphDimensions,
|
|
367
|
-
labelsPlaceholders: labelsPlaceholders,
|
|
368
|
-
model: model,
|
|
369
|
-
showLabels: labelsEnabled,
|
|
370
|
-
dimensionsEnabled: dimensionsEnabled,
|
|
371
|
-
showTitle: titleEnabled,
|
|
372
|
-
titlePlaceholder: title.placeholder,
|
|
373
|
-
onChange: this.props.onModelChanged,
|
|
374
|
-
mathMlOptions: mathMlOptions,
|
|
375
|
-
removeIncompleteTool: removeIncompleteTool
|
|
376
|
-
}), /*#__PURE__*/_react["default"].createElement(_correctResponse["default"], {
|
|
377
|
-
availableTools: availableTools,
|
|
378
|
-
errors: errors,
|
|
117
|
+
const toolbarTools = (0, _intersection.default)(availableTools || [], model.toolbarTools || []);
|
|
118
|
+
const titleEnabled = showTitle === undefined || showTitle === null ? title.enabled : showTitle;
|
|
119
|
+
const dimensionsEnabled = showDimensions === undefined || showDimensions === null ? graphDimensions.enabled : showDimensions;
|
|
120
|
+
onModelChanged && onModelChanged({
|
|
121
|
+
...model,
|
|
122
|
+
arrows,
|
|
123
|
+
toolbarTools,
|
|
124
|
+
titleEnabled,
|
|
125
|
+
dimensionsEnabled
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
render() {
|
|
129
|
+
const {
|
|
130
|
+
model,
|
|
131
|
+
configuration,
|
|
132
|
+
onConfigurationChanged,
|
|
133
|
+
onModelChanged,
|
|
134
|
+
imageSupport,
|
|
135
|
+
uploadSoundSupport
|
|
136
|
+
} = this.props;
|
|
137
|
+
const {
|
|
138
|
+
arrows = {},
|
|
139
|
+
authoring = {},
|
|
140
|
+
availableTools = [],
|
|
141
|
+
baseInputConfiguration = {},
|
|
142
|
+
coordinatesOnHover = {},
|
|
143
|
+
contentDimensions = {},
|
|
144
|
+
gridConfigurations = [],
|
|
145
|
+
graphDimensions = {},
|
|
146
|
+
instruction = {},
|
|
147
|
+
labels = {},
|
|
148
|
+
padding = {},
|
|
149
|
+
prompt = {},
|
|
150
|
+
rationale = {},
|
|
151
|
+
scoringType = {},
|
|
152
|
+
settingsPanelDisabled,
|
|
153
|
+
spellCheck = {},
|
|
154
|
+
studentInstructions = {},
|
|
155
|
+
teacherInstructions = {},
|
|
156
|
+
title = {},
|
|
157
|
+
maxImageWidth = {},
|
|
158
|
+
maxImageHeight = {},
|
|
159
|
+
withRubric = {},
|
|
160
|
+
language = {},
|
|
161
|
+
languageChoices = {},
|
|
162
|
+
mathMlOptions = {},
|
|
163
|
+
removeIncompleteTool = false
|
|
164
|
+
} = configuration || {};
|
|
165
|
+
const {
|
|
166
|
+
errors = {},
|
|
167
|
+
extraCSSRules,
|
|
168
|
+
labelsEnabled,
|
|
169
|
+
dimensionsEnabled,
|
|
170
|
+
promptEnabled,
|
|
171
|
+
rationaleEnabled,
|
|
172
|
+
spellCheckEnabled,
|
|
173
|
+
teacherInstructionsEnabled,
|
|
174
|
+
titleEnabled
|
|
175
|
+
} = model || {};
|
|
176
|
+
const {
|
|
177
|
+
prompt: promptError,
|
|
178
|
+
rationale: rationaleError,
|
|
179
|
+
teacherInstructions: teacherInstructionsError
|
|
180
|
+
} = errors || {};
|
|
181
|
+
log('[render] model', model);
|
|
182
|
+
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
183
|
+
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
184
|
+
const labelsPlaceholders = {
|
|
185
|
+
top: labels.top,
|
|
186
|
+
right: labels.right,
|
|
187
|
+
bottom: labels.bottom,
|
|
188
|
+
left: labels.left
|
|
189
|
+
};
|
|
190
|
+
const panelItemType = {
|
|
191
|
+
arrows: arrows.settings && checkboxes(arrows.label, {
|
|
192
|
+
left: arrows.left,
|
|
193
|
+
right: arrows.right,
|
|
194
|
+
up: arrows.up,
|
|
195
|
+
down: arrows.down
|
|
196
|
+
}),
|
|
197
|
+
titleEnabled: title.settings && toggle(title.label),
|
|
198
|
+
padding: padding.settings && toggle(padding.label),
|
|
199
|
+
labelsEnabled: labels.settings && toggle(labels.label),
|
|
200
|
+
'language.enabled': language.settings && toggle(language.label, true),
|
|
201
|
+
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),
|
|
202
|
+
dimensionsEnabled: graphDimensions.settings && toggle(graphDimensions.label),
|
|
203
|
+
coordinatesOnHover: coordinatesOnHover.settings && toggle(coordinatesOnHover.label)
|
|
204
|
+
};
|
|
205
|
+
const panelProperties = {
|
|
206
|
+
'authoring.enabled': authoring.settings && toggle(authoring.label, true),
|
|
207
|
+
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
208
|
+
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
209
|
+
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
210
|
+
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
211
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
212
|
+
scoringType: scoringType.settings && radio(scoringType.label, ['dichotomous', 'partial scoring']),
|
|
213
|
+
rubricEnabled: withRubric?.settings && toggle(withRubric?.label),
|
|
214
|
+
instruction: instruction.settings && textField(instruction.label)
|
|
215
|
+
};
|
|
216
|
+
const getPluginProps = (props = {}) => ({
|
|
217
|
+
...baseInputConfiguration,
|
|
218
|
+
...props
|
|
219
|
+
});
|
|
220
|
+
return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
|
|
221
|
+
extraCSSRules: extraCSSRules,
|
|
222
|
+
dimensions: contentDimensions,
|
|
223
|
+
hideSettings: settingsPanelDisabled,
|
|
224
|
+
settings: /*#__PURE__*/_react.default.createElement(Panel, {
|
|
379
225
|
model: model,
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
226
|
+
configuration: configuration,
|
|
227
|
+
onChangeModel: onModelChanged,
|
|
228
|
+
onChangeConfiguration: onConfigurationChanged,
|
|
229
|
+
groups: {
|
|
230
|
+
Settings: panelItemType,
|
|
231
|
+
Properties: panelProperties
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
}, /*#__PURE__*/_react.default.createElement(Description, {
|
|
235
|
+
component: "div",
|
|
236
|
+
variant: "body1"
|
|
237
|
+
}, instruction?.label || ''), teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
238
|
+
label: teacherInstructions.label
|
|
239
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtml.default, {
|
|
240
|
+
markup: model.teacherInstructions || '',
|
|
241
|
+
onChange: this.onTeacherInstructionsChange,
|
|
242
|
+
imageSupport: imageSupport,
|
|
243
|
+
error: teacherInstructionsError,
|
|
244
|
+
nonEmpty: false,
|
|
245
|
+
pluginProps: getPluginProps(teacherInstructions?.inputConfiguration),
|
|
246
|
+
spellCheck: spellCheckEnabled,
|
|
247
|
+
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
248
|
+
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
249
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
250
|
+
languageCharactersProps: [{
|
|
251
|
+
language: 'spanish'
|
|
252
|
+
}, {
|
|
253
|
+
language: 'special'
|
|
254
|
+
}],
|
|
255
|
+
mathMlOptions: mathMlOptions
|
|
256
|
+
}), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
257
|
+
label: prompt.label
|
|
258
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtml.default, {
|
|
259
|
+
markup: model.prompt,
|
|
260
|
+
onChange: this.onPromptChange,
|
|
261
|
+
imageSupport: imageSupport,
|
|
262
|
+
error: promptError,
|
|
263
|
+
nonEmpty: false,
|
|
264
|
+
spellCheck: spellCheckEnabled,
|
|
265
|
+
pluginProps: getPluginProps(prompt?.inputConfiguration),
|
|
266
|
+
disableUnderline: true,
|
|
267
|
+
maxImageWidth: defaultImageMaxWidth,
|
|
268
|
+
maxImageHeight: defaultImageMaxHeight,
|
|
269
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
270
|
+
languageCharactersProps: [{
|
|
271
|
+
language: 'spanish'
|
|
272
|
+
}, {
|
|
273
|
+
language: 'special'
|
|
274
|
+
}],
|
|
275
|
+
mathMlOptions: mathMlOptions
|
|
276
|
+
}), promptError && /*#__PURE__*/_react.default.createElement(ErrorText, null, promptError)), /*#__PURE__*/_react.default.createElement(_graphingConfig.default, {
|
|
277
|
+
authoring: authoring,
|
|
278
|
+
availableTools: availableTools,
|
|
279
|
+
gridConfigurations: gridConfigurations,
|
|
280
|
+
graphDimensions: graphDimensions,
|
|
281
|
+
labelsPlaceholders: labelsPlaceholders,
|
|
282
|
+
model: model,
|
|
283
|
+
showLabels: labelsEnabled,
|
|
284
|
+
dimensionsEnabled: dimensionsEnabled,
|
|
285
|
+
showTitle: titleEnabled,
|
|
286
|
+
titlePlaceholder: title.placeholder,
|
|
287
|
+
onChange: this.props.onModelChanged,
|
|
288
|
+
mathMlOptions: mathMlOptions,
|
|
289
|
+
removeIncompleteTool: removeIncompleteTool
|
|
290
|
+
}), /*#__PURE__*/_react.default.createElement(_correctResponse.default, {
|
|
291
|
+
availableTools: availableTools,
|
|
292
|
+
errors: errors,
|
|
293
|
+
model: model,
|
|
294
|
+
onChange: this.props.onModelChanged,
|
|
295
|
+
mathMlOptions: mathMlOptions,
|
|
296
|
+
removeIncompleteTool: removeIncompleteTool
|
|
297
|
+
}), rationaleEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
298
|
+
label: rationale.label || 'Rationale'
|
|
299
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtml.default, {
|
|
300
|
+
markup: model.rationale || '',
|
|
301
|
+
onChange: this.onRationaleChange,
|
|
302
|
+
imageSupport: imageSupport,
|
|
303
|
+
error: rationaleError,
|
|
304
|
+
spellCheck: spellCheckEnabled,
|
|
305
|
+
pluginProps: getPluginProps(rationale?.inputConfiguration),
|
|
306
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
307
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
308
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
309
|
+
languageCharactersProps: [{
|
|
310
|
+
language: 'spanish'
|
|
311
|
+
}, {
|
|
312
|
+
language: 'special'
|
|
313
|
+
}],
|
|
314
|
+
mathMlOptions: mathMlOptions
|
|
315
|
+
}), rationaleError && /*#__PURE__*/_react.default.createElement(ErrorText, null, rationaleError)));
|
|
316
|
+
}
|
|
317
|
+
}
|
|
411
318
|
exports.Configure = Configure;
|
|
412
|
-
(0, _defineProperty2
|
|
413
|
-
onModelChanged: _propTypes
|
|
414
|
-
onConfigurationChanged: _propTypes
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
configuration: _propTypes["default"].object.isRequired
|
|
319
|
+
(0, _defineProperty2.default)(Configure, "propTypes", {
|
|
320
|
+
onModelChanged: _propTypes.default.func,
|
|
321
|
+
onConfigurationChanged: _propTypes.default.func,
|
|
322
|
+
imageSupport: _propTypes.default.object,
|
|
323
|
+
uploadSoundSupport: _propTypes.default.object,
|
|
324
|
+
model: _propTypes.default.object.isRequired,
|
|
325
|
+
configuration: _propTypes.default.object.isRequired
|
|
420
326
|
});
|
|
421
|
-
|
|
422
|
-
classes: {}
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
var _default = (0, _styles.withStyles)(styles)(Configure);
|
|
426
|
-
|
|
427
|
-
exports["default"] = _default;
|
|
327
|
+
var _default = exports.default = Configure;
|
|
428
328
|
//# sourceMappingURL=configure.js.map
|