@pie-element/multiple-choice 6.2.7 → 6.3.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,33 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [6.3.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.2.7...@pie-element/multiple-choice@6.3.0) (2022-05-03)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * build ([7b3a278](https://github.com/pie-framework/pie-elements/commit/7b3a278f2c83562cbe848bd08c38a20d6cd2b8a0))
12
+ * fix crash ([0b5ab48](https://github.com/pie-framework/pie-elements/commit/0b5ab48ecf0468ac7fb724a152a5640dc25fea62))
13
+ * **multiple-choice:** comment validation ui/ux ([89e731c](https://github.com/pie-framework/pie-elements/commit/89e731c549a3da60f4dcbdb2e131d53a4587b5ea))
14
+ * added getters for the session PD-1668 ([de8a754](https://github.com/pie-framework/pie-elements/commit/de8a754f4580370b127257c435e43db405b4bdc4))
15
+ * **multiple-choice:** set choices layout for print PD-1623 ([ed90d57](https://github.com/pie-framework/pie-elements/commit/ed90d578da7d8db040082e93e718357a60dd8881))
16
+ * **multiple-choice:** set lockChoiceOrder to true for print ([5de2c75](https://github.com/pie-framework/pie-elements/commit/5de2c751b7a6cc63d54d4c8a1bbfb7adab4d2c00))
17
+
18
+
19
+ ### Features
20
+
21
+ * **multiple-choice:** PD-1697 ui/ux for validation ([9a088a3](https://github.com/pie-framework/pie-elements/commit/9a088a3d4af75586d6b8e302078c8629a3e7d718))
22
+ * **multiple-choice:** updated validation behaviors PD-1696 PD-1697 ([ab009c4](https://github.com/pie-framework/pie-elements/commit/ab009c4832572dab96c5b4130a5088dea17222e6))
23
+ * added configurable validation ([1e3a0d6](https://github.com/pie-framework/pie-elements/commit/1e3a0d6da3c790e68a7fd401df2c832917d62480))
24
+ * added configurable validation + refactoring PD-1696 ([31f6354](https://github.com/pie-framework/pie-elements/commit/31f6354b256fef876fa6c48e79a3f82486b5fce7))
25
+ * added configurable validation + refactoring PD-1696 ([08d9b70](https://github.com/pie-framework/pie-elements/commit/08d9b70991f159707ef7fd5b3e533a0addda1d90))
26
+ * added configurable validation + refactoring PD-1696 ([07c42c2](https://github.com/pie-framework/pie-elements/commit/07c42c2811349d1e829d367993541157fbbe2dfc))
27
+ * start working on multiple-choice validation ([722037b](https://github.com/pie-framework/pie-elements/commit/722037bc0fddd2e090ec1506e85a91949ad86c91))
28
+
29
+
30
+
31
+
32
+
6
33
  ## [6.2.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.2.6...@pie-element/multiple-choice@6.2.7) (2022-04-12)
7
34
 
8
35
  **Note:** Version bump only for package @pie-element/multiple-choice
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.7...@pie-element/multiple-choice-configure@4.2.0) (2022-05-03)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * build ([7b3a278](https://github.com/pie-framework/pie-elements/commit/7b3a278f2c83562cbe848bd08c38a20d6cd2b8a0))
12
+ * fix crash ([0b5ab48](https://github.com/pie-framework/pie-elements/commit/0b5ab48ecf0468ac7fb724a152a5640dc25fea62))
13
+ * **multiple-choice:** comment validation ui/ux ([89e731c](https://github.com/pie-framework/pie-elements/commit/89e731c549a3da60f4dcbdb2e131d53a4587b5ea))
14
+
15
+
16
+ ### Features
17
+
18
+ * **multiple-choice:** PD-1697 ui/ux for validation ([9a088a3](https://github.com/pie-framework/pie-elements/commit/9a088a3d4af75586d6b8e302078c8629a3e7d718))
19
+ * **multiple-choice:** updated validation behaviors PD-1696 PD-1697 ([ab009c4](https://github.com/pie-framework/pie-elements/commit/ab009c4832572dab96c5b4130a5088dea17222e6))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [4.1.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.6...@pie-element/multiple-choice-configure@4.1.7) (2022-04-12)
7
26
 
8
27
  **Note:** Version bump only for package @pie-element/multiple-choice-configure
@@ -51,6 +51,8 @@ var _Typography = _interopRequireDefault(require("@material-ui/core/Typography")
51
51
 
52
52
  var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
53
53
 
54
+ var _utils = require("./utils");
55
+
54
56
  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); }; }
55
57
 
56
58
  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; } }
@@ -121,15 +123,15 @@ var styles = function styles(theme) {
121
123
  },
122
124
  flexContainer: {
123
125
  display: 'flex',
124
- alignItems: 'center'
126
+ alignItems: 'center',
127
+ marginBottom: '5px'
125
128
  },
126
129
  titleText: {
127
130
  fontFamily: 'Cerebri Sans',
128
131
  fontSize: '18px',
129
132
  lineHeight: '19px',
130
133
  color: '#495B8F',
131
- marginRight: '5px',
132
- marginBottom: '5px'
134
+ marginRight: '5px'
133
135
  },
134
136
  tooltip: {
135
137
  fontSize: '12px',
@@ -203,8 +205,13 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
203
205
  feedbackEnabled = _ref3.feedbackEnabled,
204
206
  promptEnabled = _ref3.promptEnabled,
205
207
  spellCheckEnabled = _ref3.spellCheckEnabled,
206
- choices = _ref3.choices; // const { choicesErrors, correctResponseError, answerChoicesError } = errors || {};
208
+ choices = _ref3.choices,
209
+ errors = _ref3.errors;
207
210
 
211
+ var _ref4 = errors || {},
212
+ choicesErrors = _ref4.choicesErrors,
213
+ correctResponseError = _ref4.correctResponseError,
214
+ answerChoicesError = _ref4.answerChoicesError;
208
215
 
209
216
  var nrOfColumnsAvailable = choices && choices.length ? Array.from({
210
217
  length: choices.length
@@ -236,6 +243,8 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
236
243
  maxAnswerChoices = MAX_CHOICES;
237
244
  }
238
245
 
246
+ var validationMessage = (0, _utils.generateValidationMessage)(configuration);
247
+
239
248
  var Content = /*#__PURE__*/_react["default"].createElement("div", null, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
240
249
  label: teacherInstructions.label,
241
250
  className: classes.promptHolder
@@ -259,7 +268,26 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
259
268
  disableUnderline: true,
260
269
  toolbarOpts: toolbarOpts,
261
270
  spellCheck: spellCheckEnabled
262
- })), choices.map(function (choice, index) {
271
+ })), /*#__PURE__*/_react["default"].createElement("div", {
272
+ className: classes.flexContainer
273
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
274
+ className: classes.titleText
275
+ }, "Choices"), /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
276
+ classes: {
277
+ tooltip: classes.tooltip
278
+ },
279
+ disableFocusListener: true,
280
+ disableTouchListener: true,
281
+ placement: 'right',
282
+ title: validationMessage
283
+ }, /*#__PURE__*/_react["default"].createElement(_Info["default"], {
284
+ fontSize: 'small',
285
+ color: 'primary'
286
+ }))), correctResponseError && /*#__PURE__*/_react["default"].createElement("div", {
287
+ className: classes.errorText
288
+ }, correctResponseError), answerChoicesError && /*#__PURE__*/_react["default"].createElement("div", {
289
+ className: classes.errorText
290
+ }, answerChoicesError), choices.map(function (choice, index) {
263
291
  return /*#__PURE__*/_react["default"].createElement("div", {
264
292
  key: "choice-".concat(index),
265
293
  className: classes.choiceConfigurationHolder
@@ -282,9 +310,9 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
282
310
  allowDelete: deleteChoice.settings,
283
311
  noLabels: true,
284
312
  toolbarOpts: toolbarOpts,
285
- spellCheck: spellCheckEnabled // error={choicesErrors && choicesErrors[choice.value] ? choicesErrors[choice.value] : null}
286
- // noCorrectAnswerError={correctResponseError}
287
-
313
+ spellCheck: spellCheckEnabled,
314
+ error: choicesErrors && choicesErrors[choice.value] ? choicesErrors[choice.value] : null,
315
+ noCorrectAnswerError: correctResponseError
288
316
  }), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
289
317
  key: "rationale-".concat(index),
290
318
  label: rationale.label,
@@ -324,7 +352,7 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
324
352
  }
325
353
  }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
326
354
  classes: {
327
- root: maxAnswerChoices && model.choices.length >= maxAnswerChoices ? classes.disableButton : undefined
355
+ root: maxAnswerChoices && model.choices.length >= maxAnswerChoices && classes.disableButton
328
356
  },
329
357
  className: classes.addButton,
330
358
  variant: "contained",
@@ -366,11 +394,11 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
366
394
  }, Content));
367
395
  });
368
396
 
369
- var InfoDialog = function InfoDialog(_ref4) {
370
- var open = _ref4.open,
371
- onCancel = _ref4.onCancel,
372
- onOk = _ref4.onOk,
373
- title = _ref4.title;
397
+ var InfoDialog = function InfoDialog(_ref5) {
398
+ var open = _ref5.open,
399
+ onCancel = _ref5.onCancel,
400
+ onOk = _ref5.onOk,
401
+ title = _ref5.title;
374
402
  return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
375
403
  open: open
376
404
  }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], null, title), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, onOk && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
@@ -414,8 +442,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
414
442
  model = _this$props.model,
415
443
  configuration = _this$props.configuration;
416
444
 
417
- var _ref5 = configuration || {},
418
- minAnswerChoices = _ref5.minAnswerChoices;
445
+ var _ref6 = configuration || {},
446
+ minAnswerChoices = _ref6.minAnswerChoices;
419
447
 
420
448
  if (minAnswerChoices && model.choices.length === minAnswerChoices) {
421
449
  _this.setState({
@@ -428,13 +456,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
428
456
  open: false
429
457
  }
430
458
  });
431
- },
432
- onCancel: function onCancel() {
433
- return _this.setState({
434
- dialog: {
435
- open: false
436
- }
437
- });
438
459
  }
439
460
  }
440
461
  });
@@ -449,51 +470,32 @@ var Main = /*#__PURE__*/function (_React$Component) {
449
470
  model = _this$props2.model,
450
471
  configuration = _this$props2.configuration;
451
472
 
452
- var _ref6 = configuration || {},
453
- maxAnswerChoices = _ref6.maxAnswerChoices;
473
+ var _ref7 = configuration || {},
474
+ maxAnswerChoices = _ref7.maxAnswerChoices;
454
475
 
455
- var _ref7 = model || {},
456
- limitChoicesNumber = _ref7.limitChoicesNumber; // if old property is used, set maxAnswerChoices to 9
476
+ var _ref8 = model || {},
477
+ limitChoicesNumber = _ref8.limitChoicesNumber; // if old property is used, set maxAnswerChoices to 9
457
478
 
458
479
 
459
480
  if (limitChoicesNumber) {
460
481
  maxAnswerChoices = MAX_CHOICES;
461
482
  }
462
483
 
463
- if (maxAnswerChoices && model.choices.length === maxAnswerChoices) {
464
- _this.setState({
465
- dialog: {
466
- open: true,
467
- message: "There can't be more than ".concat(maxAnswerChoices, " choices."),
468
- onOk: function onOk() {
469
- _this.setState({
470
- dialog: {
471
- open: false
472
- }
473
- });
474
- },
475
- onCancel: function onCancel() {
476
- return _this.setState({
477
- dialog: {
478
- open: false
479
- }
480
- });
481
- }
482
- }
483
- });
484
- } else {
485
- model.choices.push({
486
- label: '',
487
- value: _configUi.choiceUtils.firstAvailableIndex(model.choices.map(function (c) {
488
- return c.value;
489
- }), 0),
490
- feedback: {
491
- type: 'none'
492
- }
493
- });
494
-
495
- _this.props.onModelChanged(model);
484
+ if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {
485
+ return;
496
486
  }
487
+
488
+ model.choices.push({
489
+ label: '',
490
+ value: _configUi.choiceUtils.firstAvailableIndex(model.choices.map(function (c) {
491
+ return c.value;
492
+ }), 0),
493
+ feedback: {
494
+ type: 'none'
495
+ }
496
+ });
497
+
498
+ _this.props.onModelChanged(model);
497
499
  });
498
500
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChoiceChanged", function (index, choice) {
499
501
  var model = _this.props.model;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","radio","dropdown","MAX_CHOICES","styles","theme","promptHolder","width","paddingBottom","spacing","unit","marginBottom","prompt","paddingTop","rationaleHolder","accessibilityHolder","rationale","accessibility","design","choiceConfigurationHolder","display","flexDirection","alignItems","choiceConfiguration","switchElement","justifyContent","margin","addButton","disableButton","cursor","pointerEvents","backgroundColor","color","disabled","flexContainer","titleText","fontFamily","fontSize","lineHeight","marginRight","tooltip","whiteSpace","maxWidth","errorText","Design","props","classes","model","configuration","onPromptChanged","onChoiceChanged","onRemoveChoice","onAddChoice","imageSupport","onChangeModel","onConfigurationChanged","onTeacherInstructionsChanged","addChoiceButton","feedback","deleteChoice","choiceMode","choicePrefix","partialScoring","lockChoiceOrder","teacherInstructions","studentInstructions","scoringType","sequentialChoiceLabels","settingsPanelDisabled","choicesLayout","spellCheck","gridColumns","maxAnswerChoices","limitChoicesNumber","teacherInstructionsEnabled","rationaleEnabled","accessibilityLabelsEnabled","feedbackEnabled","promptEnabled","spellCheckEnabled","choices","nrOfColumnsAvailable","length","Array","from","_","i","labelPlugins","audio","video","toolbarOpts","toolbarEditorPosition","position","Content","label","map","choice","index","c","root","undefined","settingsInPanel","Settings","Properties","studentInstructionsEnabled","InfoDialog","open","onCancel","onOk","title","propTypes","PropTypes","bool","func","string","Main","dialog","minAnswerChoices","setState","message","splice","onModelChanged","push","value","utils","firstAvailableIndex","type","correct","key","correctFound","state","React","Component","object","isRequired","disableSidePanel","shape","add","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;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,WAAW,GAAG,CAApB;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,YAAY,EAAE;AACZC,MAAAA,KAAK,EAAE,MADK;AAEZC,MAAAA,aAAa,EAAEH,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAFxB;AAGZC,MAAAA,YAAY,EAAEN,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB;AAHvB,KADW;AAMzBE,IAAAA,MAAM,EAAE;AACNC,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAD3B;AAENH,MAAAA,KAAK,EAAE;AAFD,KANiB;AAUzBO,IAAAA,eAAe,EAAE;AACfP,MAAAA,KAAK,EAAE;AADQ,KAVQ;AAazBQ,IAAAA,mBAAmB,EAAE;AACnBR,MAAAA,KAAK,EAAE;AADY,KAbI;AAgBzBS,IAAAA,SAAS,EAAE;AACTH,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB;AADxB,KAhBc;AAmBzBO,IAAAA,aAAa,EAAE;AACbJ,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,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AK/D,KADX;AAEE,QAAA,aAAa,EAAE,KAAK4E,cAFtB;AAGE,QAAA,cAAc,EAAE,KAAKtE,cAHvB;AAIE,QAAA,eAAe,EAAE,KAAKD,eAJxB;AAKE,QAAA,WAAW,EAAE,KAAKE,WALpB;AAME,QAAA,eAAe,EAAE,KAAKH,eANxB;AAOE,QAAA,4BAA4B,EAAE,KAAKO;AAPrC,SAPF,CADF;AAmBD;;;EAhLuB2E,kBAAMC,S;;;iCAAnBjB,I,eACQ;AACjBpE,EAAAA,KAAK,EAAEgE,sBAAUsB,MAAV,CAAiBC,UADP;AAEjBtF,EAAAA,aAAa,EAAE+D,sBAAUsB,MAAV,CAAiBC,UAFf;AAGjBC,EAAAA,gBAAgB,EAAExB,sBAAUC,IAHX;AAIjBS,EAAAA,cAAc,EAAEV,sBAAUE,IAAV,CAAeqB,UAJd;AAKjB/E,EAAAA,sBAAsB,EAAEwD,sBAAUE,IAAV,CAAeqB,UALtB;AAMjBxF,EAAAA,OAAO,EAAEiE,sBAAUsB,MAAV,CAAiBC,UANT;AAOjBjF,EAAAA,YAAY,EAAE0D,sBAAUyB,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAE1B,sBAAUE,IAAV,CAAeqB,UADQ;AAE5B,cAAQvB,sBAAUE,IAAV,CAAeqB;AAFK,GAAhB;AAPG,C;AAkLrB,IAAMI,MAAM,GAAG,wBAAWtI,MAAX,EAAmB+G,IAAnB,CAAf;eAEeuB,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html';\nimport {\n InputContainer,\n ChoiceConfiguration,\n settings,\n layout,\n choiceUtils as utils,\n} from '@pie-lib/config-ui';\nimport { color } from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport Button from '@material-ui/core/Button';\nimport merge from 'lodash/merge';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport Typography from '@material-ui/core/Typography';\nimport Info from '@material-ui/icons/Info';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst MAX_CHOICES = 9;\n\nconst styles = (theme) => ({\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n },\n rationaleHolder: {\n width: '70%',\n },\n accessibilityHolder: {\n width: '70%',\n },\n rationale: {\n paddingTop: theme.spacing.unit * 2,\n },\n accessibility: {\n paddingTop: theme.spacing.unit * 2,\n },\n design: {\n paddingTop: theme.spacing.unit * 3,\n },\n choiceConfigurationHolder: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n },\n choiceConfiguration: {\n width: '100%',\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2,\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0,\n },\n addButton: {\n float: 'right',\n },\n disableButton: {\n cursor: 'not-allowed',\n pointerEvents: 'all',\n backgroundColor: color.disabled(),\n '&:hover': {\n backgroundColor: color.disabled(),\n },\n '&:focus': {\n backgroundColor: color.disabled(),\n },\n },\n flexContainer: {\n display: 'flex',\n alignItems: 'center',\n },\n titleText: {\n fontFamily: 'Cerebri Sans',\n fontSize: '18px',\n lineHeight: '19px',\n color: '#495B8F',\n marginRight: '5px',\n marginBottom: '5px'\n },\n tooltip: {\n fontSize: '12px',\n whiteSpace: 'pre',\n maxWidth: '500px'\n },\n errorText: {\n fontSize: '12px',\n color: 'red',\n paddingTop: '5px'\n }\n});\n\nconst Design = withStyles(styles)((props) => {\n const {\n classes,\n model,\n configuration,\n onPromptChanged,\n onChoiceChanged,\n onRemoveChoice,\n onAddChoice,\n imageSupport,\n onChangeModel,\n onConfigurationChanged,\n onTeacherInstructionsChanged,\n } = props;\n const {\n prompt = {},\n addChoiceButton = {},\n feedback = {},\n deleteChoice = {},\n choiceMode = {},\n choicePrefix = {},\n partialScoring = {},\n lockChoiceOrder = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n accessibility = {},\n scoringType = {},\n sequentialChoiceLabels = {},\n settingsPanelDisabled,\n choicesLayout,\n spellCheck = {},\n gridColumns,\n } = configuration || {};\n let { maxAnswerChoices } = configuration || {};\n const {\n limitChoicesNumber,\n teacherInstructionsEnabled,\n rationaleEnabled,\n accessibilityLabelsEnabled,\n feedbackEnabled,\n promptEnabled,\n spellCheckEnabled,\n choices,\n // errors\n } = model || {};\n\n // const { choicesErrors, correctResponseError, answerChoicesError } = errors || {};\n const nrOfColumnsAvailable =\n choices && choices.length\n ? Array.from({ length: choices.length }, (_, i) => `${i + 1}`)\n : [];\n\n const labelPlugins = {\n audio: { disabled: true },\n video: { disabled: true },\n };\n\n const toolbarOpts = {};\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n const Content = (\n <div>\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n {/*<div className={classes.flexContainer}>*/}\n {/* <Typography className={classes.titleText}>Choices</Typography>*/}\n {/*<Tooltip*/}\n {/* classes={{tooltip: classes.tooltip}}*/}\n {/* disableFocusListener*/}\n {/* disableTouchListener*/}\n {/* placement={'right'}*/}\n {/* title={'Validation requirements:\\nThere should at least two answer choices, non-blank and unique.\\nA correct answer must be defined.'}*/}\n {/*>*/}\n {/* <Info fontSize={'small'} color={'primary'}/>*/}\n {/*</Tooltip>*/}\n {/*</div>*/}\n {/*{correctResponseError && <div className={classes.errorText}>{correctResponseError}</div>}*/}\n {/*{answerChoicesError && <div className={classes.errorText}>{answerChoicesError}</div>}*/}\n {choices.map((choice, index) => (\n <div\n key={`choice-${index}`}\n className={classes.choiceConfigurationHolder}\n >\n <ChoiceConfiguration\n key={index}\n index={index + 1}\n useLetterOrdering={model.choicePrefix === 'letters'}\n className={classes.choiceConfiguration}\n mode={model.choiceMode}\n data={choice}\n defaultFeedback={{}}\n imageSupport={imageSupport}\n onDelete={() => onRemoveChoice(index)}\n onChange={(c) => onChoiceChanged(index, c)}\n allowFeedBack={feedbackEnabled}\n allowDelete={deleteChoice.settings}\n noLabels\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n // error={choicesErrors && choicesErrors[choice.value] ? choicesErrors[choice.value] : null}\n // noCorrectAnswerError={correctResponseError}\n />\n {rationaleEnabled && (\n <InputContainer\n key={`rationale-${index}`}\n label={rationale.label}\n className={classes.rationaleHolder}\n >\n <EditableHtml\n className={classes.rationale}\n markup={choice.rationale || ''}\n onChange={(c) =>\n onChoiceChanged(index, {\n ...choice,\n rationale: c,\n })\n }\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n pluginProps={labelPlugins}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n {accessibilityLabelsEnabled && (\n <InputContainer\n key={`accessibility-${index}`}\n label={accessibility.label}\n className={classes.accessibilityHolder}\n >\n <EditableHtml\n className={classes.accessibility}\n markup={choice.accessibility || ''}\n onChange={(c) =>\n onChoiceChanged(index, {\n ...choice,\n accessibility: c,\n })\n }\n imageSupport={imageSupport}\n pluginProps={labelPlugins}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n </div>\n ))}\n <br />\n {addChoiceButton.settings && (\n <Tooltip\n title={\n maxAnswerChoices && model.choices.length >= maxAnswerChoices\n ? `Only ${maxAnswerChoices} allowed maximum`\n : ''\n }\n classes={{ tooltip: classes.tooltip }}\n >\n <Button\n classes={{\n root:\n maxAnswerChoices && model.choices.length >= maxAnswerChoices\n ? classes.disableButton\n : undefined,\n }}\n className={classes.addButton}\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n >\n {addChoiceButton.label}\n </Button>\n </Tooltip>\n )}\n </div>\n );\n\n const settingsInPanel = {\n choiceMode:\n choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),\n 'sequentialChoiceLabels.enabled':\n sequentialChoiceLabels.settings &&\n toggle(sequentialChoiceLabels.label, true),\n choicePrefix:\n choicePrefix.settings &&\n radio(choicePrefix.label, ['numbers', 'letters']),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n choicesLayout:\n choicesLayout.settings &&\n dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),\n gridColumns:\n choicesLayout.settings &&\n model.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.length > 0 &&\n dropdown(gridColumns.label, nrOfColumnsAvailable),\n };\n\n return (\n <div className={classes.design}>\n {settingsPanelDisabled ? (\n Content\n ) : (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n onChangeModel={onChangeModel}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: settingsInPanel,\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n studentInstructionsEnabled:\n studentInstructions.settings &&\n toggle(studentInstructions.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n rationaleEnabled:\n rationale.settings && toggle(rationale.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n accessibilityLabelsEnabled:\n accessibility.settings && toggle(accessibility.label),\n scoringType:\n scoringType.settings &&\n radio(scoringType.label, ['auto', 'rubric']),\n },\n }}\n />\n }\n >\n {Content}\n </layout.ConfigLayout>\n )}\n </div>\n );\n});\n\nconst InfoDialog = ({ open, onCancel, onOk, title }) => (\n <Dialog open={open}>\n <DialogTitle>{title}</DialogTitle>\n <DialogActions>\n {onOk && (\n <Button onClick={onOk} color=\"primary\">\n OK\n </Button>\n )}\n {onCancel && (\n <Button onClick={onCancel} color=\"primary\">\n Cancel\n </Button>\n )}\n </DialogActions>\n </Dialog>\n);\n\nInfoDialog.propTypes = {\n open: PropTypes.bool,\n onCancel: PropTypes.func,\n onOk: PropTypes.func,\n title: PropTypes.string,\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n };\n\n state = {\n dialog: {\n open: false,\n },\n };\n\n onRemoveChoice = (index) => {\n const { model, configuration } = this.props;\n const { minAnswerChoices } = configuration || {};\n\n if (minAnswerChoices && model.choices.length === minAnswerChoices) {\n this.setState({\n dialog: {\n open: true,\n message: `There can't be less than ${minAnswerChoices} choices.`,\n onOk: () => {\n this.setState({\n dialog: {\n open: false,\n },\n });\n },\n onCancel: () =>\n this.setState({\n dialog: {\n open: false,\n },\n }),\n },\n });\n } else {\n model.choices.splice(index, 1);\n this.props.onModelChanged(model);\n }\n };\n\n onAddChoice = () => {\n const { model, configuration } = this.props;\n let { maxAnswerChoices } = configuration || {};\n const { limitChoicesNumber } = model || {};\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n if (maxAnswerChoices && model.choices.length === maxAnswerChoices) {\n this.setState({\n dialog: {\n open: true,\n message: `There can't be more than ${maxAnswerChoices} choices.`,\n onOk: () => {\n this.setState({\n dialog: {\n open: false,\n },\n });\n },\n onCancel: () =>\n this.setState({\n dialog: {\n open: false,\n },\n }),\n },\n });\n } else {\n model.choices.push({\n label: '',\n value: utils.firstAvailableIndex(\n model.choices.map((c) => c.value),\n 0\n ),\n feedback: {\n type: 'none',\n },\n });\n\n this.props.onModelChanged(model);\n }\n };\n\n onChoiceChanged = (index, choice) => {\n const { model } = this.props;\n\n if (choice.correct && model.choiceMode === 'radio') {\n model.choices = model.choices.map((c) => {\n return merge({}, c, { correct: false });\n });\n }\n\n model.choices.splice(index, 1, choice);\n this.props.onModelChanged(model);\n };\n\n onPromptChanged = (prompt) => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt,\n });\n };\n\n onTeacherInstructionsChanged = (teacherInstructions) => {\n this.props.onModelChanged({\n ...this.props.model,\n teacherInstructions,\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n switch (key) {\n case 'choiceMode': {\n let value = model.choiceMode;\n\n if (value === 'radio') {\n let correctFound = false;\n\n model.choices = model.choices.map((c) => {\n if (correctFound) {\n c.correct = false;\n return c;\n }\n\n if (c.correct) {\n correctFound = true;\n }\n return c;\n });\n }\n onModelChanged(model, true);\n break;\n }\n default:\n onModelChanged(model);\n break;\n }\n };\n\n render() {\n const { dialog } = this.state;\n\n return (\n <>\n <InfoDialog\n open={dialog.open}\n title={dialog.message}\n onCancel={dialog.onCancel}\n onOk={dialog.onOk}\n />\n <Design\n {...this.props}\n onChangeModel={this.onModelChanged}\n onRemoveChoice={this.onRemoveChoice}\n onChoiceChanged={this.onChoiceChanged}\n onAddChoice={this.onAddChoice}\n onPromptChanged={this.onPromptChanged}\n onTeacherInstructionsChanged={this.onTeacherInstructionsChanged}\n />\n </>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
1
+ {"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","radio","dropdown","MAX_CHOICES","styles","theme","promptHolder","width","paddingBottom","spacing","unit","marginBottom","prompt","paddingTop","rationaleHolder","accessibilityHolder","rationale","accessibility","design","choiceConfigurationHolder","display","flexDirection","alignItems","choiceConfiguration","switchElement","justifyContent","margin","addButton","disableButton","cursor","pointerEvents","backgroundColor","color","disabled","flexContainer","titleText","fontFamily","fontSize","lineHeight","marginRight","tooltip","whiteSpace","maxWidth","errorText","Design","props","classes","model","configuration","onPromptChanged","onChoiceChanged","onRemoveChoice","onAddChoice","imageSupport","onChangeModel","onConfigurationChanged","onTeacherInstructionsChanged","addChoiceButton","feedback","deleteChoice","choiceMode","choicePrefix","partialScoring","lockChoiceOrder","teacherInstructions","studentInstructions","scoringType","sequentialChoiceLabels","settingsPanelDisabled","choicesLayout","spellCheck","gridColumns","maxAnswerChoices","limitChoicesNumber","teacherInstructionsEnabled","rationaleEnabled","accessibilityLabelsEnabled","feedbackEnabled","promptEnabled","spellCheckEnabled","choices","errors","choicesErrors","correctResponseError","answerChoicesError","nrOfColumnsAvailable","length","Array","from","_","i","labelPlugins","audio","video","toolbarOpts","toolbarEditorPosition","position","validationMessage","Content","label","map","choice","index","c","value","root","settingsInPanel","Settings","Properties","studentInstructionsEnabled","InfoDialog","open","onCancel","onOk","title","propTypes","PropTypes","bool","func","string","Main","dialog","minAnswerChoices","setState","message","splice","onModelChanged","push","utils","firstAvailableIndex","type","correct","key","correctFound","state","React","Component","object","isRequired","disableSidePanel","shape","add","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAQA,KAAR,GAA2CC,kBAA3C,CAAQD,KAAR;AAA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QAAA,QAAQ,EAAEH,MAAM,CAACT,QAHnB;AAIE,QAAA,IAAI,EAAES,MAAM,CAACR;AAJf,QADF,eAOE,gCAAC,MAAD,gCACM,KAAKpE,KADX;AAEE,QAAA,aAAa,EAAE,KAAKiF,cAFtB;AAGE,QAAA,cAAc,EAAE,KAAK3E,cAHvB;AAIE,QAAA,eAAe,EAAE,KAAKD,eAJxB;AAKE,QAAA,WAAW,EAAE,KAAKE,WALpB;AAME,QAAA,eAAe,EAAE,KAAKH,eANxB;AAOE,QAAA,4BAA4B,EAAE,KAAKO;AAPrC,SAPF,CADF;AAmBD;;;EAtJuB+E,kBAAMC,S;;;iCAAnBhB,I,eACQ;AACjBzE,EAAAA,KAAK,EAAEqE,sBAAUqB,MAAV,CAAiBC,UADP;AAEjB1F,EAAAA,aAAa,EAAEoE,sBAAUqB,MAAV,CAAiBC,UAFf;AAGjBC,EAAAA,gBAAgB,EAAEvB,sBAAUC,IAHX;AAIjBS,EAAAA,cAAc,EAAEV,sBAAUE,IAAV,CAAeoB,UAJd;AAKjBnF,EAAAA,sBAAsB,EAAE6D,sBAAUE,IAAV,CAAeoB,UALtB;AAMjB5F,EAAAA,OAAO,EAAEsE,sBAAUqB,MAAV,CAAiBC,UANT;AAOjBrF,EAAAA,YAAY,EAAE+D,sBAAUwB,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEzB,sBAAUE,IAAV,CAAeoB,UADQ;AAE5B,cAAQtB,sBAAUE,IAAV,CAAeoB;AAFK,GAAhB;AAPG,C;AAwJrB,IAAMI,MAAM,GAAG,wBAAW1I,MAAX,EAAmBoH,IAAnB,CAAf;eAEesB,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html';\nimport {\n InputContainer,\n ChoiceConfiguration,\n settings,\n layout,\n choiceUtils as utils,\n} from '@pie-lib/config-ui';\nimport { color } from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport Button from '@material-ui/core/Button';\nimport merge from 'lodash/merge';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport Typography from '@material-ui/core/Typography';\nimport Info from '@material-ui/icons/Info';\nimport { generateValidationMessage } from './utils';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst MAX_CHOICES = 9;\n\nconst styles = (theme) => ({\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n },\n rationaleHolder: {\n width: '70%',\n },\n accessibilityHolder: {\n width: '70%',\n },\n rationale: {\n paddingTop: theme.spacing.unit * 2,\n },\n accessibility: {\n paddingTop: theme.spacing.unit * 2,\n },\n design: {\n paddingTop: theme.spacing.unit * 3,\n },\n choiceConfigurationHolder: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n },\n choiceConfiguration: {\n width: '100%',\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2,\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0,\n },\n addButton: {\n float: 'right',\n },\n disableButton: {\n cursor: 'not-allowed',\n pointerEvents: 'all',\n backgroundColor: color.disabled(),\n '&:hover': {\n backgroundColor: color.disabled(),\n },\n '&:focus': {\n backgroundColor: color.disabled(),\n },\n },\n flexContainer: {\n display: 'flex',\n alignItems: 'center',\n marginBottom: '5px'\n },\n titleText: {\n fontFamily: 'Cerebri Sans',\n fontSize: '18px',\n lineHeight: '19px',\n color: '#495B8F',\n marginRight: '5px'\n },\n tooltip: {\n fontSize: '12px',\n whiteSpace: 'pre',\n maxWidth: '500px'\n },\n errorText: {\n fontSize: '12px',\n color: 'red',\n paddingTop: '5px'\n }\n});\n\nconst Design = withStyles(styles)((props) => {\n const {\n classes,\n model,\n configuration,\n onPromptChanged,\n onChoiceChanged,\n onRemoveChoice,\n onAddChoice,\n imageSupport,\n onChangeModel,\n onConfigurationChanged,\n onTeacherInstructionsChanged,\n } = props;\n const {\n prompt = {},\n addChoiceButton = {},\n feedback = {},\n deleteChoice = {},\n choiceMode = {},\n choicePrefix = {},\n partialScoring = {},\n lockChoiceOrder = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n accessibility = {},\n scoringType = {},\n sequentialChoiceLabels = {},\n settingsPanelDisabled,\n choicesLayout,\n spellCheck = {},\n gridColumns\n } = configuration || {};\n let { maxAnswerChoices } = configuration || {};\n const {\n limitChoicesNumber,\n teacherInstructionsEnabled,\n rationaleEnabled,\n accessibilityLabelsEnabled,\n feedbackEnabled,\n promptEnabled,\n spellCheckEnabled,\n choices,\n errors\n } = model || {};\n\n const { choicesErrors, correctResponseError, answerChoicesError } = errors || {};\n const nrOfColumnsAvailable = choices && choices.length\n ? Array.from({ length: choices.length }, (_, i) => `${i + 1}`)\n : [];\n\n const labelPlugins = {\n audio: { disabled: true },\n video: { disabled: true },\n };\n\n const toolbarOpts = {};\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n const validationMessage = generateValidationMessage(configuration);\n\n const Content = (\n <div>\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n <div className={classes.flexContainer}>\n <Typography className={classes.titleText}>Choices</Typography>\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'}/>\n </Tooltip>\n </div>\n {correctResponseError && <div className={classes.errorText}>{correctResponseError}</div>}\n {answerChoicesError && <div className={classes.errorText}>{answerChoicesError}</div>}\n {choices.map((choice, index) => (\n <div\n key={`choice-${index}`}\n className={classes.choiceConfigurationHolder}\n >\n <ChoiceConfiguration\n key={index}\n index={index + 1}\n useLetterOrdering={model.choicePrefix === 'letters'}\n className={classes.choiceConfiguration}\n mode={model.choiceMode}\n data={choice}\n defaultFeedback={{}}\n imageSupport={imageSupport}\n onDelete={() => onRemoveChoice(index)}\n onChange={(c) => onChoiceChanged(index, c)}\n allowFeedBack={feedbackEnabled}\n allowDelete={deleteChoice.settings}\n noLabels\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n error={choicesErrors && choicesErrors[choice.value] ? choicesErrors[choice.value] : null}\n noCorrectAnswerError={correctResponseError}\n />\n {rationaleEnabled && (\n <InputContainer\n key={`rationale-${index}`}\n label={rationale.label}\n className={classes.rationaleHolder}\n >\n <EditableHtml\n className={classes.rationale}\n markup={choice.rationale || ''}\n onChange={(c) =>\n onChoiceChanged(index, {\n ...choice,\n rationale: c,\n })\n }\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n pluginProps={labelPlugins}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n {accessibilityLabelsEnabled && (\n <InputContainer\n key={`accessibility-${index}`}\n label={accessibility.label}\n className={classes.accessibilityHolder}\n >\n <EditableHtml\n className={classes.accessibility}\n markup={choice.accessibility || ''}\n onChange={(c) =>\n onChoiceChanged(index, {\n ...choice,\n accessibility: c,\n })\n }\n imageSupport={imageSupport}\n pluginProps={labelPlugins}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n </div>\n ))}\n <br/>\n {addChoiceButton.settings && (\n <Tooltip\n title={\n maxAnswerChoices && model.choices.length >= maxAnswerChoices\n ? `Only ${maxAnswerChoices} allowed maximum`\n : ''\n }\n classes={{ tooltip: classes.tooltip }}\n >\n <Button\n classes={{ root: maxAnswerChoices && model.choices.length >= maxAnswerChoices && classes.disableButton }}\n className={classes.addButton}\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n >\n {addChoiceButton.label}\n </Button>\n </Tooltip>\n )}\n </div>\n );\n\n const settingsInPanel = {\n choiceMode:\n choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),\n 'sequentialChoiceLabels.enabled':\n sequentialChoiceLabels.settings &&\n toggle(sequentialChoiceLabels.label, true),\n choicePrefix:\n choicePrefix.settings &&\n radio(choicePrefix.label, ['numbers', 'letters']),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n choicesLayout:\n choicesLayout.settings &&\n dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),\n gridColumns:\n choicesLayout.settings &&\n model.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.length > 0 &&\n dropdown(gridColumns.label, nrOfColumnsAvailable),\n };\n\n return (\n <div className={classes.design}>\n {settingsPanelDisabled ? (\n Content\n ) : (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n onChangeModel={onChangeModel}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: settingsInPanel,\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n studentInstructionsEnabled:\n studentInstructions.settings &&\n toggle(studentInstructions.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n rationaleEnabled:\n rationale.settings && toggle(rationale.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n accessibilityLabelsEnabled:\n accessibility.settings && toggle(accessibility.label),\n scoringType:\n scoringType.settings &&\n radio(scoringType.label, ['auto', 'rubric']),\n },\n }}\n />\n }\n >\n {Content}\n </layout.ConfigLayout>\n )}\n </div>\n );\n});\n\nconst InfoDialog = ({ open, onCancel, onOk, title }) => (\n <Dialog open={open}>\n <DialogTitle>{title}</DialogTitle>\n <DialogActions>\n {onOk && (\n <Button onClick={onOk} color=\"primary\">\n OK\n </Button>\n )}\n {onCancel && (\n <Button onClick={onCancel} color=\"primary\">\n Cancel\n </Button>\n )}\n </DialogActions>\n </Dialog>\n);\n\nInfoDialog.propTypes = {\n open: PropTypes.bool,\n onCancel: PropTypes.func,\n onOk: PropTypes.func,\n title: PropTypes.string,\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n };\n\n state = {\n dialog: {\n open: false,\n },\n };\n\n onRemoveChoice = (index) => {\n const { model, configuration } = this.props;\n const { minAnswerChoices } = configuration || {};\n\n if (minAnswerChoices && model.choices.length === minAnswerChoices) {\n this.setState({\n dialog: {\n open: true,\n message: `There can't be less than ${minAnswerChoices} choices.`,\n onOk: () => {\n this.setState({\n dialog: {\n open: false,\n },\n });\n }\n }\n });\n } else {\n model.choices.splice(index, 1);\n this.props.onModelChanged(model);\n }\n };\n\n onAddChoice = () => {\n const { model, configuration } = this.props;\n let { maxAnswerChoices } = configuration || {};\n const { limitChoicesNumber } = model || {};\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {\n return;\n }\n\n model.choices.push({\n label: '',\n value: utils.firstAvailableIndex(model.choices.map((c) => c.value), 0),\n feedback: { type: 'none' }\n });\n\n this.props.onModelChanged(model);\n };\n\n onChoiceChanged = (index, choice) => {\n const { model } = this.props;\n\n if (choice.correct && model.choiceMode === 'radio') {\n model.choices = model.choices.map((c) => {\n return merge({}, c, { correct: false });\n });\n }\n\n model.choices.splice(index, 1, choice);\n this.props.onModelChanged(model);\n };\n\n onPromptChanged = (prompt) => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt,\n });\n };\n\n onTeacherInstructionsChanged = (teacherInstructions) => {\n this.props.onModelChanged({\n ...this.props.model,\n teacherInstructions,\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n switch (key) {\n case 'choiceMode': {\n let value = model.choiceMode;\n\n if (value === 'radio') {\n let correctFound = false;\n\n model.choices = model.choices.map((c) => {\n if (correctFound) {\n c.correct = false;\n\n return c;\n }\n\n if (c.correct) {\n correctFound = true;\n }\n\n return c;\n });\n }\n\n onModelChanged(model, true);\n break;\n }\n default:\n onModelChanged(model);\n break;\n }\n };\n\n render() {\n const { dialog } = this.state;\n\n return (\n <>\n <InfoDialog\n open={dialog.open}\n title={dialog.message}\n onCancel={dialog.onCancel}\n onOk={dialog.onOk}\n />\n <Design\n {...this.props}\n onChangeModel={this.onModelChanged}\n onRemoveChoice={this.onRemoveChoice}\n onChoiceChanged={this.onChoiceChanged}\n onAddChoice={this.onAddChoice}\n onPromptChanged={this.onPromptChanged}\n onTeacherInstructionsChanged={this.onTeacherInstructionsChanged}\n />\n </>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.generateValidationMessage = void 0;
7
+
8
+ var generateValidationMessage = function generateValidationMessage(config) {
9
+ var minAnswerChoices = config.minAnswerChoices,
10
+ maxAnswerChoices = config.maxAnswerChoices;
11
+ var answerChoicesMessage = "\nThere should be at least ".concat(minAnswerChoices, " ") + (maxAnswerChoices ? "and at most ".concat(maxAnswerChoices, " ") : '') + 'answer choices defined.' + '\nEvery answer choice should be non-blank and unique.';
12
+ var correctAnswerMessage = '\nA correct answer must be defined.';
13
+ var message = 'Validation requirements:' + answerChoicesMessage + correctAnswerMessage;
14
+ return message;
15
+ };
16
+
17
+ exports.generateValidationMessage = generateValidationMessage;
18
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.js"],"names":["generateValidationMessage","config","minAnswerChoices","maxAnswerChoices","answerChoicesMessage","correctAnswerMessage","message"],"mappings":";;;;;;;AAAO,IAAMA,yBAAyB,GAAG,SAA5BA,yBAA4B,CAAAC,MAAM,EAAI;AACjD,MAAQC,gBAAR,GAA+CD,MAA/C,CAAQC,gBAAR;AAAA,MAA0BC,gBAA1B,GAA+CF,MAA/C,CAA0BE,gBAA1B;AAEA,MAAMC,oBAAoB,GAAG,qCAA8BF,gBAA9B,UAC1BC,gBAAgB,yBAAkBA,gBAAlB,SAAwC,EAD9B,IACoC,yBADpC,GAE3B,uDAFF;AAIA,MAAME,oBAAoB,GAAG,qCAA7B;AAEA,MAAMC,OAAO,GAAG,6BAA6BF,oBAA7B,GAAoDC,oBAApE;AAEA,SAAOC,OAAP;AACD,CAZM","sourcesContent":["export const generateValidationMessage = config => {\n const { minAnswerChoices, maxAnswerChoices } = config;\n\n const answerChoicesMessage = `\\nThere should be at least ${minAnswerChoices} ` +\n (maxAnswerChoices ? `and at most ${maxAnswerChoices} ` : '') + 'answer choices defined.' +\n '\\nEvery answer choice should be non-blank and unique.';\n\n const correctAnswerMessage = '\\nA correct answer must be defined.';\n\n const message = 'Validation requirements:' + answerChoicesMessage + correctAnswerMessage;\n\n return message;\n};\n"],"file":"utils.js"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/multiple-choice-configure",
3
- "version": "4.1.7",
3
+ "version": "4.2.0",
4
4
  "private": true,
5
5
  "main": "lib/index.js",
6
6
  "module": "src/index.js",
@@ -8,9 +8,9 @@
8
8
  "@material-ui/core": "^3.9.2",
9
9
  "@material-ui/icons": "^3.0.1",
10
10
  "@pie-framework/pie-configure-events": "^1.2.0",
11
- "@pie-lib/config-ui": "^10.11.0",
12
- "@pie-lib/editable-html": "^7.20.0",
13
- "@pie-lib/scoring-config": "^3.5.154",
11
+ "@pie-lib/config-ui": "^10.12.1",
12
+ "@pie-lib/editable-html": "^7.22.1",
13
+ "@pie-lib/scoring-config": "^3.5.157",
14
14
  "debug": "^3.1.0",
15
15
  "lodash": "^4.17.15",
16
16
  "prop-types": "^15.6.2",
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.6.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@3.5.5...@pie-element/multiple-choice-controller@3.6.0) (2022-05-03)
7
+
8
+
9
+ ### Features
10
+
11
+ * **multiple-choice:** updated validation behaviors PD-1696 PD-1697 ([ab009c4](https://github.com/pie-framework/pie-elements/commit/ab009c4832572dab96c5b4130a5088dea17222e6))
12
+ * added configurable validation ([1e3a0d6](https://github.com/pie-framework/pie-elements/commit/1e3a0d6da3c790e68a7fd401df2c832917d62480))
13
+ * added configurable validation + refactoring PD-1696 ([31f6354](https://github.com/pie-framework/pie-elements/commit/31f6354b256fef876fa6c48e79a3f82486b5fce7))
14
+ * added configurable validation + refactoring PD-1696 ([08d9b70](https://github.com/pie-framework/pie-elements/commit/08d9b70991f159707ef7fd5b3e533a0addda1d90))
15
+ * added configurable validation + refactoring PD-1696 ([07c42c2](https://github.com/pie-framework/pie-elements/commit/07c42c2811349d1e829d367993541157fbbe2dfc))
16
+ * start working on multiple-choice validation ([722037b](https://github.com/pie-framework/pie-elements/commit/722037bc0fddd2e090ec1506e85a91949ad86c91))
17
+
18
+
19
+
20
+
21
+
6
22
  ## [3.5.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@3.5.4...@pie-element/multiple-choice-controller@3.5.5) (2022-04-12)
7
23
 
8
24
  **Note:** Version bump only for package @pie-element/multiple-choice-controller
@@ -285,7 +285,7 @@ var validate = function validate() {
285
285
  var nbOfChoices = (choices || []).length;
286
286
 
287
287
  if (nbOfChoices < minAnswerChoices) {
288
- errors.answerChoicesError = "Should be defined at least ".concat(minAnswerChoices, " choices.");
288
+ errors.answerChoicesError = "There should be at least ".concat(minAnswerChoices, " choices defined.");
289
289
  } else if (nbOfChoices > maxAnswerChoices) {
290
290
  errors.answerChoicesError = "No more than ".concat(maxAnswerChoices, " choices should be defined.");
291
291
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["prepareChoice","model","env","defaultFeedback","choice","role","mode","out","label","value","accessibilityLabelsEnabled","accessibility","textContent","rationale","rationaleEnabled","correct","feedbackEnabled","feedbackType","feedback","type","createDefaultModel","Promise","resolve","defaults","normalize","question","verticalMode","choicesLayout","questionProps","session","updateSession","normalizedQuestion","Object","assign","incorrect","choices","map","lockChoiceOrder","disabled","prompt","promptEnabled","gridColumns","choiceMode","keyMode","choicePrefix","responseCorrect","undefined","teacherInstructions","teacherInstructionsEnabled","getScore","config","selectedChoices","correctChoices","filter","ch","score","reduce","acc","selectedChoice","find","length","str","parseFloat","toFixed","outcome","empty","partialScoringEnabled","partialScoring","enabled","createCorrectResponseSession","id","c","validate","minAnswerChoices","maxAnswerChoices","reversedChoices","reverse","choicesErrors","hasCorrectResponse","forEach","index","identicalAnswer","slice","some","errors","nbOfChoices","answerChoicesError","correctResponseError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,EAAQC,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Z,EAAgByB,MAApC;;AAEA,MAAIyB,WAAW,GAAGZ,gBAAlB,EAAoC;AAClCW,IAAAA,MAAM,CAACE,kBAAP,wCAA0Db,gBAA1D;AACD,GAFD,MAEO,IAAIY,WAAW,GAAGX,gBAAlB,EAAoC;AACzCU,IAAAA,MAAM,CAACE,kBAAP,0BAA4CZ,gBAA5C;AACD;;AAED,MAAI,CAACI,kBAAL,EAAyB;AACvBM,IAAAA,MAAM,CAACG,oBAAP,GAA8B,8BAA9B;AACD;;AAED,MAAI,CAAC,yBAAQV,aAAR,CAAL,EAA6B;AAC3BO,IAAAA,MAAM,CAACP,aAAP,GAAuBA,aAAvB;AACD;;AAED,SAAOO,MAAP;AACD,CA3CM","sourcesContent":["/* eslint-disable no-console */\nimport isEmpty from 'lodash/isEmpty';\nimport { isResponseCorrect, parseHTML } from './utils';\nimport defaults from './defaults';\nimport { lockChoices, partialScoring, getShuffledChoices } from '@pie-lib/controller-utils';\n\nconst prepareChoice = (model, env, defaultFeedback) => choice => {\n const { role, mode } = env || {};\n const out = {\n label: choice.label,\n value: choice.value,\n };\n\n if (model.accessibilityLabelsEnabled) {\n out.accessibility = parseHTML(choice.accessibility).textContent || choice.value;\n }\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = model.rationaleEnabled ? choice.rationale : null;\n } else {\n out.rationale = null;\n }\n\n if (mode === 'evaluate') {\n out.correct = !!choice.correct;\n\n if (model.feedbackEnabled) {\n const feedbackType = (choice.feedback && choice.feedback.type) || 'none';\n\n if (feedbackType === 'default') {\n out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];\n } else if (feedbackType === 'custom') {\n out.feedback = choice.feedback.value;\n }\n }\n }\n\n return out;\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise(resolve => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = question => {\n const { verticalMode, choicesLayout, ...questionProps } = question || {};\n\n return {\n ...defaults,\n ...questionProps,\n // This is used for offering support for old models which have the property verticalMode\n // Same thing is set in authoring : packages/multiple-choice/configure/src/index.jsx - createDefaultModel\n choicesLayout: choicesLayout || (verticalMode === false && 'horizontal') || defaults.choicesLayout\n };\n};\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n\n const defaultFeedback = Object.assign(\n { correct: 'Correct', incorrect: 'Incorrect' },\n normalizedQuestion.defaultFeedback\n );\n\n let choices = normalizedQuestion.choices.map(\n prepareChoice(normalizedQuestion, env, defaultFeedback)\n );\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(\n choices,\n session,\n updateSession,\n 'value'\n );\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n choicesLayout: normalizedQuestion.choicesLayout,\n gridColumns: normalizedQuestion.gridColumns,\n choiceMode: normalizedQuestion.choiceMode,\n keyMode: normalizedQuestion.choicePrefix,\n choices,\n responseCorrect:\n env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined\n };\n\n const { role, mode } = env || {};\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n return out;\n}\n\n\nexport const getScore = (config, session) => {\n if (!session || isEmpty(session)) {\n return 0;\n }\n\n const selectedChoices = session.value || [];\n const correctChoices = (config.choices || []).filter(ch => ch.correct);\n\n let score = selectedChoices.reduce((acc, selectedChoice) =>\n acc + (correctChoices.find(ch => ch.value === selectedChoice) ? 1 : 0), 0);\n\n if (correctChoices.length < selectedChoices.length) {\n score -= selectedChoices.length - correctChoices.length;\n\n if (score < 0) {\n score = 0;\n }\n }\n\n const str = correctChoices.length ? score / correctChoices.length : 0;\n\n return parseFloat(str.toFixed(2));\n};\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring = false. the value in `env` will\n * override the value in `model`.\n * @param {Object} model - the main model\n * @param {*} session\n * @param {Object} env\n */\nexport function outcome(model, session, env) {\n return new Promise(resolve => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true });\n } else {\n const partialScoringEnabled =\n partialScoring.enabled(model, env) && model.choiceMode !== 'radio';\n const score = getScore(model, session);\n\n resolve({ score: partialScoringEnabled ? score : score === 1 ? 1 : 0, empty: false });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise(resolve => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question || { choices: [] };\n\n resolve({\n id: '1',\n value: choices.filter(c => c.correct).map(c => c.value)\n });\n } else {\n resolve(null);\n }\n });\n};\n\nexport const validate = (model = {}, config = {}) => {\n const { choices } = model;\n const { minAnswerChoices = 2, maxAnswerChoices } = config;\n const reversedChoices = [...choices || []].reverse();\n const choicesErrors = {};\n let hasCorrectResponse = false;\n\n reversedChoices.forEach((choice, index) => {\n const { correct, value, label } = choice;\n\n if (correct) {\n hasCorrectResponse = true;\n }\n\n if (label === '' || label === '<div></div>') {\n choicesErrors[value] = 'Content should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some(c => c.label === label);\n\n if (identicalAnswer) {\n choicesErrors[value] = 'Content should be unique.';\n }\n }\n });\n\n const errors = {};\n const nbOfChoices = (choices || []).length;\n\n if (nbOfChoices < minAnswerChoices) {\n errors.answerChoicesError = `Should be defined at least ${minAnswerChoices} choices.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.answerChoicesError = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (!hasCorrectResponse) {\n errors.correctResponseError = 'No correct response defined.';\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choicesErrors = choicesErrors;\n }\n\n return errors;\n};\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["prepareChoice","model","env","defaultFeedback","choice","role","mode","out","label","value","accessibilityLabelsEnabled","accessibility","textContent","rationale","rationaleEnabled","correct","feedbackEnabled","feedbackType","feedback","type","createDefaultModel","Promise","resolve","defaults","normalize","question","verticalMode","choicesLayout","questionProps","session","updateSession","normalizedQuestion","Object","assign","incorrect","choices","map","lockChoiceOrder","disabled","prompt","promptEnabled","gridColumns","choiceMode","keyMode","choicePrefix","responseCorrect","undefined","teacherInstructions","teacherInstructionsEnabled","getScore","config","selectedChoices","correctChoices","filter","ch","score","reduce","acc","selectedChoice","find","length","str","parseFloat","toFixed","outcome","empty","partialScoringEnabled","partialScoring","enabled","createCorrectResponseSession","id","c","validate","minAnswerChoices","maxAnswerChoices","reversedChoices","reverse","choicesErrors","hasCorrectResponse","forEach","index","identicalAnswer","slice","some","errors","nbOfChoices","answerChoicesError","correctResponseError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,EAAQC,GAAR,EAAaC,eAAb;AAAA,SAAiC,UAAAC,MAAM,EAAI;AAC/D,eAAuBF,GAAG,IAAI,EAA9B;AAAA,QAAQG,IAAR,QAAQA,IAAR;AAAA,QAAcC,IAAd,QAAcA,IAAd;;AACA,QAAMC,GAAG,GAAG;AACVC,MAAAA,KAAK,EAAEJ,MAAM,CAACI,KADJ;AAEVC,MAAAA,KAAK,EAAEL,MAAM,CAACK;AAFJ,KAAZ;;AAKA,QAAIR,KAAK,CAACS,0BAAV,EAAsC;AACpCH,MAAAA,GAAG,CAACI,aAAJ,GAAoB,sBAAUP,MAAM,CAACO,aAAjB,EAAgCC,WAAhC,IAA+CR,MAAM,CAACK,KAA1E;AACD;;AAED,QAAIJ,IAAI,KAAK,YA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no-console */\nimport isEmpty from 'lodash/isEmpty';\nimport { isResponseCorrect, parseHTML } from './utils';\nimport defaults from './defaults';\nimport { lockChoices, partialScoring, getShuffledChoices } from '@pie-lib/controller-utils';\n\nconst prepareChoice = (model, env, defaultFeedback) => choice => {\n const { role, mode } = env || {};\n const out = {\n label: choice.label,\n value: choice.value,\n };\n\n if (model.accessibilityLabelsEnabled) {\n out.accessibility = parseHTML(choice.accessibility).textContent || choice.value;\n }\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = model.rationaleEnabled ? choice.rationale : null;\n } else {\n out.rationale = null;\n }\n\n if (mode === 'evaluate') {\n out.correct = !!choice.correct;\n\n if (model.feedbackEnabled) {\n const feedbackType = (choice.feedback && choice.feedback.type) || 'none';\n\n if (feedbackType === 'default') {\n out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];\n } else if (feedbackType === 'custom') {\n out.feedback = choice.feedback.value;\n }\n }\n }\n\n return out;\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise(resolve => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = question => {\n const { verticalMode, choicesLayout, ...questionProps } = question || {};\n\n return {\n ...defaults,\n ...questionProps,\n // This is used for offering support for old models which have the property verticalMode\n // Same thing is set in authoring : packages/multiple-choice/configure/src/index.jsx - createDefaultModel\n choicesLayout: choicesLayout || (verticalMode === false && 'horizontal') || defaults.choicesLayout\n };\n};\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n\n const defaultFeedback = Object.assign(\n { correct: 'Correct', incorrect: 'Incorrect' },\n normalizedQuestion.defaultFeedback\n );\n\n let choices = normalizedQuestion.choices.map(\n prepareChoice(normalizedQuestion, env, defaultFeedback)\n );\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(\n choices,\n session,\n updateSession,\n 'value'\n );\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n choicesLayout: normalizedQuestion.choicesLayout,\n gridColumns: normalizedQuestion.gridColumns,\n choiceMode: normalizedQuestion.choiceMode,\n keyMode: normalizedQuestion.choicePrefix,\n choices,\n responseCorrect:\n env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined\n };\n\n const { role, mode } = env || {};\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n return out;\n}\n\n\nexport const getScore = (config, session) => {\n if (!session || isEmpty(session)) {\n return 0;\n }\n\n const selectedChoices = session.value || [];\n const correctChoices = (config.choices || []).filter(ch => ch.correct);\n\n let score = selectedChoices.reduce((acc, selectedChoice) =>\n acc + (correctChoices.find(ch => ch.value === selectedChoice) ? 1 : 0), 0);\n\n if (correctChoices.length < selectedChoices.length) {\n score -= selectedChoices.length - correctChoices.length;\n\n if (score < 0) {\n score = 0;\n }\n }\n\n const str = correctChoices.length ? score / correctChoices.length : 0;\n\n return parseFloat(str.toFixed(2));\n};\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring = false. the value in `env` will\n * override the value in `model`.\n * @param {Object} model - the main model\n * @param {*} session\n * @param {Object} env\n */\nexport function outcome(model, session, env) {\n return new Promise(resolve => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true });\n } else {\n const partialScoringEnabled =\n partialScoring.enabled(model, env) && model.choiceMode !== 'radio';\n const score = getScore(model, session);\n\n resolve({ score: partialScoringEnabled ? score : score === 1 ? 1 : 0, empty: false });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise(resolve => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question || { choices: [] };\n\n resolve({\n id: '1',\n value: choices.filter(c => c.correct).map(c => c.value)\n });\n } else {\n resolve(null);\n }\n });\n};\n\nexport const validate = (model = {}, config = {}) => {\n const { choices } = model;\n const { minAnswerChoices = 2, maxAnswerChoices } = config;\n const reversedChoices = [...choices || []].reverse();\n const choicesErrors = {};\n let hasCorrectResponse = false;\n\n reversedChoices.forEach((choice, index) => {\n const { correct, value, label } = choice;\n\n if (correct) {\n hasCorrectResponse = true;\n }\n\n if (label === '' || label === '<div></div>') {\n choicesErrors[value] = 'Content should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some(c => c.label === label);\n\n if (identicalAnswer) {\n choicesErrors[value] = 'Content should be unique.';\n }\n }\n });\n\n const errors = {};\n const nbOfChoices = (choices || []).length;\n\n if (nbOfChoices < minAnswerChoices) {\n errors.answerChoicesError = `There should be at least ${minAnswerChoices} choices defined.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.answerChoicesError = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (!hasCorrectResponse) {\n errors.correctResponseError = 'No correct response defined.';\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choicesErrors = choicesErrors;\n }\n\n return errors;\n};\n"],"file":"index.js"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/multiple-choice-controller",
3
3
  "private": true,
4
- "version": "3.5.5",
4
+ "version": "3.6.0",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
@@ -1,6 +1,6 @@
1
- import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_lodash, _dll_pie_lib__render_ui, _dll_debug, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.10/module/index.js";
2
- import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.33/module/index.js";
3
- import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.2.9/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_lodash, _dll_material_ui__icons, _dll_pie_lib__render_ui, _dll_debug, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.13/module/index.js";
2
+ import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.2.0/module/index.js";
3
+ import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.5.0/module/index.js";
4
4
  var lib = {};
5
5
  Object.defineProperty(lib, "__esModule", {
6
6
  value: true
@@ -46,6 +46,13 @@ class InsertImageEvent extends CustomEvent {
46
46
  }
47
47
  InsertImageEvent.TYPE = 'insert.image';
48
48
  var InsertImageEvent_1 = lib.InsertImageEvent = InsertImageEvent;
49
+ const generateValidationMessage = config => {
50
+ const {minAnswerChoices, maxAnswerChoices} = config;
51
+ const answerChoicesMessage = `\nThere should be at least ${minAnswerChoices} ` + (maxAnswerChoices ? `and at most ${maxAnswerChoices} ` : '') + 'answer choices defined.' + '\nEvery answer choice should be non-blank and unique.';
52
+ const correctAnswerMessage = '\nA correct answer must be defined.';
53
+ const message = 'Validation requirements:' + answerChoicesMessage + correctAnswerMessage;
54
+ return message;
55
+ };
49
56
  const React$1 = _dll_react;
50
57
  const PropTypes = _dll_prop_types;
51
58
  const {color: color} = _dll_pie_lib__render_ui;
@@ -55,7 +62,9 @@ const {Tooltip: Tooltip} = _dll_material_ui__core;
55
62
  const {Dialog: Dialog} = _dll_material_ui__core;
56
63
  const {DialogTitle: DialogTitle} = _dll_material_ui__core;
57
64
  const {DialogActions: DialogActions} = _dll_material_ui__core;
65
+ const {Typography: Typography} = _dll_material_ui__core;
58
66
  const {merge: merge} = _dll_lodash;
67
+ const {Info: Info} = _dll_material_ui__icons;
59
68
  const EditableHtml = _dll_pie_lib__editable_html;
60
69
  const {InputContainer: InputContainer} = _dll_pie_lib__config_ui;
61
70
  const {ChoiceConfiguration: ChoiceConfiguration} = _dll_pie_lib__config_ui;
@@ -120,15 +129,15 @@ const styles = theme => ({
120
129
  },
121
130
  flexContainer: {
122
131
  display: 'flex',
123
- alignItems: 'center'
132
+ alignItems: 'center',
133
+ marginBottom: '5px'
124
134
  },
125
135
  titleText: {
126
136
  fontFamily: 'Cerebri Sans',
127
137
  fontSize: '18px',
128
138
  lineHeight: '19px',
129
139
  color: '#495B8F',
130
- marginRight: '5px',
131
- marginBottom: '5px'
140
+ marginRight: '5px'
132
141
  },
133
142
  tooltip: {
134
143
  fontSize: '12px',
@@ -145,7 +154,8 @@ const Design = withStyles(styles)(props => {
145
154
  const {classes, model, configuration, onPromptChanged, onChoiceChanged, onRemoveChoice, onAddChoice, imageSupport, onChangeModel, onConfigurationChanged, onTeacherInstructionsChanged} = props;
146
155
  const {prompt = {}, addChoiceButton = {}, feedback = {}, deleteChoice = {}, choiceMode = {}, choicePrefix = {}, partialScoring = {}, lockChoiceOrder = {}, teacherInstructions = {}, studentInstructions = {}, rationale = {}, accessibility = {}, scoringType = {}, sequentialChoiceLabels = {}, settingsPanelDisabled, choicesLayout, spellCheck = {}, gridColumns} = configuration || ({});
147
156
  let {maxAnswerChoices} = configuration || ({});
148
- const {limitChoicesNumber, teacherInstructionsEnabled, rationaleEnabled, accessibilityLabelsEnabled, feedbackEnabled, promptEnabled, spellCheckEnabled, choices} = model || ({});
157
+ const {limitChoicesNumber, teacherInstructionsEnabled, rationaleEnabled, accessibilityLabelsEnabled, feedbackEnabled, promptEnabled, spellCheckEnabled, choices, errors} = model || ({});
158
+ const {choicesErrors, correctResponseError, answerChoicesError} = errors || ({});
149
159
  const nrOfColumnsAvailable = choices && choices.length ? Array.from({
150
160
  length: choices.length
151
161
  }, (_, i) => `${i + 1}`) : [];
@@ -169,11 +179,12 @@ const Design = withStyles(styles)(props => {
169
179
  if (limitChoicesNumber) {
170
180
  maxAnswerChoices = MAX_CHOICES;
171
181
  }
182
+ const validationMessage = generateValidationMessage(configuration);
172
183
  const Content = React$1.createElement('div', {
173
184
  __self: undefined,
174
185
  __source: {
175
186
  fileName: _jsxFileName,
176
- lineNumber: 178
187
+ lineNumber: 180
177
188
  }
178
189
  }, teacherInstructionsEnabled && React$1.createElement(InputContainer, {
179
190
  label: teacherInstructions.label,
@@ -181,7 +192,7 @@ const Design = withStyles(styles)(props => {
181
192
  __self: undefined,
182
193
  __source: {
183
194
  fileName: _jsxFileName,
184
- lineNumber: 180
195
+ lineNumber: 182
185
196
  }
186
197
  }, React$1.createElement(EditableHtml, {
187
198
  className: classes.prompt,
@@ -194,7 +205,7 @@ const Design = withStyles(styles)(props => {
194
205
  __self: undefined,
195
206
  __source: {
196
207
  fileName: _jsxFileName,
197
- lineNumber: 184
208
+ lineNumber: 186
198
209
  }
199
210
  })), promptEnabled && React$1.createElement(InputContainer, {
200
211
  label: prompt.label,
@@ -202,7 +213,7 @@ const Design = withStyles(styles)(props => {
202
213
  __self: undefined,
203
214
  __source: {
204
215
  fileName: _jsxFileName,
205
- lineNumber: 197
216
+ lineNumber: 199
206
217
  }
207
218
  }, React$1.createElement(EditableHtml, {
208
219
  className: classes.prompt,
@@ -216,15 +227,64 @@ const Design = withStyles(styles)(props => {
216
227
  __self: undefined,
217
228
  __source: {
218
229
  fileName: _jsxFileName,
219
- lineNumber: 198
230
+ lineNumber: 200
231
+ }
232
+ })), React$1.createElement('div', {
233
+ className: classes.flexContainer,
234
+ __self: undefined,
235
+ __source: {
236
+ fileName: _jsxFileName,
237
+ lineNumber: 212
238
+ }
239
+ }, React$1.createElement(Typography, {
240
+ className: classes.titleText,
241
+ __self: undefined,
242
+ __source: {
243
+ fileName: _jsxFileName,
244
+ lineNumber: 213
245
+ }
246
+ }, "Choices"), React$1.createElement(Tooltip, {
247
+ classes: {
248
+ tooltip: classes.tooltip
249
+ },
250
+ disableFocusListener: true,
251
+ disableTouchListener: true,
252
+ placement: 'right',
253
+ title: validationMessage,
254
+ __self: undefined,
255
+ __source: {
256
+ fileName: _jsxFileName,
257
+ lineNumber: 214
258
+ }
259
+ }, React$1.createElement(Info, {
260
+ fontSize: 'small',
261
+ color: 'primary',
262
+ __self: undefined,
263
+ __source: {
264
+ fileName: _jsxFileName,
265
+ lineNumber: 221
266
+ }
267
+ }))), correctResponseError && React$1.createElement('div', {
268
+ className: classes.errorText,
269
+ __self: undefined,
270
+ __source: {
271
+ fileName: _jsxFileName,
272
+ lineNumber: 224
273
+ }
274
+ }, correctResponseError), answerChoicesError && React$1.createElement('div', {
275
+ className: classes.errorText,
276
+ __self: undefined,
277
+ __source: {
278
+ fileName: _jsxFileName,
279
+ lineNumber: 225
220
280
  }
221
- })), choices.map((choice, index) => React$1.createElement('div', {
281
+ }, answerChoicesError), choices.map((choice, index) => React$1.createElement('div', {
222
282
  key: `choice-${index}`,
223
283
  className: classes.choiceConfigurationHolder,
224
284
  __self: undefined,
225
285
  __source: {
226
286
  fileName: _jsxFileName,
227
- lineNumber: 225
287
+ lineNumber: 227
228
288
  }
229
289
  }, React$1.createElement(ChoiceConfiguration, {
230
290
  key: index,
@@ -242,10 +302,12 @@ const Design = withStyles(styles)(props => {
242
302
  noLabels: true,
243
303
  toolbarOpts: toolbarOpts,
244
304
  spellCheck: spellCheckEnabled,
305
+ error: choicesErrors && choicesErrors[choice.value] ? choicesErrors[choice.value] : null,
306
+ noCorrectAnswerError: correctResponseError,
245
307
  __self: undefined,
246
308
  __source: {
247
309
  fileName: _jsxFileName,
248
- lineNumber: 229
310
+ lineNumber: 231
249
311
  }
250
312
  }), rationaleEnabled && React$1.createElement(InputContainer, {
251
313
  key: `rationale-${index}`,
@@ -254,7 +316,7 @@ const Design = withStyles(styles)(props => {
254
316
  __self: undefined,
255
317
  __source: {
256
318
  fileName: _jsxFileName,
257
- lineNumber: 249
319
+ lineNumber: 251
258
320
  }
259
321
  }, React$1.createElement(EditableHtml, {
260
322
  className: classes.rationale,
@@ -270,7 +332,7 @@ const Design = withStyles(styles)(props => {
270
332
  __self: undefined,
271
333
  __source: {
272
334
  fileName: _jsxFileName,
273
- lineNumber: 254
335
+ lineNumber: 256
274
336
  }
275
337
  })), accessibilityLabelsEnabled && React$1.createElement(InputContainer, {
276
338
  key: `accessibility-${index}`,
@@ -279,7 +341,7 @@ const Design = withStyles(styles)(props => {
279
341
  __self: undefined,
280
342
  __source: {
281
343
  fileName: _jsxFileName,
282
- lineNumber: 271
344
+ lineNumber: 273
283
345
  }
284
346
  }, React$1.createElement(EditableHtml, {
285
347
  className: classes.accessibility,
@@ -294,13 +356,13 @@ const Design = withStyles(styles)(props => {
294
356
  __self: undefined,
295
357
  __source: {
296
358
  fileName: _jsxFileName,
297
- lineNumber: 276
359
+ lineNumber: 278
298
360
  }
299
361
  })))), React$1.createElement('br', {
300
362
  __self: undefined,
301
363
  __source: {
302
364
  fileName: _jsxFileName,
303
- lineNumber: 293
365
+ lineNumber: 295
304
366
  }
305
367
  }), addChoiceButton.settings && React$1.createElement(Tooltip, {
306
368
  title: maxAnswerChoices && model.choices.length >= maxAnswerChoices ? `Only ${maxAnswerChoices} allowed maximum` : '',
@@ -310,11 +372,11 @@ const Design = withStyles(styles)(props => {
310
372
  __self: undefined,
311
373
  __source: {
312
374
  fileName: _jsxFileName,
313
- lineNumber: 295
375
+ lineNumber: 297
314
376
  }
315
377
  }, React$1.createElement(Button, {
316
378
  classes: {
317
- root: maxAnswerChoices && model.choices.length >= maxAnswerChoices ? classes.disableButton : undefined
379
+ root: maxAnswerChoices && model.choices.length >= maxAnswerChoices && classes.disableButton
318
380
  },
319
381
  className: classes.addButton,
320
382
  variant: "contained",
@@ -323,7 +385,7 @@ const Design = withStyles(styles)(props => {
323
385
  __self: undefined,
324
386
  __source: {
325
387
  fileName: _jsxFileName,
326
- lineNumber: 303
388
+ lineNumber: 305
327
389
  }
328
390
  }, addChoiceButton.label)));
329
391
  const settingsInPanel = {
@@ -341,7 +403,7 @@ const Design = withStyles(styles)(props => {
341
403
  __self: undefined,
342
404
  __source: {
343
405
  fileName: _jsxFileName,
344
- lineNumber: 345
406
+ lineNumber: 342
345
407
  }
346
408
  }, settingsPanelDisabled ? Content : React$1.createElement(layout.ConfigLayout, {
347
409
  settings: React$1.createElement(Panel, {
@@ -364,13 +426,13 @@ const Design = withStyles(styles)(props => {
364
426
  __self: undefined,
365
427
  __source: {
366
428
  fileName: _jsxFileName,
367
- lineNumber: 351
429
+ lineNumber: 348
368
430
  }
369
431
  }),
370
432
  __self: undefined,
371
433
  __source: {
372
434
  fileName: _jsxFileName,
373
- lineNumber: 349
435
+ lineNumber: 346
374
436
  }
375
437
  }, Content));
376
438
  });
@@ -379,19 +441,19 @@ const InfoDialog = ({open, onCancel, onOk, title}) => React$1.createElement(Dial
379
441
  __self: undefined,
380
442
  __source: {
381
443
  fileName: _jsxFileName,
382
- lineNumber: 388
444
+ lineNumber: 385
383
445
  }
384
446
  }, React$1.createElement(DialogTitle, {
385
447
  __self: undefined,
386
448
  __source: {
387
449
  fileName: _jsxFileName,
388
- lineNumber: 389
450
+ lineNumber: 386
389
451
  }
390
452
  }, title), React$1.createElement(DialogActions, {
391
453
  __self: undefined,
392
454
  __source: {
393
455
  fileName: _jsxFileName,
394
- lineNumber: 390
456
+ lineNumber: 387
395
457
  }
396
458
  }, onOk && React$1.createElement(Button, {
397
459
  onClick: onOk,
@@ -399,7 +461,7 @@ const InfoDialog = ({open, onCancel, onOk, title}) => React$1.createElement(Dial
399
461
  __self: undefined,
400
462
  __source: {
401
463
  fileName: _jsxFileName,
402
- lineNumber: 392
464
+ lineNumber: 389
403
465
  }
404
466
  }, "OK"), onCancel && React$1.createElement(Button, {
405
467
  onClick: onCancel,
@@ -407,7 +469,7 @@ const InfoDialog = ({open, onCancel, onOk, title}) => React$1.createElement(Dial
407
469
  __self: undefined,
408
470
  __source: {
409
471
  fileName: _jsxFileName,
410
- lineNumber: 397
472
+ lineNumber: 394
411
473
  }
412
474
  }, "Cancel")));
413
475
  InfoDialog.propTypes = {
@@ -463,12 +525,7 @@ class Main extends React$1.Component {
463
525
  open: false
464
526
  }
465
527
  });
466
- },
467
- onCancel: () => this.setState({
468
- dialog: {
469
- open: false
470
- }
471
- })
528
+ }
472
529
  }
473
530
  });
474
531
  } else {
@@ -485,35 +542,17 @@ class Main extends React$1.Component {
485
542
  if (limitChoicesNumber) {
486
543
  maxAnswerChoices = MAX_CHOICES;
487
544
  }
488
- if (maxAnswerChoices && model.choices.length === maxAnswerChoices) {
489
- this.setState({
490
- dialog: {
491
- open: true,
492
- message: `There can't be more than ${maxAnswerChoices} choices.`,
493
- onOk: () => {
494
- this.setState({
495
- dialog: {
496
- open: false
497
- }
498
- });
499
- },
500
- onCancel: () => this.setState({
501
- dialog: {
502
- open: false
503
- }
504
- })
505
- }
506
- });
507
- } else {
508
- model.choices.push({
509
- label: '',
510
- value: utils$1.firstAvailableIndex(model.choices.map(c => c.value), 0),
511
- feedback: {
512
- type: 'none'
513
- }
514
- });
515
- this.props.onModelChanged(model);
545
+ if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {
546
+ return;
516
547
  }
548
+ model.choices.push({
549
+ label: '',
550
+ value: utils$1.firstAvailableIndex(model.choices.map(c => c.value), 0),
551
+ feedback: {
552
+ type: 'none'
553
+ }
554
+ });
555
+ this.props.onModelChanged(model);
517
556
  };
518
557
  }
519
558
  __init4() {
@@ -585,7 +624,7 @@ class Main extends React$1.Component {
585
624
  __self: this,
586
625
  __source: {
587
626
  fileName: _jsxFileName,
588
- lineNumber: 571
627
+ lineNumber: 542
589
628
  }
590
629
  }), React$1.createElement(Design, {
591
630
  ...this.props,
@@ -598,7 +637,7 @@ class Main extends React$1.Component {
598
637
  __self: this,
599
638
  __source: {
600
639
  fileName: _jsxFileName,
601
- lineNumber: 577
640
+ lineNumber: 548
602
641
  }
603
642
  }));
604
643
  }
@@ -20667,7 +20667,7 @@ const validate = (model = {}, config = {}) => {
20667
20667
  const nbOfChoices = (choices || []).length;
20668
20668
 
20669
20669
  if (nbOfChoices < minAnswerChoices) {
20670
- errors.answerChoicesError = `Should be defined at least ${minAnswerChoices} choices.`;
20670
+ errors.answerChoicesError = `There should be at least ${minAnswerChoices} choices defined.`;
20671
20671
  } else if (nbOfChoices > maxAnswerChoices) {
20672
20672
  errors.answerChoicesError = `No more than ${maxAnswerChoices} choices should be defined.`;
20673
20673
  }
package/module/element.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.10/module/index.js";
2
- import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.35/module/index.js";
1
+ import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.13/module/index.js";
2
+ import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.1.1/module/index.js";
3
3
  function getDefaultExportFromCjs(x) {
4
4
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
5
  }
package/module/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/multiple-choice@6.2.6</title>
5
+ <title>@pie-element/multiple-choice@6.2.7</title>
6
6
  <script
7
7
  type="module"
8
8
  src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@pie-element/multiple-choice",
3
- "version": "6.2.6",
3
+ "version": "6.2.7",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/shared-module",
7
- "version": "^1.4.10"
7
+ "version": "^1.4.13"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/math-rendering-module",
11
- "version": "^1.0.35"
11
+ "version": "^1.1.1"
12
12
  }
13
13
  ]
14
14
  }
package/module/print.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/multiple-choice@6.2.6</title>
5
+ <title>@pie-element/multiple-choice@6.2.7</title>
6
6
  <link
7
7
  href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
8
  rel="stylesheet"
package/module/print.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.10/module/index.js";
2
- import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.35/module/index.js";
1
+ import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.13/module/index.js";
2
+ import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.1.1/module/index.js";
3
3
  function getDefaultExportFromCjs(x) {
4
4
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
5
  }
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@pie-element/multiple-choice",
3
3
  "repository": "pie-framework/pie-elements",
4
- "version": "6.2.7",
4
+ "version": "6.3.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
- "@pie-lib/config-ui": "^10.11.0",
11
- "@pie-lib/correct-answer-toggle": "^2.3.35",
12
- "@pie-lib/math-rendering": "^2.3.13",
13
- "@pie-lib/render-ui": "^4.12.5",
10
+ "@pie-lib/config-ui": "^10.12.1",
11
+ "@pie-lib/correct-answer-toggle": "^2.3.36",
12
+ "@pie-lib/math-rendering": "^2.4.0",
13
+ "@pie-lib/render-ui": "^4.12.6",
14
14
  "classnames": "^2.2.5",
15
15
  "debug": "^4.1.1",
16
16
  "enzyme-to-json": "^3.3.3",
@@ -21,7 +21,7 @@
21
21
  "react-test-renderer": "^16.3.2",
22
22
  "react-transition-group": "^2.3.1"
23
23
  },
24
- "gitHead": "de8f41ecfc06944b7bc890a167f81818d2bf1845",
24
+ "gitHead": "87c4247b2cca04380c8638f88e57bba47fb6c06a",
25
25
  "scripts": {
26
26
  "postpublish": "../../scripts/postpublish"
27
27
  },