@pie-element/ebsr 10.7.3-next.12 → 10.7.3-next.14

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.
Files changed (64) hide show
  1. package/module/index.html +1 -1
  2. package/module/manifest.json +1 -1
  3. package/module/print.html +1 -1
  4. package/package.json +3 -3
  5. package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.json +0 -1972
  6. package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.md +0 -4144
  7. package/configure/node_modules/@pie-element/multiple-choice/LICENSE.md +0 -5
  8. package/configure/node_modules/@pie-element/multiple-choice/PRINT.md +0 -35
  9. package/configure/node_modules/@pie-element/multiple-choice/README.md +0 -56
  10. package/configure/node_modules/@pie-element/multiple-choice/choice.png +0 -0
  11. package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.json +0 -1387
  12. package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.md +0 -3316
  13. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js +0 -202
  14. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js.map +0 -1
  15. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js +0 -248
  16. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js.map +0 -1
  17. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js +0 -597
  18. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js.map +0 -1
  19. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js +0 -18
  20. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js.map +0 -1
  21. package/configure/node_modules/@pie-element/multiple-choice/configure/package.json +0 -18
  22. package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.json +0 -527
  23. package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.md +0 -2281
  24. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js +0 -34
  25. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js.map +0 -1
  26. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js +0 -346
  27. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js.map +0 -1
  28. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js +0 -28
  29. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js.map +0 -1
  30. package/configure/node_modules/@pie-element/multiple-choice/controller/package.json +0 -15
  31. package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json +0 -2993
  32. package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json.md +0 -2217
  33. package/configure/node_modules/@pie-element/multiple-choice/docs/demo/config.js +0 -8
  34. package/configure/node_modules/@pie-element/multiple-choice/docs/demo/generate.js +0 -61
  35. package/configure/node_modules/@pie-element/multiple-choice/docs/demo/index.html +0 -1
  36. package/configure/node_modules/@pie-element/multiple-choice/docs/demo/session.js +0 -7
  37. package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json +0 -1332
  38. package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json.md +0 -1015
  39. package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js +0 -427
  40. package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js.map +0 -1
  41. package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js +0 -252
  42. package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js.map +0 -1
  43. package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js +0 -174
  44. package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js.map +0 -1
  45. package/configure/node_modules/@pie-element/multiple-choice/lib/index.js +0 -388
  46. package/configure/node_modules/@pie-element/multiple-choice/lib/index.js.map +0 -1
  47. package/configure/node_modules/@pie-element/multiple-choice/lib/main.js +0 -108
  48. package/configure/node_modules/@pie-element/multiple-choice/lib/main.js.map +0 -1
  49. package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js +0 -469
  50. package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js.map +0 -1
  51. package/configure/node_modules/@pie-element/multiple-choice/lib/print.js +0 -129
  52. package/configure/node_modules/@pie-element/multiple-choice/lib/print.js.map +0 -1
  53. package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js +0 -48
  54. package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js.map +0 -1
  55. package/configure/node_modules/@pie-element/multiple-choice/module/configure.js +0 -1
  56. package/configure/node_modules/@pie-element/multiple-choice/module/controller.js +0 -3611
  57. package/configure/node_modules/@pie-element/multiple-choice/module/demo.js +0 -86
  58. package/configure/node_modules/@pie-element/multiple-choice/module/element.js +0 -1
  59. package/configure/node_modules/@pie-element/multiple-choice/module/index.html +0 -21
  60. package/configure/node_modules/@pie-element/multiple-choice/module/manifest.json +0 -10
  61. package/configure/node_modules/@pie-element/multiple-choice/module/print-demo.js +0 -124
  62. package/configure/node_modules/@pie-element/multiple-choice/module/print.html +0 -18
  63. package/configure/node_modules/@pie-element/multiple-choice/module/print.js +0 -1
  64. package/configure/node_modules/@pie-element/multiple-choice/package.json +0 -32
