@pie-element/ebsr 12.3.4-next.3 → 13.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.
Files changed (101) hide show
  1. package/configure/lib/defaults.js +23 -36
  2. package/configure/lib/defaults.js.map +1 -1
  3. package/configure/lib/index.js +114 -202
  4. package/configure/lib/index.js.map +1 -1
  5. package/configure/lib/main.js +188 -271
  6. package/configure/lib/main.js.map +1 -1
  7. package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.json +1972 -0
  8. package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.md +4213 -0
  9. package/configure/node_modules/@pie-element/multiple-choice/PRINT.md +35 -0
  10. package/configure/node_modules/@pie-element/multiple-choice/README.md +56 -0
  11. package/configure/node_modules/@pie-element/multiple-choice/choice.png +0 -0
  12. package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.json +1387 -0
  13. package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.md +3351 -0
  14. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/__tests__/root.test.js +248 -0
  15. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js +200 -0
  16. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js.map +1 -0
  17. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js +211 -0
  18. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js.map +1 -0
  19. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js +477 -0
  20. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js.map +1 -0
  21. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js +18 -0
  22. package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js.map +1 -0
  23. package/configure/node_modules/@pie-element/multiple-choice/configure/package.json +22 -0
  24. package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.json +527 -0
  25. package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.md +2316 -0
  26. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/__tests__/index.test.js +520 -0
  27. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/__tests__/utils.test.js +8 -0
  28. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js +33 -0
  29. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js.map +1 -0
  30. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js +251 -0
  31. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js.map +1 -0
  32. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js +16 -0
  33. package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js.map +1 -0
  34. package/configure/node_modules/@pie-element/multiple-choice/controller/package.json +15 -0
  35. package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json +2993 -0
  36. package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json.md +2217 -0
  37. package/configure/node_modules/@pie-element/multiple-choice/docs/demo/config.js +8 -0
  38. package/configure/node_modules/@pie-element/multiple-choice/docs/demo/generate.js +61 -0
  39. package/configure/node_modules/@pie-element/multiple-choice/docs/demo/index.html +1 -0
  40. package/configure/node_modules/@pie-element/multiple-choice/docs/demo/pie.manifest.json +11 -0
  41. package/configure/node_modules/@pie-element/multiple-choice/docs/demo/session.js +7 -0
  42. package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json +1332 -0
  43. package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json.md +1015 -0
  44. package/configure/node_modules/@pie-element/multiple-choice/lib/__tests__/choice-input-test.js +117 -0
  45. package/configure/node_modules/@pie-element/multiple-choice/lib/__tests__/index-test.js +151 -0
  46. package/configure/node_modules/@pie-element/multiple-choice/lib/__tests__/key-events-test.js +95 -0
  47. package/configure/node_modules/@pie-element/multiple-choice/lib/__tests__/multiple-choice-test.js +223 -0
  48. package/configure/node_modules/@pie-element/multiple-choice/lib/__tests__/session-updater-test.js +70 -0
  49. package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js +370 -0
  50. package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js.map +1 -0
  51. package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js +197 -0
  52. package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js.map +1 -0
  53. package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js +130 -0
  54. package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js.map +1 -0
  55. package/configure/node_modules/@pie-element/multiple-choice/lib/index.js +292 -0
  56. package/configure/node_modules/@pie-element/multiple-choice/lib/index.js.map +1 -0
  57. package/configure/node_modules/@pie-element/multiple-choice/lib/main.js +54 -0
  58. package/configure/node_modules/@pie-element/multiple-choice/lib/main.js.map +1 -0
  59. package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js +386 -0
  60. package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js.map +1 -0
  61. package/configure/node_modules/@pie-element/multiple-choice/lib/print.js +92 -0
  62. package/configure/node_modules/@pie-element/multiple-choice/lib/print.js.map +1 -0
  63. package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js +37 -0
  64. package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js.map +1 -0
  65. package/configure/node_modules/@pie-element/multiple-choice/package.json +39 -0
  66. package/configure/package.json +9 -6
  67. package/configure/src/__tests__/index.test.js +99 -108
  68. package/configure/src/index.js +13 -6
  69. package/configure/src/main.jsx +14 -18
  70. package/controller/lib/defaults.js +20 -32
  71. package/controller/lib/defaults.js.map +1 -1
  72. package/controller/lib/index.js +224 -349
  73. package/controller/lib/index.js.map +1 -1
  74. package/controller/lib/utils.js +4 -18
  75. package/controller/lib/utils.js.map +1 -1
  76. package/controller/package.json +3 -3
  77. package/lib/index.js +113 -181
  78. package/lib/index.js.map +1 -1
  79. package/lib/print.js +120 -204
  80. package/lib/print.js.map +1 -1
  81. package/package.json +5 -13
  82. package/src/__tests__/index.test.js +18 -5
  83. package/configure/src/__tests__/__snapshots__/index.test.js.snap +0 -83
  84. package/esm/configure.js +0 -12003
  85. package/esm/configure.js.map +0 -1
  86. package/esm/controller.js +0 -3358
  87. package/esm/controller.js.map +0 -1
  88. package/esm/element.js +0 -2203
  89. package/esm/element.js.map +0 -1
  90. package/esm/package.json +0 -3
  91. package/esm/print.js +0 -4092
  92. package/esm/print.js.map +0 -1
  93. package/module/configure.js +0 -1
  94. package/module/controller.js +0 -6469
  95. package/module/demo.js +0 -77
  96. package/module/element.js +0 -1
  97. package/module/index.html +0 -21
  98. package/module/manifest.json +0 -14
  99. package/module/print-demo.js +0 -115
  100. package/module/print.html +0 -18
  101. package/module/print.js +0 -1
@@ -1,305 +1,222 @@
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.Main = void 0;
9
-
10
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
7
+ exports.default = exports.Main = void 0;
24
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
9
  var _react = _interopRequireDefault(require("react"));
27
-
28
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
29
-
30
11
  var _configUi = require("@pie-lib/config-ui");
