@pie-element/placement-ordering 8.5.1 → 8.5.2-next.120

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.
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = exports.InfoDialog = void 0;
8
+ exports["default"] = void 0;
9
9
 
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
11
 
@@ -45,11 +45,9 @@ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
45
45
 
46
46
  var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
47
47
 
48
- var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
48
+ var _renderUi = require("@pie-lib/render-ui");
49
49
 
50
- var _DialogTitle = _interopRequireDefault(require("@material-ui/core/DialogTitle"));
51
-
52
- var _DialogActions = _interopRequireDefault(require("@material-ui/core/DialogActions"));
50
+ var _configUi = require("@pie-lib/config-ui");
53
51
 
54
52
  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
53
 
@@ -59,25 +57,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
59
57
 
60
58
  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; }
61
59
 
62
- var InfoDialog = function InfoDialog(_ref) {
63
- var title = _ref.title,
64
- open = _ref.open,
65
- onOk = _ref.onOk;
66
- return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
67
- open: open
68
- }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], null, title), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, onOk && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
69
- onClick: onOk,
70
- color: "primary"
71
- }, "OK")));
72
- };
73
-
74
- exports.InfoDialog = InfoDialog;
75
- InfoDialog.propTypes = {
76
- title: _propTypes["default"].string,
77
- open: _propTypes["default"].bool,
78
- onOk: _propTypes["default"].func
79
- };
80
-
81
60
  function findFreeChoiceSlot(choices) {
82
61
  var slot = 1;
83
62
  var ids = choices.map(function (c) {
@@ -197,7 +176,7 @@ var ChoiceEditor = /*#__PURE__*/function (_React$Component) {
197
176
  (0, _classCallCheck2["default"])(this, ChoiceEditor);
198
177
  _this = _super.call(this, props);
199
178
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
200
- dialog: {
179
+ warning: {
201
180
  open: false
202
181
  }
203
182
  });
@@ -207,8 +186,7 @@ var ChoiceEditor = /*#__PURE__*/function (_React$Component) {
207
186
  var _this$props = _this.props,
208
187
  choices = _this$props.choices,
209
188
  onChange = _this$props.onChange,
210
- correctResponse = _this$props.correctResponse,
211
- toolbarOpts = _this$props.toolbarOpts;
189
+ correctResponse = _this$props.correctResponse;
212
190
  var index = choices.findIndex(function (c) {
213
191
  return c.id === choice.id;
214
192
  });
@@ -227,16 +205,9 @@ var ChoiceEditor = /*#__PURE__*/function (_React$Component) {
227
205
 
228
206
  if (choices && choices.length === 3) {
229
207
  _this.setState({
230
- dialog: {
208
+ warning: {
231
209
  open: true,
232
- message: "There have to be at least 3 ".concat(choicesLabel, "."),
233
- onOk: function onOk() {
234
- _this.setState({
235
- dialog: {
236
- open: false
237
- }
238
- });
239
- }
210
+ text: "There have to be at least 3 ".concat(choicesLabel, ".")
240
211
  }
241
212
  });
242
213
  } else {
@@ -259,16 +230,9 @@ var ChoiceEditor = /*#__PURE__*/function (_React$Component) {
259
230
 
260
231
  if (choices && choices.length === 10) {
261
232
  _this.setState({
262
- dialog: {
233
+ warning: {
263
234
  open: true,
264
- message: "There can be maximum 10 ".concat(choicesLabel, "."),
265
- onOk: function onOk() {
266
- _this.setState({
267
- dialog: {
268
- open: false
269
- }
270
- });
271
- }
235
+ text: "There can be maximum 10 ".concat(choicesLabel, ".")
272
236
  }
273
237
  });
274
238
  } else {
@@ -352,13 +316,18 @@ var ChoiceEditor = /*#__PURE__*/function (_React$Component) {
352
316
  maxImageWidth = _this$props5.maxImageWidth,
353
317
  maxImageHeight = _this$props5.maxImageHeight,
354
318
  errors = _this$props5.errors;
355
- var dialog = this.state.dialog;
319
+ var warning = this.state.warning;
320
+
321
+ var _ref = errors || {},
322
+ choicesErrors = _ref.choicesErrors,
323
+ orderError = _ref.orderError;
324
+
356
325
  var ordering = {
357
326
  choices: choices,
358
327
  response: !correctResponse || (0, _isEmpty["default"])(correctResponse) ? new Array(choices.length) : correctResponse,
359
328
  tiles: buildTiles(choices, correctResponse, this.instanceId)
360
329
  };
361
- var style = {
330
+ var vTilerStyle = {
362
331
  gridTemplateColumns: 'repeat(2, 1fr)',
363
332
  gridTemplateRows: "repeat(".concat(choices.length, ", 1fr)")
364
333
  };
@@ -366,17 +335,28 @@ var ChoiceEditor = /*#__PURE__*/function (_React$Component) {
366
335
  className: classes.choiceEditor
367
336
  }, /*#__PURE__*/_react["default"].createElement("div", {
368
337
  className: classes.vtiler,
369
- style: style
370
- }, ordering.tiles.map(function (c, index) {
338
+ style: {
339
+ gridTemplateColumns: 'repeat(2, 1fr)'
340
+ }
341
+ }, /*#__PURE__*/_react["default"].createElement(_renderUi.InputContainer, {
342
+ label: "Student ".concat(choicesLabel || 'Choices'),
343
+ className: classes.columnLabel
344
+ }), /*#__PURE__*/_react["default"].createElement(_renderUi.InputContainer, {
345
+ label: "Correct Order",
346
+ className: classes.columnLabel
347
+ })), /*#__PURE__*/_react["default"].createElement("div", {
348
+ className: classes.vtiler,
349
+ style: vTilerStyle
350
+ }, ordering.tiles.map(function (choice, index) {
371
351
  return /*#__PURE__*/_react["default"].createElement(_choiceTile["default"], {
372
- choice: c,
352
+ choice: choice,
373
353
  index: index,
374
354
  key: index,
375
355
  imageSupport: imageSupport,
376
- onDelete: _this2.onDelete.bind(_this2, c),
356
+ onDelete: _this2.onDelete.bind(_this2, choice),
377
357
  onChoiceChange: _this2.onChoiceChange,
378
358
  onDropChoice: function onDropChoice(source, index) {
379
- return _this2.onDropChoice(ordering, c, source, index);
359
+ return _this2.onDropChoice(ordering, choice, source, index);
380
360
  },
381
361
  disableImages: disableImages,
382
362
  toolbarOpts: toolbarOpts,
@@ -385,9 +365,11 @@ var ChoiceEditor = /*#__PURE__*/function (_React$Component) {
385
365
  spellCheck: spellCheck,
386
366
  maxImageWidth: maxImageWidth,
387
367
  maxImageHeight: maxImageHeight,
388
- error: errors && errors[c.id] ? errors[c.id] : null
368
+ error: (choicesErrors === null || choicesErrors === void 0 ? void 0 : choicesErrors[choice.id]) || orderError && ' ' || null
389
369
  });
390
- })), /*#__PURE__*/_react["default"].createElement("div", {
370
+ })), orderError && /*#__PURE__*/_react["default"].createElement("div", {
371
+ className: classes.errorText
372
+ }, orderError), /*#__PURE__*/_react["default"].createElement("div", {
391
373
  className: classes.controls
392
374
  }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
393
375
  onClick: this.shuffleChoices,
@@ -407,10 +389,17 @@ var ChoiceEditor = /*#__PURE__*/function (_React$Component) {
407
389
  root: classes.addButtonRoot,
408
390
  label: classes.addButtonLabel
409
391
  }
410
- }, "ADD ".concat(singularChoiceLabel).toUpperCase())), /*#__PURE__*/_react["default"].createElement(InfoDialog, {
411
- title: dialog.message,
412
- open: dialog.open,
413
- onOk: dialog.onOk
392
+ }, "ADD ".concat(singularChoiceLabel).toUpperCase())), /*#__PURE__*/_react["default"].createElement(_configUi.AlertDialog, {
393
+ open: warning.open,
394
+ title: "Warning",
395
+ text: warning.text,
396
+ onConfirm: function onConfirm() {
397
+ return _this2.setState({
398
+ warning: {
399
+ open: false
400
+ }
401
+ });
402
+ }
414
403
  }));
415
404
  }
416
405
  }]);
@@ -439,7 +428,7 @@ var styles = function styles(theme) {
439
428
  return {
440
429
  allToggle: {},
441
430
  choiceEditor: {
442
- marginTop: '10px'
431
+ marginTop: theme.spacing.unit
443
432
  },
444
433
  controls: {
445
434
  display: 'flex',
@@ -452,8 +441,8 @@ var styles = function styles(theme) {
452
441
  fill: theme.palette.primary[500]
453
442
  },
454
443
  addButtonRoot: {
455
- marginTop: '24px',
456
- paddingHorizontal: '12px'
444
+ marginTop: theme.spacing.unit * 3,
445
+ paddingHorizontal: theme.spacing.unit * 1.5
457
446
  },
458
447
  addButtonLabel: {
459
448
  transition: 'opacity 200ms linear',
@@ -465,6 +454,16 @@ var styles = function styles(theme) {
465
454
  gridAutoFlow: 'column',
466
455
  display: 'grid',
467
456
  gridGap: '10px'
457
+ },
458
+ columnLabel: {
459
+ width: '100%',
460
+ paddingTop: theme.spacing.unit * 3,
461
+ marginTop: theme.spacing.unit * 2
462
+ },
463
+ errorText: {
464
+ fontSize: theme.typography.fontSize - 2,
465
+ color: 'red',
466
+ paddingTop: theme.spacing.unit
468
467
  }
469
468
  };
470
469
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/choice-editor.jsx"],"names":["InfoDialog","title","open","onOk","propTypes","PropTypes","string","bool","func","findFreeChoiceSlot","choices","slot","ids","map","c","id","includes","log","updateResponseOrChoices","response","from","to","fromType","type","fromIndex","index","toType","placeAtIndex","updatedResponse","reduce","acc","item","movedItem","remainingItems","push","slice","updatedChoices","toIndex","buildTiles","instanceId","targets","r","respId","choice","find","undefined","draggable","editable","processedChoices","m","Object","assign","droppable","concat","ChoiceEditor","props","dialog","onChoiceChange","onChange","correctResponse","toolbarOpts","findIndex","splice","label","onDelete","choicesLabel","length","setState","message","filter","updatedCorrectResponse","v","addChoice","freeId","newChoice","newCorrectResponse","weight","shuffleChoices","placementArea","shuffled","shuffledCorrect","shuffledTwice","onDropChoice","ordering","target","source","tiles","t","classes","imageSupport","disableImages","singularChoiceLabel","pluralChoiceLabel","spellCheck","maxImageWidth","maxImageHeight","errors","state","Array","style","gridTemplateColumns","gridTemplateRows","choiceEditor","vtiler","bind","controls","root","addButtonRoot","addButtonLabel","toUpperCase","React","Component","object","isRequired","array","shape","add","styles","theme","allToggle","marginTop","display","alignItems","justifyContent","width","height","fill","palette","primary","paddingHorizontal","transition","opacity","gridAutoFlow","gridGap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,IAAMA,UAAU,GAAG,SAAbA,UAAa;AAAA,MAAGC,KAAH,QAAGA,KAAH;AAAA,MAAUC,IAAV,QAAUA,IAAV;AAAA,MAAgBC,IAAhB,QAAgBA,IAAhB;AAAA,sBACxB,gCAAC,kBAAD;AAAQ,IAAA,IAAI,EAAED;AAAd,kBACE,gCAAC,uBAAD,QAAcD,KAAd,CADF,eAEE,gCAAC,yBAAD,QACGE,IAAI,iBACH,gCAAC,kBAAD;AAAQ,IAAA,OAAO,EAAEA,IAAjB;AAAuB,IAAA,KAAK,EAAC;AAA7B,UAFJ,CAFF,CADwB;AAAA,CAAnB;;;AAaPH,UAAU,CAACI,SAAX,GAAuB;AACrBH,EAAAA,KAAK,EAAEI,sBAAUC,MADI;AAErBJ,EAAAA,IAAI,EAAEG,sBAAUE,IAFK;AAGrBJ,EAAAA,IAAI,EAAEE,sBAAUG;AAHK,CAAvB;;AAMA,SAASC,kBAAT,CAA4BC,OAA5B,EAAqC;AACnC,MAAIC,IAAI,GAAG,CAAX;AACA,M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;AAENX,MAAAA,OAAO,EAAE,MAFH;AAGNY,MAAAA,OAAO,EAAE;AAHH;AAzBiB,GAAZ;AAAA,CAAf;;eAgCe,wBAAWhB,MAAX,EAAmB/D,YAAnB,C","sourcesContent":["import ChoiceTile from './choice-tile';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport isEmpty from 'lodash/isEmpty';\nimport cloneDeep from 'lodash/cloneDeep';\nimport uniqueId from 'lodash/uniqueId';\nimport shuffle from 'lodash/shuffle';\nimport isEqual from 'lodash/isEqual';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport DialogActions from '@material-ui/core/DialogActions';\n\nexport const InfoDialog = ({ title, open, onOk }) => (\n <Dialog open={open}>\n <DialogTitle>{title}</DialogTitle>\n <DialogActions>\n {onOk && (\n <Button onClick={onOk} color=\"primary\">\n OK\n </Button>\n )}\n </DialogActions>\n </Dialog>\n);\n\nInfoDialog.propTypes = {\n title: PropTypes.string,\n open: PropTypes.bool,\n onOk: PropTypes.func,\n};\n\nfunction findFreeChoiceSlot(choices) {\n let slot = 1;\n const ids = choices.map((c) => c.id);\n while (ids.includes(`c${slot}`)) {\n slot++;\n }\n return slot;\n}\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-editor');\n\nfunction updateResponseOrChoices(response, choices, from, to) {\n const { type: fromType, index: fromIndex } = from;\n const { type: toType, index: placeAtIndex } = to;\n\n if (fromType === 'target' && toType === 'target') {\n const updatedResponse = cloneDeep(response) || [];\n\n const { movedItem, remainingItems } = updatedResponse.reduce(\n (acc, item, index) => {\n if (index === fromIndex) {\n acc.movedItem = item;\n } else {\n acc.remainingItems.push(item);\n }\n\n return acc;\n },\n { movedItem: null, remainingItems: [] },\n );\n\n return {\n response: [...remainingItems.slice(0, placeAtIndex), movedItem, ...remainingItems.slice(placeAtIndex)],\n choices,\n };\n }\n\n if (fromType === 'choice' && toType === 'choice') {\n const updatedChoices = cloneDeep(choices) || [];\n\n const { movedItem, remainingItems, toIndex } = updatedChoices.reduce(\n (acc, item, index) => {\n if (item.id === from.id) {\n acc.movedItem = item;\n } else {\n acc.remainingItems.push(item);\n }\n\n if (item.id === to.id) {\n acc.toIndex = index;\n }\n\n return acc;\n },\n { movedItem: null, remainingItems: [], toIndex: null },\n );\n\n return {\n response,\n choices: [...remainingItems.slice(0, toIndex), movedItem, ...remainingItems.slice(toIndex)],\n };\n }\n\n return { response, choices };\n}\n\nfunction buildTiles(choices, response, instanceId) {\n const targets = response.map((r, index) => {\n const respId = r && r.id;\n\n const choice = choices.find((c) => respId !== undefined && respId !== null && c.id === respId);\n\n return {\n type: 'target',\n instanceId,\n ...choice,\n draggable: true,\n index,\n editable: false,\n };\n });\n\n const processedChoices = choices.map((m) => {\n return Object.assign({}, m, {\n type: 'choice',\n droppable: false,\n draggable: true,\n instanceId,\n editable: true,\n });\n });\n\n return processedChoices.concat(targets);\n}\n\nclass ChoiceEditor extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n correctResponse: PropTypes.array.isRequired,\n choices: PropTypes.array.isRequired,\n onChange: PropTypes.func.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n disableImages: PropTypes.bool,\n toolbarOpts: PropTypes.object,\n placementArea: PropTypes.bool,\n singularChoiceLabel: PropTypes.string,\n pluralChoiceLabel: PropTypes.string,\n choicesLabel: PropTypes.string,\n errors: PropTypes.object,\n };\n\n state = {\n dialog: {\n open: false,\n },\n };\n\n constructor(props) {\n super(props);\n\n this.instanceId = uniqueId();\n\n this.onChoiceChange = (choice) => {\n const { choices, onChange, correctResponse, toolbarOpts } = this.props;\n const index = choices.findIndex((c) => c.id === choice.id);\n\n choices.splice(index, 1, { ...choices[index], label: choice.label });\n onChange(choices, correctResponse);\n };\n\n this.onDelete = (choice) => {\n const { choices, onChange, correctResponse, choicesLabel } = this.props;\n\n if (choices && choices.length === 3) {\n this.setState({\n dialog: {\n open: true,\n message: `There have to be at least 3 ${choicesLabel}.`,\n onOk: () => {\n this.setState({\n dialog: {\n open: false,\n },\n });\n },\n },\n });\n } else {\n const updatedChoices = choices.filter((c) => c.id !== choice.id);\n const updatedCorrectResponse = correctResponse.filter((v) => v.id !== choice.id);\n onChange(updatedChoices, updatedCorrectResponse);\n }\n };\n\n this.addChoice = () => {\n const { choices, correctResponse, onChange, choicesLabel } = this.props;\n\n if (choices && choices.length === 10) {\n this.setState({\n dialog: {\n open: true,\n message: `There can be maximum 10 ${choicesLabel}.`,\n onOk: () => {\n this.setState({\n dialog: {\n open: false,\n },\n });\n },\n },\n });\n } else {\n const freeId = findFreeChoiceSlot(choices);\n const id = `c${freeId}`;\n const newChoice = { id, label: '' };\n\n const newCorrectResponse = {\n id,\n /**\n * Note: weights are not configurable in the existing component\n * so we'll want do disable this in the controller and ignore it for now.\n */\n weight: 0,\n };\n\n const updatedChoices = choices.concat([newChoice]);\n const updatedCorrectResponse = correctResponse.concat([newCorrectResponse]);\n\n onChange(updatedChoices, updatedCorrectResponse);\n }\n };\n\n this.shuffleChoices = () => {\n const { onChange, choices, correctResponse, placementArea } = this.props;\n let shuffled = shuffle(choices);\n\n // if placementArea is disabled, make sure we don't shuffle choices in the correct order\n const shuffledCorrect =\n !placementArea &&\n isEqual(\n shuffled.map((item) => item.id),\n correctResponse.map((item) => item.id),\n );\n\n if (shuffledCorrect) {\n const shuffledTwice = shuffle(shuffled);\n\n onChange(shuffledTwice, correctResponse);\n } else {\n onChange(shuffled, correctResponse);\n }\n };\n\n this.onDropChoice = (ordering, target, source) => {\n const { onChange } = this.props;\n const from = ordering.tiles.find((t) => t.id === source.id && t.type === source.type);\n const to = target;\n log('[onDropChoice] ', from, to);\n const { response, choices } = updateResponseOrChoices(ordering.response, ordering.choices, from, to);\n\n onChange(choices, response);\n };\n }\n\n render() {\n const {\n classes,\n correctResponse,\n choices,\n imageSupport,\n disableImages,\n toolbarOpts,\n singularChoiceLabel,\n pluralChoiceLabel,\n choicesLabel,\n spellCheck,\n maxImageWidth,\n maxImageHeight,\n errors,\n } = this.props;\n const { dialog } = this.state;\n\n const ordering = {\n choices,\n response: !correctResponse || isEmpty(correctResponse) ? new Array(choices.length) : correctResponse,\n tiles: buildTiles(choices, correctResponse, this.instanceId),\n };\n\n const style = {\n gridTemplateColumns: 'repeat(2, 1fr)',\n gridTemplateRows: `repeat(${choices.length}, 1fr)`,\n };\n\n return (\n <div className={classes.choiceEditor}>\n <div className={classes.vtiler} style={style}>\n {ordering.tiles.map((c, index) => (\n <ChoiceTile\n choice={c}\n index={index}\n key={index}\n imageSupport={imageSupport}\n onDelete={this.onDelete.bind(this, c)}\n onChoiceChange={this.onChoiceChange}\n onDropChoice={(source, index) => this.onDropChoice(ordering, c, source, index)}\n disableImages={disableImages}\n toolbarOpts={toolbarOpts}\n choices={choices}\n choicesLabel={choicesLabel}\n spellCheck={spellCheck}\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n error={errors && errors[c.id] ? errors[c.id] : null}\n />\n ))}\n </div>\n <div className={classes.controls}>\n <Button\n onClick={this.shuffleChoices}\n size=\"small\"\n variant=\"contained\"\n color=\"default\"\n classes={{\n root: classes.addButtonRoot,\n label: classes.addButtonLabel,\n }}\n >\n {`SHUFFLE ${pluralChoiceLabel}`.toUpperCase()}\n </Button>\n <Button\n onClick={this.addChoice}\n size=\"small\"\n variant=\"contained\"\n color=\"default\"\n classes={{\n root: classes.addButtonRoot,\n label: classes.addButtonLabel,\n }}\n >\n {`ADD ${singularChoiceLabel}`.toUpperCase()}\n </Button>\n </div>\n <InfoDialog title={dialog.message} open={dialog.open} onOk={dialog.onOk} />\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n allToggle: {},\n choiceEditor: {\n marginTop: '10px',\n },\n controls: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n root: {\n width: '30px',\n height: '30px',\n fill: theme.palette.primary[500],\n },\n addButtonRoot: {\n marginTop: '24px',\n paddingHorizontal: '12px',\n },\n addButtonLabel: {\n transition: 'opacity 200ms linear',\n '&:hover': {\n opacity: 0.3,\n },\n },\n vtiler: {\n gridAutoFlow: 'column',\n display: 'grid',\n gridGap: '10px',\n },\n});\n\nexport default withStyles(styles)(ChoiceEditor);\n"],"file":"choice-editor.js"}
1
+ {"version":3,"sources":["../src/choice-editor.jsx"],"names":["findFreeChoiceSlot","choices","slot","ids","map","c","id","includes","log","updateResponseOrChoices","response","from","to","fromType","type","fromIndex","index","toType","placeAtIndex","updatedResponse","reduce","acc","item","movedItem","remainingItems","push","slice","updatedChoices","toIndex","buildTiles","instanceId","targets","r","respId","choice","find","undefined","draggable","editable","processedChoices","m","Object","assign","droppable","concat","ChoiceEditor","props","warning","open","onChoiceChange","onChange","correctResponse","findIndex","splice","label","onDelete","choicesLabel","length","setState","text","filter","updatedCorrectResponse","v","addChoice","freeId","newChoice","newCorrectResponse","weight","shuffleChoices","placementArea","shuffled","shuffledCorrect","shuffledTwice","onDropChoice","ordering","target","source","tiles","t","classes","imageSupport","disableImages","toolbarOpts","singularChoiceLabel","pluralChoiceLabel","spellCheck","maxImageWidth","maxImageHeight","errors","state","choicesErrors","orderError","Array","vTilerStyle","gridTemplateColumns","gridTemplateRows","choiceEditor","vtiler","columnLabel","bind","errorText","controls","root","addButtonRoot","addButtonLabel","toUpperCase","React","Component","PropTypes","object","isRequired","array","func","shape","add","bool","string","styles","theme","allToggle","marginTop","spacing","unit","display","alignItems","justifyContent","width","height","fill","palette","primary","paddingHorizontal","transition","opacity","gridAutoFlow","gridGap","paddingTop","fontSize","typography","color"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,SAASA,kBAAT,CAA4BC,OAA5B,EAAqC;AACnC,MAAIC,IAA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A,IAAI,EAAE;AACJwB,MAAAA,KAAK,EAAE,MADH;AAEJC,MAAAA,MAAM,EAAE,MAFJ;AAGJC,MAAAA,IAAI,EAAEV,KAAK,CAACW,OAAN,CAAcC,OAAd,CAAsB,GAAtB;AAHF,KAVmB;AAezB3B,IAAAA,aAAa,EAAE;AACbiB,MAAAA,SAAS,EAAEF,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CADnB;AAEbS,MAAAA,iBAAiB,EAAEb,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB;AAF3B,KAfU;AAmBzBlB,IAAAA,cAAc,EAAE;AACd4B,MAAAA,UAAU,EAAE,sBADE;AAEd,iBAAW;AACTC,QAAAA,OAAO,EAAE;AADA;AAFG,KAnBS;AAyBzBpC,IAAAA,MAAM,EAAE;AACNqC,MAAAA,YAAY,EAAE,QADR;AAENX,MAAAA,OAAO,EAAE,MAFH;AAGNY,MAAAA,OAAO,EAAE;AAHH,KAzBiB;AA8BzBrC,IAAAA,WAAW,EAAE;AACX4B,MAAAA,KAAK,EAAE,MADI;AAEXU,MAAAA,UAAU,EAAElB,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CAFtB;AAGXF,MAAAA,SAAS,EAAEF,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB;AAHrB,KA9BY;AAmCzBtB,IAAAA,SAAS,EAAE;AACTqC,MAAAA,QAAQ,EAAEnB,KAAK,CAACoB,UAAN,CAAiBD,QAAjB,GAA4B,CAD7B;AAETE,MAAAA,KAAK,EAAE,KAFE;AAGTH,MAAAA,UAAU,EAAElB,KAAK,CAACG,OAAN,CAAcC;AAHjB;AAnCc,GAAZ;AAAA,CAAf;;eA0Ce,wBAAWL,MAAX,EAAmBxE,YAAnB,C","sourcesContent":["import ChoiceTile from './choice-tile';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport isEmpty from 'lodash/isEmpty';\nimport cloneDeep from 'lodash/cloneDeep';\nimport uniqueId from 'lodash/uniqueId';\nimport shuffle from 'lodash/shuffle';\nimport isEqual from 'lodash/isEqual';\nimport Button from '@material-ui/core/Button';\nimport { InputContainer } from '@pie-lib/render-ui';\nimport { AlertDialog } from '@pie-lib/config-ui';\n\nfunction findFreeChoiceSlot(choices) {\n let slot = 1;\n const ids = choices.map((c) => c.id);\n\n while (ids.includes(`c${slot}`)) {\n slot++;\n }\n\n return slot;\n}\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-editor');\n\nfunction updateResponseOrChoices(response, choices, from, to) {\n const { type: fromType, index: fromIndex } = from;\n const { type: toType, index: placeAtIndex } = to;\n\n if (fromType === 'target' && toType === 'target') {\n const updatedResponse = cloneDeep(response) || [];\n\n const { movedItem, remainingItems } = updatedResponse.reduce(\n (acc, item, index) => {\n if (index === fromIndex) {\n acc.movedItem = item;\n } else {\n acc.remainingItems.push(item);\n }\n\n return acc;\n },\n { movedItem: null, remainingItems: [] },\n );\n\n return {\n response: [...remainingItems.slice(0, placeAtIndex), movedItem, ...remainingItems.slice(placeAtIndex)],\n choices,\n };\n }\n\n if (fromType === 'choice' && toType === 'choice') {\n const updatedChoices = cloneDeep(choices) || [];\n\n const { movedItem, remainingItems, toIndex } = updatedChoices.reduce(\n (acc, item, index) => {\n if (item.id === from.id) {\n acc.movedItem = item;\n } else {\n acc.remainingItems.push(item);\n }\n\n if (item.id === to.id) {\n acc.toIndex = index;\n }\n\n return acc;\n },\n { movedItem: null, remainingItems: [], toIndex: null },\n );\n\n return {\n response,\n choices: [...remainingItems.slice(0, toIndex), movedItem, ...remainingItems.slice(toIndex)],\n };\n }\n\n return { response, choices };\n}\n\nfunction buildTiles(choices, response, instanceId) {\n const targets = response.map((r, index) => {\n const respId = r && r.id;\n const choice = choices.find((c) => respId !== undefined && respId !== null && c.id === respId);\n\n return {\n type: 'target',\n instanceId,\n ...choice,\n draggable: true,\n index,\n editable: false,\n };\n });\n\n const processedChoices = choices.map((m) => {\n return Object.assign({}, m, {\n type: 'choice',\n droppable: false,\n draggable: true,\n instanceId,\n editable: true,\n });\n });\n\n return processedChoices.concat(targets);\n}\n\nclass ChoiceEditor extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n correctResponse: PropTypes.array.isRequired,\n choices: PropTypes.array.isRequired,\n onChange: PropTypes.func.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n disableImages: PropTypes.bool,\n toolbarOpts: PropTypes.object,\n placementArea: PropTypes.bool,\n singularChoiceLabel: PropTypes.string,\n pluralChoiceLabel: PropTypes.string,\n choicesLabel: PropTypes.string,\n errors: PropTypes.object,\n };\n\n state = { warning: { open: false } };\n\n constructor(props) {\n super(props);\n\n this.instanceId = uniqueId();\n\n this.onChoiceChange = (choice) => {\n const { choices, onChange, correctResponse } = this.props;\n const index = choices.findIndex((c) => c.id === choice.id);\n\n choices.splice(index, 1, { ...choices[index], label: choice.label });\n onChange(choices, correctResponse);\n };\n\n this.onDelete = (choice) => {\n const { choices, onChange, correctResponse, choicesLabel } = this.props;\n\n if (choices && choices.length === 3) {\n this.setState({\n warning: {\n open: true,\n text: `There have to be at least 3 ${choicesLabel}.`,\n },\n });\n } else {\n const updatedChoices = choices.filter((c) => c.id !== choice.id);\n const updatedCorrectResponse = correctResponse.filter((v) => v.id !== choice.id);\n\n onChange(updatedChoices, updatedCorrectResponse);\n }\n };\n\n this.addChoice = () => {\n const { choices, correctResponse, onChange, choicesLabel } = this.props;\n\n if (choices && choices.length === 10) {\n this.setState({\n warning: {\n open: true,\n text: `There can be maximum 10 ${choicesLabel}.`,\n },\n });\n } else {\n const freeId = findFreeChoiceSlot(choices);\n const id = `c${freeId}`;\n const newChoice = { id, label: '' };\n\n const newCorrectResponse = {\n id,\n /**\n * Note: weights are not configurable in the existing component\n * so we'll want do disable this in the controller and ignore it for now.\n */\n weight: 0,\n };\n\n const updatedChoices = choices.concat([newChoice]);\n const updatedCorrectResponse = correctResponse.concat([newCorrectResponse]);\n\n onChange(updatedChoices, updatedCorrectResponse);\n }\n };\n\n this.shuffleChoices = () => {\n const { onChange, choices, correctResponse, placementArea } = this.props;\n let shuffled = shuffle(choices);\n\n // if placementArea is disabled, make sure we don't shuffle choices in the correct order\n const shuffledCorrect =\n !placementArea &&\n isEqual(\n shuffled.map((item) => item.id),\n correctResponse.map((item) => item.id),\n );\n\n if (shuffledCorrect) {\n const shuffledTwice = shuffle(shuffled);\n\n onChange(shuffledTwice, correctResponse);\n } else {\n onChange(shuffled, correctResponse);\n }\n };\n\n this.onDropChoice = (ordering, target, source) => {\n const { onChange } = this.props;\n const from = ordering.tiles.find((t) => t.id === source.id && t.type === source.type);\n const to = target;\n log('[onDropChoice] ', from, to);\n const { response, choices } = updateResponseOrChoices(ordering.response, ordering.choices, from, to);\n\n onChange(choices, response);\n };\n }\n\n render() {\n const {\n classes,\n correctResponse,\n choices,\n imageSupport,\n disableImages,\n toolbarOpts,\n singularChoiceLabel,\n pluralChoiceLabel,\n choicesLabel,\n spellCheck,\n maxImageWidth,\n maxImageHeight,\n errors,\n } = this.props;\n const { warning } = this.state;\n const { choicesErrors, orderError } = errors || {};\n\n const ordering = {\n choices,\n response: !correctResponse || isEmpty(correctResponse) ? new Array(choices.length) : correctResponse,\n tiles: buildTiles(choices, correctResponse, this.instanceId),\n };\n\n const vTilerStyle = {\n gridTemplateColumns: 'repeat(2, 1fr)',\n gridTemplateRows: `repeat(${choices.length}, 1fr)`,\n };\n\n return (\n <div className={classes.choiceEditor}>\n <div className={classes.vtiler} style={{ gridTemplateColumns: 'repeat(2, 1fr)' }}>\n <InputContainer label={`Student ${choicesLabel || 'Choices'}`} className={classes.columnLabel} />\n <InputContainer label=\"Correct Order\" className={classes.columnLabel} />\n </div>\n\n <div className={classes.vtiler} style={vTilerStyle}>\n {ordering.tiles.map((choice, index) => (\n <ChoiceTile\n choice={choice}\n index={index}\n key={index}\n imageSupport={imageSupport}\n onDelete={this.onDelete.bind(this, choice)}\n onChoiceChange={this.onChoiceChange}\n onDropChoice={(source, index) => this.onDropChoice(ordering, choice, source, index)}\n disableImages={disableImages}\n toolbarOpts={toolbarOpts}\n choices={choices}\n choicesLabel={choicesLabel}\n spellCheck={spellCheck}\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n error={choicesErrors?.[choice.id] || (orderError && ' ') || null}\n />\n ))}\n </div>\n\n {orderError && <div className={classes.errorText}>{orderError}</div>}\n\n <div className={classes.controls}>\n <Button\n onClick={this.shuffleChoices}\n size=\"small\"\n variant=\"contained\"\n color=\"default\"\n classes={{ root: classes.addButtonRoot, label: classes.addButtonLabel }}\n >\n {`SHUFFLE ${pluralChoiceLabel}`.toUpperCase()}\n </Button>\n\n <Button\n onClick={this.addChoice}\n size=\"small\"\n variant=\"contained\"\n color=\"default\"\n classes={{ root: classes.addButtonRoot, label: classes.addButtonLabel }}\n >\n {`ADD ${singularChoiceLabel}`.toUpperCase()}\n </Button>\n </div>\n\n <AlertDialog\n open={warning.open}\n title=\"Warning\"\n text={warning.text}\n onConfirm={() => this.setState({ warning: { open: false } })}\n />\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n allToggle: {},\n choiceEditor: {\n marginTop: theme.spacing.unit,\n },\n controls: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n root: {\n width: '30px',\n height: '30px',\n fill: theme.palette.primary[500],\n },\n addButtonRoot: {\n marginTop: theme.spacing.unit * 3,\n paddingHorizontal: theme.spacing.unit * 1.5,\n },\n addButtonLabel: {\n transition: 'opacity 200ms linear',\n '&:hover': {\n opacity: 0.3,\n },\n },\n vtiler: {\n gridAutoFlow: 'column',\n display: 'grid',\n gridGap: '10px',\n },\n columnLabel: {\n width: '100%',\n paddingTop: theme.spacing.unit * 3,\n marginTop: theme.spacing.unit * 2,\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: 'red',\n paddingTop: theme.spacing.unit,\n },\n});\n\nexport default withStyles(styles)(ChoiceEditor);\n"],"file":"choice-editor.js"}
@@ -45,8 +45,6 @@ var _debug = _interopRequireDefault(require("debug"));
45
45
 
46
46
  var _styles = require("@material-ui/core/styles");
47
47
 
48
- var _choiceEditor = require("./choice-editor");
49
-
50
48
  var _renderUi = require("@pie-lib/render-ui");
51
49
 
52
50
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -74,11 +72,6 @@ var ChoiceTile = /*#__PURE__*/function (_React$Component) {
74
72
  }
75
73
 
76
74
  _this = _super.call.apply(_super, [this].concat(args));
77
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
78
- dialog: {
79
- open: false
80
- }
81
- });
82
75
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onLabelChange", function (label) {
83
76
  var _this$props = _this.props,
84
77
  choice = _this$props.choice,
@@ -96,7 +89,6 @@ var ChoiceTile = /*#__PURE__*/function (_React$Component) {
96
89
  _this$props2$choice = _this$props2.choice,
97
90
  label = _this$props2$choice.label,
98
91
  editable = _this$props2$choice.editable,
99
- index = _this$props2$choice.index,
100
92
  isDragging = _this$props2.isDragging,
101
93
  connectDragSource = _this$props2.connectDragSource,
102
94
  connectDropTarget = _this$props2.connectDropTarget,
@@ -109,7 +101,6 @@ var ChoiceTile = /*#__PURE__*/function (_React$Component) {
109
101
  maxImageWidth = _this$props2.maxImageWidth,
110
102
  maxImageHeight = _this$props2.maxImageHeight,
111
103
  error = _this$props2.error;
112
- var dialog = this.state.dialog;
113
104
  var dragSourceOpts = {}; //dropEffect: moveOnDrag ? 'move' : 'copy'};
114
105
 
115
106
  var choicePlugins = {
@@ -134,18 +125,16 @@ var ChoiceTile = /*#__PURE__*/function (_React$Component) {
134
125
  opacity: opacity,
135
126
  width: '100%'
136
127
  }
137
- }, /*#__PURE__*/_react["default"].createElement(_CardActions["default"], null, /*#__PURE__*/_react["default"].createElement("span", {
138
- className: (0, _classnames["default"])(classes.dragHandle)
139
- }, /*#__PURE__*/_react["default"].createElement(_DragHandle["default"], {
140
- className: classes.actions
141
- }))), /*#__PURE__*/_react["default"].createElement("div", {
128
+ }, /*#__PURE__*/_react["default"].createElement("div", {
142
129
  style: {
143
130
  width: '100%',
144
131
  display: 'flex'
145
132
  }
146
- }, !editable && index === 0 ? /*#__PURE__*/_react["default"].createElement("div", {
147
- className: classes.correctOrder
148
- }, "Correct Order") : null, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
133
+ }, /*#__PURE__*/_react["default"].createElement(_CardActions["default"], null, /*#__PURE__*/_react["default"].createElement("span", {
134
+ className: (0, _classnames["default"])(classes.dragHandle)
135
+ }, /*#__PURE__*/_react["default"].createElement(_DragHandle["default"], {
136
+ className: classes.actions
137
+ }))), /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
149
138
  disabled: !editable,
150
139
  className: (0, _classnames["default"])(classes.prompt, !editable && classes.targetPrompt),
151
140
  placeholder: "Enter a choice",
@@ -164,9 +153,7 @@ var ChoiceTile = /*#__PURE__*/function (_React$Component) {
164
153
  language: 'special'
165
154
  }],
166
155
  error: editable && error
167
- }), editable && error && /*#__PURE__*/_react["default"].createElement("div", {
168
- className: classes.errorText
169
- }, error), editable && /*#__PURE__*/_react["default"].createElement("div", {
156
+ }), editable && /*#__PURE__*/_react["default"].createElement("div", {
170
157
  className: classes.controls
171
158
  }, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
172
159
  color: "default",
@@ -175,11 +162,9 @@ var ChoiceTile = /*#__PURE__*/function (_React$Component) {
175
162
  classes: {
176
163
  root: classes.removeCircle
177
164
  }
178
- })))), /*#__PURE__*/_react["default"].createElement(_choiceEditor.InfoDialog, {
179
- title: dialog.message,
180
- open: dialog.open,
181
- onOk: dialog.onOk
182
- }));
165
+ })))), editable && error && /*#__PURE__*/_react["default"].createElement("div", {
166
+ className: classes.errorText
167
+ }, error));
183
168
 
