@pie-element/ebsr 8.5.0 → 8.5.1-beta.1

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,288 +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 _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
-
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 _configUi = require("@pie-lib/config-ui");
31
-
32
- var _styles = require("@material-ui/core/styles");
33
-
34
- var _excluded = ["partA", "partB", "partialScoring", "settingsPanelDisabled", "scoringType"];
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
- part: {
52
- display: 'flex',
53
- flexDirection: 'column',
54
- '&:not(:first-child)': {
55
- paddingTop: theme.spacing.unit * 4
56
- }
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) {
79
- if (correctFound) {
80
- choice.correct = false;
81
- return choice;
82
- }
83
-
84
- if (choice.correct) {
85
- correctFound = true;
86
- }
87
-
88
- return choice;
89
- });
90
- });
91
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onModelChanged", function (model, key) {
92
- var onModelChanged = _this.props.onModelChanged;
93
-
94
- if (key === 'partA.choiceMode' && model.partA.choiceMode === 'radio') {
95
- model.partA.choices = _this.removeExtraChoices(model.partA.choices);
96
- return onModelChanged(model, true);
97
- }
98
-
99
- if (key === 'partB.choiceMode' && model.partB.choiceMode === 'radio') {
100
- model.partB.choices = _this.removeExtraChoices(model.partB.choices);
101
- return onModelChanged(model, true);
102
- }
103
-
104
- return onModelChanged(model);
105
- });
106
- return _this;
107
- }
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
- var partA = configuration.partA,
124
- partB = configuration.partB,
125
- partialScoring = configuration.partialScoring,
126
- settingsPanelDisabled = configuration.settingsPanelDisabled,
127
- scoringType = configuration.scoringType,
128
- generalConfiguration = (0, _objectWithoutProperties2["default"])(configuration, _excluded);
129
-
130
- var _ref = partA || {},
131
- _ref$feedback = _ref.feedback,
132
- feedbackA = _ref$feedback === void 0 ? {} : _ref$feedback,
133
- _ref$choiceMode = _ref.choiceMode,
134
- choiceModeA = _ref$choiceMode === void 0 ? {} : _ref$choiceMode,
135
- _ref$choicePrefix = _ref.choicePrefix,
136
- choicePrefixA = _ref$choicePrefix === void 0 ? {} : _ref$choicePrefix,
137
- _ref$lockChoiceOrder = _ref.lockChoiceOrder,
138
- lockChoiceOrderA = _ref$lockChoiceOrder === void 0 ? {} : _ref$lockChoiceOrder,
139
- _ref$prompt = _ref.prompt,
140
- promptA = _ref$prompt === void 0 ? {} : _ref$prompt,
141
- _ref$teacherInstructi = _ref.teacherInstructions,
142
- teacherInstructionsA = _ref$teacherInstructi === void 0 ? {} : _ref$teacherInstructi,
143
- _ref$studentInstructi = _ref.studentInstructions,
144
- studentInstructionsA = _ref$studentInstructi === void 0 ? {} : _ref$studentInstructi,
145
- _ref$choicesLayout = _ref.choicesLayout,
146
- choicesLayoutA = _ref$choicesLayout === void 0 ? {} : _ref$choicesLayout,
147
- _ref$gridColumns = _ref.gridColumns,
148
- gridColumnsA = _ref$gridColumns === void 0 ? {} : _ref$gridColumns,
149
- _ref$rationale = _ref.rationale,
150
- rationaleA = _ref$rationale === void 0 ? {} : _ref$rationale,
151
- _ref$spellCheck = _ref.spellCheck,
152
- spellCheckA = _ref$spellCheck === void 0 ? {} : _ref$spellCheck;
153
-
154
- var _ref2 = partB || {},
155
- _ref2$feedback = _ref2.feedback,
156
- feedbackB = _ref2$feedback === void 0 ? {} : _ref2$feedback,
157
- _ref2$choiceMode = _ref2.choiceMode,
158
- choiceModeB = _ref2$choiceMode === void 0 ? {} : _ref2$choiceMode,
159
- _ref2$choicePrefix = _ref2.choicePrefix,
160
- choicePrefixB = _ref2$choicePrefix === void 0 ? {} : _ref2$choicePrefix,
161
- _ref2$lockChoiceOrder = _ref2.lockChoiceOrder,
162
- lockChoiceOrderB = _ref2$lockChoiceOrder === void 0 ? {} : _ref2$lockChoiceOrder,
163
- _ref2$prompt = _ref2.prompt,
164
- promptB = _ref2$prompt === void 0 ? {} : _ref2$prompt,
165
- _ref2$teacherInstruct = _ref2.teacherInstructions,
166
- teacherInstructionsB = _ref2$teacherInstruct === void 0 ? {} : _ref2$teacherInstruct,
167
- _ref2$studentInstruct = _ref2.studentInstructions,
168
- studentInstructionsB = _ref2$studentInstruct === void 0 ? {} : _ref2$studentInstruct,
169
- _ref2$choicesLayout = _ref2.choicesLayout,
170
- choicesLayoutB = _ref2$choicesLayout === void 0 ? {} : _ref2$choicesLayout,
171
- _ref2$gridColumns = _ref2.gridColumns,
172
- gridColumnsB = _ref2$gridColumns === void 0 ? {} : _ref2$gridColumns,
173
- _ref2$rationale = _ref2.rationale,
174
- rationaleB = _ref2$rationale === void 0 ? {} : _ref2$rationale,
175
- _ref2$spellCheck = _ref2.spellCheck,
176
- spellCheckB = _ref2$spellCheck === void 0 ? {} : _ref2$spellCheck;
177
-
178
- var type = partLabelType || 'Numbers';
179
- var typeIsNumber = type === 'Numbers';
180
- var firstPart = "Part ".concat(typeIsNumber ? '1' : 'A');
181
- var secondPart = "Part ".concat(typeIsNumber ? '2' : 'B');
182
- var nrOfColumnsAvailable = {
183
- partA: modelPartA.choices && modelPartA.choices.length ? Array.from({
184
- length: modelPartA.choices.length
185
- }, function (_, i) {
186
- return "".concat(i + 1);
187
- }) : [],
188
- partB: modelPartB.choices && modelPartB.choices.length ? Array.from({
189
- length: modelPartB.choices.length
190
- }, function (_, i) {
191
- return "".concat(i + 1);
192
- }) : []
193
- };
194
- var panelSettings = {
195
- partLabels: generalConfiguration.partLabels.settings && toggle(generalConfiguration.partLabels.label),
196
- partLabelType: model.partLabels && dropdown('', ['Numbers', 'Letters']),
197
- partialScoring: partialScoring.settings && toggle(partialScoring.label),
198
- scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric'])
199
- };
200
- var panelSettingsPartA = {
201
- 'partA.choiceMode': choiceModeA.settings && radio(choiceModeA.label, ['checkbox', 'radio']),
202
- 'partA.choicePrefix': choicePrefixA.settings && radio(choicePrefixA.label, ['numbers', 'letters']),
203
- 'partA.lockChoiceOrder': lockChoiceOrderA.settings && toggle(lockChoiceOrderA.label),
204
- 'partA.choicesLayout': choicesLayoutA.settings && dropdown(choicesLayoutA.label, ['vertical', 'grid', 'horizontal']),
205
- 'partA.gridColumns': choicesLayoutA.settings && modelPartA.choicesLayout === 'grid' && nrOfColumnsAvailable.partA.length > 0 && dropdown(gridColumnsA.label, nrOfColumnsAvailable.partA)
206
- };
207
- var panelPropertiesPartA = {
208
- 'partA.feedbackEnabled': feedbackA.settings && toggle(feedbackA.label),
209
- 'partA.promptEnabled': promptA.settings && toggle(promptA.label),
210
- 'partA.teacherInstructionsEnabled': teacherInstructionsA.settings && toggle(teacherInstructionsA.label),
211
- 'partA.studentInstructionsEnabled': studentInstructionsA.settings && toggle(studentInstructionsA.label),
212
- 'partA.rationaleEnabled': rationaleA.settings && toggle(rationaleA.label),
213
- 'partA.spellCheckEnabled': spellCheckA.settings && toggle(spellCheckA.label)
214
- };
215
- var panelSettingsPartB = {
216
- 'partB.choiceMode': choiceModeB.settings && radio(choiceModeB.label, ['checkbox', 'radio']),
217
- 'partB.choicePrefix': choicePrefixB.settings && radio(choicePrefixB.label, ['numbers', 'letters']),
218
- 'partB.lockChoiceOrder': lockChoiceOrderB.settings && toggle(lockChoiceOrderB.label),
219
- 'partB.choicesLayout': choicesLayoutB.settings && dropdown(choicesLayoutB.label, ['vertical', 'grid', 'horizontal']),
220
- 'partB.gridColumns': choicesLayoutB.settings && modelPartB.choicesLayout === 'grid' && nrOfColumnsAvailable.partB.length > 0 && dropdown(gridColumnsB.label, nrOfColumnsAvailable.partB)
221
- };
222
- var panelPropertiesPartB = {
223
- 'partB.feedbackEnabled': feedbackB.settings && toggle(feedbackB.label),
224
- 'partB.promptEnabled': promptB.settings && toggle(promptB.label),
225
- 'partB.teacherInstructionsEnabled': teacherInstructionsB.settings && toggle(teacherInstructionsB.label),
226
- 'partB.studentInstructionsEnabled': studentInstructionsB.settings && toggle(studentInstructionsB.label),
227
- 'partB.rationaleEnabled': rationaleB.settings && toggle(rationaleB.label),
228
- 'partB.spellCheckEnabled': spellCheckB.settings && toggle(spellCheckB.label)
229
- };
230
- return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
231
- hideSettings: settingsPanelDisabled,
232
- settings: /*#__PURE__*/_react["default"].createElement(Panel, {
233
- model: model,
234
- onChangeModel: this.onModelChanged,
235
- configuration: configuration,
236
- onChangeConfiguration: onConfigurationChanged,
237
- groups: (_ref3 = {
238
- 'Settings for both': panelSettings
239
- }, (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)
240
- })
241
- }, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
242
- className: classes.part
243
- }, model.partLabels && /*#__PURE__*/_react["default"].createElement("div", null, firstPart), /*#__PURE__*/_react["default"].createElement("ebsr-multiple-choice-configure", {
244
- id: "A",
245
- key: "partA",
246
- ref: function ref(_ref4) {
247
- if (_ref4) {
248
- // do not use destructuring to get model from props
249
- _this2.partA = _ref4;
250
- _this2.partA._model = _objectSpread(_objectSpread({}, _this2.props.model.partA), {}, {
251
- errors: _this2.props.model.errors && _this2.props.model.errors.partA || {}
252
- });
253
- _this2.partA.configuration = _objectSpread(_objectSpread({}, partA), generalConfiguration);
254
- }
255
- }
256
- })), /*#__PURE__*/_react["default"].createElement("div", {
257
- className: classes.part
258
- }, model.partLabels && /*#__PURE__*/_react["default"].createElement("div", null, secondPart), /*#__PURE__*/_react["default"].createElement("ebsr-multiple-choice-configure", {
259
- id: "B",
260
- key: "partB",
261
- ref: function ref(_ref5) {
262
- if (_ref5) {
263
- // do not use destructuring to get model from props
264
- _this2.partB = _ref5;
265
- _this2.partB._model = _objectSpread(_objectSpread({}, _this2.props.model.partB), {}, {
266
- errors: _this2.props.model.errors && _this2.props.model.errors.partB || {}
267
- });
268
- _this2.partB.configuration = _objectSpread(_objectSpread({}, partB), generalConfiguration);
269
- }
270
- }
271
- }))));
272
- }
273
- }]);
274
- return Main;
275
- }(_react["default"].Component);
276
-
277
- exports.Main = Main;
278
- (0, _defineProperty2["default"])(Main, "propTypes", {
279
- classes: _propTypes["default"].object,
280
- configuration: _propTypes["default"].object,
281
- model: _propTypes["default"].object,
282
- onModelChanged: _propTypes["default"].func,
283
- onConfigurationChanged: _propTypes["default"].func
284
- });
285
- var Styled = (0, _styles.withStyles)(styles)(Main);
286
- var _default = Styled;
287
- exports["default"] = _default;
288
- //# sourceMappingURL=main.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","radio","dropdown","styles","theme","part","display","flexDirection","paddingTop","spacing","unit","Main","choices","correctFound","map","choice","correct","model","key","onModelChanged","props","partA","choiceMode","removeExtraChoices","partB","classes","configuration","onConfigurationChanged","partLabelType","modelPartA","modelPartB","partialScoring","settingsPanelDisabled","scoringType","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","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,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ACK,MAAI,CAACjE,KAAL,CAAWH,KAAX,CAAiBO,KADtB;AAEE8D,cAAAA,MAAM,EAAG,MAAI,CAAClE,KAAL,CAAWH,KAAX,CAAiBqE,MAAjB,IAA2B,MAAI,CAAClE,KAAL,CAAWH,KAAX,CAAiBqE,MAAjB,CAAwB9D,KAApD,IAA8D;AAFxE;AAIA,YAAA,MAAI,CAACA,KAAL,CAAWE,aAAX,mCACKF,KADL,GAEKU,oBAFL;AAID;AACF;AAhBH,QAFF,CAvBF,CAlBF,CADF;AAkED;;;EA9MuBqD,kBAAMC,S;;;iCAAnB7E,I,eACQ;AACjBc,EAAAA,OAAO,EAAEgE,sBAAUC,MADF;AAEjBhE,EAAAA,aAAa,EAAE+D,sBAAUC,MAFR;AAGjBzE,EAAAA,KAAK,EAAEwE,sBAAUC,MAHA;AAIjBvE,EAAAA,cAAc,EAAEsE,sBAAUE,IAJT;AAKjBhE,EAAAA,sBAAsB,EAAE8D,sBAAUE;AALjB,C;AAgNrB,IAAMC,MAAM,GAAG,wBAAWzF,MAAX,EAAmBQ,IAAnB,CAAf;eAEeiF,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 part: {\n display: 'flex',\n flexDirection: 'column',\n '&:not(:first-child)': {\n paddingTop: theme.spacing.unit * 4,\n },\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 } = model;\n const { partA, partB, partialScoring, settingsPanelDisabled, scoringType, ...generalConfiguration } = 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 };\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 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 <div>\n <div className={classes.part}>\n {model.partLabels && <div>{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 </div>\n\n <div className={classes.part}>\n {model.partLabels && <div>{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 </div>\n </div>\n </layout.ConfigLayout>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _default = {
8
- partA: {
9
- choicePrefix: 'letters',
10
- choices: [{
11
- value: 'a',
12
- label: 'label a'
13
- }],
14
- prompt: 'prompt a',
15
- disabled: false
16
- },
17
- partB: {
18
- choicePrefix: 'letters',
19
- choices: [{
20
- value: 'b',
21
- label: 'label b'
22
- }],
23
- prompt: 'prompt b',
24
- disabled: false
25
- }
26
- };
27
- exports["default"] = _default;
28
- //# sourceMappingURL=defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/defaults.js"],"names":["partA","choicePrefix","choices","value","label","prompt","disabled","partB"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,YAAY,EAAE,SADT;AAELC,IAAAA,OAAO,EAAE,CACP;AACEC,MAAAA,KAAK,EAAE,GADT;AAEEC,MAAAA,KAAK,EAAE;AAFT,KADO,CAFJ;AAQLC,IAAAA,MAAM,EAAE,UARH;AASLC,IAAAA,QAAQ,EAAE;AATL,GADM;AAYbC,EAAAA,KAAK,EAAE;AACLN,IAAAA,YAAY,EAAE,SADT;AAELC,IAAAA,OAAO,EAAE,CACP;AACEC,MAAAA,KAAK,EAAE,GADT;AAEEC,MAAAA,KAAK,EAAE;AAFT,KADO,CAFJ;AAQLC,IAAAA,MAAM,EAAE,UARH;AASLC,IAAAA,QAAQ,EAAE;AATL;AAZM,C","sourcesContent":["export default {\n partA: {\n choicePrefix: 'letters',\n choices: [\n {\n value: 'a',\n label: 'label a',\n },\n ],\n prompt: 'prompt a',\n disabled: false,\n },\n partB: {\n choicePrefix: 'letters',\n choices: [\n {\n value: 'b',\n label: 'label b',\n },\n ],\n prompt: 'prompt b',\n disabled: false,\n },\n};\n"],"file":"defaults.js"}