@pie-element/graphing 8.3.4-next.0 → 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.
@@ -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["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
-
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 _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
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
- 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: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
- },
73
- description: {
74
- marginBottom: theme.spacing.unit * 2.5
75
- },
76
- errorText: {
77
- fontSize: theme.typography.fontSize - 2,
78
- color: theme.palette.error.main,
79
- paddingTop: theme.spacing.unit
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["default"])((0, _assertThisInitialized2["default"])(_this), "onPromptChange", function (prompt) {
108
- var _this$props2 = _this.props,
109
- onModelChanged = _this$props2.onModelChanged,
110
- model = _this$props2.model;
111
- onModelChanged(_objectSpread(_objectSpread({}, model), {}, {
112
- prompt: prompt
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["default"])((0, _assertThisInitialized2["default"])(_this), "onTeacherInstructionsChange", function (teacherInstructions) {
116
- var _this$props3 = _this.props,
117
- onModelChanged = _this$props3.onModelChanged,
118
- model = _this$props3.model;
119
- onModelChanged(_objectSpread(_objectSpread({}, model), {}, {
120
- teacherInstructions: teacherInstructions
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
- (0, _createClass2["default"])(Configure, [{
127
- key: "componentDidMount",
128
- value: 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
- availableTools = _ref.availableTools,
136
- title = _ref.title,
137
- graphDimensions = _ref.graphDimensions;
138
-
139
- var _ref2 = model || {},
140
- arrows = _ref2.arrows,
141
- showTitle = _ref2.titleEnabled,
142
- showDimensions = _ref2.dimensionsEnabled; // This is used for offering support for old models which have the property arrows: boolean
143
- // Same thing is set in the controller: packages/graphing/controller/src/index.js - model
144
-
145
-
146
- if (typeof arrows === 'boolean') {
147
- if (arrows) {
148
- arrows = {
149
- left: true,
150
- right: true,
151
- up: true,
152
- down: true
153
- };
154
- } else {
155
- arrows = {
156
- left: false,
157
- right: false,
158
- up: false,
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
- key: "render",
176
- value: function render() {
177
- var _this$props5 = this.props,
178
- classes = _this$props5.classes,
179
- model = _this$props5.model,
180
- configuration = _this$props5.configuration,
181
- onConfigurationChanged = _this$props5.onConfigurationChanged,
182
- onModelChanged = _this$props5.onModelChanged,
183
- imageSupport = _this$props5.imageSupport,
184
- uploadSoundSupport = _this$props5.uploadSoundSupport;
185
-
186
- var _ref3 = configuration || {},
187
- _ref3$arrows = _ref3.arrows,
188
- arrows = _ref3$arrows === void 0 ? {} : _ref3$arrows,
189
- _ref3$authoring = _ref3.authoring,
190
- authoring = _ref3$authoring === void 0 ? {} : _ref3$authoring,
191
- _ref3$availableTools = _ref3.availableTools,
192
- availableTools = _ref3$availableTools === void 0 ? [] : _ref3$availableTools,
193
- _ref3$baseInputConfig = _ref3.baseInputConfiguration,
194
- baseInputConfiguration = _ref3$baseInputConfig === void 0 ? {} : _ref3$baseInputConfig,
195
- _ref3$coordinatesOnHo = _ref3.coordinatesOnHover,
196
- coordinatesOnHover = _ref3$coordinatesOnHo === void 0 ? {} : _ref3$coordinatesOnHo,
197
- _ref3$contentDimensio = _ref3.contentDimensions,
198
- contentDimensions = _ref3$contentDimensio === void 0 ? {} : _ref3$contentDimensio,
199
- _ref3$gridConfigurati = _ref3.gridConfigurations,
200
- gridConfigurations = _ref3$gridConfigurati === void 0 ? [] : _ref3$gridConfigurati,
201
- _ref3$graphDimensions = _ref3.graphDimensions,
202
- graphDimensions = _ref3$graphDimensions === void 0 ? {} : _ref3$graphDimensions,
203
- _ref3$instruction = _ref3.instruction,
204
- instruction = _ref3$instruction === void 0 ? {} : _ref3$instruction,
205
- _ref3$labels = _ref3.labels,
206
- labels = _ref3$labels === void 0 ? {} : _ref3$labels,
207
- _ref3$padding = _ref3.padding,
208
- padding = _ref3$padding === void 0 ? {} : _ref3$padding,
209
- _ref3$prompt = _ref3.prompt,
210
- prompt = _ref3$prompt === void 0 ? {} : _ref3$prompt,
211
- _ref3$rationale = _ref3.rationale,
212
- rationale = _ref3$rationale === void 0 ? {} : _ref3$rationale,
213
- _ref3$scoringType = _ref3.scoringType,
214
- scoringType = _ref3$scoringType === void 0 ? {} : _ref3$scoringType,
215
- settingsPanelDisabled = _ref3.settingsPanelDisabled,
216
- _ref3$spellCheck = _ref3.spellCheck,
217
- spellCheck = _ref3$spellCheck === void 0 ? {} : _ref3$spellCheck,
218
- _ref3$studentInstruct = _ref3.studentInstructions,
219
- studentInstructions = _ref3$studentInstruct === void 0 ? {} : _ref3$studentInstruct,
220
- _ref3$teacherInstruct = _ref3.teacherInstructions,
221
- teacherInstructions = _ref3$teacherInstruct === void 0 ? {} : _ref3$teacherInstruct,
222
- _ref3$title = _ref3.title,
223
- title = _ref3$title === void 0 ? {} : _ref3$title,
224
- _ref3$maxImageWidth = _ref3.maxImageWidth,
225
- maxImageWidth = _ref3$maxImageWidth === void 0 ? {} : _ref3$maxImageWidth,
226
- _ref3$maxImageHeight = _ref3.maxImageHeight,
227
- maxImageHeight = _ref3$maxImageHeight === void 0 ? {} : _ref3$maxImageHeight,
228
- _ref3$withRubric = _ref3.withRubric,
229
- withRubric = _ref3$withRubric === void 0 ? {} : _ref3$withRubric,
230
- _ref3$language = _ref3.language,
231
- language = _ref3$language === void 0 ? {} : _ref3$language,
232
- _ref3$languageChoices = _ref3.languageChoices,
233
- languageChoices = _ref3$languageChoices === void 0 ? {} : _ref3$languageChoices,
234
- _ref3$mathMlOptions = _ref3.mathMlOptions,
235
- mathMlOptions = _ref3$mathMlOptions === void 0 ? {} : _ref3$mathMlOptions,
236
- _ref3$removeIncomplet = _ref3.removeIncompleteTool,
237
- removeIncompleteTool = _ref3$removeIncomplet === void 0 ? false : _ref3$removeIncomplet;
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 _ref5 = errors || {},
252
- promptError = _ref5.prompt,
253
- rationaleError = _ref5.rationale,
254
- teacherInstructionsError = _ref5.teacherInstructions;
255
-
256
- log('[render] model', model);
257
- var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
258
- var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
259
- var labelsPlaceholders = {
260
- top: labels.top,
261
- right: labels.right,
262
- bottom: labels.bottom,
263
- left: labels.left
264
- };
265
- var panelItemType = {
266
- arrows: arrows.settings && checkboxes(arrows.label, {
267
- left: arrows.left,
268
- right: arrows.right,
269
- up: arrows.up,
270
- down: arrows.down
271
- }),
272
- titleEnabled: title.settings && toggle(title.label),
273
- padding: padding.settings && toggle(padding.label),
274
- labelsEnabled: labels.settings && toggle(labels.label),
275
- 'language.enabled': language.settings && toggle(language.label, true),
276
- language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),
277
- dimensionsEnabled: graphDimensions.settings && toggle(graphDimensions.label),
278
- coordinatesOnHover: coordinatesOnHover.settings && toggle(coordinatesOnHover.label)
279
- };
280
- var panelProperties = {
281
- 'authoring.enabled': authoring.settings && toggle(authoring.label, true),
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
- onChange: this.props.onModelChanged,
381
- mathMlOptions: mathMlOptions,
382
- removeIncompleteTool: removeIncompleteTool
383
- }), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
384
- label: rationale.label || 'Rationale',
385
- className: classes.promptHolder
386
- }, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
387
- className: classes.prompt,
388
- markup: model.rationale || '',
389
- onChange: this.onRationaleChange,
390
- imageSupport: imageSupport,
391
- error: rationaleError,
392
- spellCheck: spellCheckEnabled,
393
- pluginProps: getPluginProps(rationale === null || rationale === void 0 ? void 0 : rationale.inputConfiguration),
394
- maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
395
- maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
396
- uploadSoundSupport: uploadSoundSupport,
397
- languageCharactersProps: [{
398
- language: 'spanish'
399
- }, {
400
- language: 'special'
401
- }],
402
- mathMlOptions: mathMlOptions
403
- }), rationaleError && /*#__PURE__*/_react["default"].createElement("div", {
404
- className: classes.errorText
405
- }, rationaleError)));
406
- }
407
- }]);
408
- return Configure;
409
- }(_react["default"].Component);
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["default"])(Configure, "propTypes", {
413
- onModelChanged: _propTypes["default"].func,
414
- onConfigurationChanged: _propTypes["default"].func,
415
- classes: _propTypes["default"].object,
416
- imageSupport: _propTypes["default"].object,
417
- uploadSoundSupport: _propTypes["default"].object,
418
- model: _propTypes["default"].object.isRequired,
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
- (0, _defineProperty2["default"])(Configure, "defaultProps", {
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