184
169
  return connectDragSource(connectDropTarget( /*#__PURE__*/_react["default"].createElement("div", null, markup)), dragSourceOpts);
185
170
  }
@@ -222,10 +207,9 @@ var Styled = (0, _styles.withStyles)(function (theme) {
222
207
  choiceTile: {
223
208
  cursor: 'move',
224
209
  backgroundColor: 'white',
225
- marginTop: '5px',
226
- marginBottom: '5px',
210
+ margin: "".concat(theme.spacing.unit, "px 0"),
227
211
  display: 'flex',
228
- alignItems: 'center'
212
+ flexDirection: 'column'
229
213
  },
230
214
  controls: {
231
215
  display: 'flex',
@@ -233,7 +217,8 @@ var Styled = (0, _styles.withStyles)(function (theme) {
233
217
  },
234
218
  prompt: {
235
219
  width: '80%',
236
- border: 'none'
220
+ border: 'none',
221
+ borderRadius: '4px'
237
222
  },
238
223
  targetPrompt: {
239
224
  backgroundColor: '#D7D7D7'
@@ -242,13 +227,15 @@ var Styled = (0, _styles.withStyles)(function (theme) {
242
227
  color: '#B1B1B1'
243
228
  },
244
229
  errorText: {
245
- fontSize: '12px',
246
- color: 'red'
230
+ fontSize: theme.typography.fontSize - 2,
231
+ color: 'red',
232
+ marginLeft: theme.spacing.unit * 5,
233
+ marginTop: theme.spacing.unit
247
234
  },
248
235
  correctOrder: {
249
236
  position: 'absolute',
250
237
  top: 0,
251
- fontSize: '12px',
238
+ fontSize: theme.typography.fontSize - 2,
252
239
  color: _renderUi.color.disabled()
253
240
  }
254
241
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/choice-tile.jsx"],"names":["log","ChoiceTile","dialog","open","label","props","choice","onChoiceChange","editable","index","isDragging","connectDragSource","connectDropTarget","classes","onDelete","imageSupport","disableImages","spellCheck","toolbarOpts","maxImageWidth","maxImageHeight","error","state","dragSourceOpts","choicePlugins","image","disabled","audio","video","filteredDefaultPlugins","DEFAULT_PLUGINS","filter","p","opacity","markup","choiceTile","width","dragHandle","actions","display","correctOrder","prompt","targetPrompt","undefined","onLabelChange","language","errorText","controls","root","removeCircle","message","onOk","React","Component","PropTypes","func","isRequired","bool","id","any","string","isOver","object","type","empty","outcome","number","shape","add","choices","array","choicesLabel","Styled","theme","fill","palette","cursor","backgroundColor","marginTop","marginBottom","alignItems","justifyContent","border","color","fontSize","position","top","NAME","choiceSource","beginDrag","instanceId","StyledSource","connect","monitor","dragSource","choiceTarget","hover","drop","item","getItem","didDrop","onDropChoice","StyledSourceAndTarget","dropTarget"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,uDAAN,CAAZ;;IAEaC,U;;;;;;;;;;;;;;;8FA4BH;AACNC,MAAAA,MAAM,EAAE;AACNC,QAAAA,IAAI,EAAE;AADA;AADF,K;sGAMQ,UAACC,KAAD,EAAW;AACzB,wBAAmC,MAAKC,KAAxC;AAAA,UAAQC,MAAR,eAAQA,MAAR;AAAA,UAAgBC,cAAhB,eAAgBA,cAAhB;AAEAD,MAAAA,MAAM,CAACF,KAAP,GAAeA,KAAf;AACAG,MAAAA,cAAc,CAACD,MAAD,CAAd;AACD,K;;;;;;WAED,kBAAS;AACP,yBAcI,KAAKD,KAdT;AAAA,6CACEC,MADF;AAAA,UACYF,KADZ,uBACYA,KADZ;AAAA,UACmBI,QADnB,uBACmBA,QADnB;AAAA,UAC6BC,KAD7B,uBAC6BA,KAD7B;AAAA,UAEEC,UAFF,gBAEEA,UAFF;AAAA,UAGEC,iBAHF,gBAGEA,iBAHF;AAAA,UAIEC,iBAJF,gBAIEA,iBAJF;AAAA,UAKEC,OALF,gBAKEA,OALF;AAAA,UAMEC,QANF,gBAMEA,QANF;AAAA,UAOEC,YAPF,gBAOEA,YAPF;AAAA,UAQEC,aARF,gBAQEA,aARF;AAAA,UASEC,UATF,gBASEA,UATF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vB;AAAA,CAA/B,EAG1B8B,YAH0B,CAA9B;eAKeW,qB","sourcesContent":["import EditableHtml, { DEFAULT_PLUGINS } from '@pie-lib/editable-html';\nimport CardActions from '@material-ui/core/CardActions';\nimport DragHandle from '@material-ui/icons/DragHandle';\n\nimport { DragSource, DropTarget } from 'react-dnd';\nimport classNames from 'classnames';\n\nimport IconButton from '@material-ui/core/IconButton';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport RemoveCircle from '@material-ui/icons/RemoveCircle';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport { InfoDialog } from './choice-editor';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-tile');\n\nexport class ChoiceTile extends React.Component {\n static propTypes = {\n connectDragSource: PropTypes.func.isRequired,\n connectDropTarget: PropTypes.func.isRequired,\n isDragging: PropTypes.bool.isRequired,\n id: PropTypes.any,\n label: PropTypes.string,\n isOver: PropTypes.bool,\n classes: PropTypes.object.isRequired,\n type: PropTypes.string,\n empty: PropTypes.bool,\n disabled: PropTypes.bool,\n outcome: PropTypes.object,\n index: PropTypes.number,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n choice: PropTypes.object,\n choices: PropTypes.array.isRequired,\n onChoiceChange: PropTypes.func.isRequired,\n onDelete: PropTypes.func.isRequired,\n disableImages: PropTypes.bool,\n toolbarOpts: PropTypes.object,\n choicesLabel: PropTypes.string,\n error: PropTypes.string,\n };\n\n state = {\n dialog: {\n open: false,\n },\n };\n\n onLabelChange = (label) => {\n const { choice, onChoiceChange } = this.props;\n\n choice.label = label;\n onChoiceChange(choice);\n };\n\n render() {\n const {\n choice: { label, editable, index },\n isDragging,\n connectDragSource,\n connectDropTarget,\n classes,\n onDelete,\n imageSupport,\n disableImages,\n spellCheck,\n toolbarOpts,\n maxImageWidth,\n maxImageHeight,\n error,\n } = this.props;\n const { dialog } = this.state;\n\n const dragSourceOpts = {}; //dropEffect: moveOnDrag ? 'move' : 'copy'};\n\n const choicePlugins = {\n image: {\n disabled: disableImages,\n },\n audio: { disabled: true },\n video: { disabled: true },\n };\n const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(\n (p) => p !== 'bulleted-list' && p !== 'numbered-list',\n );\n\n const opacity = isDragging ? 0 : 1;\n const markup = (\n <div className={classes.choiceTile} style={{ opacity: opacity, width: '100%' }}>\n <CardActions>\n <span className={classNames(classes.dragHandle)}>\n <DragHandle className={classes.actions} />\n </span>\n </CardActions>\n <div style={{ width: '100%', display: 'flex' }}>\n {!editable && index === 0 ? <div className={classes.correctOrder}>Correct Order</div> : null}\n <EditableHtml\n disabled={!editable}\n className={classNames(classes.prompt, !editable && classes.targetPrompt)}\n placeholder=\"Enter a choice\"\n markup={label}\n imageSupport={imageSupport || undefined}\n onChange={this.onLabelChange}\n pluginProps={choicePlugins}\n toolbarOpts={toolbarOpts}\n activePlugins={filteredDefaultPlugins}\n spellCheck={spellCheck}\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n error={editable && error}\n />\n {editable && error && <div className={classes.errorText}>{error}</div>}\n {editable && (\n <div className={classes.controls}>\n <IconButton color=\"default\" onClick={onDelete}>\n <RemoveCircle\n classes={{\n root: classes.removeCircle,\n }}\n />\n </IconButton>\n </div>\n )}\n </div>\n <InfoDialog title={dialog.message} open={dialog.open} onOk={dialog.onOk} />\n </div>\n );\n\n return connectDragSource(connectDropTarget(<div>{markup}</div>), dragSourceOpts);\n }\n}\n\nconst Styled = withStyles((theme) => ({\n removeCircle: {\n fill: theme.palette.error[500],\n },\n choiceTile: {\n cursor: 'move',\n backgroundColor: 'white',\n marginTop: '5px',\n marginBottom: '5px',\n display: 'flex',\n alignItems: 'center',\n },\n controls: {\n display: 'flex',\n justifyContent: 'flex-end',\n },\n prompt: {\n width: '80%',\n border: 'none',\n },\n targetPrompt: {\n backgroundColor: '#D7D7D7',\n },\n actions: {\n color: '#B1B1B1',\n },\n errorText: {\n fontSize: '12px',\n color: 'red',\n },\n correctOrder: {\n position: 'absolute',\n top: 0,\n fontSize: '12px',\n color: color.disabled(),\n },\n}))(ChoiceTile);\n\nconst NAME = 'choice-config';\n\nconst choiceSource = {\n beginDrag(props) {\n return {\n id: props.choice.id,\n index: props.index,\n type: props.choice.type,\n instanceId: props.choice.instanceId,\n };\n },\n};\n\nconst StyledSource = DragSource(NAME, choiceSource, (connect, monitor) => ({\n connectDragSource: connect.dragSource(),\n isDragging: monitor.isDragging(),\n}))(Styled);\n\nconst choiceTarget = {\n hover() {\n log('[hover]');\n },\n drop(props, monitor) {\n const item = monitor.getItem();\n log('[drop] item: ', item, 'didDrop?', monitor.didDrop());\n\n props.onDropChoice(item, props.index);\n },\n};\n\nconst StyledSourceAndTarget = DropTarget(NAME, choiceTarget, (connect, monitor) => ({\n connectDropTarget: connect.dropTarget(),\n isOver: monitor.isOver(),\n}))(StyledSource);\n\nexport default StyledSourceAndTarget;\n"],"file":"choice-tile.js"}
1
+ {"version":3,"sources":["../src/choice-tile.jsx"],"names":["log","ChoiceTile","label","props","choice","onChoiceChange","editable","isDragging","connectDragSource","connectDropTarget","classes","onDelete","imageSupport","disableImages","spellCheck","toolbarOpts","maxImageWidth","maxImageHeight","error","dragSourceOpts","choicePlugins","image","disabled","audio","video","filteredDefaultPlugins","DEFAULT_PLUGINS","filter","p","opacity","markup","choiceTile","width","display","dragHandle","actions","prompt","targetPrompt","undefined","onLabelChange","language","controls","root","removeCircle","errorText","React","Component","PropTypes","func","isRequired","bool","id","any","string","isOver","object","type","empty","outcome","index","number","shape","add","choices","array","choicesLabel","Styled","theme","fill","palette","cursor","backgroundColor","margin","spacing","unit","flexDirection","justifyContent","border","borderRadius","color","fontSize","typography","marginLeft","marginTop","correctOrder","position","top","NAME","choiceSource","beginDrag","instanceId","StyledSource","connect","monitor","dragSource","choiceTarget","hover","drop","item","getItem","didDrop","onDrop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AR,EADsD;AAEzEvF,IAAAA,UAAU,EAAEsF,OAAO,CAACtF,UAAR;AAF6D,GAAvB;AAAA,CAA/B,EAGjB2D,MAHiB,CAArB;AAKA,IAAM6B,YAAY,GAAG;AACnBC,EAAAA,KADmB,mBACX;AACNhG,IAAAA,GAAG,CAAC,SAAD,CAAH;AACD,GAHkB;AAInBiG,EAAAA,IAJmB,gBAId9F,KAJc,EAIP0F,OAJO,EAIE;AACnB,QAAMK,IAAI,GAAGL,OAAO,CAACM,OAAR,EAAb;AACAnG,IAAAA,GAAG,CAAC,eAAD,EAAkBkG,IAAlB,EAAwB,UAAxB,EAAoCL,OAAO,CAACO,OAAR,EAApC,CAAH;AAEAjG,IAAAA,KAAK,CAACkG,YAAN,CAAmBH,IAAnB,EAAyB/F,KAAK,CAACwD,KAA/B;AACD;AATkB,CAArB;AAYA,IAAM2C,qBAAqB,GAAG,0BAAWf,IAAX,EAAiBQ,YAAjB,EAA+B,UAACH,OAAD,EAAUC,OAAV;AAAA,SAAuB;AAClFpF,IAAAA,iBAAiB,EAAEmF,OAAO,CAACW,UAAR,EAD+D;AAElFjD,IAAAA,MAAM,EAAEuC,OAAO,CAACvC,MAAR;AAF0E,GAAvB;AAAA,CAA/B,EAG1BqC,YAH0B,CAA9B;eAKeW,qB","sourcesContent":["import EditableHtml, { DEFAULT_PLUGINS } from '@pie-lib/editable-html';\nimport CardActions from '@material-ui/core/CardActions';\nimport DragHandle from '@material-ui/icons/DragHandle';\n\nimport { DragSource, DropTarget } from 'react-dnd';\nimport classNames from 'classnames';\n\nimport IconButton from '@material-ui/core/IconButton';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport RemoveCircle from '@material-ui/icons/RemoveCircle';\nimport debug from 'debug';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('@pie-element:placement-ordering:configure:choice-tile');\n\nexport class ChoiceTile extends React.Component {\n static propTypes = {\n connectDragSource: PropTypes.func.isRequired,\n connectDropTarget: PropTypes.func.isRequired,\n isDragging: PropTypes.bool.isRequired,\n id: PropTypes.any,\n label: PropTypes.string,\n isOver: PropTypes.bool,\n classes: PropTypes.object.isRequired,\n type: PropTypes.string,\n empty: PropTypes.bool,\n disabled: PropTypes.bool,\n outcome: PropTypes.object,\n index: PropTypes.number,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n choice: PropTypes.object,\n choices: PropTypes.array.isRequired,\n onChoiceChange: PropTypes.func.isRequired,\n onDelete: PropTypes.func.isRequired,\n disableImages: PropTypes.bool,\n toolbarOpts: PropTypes.object,\n choicesLabel: PropTypes.string,\n error: PropTypes.string,\n };\n\n onLabelChange = (label) => {\n const { choice, onChoiceChange } = this.props;\n\n choice.label = label;\n onChoiceChange(choice);\n };\n\n render() {\n const {\n choice: { label, editable },\n isDragging,\n connectDragSource,\n connectDropTarget,\n classes,\n onDelete,\n imageSupport,\n disableImages,\n spellCheck,\n toolbarOpts,\n maxImageWidth,\n maxImageHeight,\n error,\n } = this.props;\n\n const dragSourceOpts = {}; //dropEffect: moveOnDrag ? 'move' : 'copy'};\n\n const choicePlugins = {\n image: { disabled: disableImages },\n audio: { disabled: true },\n video: { disabled: true },\n };\n const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(\n (p) => p !== 'bulleted-list' && p !== 'numbered-list',\n );\n\n const opacity = isDragging ? 0 : 1;\n const markup = (\n <div className={classes.choiceTile} style={{ opacity: opacity, width: '100%' }}>\n <div style={{ width: '100%', display: 'flex' }}>\n <CardActions>\n <span className={classNames(classes.dragHandle)}>\n <DragHandle className={classes.actions} />\n </span>\n </CardActions>\n\n <EditableHtml\n disabled={!editable}\n className={classNames(classes.prompt, !editable && classes.targetPrompt)}\n placeholder=\"Enter a choice\"\n markup={label}\n imageSupport={imageSupport || undefined}\n onChange={this.onLabelChange}\n pluginProps={choicePlugins}\n toolbarOpts={toolbarOpts}\n activePlugins={filteredDefaultPlugins}\n spellCheck={spellCheck}\n maxImageWidth={maxImageWidth}\n maxImageHeight={maxImageHeight}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n error={editable && error}\n />\n\n {editable && (\n <div className={classes.controls}>\n <IconButton color=\"default\" onClick={onDelete}>\n <RemoveCircle classes={{ root: classes.removeCircle }} />\n </IconButton>\n </div>\n )}\n </div>\n\n {editable && error && <div className={classes.errorText}>{error}</div>}\n </div>\n );\n\n return connectDragSource(connectDropTarget(<div>{markup}</div>), dragSourceOpts);\n }\n}\n\nconst Styled = withStyles((theme) => ({\n removeCircle: {\n fill: theme.palette.error[500],\n },\n choiceTile: {\n cursor: 'move',\n backgroundColor: 'white',\n margin: `${theme.spacing.unit}px 0`,\n display: 'flex',\n flexDirection: 'column',\n },\n controls: {\n display: 'flex',\n justifyContent: 'flex-end',\n },\n prompt: {\n width: '80%',\n border: 'none',\n borderRadius: '4px',\n },\n targetPrompt: {\n backgroundColor: '#D7D7D7',\n },\n actions: {\n color: '#B1B1B1',\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: 'red',\n marginLeft: theme.spacing.unit * 5,\n marginTop: theme.spacing.unit,\n },\n correctOrder: {\n position: 'absolute',\n top: 0,\n fontSize: theme.typography.fontSize - 2,\n color: color.disabled(),\n },\n}))(ChoiceTile);\n\nconst NAME = 'choice-config';\n\nconst choiceSource = {\n beginDrag(props) {\n return {\n id: props.choice.id,\n index: props.index,\n type: props.choice.type,\n instanceId: props.choice.instanceId,\n };\n },\n};\n\nconst StyledSource = DragSource(NAME, choiceSource, (connect, monitor) => ({\n connectDragSource: connect.dragSource(),\n isDragging: monitor.isDragging(),\n}))(Styled);\n\nconst choiceTarget = {\n hover() {\n log('[hover]');\n },\n drop(props, monitor) {\n const item = monitor.getItem();\n log('[drop] item: ', item, 'didDrop?', monitor.didDrop());\n\n props.onDropChoice(item, props.index);\n },\n};\n\nconst StyledSourceAndTarget = DropTarget(NAME, choiceTarget, (connect, monitor) => ({\n connectDropTarget: connect.dropTarget(),\n isOver: monitor.isOver(),\n}))(StyledSource);\n\nexport default StyledSourceAndTarget;\n"],"file":"choice-tile.js"}
@@ -77,6 +77,7 @@ var _default = {
77
77
  settings: false,
78
78
  label: 'Remove Tiles after placing'
79
79
  },
80
+ settingsPanelDisabled: false,
80
81
  scoringType: {
81
82
  settings: false,
82
83
  label: 'Scoring Type'
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/defaults.js"],"names":["model","choiceLabel","choices","correctResponse","enableImages","prompt","numberedGuides","orientation","partialScoring","placementArea","removeTilesAfterPlacing","choiceLabelEnabled","scoringType","targetLabel","rationaleEnabled","feedbackEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","configuration","settings","label","feedback","enabled","rationale","studentInstructions","spellCheck","teacherInstructions","maxImageWidth","choicesWithPlacementArea","choicesWithoutPlacementArea","maxImageHeight","withRubric"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;eAEe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,WAAW,EAAE,EADR;AAELC,IAAAA,OAAO,EAAE,EAFJ;AAGLC,IAAAA,eAAe,EAAE,EAHZ;AAILC,IAAAA,YAAY,EAAE,KAJT;AAKLC,IAAAA,MAAM,EAAE,qBALH;AAMLC,IAAAA,cAAc,EAAE,KANX;AAOLC,IAAAA,WAAW,EAAE,UAPR;AAQLC,IAAAA,cAAc,EAAE,IARX;AASLC,IAAAA,aAAa,EAAE,KATV;AAULC,IAAAA,uBAAuB,EAAE,IAVpB;AAWLC,IAAAA,kBAAkB,EAAE,IAXf;AAYLC,IAAAA,WAAW,EAAE,MAZR;AAaLC,IAAAA,WAAW,EAAE,EAbR;AAcLC,IAAAA,gBAAgB,EAAE,IAdb;AAeLC,IAAAA,eAAe,EAAE,IAfZ;AAgBLC,IAAAA,aAAa,EAAE,IAhBV;AAiBLC,IAAAA,0BAA0B,EAAE,IAjBvB;AAkBLC,IAAAA,0BAA0B,EAAE,IAlBvB;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AAQ,EAAE,KADC;AAEXC,MAAAA,KAAK,EAAE;AAFI,KA9CA;AAkDbI,IAAAA,mBAAmB,EAAE;AACnBL,MAAAA,QAAQ,EAAE,KADS;AAEnBC,MAAAA,KAAK,EAAE;AAFY,KAlDR;AAsDbT,IAAAA,WAAW,EAAE;AACXQ,MAAAA,QAAQ,EAAE,IADC;AAEXC,MAAAA,KAAK,EAAE;AAFI,KAtDA;AA0DbK,IAAAA,UAAU,EAAE;AACVL,MAAAA,KAAK,EAAE,YADG;AAEVD,MAAAA,QAAQ,EAAE,KAFA;AAGVG,MAAAA,OAAO,EAAE;AAHC,KA1DC;AA+DbI,IAAAA,mBAAmB,EAAE;AACnBP,MAAAA,QAAQ,EAAE,IADS;AAEnBC,MAAAA,KAAK,EAAE;AAFY,KA/DR;AAmEbO,IAAAA,aAAa,EAAE;AACbD,MAAAA,mBAAmB,EAAE,GADR;AAEbvB,MAAAA,MAAM,EAAE,GAFK;AAGboB,MAAAA,SAAS,EAAE,GAHE;AAIbK,MAAAA,wBAAwB,EAAE,GAJb;AAKbC,MAAAA,2BAA2B,EAAE;AALhB,KAnEF;AA0EbC,IAAAA,cAAc,EAAE;AACdJ,MAAAA,mBAAmB,EAAE,GADP;AAEdvB,MAAAA,MAAM,EAAE,GAFM;AAGdoB,MAAAA,SAAS,EAAE,GAHG;AAIdvB,MAAAA,OAAO,EAAE;AAJK,KA1EH;AAgFb+B,IAAAA,UAAU,EAAE;AACVZ,MAAAA,QAAQ,EAAE,KADA;AAEVC,MAAAA,KAAK,EAAE;AAFG;AAhFC;AAtBF,C","sourcesContent":["/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType\n * functionalities are not defined yet - the value for those can belong to\n * model or to configuration\n */\n\nexport default {\n model: {\n choiceLabel: '',\n choices: [],\n correctResponse: [],\n enableImages: false,\n prompt: 'Item Stem goes here',\n numberedGuides: false,\n orientation: 'vertical',\n partialScoring: true,\n placementArea: false,\n removeTilesAfterPlacing: true,\n choiceLabelEnabled: true,\n scoringType: 'auto',\n targetLabel: '',\n rationaleEnabled: true,\n feedbackEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n },\n configuration: {\n choiceLabel: {\n settings: true,\n label: 'Choice label',\n },\n choices: {\n settings: true,\n label: 'Choices',\n },\n enableImages: {\n settings: true,\n label: 'Enable Images',\n },\n feedback: {\n settings: true,\n label: 'Feedback',\n enabled: true,\n },\n prompt: {\n settings: true,\n label: 'Item Stem',\n },\n numberedGuides: {\n settings: true,\n label: 'Numbered guides',\n },\n orientation: {\n settings: true,\n label: 'Orientation',\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring',\n },\n placementArea: {\n settings: true,\n label: 'Placement Area',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n },\n removeTilesAfterPlacing: {\n settings: false,\n label: 'Remove Tiles after placing',\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n targetLabel: {\n settings: true,\n label: 'Target label',\n },\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n },\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n choicesWithPlacementArea: 240,\n choicesWithoutPlacementArea: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n choices: 150,\n },\n withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n },\n};\n"],"file":"defaults.js"}
1
+ {"version":3,"sources":["../src/defaults.js"],"names":["model","choiceLabel","choices","correctResponse","enableImages","prompt","numberedGuides","orientation","partialScoring","placementArea","removeTilesAfterPlacing","choiceLabelEnabled","scoringType","targetLabel","rationaleEnabled","feedbackEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","configuration","settings","label","feedback","enabled","rationale","settingsPanelDisabled","studentInstructions","spellCheck","teacherInstructions","maxImageWidth","choicesWithPlacementArea","choicesWithoutPlacementArea","maxImageHeight","withRubric"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;eAEe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,WAAW,EAAE,EADR;AAELC,IAAAA,OAAO,EAAE,EAFJ;AAGLC,IAAAA,eAAe,EAAE,EAHZ;AAILC,IAAAA,YAAY,EAAE,KAJT;AAKLC,IAAAA,MAAM,EAAE,qBALH;AAMLC,IAAAA,cAAc,EAAE,KANX;AAOLC,IAAAA,WAAW,EAAE,UAPR;AAQLC,IAAAA,cAAc,EAAE,IARX;AASLC,IAAAA,aAAa,EAAE,KATV;AAULC,IAAAA,uBAAuB,EAAE,IAVpB;AAWLC,IAAAA,kBAAkB,EAAE,IAXf;AAYLC,IAAAA,WAAW,EAAE,MAZR;AAaLC,IAAAA,WAAW,EAAE,EAbR;AAcLC,IAAAA,gBAAgB,EAAE,IAdb;AAeLC,IAAAA,eAAe,EAAE,IAfZ;AAgBLC,IAAAA,aAAa,EAAE,IAhBV;AAiBLC,IAAAA,0BAA0B,EAAE,IAjBvB;AAkBLC,IAAAA,0BAA0B,EAAE,IAlBvB;AAmBLC,IAAAA,qBAAqB,EAAE;AAnBlB,GADM;AAsBbC,EAAAA,aAAa,EAAE;AACbnB,IAAAA,WAAW,EAAE;AACXoB,MAAAA,QAAQ,EAAE,IADC;AAEXC,MAAAA,KAAK,EAAE;AAFI,KADA;AAKbpB,IAAAA,OAAO,EAAE;AACPmB,MAAAA,QAAQ,EAAE,IADH;AAEPC,MAAAA,KAAK,EAAE;AAFA,KALI;AASblB,IAAAA,YAAY,EAAE;AACZiB,MAAAA,QAAQ,EAAE,IADE;AAEZC,MAAAA,KAAK,EAAE;AAFK,KATD;AAabC,IAAAA,QAAQ,EAAE;AACRF,MAAAA,QAAQ,EAAE,IADF;AAERC,MAAAA,KAAK,EAAE,UAFC;AAGRE,MAAAA,OAAO,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AAA,QAAQ,EAAE,IADS;AAEnBC,MAAAA,KAAK,EAAE;AAFY,KAhER;AAoEbQ,IAAAA,aAAa,EAAE;AACbD,MAAAA,mBAAmB,EAAE,GADR;AAEbxB,MAAAA,MAAM,EAAE,GAFK;AAGboB,MAAAA,SAAS,EAAE,GAHE;AAIbM,MAAAA,wBAAwB,EAAE,GAJb;AAKbC,MAAAA,2BAA2B,EAAE;AALhB,KApEF;AA2EbC,IAAAA,cAAc,EAAE;AACdJ,MAAAA,mBAAmB,EAAE,GADP;AAEdxB,MAAAA,MAAM,EAAE,GAFM;AAGdoB,MAAAA,SAAS,EAAE,GAHG;AAIdvB,MAAAA,OAAO,EAAE;AAJK,KA3EH;AAiFbgC,IAAAA,UAAU,EAAE;AACVb,MAAAA,QAAQ,EAAE,KADA;AAEVC,MAAAA,KAAK,EAAE;AAFG;AAjFC;AAtBF,C","sourcesContent":["/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType\n * functionalities are not defined yet - the value for those can belong to\n * model or to configuration\n */\n\nexport default {\n model: {\n choiceLabel: '',\n choices: [],\n correctResponse: [],\n enableImages: false,\n prompt: 'Item Stem goes here',\n numberedGuides: false,\n orientation: 'vertical',\n partialScoring: true,\n placementArea: false,\n removeTilesAfterPlacing: true,\n choiceLabelEnabled: true,\n scoringType: 'auto',\n targetLabel: '',\n rationaleEnabled: true,\n feedbackEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n },\n configuration: {\n choiceLabel: {\n settings: true,\n label: 'Choice label',\n },\n choices: {\n settings: true,\n label: 'Choices',\n },\n enableImages: {\n settings: true,\n label: 'Enable Images',\n },\n feedback: {\n settings: true,\n label: 'Feedback',\n enabled: true,\n },\n prompt: {\n settings: true,\n label: 'Item Stem',\n },\n numberedGuides: {\n settings: true,\n label: 'Numbered guides',\n },\n orientation: {\n settings: true,\n label: 'Orientation',\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring',\n },\n placementArea: {\n settings: true,\n label: 'Placement Area',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n },\n removeTilesAfterPlacing: {\n settings: false,\n label: 'Remove Tiles after placing',\n },\n settingsPanelDisabled: false,\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n targetLabel: {\n settings: true,\n label: 'Target label',\n },\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n },\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n choicesWithPlacementArea: 240,\n choicesWithoutPlacementArea: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n choices: 150,\n },\n withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n },\n};\n"],"file":"defaults.js"}
@@ -149,80 +149,88 @@ var Design = /*#__PURE__*/function (_React$Component) {
149
149
  choiceLabel = _ref3$choiceLabel === void 0 ? {} : _ref3$choiceLabel,
150
150
  _ref3$choices = _ref3.choices,
151
151
  choices = _ref3$choices === void 0 ? {} : _ref3$choices,
152
+ _ref3$enableImages = _ref3.enableImages,
153
+ enableImages = _ref3$enableImages === void 0 ? {} : _ref3$enableImages,
152
154
  _ref3$feedback = _ref3.feedback,
153
155
  feedback = _ref3$feedback === void 0 ? {} : _ref3$feedback,
154
- _ref3$targetLabel = _ref3.targetLabel,
155
- targetLabel = _ref3$targetLabel === void 0 ? {} : _ref3$targetLabel,
156
156
  _ref3$prompt = _ref3.prompt,
157
157
  prompt = _ref3$prompt === void 0 ? {} : _ref3$prompt,
158
158
  _ref3$placementArea = _ref3.placementArea,
159
159
  placementArea = _ref3$placementArea === void 0 ? {} : _ref3$placementArea,
160
+ _ref3$maxImageWidth = _ref3.maxImageWidth,
161
+ maxImageWidth = _ref3$maxImageWidth === void 0 ? {} : _ref3$maxImageWidth,
162
+ _ref3$maxImageHeight = _ref3.maxImageHeight,
163
+ maxImageHeight = _ref3$maxImageHeight === void 0 ? {} : _ref3$maxImageHeight,
160
164
  _ref3$numberedGuides = _ref3.numberedGuides,
161
165
  numberedGuides = _ref3$numberedGuides === void 0 ? {} : _ref3$numberedGuides,
162
- _ref3$enableImages = _ref3.enableImages,
163
- enableImages = _ref3$enableImages === void 0 ? {} : _ref3$enableImages,
164
166
  _ref3$orientation = _ref3.orientation,
165
167
  orientation = _ref3$orientation === void 0 ? {} : _ref3$orientation,
166
- _ref3$removeTilesAfte = _ref3.removeTilesAfterPlacing,
167
- removeTilesAfterPlacing = _ref3$removeTilesAfte === void 0 ? {} : _ref3$removeTilesAfte,
168
168
  _ref3$partialScoring = _ref3.partialScoring,
169
169
  partialScoring = _ref3$partialScoring === void 0 ? {} : _ref3$partialScoring,
170
- _ref3$teacherInstruct = _ref3.teacherInstructions,
171
- teacherInstructions = _ref3$teacherInstruct === void 0 ? {} : _ref3$teacherInstruct,
172
- _ref3$studentInstruct = _ref3.studentInstructions,
173
- studentInstructions = _ref3$studentInstruct === void 0 ? {} : _ref3$studentInstruct,
174
170
  _ref3$rationale = _ref3.rationale,
175
171
  rationale = _ref3$rationale === void 0 ? {} : _ref3$rationale,
172
+ _ref3$removeTilesAfte = _ref3.removeTilesAfterPlacing,
173
+ removeTilesAfterPlacing = _ref3$removeTilesAfte === void 0 ? {} : _ref3$removeTilesAfte,
174
+ settingsPanelDisabled = _ref3.settingsPanelDisabled,
175
+ _ref3$studentInstruct = _ref3.studentInstructions,
176
+ studentInstructions = _ref3$studentInstruct === void 0 ? {} : _ref3$studentInstruct,
176
177
  _ref3$spellCheck = _ref3.spellCheck,
177
178
  spellCheck = _ref3$spellCheck === void 0 ? {} : _ref3$spellCheck,
178
179
  _ref3$scoringType = _ref3.scoringType,
179
180
  scoringType = _ref3$scoringType === void 0 ? {} : _ref3$scoringType,
180
- _ref3$maxImageWidth = _ref3.maxImageWidth,
181
- maxImageWidth = _ref3$maxImageWidth === void 0 ? {} : _ref3$maxImageWidth,
182
- _ref3$maxImageHeight = _ref3.maxImageHeight,
183
- maxImageHeight = _ref3$maxImageHeight === void 0 ? {} : _ref3$maxImageHeight,
181
+ _ref3$targetLabel = _ref3.targetLabel,
182
+ targetLabel = _ref3$targetLabel === void 0 ? {} : _ref3$targetLabel,
183
+ _ref3$teacherInstruct = _ref3.teacherInstructions,
184
+ teacherInstructions = _ref3$teacherInstruct === void 0 ? {} : _ref3$teacherInstruct,
184
185
  _ref3$withRubric = _ref3.withRubric,
185
186
  withRubric = _ref3$withRubric === void 0 ? {} : _ref3$withRubric;
186
187
 
187
188
  var _ref4 = model || {},
188
- teacherInstructionsEnabled = _ref4.teacherInstructionsEnabled,
189
+ choiceLabelEnabled = _ref4.choiceLabelEnabled,
190
+ errors = _ref4.errors,
191
+ feedbackEnabled = _ref4.feedbackEnabled,
189
192
  promptEnabled = _ref4.promptEnabled,
190
193
  rationaleEnabled = _ref4.rationaleEnabled,
191
- feedbackEnabled = _ref4.feedbackEnabled,
192
- choiceLabelEnabled = _ref4.choiceLabelEnabled,
193
194
  spellCheckEnabled = _ref4.spellCheckEnabled,
194
- errors = _ref4.errors,
195
- rubricEnabled = _ref4.rubricEnabled;
196
-
197
- var _ref5 = errors || {},
198
- orderError = _ref5.orderError,
199
- choicesErrors = _ref5.choicesErrors;
195
+ teacherInstructionsEnabled = _ref4.teacherInstructionsEnabled,
196
+ toolbarEditorPosition = _ref4.toolbarEditorPosition;
200
197
 
201
198
  var validationMessage = (0, _utils.generateValidationMessage)();
202
- var toolbarOpts = {};
203
199
 
204
- var _ref6 = choices && choices.label && getSingularAndPlural(choices.label) || {},
205
- _ref6$singularLabel = _ref6.singularLabel,
206
- singularLabel = _ref6$singularLabel === void 0 ? '' : _ref6$singularLabel,
207
- _ref6$pluralLabel = _ref6.pluralLabel,
208
- pluralLabel = _ref6$pluralLabel === void 0 ? '' : _ref6$pluralLabel;
200
+ var _ref5 = (choices === null || choices === void 0 ? void 0 : choices.label) && getSingularAndPlural(choices.label) || {},
201
+ _ref5$singularLabel = _ref5.singularLabel,
202
+ singularLabel = _ref5$singularLabel === void 0 ? '' : _ref5$singularLabel,
203
+ _ref5$pluralLabel = _ref5.pluralLabel,
204
+ pluralLabel = _ref5$pluralLabel === void 0 ? '' : _ref5$pluralLabel;
209
205
 
210
206
  var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
211
207
  var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
212
208
  var maxChoicesImageWidth = maxImageWidth && model.placementArea ? maxImageWidth.choicesWithPlacementArea : maxImageWidth.choicesWithoutPlacementArea || defaultImageMaxWidth;
213
209
  var maxChoicesImageHeight = maxImageHeight && maxImageHeight.choices || defaultImageMaxHeight;
214
-
215
- switch (model.toolbarEditorPosition) {
216
- case 'top':
217
- toolbarOpts.position = 'top';
218
- break;
219
-
220
- default:
221
- toolbarOpts.position = 'bottom';
222
- break;
223
- }
224
-
210
+ var toolbarOpts = {
211
+ position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
212
+ };
213
+ var panelSettings = {
214
+ choiceLabelEnabled: choiceLabel.settings && toggle(choiceLabel.label),
215
+ placementArea: placementArea.settings && toggle(placementArea.label),
216
+ numberedGuides: numberedGuides.settings && model.placementArea && toggle(numberedGuides.label),
217
+ enableImages: enableImages.settings && toggle(enableImages.label),
218
+ orientation: orientation.settings && radio(orientation.label, ['vertical', 'horizontal']),
219
+ removeTilesAfterPlacing: removeTilesAfterPlacing.settings && toggle(removeTilesAfterPlacing.label),
220
+ partialScoring: partialScoring.settings && toggle(partialScoring.label),
221
+ feedbackEnabled: feedback.settings && toggle(feedback.label)
222
+ };
223
+ var panelProperties = {
224
+ teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
225
+ studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
226
+ rationaleEnabled: rationale.settings && toggle(rationale.label),
227
+ promptEnabled: prompt.settings && toggle(prompt.label),
228
+ spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
229
+ scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
230
+ rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label)
231
+ };
225
232
  return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
233
+ hideSettings: settingsPanelDisabled,
226
234
  settings: /*#__PURE__*/_react["default"].createElement(Panel, {
227
235
  model: model,
228
236
  configuration: configuration,
@@ -233,25 +241,8 @@ var Design = /*#__PURE__*/function (_React$Component) {
233
241
  return onConfigurationChanged(configuration, true);
234
242
  },
235
243
  groups: {
236
- Settings: {
237
- choiceLabelEnabled: choiceLabel.settings && toggle(choiceLabel.label),
238
- placementArea: placementArea.settings && toggle(placementArea.label),
239
- numberedGuides: numberedGuides.settings && model.placementArea && toggle(numberedGuides.label),
240
- enableImages: enableImages.settings && toggle(enableImages.label),
241
- orientation: orientation.settings && radio(orientation.label, ['vertical', 'horizontal']),
242
- removeTilesAfterPlacing: removeTilesAfterPlacing.settings && toggle(removeTilesAfterPlacing.label),
243
- partialScoring: partialScoring.settings && toggle(partialScoring.label),
244
- feedbackEnabled: feedback.settings && toggle(feedback.label)
245
- },
246
- Properties: {
247
- teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
248
- studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
249
- rationaleEnabled: rationale.settings && toggle(rationale.label),
250
- promptEnabled: prompt.settings && toggle(prompt.label),
251
- spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
252
- scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
253
- rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label)
254
- }
244
+ Settings: panelSettings,
245
+ Properties: panelProperties
255
246
  }
256
247
  })
257
248
  }, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
@@ -328,11 +319,9 @@ var Design = /*#__PURE__*/function (_React$Component) {
328
319
  fontSize: 'small',
329
320
  color: 'primary',
330
321
  style: {
331
- marginLeft: '5px'
322
+ marginLeft: '8px'
332
323
  }
333
- }))), orderError && /*#__PURE__*/_react["default"].createElement("div", {
334
- className: classes.errorText
335
- }, orderError), /*#__PURE__*/_react["default"].createElement("div", {
324
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
336
325
  className: classes.row
337
326
  }, choiceLabelEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
338
327
  label: choiceLabel && choiceLabel.label && "".concat(singularLabel, " label"),
@@ -368,10 +357,7 @@ var Design = /*#__PURE__*/function (_React$Component) {
368
357
  }, {
369
358
  language: 'special'
370
359
  }]
371
- }))), choices.settings && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
372
- label: choices && choices.label && "Student ".concat(pluralLabel),
373
- className: classes.promptHolder
374
- }, /*#__PURE__*/_react["default"].createElement(_choiceEditor["default"], {
360
+ }))), choices.settings && /*#__PURE__*/_react["default"].createElement(_choiceEditor["default"], {
375
361
  correctResponse: model.correctResponse,
376
362
  choices: model.choices,
377
363
  onChange: this.onChoiceEditorChange,
@@ -385,8 +371,8 @@ var Design = /*#__PURE__*/function (_React$Component) {
385
371
  spellCheck: spellCheckEnabled,
386
372
  maxImageWidth: maxChoicesImageWidth,
387
373
  maxImageHeight: maxChoicesImageHeight,
388
- errors: choicesErrors
389
- }))), feedbackEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.FeedbackConfig, {
374
+ errors: errors || {}
375
+ })), feedbackEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.FeedbackConfig, {
390
376
  feedback: model.feedback,
391
377
  onChange: this.onFeedbackChange,
392
378
  imageSupport: imageSupport,
@@ -415,8 +401,8 @@ var _default = (0, _drag.withDragContext)((0, _styles.withStyles)(function (them
415
401
  return {
416
402
  promptHolder: {
417
403
  width: '100%',
418
- paddingTop: '12px',
419
- marginTop: '24px'
404
+ paddingTop: theme.spacing.unit * 1.5,
405
+ marginTop: theme.spacing.unit * 3
420
406
  },
421
407
  prompt: {
422
408
  paddingTop: theme.spacing.unit * 2,
@@ -429,15 +415,10 @@ var _default = (0, _drag.withDragContext)((0, _styles.withStyles)(function (them
429
415
  gridGap: '8px'
430
416
  },
431
417
  tooltip: {
432
- fontSize: '12px',
418
+ fontSize: theme.typography.fontSize - 2,
433
419
  whiteSpace: 'pre',
434
420
  maxWidth: '500px'
435
421
  },
436
- errorText: {
437
- fontSize: '12px',
438
- color: 'red',
439
- padding: '5px 0'
440
- },
441
422
  inlineFlexContainer: {
442
423
  display: 'inline-flex',
443
424
  position: 'absolute'
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/design.jsx"],"names":["log","Panel","settings","toggle","radio","getSingularAndPlural","label","pluralize","isPlural","singularLabel","pluralLabel","singular","Design","props","applyUpdate","modelFn","model","onModelChanged","update","changeHandler","modelPath","valuePath","value","v","onPromptChange","onTeacherInstructionsChange","onRationaleChange","onChoiceAreaLabelChange","onAnswerAreaLabelChange","onFeedbackChange","onChoiceEditorChange","choices","correctResponse","feedback","feedbackEnabled","classes","imageSupport","uploadSoundSupport","configuration","onConfigurationChanged","choiceLabel","targetLabel","prompt","placementArea","numberedGuides","enableImages","orientation","removeTilesAfterPlacing","partialScoring","teacherInstructions","studentInstructions","rationale","spellCheck","scoringType","maxImageWidth","maxImageHeight","withRubric","teacherInstructionsEnabled","promptEnabled","rationaleEnabled","choiceLabelEnabled","spellCheckEnabled","errors","rubricEnabled","orderError","choicesErrors","validationMessage","toolbarOpts","defaultImageMaxWidth","defaultImageMaxHeight","maxChoicesImageWidth","choicesWithPlacementArea","choicesWithoutPlacementArea","maxChoicesImageHeight","toolbarEditorPosition","position","Settings","Properties","studentInstructionsEnabled","promptHolder","language","display","inlineFlexContainer","tooltip","marginLeft","errorText","row","React","Component","defaultProps","propTypes","PropTypes","object","isRequired","func","theme","width","paddingTop","marginTop","spacing","unit","paddingBottom","gridAutoFlow","gridAutoColumns","gridGap","fontSize","whiteSpace","maxWidth","color","padding"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,wCAAN,CAAZ;AACA,IAAQC,KAAR,GAAiCC,kBAAjC,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAAiCD,kBAAjC,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAAiCF,kBAAjC,CAAuBE,KAAvB;;AAEA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,KAAD,EAAW;AACtC,SAAO,CAACC,sBAAUC,QAAV,CAAmBF,KAAnB,CAAD,GACH;AACEG,IAAAA,aAAa,EAAEH,KADjB;AAEEI,IAAAA,WAAW,EAAE,2BAAUJ,KAAV;AAFf,GADG,GAKH;AACEG,IAAAA,aAAa,EAAEF,sBAAUI,QAAV,CAAmBL,KAAnB,CADjB;AAEEI,IAAAA,WAAW,EAAEJ;AAFf,GALJ;AASD,CAVD;;IAYaM,M;;;;;AACX,kBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;;AAEA,UAAKC,WAAL,GAAmB,UAACC,OAAD,EAAa;AAC9B,wBAAkC,MAAKF,KAAvC;AAAA,UAAQG,KAAR,eAAQA,KAAR;AAAA,UAAeC,cAAf,eAAeA,cAAf;AACA,UAAMC,MAAM,GAAGH,OAAO,CAAC,2BAAUC,KAAV,CAAD,CAAtB;AAEAC,MAAAA,cAAc,CAACC,MAAD,CAAd;AACD,KALD;;AAOA,UAAKC,aAAL,GAAqB,UAACC,SAAD,EAAYC,SAAZ,EAA0B;AAC7C,aAAO,UAACC,KAAD,EAAW;AAChBtB,QAAAA,GAAG,CAAC,yBAAD,E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,MAAAA,eAAe,EAAE,KAHd;AAIHC,MAAAA,OAAO,EAAE;AAJN,KAVgB;AAgBrBrB,IAAAA,OAAO,EAAE;AACPsB,MAAAA,QAAQ,EAAE,MADH;AAEPC,MAAAA,UAAU,EAAE,KAFL;AAGPC,MAAAA,QAAQ,EAAE;AAHH,KAhBY;AAqBrBtB,IAAAA,SAAS,EAAE;AACToB,MAAAA,QAAQ,EAAE,MADD;AAETG,MAAAA,KAAK,EAAE,KAFE;AAGTC,MAAAA,OAAO,EAAE;AAHA,KArBU;AA0BrB3B,IAAAA,mBAAmB,EAAE;AACnBD,MAAAA,OAAO,EAAE,aADU;AAEnBN,MAAAA,QAAQ,EAAE;AAFS;AA1BA,GAAZ;AAAA,CAAX,EA8BI/D,MA9BJ,CADa,C","sourcesContent":["import { FeedbackConfig, FormSection, InputContainer, settings, layout } from '@pie-lib/config-ui';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { withStyles } from '@material-ui/core/styles';\nimport { withDragContext } from '@pie-lib/drag';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nimport debug from 'debug';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { get, set } from 'nested-property';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport pluralize from 'pluralize';\n\nimport ChoiceEditor from './choice-editor';\nimport { generateValidationMessage } from './utils';\n\nconst log = debug('@pie-element:placement-ordering:design');\nconst { Panel, toggle, radio } = settings;\n\nconst getSingularAndPlural = (label) => {\n return !pluralize.isPlural(label)\n ? {\n singularLabel: label,\n pluralLabel: pluralize(label),\n }\n : {\n singularLabel: pluralize.singular(label),\n pluralLabel: label,\n };\n};\n\nexport class Design extends React.Component {\n constructor(props) {\n super(props);\n\n this.applyUpdate = (modelFn) => {\n const { model, onModelChanged } = this.props;\n const update = modelFn(cloneDeep(model));\n\n onModelChanged(update);\n };\n\n this.changeHandler = (modelPath, valuePath) => {\n return (value) => {\n log('[changeHandler] value: ', value);\n\n const v = valuePath ? get(value, valuePath) : value;\n\n this.applyUpdate((model) => {\n set(model, modelPath, v);\n return model;\n });\n };\n };\n\n this.onPromptChange = this.changeHandler('prompt');\n this.onTeacherInstructionsChange = this.changeHandler('teacherInstructions');\n this.onRationaleChange = this.changeHandler('rationale');\n this.onChoiceAreaLabelChange = this.changeHandler('choiceLabel', 'target.value');\n this.onAnswerAreaLabelChange = this.changeHandler('targetLabel', 'target.value');\n this.onFeedbackChange = this.changeHandler('feedback');\n\n this.onChoiceEditorChange = (choices, correctResponse) => {\n const { model, onModelChanged } = this.props;\n const update = cloneDeep(model);\n\n update.choices = choices;\n update.correctResponse = correctResponse;\n onModelChanged(update);\n };\n }\n\n componentDidMount() {\n const { model, onModelChanged } = this.props || {};\n const { feedback } = model || {};\n const update = cloneDeep(model);\n\n // requirement made in PD-2182\n if (!feedback) {\n update.feedbackEnabled = false;\n onModelChanged(update);\n }\n }\n\n render() {\n const { model, classes, imageSupport, uploadSoundSupport, onModelChanged, configuration, onConfigurationChanged } =\n this.props;\n const {\n choiceLabel = {},\n choices = {},\n feedback = {},\n targetLabel = {},\n prompt = {},\n placementArea = {},\n numberedGuides = {},\n enableImages = {},\n orientation = {},\n removeTilesAfterPlacing = {},\n partialScoring = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n spellCheck = {},\n scoringType = {},\n maxImageWidth = {},\n maxImageHeight = {},\n withRubric = {},\n } = configuration || {};\n const {\n teacherInstructionsEnabled,\n promptEnabled,\n rationaleEnabled,\n feedbackEnabled,\n choiceLabelEnabled,\n spellCheckEnabled,\n errors,\n rubricEnabled,\n } = model || {};\n const { orderError, choicesErrors } = errors || {};\n const validationMessage = generateValidationMessage();\n\n const toolbarOpts = {};\n const { singularLabel = '', pluralLabel = '' } =\n (choices && choices.label && getSingularAndPlural(choices.label)) || {};\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n const maxChoicesImageWidth =\n maxImageWidth && model.placementArea\n ? maxImageWidth.choicesWithPlacementArea\n : maxImageWidth.choicesWithoutPlacementArea || defaultImageMaxWidth;\n const maxChoicesImageHeight = (maxImageHeight && maxImageHeight.choices) || defaultImageMaxHeight;\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n return (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={(model) => onModelChanged(model)}\n onChangeConfiguration={(configuration) => onConfigurationChanged(configuration, true)}\n groups={{\n Settings: {\n choiceLabelEnabled: choiceLabel.settings && toggle(choiceLabel.label),\n placementArea: placementArea.settings && toggle(placementArea.label),\n numberedGuides: numberedGuides.settings && model.placementArea && toggle(numberedGuides.label),\n enableImages: enableImages.settings && toggle(enableImages.label),\n orientation: orientation.settings && radio(orientation.label, ['vertical', 'horizontal']),\n removeTilesAfterPlacing: removeTilesAfterPlacing.settings && toggle(removeTilesAfterPlacing.label),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n },\n Properties: {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n },\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <InputContainer label={teacherInstructions.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <FormSection>\n <InputContainer label={prompt && prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.prompt}\n maxImageHeight={maxImageHeight && maxImageHeight.prompt}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n {rationaleEnabled && (\n <InputContainer label={rationale.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n </FormSection>\n )}\n\n <FormSection label={`Define ${pluralLabel}`} labelExtraStyle={{ display: 'inline-flex' }}>\n <div className={classes.inlineFlexContainer}>\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ marginLeft: '5px' }} />\n </Tooltip>\n </div>\n {orderError && <div className={classes.errorText}>{orderError}</div>}\n <div className={classes.row}>\n {choiceLabelEnabled && (\n <InputContainer\n label={choiceLabel && choiceLabel.label && `${singularLabel} label`}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.choiceLabel}\n onChange={this.onChoiceAreaLabelChange}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxChoicesImageWidth}\n maxImageHeight={maxChoicesImageHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n {targetLabel.settings && model.placementArea && (\n <InputContainer\n label={targetLabel && targetLabel.label && targetLabel.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.targetLabel}\n onChange={this.onAnswerAreaLabelChange}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.choicesWithPlacementArea) || defaultImageMaxWidth}\n maxImageHeight={maxChoicesImageHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n </div>\n\n {choices.settings && (\n <InputContainer\n label={choices && choices.label && `Student ${pluralLabel}`}\n className={classes.promptHolder}\n >\n <ChoiceEditor\n correctResponse={model.correctResponse}\n choices={model.choices}\n onChange={this.onChoiceEditorChange}\n imageSupport={imageSupport}\n disableImages={!model.enableImages}\n toolbarOpts={toolbarOpts}\n choicesLabel={choices.label}\n placementArea={model.placementArea}\n singularChoiceLabel={singularLabel}\n pluralChoiceLabel={pluralLabel}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxChoicesImageWidth}\n maxImageHeight={maxChoicesImageHeight}\n errors={choicesErrors}\n />\n </InputContainer>\n )}\n </FormSection>\n\n {feedbackEnabled && (\n <FeedbackConfig\n feedback={model.feedback}\n onChange={this.onFeedbackChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n />\n )}\n </layout.ConfigLayout>\n );\n }\n}\n\nDesign.defaultProps = {\n onModelChanged: () => {},\n onConfigurationChanged: () => {},\n};\n\nDesign.propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.object,\n};\n\nexport default withDragContext(\n withStyles((theme) => ({\n promptHolder: {\n width: '100%',\n paddingTop: '12px',\n marginTop: '24px',\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit,\n },\n row: {\n display: 'grid',\n gridAutoFlow: 'column',\n gridAutoColumns: '1fr',\n gridGap: '8px',\n },\n tooltip: {\n fontSize: '12px',\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n errorText: {\n fontSize: '12px',\n color: 'red',\n padding: '5px 0',\n },\n inlineFlexContainer: {\n display: 'inline-flex',\n position: 'absolute',\n },\n }))(Design),\n);\n"],"file":"design.js"}
1
+ {"version":3,"sources":["../src/design.jsx"],"names":["log","Panel","settings","toggle","radio","getSingularAndPlural","label","pluralize","isPlural","singularLabel","pluralLabel","singular","Design","props","applyUpdate","modelFn","model","onModelChanged","update","changeHandler","modelPath","valuePath","value","v","onPromptChange","onTeacherInstructionsChange","onRationaleChange","onChoiceAreaLabelChange","onAnswerAreaLabelChange","onFeedbackChange","onChoiceEditorChange","choices","correctResponse","feedback","feedbackEnabled","classes","imageSupport","uploadSoundSupport","configuration","onConfigurationChanged","choiceLabel","enableImages","prompt","placementArea","maxImageWidth","maxImageHeight","numberedGuides","orientation","partialScoring","rationale","removeTilesAfterPlacing","settingsPanelDisabled","studentInstructions","spellCheck","scoringType","targetLabel","teacherInstructions","withRubric","choiceLabelEnabled","errors","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","validationMessage","defaultImageMaxWidth","defaultImageMaxHeight","maxChoicesImageWidth","choicesWithPlacementArea","choicesWithoutPlacementArea","maxChoicesImageHeight","toolbarOpts","position","panelSettings","panelProperties","studentInstructionsEnabled","rubricEnabled","Settings","Properties","promptHolder","language","display","inlineFlexContainer","tooltip","marginLeft","row","React","Component","defaultProps","propTypes","PropTypes","object","isRequired","func","theme","width","paddingTop","spacing","unit","marginTop","paddingBottom","gridAutoFlow","gridAutoColumns","gridGap","fontSize","typography","whiteSpace","maxWidth"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,wCAAN,CAAZ;AACA,IAAQC,KAAR,GAAiCC,kBAAjC,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAAiCD,kBAAjC,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAAiCF,kBAAjC,CAAuBE,KAAvB;;AAEA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,KAAD;AAAA,SAC3B,CAACC,sBAAUC,QAAV,CAAmBF,KAAnB,CAAD,GACI;AACEG,IAAAA,aAAa,EAAEH,KADjB;AAEEI,IAAAA,WAAW,EAAE,2BAAUJ,KAAV;AAFf,GADJ,GAKI;AACEG,IAAAA,aAAa,EAAEF,sBAAUI,QAAV,CAAmBL,KAAnB,CADjB;AAEEI,IAAAA,WAAW,EAAEJ;AAFf,GANuB;AAAA,CAA7B;;IAWaM,M;;;;;AACX,kBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;;AAEA,UAAKC,WAAL,GAAmB,UAACC,OAAD,EAAa;AAC9B,wBAAkC,MAAKF,KAAvC;AAAA,UAAQG,KAAR,eAAQA,KAAR;AAAA,UAAeC,cAAf,eAAeA,cAAf;AACA,UAAMC,MAAM,GAAGH,OAAO,CAAC,2BAAUC,KAAV,CAAD,CAAtB;AAEAC,MAAAA,cAAc,CAACC,MAAD,CAAd;AACD,KALD;;AAOA,UAAKC,aAAL,GAAqB,UAACC,SAAD,EAAYC,SAAZ,EAA0B;AA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A,OAAO,EAAE;AACPqB,MAAAA,QAAQ,EAAEV,KAAK,CAACW,UAAN,CAAiBD,QAAjB,GAA4B,CAD/B;AAEPE,MAAAA,UAAU,EAAE,KAFL;AAGPC,MAAAA,QAAQ,EAAE;AAHH,KAhBY;AAqBrBzB,IAAAA,mBAAmB,EAAE;AACnBD,MAAAA,OAAO,EAAE,aADU;AAEnBT,MAAAA,QAAQ,EAAE;AAFS;AArBA,GAAZ;AAAA,CAAX,EAyBI7D,MAzBJ,CADa,C","sourcesContent":["import { FeedbackConfig, FormSection, InputContainer, settings, layout } from '@pie-lib/config-ui';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { withStyles } from '@material-ui/core/styles';\nimport { withDragContext } from '@pie-lib/drag';\nimport Info from '@material-ui/icons/Info';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nimport debug from 'debug';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { get, set } from 'nested-property';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport pluralize from 'pluralize';\n\nimport ChoiceEditor from './choice-editor';\nimport { generateValidationMessage } from './utils';\n\nconst log = debug('@pie-element:placement-ordering:design');\nconst { Panel, toggle, radio } = settings;\n\nconst getSingularAndPlural = (label) =>\n !pluralize.isPlural(label)\n ? {\n singularLabel: label,\n pluralLabel: pluralize(label),\n }\n : {\n singularLabel: pluralize.singular(label),\n pluralLabel: label,\n };\n\nexport class Design extends React.Component {\n constructor(props) {\n super(props);\n\n this.applyUpdate = (modelFn) => {\n const { model, onModelChanged } = this.props;\n const update = modelFn(cloneDeep(model));\n\n onModelChanged(update);\n };\n\n this.changeHandler = (modelPath, valuePath) => {\n return (value) => {\n log('[changeHandler] value: ', value);\n\n const v = valuePath ? get(value, valuePath) : value;\n\n this.applyUpdate((model) => {\n set(model, modelPath, v);\n\n return model;\n });\n };\n };\n\n this.onPromptChange = this.changeHandler('prompt');\n\n this.onTeacherInstructionsChange = this.changeHandler('teacherInstructions');\n\n this.onRationaleChange = this.changeHandler('rationale');\n\n this.onChoiceAreaLabelChange = this.changeHandler('choiceLabel', 'target.value');\n\n this.onAnswerAreaLabelChange = this.changeHandler('targetLabel', 'target.value');\n\n this.onFeedbackChange = this.changeHandler('feedback');\n\n this.onChoiceEditorChange = (choices, correctResponse) => {\n const { model, onModelChanged } = this.props;\n const update = cloneDeep(model);\n\n update.choices = choices;\n update.correctResponse = correctResponse;\n onModelChanged(update);\n };\n }\n\n componentDidMount() {\n const { model, onModelChanged } = this.props || {};\n const { feedback } = model || {};\n const update = cloneDeep(model);\n\n // requirement made in PD-2182\n if (!feedback) {\n update.feedbackEnabled = false;\n onModelChanged(update);\n }\n }\n\n render() {\n const { model, classes, imageSupport, uploadSoundSupport, onModelChanged, configuration, onConfigurationChanged } =\n this.props;\n const {\n choiceLabel = {},\n choices = {},\n enableImages = {},\n feedback = {},\n prompt = {},\n placementArea = {},\n maxImageWidth = {},\n maxImageHeight = {},\n numberedGuides = {},\n orientation = {},\n partialScoring = {},\n rationale = {},\n removeTilesAfterPlacing = {},\n settingsPanelDisabled,\n studentInstructions = {},\n spellCheck = {},\n scoringType = {},\n targetLabel = {},\n teacherInstructions = {},\n withRubric = {},\n } = configuration || {};\n const {\n choiceLabelEnabled,\n errors,\n feedbackEnabled,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n } = model || {};\n const validationMessage = generateValidationMessage();\n\n const { singularLabel = '', pluralLabel = '' } = (choices?.label && getSingularAndPlural(choices.label)) || {};\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n const maxChoicesImageWidth =\n maxImageWidth && model.placementArea\n ? maxImageWidth.choicesWithPlacementArea\n : maxImageWidth.choicesWithoutPlacementArea || defaultImageMaxWidth;\n const maxChoicesImageHeight = (maxImageHeight && maxImageHeight.choices) || defaultImageMaxHeight;\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const panelSettings = {\n choiceLabelEnabled: choiceLabel.settings && toggle(choiceLabel.label),\n placementArea: placementArea.settings && toggle(placementArea.label),\n numberedGuides: numberedGuides.settings && model.placementArea && toggle(numberedGuides.label),\n enableImages: enableImages.settings && toggle(enableImages.label),\n orientation: orientation.settings && radio(orientation.label, ['vertical', 'horizontal']),\n removeTilesAfterPlacing: removeTilesAfterPlacing.settings && toggle(removeTilesAfterPlacing.label),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n };\n\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n return (\n <layout.ConfigLayout\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={(model) => onModelChanged(model)}\n onChangeConfiguration={(configuration) => onConfigurationChanged(configuration, true)}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <InputContainer label={teacherInstructions.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <FormSection>\n <InputContainer label={prompt && prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.prompt}\n maxImageHeight={maxImageHeight && maxImageHeight.prompt}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n\n {rationaleEnabled && (\n <InputContainer label={rationale.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n </FormSection>\n )}\n\n <FormSection label={`Define ${pluralLabel}`} labelExtraStyle={{ display: 'inline-flex' }}>\n <div className={classes.inlineFlexContainer}>\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} style={{ marginLeft: '8px' }} />\n </Tooltip>\n </div>\n\n <div className={classes.row}>\n {choiceLabelEnabled && (\n <InputContainer\n label={choiceLabel && choiceLabel.label && `${singularLabel} label`}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.choiceLabel}\n onChange={this.onChoiceAreaLabelChange}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxChoicesImageWidth}\n maxImageHeight={maxChoicesImageHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n\n {targetLabel.settings && model.placementArea && (\n <InputContainer\n label={targetLabel && targetLabel.label && targetLabel.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.targetLabel}\n onChange={this.onAnswerAreaLabelChange}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.choicesWithPlacementArea) || defaultImageMaxWidth}\n maxImageHeight={maxChoicesImageHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n </InputContainer>\n )}\n </div>\n\n {choices.settings && (\n <ChoiceEditor\n correctResponse={model.correctResponse}\n choices={model.choices}\n onChange={this.onChoiceEditorChange}\n imageSupport={imageSupport}\n disableImages={!model.enableImages}\n toolbarOpts={toolbarOpts}\n choicesLabel={choices.label}\n placementArea={model.placementArea}\n singularChoiceLabel={singularLabel}\n pluralChoiceLabel={pluralLabel}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxChoicesImageWidth}\n maxImageHeight={maxChoicesImageHeight}\n errors={errors || {}}\n />\n )}\n </FormSection>\n\n {feedbackEnabled && (\n <FeedbackConfig\n feedback={model.feedback}\n onChange={this.onFeedbackChange}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n />\n )}\n </layout.ConfigLayout>\n );\n }\n}\n\nDesign.defaultProps = {\n onModelChanged: () => {},\n onConfigurationChanged: () => {},\n};\n\nDesign.propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.object,\n};\n\nexport default withDragContext(\n withStyles((theme) => ({\n promptHolder: {\n width: '100%',\n paddingTop: theme.spacing.unit * 1.5,\n marginTop: theme.spacing.unit * 3,\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit,\n },\n row: {\n display: 'grid',\n gridAutoFlow: 'column',\n gridAutoColumns: '1fr',\n gridGap: '8px',\n },\n tooltip: {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n inlineFlexContainer: {\n display: 'inline-flex',\n position: 'absolute',\n },\n }))(Design),\n);\n"],"file":"design.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["prepareCustomizationObject","config","model","configuration","defaultValues","addWeightToCorrectResponse","correctResponse","map","correct","weight","undefined","id","PlacementOrdering","_model","createDefaultModel","_configuration","onModelChanged","resetSession","_rerender","dispatchUpdate","onConfigurationChanged","insertImage","handler","dispatchEvent","InsertImageEvent","deleteImage","src","done","DeleteImageEvent","reset","ModelUpdatedEvent","s","c","info","InsertSoundEvent","DeleteSoundEvent","element","React","createElement","Main","imageSupport","add","uploadSoundSupport","insertSound","bind","onDeleteSound","ReactDOM","render","HTMLElement","mapChoicesToReturnCorrectResponse","choices","ch","defaultModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAQA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,0BAA0B,GAAG,SAA7BA,0BAA6B,CAACC,MAAD,EAASC,KAAT,EAAmB;AACpD,MAAMC,aAAa,GAAG,2BAASF,MAAT,EAAiBG,qBAAcD,aAA/B,CAAtB;AAEA,SAAO;AAAEA,IAAAA,aAAa,EAAbA,aAAF;AAAiBD,IAAAA,KAAK,EAALA;AAAjB,GAAP;AACD,CAJD;;AAMO,IAAMG,0BAA0B,GAAG,SAA7BA,0BAA6B,CAACC,eAAD;AAAA,SACxCA,eAAe,IACfA,eAAe,CAACC,GAAhB,CAAoB,UAACC,OAAD,EAAa;AAC/B;AACA,QAAIA,OAAO,CAACC,MAAR,KAAmBC,SAAvB,EAAkC;AAChC,aAAO;AAAEC,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oC,CAACC,OAAD;AAAA,WAAaA,OAAO,IAAIA,OAAO,CAAC3C,GAAR,CAAY,UAAC4C,EAAD;AAAA,aAAS;AAAExC,QAAAA,EAAE,EAAEwC,EAAE,CAACxC,EAAT;AAAaF,QAAAA,MAAM,EAAE;AAArB,OAAT;AAAA,KAAZ,CAAxB;AAAA,GAA1C;;AAEA,MAAIH,eAAe,GACjBD,0BAA0B,CAACH,KAAK,CAACI,eAAP,CAA1B,IAAqD2C,iCAAiC,CAAC/C,KAAK,CAACgD,OAAP,CADxF;;AAGA,MAAME,YAAY,mCACbhD,qBAAcF,KADD,GAEbA,KAFa,CAAlB;;AAKA,MAAII,eAAJ,EAAqB;AACnB8C,IAAAA,YAAY,CAAC9C,eAAb,GAA+BA,eAA/B;AACD;;AAED,SAAO8C,YAAP;AACD,C","sourcesContent":["import {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './design';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport defaultValues from './defaults';\nimport defaults from 'lodash/defaults';\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, defaultValues.configuration);\n\n return { configuration, model };\n};\n\nexport const addWeightToCorrectResponse = (correctResponse) =>\n correctResponse &&\n correctResponse.map((correct) => {\n // if weight is set\n if (correct.weight !== undefined) {\n return { id: correct.id, weight: correct.weight };\n } else {\n return { id: correct, weight: 0 };\n }\n });\n/**\n * assuming that the correct response will be set via ui, not via config,\n * correctResponse (if not set) will be initialized with choices default order\n */\nexport default class PlacementOrdering extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const mapChoicesToReturnCorrectResponse = (choices) => choices && choices.map((ch) => ({ id: ch.id, weight: 0 }));\n\n let correctResponse =\n addWeightToCorrectResponse(model.correctResponse) || mapChoicesToReturnCorrectResponse(model.choices);\n\n const defaultModel = {\n ...defaultValues.model,\n ...model,\n };\n\n if (correctResponse) {\n defaultModel.correctResponse = correctResponse;\n }\n\n return defaultModel;\n };\n\n constructor() {\n super();\n\n this._model = PlacementOrdering.createDefaultModel();\n this._configuration = defaultValues.configuration;\n\n this.onModelChanged = (model, resetSession) => {\n this._model = model;\n this._rerender();\n this.dispatchUpdate(resetSession);\n };\n\n this.onConfigurationChanged = (configuration) => {\n this._configuration = prepareCustomizationObject(configuration).configuration;\n\n this.onModelChanged(this._model);\n this._rerender();\n };\n\n this.insertImage = (handler) => {\n this.dispatchEvent(new InsertImageEvent(handler));\n };\n\n this.deleteImage = (src, done) => {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n };\n }\n\n dispatchUpdate(reset) {\n this.dispatchEvent(new ModelUpdatedEvent(this._model, reset));\n }\n\n set model(s) {\n this._model = PlacementOrdering.createDefaultModel(s);\n this._rerender();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n this._configuration = info.configuration;\n this._rerender();\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n _rerender() {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n imageSupport: {\n add: this.insertImage,\n delete: this.deleteImage,\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["prepareCustomizationObject","config","model","configuration","defaultValues","addWeightToCorrectResponse","correctResponse","map","correct","weight","undefined","id","PlacementOrdering","_model","createDefaultModel","_configuration","onModelChanged","resetSession","_rerender","dispatchUpdate","onConfigurationChanged","insertImage","handler","dispatchEvent","InsertImageEvent","deleteImage","src","done","DeleteImageEvent","reset","ModelUpdatedEvent","s","c","info","InsertSoundEvent","DeleteSoundEvent","element","React","createElement","Main","imageSupport","add","uploadSoundSupport","insertSound","bind","onDeleteSound","ReactDOM","render","HTMLElement","mapChoicesToReturnCorrectResponse","choices","ch","defaultModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAQA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,0BAA0B,GAAG,SAA7BA,0BAA6B,CAACC,MAAD,EAASC,KAAT,EAAmB;AACpD,MAAMC,aAAa,GAAG,2BAASF,MAAT,EAAiBG,qBAAcD,aAA/B,CAAtB;AAEA,SAAO;AAAEA,IAAAA,aAAa,EAAbA,aAAF;AAAiBD,IAAAA,KAAK,EAALA;AAAjB,GAAP;AACD,CAJD;;AAMO,IAAMG,0BAA0B,GAAG,SAA7BA,0BAA6B,CAACC,eAAD;AAAA,SACxCA,eAAe,IACfA,eAAe,CAACC,GAAhB,CAAoB,UAACC,OAAD,EAAa;AAC/B;AACA,QAAIA,OAAO,CAACC,MAAR,KAAmBC,SAAvB,EAAkC;AAChC,aAAO;AAAEC,QAAAA,EAAE,EAAEH,OAAO,CAACG,EAAd;AAAkBF,QAAAA,MAAM,EAAED,OAAO,CAACC;AAAlC,OAAP;AACD,KAFD,MAEO;AACL,aAAO;AAAEE,QAAAA,EAAE,EAAEH,OAAN;AAAeC,QAAAA,MAAM,EAAE;AAAvB,OAAP;AACD;AACF,GAPD,CAFwC;AAAA,CAAnC;AAUP;AACA;AACA;AACA;;;;;IACqBG,iB;;;;;AAmBnB,+BAAc;AAAA;;AAAA;AACZ;AAEA,UAAKC,MAAL,GAAcD,iBAAiB,CAACE,kBAAlB,EAAd;AACA,UAAKC,cAAL,GAAsBX,qBAAcD,aAApC;;AAEA,UAAKa,cAAL,GAAsB,UAACd,KAAD,EAAQe,YAAR,EAAyB;AAC7C,YAAKJ,MAAL,GAAcX,KAAd;;AACA,YAAKgB,SAAL;;AACA,YAAKC,cAAL,CAAoBF,YAApB;AACD,KAJD;;AAMA,U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ertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './design';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport defaultValues from './defaults';\nimport defaults from 'lodash/defaults';\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, defaultValues.configuration);\n\n return { configuration, model };\n};\n\nexport const addWeightToCorrectResponse = (correctResponse) =>\n correctResponse &&\n correctResponse.map((correct) => {\n // if weight is set\n if (correct.weight !== undefined) {\n return { id: correct.id, weight: correct.weight };\n } else {\n return { id: correct, weight: 0 };\n }\n });\n/**\n * assuming that the correct response will be set via ui, not via config,\n * correctResponse (if not set) will be initialized with choices default order\n */\nexport default class PlacementOrdering extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const mapChoicesToReturnCorrectResponse = (choices) => choices && choices.map((ch) => ({ id: ch.id, weight: 0 }));\n\n let correctResponse =\n addWeightToCorrectResponse(model.correctResponse) || mapChoicesToReturnCorrectResponse(model.choices);\n\n const defaultModel = {\n ...defaultValues.model,\n ...model,\n };\n\n if (correctResponse) {\n defaultModel.correctResponse = correctResponse;\n }\n\n return defaultModel;\n };\n\n constructor() {\n super();\n\n this._model = PlacementOrdering.createDefaultModel();\n this._configuration = defaultValues.configuration;\n\n this.onModelChanged = (model, resetSession) => {\n this._model = model;\n this._rerender();\n this.dispatchUpdate(resetSession);\n };\n\n this.onConfigurationChanged = (configuration) => {\n this._configuration = prepareCustomizationObject(configuration).configuration;\n\n this.onModelChanged(this._model);\n this._rerender();\n };\n\n this.insertImage = (handler) => {\n this.dispatchEvent(new InsertImageEvent(handler));\n };\n\n this.deleteImage = (src, done) => {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n };\n }\n\n dispatchUpdate(reset) {\n this.dispatchEvent(new ModelUpdatedEvent(this._model, reset));\n }\n\n set model(s) {\n this._model = PlacementOrdering.createDefaultModel(s);\n this._rerender();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n this._configuration = info.configuration;\n this._rerender();\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n _rerender() {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n imageSupport: {\n add: this.insertImage,\n delete: this.deleteImage,\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n ReactDOM.render(element, this);\n }\n}\n"],"file":"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.3.0",
11
- "@pie-lib/config-ui": "^11.1.4",
12
- "@pie-lib/editable-html": "^9.3.0",
13
- "@pie-lib/scoring-config": "^3.5.195",
11
+ "@pie-lib/config-ui": "^11.2.0",
12
+ "@pie-lib/editable-html": "^9.4.0",
13
+ "@pie-lib/scoring-config": "^3.5.196",
14
14
  "debug": "^3.1.0",
15
15
  "lodash": "^4.17.15",
16
16
  "nested-property": "^0.0.7",
@@ -211,6 +211,11 @@
211
211
  }
212
212
  }
213
213
  },
214
+ "settingsPanelDisabled": {
215
+ "description": "Indicates if the settings panel is not available",
216
+ "type": "boolean",
217
+ "title": "settingsPanelDisabled"
218
+ },
214
219
  "scoringType": {
215
220
  "title": "ConfigureProp",
216
221
  "type": "object",
@@ -158,6 +158,10 @@ Indicates if the item has to be displayed in the Settings Panel
158
158
 
159
159
  Indicates the label for the item that has to be displayed in the Settings Panel
160
160
 
161
+ # `settingsPanelDisabled` (boolean)
162
+
163
+ Indicates if the settings panel is not available
164
+
161
165
  # `scoringType` (object)
162
166
 
163
167
  Properties of the `scoringType` object:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/placement-ordering",
3
- "version": "8.5.1",
3
+ "version": "8.5.2-next.120+851bb10e8",
4
4
  "description": "",
5
5
  "repository": "pie-framework/pie-elements",
6
6
  "publishConfig": {
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@material-ui/core": "^3.9.2",
11
11
  "@pie-lib/correct-answer-toggle": "^2.3.47",
12
- "@pie-lib/drag": "^2.0.4",
12
+ "@pie-lib/drag": "^2.0.5",
13
13
  "@pie-lib/math-rendering": "^2.5.1",
14
14
  "@pie-lib/render-ui": "^4.13.7",
15
15
  "debug": "^4.1.1",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "author": "",
26
26
  "license": "ISC",
27
- "gitHead": "4b3c97b360f5c94d400b37d3b900fd42ef8e4f1c",
27
+ "gitHead": "851bb10e8e0f8605c2c39f4f5c64cf689a6c6e1e",
28
28
  "scripts": {
29
29
  "postpublish": "../../scripts/postpublish"
30
30
  },