@@ -1,597 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = exports.Main = void 0;
9
-
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
- var _react = _interopRequireDefault(require("react"));
27
-
28
- var _propTypes = _interopRequireDefault(require("prop-types"));
29
-
30
- var _editableHtml = require("@pie-lib/pie-toolbox/editable-html");
31
-
32
- var _configUi = require("@pie-lib/pie-toolbox/config-ui");
33
-
34
- var _renderUi = require("@pie-lib/pie-toolbox/render-ui");
35
-
36
- var _styles = require("@material-ui/core/styles");
37
-
38
- var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
39
-
40
- var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
41
-
42
- var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
43
-
44
- var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
45
-
46
- var _merge = _interopRequireDefault(require("lodash/merge"));
47
-
48
- var _utils = require("./utils");
49
-
50
- 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); }; }
51
-
52
- 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; } }
53
-
54
- 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; }
55
-
56
- 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; }
57
-
58
- var Panel = _configUi.settings.Panel,
59
- toggle = _configUi.settings.toggle,
60
- radio = _configUi.settings.radio,
61
- dropdown = _configUi.settings.dropdown;
62
- var MAX_CHOICES = 9;
63
-
64
- var styles = function styles(theme) {
65
- return {
66
- promptHolder: {
67
- width: '100%',
68
- paddingTop: theme.spacing.unit * 2,
69
- marginBottom: theme.spacing.unit * 2
70
- },
71
- rationaleHolder: {
72
- flex: 1,
73
- marginTop: theme.spacing.unit * 1.5,
74
- paddingTop: theme.spacing.unit * 2,
75
- marginLeft: theme.spacing.unit * 3.5
76
- },
77
- choiceConfigurationHolder: {
78
- display: 'flex',
79
- flexDirection: 'column',
80
- marginBottom: theme.spacing.unit
81
- },
82
- choiceConfiguration: {
83
- width: '100%'
84
- },
85
- switchElement: {
86
- justifyContent: 'space-between',
87
- margin: 0
88
- },
89
- addButton: {
90
- marginTop: theme.spacing.unit,
91
- "float": 'right'
92
- },
93
- disableButton: {
94
- cursor: 'not-allowed',
95
- pointerEvents: 'all',
96
- backgroundColor: _renderUi.color.disabled(),
97
- '&:hover': {
98
- backgroundColor: _renderUi.color.disabled()
99
- },
100
- '&:focus': {
101
- backgroundColor: _renderUi.color.disabled()
102
- }
103
- },
104
- flexContainer: {
105
- display: 'flex',
106
- alignItems: 'center'
107
- },
108
- titleText: {
109
- fontSize: theme.typography.fontSize + 2,
110
- marginRight: theme.spacing.unit
111
- },
112
- tooltip: {
113
- fontSize: theme.typography.fontSize - 2,
114
- whiteSpace: 'pre',
115
- maxWidth: '500px'
116
- },
117
- errorText: {
118
- fontSize: theme.typography.fontSize - 2,
119
- color: theme.palette.error.main,
120
- paddingTop: theme.spacing.unit
121
- }
122
- };
123
- };
124
-
125
- var Design = (0, _styles.withStyles)(styles)(function (props) {
126
- var _configuration$teache, _configuration$prompt;
127
-
128
- var classes = props.classes,
129
- model = props.model,
130
- configuration = props.configuration,
131
- onPromptChanged = props.onPromptChanged,
132
- onChoiceChanged = props.onChoiceChanged,
133
- onRemoveChoice = props.onRemoveChoice,
134
- onAddChoice = props.onAddChoice,
135
- imageSupport = props.imageSupport,
136
- uploadSoundSupport = props.uploadSoundSupport,
137
- onChangeModel = props.onChangeModel,
138
- onConfigurationChanged = props.onConfigurationChanged,
139
- onTeacherInstructionsChanged = props.onTeacherInstructionsChanged;
140
-
141
- var _ref = configuration || {},
142
- _ref$addChoiceButton = _ref.addChoiceButton,
143
- addChoiceButton = _ref$addChoiceButton === void 0 ? {} : _ref$addChoiceButton,
144
- _ref$contentDimension = _ref.contentDimensions,
145
- contentDimensions = _ref$contentDimension === void 0 ? {} : _ref$contentDimension,
146
- _ref$feedback = _ref.feedback,
147
- feedback = _ref$feedback === void 0 ? {} : _ref$feedback,
148
- _ref$deleteChoice = _ref.deleteChoice,
149
- deleteChoice = _ref$deleteChoice === void 0 ? {} : _ref$deleteChoice,
150
- _ref$choiceMode = _ref.choiceMode,
151
- choiceMode = _ref$choiceMode === void 0 ? {} : _ref$choiceMode,
152
- _ref$choicePrefix = _ref.choicePrefix,
153
- choicePrefix = _ref$choicePrefix === void 0 ? {} : _ref$choicePrefix,
154
- _ref$partialScoring = _ref.partialScoring,
155
- partialScoring = _ref$partialScoring === void 0 ? {} : _ref$partialScoring,
156
- _ref$lockChoiceOrder = _ref.lockChoiceOrder,
157
- lockChoiceOrder = _ref$lockChoiceOrder === void 0 ? {} : _ref$lockChoiceOrder,
158
- _ref$teacherInstructi = _ref.teacherInstructions,
159
- teacherInstructions = _ref$teacherInstructi === void 0 ? {} : _ref$teacherInstructi,
160
- _ref$studentInstructi = _ref.studentInstructions,
161
- studentInstructions = _ref$studentInstructi === void 0 ? {} : _ref$studentInstructi,
162
- _ref$rationale = _ref.rationale,
163
- rationale = _ref$rationale === void 0 ? {} : _ref$rationale,
164
- _ref$scoringType = _ref.scoringType,
165
- scoringType = _ref$scoringType === void 0 ? {} : _ref$scoringType,
166
- _ref$sequentialChoice = _ref.sequentialChoiceLabels,
167
- sequentialChoiceLabels = _ref$sequentialChoice === void 0 ? {} : _ref$sequentialChoice,
168
- settingsPanelDisabled = _ref.settingsPanelDisabled,
169
- choicesLayout = _ref.choicesLayout,
170
- _ref$spellCheck = _ref.spellCheck,
171
- spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck,
172
- gridColumns = _ref.gridColumns,
173
- _ref$maxImageWidth = _ref.maxImageWidth,
174
- maxImageWidth = _ref$maxImageWidth === void 0 ? {} : _ref$maxImageWidth,
175
- _ref$maxImageHeight = _ref.maxImageHeight,
176
- maxImageHeight = _ref$maxImageHeight === void 0 ? {} : _ref$maxImageHeight,
177
- _ref$prompt = _ref.prompt,
178
- prompt = _ref$prompt === void 0 ? {} : _ref$prompt,
179
- _ref$withRubric = _ref.withRubric,
180
- withRubric = _ref$withRubric === void 0 ? {} : _ref$withRubric,
181
- _ref$mathMlOptions = _ref.mathMlOptions,
182
- mathMlOptions = _ref$mathMlOptions === void 0 ? {} : _ref$mathMlOptions,
183
- _ref$language = _ref.language,
184
- language = _ref$language === void 0 ? {} : _ref$language,
185
- _ref$languageChoices = _ref.languageChoices,
186
- languageChoices = _ref$languageChoices === void 0 ? {} : _ref$languageChoices;
187
-
188
- var _ref2 = configuration || {},
189
- maxAnswerChoices = _ref2.maxAnswerChoices;
190
-
191
- var _ref3 = model || {},
192
- limitChoicesNumber = _ref3.limitChoicesNumber,
193
- teacherInstructionsEnabled = _ref3.teacherInstructionsEnabled,
194
- rationaleEnabled = _ref3.rationaleEnabled,
195
- feedbackEnabled = _ref3.feedbackEnabled,
196
- promptEnabled = _ref3.promptEnabled,
197
- spellCheckEnabled = _ref3.spellCheckEnabled,
198
- choices = _ref3.choices,
199
- errors = _ref3.errors,
200
- toolbarEditorPosition = _ref3.toolbarEditorPosition,
201
- extraCSSRules = _ref3.extraCSSRules;
202
-
203
- var _ref4 = errors || {},
204
- answerChoicesError = _ref4.answerChoices,
205
- choicesErrors = _ref4.choices,
206
- correctResponseError = _ref4.correctResponse,
207
- promptError = _ref4.prompt,
208
- rationaleErrors = _ref4.rationale,
209
- teacherInstructionsError = _ref4.teacherInstructions;
210
-
211
- var nrOfColumnsAvailable = choices !== null && choices !== void 0 && choices.length ? Array.from({
212
- length: choices.length
213
- }, function (_, i) {
214
- return "".concat(i + 1);
215
- }) : [];
216
- var _configuration$baseIn = configuration.baseInputConfiguration,
217
- baseInputConfiguration = _configuration$baseIn === void 0 ? {} : _configuration$baseIn;
218
- var toolbarOpts = {
219
- position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
220
- }; // if old property is used, set maxAnswerChoices to 9
221
-
222
- if (limitChoicesNumber) {
223
- maxAnswerChoices = MAX_CHOICES;
224
- }
225
-
226
- var getPluginProps = function getPluginProps() {
227
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
228
- return _objectSpread(_objectSpread({}, baseInputConfiguration), props);
229
- };
230
-
231
- var validationMessage = (0, _utils.generateValidationMessage)(configuration);
232
- var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
233
- var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
234
- var addChoiceButtonTooltip = maxAnswerChoices && (choices === null || choices === void 0 ? void 0 : choices.length) >= maxAnswerChoices ? "Only ".concat(maxAnswerChoices, " allowed maximum") : '';
235
- var panelSettings = {
236
- choiceMode: choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),
237
- 'sequentialChoiceLabels.enabled': sequentialChoiceLabels.settings && toggle(sequentialChoiceLabels.label, true),
238
- choicePrefix: choicePrefix.settings && radio(choicePrefix.label, ['numbers', 'letters']),
239
- partialScoring: partialScoring.settings && toggle(partialScoring.label),
240
- lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
241
- feedbackEnabled: feedback.settings && toggle(feedback.label),
242
- choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),
243
- gridColumns: choicesLayout.settings && model.choicesLayout === 'grid' && nrOfColumnsAvailable.length > 0 && dropdown(gridColumns.label, nrOfColumnsAvailable),
244
- 'language.enabled': language.settings && toggle(language.label, true),
245
- language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
246
- };
247
- var panelProperties = {
248
- teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
249
- studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
250
- promptEnabled: prompt.settings && toggle(prompt.label),
251
- rationaleEnabled: rationale.settings && toggle(rationale.label),
252
- spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
253
- scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
254
- rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label)
255
- };
256
- return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
257
- dimensions: contentDimensions,
258
- hideSettings: settingsPanelDisabled,
259
- extraCSSRules: extraCSSRules,
260
- settings: /*#__PURE__*/_react["default"].createElement(Panel, {
261
- model: model,
262
- onChangeModel: onChangeModel,
263
- configuration: configuration,
264
- onChangeConfiguration: onConfigurationChanged,
265
- groups: {
266
- Settings: panelSettings,
267
- Properties: panelProperties
268
- }
269
- })
270
- }, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
271
- label: teacherInstructions.label,
272
- className: classes.promptHolder
273
- }, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
274
- className: classes.prompt,
275
- markup: model.teacherInstructions || '',
276
- onChange: onTeacherInstructionsChanged,
277
- imageSupport: imageSupport,
278
- nonEmpty: false,
279
- error: teacherInstructionsError,
280
- toolbarOpts: toolbarOpts,
281
- pluginProps: getPluginProps(configuration === null || configuration === void 0 ? void 0 : (_configuration$teache = configuration.teacherInstructions) === null || _configuration$teache === void 0 ? void 0 : _configuration$teache.inputConfiguration),
282
- spellCheck: spellCheckEnabled,
283
- maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
284
- maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
285
- uploadSoundSupport: uploadSoundSupport,
286
- languageCharactersProps: [{
287
- language: 'spanish'
288
- }, {
289
- language: 'special'
290
- }],
291
- mathMlOptions: mathMlOptions
292
- }), teacherInstructionsError && /*#__PURE__*/_react["default"].createElement("div", {
293
- className: classes.errorText
294
- }, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
295
- label: prompt.label,
296
- className: classes.promptHolder
297
- }, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
298
- className: classes.prompt,
299
- markup: model.prompt,
300
- onChange: onPromptChanged,
301
- imageSupport: imageSupport,
302
- nonEmpty: false,
303
- disableUnderline: true,
304
- error: promptError,
305
- toolbarOpts: toolbarOpts,
306
- pluginProps: getPluginProps(configuration === null || configuration === void 0 ? void 0 : (_configuration$prompt = configuration.prompt) === null || _configuration$prompt === void 0 ? void 0 : _configuration$prompt.inputConfiguration),
307
- spellCheck: spellCheckEnabled,
308
- maxImageWidth: maxImageWidth && maxImageWidth.prompt,
309
- maxImageHeight: maxImageHeight && maxImageHeight.prompt,
310
- uploadSoundSupport: uploadSoundSupport,
311
- languageCharactersProps: [{
312
- language: 'spanish'
313
- }, {
314
- language: 'special'
315
- }],
316
- mathMlOptions: mathMlOptions
317
- }), promptError && /*#__PURE__*/_react["default"].createElement("div", {
318
- className: classes.errorText
319
- }, promptError)), /*#__PURE__*/_react["default"].createElement("div", {
320
- className: classes.flexContainer
321
- }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
322
- className: classes.titleText,
323
- component: 'div'
324
- }, "Choices"), /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
325
- classes: {
326
- tooltip: classes.tooltip
327
- },
328
- disableFocusListener: true,
329
- disableTouchListener: true,
330
- placement: 'right',
331
- title: validationMessage
332
- }, /*#__PURE__*/_react["default"].createElement(_Info["default"], {
333
- fontSize: 'small',
334
- color: 'primary'
335
- }))), choices.map(function (choice, index) {
336
- var _configuration$choice, _configuration$ration;
337
-
338
- return /*#__PURE__*/_react["default"].createElement("div", {
339
- key: "choice-".concat(index),
340
- className: classes.choiceConfigurationHolder
341
- }, /*#__PURE__*/_react["default"].createElement(_configUi.ChoiceConfiguration, {
342
- key: index,
343
- index: index + 1,
344
- useLetterOrdering: model.choicePrefix === 'letters',
345
- className: classes.choiceConfiguration,
346
- mode: model.choiceMode,
347
- data: choice,
348
- defaultFeedback: {},
349
- imageSupport: imageSupport,
350
- disableImageAlignmentButtons: true,
351
- onDelete: function onDelete() {
352
- return onRemoveChoice(index);
353
- },
354
- onChange: function onChange(c) {
355
- return onChoiceChanged(index, c);
356
- },
357
- allowFeedBack: feedbackEnabled,
358
- allowDelete: deleteChoice.settings,
359
- noLabels: true,
360
- pluginOpts: getPluginProps(configuration === null || configuration === void 0 ? void 0 : (_configuration$choice = configuration.choices) === null || _configuration$choice === void 0 ? void 0 : _configuration$choice.inputConfiguration),
361
- toolbarOpts: toolbarOpts,
362
- spellCheck: spellCheckEnabled,
363
- error: (choicesErrors === null || choicesErrors === void 0 ? void 0 : choicesErrors[choice.value]) || null,
364
- noCorrectAnswerError: correctResponseError,
365
- maxImageWidth: maxImageWidth && maxImageWidth.choices || defaultImageMaxWidth,
366
- maxImageHeight: maxImageHeight && maxImageHeight.choices || defaultImageMaxHeight,
367
- uploadSoundSupport: uploadSoundSupport,
368
- mathMlOptions: mathMlOptions
369
- }), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
370
- key: "rationale-".concat(index),
371
- label: rationale.label,
372
- className: classes.rationaleHolder
373
- }, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
374
- className: classes.rationale,
375
- markup: choice.rationale || '',
376
- onChange: function onChange(c) {
377
- return onChoiceChanged(index, _objectSpread(_objectSpread({}, choice), {}, {
378
- rationale: c
379
- }));
380
- },
381
- imageSupport: imageSupport,
382
- error: (rationaleErrors === null || rationaleErrors === void 0 ? void 0 : rationaleErrors[choice.value]) || null,
383
- toolbarOpts: toolbarOpts,
384
- pluginProps: getPluginProps(configuration === null || configuration === void 0 ? void 0 : (_configuration$ration = configuration.rationale) === null || _configuration$ration === void 0 ? void 0 : _configuration$ration.inputConfiguration),
385
- spellCheck: spellCheckEnabled,
386
- maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
387
- maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
388
- uploadSoundSupport: uploadSoundSupport,
389
- languageCharactersProps: [{
390
- language: 'spanish'
391
- }, {
392
- language: 'special'
393
- }],
394
- mathMlOptions: mathMlOptions
395
- }), (rationaleErrors === null || rationaleErrors === void 0 ? void 0 : rationaleErrors[choice.value]) && /*#__PURE__*/_react["default"].createElement("div", {
396
- className: classes.errorText
397
- }, rationaleErrors === null || rationaleErrors === void 0 ? void 0 : rationaleErrors[choice.value])));
398
- }), correctResponseError && /*#__PURE__*/_react["default"].createElement("div", {
399
- className: classes.errorText
400
- }, correctResponseError), answerChoicesError && /*#__PURE__*/_react["default"].createElement("div", {
401
- className: classes.errorText
402
- }, answerChoicesError), addChoiceButton.settings && /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
403
- title: addChoiceButtonTooltip,
404
- classes: {
405
- tooltip: classes.tooltip
406
- }
407
- }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
408
- classes: {
409
- root: maxAnswerChoices && (choices === null || choices === void 0 ? void 0 : choices.length) >= maxAnswerChoices && classes.disableButton
410
- },
411
- className: classes.addButton,
412
- variant: "contained",
413
- color: "primary",
414
- onClick: onAddChoice
415
- }, addChoiceButton.label)));
416
- });
417
-
418
- var Main = /*#__PURE__*/function (_React$Component) {
419
- (0, _inherits2["default"])(Main, _React$Component);
420
-
421
- var _super = _createSuper(Main);
422
-
423
- function Main() {
424
- var _this;
425
-
426
- (0, _classCallCheck2["default"])(this, Main);
427
-
428
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
429
- args[_key] = arguments[_key];
430
- }
431
-
432
- _this = _super.call.apply(_super, [this].concat(args));
433
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
434
- showWarning: false
435
- });
436
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRemoveChoice", function (index) {
437
- var _this$props = _this.props,
438
- model = _this$props.model,
439
- configuration = _this$props.configuration,
440
- onModelChanged = _this$props.onModelChanged;
441
-
442
- var _ref5 = configuration || {},
443
- minAnswerChoices = _ref5.minAnswerChoices;
444
-
445
- if (minAnswerChoices && model.choices.length === minAnswerChoices) {
446
- _this.setState({
447
- showWarning: true
448
- });
449
-
450
- return;
451
- }
452
-
453
- model.choices.splice(index, 1);
454
- onModelChanged(model);
455
- });
456
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAddChoice", function () {
457
- var _this$props2 = _this.props,
458
- model = _this$props2.model,
459
- configuration = _this$props2.configuration,
460
- onModelChanged = _this$props2.onModelChanged;
461
-
462
- var _ref6 = configuration || {},
463
- maxAnswerChoices = _ref6.maxAnswerChoices;
464
-
465
- var _ref7 = model || {},
466
- limitChoicesNumber = _ref7.limitChoicesNumber; // if old property is used, set maxAnswerChoices to 9
467
-
468
-
469
- if (limitChoicesNumber) {
470
- maxAnswerChoices = MAX_CHOICES;
471
- }
472
-
473
- if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {
474
- return;
475
- }
476
-
477
- model.choices.push({
478
- label: '',
479
- value: _configUi.choiceUtils.firstAvailableIndex(model.choices.map(function (c) {
480
- return c.value;
481
- }), 0),
482
- feedback: {
483
- type: 'none'
484
- }
485
- });
486
- onModelChanged(model);
487
- });
488
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChoiceChanged", function (index, choice) {
489
- var _this$props3 = _this.props,
490
- model = _this$props3.model,
491
- onModelChanged = _this$props3.onModelChanged;
492
-
493
- if (choice.correct && model.choiceMode === 'radio') {
494
- model.choices = model.choices.map(function (c) {
495
- return (0, _merge["default"])({}, c, {
496
- correct: false
497
- });
498
- });
499
- }
500
-
501
- model.choices.splice(index, 1, choice);
502
- onModelChanged(model);
503
- });
504
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPromptChanged", function (prompt) {
505
- _this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
506
- prompt: prompt
507
- }));
508
- });
509
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onTeacherInstructionsChanged", function (teacherInstructions) {
510
- _this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
511
- teacherInstructions: teacherInstructions
512
- }));
513
- });
514
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onModelChanged", function (model, key) {
515
- var onModelChanged = _this.props.onModelChanged;
516
-
517
- switch (key) {
518
- case 'choiceMode':
519
- {
520
- var value = model.choiceMode;
521
-
522
- if (value === 'radio') {
523
- var correctFound = false;
524
- model.choices = model.choices.map(function (c) {
525
- if (correctFound) {
526
- c.correct = false;
527
- return c;
528
- }
529
-
530
- if (c.correct) {
531
- correctFound = true;
532
- }
533
-
534
- return c;
535
- });
536
- }
537
-
538
- onModelChanged(model, true);
539
- break;
540
- }
541
-
542
- default:
543
- onModelChanged(model);
544
- break;
545
- }
546
- });
547
- return _this;
548
- }
549
-
550
- (0, _createClass2["default"])(Main, [{
551
- key: "render",
552
- value: function render() {
553
- var _this2 = this;
554
-
555
- var _this$props$configura = this.props.configuration;
556
- _this$props$configura = _this$props$configura === void 0 ? {} : _this$props$configura;
557
- var minAnswerChoices = _this$props$configura.minAnswerChoices;
558
- var showWarning = this.state.showWarning;
559
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_configUi.AlertDialog, {
560
- open: showWarning,
561
- title: "Warning",
562
- text: "There can't be less than ".concat(minAnswerChoices || 0, " choices."),
563
- onConfirm: function onConfirm() {
564
- return _this2.setState({
565
- showWarning: false
566
- });
567
- }
568
- }), /*#__PURE__*/_react["default"].createElement(Design, (0, _extends2["default"])({}, this.props, {
569
- onChangeModel: this.onModelChanged,
570
- onRemoveChoice: this.onRemoveChoice,
571
- onChoiceChanged: this.onChoiceChanged,
572
- onAddChoice: this.onAddChoice,
573
- onPromptChanged: this.onPromptChanged,
574
- onTeacherInstructionsChanged: this.onTeacherInstructionsChanged
575
- })));
576
- }
577
- }]);
578
- return Main;
579
- }(_react["default"].Component);
580
-
581
- exports.Main = Main;
582
- (0, _defineProperty2["default"])(Main, "propTypes", {
583
- model: _propTypes["default"].object.isRequired,
584
- configuration: _propTypes["default"].object.isRequired,
585
- disableSidePanel: _propTypes["default"].bool,
586
- onModelChanged: _propTypes["default"].func.isRequired,
587
- onConfigurationChanged: _propTypes["default"].func.isRequired,
588
- classes: _propTypes["default"].object.isRequired,
589
- imageSupport: _propTypes["default"].shape({
590
- add: _propTypes["default"].func.isRequired,
591
- "delete": _propTypes["default"].func.isRequired
592
- })
593
- });
594
- var Styled = (0, _styles.withStyles)(styles)(Main);
595
- var _default = Styled;
596
- exports["default"] = _default;
597
- //# sourceMappingURL=main.js.map