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