31
-
32
- var _styles = require("@material-ui/core/styles");
33
-
34
- var _excluded = ["contentDimensions", "partA", "partB", "partialScoring", "settingsPanelDisabled", "scoringType", "language", "languageChoices"];
35
-
36
- 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; }
37
-
38
- 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; }
39
-
40
- 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); }; }
41
-
42
- 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; } }
43
-
44
- var Panel = _configUi.settings.Panel,
45
- toggle = _configUi.settings.toggle,
46
- radio = _configUi.settings.radio,
47
- dropdown = _configUi.settings.dropdown;
48
-
49
- var styles = function styles(theme) {
50
- return {
51
- partLabel: {
52
- paddingBottom: theme.spacing.unit * 2
53
- },
54
- divider: {
55
- flex: 1,
56
- height: theme.spacing.unit * 2.5
57
- }
58
- };
59
- };
60
-
61
- var Main = /*#__PURE__*/function (_React$Component) {
62
- (0, _inherits2["default"])(Main, _React$Component);
63
-
64
- var _super = _createSuper(Main);
65
-
66
- function Main() {
67
- var _this;
68
-
69
- (0, _classCallCheck2["default"])(this, Main);
70
-
71
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
72
- args[_key] = arguments[_key];
73
- }
74
-
75
- _this = _super.call.apply(_super, [this].concat(args));
76
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "removeExtraChoices", function (choices) {
77
- var correctFound = false;
78
- return (choices || []).map(function (choice) {
12
+ var _styles = require("@mui/material/styles");
13
+ const {
14
+ Panel,
15
+ toggle,
16
+ radio,
17
+ dropdown
18
+ } = _configUi.settings;
19
+ const PartLabel = (0, _styles.styled)('div')(({
20
+ theme
21
+ }) => ({
22
+ paddingBottom: theme.spacing(2)
23
+ }));
24
+ const Divider = (0, _styles.styled)('div')(({
25
+ theme
26
+ }) => ({
27
+ flex: 1,
28
+ height: theme.spacing(2.5)
29
+ }));
30
+ class Main extends _react.default.Component {
31
+ constructor(...args) {
32
+ super(...args);
33
+ (0, _defineProperty2.default)(this, "removeExtraChoices", choices => {
34
+ let correctFound = false;
35
+ return (choices || []).map(choice => {
79
36
  if (correctFound) {
80
37
  choice.correct = false;
81
38
  return choice;
82
39
  }
83
-
84
40
  if (choice.correct) {
85
41
  correctFound = true;
86
42
  }
87
-
88
43
  return choice;
89
44
  });
90
45
  });
91
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onModelChanged", function (model, key) {
92
- var onModelChanged = _this.props.onModelChanged;
93
-
46
+ (0, _defineProperty2.default)(this, "onModelChanged", (model, key) => {
47
+ const {
48
+ onModelChanged
49
+ } = this.props;
94
50
  if (key === 'partA.choiceMode' && model.partA.choiceMode === 'radio') {
95
- model.partA.choices = _this.removeExtraChoices(model.partA.choices);
51
+ model.partA.choices = this.removeExtraChoices(model.partA.choices);
96
52
  return onModelChanged(model, true);
97
53
  }
98
-
99
54
  if (key === 'partB.choiceMode' && model.partB.choiceMode === 'radio') {
100
- model.partB.choices = _this.removeExtraChoices(model.partB.choices);
55
+ model.partB.choices = this.removeExtraChoices(model.partB.choices);
101
56
  return onModelChanged(model, true);
102
57
  }
103
-
104
58
  return onModelChanged(model);
105
59
  });
106
- return _this;
107
60
  }
108
-
109
- (0, _createClass2["default"])(Main, [{
110
- key: "render",
111
- value: function render() {
112
- var _ref3,
113
- _this2 = this;
114
-
115
- var _this$props = this.props,
116
- classes = _this$props.classes,
117
- model = _this$props.model,
118
- configuration = _this$props.configuration,
119
- onConfigurationChanged = _this$props.onConfigurationChanged;
120
- var partLabelType = model.partLabelType,
121
- modelPartA = model.partA,
122
- modelPartB = model.partB,
123
- extraCSSRules = model.extraCSSRules;
124
- var _configuration$conten = configuration.contentDimensions,
125
- contentDimensions = _configuration$conten === void 0 ? {} : _configuration$conten,
126
- _configuration$partA = configuration.partA,
127
- partA = _configuration$partA === void 0 ? {} : _configuration$partA,
128
- _configuration$partB = configuration.partB,
129
- partB = _configuration$partB === void 0 ? {} : _configuration$partB,
130
- _configuration$partia = configuration.partialScoring,
131
- partialScoring = _configuration$partia === void 0 ? {} : _configuration$partia,
132
- settingsPanelDisabled = configuration.settingsPanelDisabled,
133
- _configuration$scorin = configuration.scoringType,
134
- scoringType = _configuration$scorin === void 0 ? {} : _configuration$scorin,
135
- _configuration$langua = configuration.language,
136
- language = _configuration$langua === void 0 ? {} : _configuration$langua,
137
- _configuration$langua2 = configuration.languageChoices,
138
- languageChoices = _configuration$langua2 === void 0 ? {} : _configuration$langua2,
139
- generalConfiguration = (0, _objectWithoutProperties2["default"])(configuration, _excluded);
140
-
141
- var _ref = partA || {},
142
- _ref$feedback = _ref.feedback,
143
- feedbackA = _ref$feedback === void 0 ? {} : _ref$feedback,
144
- _ref$choiceMode = _ref.choiceMode,
145
- choiceModeA = _ref$choiceMode === void 0 ? {} : _ref$choiceMode,
146
- _ref$choicePrefix = _ref.choicePrefix,
147
- choicePrefixA = _ref$choicePrefix === void 0 ? {} : _ref$choicePrefix,
148
- _ref$lockChoiceOrder = _ref.lockChoiceOrder,
149
- lockChoiceOrderA = _ref$lockChoiceOrder === void 0 ? {} : _ref$lockChoiceOrder,
150
- _ref$prompt = _ref.prompt,
151
- promptA = _ref$prompt === void 0 ? {} : _ref$prompt,
152
- _ref$teacherInstructi = _ref.teacherInstructions,
153
- teacherInstructionsA = _ref$teacherInstructi === void 0 ? {} : _ref$teacherInstructi,
154
- _ref$studentInstructi = _ref.studentInstructions,
155
- studentInstructionsA = _ref$studentInstructi === void 0 ? {} : _ref$studentInstructi,
156
- _ref$choicesLayout = _ref.choicesLayout,
157
- choicesLayoutA = _ref$choicesLayout === void 0 ? {} : _ref$choicesLayout,
158
- _ref$gridColumns = _ref.gridColumns,
159
- gridColumnsA = _ref$gridColumns === void 0 ? {} : _ref$gridColumns,
160
- _ref$rationale = _ref.rationale,
161
- rationaleA = _ref$rationale === void 0 ? {} : _ref$rationale,
162
- _ref$spellCheck = _ref.spellCheck,
163
- spellCheckA = _ref$spellCheck === void 0 ? {} : _ref$spellCheck;
164
-
165
- var _ref2 = partB || {},
166
- _ref2$feedback = _ref2.feedback,
167
- feedbackB = _ref2$feedback === void 0 ? {} : _ref2$feedback,
168
- _ref2$choiceMode = _ref2.choiceMode,
169
- choiceModeB = _ref2$choiceMode === void 0 ? {} : _ref2$choiceMode,
170
- _ref2$choicePrefix = _ref2.choicePrefix,
171
- choicePrefixB = _ref2$choicePrefix === void 0 ? {} : _ref2$choicePrefix,
172
- _ref2$lockChoiceOrder = _ref2.lockChoiceOrder,
173
- lockChoiceOrderB = _ref2$lockChoiceOrder === void 0 ? {} : _ref2$lockChoiceOrder,
174
- _ref2$prompt = _ref2.prompt,
175
- promptB = _ref2$prompt === void 0 ? {} : _ref2$prompt,
176
- _ref2$teacherInstruct = _ref2.teacherInstructions,
177
- teacherInstructionsB = _ref2$teacherInstruct === void 0 ? {} : _ref2$teacherInstruct,
178
- _ref2$studentInstruct = _ref2.studentInstructions,
179
- studentInstructionsB = _ref2$studentInstruct === void 0 ? {} : _ref2$studentInstruct,
180
- _ref2$choicesLayout = _ref2.choicesLayout,
181
- choicesLayoutB = _ref2$choicesLayout === void 0 ? {} : _ref2$choicesLayout,
182
- _ref2$gridColumns = _ref2.gridColumns,
183
- gridColumnsB = _ref2$gridColumns === void 0 ? {} : _ref2$gridColumns,
184
- _ref2$rationale = _ref2.rationale,
185
- rationaleB = _ref2$rationale === void 0 ? {} : _ref2$rationale,
186
- _ref2$spellCheck = _ref2.spellCheck,
187
- spellCheckB = _ref2$spellCheck === void 0 ? {} : _ref2$spellCheck;
188
-
189
- var type = partLabelType || 'Numbers';
190
- var typeIsNumber = type === 'Numbers';
191
- var firstPart = "Part ".concat(typeIsNumber ? '1' : 'A');
192
- var secondPart = "Part ".concat(typeIsNumber ? '2' : 'B');
193
- var nrOfColumnsAvailable = {
194
- partA: modelPartA.choices && modelPartA.choices.length ? Array.from({
195
- length: modelPartA.choices.length
196
- }, function (_, i) {
197
- return "".concat(i + 1);
198
- }) : [],
199
- partB: modelPartB.choices && modelPartB.choices.length ? Array.from({
200
- length: modelPartB.choices.length
201
- }, function (_, i) {
202
- return "".concat(i + 1);
203
- }) : []
204
- };
205
- var panelSettings = {
206
- partLabels: generalConfiguration.partLabels.settings && toggle(generalConfiguration.partLabels.label),
207
- partLabelType: model.partLabels && dropdown('', ['Numbers', 'Letters']),
208
- partialScoring: partialScoring.settings && toggle(partialScoring.label),
209
- scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
210
- 'language.enabled': language.settings && toggle(language.label, true),
211
- language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
212
- };
213
- var panelSettingsPartA = {
214
- 'partA.choiceMode': choiceModeA.settings && radio(choiceModeA.label, ['checkbox', 'radio']),
215
- 'partA.choicePrefix': choicePrefixA.settings && radio(choicePrefixA.label, ['numbers', 'letters']),
216
- 'partA.lockChoiceOrder': lockChoiceOrderA.settings && toggle(lockChoiceOrderA.label),
217
- 'partA.choicesLayout': choicesLayoutA.settings && dropdown(choicesLayoutA.label, ['vertical', 'grid', 'horizontal']),
218
- 'partA.gridColumns': choicesLayoutA.settings && modelPartA.choicesLayout === 'grid' && nrOfColumnsAvailable.partA.length > 0 && dropdown(gridColumnsA.label, nrOfColumnsAvailable.partA)
219
- };
220
- var panelPropertiesPartA = {
221
- 'partA.feedbackEnabled': feedbackA.settings && toggle(feedbackA.label),
222
- 'partA.promptEnabled': promptA.settings && toggle(promptA.label),
223
- 'partA.teacherInstructionsEnabled': teacherInstructionsA.settings && toggle(teacherInstructionsA.label),
224
- 'partA.studentInstructionsEnabled': studentInstructionsA.settings && toggle(studentInstructionsA.label),
225
- 'partA.rationaleEnabled': rationaleA.settings && toggle(rationaleA.label),
226
- 'partA.spellCheckEnabled': spellCheckA.settings && toggle(spellCheckA.label)
227
- };
228
- var panelSettingsPartB = {
229
- 'partB.choiceMode': choiceModeB.settings && radio(choiceModeB.label, ['checkbox', 'radio']),
230
- 'partB.choicePrefix': choicePrefixB.settings && radio(choicePrefixB.label, ['numbers', 'letters']),
231
- 'partB.lockChoiceOrder': lockChoiceOrderB.settings && toggle(lockChoiceOrderB.label),
232
- 'partB.choicesLayout': choicesLayoutB.settings && dropdown(choicesLayoutB.label, ['vertical', 'grid', 'horizontal']),
233
- 'partB.gridColumns': choicesLayoutB.settings && modelPartB.choicesLayout === 'grid' && nrOfColumnsAvailable.partB.length > 0 && dropdown(gridColumnsB.label, nrOfColumnsAvailable.partB)
234
- };
235
- var panelPropertiesPartB = {
236
- 'partB.feedbackEnabled': feedbackB.settings && toggle(feedbackB.label),
237
- 'partB.promptEnabled': promptB.settings && toggle(promptB.label),
238
- 'partB.teacherInstructionsEnabled': teacherInstructionsB.settings && toggle(teacherInstructionsB.label),
239
- 'partB.studentInstructionsEnabled': studentInstructionsB.settings && toggle(studentInstructionsB.label),
240
- 'partB.rationaleEnabled': rationaleB.settings && toggle(rationaleB.label),
241
- 'partB.spellCheckEnabled': spellCheckB.settings && toggle(spellCheckB.label)
242
- };
243
- return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
244
- extraCSSRules: extraCSSRules,
245
- dimensions: contentDimensions,
246
- hideSettings: settingsPanelDisabled,
247
- settings: /*#__PURE__*/_react["default"].createElement(Panel, {
248
- model: model,
249
- onChangeModel: this.onModelChanged,
250
- configuration: configuration,
251
- onChangeConfiguration: onConfigurationChanged,
252
- groups: (_ref3 = {
253
- 'Settings for both': panelSettings
254
- }, (0, _defineProperty2["default"])(_ref3, "Settings ".concat(firstPart), panelSettingsPartA), (0, _defineProperty2["default"])(_ref3, "Properties ".concat(firstPart), panelPropertiesPartA), (0, _defineProperty2["default"])(_ref3, "Settings ".concat(secondPart), panelSettingsPartB), (0, _defineProperty2["default"])(_ref3, "Properties ".concat(secondPart), panelPropertiesPartB), _ref3)
255
- })
256
- }, model.partLabels && /*#__PURE__*/_react["default"].createElement("div", {
257
- className: classes.partLabel
258
- }, firstPart), /*#__PURE__*/_react["default"].createElement("ebsr-multiple-choice-configure", {
259
- id: "A",
260
- key: "partA",
261
- ref: function ref(_ref4) {
262
- if (_ref4) {
263
- // do not use destructuring to get model from props
264
- _this2.partA = _ref4;
265
- _this2.partA._model = _objectSpread(_objectSpread({}, _this2.props.model.partA), {}, {
266
- errors: _this2.props.model.errors && _this2.props.model.errors.partA || {}
267
- });
268
- _this2.partA.configuration = _objectSpread(_objectSpread({}, partA), generalConfiguration);
269
- }
61
+ render() {
62
+ const {
63
+ model,
64
+ configuration,
65
+ onConfigurationChanged
66
+ } = this.props;
67
+ const {
68
+ partLabelType,
69
+ partA: modelPartA,
70
+ partB: modelPartB,
71
+ extraCSSRules
72
+ } = model;
73
+ const {
74
+ contentDimensions = {},
75
+ partA = {},
76
+ partB = {},
77
+ partialScoring = {},
78
+ settingsPanelDisabled,
79
+ scoringType = {},
80
+ language = {},
81
+ languageChoices = {},
82
+ ...generalConfiguration
83
+ } = configuration;
84
+ const {
85
+ feedback: feedbackA = {},
86
+ choiceMode: choiceModeA = {},
87
+ choicePrefix: choicePrefixA = {},
88
+ lockChoiceOrder: lockChoiceOrderA = {},
89
+ prompt: promptA = {},
90
+ teacherInstructions: teacherInstructionsA = {},
91
+ studentInstructions: studentInstructionsA = {},
92
+ choicesLayout: choicesLayoutA = {},
93
+ gridColumns: gridColumnsA = {},
94
+ rationale: rationaleA = {},
95
+ spellCheck: spellCheckA = {}
96
+ } = partA || {};
97
+ const {
98
+ feedback: feedbackB = {},
99
+ choiceMode: choiceModeB = {},
100
+ choicePrefix: choicePrefixB = {},
101
+ lockChoiceOrder: lockChoiceOrderB = {},
102
+ prompt: promptB = {},
103
+ teacherInstructions: teacherInstructionsB = {},
104
+ studentInstructions: studentInstructionsB = {},
105
+ choicesLayout: choicesLayoutB = {},
106
+ gridColumns: gridColumnsB = {},
107
+ rationale: rationaleB = {},
108
+ spellCheck: spellCheckB = {}
109
+ } = partB || {};
110
+ const type = partLabelType || 'Numbers';
111
+ const typeIsNumber = type === 'Numbers';
112
+ const firstPart = `Part ${typeIsNumber ? '1' : 'A'}`;
113
+ const secondPart = `Part ${typeIsNumber ? '2' : 'B'}`;
114
+ const nrOfColumnsAvailable = {
115
+ partA: modelPartA.choices && modelPartA.choices.length ? Array.from({
116
+ length: modelPartA.choices.length
117
+ }, (_, i) => `${i + 1}`) : [],
118
+ partB: modelPartB.choices && modelPartB.choices.length ? Array.from({
119
+ length: modelPartB.choices.length
120
+ }, (_, i) => `${i + 1}`) : []
121
+ };
122
+ const panelSettings = {
123
+ partLabels: generalConfiguration.partLabels.settings && toggle(generalConfiguration.partLabels.label),
124
+ partLabelType: model.partLabels && dropdown('', ['Numbers', 'Letters']),
125
+ partialScoring: partialScoring.settings && toggle(partialScoring.label),
126
+ scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
127
+ 'language.enabled': language.settings && toggle(language.label, true),
128
+ language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
129
+ };
130
+ const panelSettingsPartA = {
131
+ 'partA.choiceMode': choiceModeA.settings && radio(choiceModeA.label, ['checkbox', 'radio']),
132
+ 'partA.choicePrefix': choicePrefixA.settings && radio(choicePrefixA.label, ['numbers', 'letters']),
133
+ 'partA.lockChoiceOrder': lockChoiceOrderA.settings && toggle(lockChoiceOrderA.label),
134
+ 'partA.choicesLayout': choicesLayoutA.settings && dropdown(choicesLayoutA.label, ['vertical', 'grid', 'horizontal']),
135
+ 'partA.gridColumns': choicesLayoutA.settings && modelPartA.choicesLayout === 'grid' && nrOfColumnsAvailable.partA.length > 0 && dropdown(gridColumnsA.label, nrOfColumnsAvailable.partA)
136
+ };
137
+ const panelPropertiesPartA = {
138
+ 'partA.feedbackEnabled': feedbackA.settings && toggle(feedbackA.label),
139
+ 'partA.promptEnabled': promptA.settings && toggle(promptA.label),
140
+ 'partA.teacherInstructionsEnabled': teacherInstructionsA.settings && toggle(teacherInstructionsA.label),
141
+ 'partA.studentInstructionsEnabled': studentInstructionsA.settings && toggle(studentInstructionsA.label),
142
+ 'partA.rationaleEnabled': rationaleA.settings && toggle(rationaleA.label),
143
+ 'partA.spellCheckEnabled': spellCheckA.settings && toggle(spellCheckA.label)
144
+ };
145
+ const panelSettingsPartB = {
146
+ 'partB.choiceMode': choiceModeB.settings && radio(choiceModeB.label, ['checkbox', 'radio']),
147
+ 'partB.choicePrefix': choicePrefixB.settings && radio(choicePrefixB.label, ['numbers', 'letters']),
148
+ 'partB.lockChoiceOrder': lockChoiceOrderB.settings && toggle(lockChoiceOrderB.label),
149
+ 'partB.choicesLayout': choicesLayoutB.settings && dropdown(choicesLayoutB.label, ['vertical', 'grid', 'horizontal']),
150
+ 'partB.gridColumns': choicesLayoutB.settings && modelPartB.choicesLayout === 'grid' && nrOfColumnsAvailable.partB.length > 0 && dropdown(gridColumnsB.label, nrOfColumnsAvailable.partB)
151
+ };
152
+ const panelPropertiesPartB = {
153
+ 'partB.feedbackEnabled': feedbackB.settings && toggle(feedbackB.label),
154
+ 'partB.promptEnabled': promptB.settings && toggle(promptB.label),
155
+ 'partB.teacherInstructionsEnabled': teacherInstructionsB.settings && toggle(teacherInstructionsB.label),
156
+ 'partB.studentInstructionsEnabled': studentInstructionsB.settings && toggle(studentInstructionsB.label),
157
+ 'partB.rationaleEnabled': rationaleB.settings && toggle(rationaleB.label),
158
+ 'partB.spellCheckEnabled': spellCheckB.settings && toggle(spellCheckB.label)
159
+ };
160
+ return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
161
+ extraCSSRules: extraCSSRules,
162
+ dimensions: contentDimensions,
163
+ hideSettings: settingsPanelDisabled,
164
+ settings: /*#__PURE__*/_react.default.createElement(Panel, {
165
+ model: model,
166
+ onChangeModel: this.onModelChanged,
167
+ configuration: configuration,
168
+ onChangeConfiguration: onConfigurationChanged,
169
+ groups: {
170
+ 'Settings for both': panelSettings,
171
+ [`Settings ${firstPart}`]: panelSettingsPartA,
172
+ [`Properties ${firstPart}`]: panelPropertiesPartA,
173
+ [`Settings ${secondPart}`]: panelSettingsPartB,
174
+ [`Properties ${secondPart}`]: panelPropertiesPartB
270
175
  }
271
- }), /*#__PURE__*/_react["default"].createElement("div", {
272
- className: classes.divider
273
- }), model.partLabels && /*#__PURE__*/_react["default"].createElement("div", {
274
- className: classes.partLabel
275
- }, secondPart), /*#__PURE__*/_react["default"].createElement("ebsr-multiple-choice-configure", {
276
- id: "B",
277
- key: "partB",
278
- ref: function ref(_ref5) {
279
- if (_ref5) {
280
- // do not use destructuring to get model from props
281
- _this2.partB = _ref5;
282
- _this2.partB._model = _objectSpread(_objectSpread({}, _this2.props.model.partB), {}, {
283
- errors: _this2.props.model.errors && _this2.props.model.errors.partB || {}
284
- });
285
- _this2.partB.configuration = _objectSpread(_objectSpread({}, partB), generalConfiguration);
286
- }
176
+ })
177
+ }, model.partLabels && /*#__PURE__*/_react.default.createElement(PartLabel, null, firstPart), /*#__PURE__*/_react.default.createElement("ebsr-multiple-choice-configure", {
178
+ id: "A",
179
+ key: "partA",
180
+ ref: ref => {
181
+ if (ref) {
182
+ // do not use destructuring to get model from props
183
+ this.partA = ref;
184
+ this.partA._model = {
185
+ ...this.props.model.partA,
186
+ errors: this.props.model.errors && this.props.model.errors.partA || {}
187
+ };
188
+ this.partA.configuration = {
189
+ ...partA,
190
+ ...generalConfiguration
191
+ };
287
192
  }
288
- }));
289
- }
290
- }]);
291
- return Main;
292
- }(_react["default"].Component);
293
-
193
+ }
194
+ }), /*#__PURE__*/_react.default.createElement(Divider, null), model.partLabels && /*#__PURE__*/_react.default.createElement(PartLabel, null, secondPart), /*#__PURE__*/_react.default.createElement("ebsr-multiple-choice-configure", {
195
+ id: "B",
196
+ key: "partB",
197
+ ref: ref => {
198
+ if (ref) {
199
+ // do not use destructuring to get model from props
200
+ this.partB = ref;
201
+ this.partB._model = {
202
+ ...this.props.model.partB,
203
+ errors: this.props.model.errors && this.props.model.errors.partB || {}
204
+ };
205
+ this.partB.configuration = {
206
+ ...partB,
207
+ ...generalConfiguration
208
+ };
209
+ }
210
+ }
211
+ }));
212
+ }
213
+ }
294
214
  exports.Main = Main;
295
- (0, _defineProperty2["default"])(Main, "propTypes", {
296
- classes: _propTypes["default"].object,
297
- configuration: _propTypes["default"].object,
298
- model: _propTypes["default"].object,
299
- onModelChanged: _propTypes["default"].func,
300
- onConfigurationChanged: _propTypes["default"].func
215
+ (0, _defineProperty2.default)(Main, "propTypes", {
216
+ configuration: _propTypes.default.object,
217
+ model: _propTypes.default.object,
218
+ onModelChanged: _propTypes.default.func,
219
+ onConfigurationChanged: _propTypes.default.func
301
220
  });
302
- var Styled = (0, _styles.withStyles)(styles)(Main);
303
- var _default = Styled;
304
- exports["default"] = _default;
221
+ var _default = exports.default = Main;
305
222
  //# sourceMappingURL=main.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","radio","dropdown","styles","theme","partLabel","paddingBottom","spacing","unit","divider","flex","height","Main","choices","correctFound","map","choice","correct","model","key","onModelChanged","props","partA","choiceMode","removeExtraChoices","partB","classes","configuration","onConfigurationChanged","partLabelType","modelPartA","modelPartB","extraCSSRules","contentDimensions","partialScoring","settingsPanelDisabled","scoringType","language","languageChoices","generalConfiguration","feedback","feedbackA","choiceModeA","choicePrefix","choicePrefixA","lockChoiceOrder","lockChoiceOrderA","prompt","promptA","teacherInstructions","teacherInstructionsA","studentInstructions","studentInstructionsA","choicesLayout","choicesLayoutA","gridColumns","gridColumnsA","rationale","rationaleA","spellCheck","spellCheckA","feedbackB","choiceModeB","choicePrefixB","lockChoiceOrderB","promptB","teacherInstructionsB","studentInstructionsB","choicesLayoutB","gridColumnsB","rationaleB","spellCheckB","type","typeIsNumber","firstPart","secondPart","nrOfColumnsAvailable","length","Array","from","_","i","panelSettings","partLabels","label","enabled","options","panelSettingsPartA","panelPropertiesPartA","panelSettingsPartB","panelPropertiesPartB","ref","_model","errors","React","Component","PropTypes","object","func","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAQA,KAAR,GAA2CC,kBAA3C,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA2CD,kBAA3C,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAA2CF,kBAA3C,CAAuBE,KAAvB;AAAA,IAA8BC,QAA9B,GAA2CH,kBAA3C,CAA8BG,QAA9B;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,aAAa,EAAEF,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB;AAD3B,KADc;AAIzBC,IAAAA,OAAO,EAAE;AACPC,MAAAA,IAAI,EAAE,CADC;AAEPC,MAAAA,MAAM,EAAEP,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB;A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AA,MAAI,CAACA,KAAL,CAAWK,aAAX,mCACKL,KADL,GAEKiB,oBAFL;AAID;AACF;AAhBH,QArBF,eAwCE;AAAK,QAAA,SAAS,EAAEb,OAAO,CAACjB;AAAxB,QAxCF,EA0CGS,KAAK,CAACiE,UAAN,iBAAoB;AAAK,QAAA,SAAS,EAAEzD,OAAO,CAACrB;AAAxB,SAAoCsE,UAApC,CA1CvB,eA2CE;AACE,QAAA,EAAE,EAAC,GADL;AAEE,QAAA,GAAG,EAAC,OAFN;AAGE,QAAA,GAAG,EAAE,aAACgB,KAAD,EAAS;AACZ,cAAIA,KAAJ,EAAS;AACP;AACA,YAAA,MAAI,CAAClE,KAAL,GAAakE,KAAb;AACA,YAAA,MAAI,CAAClE,KAAL,CAAWmE,MAAX,mCACK,MAAI,CAACvE,KAAL,CAAWH,KAAX,CAAiBO,KADtB;AAEEoE,cAAAA,MAAM,EAAG,MAAI,CAACxE,KAAL,CAAWH,KAAX,CAAiB2E,MAAjB,IAA2B,MAAI,CAACxE,KAAL,CAAWH,KAAX,CAAiB2E,MAAjB,CAAwBpE,KAApD,IAA8D;AAFxE;AAIA,YAAA,MAAI,CAACA,KAAL,CAAWE,aAAX,mCACKF,KADL,GAEKc,oBAFL;AAID;AACF;AAhBH,QA3CF,CADF;AAgED;;;EAxNuBuD,kBAAMC,S;;;iCAAnBnF,I,eACQ;AACjBc,EAAAA,OAAO,EAAEsE,sBAAUC,MADF;AAEjBtE,EAAAA,aAAa,EAAEqE,sBAAUC,MAFR;AAGjB/E,EAAAA,KAAK,EAAE8E,sBAAUC,MAHA;AAIjB7E,EAAAA,cAAc,EAAE4E,sBAAUE,IAJT;AAKjBtE,EAAAA,sBAAsB,EAAEoE,sBAAUE;AALjB,C;AA0NrB,IAAMC,MAAM,GAAG,wBAAWhG,MAAX,EAAmBS,IAAnB,CAAf;eAEeuF,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { settings, layout } from '@pie-lib/config-ui';\nimport { withStyles } from '@material-ui/core/styles';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst styles = (theme) => ({\n partLabel: {\n paddingBottom: theme.spacing.unit * 2,\n },\n divider: {\n flex: 1,\n height: theme.spacing.unit * 2.5,\n },\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n configuration: PropTypes.object,\n model: PropTypes.object,\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n };\n\n removeExtraChoices = (choices) => {\n let correctFound = false;\n\n return (choices || []).map((choice) => {\n if (correctFound) {\n choice.correct = false;\n\n return choice;\n }\n\n if (choice.correct) {\n correctFound = true;\n }\n\n return choice;\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n if (key === 'partA.choiceMode' && model.partA.choiceMode === 'radio') {\n model.partA.choices = this.removeExtraChoices(model.partA.choices);\n\n return onModelChanged(model, true);\n }\n\n if (key === 'partB.choiceMode' && model.partB.choiceMode === 'radio') {\n model.partB.choices = this.removeExtraChoices(model.partB.choices);\n\n return onModelChanged(model, true);\n }\n\n return onModelChanged(model);\n };\n\n render() {\n const { classes, model, configuration, onConfigurationChanged } = this.props;\n const { partLabelType, partA: modelPartA, partB: modelPartB, extraCSSRules } = model;\n const {\n contentDimensions = {},\n partA = {},\n partB = {},\n partialScoring = {},\n settingsPanelDisabled,\n scoringType = {},\n language = {},\n languageChoices = {},\n ...generalConfiguration\n } = configuration;\n const {\n feedback: feedbackA = {},\n choiceMode: choiceModeA = {},\n choicePrefix: choicePrefixA = {},\n lockChoiceOrder: lockChoiceOrderA = {},\n prompt: promptA = {},\n teacherInstructions: teacherInstructionsA = {},\n studentInstructions: studentInstructionsA = {},\n choicesLayout: choicesLayoutA = {},\n gridColumns: gridColumnsA = {},\n rationale: rationaleA = {},\n spellCheck: spellCheckA = {},\n } = partA || {};\n const {\n feedback: feedbackB = {},\n choiceMode: choiceModeB = {},\n choicePrefix: choicePrefixB = {},\n lockChoiceOrder: lockChoiceOrderB = {},\n prompt: promptB = {},\n teacherInstructions: teacherInstructionsB = {},\n studentInstructions: studentInstructionsB = {},\n choicesLayout: choicesLayoutB = {},\n gridColumns: gridColumnsB = {},\n rationale: rationaleB = {},\n spellCheck: spellCheckB = {},\n } = partB || {};\n\n const type = partLabelType || 'Numbers';\n const typeIsNumber = type === 'Numbers';\n const firstPart = `Part ${typeIsNumber ? '1' : 'A'}`;\n const secondPart = `Part ${typeIsNumber ? '2' : 'B'}`;\n const nrOfColumnsAvailable = {\n partA:\n modelPartA.choices && modelPartA.choices.length\n ? Array.from({ length: modelPartA.choices.length }, (_, i) => `${i + 1}`)\n : [],\n partB:\n modelPartB.choices && modelPartB.choices.length\n ? Array.from({ length: modelPartB.choices.length }, (_, i) => `${i + 1}`)\n : [],\n };\n\n const panelSettings = {\n partLabels: generalConfiguration.partLabels.settings && toggle(generalConfiguration.partLabels.label),\n partLabelType: model.partLabels && dropdown('', ['Numbers', 'Letters']),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n };\n\n const panelSettingsPartA = {\n 'partA.choiceMode': choiceModeA.settings && radio(choiceModeA.label, ['checkbox', 'radio']),\n 'partA.choicePrefix': choicePrefixA.settings && radio(choicePrefixA.label, ['numbers', 'letters']),\n 'partA.lockChoiceOrder': lockChoiceOrderA.settings && toggle(lockChoiceOrderA.label),\n 'partA.choicesLayout':\n choicesLayoutA.settings && dropdown(choicesLayoutA.label, ['vertical', 'grid', 'horizontal']),\n 'partA.gridColumns':\n choicesLayoutA.settings &&\n modelPartA.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.partA.length > 0 &&\n dropdown(gridColumnsA.label, nrOfColumnsAvailable.partA),\n };\n const panelPropertiesPartA = {\n 'partA.feedbackEnabled': feedbackA.settings && toggle(feedbackA.label),\n 'partA.promptEnabled': promptA.settings && toggle(promptA.label),\n 'partA.teacherInstructionsEnabled': teacherInstructionsA.settings && toggle(teacherInstructionsA.label),\n 'partA.studentInstructionsEnabled': studentInstructionsA.settings && toggle(studentInstructionsA.label),\n 'partA.rationaleEnabled': rationaleA.settings && toggle(rationaleA.label),\n 'partA.spellCheckEnabled': spellCheckA.settings && toggle(spellCheckA.label),\n };\n\n const panelSettingsPartB = {\n 'partB.choiceMode': choiceModeB.settings && radio(choiceModeB.label, ['checkbox', 'radio']),\n 'partB.choicePrefix': choicePrefixB.settings && radio(choicePrefixB.label, ['numbers', 'letters']),\n 'partB.lockChoiceOrder': lockChoiceOrderB.settings && toggle(lockChoiceOrderB.label),\n 'partB.choicesLayout':\n choicesLayoutB.settings && dropdown(choicesLayoutB.label, ['vertical', 'grid', 'horizontal']),\n 'partB.gridColumns':\n choicesLayoutB.settings &&\n modelPartB.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.partB.length > 0 &&\n dropdown(gridColumnsB.label, nrOfColumnsAvailable.partB),\n };\n const panelPropertiesPartB = {\n 'partB.feedbackEnabled': feedbackB.settings && toggle(feedbackB.label),\n 'partB.promptEnabled': promptB.settings && toggle(promptB.label),\n 'partB.teacherInstructionsEnabled': teacherInstructionsB.settings && toggle(teacherInstructionsB.label),\n 'partB.studentInstructionsEnabled': studentInstructionsB.settings && toggle(studentInstructionsB.label),\n 'partB.rationaleEnabled': rationaleB.settings && toggle(rationaleB.label),\n 'partB.spellCheckEnabled': spellCheckB.settings && toggle(spellCheckB.label),\n };\n\n return (\n <layout.ConfigLayout\n extraCSSRules={extraCSSRules}\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={this.onModelChanged}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n 'Settings for both': panelSettings,\n [`Settings ${firstPart}`]: panelSettingsPartA,\n [`Properties ${firstPart}`]: panelPropertiesPartA,\n [`Settings ${secondPart}`]: panelSettingsPartB,\n [`Properties ${secondPart}`]: panelPropertiesPartB,\n }}\n />\n }\n >\n {model.partLabels && <div className={classes.partLabel}>{firstPart}</div>}\n <ebsr-multiple-choice-configure\n id=\"A\"\n key=\"partA\"\n ref={(ref) => {\n if (ref) {\n // do not use destructuring to get model from props\n this.partA = ref;\n this.partA._model = {\n ...this.props.model.partA,\n errors: (this.props.model.errors && this.props.model.errors.partA) || {},\n };\n this.partA.configuration = {\n ...partA,\n ...generalConfiguration,\n };\n }\n }}\n />\n\n <div className={classes.divider} />\n\n {model.partLabels && <div className={classes.partLabel}>{secondPart}</div>}\n <ebsr-multiple-choice-configure\n id=\"B\"\n key=\"partB\"\n ref={(ref) => {\n if (ref) {\n // do not use destructuring to get model from props\n this.partB = ref;\n this.partB._model = {\n ...this.props.model.partB,\n errors: (this.props.model.errors && this.props.model.errors.partB) || {},\n };\n this.partB.configuration = {\n ...partB,\n ...generalConfiguration,\n };\n }\n }}\n />\n </layout.ConfigLayout>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
1
+ {"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_propTypes","_configUi","_styles","Panel","toggle","radio","dropdown","settings","PartLabel","styled","theme","paddingBottom","spacing","Divider","flex","height","Main","React","Component","constructor","args","_defineProperty2","default","choices","correctFound","map","choice","correct","model","key","onModelChanged","props","partA","choiceMode","removeExtraChoices","partB","render","configuration","onConfigurationChanged","partLabelType","modelPartA","modelPartB","extraCSSRules","contentDimensions","partialScoring","settingsPanelDisabled","scoringType","language","languageChoices","generalConfiguration","feedback","feedbackA","choiceModeA","choicePrefix","choicePrefixA","lockChoiceOrder","lockChoiceOrderA","prompt","promptA","teacherInstructions","teacherInstructionsA","studentInstructions","studentInstructionsA","choicesLayout","choicesLayoutA","gridColumns","gridColumnsA","rationale","rationaleA","spellCheck","spellCheckA","feedbackB","choiceModeB","choicePrefixB","lockChoiceOrderB","promptB","teacherInstructionsB","studentInstructionsB","choicesLayoutB","gridColumnsB","rationaleB","spellCheckB","type","typeIsNumber","firstPart","secondPart","nrOfColumnsAvailable","length","Array","from","_","i","panelSettings","partLabels","label","enabled","options","panelSettingsPartA","panelPropertiesPartA","panelSettingsPartB","panelPropertiesPartB","createElement","layout","ConfigLayout","dimensions","hideSettings","onChangeModel","onChangeConfiguration","groups","id","ref","_model","errors","exports","PropTypes","object","func","_default"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { settings, layout } from '@pie-lib/config-ui';\nimport { styled } from '@mui/material/styles';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst PartLabel = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n}));\n\nconst Divider = styled('div')(({ theme }) => ({\n flex: 1,\n height: theme.spacing(2.5),\n}));\n\nexport class Main extends React.Component {\n static propTypes = {\n configuration: PropTypes.object,\n model: PropTypes.object,\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n };\n\n removeExtraChoices = (choices) => {\n let correctFound = false;\n\n return (choices || []).map((choice) => {\n if (correctFound) {\n choice.correct = false;\n\n return choice;\n }\n\n if (choice.correct) {\n correctFound = true;\n }\n\n return choice;\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n if (key === 'partA.choiceMode' && model.partA.choiceMode === 'radio') {\n model.partA.choices = this.removeExtraChoices(model.partA.choices);\n\n return onModelChanged(model, true);\n }\n\n if (key === 'partB.choiceMode' && model.partB.choiceMode === 'radio') {\n model.partB.choices = this.removeExtraChoices(model.partB.choices);\n\n return onModelChanged(model, true);\n }\n\n return onModelChanged(model);\n };\n\n render() {\n const { model, configuration, onConfigurationChanged } = this.props;\n const { partLabelType, partA: modelPartA, partB: modelPartB, extraCSSRules } = model;\n const {\n contentDimensions = {},\n partA = {},\n partB = {},\n partialScoring = {},\n settingsPanelDisabled,\n scoringType = {},\n language = {},\n languageChoices = {},\n ...generalConfiguration\n } = configuration;\n const {\n feedback: feedbackA = {},\n choiceMode: choiceModeA = {},\n choicePrefix: choicePrefixA = {},\n lockChoiceOrder: lockChoiceOrderA = {},\n prompt: promptA = {},\n teacherInstructions: teacherInstructionsA = {},\n studentInstructions: studentInstructionsA = {},\n choicesLayout: choicesLayoutA = {},\n gridColumns: gridColumnsA = {},\n rationale: rationaleA = {},\n spellCheck: spellCheckA = {},\n } = partA || {};\n const {\n feedback: feedbackB = {},\n choiceMode: choiceModeB = {},\n choicePrefix: choicePrefixB = {},\n lockChoiceOrder: lockChoiceOrderB = {},\n prompt: promptB = {},\n teacherInstructions: teacherInstructionsB = {},\n studentInstructions: studentInstructionsB = {},\n choicesLayout: choicesLayoutB = {},\n gridColumns: gridColumnsB = {},\n rationale: rationaleB = {},\n spellCheck: spellCheckB = {},\n } = partB || {};\n\n const type = partLabelType || 'Numbers';\n const typeIsNumber = type === 'Numbers';\n const firstPart = `Part ${typeIsNumber ? '1' : 'A'}`;\n const secondPart = `Part ${typeIsNumber ? '2' : 'B'}`;\n const nrOfColumnsAvailable = {\n partA:\n modelPartA.choices && modelPartA.choices.length\n ? Array.from({ length: modelPartA.choices.length }, (_, i) => `${i + 1}`)\n : [],\n partB:\n modelPartB.choices && modelPartB.choices.length\n ? Array.from({ length: modelPartB.choices.length }, (_, i) => `${i + 1}`)\n : [],\n };\n\n const panelSettings = {\n partLabels: generalConfiguration.partLabels.settings && toggle(generalConfiguration.partLabels.label),\n partLabelType: model.partLabels && dropdown('', ['Numbers', 'Letters']),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n };\n\n const panelSettingsPartA = {\n 'partA.choiceMode': choiceModeA.settings && radio(choiceModeA.label, ['checkbox', 'radio']),\n 'partA.choicePrefix': choicePrefixA.settings && radio(choicePrefixA.label, ['numbers', 'letters']),\n 'partA.lockChoiceOrder': lockChoiceOrderA.settings && toggle(lockChoiceOrderA.label),\n 'partA.choicesLayout':\n choicesLayoutA.settings && dropdown(choicesLayoutA.label, ['vertical', 'grid', 'horizontal']),\n 'partA.gridColumns':\n choicesLayoutA.settings &&\n modelPartA.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.partA.length > 0 &&\n dropdown(gridColumnsA.label, nrOfColumnsAvailable.partA),\n };\n const panelPropertiesPartA = {\n 'partA.feedbackEnabled': feedbackA.settings && toggle(feedbackA.label),\n 'partA.promptEnabled': promptA.settings && toggle(promptA.label),\n 'partA.teacherInstructionsEnabled': teacherInstructionsA.settings && toggle(teacherInstructionsA.label),\n 'partA.studentInstructionsEnabled': studentInstructionsA.settings && toggle(studentInstructionsA.label),\n 'partA.rationaleEnabled': rationaleA.settings && toggle(rationaleA.label),\n 'partA.spellCheckEnabled': spellCheckA.settings && toggle(spellCheckA.label),\n };\n\n const panelSettingsPartB = {\n 'partB.choiceMode': choiceModeB.settings && radio(choiceModeB.label, ['checkbox', 'radio']),\n 'partB.choicePrefix': choicePrefixB.settings && radio(choicePrefixB.label, ['numbers', 'letters']),\n 'partB.lockChoiceOrder': lockChoiceOrderB.settings && toggle(lockChoiceOrderB.label),\n 'partB.choicesLayout':\n choicesLayoutB.settings && dropdown(choicesLayoutB.label, ['vertical', 'grid', 'horizontal']),\n 'partB.gridColumns':\n choicesLayoutB.settings &&\n modelPartB.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.partB.length > 0 &&\n dropdown(gridColumnsB.label, nrOfColumnsAvailable.partB),\n };\n const panelPropertiesPartB = {\n 'partB.feedbackEnabled': feedbackB.settings && toggle(feedbackB.label),\n 'partB.promptEnabled': promptB.settings && toggle(promptB.label),\n 'partB.teacherInstructionsEnabled': teacherInstructionsB.settings && toggle(teacherInstructionsB.label),\n 'partB.studentInstructionsEnabled': studentInstructionsB.settings && toggle(studentInstructionsB.label),\n 'partB.rationaleEnabled': rationaleB.settings && toggle(rationaleB.label),\n 'partB.spellCheckEnabled': spellCheckB.settings && toggle(spellCheckB.label),\n };\n\n return (\n <layout.ConfigLayout\n extraCSSRules={extraCSSRules}\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={this.onModelChanged}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n 'Settings for both': panelSettings,\n [`Settings ${firstPart}`]: panelSettingsPartA,\n [`Properties ${firstPart}`]: panelPropertiesPartA,\n [`Settings ${secondPart}`]: panelSettingsPartB,\n [`Properties ${secondPart}`]: panelPropertiesPartB,\n }}\n />\n }\n >\n {model.partLabels && <PartLabel>{firstPart}</PartLabel>}\n <ebsr-multiple-choice-configure\n id=\"A\"\n key=\"partA\"\n ref={(ref) => {\n if (ref) {\n // do not use destructuring to get model from props\n this.partA = ref;\n this.partA._model = {\n ...this.props.model.partA,\n errors: (this.props.model.errors && this.props.model.errors.partA) || {},\n };\n this.partA.configuration = {\n ...partA,\n ...generalConfiguration,\n };\n }\n }}\n />\n\n <Divider />\n\n {model.partLabels && <PartLabel>{secondPart}</PartLabel>}\n <ebsr-multiple-choice-configure\n id=\"B\"\n key=\"partB\"\n ref={(ref) => {\n if (ref) {\n // do not use destructuring to get model from props\n this.partB = ref;\n this.partB._model = {\n ...this.props.model.partB,\n errors: (this.props.model.errors && this.props.model.errors.partB) || {},\n };\n this.partB.configuration = {\n ...partB,\n ...generalConfiguration,\n };\n }\n }}\n />\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default Main;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAM;EAAEI,KAAK;EAAEC,MAAM;EAAEC,KAAK;EAAEC;AAAS,CAAC,GAAGC,kBAAQ;AAEnD,MAA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