@pie-element/charting 7.1.1 → 7.1.2-next.16

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.
@@ -73,6 +73,11 @@ var styles = function styles(theme) {
73
73
  },
74
74
  description: {
75
75
  marginBottom: theme.spacing.unit * 2.5
76
+ },
77
+ errorText: {
78
+ fontSize: theme.typography.fontSize - 2,
79
+ color: theme.palette.error.main,
80
+ paddingTop: theme.spacing.unit
76
81
  }
77
82
  };
78
83
  };
@@ -223,7 +228,10 @@ var Configure = /*#__PURE__*/function (_React$Component) {
223
228
 
224
229
  var _ref4 = errors || {},
225
230
  categoryErrors = _ref4.categoryErrors,
226
- correctAnswerErrors = _ref4.correctAnswerErrors;
231
+ correctAnswerErrors = _ref4.correctAnswerErrors,
232
+ promptError = _ref4.prompt,
233
+ rationaleError = _ref4.rationale,
234
+ teacherInstructionsError = _ref4.teacherInstructions;
227
235
 
228
236
  var _this$state2 = this.state,
229
237
  gridValues = _this$state2.gridValues,
@@ -274,6 +282,7 @@ var Configure = /*#__PURE__*/function (_React$Component) {
274
282
  onChange: this.onTeacherInstructionsChange,
275
283
  imageSupport: imageSupport,
276
284
  nonEmpty: false,
285
+ error: teacherInstructionsError,
277
286
  spellCheck: spellCheckEnabled,
278
287
  maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
279
288
  maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
@@ -284,7 +293,9 @@ var Configure = /*#__PURE__*/function (_React$Component) {
284
293
  language: 'special'
285
294
  }],
286
295
  mathMlOptions: mathMlOptions
287
- })), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
296
+ }), teacherInstructionsError && /*#__PURE__*/_react["default"].createElement("div", {
297
+ className: classes.errorText
298
+ }, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
288
299
  label: prompt.label,
289
300
  className: classes.promptHolder
290
301
  }, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
@@ -293,6 +304,7 @@ var Configure = /*#__PURE__*/function (_React$Component) {
293
304
  onChange: this.onPromptChange,
294
305
  imageSupport: imageSupport,
295
306
  nonEmpty: false,
307
+ error: promptError,
296
308
  spellCheck: spellCheckEnabled,
297
309
  disableUnderline: true,
298
310
  maxImageWidth: defaultImageMaxWidth,
@@ -304,7 +316,9 @@ var Configure = /*#__PURE__*/function (_React$Component) {
304
316
  language: 'special'
305
317
  }],
306
318
  mathMlOptions: mathMlOptions
307
- })), /*#__PURE__*/_react["default"].createElement(_charting.ConfigureChartPanel, {
319
+ }), promptError && /*#__PURE__*/_react["default"].createElement("div", {
320
+ className: classes.errorText
321
+ }, promptError)), /*#__PURE__*/_react["default"].createElement(_charting.ConfigureChartPanel, {
308
322
  model: model,
309
323
  onChange: this.onConfigChange,
310
324
  gridValues: gridValues,
@@ -341,6 +355,7 @@ var Configure = /*#__PURE__*/function (_React$Component) {
341
355
  markup: model.rationale || '',
342
356
  onChange: this.onRationaleChange,
343
357
  imageSupport: imageSupport,
358
+ error: rationaleError,
344
359
  spellCheck: spellCheckEnabled,
345
360
  maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
346
361
  maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
@@ -351,7 +366,9 @@ var Configure = /*#__PURE__*/function (_React$Component) {
351
366
  language: 'special'
352
367
  }],
353
368
  mathMlOptions: mathMlOptions
354
- })));
369
+ }), rationaleError && /*#__PURE__*/_react["default"].createElement("div", {
370
+ className: classes.errorText
371
+ }, rationaleError)));
355
372
  }
356
373
  }]);
357
374
  return Configure;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/configure.jsx"],"names":["log","Panel","settings","toggle","radio","dropdown","textField","styles","theme","title","fontSize","display","marginTop","spacing","unit","marginBottom","promptHolder","width","paddingTop","description","charts","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","Configure","props","rationale","onModelChanged","model","prompt","teacherInstructions","chartType","config","state","oldGridValues","gridValues","oldLabelValues","labelValues","updatedModel","graph","range","rangeConstraints","height","setState","step","classes","configuration","imageSupport","onConfigurationChanged","uploadSoundSupport","contentDimensions","chartDimensions","authorNewCategoryDefaults","labelsPlaceholders","instruction","maxImageWidth","maxImageHeight","scoringType","settingsPanelDisabled","spellCheck","studentInstructions","titlePlaceholder","withRubric","chartingOptions","availableChartTypes","mathMlOptions","chartTypeLabel","language","languageChoices","errors","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","studentNewCategoryDefaultLabel","categoryErrors","correctAnswerErrors","showPixeGuides","showInConfigPanel","defaultImageMaxWidth","defaultImageMaxHeight","panelItemType","changeInteractiveEnabled","changeInteractive","settingsLabel","changeEditableEnabled","changeEditable","changeAddCategoryEnabled","addCategory","panelProperties","label","studentInstructionsEnabled","rubricEnabled","enabled","options","Settings","Properties","onTeacherInstructionsChange","onPromptChange","onConfigChange","onRationaleChange","React","Component","PropTypes","func","object","isRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,iCAAN,CAAZ;AACA,IAAQC,KAAR,GAAsDC,kBAAtD,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAAsDD,kBAAtD,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAAsDF,kBAAtD,CAAuBE,KAAvB;AAAA,IAA8BC,QAA9B,GAAsDH,kBAAtD,CAA8BG,QAA9B;AAAA,IAAwCC,SAAxC,GAAsDJ,kBAAtD,CAAwCI,SAAxC;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,KAAK,EAAE;AACLC,MAAAA,QAAQ,EAAE,QADL;AAELC,MAAAA,OAAO,EAAE,OAF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AAD;AACE,QAAA,SAAS,EAAEiC,OAAO,CAAChB,MADrB;AAEE,QAAA,MAAM,EAAED,KAAK,CAACF,SAAN,IAAmB,EAF7B;AAGE,QAAA,QAAQ,EAAE,KAAK0E,iBAHjB;AAIE,QAAA,YAAY,EAAErD,YAJhB;AAKE,QAAA,UAAU,EAAEyB,iBALd;AAME,QAAA,aAAa,EAAGjB,aAAa,IAAIA,aAAa,CAAC7B,SAAhC,IAA8CqD,oBAN/D;AAOE,QAAA,cAAc,EAAGvB,cAAc,IAAIA,cAAc,CAAC9B,SAAlC,IAAgDsD,qBAPlE;AAQE,QAAA,kBAAkB,EAAE/B,kBARtB;AASE,QAAA,uBAAuB,EAAE,CAAC;AAAEkB,UAAAA,QAAQ,EAAE;AAAZ,SAAD,EAA0B;AAAEA,UAAAA,QAAQ,EAAE;AAAZ,SAA1B,CAT3B;AAUE,QAAA,aAAa,EAAEF;AAVjB,QADF,CA7FJ,CADF;AA+GD;;;EApO4BoC,kBAAMC,S;;;iCAAxB9E,S,eACQ;AACjBG,EAAAA,cAAc,EAAE4E,sBAAUC,IADT;AAEjBxD,EAAAA,sBAAsB,EAAEuD,sBAAUC,IAFjB;AAGjB3D,EAAAA,OAAO,EAAE0D,sBAAUE,MAHF;AAIjB1D,EAAAA,YAAY,EAAEwD,sBAAUE,MAJP;AAKjBxD,EAAAA,kBAAkB,EAAEsD,sBAAUE,MALb;AAMjB7E,EAAAA,KAAK,EAAE2E,sBAAUE,MAAV,CAAiBC,UANP;AAOjB5D,EAAAA,aAAa,EAAEyD,sBAAUE,MAAV,CAAiBC,UAPf;AAQjB3C,EAAAA,eAAe,EAAEwC,sBAAUE;AARV,C;iCADRjF,S,kBAqBW;AAAEqB,EAAAA,OAAO,EAAE;AAAX,C;;eAkNT,wBAAW1C,MAAX,EAAmBqB,SAAnB,C","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport { chartTypes, ConfigureChartPanel } from '@pie-lib/pie-toolbox/charting';\nimport { settings, layout, InputContainer } from '@pie-lib/pie-toolbox/config-ui';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport Typography from '@material-ui/core/Typography';\nimport EditableHtml from '@pie-lib/pie-toolbox/editable-html';\n\nimport ChartingConfig from './charting-config';\nimport CorrectResponse from './correct-response';\nimport { applyConstraints, getGridValues, getLabelValues } from './utils';\n\nconst log = debug('@pie-element:graphing:configure');\nconst { Panel, toggle, radio, dropdown, textField } = settings;\n\nconst styles = (theme) => ({\n title: {\n fontSize: '1.1rem',\n display: 'block',\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit,\n },\n promptHolder: {\n width: '100%',\n paddingTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n description: {\n marginBottom: theme.spacing.unit * 2.5,\n },\n});\n\nconst charts = [\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n];\n\nexport class Configure extends React.Component {\n static propTypes = {\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n classes: PropTypes.object,\n imageSupport: PropTypes.object,\n uploadSoundSupport: PropTypes.object,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n chartingOptions: PropTypes.object,\n };\n\n constructor(props) {\n super(props);\n const { range = {}, graph } = props.model || {};\n const gridValues = { range: getGridValues(range, graph.height, true) };\n const labelValues = { range: getLabelValues(range.step || 1) };\n\n this.state = { gridValues, labelValues };\n }\n\n static defaultProps = { classes: {} };\n\n onRationaleChange = (rationale) => this.props.onModelChanged({ ...this.props.model, rationale });\n\n onPromptChange = (prompt) => this.props.onModelChanged({ ...this.props.model, prompt });\n\n onTeacherInstructionsChange = (teacherInstructions) =>\n this.props.onModelChanged({ ...this.props.model, teacherInstructions });\n\n onChartTypeChange = (chartType) => this.props.onModelChanged({ ...this.props.model, chartType });\n\n onConfigChange = (config) => {\n const { model, onModelChanged } = this.props;\n const { gridValues: oldGridValues, labelValues: oldLabelValues } = this.state;\n const updatedModel = { ...model, ...config };\n const { graph, range } = updatedModel;\n const gridValues = {};\n const labelValues = {};\n\n const rangeConstraints = applyConstraints(range, graph.height, oldGridValues.range, oldLabelValues.range);\n\n gridValues.range = rangeConstraints.gridValues;\n labelValues.range = rangeConstraints.labelValues;\n\n this.setState({ gridValues, labelValues });\n onModelChanged(updatedModel);\n };\n\n render() {\n const { classes, configuration, imageSupport, model, onConfigurationChanged, onModelChanged, uploadSoundSupport } =\n this.props;\n\n log('[render] model', model);\n\n const { graph } = model;\n const {\n contentDimensions = {},\n chartDimensions = {},\n authorNewCategoryDefaults = {},\n labelsPlaceholders = {},\n instruction = {},\n maxImageWidth = {},\n maxImageHeight = {},\n prompt = {},\n rationale = {},\n scoringType = {},\n settingsPanelDisabled,\n spellCheck = {},\n studentInstructions = {},\n teacherInstructions = {},\n titlePlaceholder = {},\n withRubric = {},\n chartingOptions = {},\n availableChartTypes = {},\n mathMlOptions = {},\n chartTypeLabel,\n language = {},\n languageChoices = {},\n } = configuration || {};\n const {\n errors,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n studentNewCategoryDefaultLabel,\n } = model || {};\n const { categoryErrors, correctAnswerErrors } = errors || {};\n const { gridValues, labelValues } = this.state;\n const showPixeGuides = chartDimensions.showInConfigPanel || true;\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const panelItemType = {\n changeInteractiveEnabled:\n chartingOptions.changeInteractive?.settings && toggle(chartingOptions.changeInteractive.settingsLabel),\n changeEditableEnabled:\n chartingOptions.changeEditable?.settings && toggle(chartingOptions.changeEditable.settingsLabel),\n changeAddCategoryEnabled:\n chartingOptions.addCategory?.settings && toggle(chartingOptions.addCategory.settingsLabel),\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 spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['all or nothing', 'partial scoring']),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n instruction: instruction.settings && textField(instruction.label),\n };\n\n return (\n <layout.ConfigLayout\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={onModelChanged}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: panelItemType,\n Properties: panelProperties,\n }}\n />\n }\n >\n <Typography component=\"div\" type=\"body1\" className={classes.description}>\n {instruction?.label || ''}\n </Typography>\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 spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n spellCheck={spellCheckEnabled}\n disableUnderline\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n </InputContainer>\n )}\n\n <ConfigureChartPanel\n model={model}\n onChange={this.onConfigChange}\n gridValues={gridValues}\n labelValues={labelValues}\n chartDimensions={chartDimensions}\n charts={charts}\n studentNewCategoryDefaultLabel={studentNewCategoryDefaultLabel}\n availableChartTypes={availableChartTypes}\n chartTypeLabel={chartTypeLabel}\n />\n\n <ChartingConfig\n model={model}\n onChange={onModelChanged}\n charts={charts}\n labelsPlaceholders={labelsPlaceholders}\n titlePlaceholder={titlePlaceholder}\n showPixelGuides={showPixeGuides}\n authorNewCategoryDefaults={authorNewCategoryDefaults}\n chartingOptions={chartingOptions}\n mathMlOptions={mathMlOptions}\n />\n\n <CorrectResponse\n config={graph}\n model={model}\n onChange={onModelChanged}\n charts={charts}\n error={categoryErrors}\n correctAnswerErrors={correctAnswerErrors}\n studentNewCategoryDefaultLabel={studentNewCategoryDefaultLabel}\n mathMlOptions={mathMlOptions}\n />\n\n {rationaleEnabled && (\n <InputContainer label={rationale.label || 'Rationale'} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChange}\n imageSupport={imageSupport}\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 mathMlOptions={mathMlOptions}\n />\n </InputContainer>\n )}\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default withStyles(styles)(Configure);\n"],"file":"configure.js"}
1
+ {"version":3,"sources":["../src/configure.jsx"],"names":["log","Panel","settings","toggle","radio","dropdown","textField","styles","theme","title","fontSize","display","marginTop","spacing","unit","marginBottom","promptHolder","width","paddingTop","description","errorText","typography","color","palette","error","main","charts","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","Configure","props","rationale","onModelChanged","model","prompt","teacherInstructions","chartType","config","state","oldGridValues","gridValues","oldLabelValues","labelValues","updatedModel","graph","range","rangeConstraints","height","setState","step","classes","configuration","imageSupport","onConfigurationChanged","uploadSoundSupport","contentDimensions","chartDimensions","authorNewCategoryDefaults","labelsPlaceholders","instruction","maxImageWidth","maxImageHeight","scoringType","settingsPanelDisabled","spellCheck","studentInstructions","titlePlaceholder","withRubric","chartingOptions","availableChartTypes","mathMlOptions","chartTypeLabel","language","languageChoices","errors","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","studentNewCategoryDefaultLabel","categoryErrors","correctAnswerErrors","promptError","rationaleError","teacherInstructionsError","showPixeGuides","showInConfigPanel","defaultImageMaxWidth","defaultImageMaxHeight","panelItemType","changeInteractiveEnabled","changeInteractive","settingsLabel","changeEditableEnabled","changeEditable","changeAddCategoryEnabled","addCategory","panelProperties","label","studentInstructionsEnabled","rubricEnabled","enabled","options","Settings","Properties","onTeacherInstructionsChange","onPromptChange","onConfigChange","onRationaleChange","React","Component","PropTypes","func","object","isRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,iCAAN,CAAZ;AACA,IAAQC,KAAR,GAAsDC,kBAAtD,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAAsDD,kBAAtD,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAAsDF,kBAAtD,CAAuBE,KAAvB;AAAA,IAA8BC,QAA9B,GAAsDH,kBAAtD,CAA8BG,QAA9B;AAAA,IAAwCC,SAAxC,GAAsDJ,kBAAtD,CAAwCI,SAAxC;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,K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EAAEF;AAXjB,QADF,EAcGa,cAAc,iBAAI;AAAK,QAAA,SAAS,EAAEjC,OAAO,CAACnC;AAAxB,SAAoCoE,cAApC,CAdrB,CAjGJ,CADF;AAqHD;;;EAhP4B0B,kBAAMC,S;;;iCAAxBjF,S,eACQ;AACjBG,EAAAA,cAAc,EAAE+E,sBAAUC,IADT;AAEjB3D,EAAAA,sBAAsB,EAAE0D,sBAAUC,IAFjB;AAGjB9D,EAAAA,OAAO,EAAE6D,sBAAUE,MAHF;AAIjB7D,EAAAA,YAAY,EAAE2D,sBAAUE,MAJP;AAKjB3D,EAAAA,kBAAkB,EAAEyD,sBAAUE,MALb;AAMjBhF,EAAAA,KAAK,EAAE8E,sBAAUE,MAAV,CAAiBC,UANP;AAOjB/D,EAAAA,aAAa,EAAE4D,sBAAUE,MAAV,CAAiBC,UAPf;AAQjB9C,EAAAA,eAAe,EAAE2C,sBAAUE;AARV,C;iCADRpF,S,kBAqBW;AAAEqB,EAAAA,OAAO,EAAE;AAAX,C;;eA8NT,wBAAWhD,MAAX,EAAmB2B,SAAnB,C","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport { chartTypes, ConfigureChartPanel } from '@pie-lib/pie-toolbox/charting';\nimport { settings, layout, InputContainer } from '@pie-lib/pie-toolbox/config-ui';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport Typography from '@material-ui/core/Typography';\nimport EditableHtml from '@pie-lib/pie-toolbox/editable-html';\n\nimport ChartingConfig from './charting-config';\nimport CorrectResponse from './correct-response';\nimport { applyConstraints, getGridValues, getLabelValues } from './utils';\n\nconst log = debug('@pie-element:graphing:configure');\nconst { Panel, toggle, radio, dropdown, textField } = settings;\n\nconst styles = (theme) => ({\n title: {\n fontSize: '1.1rem',\n display: 'block',\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit,\n },\n promptHolder: {\n width: '100%',\n paddingTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n description: {\n marginBottom: theme.spacing.unit * 2.5,\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit,\n },\n});\n\nconst charts = [\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n];\n\nexport class Configure extends React.Component {\n static propTypes = {\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n classes: PropTypes.object,\n imageSupport: PropTypes.object,\n uploadSoundSupport: PropTypes.object,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n chartingOptions: PropTypes.object,\n };\n\n constructor(props) {\n super(props);\n const { range = {}, graph } = props.model || {};\n const gridValues = { range: getGridValues(range, graph.height, true) };\n const labelValues = { range: getLabelValues(range.step || 1) };\n\n this.state = { gridValues, labelValues };\n }\n\n static defaultProps = { classes: {} };\n\n onRationaleChange = (rationale) => this.props.onModelChanged({ ...this.props.model, rationale });\n\n onPromptChange = (prompt) => this.props.onModelChanged({ ...this.props.model, prompt });\n\n onTeacherInstructionsChange = (teacherInstructions) =>\n this.props.onModelChanged({ ...this.props.model, teacherInstructions });\n\n onChartTypeChange = (chartType) => this.props.onModelChanged({ ...this.props.model, chartType });\n\n onConfigChange = (config) => {\n const { model, onModelChanged } = this.props;\n const { gridValues: oldGridValues, labelValues: oldLabelValues } = this.state;\n const updatedModel = { ...model, ...config };\n const { graph, range } = updatedModel;\n const gridValues = {};\n const labelValues = {};\n\n const rangeConstraints = applyConstraints(range, graph.height, oldGridValues.range, oldLabelValues.range);\n\n gridValues.range = rangeConstraints.gridValues;\n labelValues.range = rangeConstraints.labelValues;\n\n this.setState({ gridValues, labelValues });\n onModelChanged(updatedModel);\n };\n\n render() {\n const { classes, configuration, imageSupport, model, onConfigurationChanged, onModelChanged, uploadSoundSupport } =\n this.props;\n\n log('[render] model', model);\n\n const { graph } = model;\n const {\n contentDimensions = {},\n chartDimensions = {},\n authorNewCategoryDefaults = {},\n labelsPlaceholders = {},\n instruction = {},\n maxImageWidth = {},\n maxImageHeight = {},\n prompt = {},\n rationale = {},\n scoringType = {},\n settingsPanelDisabled,\n spellCheck = {},\n studentInstructions = {},\n teacherInstructions = {},\n titlePlaceholder = {},\n withRubric = {},\n chartingOptions = {},\n availableChartTypes = {},\n mathMlOptions = {},\n chartTypeLabel,\n language = {},\n languageChoices = {},\n } = configuration || {};\n const {\n errors,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n studentNewCategoryDefaultLabel,\n } = model || {};\n const {\n categoryErrors,\n correctAnswerErrors,\n prompt: promptError,\n rationale: rationaleError,\n teacherInstructions: teacherInstructionsError,\n } = errors || {};\n const { gridValues, labelValues } = this.state;\n const showPixeGuides = chartDimensions.showInConfigPanel || true;\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const panelItemType = {\n changeInteractiveEnabled:\n chartingOptions.changeInteractive?.settings && toggle(chartingOptions.changeInteractive.settingsLabel),\n changeEditableEnabled:\n chartingOptions.changeEditable?.settings && toggle(chartingOptions.changeEditable.settingsLabel),\n changeAddCategoryEnabled:\n chartingOptions.addCategory?.settings && toggle(chartingOptions.addCategory.settingsLabel),\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 spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['all or nothing', 'partial scoring']),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n instruction: instruction.settings && textField(instruction.label),\n };\n\n return (\n <layout.ConfigLayout\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={onModelChanged}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: panelItemType,\n Properties: panelProperties,\n }}\n />\n }\n >\n <Typography component=\"div\" type=\"body1\" className={classes.description}>\n {instruction?.label || ''}\n </Typography>\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 error={teacherInstructionsError}\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 mathMlOptions={mathMlOptions}\n />\n {teacherInstructionsError && <div className={classes.errorText}>{teacherInstructionsError}</div>}\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={promptError}\n spellCheck={spellCheckEnabled}\n disableUnderline\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {promptError && <div className={classes.errorText}>{promptError}</div>}\n </InputContainer>\n )}\n\n <ConfigureChartPanel\n model={model}\n onChange={this.onConfigChange}\n gridValues={gridValues}\n labelValues={labelValues}\n chartDimensions={chartDimensions}\n charts={charts}\n studentNewCategoryDefaultLabel={studentNewCategoryDefaultLabel}\n availableChartTypes={availableChartTypes}\n chartTypeLabel={chartTypeLabel}\n />\n\n <ChartingConfig\n model={model}\n onChange={onModelChanged}\n charts={charts}\n labelsPlaceholders={labelsPlaceholders}\n titlePlaceholder={titlePlaceholder}\n showPixelGuides={showPixeGuides}\n authorNewCategoryDefaults={authorNewCategoryDefaults}\n chartingOptions={chartingOptions}\n mathMlOptions={mathMlOptions}\n />\n\n <CorrectResponse\n config={graph}\n model={model}\n onChange={onModelChanged}\n charts={charts}\n error={categoryErrors}\n correctAnswerErrors={correctAnswerErrors}\n studentNewCategoryDefaultLabel={studentNewCategoryDefaultLabel}\n mathMlOptions={mathMlOptions}\n />\n\n {rationaleEnabled && (\n <InputContainer label={rationale.label || 'Rationale'} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChange}\n imageSupport={imageSupport}\n error={rationaleError}\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 mathMlOptions={mathMlOptions}\n />\n {rationaleError && <div className={classes.errorText}>{rationaleError}</div>}\n </InputContainer>\n )}\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default withStyles(styles)(Configure);\n"],"file":"configure.js"}
@@ -87,11 +87,13 @@ var _default = {
87
87
  },
88
88
  prompt: {
89
89
  settings: true,
90
- label: 'Item Stem'
90
+ label: 'Item Stem',
91
+ required: false
91
92
  },
92
93
  rationale: {
93
94
  settings: true,
94
- label: 'Rationale'
95
+ label: 'Rationale',
96
+ required: false
95
97
  },
96
98
  scoringType: {
97
99
  settings: false,
@@ -104,7 +106,8 @@ var _default = {
104
106
  },
105
107
  teacherInstructions: {
106
108
  settings: true,
107
- label: 'Teacher Instructions'
109
+ label: 'Teacher Instructions',
110
+ required: false
108
111
  },
109
112
  title: {
110
113
  settings: false,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/defaults.js"],"names":["model","addCategoryEnabled","chartType","correctAnswer","data","domain","graph","width","height","prompt","promptEnabled","rationale","range","label","max","min","scoringType","title","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","studentNewCategoryDefaultLabel","changeInteractiveEnabled","changeEditableEnabled","changeAddCategoryEnabled","configuration","spellCheck","settings","enabled","chartDimensions","showInConfigPanel","step","authorNewCategoryDefaults","interactive","editable","availableChartTypes","bar","histogram","lineDot","lineCross","dotPlot","linePlot","chartTypeLabel","settingsPanelDisabled","studentInstructions","teacherInstructions","instruction","titlePlaceholder","labelsPlaceholders","left","right","top","bottom","maxImageWidth","maxImageHeight","withRubric","language","languageChoices","options","chartingOptions","changeInteractive","authoringLabel","settingsLabel","changeEditable","addCategory","mathMlOptions","mmlOutput","mmlEditing"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;eAEe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,kBAAkB,EAAE,IADf;AAELC,IAAAA,SAAS,EAAE,WAFN;AAGLC,IAAAA,aAAa,EAAE,EAHV;AAILC,IAAAA,IAAI,EAAE,EAJD;AAKLC,IAAAA,MAAM,EAAE,EALH;AAMLC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE,GADF;AAELC,MAAAA,MAAM,EAAE;AAFH,KANF;AAULC,IAAAA,MAAM,EAAE,EAVH;AAWLC,IAAAA,aAAa,EAAE,IAXV;AAYLC,IAAAA,SAAS,EAAE,EAZN;AAaLC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE,EADF;AAELC,MAAAA,GAAG,EAAE,CAFA;AAGLC,MAAAA,GAAG,EAAE;AAHA,KAbF;AAkBLC,IAAAA,WAAW,EAAE,gBAlBR;AAmBLC,IAAAA,KAAK,EA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AAmB,EAAE,GADR;AAEbpC,MAAAA,MAAM,EAAE,GAFK;AAGbE,MAAAA,SAAS,EAAE;AAHE,KAlFF;AAuFb2C,IAAAA,cAAc,EAAE;AACdT,MAAAA,mBAAmB,EAAE,GADP;AAEdpC,MAAAA,MAAM,EAAE,GAFM;AAGdE,MAAAA,SAAS,EAAE;AAHG,KAvFH;AA4Fb4C,IAAAA,UAAU,EAAE;AACV5B,MAAAA,QAAQ,EAAE,KADA;AAEVd,MAAAA,KAAK,EAAE;AAFG,KA5FC;AAgGb2C,IAAAA,QAAQ,EAAE;AACR7B,MAAAA,QAAQ,EAAE,KADF;AAERd,MAAAA,KAAK,EAAE,kBAFC;AAGRe,MAAAA,OAAO,EAAE;AAHD,KAhGG;AAqGb6B,IAAAA,eAAe,EAAE;AACf5C,MAAAA,KAAK,EAAE,kBADQ;AAEf6C,MAAAA,OAAO,EAAE;AAFM,KArGJ;AAyGbC,IAAAA,eAAe,EAAE;AACfC,MAAAA,iBAAiB,EAAE;AACjBjC,QAAAA,QAAQ,EAAE,KADO;AAEjBkC,QAAAA,cAAc,EAAE,uBAFC;AAGjBC,QAAAA,aAAa,EAAE;AAHE,OADJ;AAMfC,MAAAA,cAAc,EAAE;AACdpC,QAAAA,QAAQ,EAAE,KADI;AAEdkC,QAAAA,cAAc,EAAE,uBAFF;AAGdC,QAAAA,aAAa,EAAE;AAHD,OAND;AAWfE,MAAAA,WAAW,EAAE;AACXrC,QAAAA,QAAQ,EAAE,KADC;AAEXkC,QAAAA,cAAc,EAAE,4BAFL;AAGXC,QAAAA,aAAa,EAAE;AAHJ,OAXE;AAgBfG,MAAAA,aAAa,EAAE;AACbC,QAAAA,SAAS,EAAE,KADE;AAEbC,QAAAA,UAAU,EAAE;AAFC;AAhBA;AAzGJ;AA7BF,C","sourcesContent":["/**\n * NOTE: There's no functionality described for graphTitle,\n * rationale, scoringType, studentInstructions, teacherInstructions\n * so there's no implementation (they are only added in model)\n */\n\n// const createCategory = (label, value) => ({\n// label,\n// value,\n// interactive: true,\n// editable: true\n// });\n\nexport default {\n model: {\n addCategoryEnabled: true,\n chartType: 'lineCross',\n correctAnswer: {},\n data: [],\n domain: {},\n graph: {\n width: 480,\n height: 480,\n },\n prompt: '',\n promptEnabled: true,\n rationale: '',\n range: {\n label: '',\n max: 1,\n min: 0,\n },\n scoringType: 'all or nothing',\n title: '',\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n studentNewCategoryDefaultLabel: 'New Category',\n changeInteractiveEnabled: false,\n changeEditableEnabled: false,\n changeAddCategoryEnabled: false,\n },\n configuration: {\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n chartDimensions: {\n settings: false,\n label: 'Chart Dimensions',\n showInConfigPanel: true,\n width: {\n min: 50,\n max: 700,\n step: 20,\n },\n height: {\n min: 400,\n max: 700,\n step: 20,\n },\n },\n authorNewCategoryDefaults: {\n settings: false,\n label: 'Category',\n interactive: true,\n editable: false,\n },\n availableChartTypes: {\n bar: 'Bar Chart',\n histogram: 'Histogram',\n lineDot: 'Line Chart ●',\n lineCross: 'Line Chart x',\n dotPlot: 'Dot/Line Plot ⬤',\n linePlot: 'Dot/Line Plot X',\n },\n chartTypeLabel: 'ChartType',\n studentNewCategoryDefaultLabel: {\n settings: false,\n label: 'Category',\n },\n prompt: {\n settings: true,\n label: 'Item Stem',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n settingsPanelDisabled: false,\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n },\n title: {\n settings: false,\n label: 'Chart Title',\n },\n instruction: {\n settings: false,\n label:\n 'This item type provides various types of interactive charts. Depending upon how an item is configured,\\n' +\n ' students can change the heights of bars (or other similar chart elements) created by the author; relabel bars\\n' +\n ' created by the author; and/or add new bars, label them, and set their heights.',\n },\n titlePlaceholder: {\n settings: false,\n label: 'Click here to add a title',\n },\n labelsPlaceholders: {\n left: 'Click here to add a label for this axis',\n right: '',\n top: '',\n bottom: 'Click here to add a label for this axis',\n },\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n language: {\n settings: false,\n label: 'Specify Language',\n enabled: false,\n },\n languageChoices: {\n label: 'Language Choices',\n options: [],\n },\n chartingOptions: {\n changeInteractive: {\n settings: false,\n authoringLabel: 'Student can set value',\n settingsLabel: 'Allow non-interactive categories',\n },\n changeEditable: {\n settings: false,\n authoringLabel: 'Student can edit name',\n settingsLabel: 'Allow editable category names',\n },\n addCategory: {\n settings: false,\n authoringLabel: 'Student can add categories',\n settingsLabel: 'Allow changes to whether students can add categories',\n },\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n },\n },\n};\n"],"file":"defaults.js"}
1
+ {"version":3,"sources":["../src/defaults.js"],"names":["model","addCategoryEnabled","chartType","correctAnswer","data","domain","graph","width","height","prompt","promptEnabled","rationale","range","label","max","min","scoringType","title","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","studentNewCategoryDefaultLabel","changeInteractiveEnabled","changeEditableEnabled","changeAddCategoryEnabled","configuration","spellCheck","settings","enabled","chartDimensions","showInConfigPanel","step","authorNewCategoryDefaults","interactive","editable","availableChartTypes","bar","histogram","lineDot","lineCross","dotPlot","linePlot","chartTypeLabel","required","settingsPanelDisabled","studentInstructions","teacherInstructions","instruction","titlePlaceholder","labelsPlaceholders","left","right","top","bottom","maxImageWidth","maxImageHeight","withRubric","language","languageChoices","options","chartingOptions","changeInteractive","authoringLabel","settingsLabel","changeEditable","addCategory","mathMlOptions","mmlOutput","mmlEditing"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;eAEe;AACbA,EAAAA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C,IAAAA,eAAe,EAAE;AACfC,MAAAA,iBAAiB,EAAE;AACjBlC,QAAAA,QAAQ,EAAE,KADO;AAEjBmC,QAAAA,cAAc,EAAE,uBAFC;AAGjBC,QAAAA,aAAa,EAAE;AAHE,OADJ;AAMfC,MAAAA,cAAc,EAAE;AACdrC,QAAAA,QAAQ,EAAE,KADI;AAEdmC,QAAAA,cAAc,EAAE,uBAFF;AAGdC,QAAAA,aAAa,EAAE;AAHD,OAND;AAWfE,MAAAA,WAAW,EAAE;AACXtC,QAAAA,QAAQ,EAAE,KADC;AAEXmC,QAAAA,cAAc,EAAE,4BAFL;AAGXC,QAAAA,aAAa,EAAE;AAHJ,OAXE;AAgBfG,MAAAA,aAAa,EAAE;AACbC,QAAAA,SAAS,EAAE,KADE;AAEbC,QAAAA,UAAU,EAAE;AAFC;AAhBA;AA5GJ;AA7BF,C","sourcesContent":["/**\n * NOTE: There's no functionality described for graphTitle,\n * rationale, scoringType, studentInstructions, teacherInstructions\n * so there's no implementation (they are only added in model)\n */\n\n// const createCategory = (label, value) => ({\n// label,\n// value,\n// interactive: true,\n// editable: true\n// });\n\nexport default {\n model: {\n addCategoryEnabled: true,\n chartType: 'lineCross',\n correctAnswer: {},\n data: [],\n domain: {},\n graph: {\n width: 480,\n height: 480,\n },\n prompt: '',\n promptEnabled: true,\n rationale: '',\n range: {\n label: '',\n max: 1,\n min: 0,\n },\n scoringType: 'all or nothing',\n title: '',\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n studentNewCategoryDefaultLabel: 'New Category',\n changeInteractiveEnabled: false,\n changeEditableEnabled: false,\n changeAddCategoryEnabled: false,\n },\n configuration: {\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n chartDimensions: {\n settings: false,\n label: 'Chart Dimensions',\n showInConfigPanel: true,\n width: {\n min: 50,\n max: 700,\n step: 20,\n },\n height: {\n min: 400,\n max: 700,\n step: 20,\n },\n },\n authorNewCategoryDefaults: {\n settings: false,\n label: 'Category',\n interactive: true,\n editable: false,\n },\n availableChartTypes: {\n bar: 'Bar Chart',\n histogram: 'Histogram',\n lineDot: 'Line Chart ●',\n lineCross: 'Line Chart x',\n dotPlot: 'Dot/Line Plot ⬤',\n linePlot: 'Dot/Line Plot X',\n },\n chartTypeLabel: 'ChartType',\n studentNewCategoryDefaultLabel: {\n settings: false,\n label: 'Category',\n },\n prompt: {\n settings: true,\n label: 'Item Stem',\n required: false,\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n required: false,\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n settingsPanelDisabled: false,\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n required: false,\n },\n title: {\n settings: false,\n label: 'Chart Title',\n },\n instruction: {\n settings: false,\n label:\n 'This item type provides various types of interactive charts. Depending upon how an item is configured,\\n' +\n ' students can change the heights of bars (or other similar chart elements) created by the author; relabel bars\\n' +\n ' created by the author; and/or add new bars, label them, and set their heights.',\n },\n titlePlaceholder: {\n settings: false,\n label: 'Click here to add a title',\n },\n labelsPlaceholders: {\n left: 'Click here to add a label for this axis',\n right: '',\n top: '',\n bottom: 'Click here to add a label for this axis',\n },\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n language: {\n settings: false,\n label: 'Specify Language',\n enabled: false,\n },\n languageChoices: {\n label: 'Language Choices',\n options: [],\n },\n chartingOptions: {\n changeInteractive: {\n settings: false,\n authoringLabel: 'Student can set value',\n settingsLabel: 'Allow non-interactive categories',\n },\n changeEditable: {\n settings: false,\n authoringLabel: 'Student can edit name',\n settingsLabel: 'Allow editable category names',\n },\n addCategory: {\n settings: false,\n authoringLabel: 'Student can add categories',\n settingsLabel: 'Allow changes to whether students can add categories',\n },\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n },\n },\n};\n"],"file":"defaults.js"}
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@material-ui/core": "^3.9.2",
11
11
  "@pie-framework/pie-configure-events": "^1.3.0",
12
- "@pie-lib/pie-toolbox": "1.1.1",
12
+ "@pie-lib/pie-toolbox": "1.2.0",
13
13
  "classnames": "^2.2.5",
14
14
  "debug": "^4.1.1",
15
15
  "prop-types": "^15.6.2",
@@ -305,8 +305,13 @@ var createCorrectResponseSession = function createCorrectResponseSession(questio
305
305
 
306
306
  exports.createCorrectResponseSession = createCorrectResponseSession;
307
307
 
308
+ var getInnerText = function getInnerText(html) {
309
+ return (html || '').replaceAll(/<[^>]*>/g, '');
310
+ };
311
+
308
312
  var validate = function validate() {
309
313
  var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
314
+ var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
310
315
 
311
316
  var _ref4 = model || {},
312
317
  correctAnswer = _ref4.correctAnswer,
@@ -319,10 +324,17 @@ var validate = function validate() {
319
324
  var errors = {};
320
325
  var correctAnswerErrors = {};
321
326
  var categoryErrors = {};
327
+ ['teacherInstructions', 'prompt', 'rationale'].forEach(function (field) {
328
+ var _config$field;
329
+
330
+ if ((_config$field = config[field]) !== null && _config$field !== void 0 && _config$field.required && !getInnerText(model[field])) {
331
+ errors[field] = 'This field is required';
332
+ }
333
+ });
322
334
  categories.forEach(function (category, index) {
323
335
  var label = category.label;
324
336
 
325
- if (label === '' || label === '<div></div>') {
337
+ if (!getInnerText(label)) {
326
338
  categoryErrors[index] = 'Content should not be empty. ';
327
339
  } else {
328
340
  var identicalAnswer = categories.some(function (c, i) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","lowerCase","string","toLowerCase","checkLabelsEquality","givenAnswerLabel","correctAnswerLabel","setCorrectness","answers","partialScoring","map","answer","correctness","value","label","normalize","question","addCategoryEnabled","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","getScore","session","env","correctAnswer","data","initialData","scoringType","isPartialScoring","enabled","undefined","correctAnswers","defaultAnswers","filterCategories","result","maxScore","score","scoreForLabelAndValueEditable","corrAnswer","forEach","index","defaultAnswer","editable","interactive","length","slice","parseFloat","toFixed","categories","deletable","rest","model","Promise","resolve","normalizedQuestion","chartType","domain","graph","prompt","range","rationale","title","teacherInstructions","studentNewCategoryDefaultLabel","language","correctInfo","base","size","disabled","mode","correctedAnswer","role","outcome","empty","createCorrectResponseSession","id","validate","correctData","errors","correctAnswerErrors","categoryErrors","category","identicalAnswer","some","c","i","categoriesError","identicalError"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,kCAAN,CAAZ;;AAEA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAACC,MAAD;AAAA,SAAY,CAACA,MAAM,IAAI,EAAX,EAAeC,WAAf,EAAZ;AAAA,CAAlB;;AAEO,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,gBAAD,EAAmBC,kBAAnB;AAAA,SACjCL,SAAS,CAACI,gBAAD,CAAT,KAAgCJ,SAAS,CAACK,kBAAD,CADR;AAAA,CAA5B;;;;AAGA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,OAAD,EAAUC,cAAV;AAAA,SAC5BD,OAAO,GACHA,OAAO,CAACE,GAAR,CAAY,UAACC,MAAD;AAAA,2CACPA,MADO;AAEVC,MAAAA,WAAW,EAAE;AACXC,QAAAA,KAAK,EAAEJ,cAAc,GAAG,WAAH,GAAiB,SAD3B;AAEXK,QAAAA,KAAK,EAAEL,cAAc,GAAG,WAAH,GAAiB;AAF3B;AAFH;AAAA,GAAZ,CADG,GAQH,EATwB;AAAA,CAAvB;;;;AAWA,IAAMM,SAAS,GAAG,SAAZA,SAAY,CAACC,QAAD;AAAA;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AACAF,IAAAA,mBAAmB,CAACQ,cAApB,GAAqC,qEAArC;AACD;;AAED,MAAI,CAAC,yBAAQP,cAAR,CAAL,EAA8B;AAC5BF,IAAAA,MAAM,CAACE,cAAP,GAAwBA,cAAxB;AACD;;AAED,MAAI,CAAC,yBAAQD,mBAAR,CAAL,EAAmC;AACjCD,IAAAA,MAAM,CAACC,mBAAP,GAA6BA,mBAA7B;AACD;;AAED,SAAOD,MAAP;AACD,CA3CM","sourcesContent":["import debug from 'debug';\nimport isEqual from 'lodash/isEqual';\nimport isEmpty from 'lodash/isEmpty';\nimport pick from 'lodash/pick';\n\nimport { partialScoring } from '@pie-lib/pie-toolbox/controller-utils';\n\nconst log = debug('@pie-element:graphing:controller');\n\nconst lowerCase = (string) => (string || '').toLowerCase();\n\nexport const checkLabelsEquality = (givenAnswerLabel, correctAnswerLabel) =>\n lowerCase(givenAnswerLabel) === lowerCase(correctAnswerLabel);\n\nexport const setCorrectness = (answers, partialScoring) =>\n answers\n ? answers.map((answer) => ({\n ...answer,\n correctness: {\n value: partialScoring ? 'incorrect' : 'correct',\n label: partialScoring ? 'incorrect' : 'correct',\n },\n }))\n : [];\n\nexport const normalize = (question) => ({\n addCategoryEnabled: true,\n promptEnabled: true,\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\nexport const getScore = (question, session, env = {}) => {\n const { correctAnswer, data: initialData = [], scoringType } = question;\n\n const isPartialScoring = partialScoring.enabled(\n { partialScoring: scoringType !== undefined ? scoringType === 'partial scoring' : scoringType },\n env,\n );\n\n const { data: correctAnswers = [] } = correctAnswer || {};\n const defaultAnswers = filterCategories(initialData);\n\n let answers = setCorrectness((session && session.answer) || defaultAnswers, isPartialScoring);\n\n let result = 0;\n\n if (isPartialScoring) {\n // if score type is \"partial scoring\"\n // maxScore is calculated based on the correct response\n // score is calculated based on the given response\n let maxScore = 0;\n let score = 0;\n\n const scoreForLabelAndValueEditable = (answer, corrAnswer) => {\n const { value, label } = answer;\n\n maxScore += 2;\n\n if (value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n\n if (checkLabelsEquality(label, corrAnswer.label)) {\n score += 1;\n answer.correctness.label = 'correct';\n }\n };\n\n // if given answer has more categories than the correct answers, the \"extra\" will be ignored\n correctAnswers.forEach((corrAnswer, index) => {\n const defaultAnswer = defaultAnswers[index];\n const answer = answers[index];\n\n // if there is a corresponding category at the same position in the given answer\n if (answer) {\n // if there is a corresponding category at the same position in the default answer\n if (defaultAnswer) {\n // if category's label (in default answer) was not editable\n // it means that this category values only one point (only the value can be changed)\n if (!defaultAnswer.editable && answer.interactive) {\n maxScore += 1;\n\n if (answer.value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n answer.correctness.label = 'correct';\n\n // if category's label (in default answer) was editable\n // it means that this category values 2 points (both label and value can be changed)\n } else if (defaultAnswer.editable && answer.interactive) {\n scoreForLabelAndValueEditable(answer, corrAnswer);\n } else if (!answer.interactive) {\n answer.correctness.value = 'correct';\n answer.correctness.label = 'correct';\n }\n } else {\n // if there is not a corresponding category at the same position in the default answer\n scoreForLabelAndValueEditable(answer, corrAnswer);\n }\n } else {\n // if there is not a corresponding category at the same position in the given answer\n // it means that the given answer has less categories than the correct answer\n maxScore += 2;\n }\n });\n\n result = maxScore ? score / maxScore : 0;\n } else {\n // if scoring type is \"all or nothing\"\n // the length on correct answers and length of given answer have to match\n result = correctAnswers.length === answers.length ? 1 : 0;\n\n if (result) {\n // if there is at least one difference between the correct answer and the given answer\n // the result will be incorrect\n correctAnswers.forEach((corrAnswer, index) => {\n const { value, label } = answers[index];\n\n if (value !== corrAnswer.value) {\n result = 0;\n answers[index].correctness.value = 'incorrect';\n }\n if (lowerCase(label) !== lowerCase(corrAnswer.label)) {\n result = 0;\n answers[index].correctness.label = 'incorrect';\n }\n });\n } else {\n answers = [\n ...answers.slice(0, correctAnswers.length),\n ...setCorrectness(answers.slice(correctAnswers.length), true),\n ];\n }\n }\n\n return {\n score: parseFloat(result.toFixed(2)),\n answers,\n };\n};\n\n// eslint-disable-next-line no-unused-vars\nexport const filterCategories = (categories) => (categories ? categories.map(({ deletable, ...rest }) => rest) : []);\n\nexport function model(question, session, env) {\n return new Promise((resolve) => {\n const normalizedQuestion = normalize(question);\n const {\n addCategoryEnabled,\n chartType,\n data,\n domain,\n graph,\n prompt,\n promptEnabled,\n range,\n rationale,\n title,\n rationaleEnabled,\n teacherInstructions,\n teacherInstructionsEnabled,\n correctAnswer,\n scoringType,\n studentNewCategoryDefaultLabel,\n language,\n } = normalizedQuestion;\n\n const correctInfo = { correctness: 'incorrect', score: '0%' };\n\n const base = {\n addCategoryEnabled,\n chartType,\n data: filterCategories(data),\n domain,\n graph,\n prompt: promptEnabled ? prompt : null,\n range,\n rationale,\n title,\n size: graph,\n correctness: correctInfo,\n disabled: env.mode !== 'gather',\n scoringType,\n studentNewCategoryDefaultLabel,\n language,\n };\n\n const answers = filterCategories(getScore(normalizedQuestion, session, env).answers);\n\n if (env.mode === 'view') {\n // eslint-disable-next-line no-unused-vars\n base.correctedAnswer = answers.map(({ correctness, ...rest }) => {\n return { ...rest, interactive: false };\n });\n\n base.addCategoryEnabled = false;\n }\n\n if (env.mode === 'evaluate') {\n base.correctedAnswer = answers;\n base.correctAnswer = correctAnswer;\n base.addCategoryEnabled = false;\n }\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n base.rationale = rationaleEnabled ? rationale : null;\n base.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;\n } else {\n base.rationale = null;\n base.teacherInstructions = null;\n }\n\n log('base: ', base);\n resolve(base);\n });\n}\n\nexport function outcome(model, session, env) {\n return new Promise((resolve) => {\n resolve({\n score: getScore(model, session, env).score,\n empty: !session || isEmpty(session),\n });\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctAnswer } = question;\n\n let answers = correctAnswer && correctAnswer.data;\n\n // for IBX preview mode\n if (env.mode === 'gather') {\n const { data } = question;\n\n answers = ((correctAnswer && correctAnswer.data) || []).map((answer, index) => {\n return {\n ...data[index],\n ...answer,\n };\n });\n }\n\n resolve({\n answer: answers,\n id: '1',\n });\n } else {\n return resolve(null);\n }\n });\n};\n\nexport const validate = (model = {}) => {\n const { correctAnswer, data } = model || {};\n const { data: correctData } = correctAnswer || {};\n const categories = correctData || [];\n\n const errors = {};\n const correctAnswerErrors = {};\n const categoryErrors = {};\n\n categories.forEach((category, index) => {\n const { label } = category;\n\n if (label === '' || label === '<div></div>') {\n categoryErrors[index] = 'Content should not be empty. ';\n } else {\n const identicalAnswer = categories.some((c, i) => c.label === label && index !== i);\n\n if (identicalAnswer) {\n categoryErrors[index] = 'Category names should be unique. ';\n }\n }\n });\n\n if (categories.length < 1 || categories.length > 20) {\n correctAnswerErrors.categoriesError = 'The correct answer should include between 1 and 20 categories.';\n } else if (\n isEqual(\n data.map((category) => pick(category, 'value', 'label')),\n correctData.map((category) => pick(category, 'value', 'label')),\n )\n ) {\n correctAnswerErrors.identicalError = 'Correct answer should not be identical to the chart’s initial state';\n }\n\n if (!isEmpty(categoryErrors)) {\n errors.categoryErrors = categoryErrors;\n }\n\n if (!isEmpty(correctAnswerErrors)) {\n errors.correctAnswerErrors = correctAnswerErrors;\n }\n\n return errors;\n};\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","lowerCase","string","toLowerCase","checkLabelsEquality","givenAnswerLabel","correctAnswerLabel","setCorrectness","answers","partialScoring","map","answer","correctness","value","label","normalize","question","addCategoryEnabled","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","getScore","session","env","correctAnswer","data","initialData","scoringType","isPartialScoring","enabled","undefined","correctAnswers","defaultAnswers","filterCategories","result","maxScore","score","scoreForLabelAndValueEditable","corrAnswer","forEach","index","defaultAnswer","editable","interactive","length","slice","parseFloat","toFixed","categories","deletable","rest","model","Promise","resolve","normalizedQuestion","chartType","domain","graph","prompt","range","rationale","title","teacherInstructions","studentNewCategoryDefaultLabel","language","correctInfo","base","size","disabled","mode","correctedAnswer","role","outcome","empty","createCorrectResponseSession","id","getInnerText","html","replaceAll","validate","config","correctData","errors","correctAnswerErrors","categoryErrors","field","required","category","identicalAnswer","some","c","i","categoriesError","identicalError"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,kCAAN,CAAZ;;AAEA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAACC,MAAD;AAAA,SAAY,CAACA,MAAM,IAAI,EAAX,EAAeC,WAAf,EAAZ;AAAA,CAAlB;;AAEO,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,gBAAD,EAAmBC,kBAAnB;AAAA,SACjCL,SAAS,CAACI,gBAAD,CAAT,KAAgCJ,SAAS,CAACK,kBAAD,CADR;AAAA,CAA5B;;;;AAGA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,OAAD,EAAUC,cAAV;AAAA,SAC5BD,OAAO,GACHA,OAAO,CAACE,GAAR,CAAY,UAACC,MAAD;AAAA,2CACPA,MADO;AAEVC,MAAAA,WAAW,EAAE;AACXC,QAAAA,KAAK,EAAEJ,cAAc,GAAG,WAAH,GAAiB,SAD3B;AAEXK,QAAAA,KAAK,EAAEL,cAAc,GAAG,WAAH,GAAiB;AAF3B;AAFH;AAAA,GAAZ,CADG,GAQH,EATwB;AAAA,CAAvB;;;;AAWA,IAAMM,SAAS,GAAG,SAAZA,SAAY,CAACC,QAAD;AAAA;AACvBC,IAAAA,kBAAkB,EAAE,IADG;AAEvBC,IAAAA,aAAa,EAAE,IAFQ;AAGvBC,IAAAA,gBAAgB,EAAE,IAHK;AAIvBC,IAAAA,0BAA0B,EAAE,IAJL;AAKvBC,IAAAA,0BAA0B,EAAE;AALL,KAMpBL,QANoB;A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;AACD,GAFD,MAEO,IACL,yBACEnE,IAAI,CAAChB,GAAL,CAAS,UAAC8E,QAAD;AAAA,WAAc,sBAAKA,QAAL,EAAe,OAAf,EAAwB,OAAxB,CAAd;AAAA,GAAT,CADF,EAEEN,WAAW,CAACxE,GAAZ,CAAgB,UAAC8E,QAAD;AAAA,WAAc,sBAAKA,QAAL,EAAe,OAAf,EAAwB,OAAxB,CAAd;AAAA,GAAhB,CAFF,CADK,EAKL;AACAJ,IAAAA,mBAAmB,CAACU,cAApB,GAAqC,qEAArC;AACD;;AAED,MAAI,CAAC,yBAAQT,cAAR,CAAL,EAA8B;AAC5BF,IAAAA,MAAM,CAACE,cAAP,GAAwBA,cAAxB;AACD;;AAED,MAAI,CAAC,yBAAQD,mBAAR,CAAL,EAAmC;AACjCD,IAAAA,MAAM,CAACC,mBAAP,GAA6BA,mBAA7B;AACD;;AAED,SAAOD,MAAP;AACD,CAjDM","sourcesContent":["import debug from 'debug';\nimport isEqual from 'lodash/isEqual';\nimport isEmpty from 'lodash/isEmpty';\nimport pick from 'lodash/pick';\n\nimport { partialScoring } from '@pie-lib/pie-toolbox/controller-utils';\n\nconst log = debug('@pie-element:graphing:controller');\n\nconst lowerCase = (string) => (string || '').toLowerCase();\n\nexport const checkLabelsEquality = (givenAnswerLabel, correctAnswerLabel) =>\n lowerCase(givenAnswerLabel) === lowerCase(correctAnswerLabel);\n\nexport const setCorrectness = (answers, partialScoring) =>\n answers\n ? answers.map((answer) => ({\n ...answer,\n correctness: {\n value: partialScoring ? 'incorrect' : 'correct',\n label: partialScoring ? 'incorrect' : 'correct',\n },\n }))\n : [];\n\nexport const normalize = (question) => ({\n addCategoryEnabled: true,\n promptEnabled: true,\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\nexport const getScore = (question, session, env = {}) => {\n const { correctAnswer, data: initialData = [], scoringType } = question;\n\n const isPartialScoring = partialScoring.enabled(\n { partialScoring: scoringType !== undefined ? scoringType === 'partial scoring' : scoringType },\n env,\n );\n\n const { data: correctAnswers = [] } = correctAnswer || {};\n const defaultAnswers = filterCategories(initialData);\n\n let answers = setCorrectness((session && session.answer) || defaultAnswers, isPartialScoring);\n\n let result = 0;\n\n if (isPartialScoring) {\n // if score type is \"partial scoring\"\n // maxScore is calculated based on the correct response\n // score is calculated based on the given response\n let maxScore = 0;\n let score = 0;\n\n const scoreForLabelAndValueEditable = (answer, corrAnswer) => {\n const { value, label } = answer;\n\n maxScore += 2;\n\n if (value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n\n if (checkLabelsEquality(label, corrAnswer.label)) {\n score += 1;\n answer.correctness.label = 'correct';\n }\n };\n\n // if given answer has more categories than the correct answers, the \"extra\" will be ignored\n correctAnswers.forEach((corrAnswer, index) => {\n const defaultAnswer = defaultAnswers[index];\n const answer = answers[index];\n\n // if there is a corresponding category at the same position in the given answer\n if (answer) {\n // if there is a corresponding category at the same position in the default answer\n if (defaultAnswer) {\n // if category's label (in default answer) was not editable\n // it means that this category values only one point (only the value can be changed)\n if (!defaultAnswer.editable && answer.interactive) {\n maxScore += 1;\n\n if (answer.value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n answer.correctness.label = 'correct';\n\n // if category's label (in default answer) was editable\n // it means that this category values 2 points (both label and value can be changed)\n } else if (defaultAnswer.editable && answer.interactive) {\n scoreForLabelAndValueEditable(answer, corrAnswer);\n } else if (!answer.interactive) {\n answer.correctness.value = 'correct';\n answer.correctness.label = 'correct';\n }\n } else {\n // if there is not a corresponding category at the same position in the default answer\n scoreForLabelAndValueEditable(answer, corrAnswer);\n }\n } else {\n // if there is not a corresponding category at the same position in the given answer\n // it means that the given answer has less categories than the correct answer\n maxScore += 2;\n }\n });\n\n result = maxScore ? score / maxScore : 0;\n } else {\n // if scoring type is \"all or nothing\"\n // the length on correct answers and length of given answer have to match\n result = correctAnswers.length === answers.length ? 1 : 0;\n\n if (result) {\n // if there is at least one difference between the correct answer and the given answer\n // the result will be incorrect\n correctAnswers.forEach((corrAnswer, index) => {\n const { value, label } = answers[index];\n\n if (value !== corrAnswer.value) {\n result = 0;\n answers[index].correctness.value = 'incorrect';\n }\n if (lowerCase(label) !== lowerCase(corrAnswer.label)) {\n result = 0;\n answers[index].correctness.label = 'incorrect';\n }\n });\n } else {\n answers = [\n ...answers.slice(0, correctAnswers.length),\n ...setCorrectness(answers.slice(correctAnswers.length), true),\n ];\n }\n }\n\n return {\n score: parseFloat(result.toFixed(2)),\n answers,\n };\n};\n\n// eslint-disable-next-line no-unused-vars\nexport const filterCategories = (categories) => (categories ? categories.map(({ deletable, ...rest }) => rest) : []);\n\nexport function model(question, session, env) {\n return new Promise((resolve) => {\n const normalizedQuestion = normalize(question);\n const {\n addCategoryEnabled,\n chartType,\n data,\n domain,\n graph,\n prompt,\n promptEnabled,\n range,\n rationale,\n title,\n rationaleEnabled,\n teacherInstructions,\n teacherInstructionsEnabled,\n correctAnswer,\n scoringType,\n studentNewCategoryDefaultLabel,\n language,\n } = normalizedQuestion;\n\n const correctInfo = { correctness: 'incorrect', score: '0%' };\n\n const base = {\n addCategoryEnabled,\n chartType,\n data: filterCategories(data),\n domain,\n graph,\n prompt: promptEnabled ? prompt : null,\n range,\n rationale,\n title,\n size: graph,\n correctness: correctInfo,\n disabled: env.mode !== 'gather',\n scoringType,\n studentNewCategoryDefaultLabel,\n language,\n };\n\n const answers = filterCategories(getScore(normalizedQuestion, session, env).answers);\n\n if (env.mode === 'view') {\n // eslint-disable-next-line no-unused-vars\n base.correctedAnswer = answers.map(({ correctness, ...rest }) => {\n return { ...rest, interactive: false };\n });\n\n base.addCategoryEnabled = false;\n }\n\n if (env.mode === 'evaluate') {\n base.correctedAnswer = answers;\n base.correctAnswer = correctAnswer;\n base.addCategoryEnabled = false;\n }\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n base.rationale = rationaleEnabled ? rationale : null;\n base.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;\n } else {\n base.rationale = null;\n base.teacherInstructions = null;\n }\n\n log('base: ', base);\n resolve(base);\n });\n}\n\nexport function outcome(model, session, env) {\n return new Promise((resolve) => {\n resolve({\n score: getScore(model, session, env).score,\n empty: !session || isEmpty(session),\n });\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctAnswer } = question;\n\n let answers = correctAnswer && correctAnswer.data;\n\n // for IBX preview mode\n if (env.mode === 'gather') {\n const { data } = question;\n\n answers = ((correctAnswer && correctAnswer.data) || []).map((answer, index) => {\n return {\n ...data[index],\n ...answer,\n };\n });\n }\n\n resolve({\n answer: answers,\n id: '1',\n });\n } else {\n return resolve(null);\n }\n });\n};\n\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { correctAnswer, data } = model || {};\n const { data: correctData } = correctAnswer || {};\n const categories = correctData || [];\n\n const errors = {};\n const correctAnswerErrors = {};\n const categoryErrors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getInnerText(model[field])) {\n errors[field] = 'This field is required';\n }\n });\n\n categories.forEach((category, index) => {\n const { label } = category;\n\n if (!getInnerText(label)) {\n categoryErrors[index] = 'Content should not be empty. ';\n } else {\n const identicalAnswer = categories.some((c, i) => c.label === label && index !== i);\n\n if (identicalAnswer) {\n categoryErrors[index] = 'Category names should be unique. ';\n }\n }\n });\n\n if (categories.length < 1 || categories.length > 20) {\n correctAnswerErrors.categoriesError = 'The correct answer should include between 1 and 20 categories.';\n } else if (\n isEqual(\n data.map((category) => pick(category, 'value', 'label')),\n correctData.map((category) => pick(category, 'value', 'label')),\n )\n ) {\n correctAnswerErrors.identicalError = 'Correct answer should not be identical to the chart’s initial state';\n }\n\n if (!isEmpty(categoryErrors)) {\n errors.categoryErrors = categoryErrors;\n }\n\n if (!isEmpty(correctAnswerErrors)) {\n errors.correctAnswerErrors = correctAnswerErrors;\n }\n\n return errors;\n};\n"],"file":"index.js"}
@@ -9,7 +9,7 @@
9
9
  "test": "./node_modules/.bin/jest"
10
10
  },
11
11
  "dependencies": {
12
- "@pie-lib/pie-toolbox": "1.1.1",
12
+ "@pie-lib/pie-toolbox": "1.2.0",
13
13
  "debug": "^4.1.1",
14
14
  "lodash": "^4.17.15"
15
15
  },
@@ -4,9 +4,14 @@
4
4
  "type": "object",
5
5
  "properties": {
6
6
  "prompt": {
7
- "title": "ConfigureProp",
7
+ "title": "ConfigureRequiredProp",
8
8
  "type": "object",
9
9
  "properties": {
10
+ "required": {
11
+ "description": "Indicates if the item is required and the value cannot be empty",
12
+ "type": "boolean",
13
+ "title": "required"
14
+ },
10
15
  "settings": {
11
16
  "description": "Indicates if the item has to be displayed in the Settings Panel",
12
17
  "type": "boolean",
@@ -20,9 +25,14 @@
20
25
  }
21
26
  },
22
27
  "rationale": {
23
- "title": "ConfigureProp",
28
+ "title": "ConfigureRequiredProp",
24
29
  "type": "object",
25
30
  "properties": {
31
+ "required": {
32
+ "description": "Indicates if the item is required and the value cannot be empty",
33
+ "type": "boolean",
34
+ "title": "required"
35
+ },
26
36
  "settings": {
27
37
  "description": "Indicates if the item has to be displayed in the Settings Panel",
28
38
  "type": "boolean",
@@ -91,6 +101,11 @@
91
101
  "type": "string",
92
102
  "title": "left"
93
103
  },
104
+ "enabled": {
105
+ "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
106
+ "type": "boolean",
107
+ "title": "enabled"
108
+ },
94
109
  "settings": {
95
110
  "description": "Indicates if the item has to be displayed in the Settings Panel",
96
111
  "type": "boolean",
@@ -100,11 +115,6 @@
100
115
  "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
101
116
  "type": "string",
102
117
  "title": "label"
103
- },
104
- "enabled": {
105
- "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
106
- "type": "boolean",
107
- "title": "enabled"
108
118
  }
109
119
  }
110
120
  },
@@ -146,9 +156,14 @@
146
156
  }
147
157
  },
148
158
  "teacherInstructions": {
149
- "title": "ConfigureProp",
159
+ "title": "ConfigureRequiredProp",
150
160
  "type": "object",
151
161
  "properties": {
162
+ "required": {
163
+ "description": "Indicates if the item is required and the value cannot be empty",
164
+ "type": "boolean",
165
+ "title": "required"
166
+ },
152
167
  "settings": {
153
168
  "description": "Indicates if the item has to be displayed in the Settings Panel",
154
169
  "type": "boolean",
@@ -165,6 +180,11 @@
165
180
  "title": "ConfigurePropWithEnabled",
166
181
  "type": "object",
167
182
  "properties": {
183
+ "enabled": {
184
+ "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
185
+ "type": "boolean",
186
+ "title": "enabled"
187
+ },
168
188
  "settings": {
169
189
  "description": "Indicates if the item has to be displayed in the Settings Panel",
170
190
  "type": "boolean",
@@ -174,11 +194,6 @@
174
194
  "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
175
195
  "type": "string",
176
196
  "title": "label"
177
- },
178
- "enabled": {
179
- "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
180
- "type": "boolean",
181
- "title": "enabled"
182
197
  }
183
198
  }
184
199
  },
@@ -420,6 +435,11 @@
420
435
  "title": "ConfigurePropWithEnabled",
421
436
  "type": "object",
422
437
  "properties": {
438
+ "enabled": {
439
+ "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
440
+ "type": "boolean",
441
+ "title": "enabled"
442
+ },
423
443
  "settings": {
424
444
  "description": "Indicates if the item has to be displayed in the Settings Panel",
425
445
  "type": "boolean",
@@ -429,11 +449,6 @@
429
449
  "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
430
450
  "type": "string",
431
451
  "title": "label"
432
- },
433
- "enabled": {
434
- "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
435
- "type": "boolean",
436
- "title": "enabled"
437
452
  }
438
453
  }
439
454
  },
@@ -544,6 +559,27 @@
544
559
  "chartTypeLabel"
545
560
  ],
546
561
  "definitions": {
562
+ "ConfigureRequiredProp": {
563
+ "title": "ConfigureRequiredProp",
564
+ "type": "object",
565
+ "properties": {
566
+ "required": {
567
+ "description": "Indicates if the item is required and the value cannot be empty",
568
+ "type": "boolean",
569
+ "title": "required"
570
+ },
571
+ "settings": {
572
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
573
+ "type": "boolean",
574
+ "title": "settings"
575
+ },
576
+ "label": {
577
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
578
+ "type": "string",
579
+ "title": "label"
580
+ }
581
+ }
582
+ },
547
583
  "ConfigureProp": {
548
584
  "title": "ConfigureProp",
549
585
  "type": "object",
@@ -584,6 +620,11 @@
584
620
  "type": "string",
585
621
  "title": "left"
586
622
  },
623
+ "enabled": {
624
+ "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
625
+ "type": "boolean",
626
+ "title": "enabled"
627
+ },
587
628
  "settings": {
588
629
  "description": "Indicates if the item has to be displayed in the Settings Panel",
589
630
  "type": "boolean",
@@ -593,11 +634,6 @@
593
634
  "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
594
635
  "type": "string",
595
636
  "title": "label"
596
- },
597
- "enabled": {
598
- "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
599
- "type": "boolean",
600
- "title": "enabled"
601
637
  }
602
638
  }
603
639
  },
@@ -605,6 +641,11 @@
605
641
  "title": "ConfigurePropWithEnabled",
606
642
  "type": "object",
607
643
  "properties": {
644
+ "enabled": {
645
+ "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
646
+ "type": "boolean",
647
+ "title": "enabled"
648
+ },
608
649
  "settings": {
609
650
  "description": "Indicates if the item has to be displayed in the Settings Panel",
610
651
  "type": "boolean",
@@ -614,11 +655,6 @@
614
655
  "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
615
656
  "type": "string",
616
657
  "title": "label"
617
- },
618
- "enabled": {
619
- "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
620
- "type": "boolean",
621
- "title": "enabled"
622
658
  }
623
659
  }
624
660
  },
@@ -6,6 +6,10 @@ The schema defines the following properties:
6
6
 
7
7
  Properties of the `prompt` object:
8
8
 
9
+ ## `required` (boolean)
10
+
11
+ Indicates if the item is required and the value cannot be empty
12
+
9
13
  ## `settings` (boolean)
10
14
 
11
15
  Indicates if the item has to be displayed in the Settings Panel
@@ -18,6 +22,10 @@ Indicates the label for the item that has to be displayed in the Settings Panel
18
22
 
19
23
  Properties of the `rationale` object:
20
24
 
25
+ ## `required` (boolean)
26
+
27
+ Indicates if the item is required and the value cannot be empty
28
+
21
29
  ## `settings` (boolean)
22
30
 
23
31
  Indicates if the item has to be displayed in the Settings Panel
@@ -70,6 +78,11 @@ Indicates the placeholder for the bottom label
70
78
 
71
79
  Indicates the placeholder for the left label
72
80
 
81
+ ## `enabled` (boolean)
82
+
83
+ Indicates the value of the item if it affects config-ui
84
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
85
+
73
86
  ## `settings` (boolean)
74
87
 
75
88
  Indicates if the item has to be displayed in the Settings Panel
@@ -78,11 +91,6 @@ Indicates if the item has to be displayed in the Settings Panel
78
91
 
79
92
  Indicates the label for the item that has to be displayed in the Settings Panel
80
93
 
81
- ## `enabled` (boolean)
82
-
83
- Indicates the value of the item if it affects config-ui
84
- (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
85
-
86
94
  # `scoringType` (object)
87
95
 
88
96
  Properties of the `scoringType` object:
@@ -115,6 +123,10 @@ Indicates the label for the item that has to be displayed in the Settings Panel
115
123
 
116
124
  Properties of the `teacherInstructions` object:
117
125
 
126
+ ## `required` (boolean)
127
+
128
+ Indicates if the item is required and the value cannot be empty
129
+
118
130
  ## `settings` (boolean)
119
131
 
120
132
  Indicates if the item has to be displayed in the Settings Panel
@@ -127,6 +139,11 @@ Indicates the label for the item that has to be displayed in the Settings Panel
127
139
 
128
140
  Properties of the `title` object:
129
141
 
142
+ ## `enabled` (boolean)
143
+
144
+ Indicates the value of the item if it affects config-ui
145
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
146
+
130
147
  ## `settings` (boolean)
131
148
 
132
149
  Indicates if the item has to be displayed in the Settings Panel
@@ -135,11 +152,6 @@ Indicates if the item has to be displayed in the Settings Panel
135
152
 
136
153
  Indicates the label for the item that has to be displayed in the Settings Panel
137
154
 
138
- ## `enabled` (boolean)
139
-
140
- Indicates the value of the item if it affects config-ui
141
- (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
142
-
143
155
  # `instruction` (object)
144
156
 
145
157
  Properties of the `instruction` object:
@@ -316,6 +328,11 @@ Indicates the label for the chart type
316
328
 
317
329
  Properties of the `language` object:
318
330
 
331
+ ## `enabled` (boolean)
332
+
333
+ Indicates the value of the item if it affects config-ui
334
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
335
+
319
336
  ## `settings` (boolean)
320
337
 
321
338
  Indicates if the item has to be displayed in the Settings Panel
@@ -324,11 +341,6 @@ Indicates if the item has to be displayed in the Settings Panel
324
341
 
325
342
  Indicates the label for the item that has to be displayed in the Settings Panel
326
343
 
327
- ## `enabled` (boolean)
328
-
329
- Indicates the value of the item if it affects config-ui
330
- (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
331
-
332
344
  # `languageChoices` (object)
333
345
 
334
346
  Language choices configuration
@@ -410,6 +422,22 @@ Default: `true`
410
422
 
411
423
  The schema defines the following additional types:
412
424
 
425
+ ## `ConfigureRequiredProp` (object)
426
+
427
+ Properties of the `ConfigureRequiredProp` object:
428
+
429
+ ### `required` (boolean)
430
+
431
+ Indicates if the item is required and the value cannot be empty
432
+
433
+ ### `settings` (boolean)
434
+
435
+ Indicates if the item has to be displayed in the Settings Panel
436
+
437
+ ### `label` (string)
438
+
439
+ Indicates the label for the item that has to be displayed in the Settings Panel
440
+
413
441
  ## `ConfigureProp` (object)
414
442
 
415
443
  Properties of the `ConfigureProp` object:
@@ -442,6 +470,11 @@ Indicates the placeholder for the bottom label
442
470
 
443
471
  Indicates the placeholder for the left label
444
472
 
473
+ ### `enabled` (boolean)
474
+
475
+ Indicates the value of the item if it affects config-ui
476
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
477
+
445
478
  ### `settings` (boolean)
446
479
 
447
480
  Indicates if the item has to be displayed in the Settings Panel
@@ -450,15 +483,15 @@ Indicates if the item has to be displayed in the Settings Panel
450
483
 
451
484
  Indicates the label for the item that has to be displayed in the Settings Panel
452
485
 
486
+ ## `ConfigurePropWithEnabled` (object)
487
+
488
+ Properties of the `ConfigurePropWithEnabled` object:
489
+
453
490
  ### `enabled` (boolean)
454
491
 
455
492
  Indicates the value of the item if it affects config-ui
456
493
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
457
494
 
458
- ## `ConfigurePropWithEnabled` (object)
459
-
460
- Properties of the `ConfigurePropWithEnabled` object:
461
-
462
495
  ### `settings` (boolean)
463
496
 
464
497
  Indicates if the item has to be displayed in the Settings Panel
@@ -467,11 +500,6 @@ Indicates if the item has to be displayed in the Settings Panel
467
500
 
468
501
  Indicates the label for the item that has to be displayed in the Settings Panel
469
502
 
470
- ### `enabled` (boolean)
471
-
472
- Indicates the value of the item if it affects config-ui
473
- (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
474
-
475
503
  ## `AuthorNewCategoryDefaults` (object)
476
504
 
477
505
  Properties of the `AuthorNewCategoryDefaults` object:
@@ -560,6 +560,27 @@
560
560
  "teacherInstructionsEnabled"
561
561
  ],
562
562
  "definitions": {
563
+ "ConfigureRequiredProp": {
564
+ "title": "ConfigureRequiredProp",
565
+ "type": "object",
566
+ "properties": {
567
+ "required": {
568
+ "description": "Indicates if the item is required and the value cannot be empty",
569
+ "type": "boolean",
570
+ "title": "required"
571
+ },
572
+ "settings": {
573
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
574
+ "type": "boolean",
575
+ "title": "settings"
576
+ },
577
+ "label": {
578
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
579
+ "type": "string",
580
+ "title": "label"
581
+ }
582
+ }
583
+ },
563
584
  "ConfigureProp": {
564
585
  "title": "ConfigureProp",
565
586
  "type": "object",
@@ -600,6 +621,11 @@
600
621
  "type": "string",
601
622
  "title": "left"
602
623
  },
624
+ "enabled": {
625
+ "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
626
+ "type": "boolean",
627
+ "title": "enabled"
628
+ },
603
629
  "settings": {
604
630
  "description": "Indicates if the item has to be displayed in the Settings Panel",
605
631
  "type": "boolean",
@@ -609,11 +635,6 @@
609
635
  "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
610
636
  "type": "string",
611
637
  "title": "label"
612
- },
613
- "enabled": {
614
- "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
615
- "type": "boolean",
616
- "title": "enabled"
617
638
  }
618
639
  }
619
640
  },
@@ -621,6 +642,11 @@
621
642
  "title": "ConfigurePropWithEnabled",
622
643
  "type": "object",
623
644
  "properties": {
645
+ "enabled": {
646
+ "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
647
+ "type": "boolean",
648
+ "title": "enabled"
649
+ },
624
650
  "settings": {
625
651
  "description": "Indicates if the item has to be displayed in the Settings Panel",
626
652
  "type": "boolean",
@@ -630,11 +656,6 @@
630
656
  "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
631
657
  "type": "string",
632
658
  "title": "label"
633
- },
634
- "enabled": {
635
- "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
636
- "type": "boolean",
637
- "title": "enabled"
638
659
  }
639
660
  }
640
661
  },
@@ -201,6 +201,22 @@ The html Element tag name
201
201
 
202
202
  The schema defines the following additional types:
203
203
 
204
+ ## `ConfigureRequiredProp` (object)
205
+
206
+ Properties of the `ConfigureRequiredProp` object:
207
+
208
+ ### `required` (boolean)
209
+
210
+ Indicates if the item is required and the value cannot be empty
211
+
212
+ ### `settings` (boolean)
213
+
214
+ Indicates if the item has to be displayed in the Settings Panel
215
+
216
+ ### `label` (string)
217
+
218
+ Indicates the label for the item that has to be displayed in the Settings Panel
219
+
204
220
  ## `ConfigureProp` (object)
205
221
 
206
222
  Properties of the `ConfigureProp` object:
@@ -233,6 +249,11 @@ Indicates the placeholder for the bottom label
233
249
 
234
250
  Indicates the placeholder for the left label
235
251
 
252
+ ### `enabled` (boolean)
253
+
254
+ Indicates the value of the item if it affects config-ui
255
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
256
+
236
257
  ### `settings` (boolean)
237
258
 
238
259
  Indicates if the item has to be displayed in the Settings Panel
@@ -241,15 +262,15 @@ Indicates if the item has to be displayed in the Settings Panel
241
262
 
242
263
  Indicates the label for the item that has to be displayed in the Settings Panel
243
264
 
265
+ ## `ConfigurePropWithEnabled` (object)
266
+
267
+ Properties of the `ConfigurePropWithEnabled` object:
268
+
244
269
  ### `enabled` (boolean)
245
270
 
246
271
  Indicates the value of the item if it affects config-ui
247
272
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
248
273
 
249
- ## `ConfigurePropWithEnabled` (object)
250
-
251
- Properties of the `ConfigurePropWithEnabled` object:
252
-
253
274
  ### `settings` (boolean)
254
275
 
255
276
  Indicates if the item has to be displayed in the Settings Panel
@@ -258,11 +279,6 @@ Indicates if the item has to be displayed in the Settings Panel
258
279
 
259
280
  Indicates the label for the item that has to be displayed in the Settings Panel
260
281
 
261
- ### `enabled` (boolean)
262
-
263
- Indicates the value of the item if it affects config-ui
264
- (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
265
-
266
282
  ## `AuthorNewCategoryDefaults` (object)
267
283
 
268
284
  Properties of the `AuthorNewCategoryDefaults` object:
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "7.1.1",
7
+ "version": "7.1.2-next.16+1d20148ed",
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "@material-ui/core": "^3.9.2",
15
15
  "@pie-framework/pie-player-events": "^0.1.0",
16
- "@pie-lib/pie-toolbox": "1.1.1",
16
+ "@pie-lib/pie-toolbox": "1.2.0",
17
17
  "classnames": "^2.2.5",
18
18
  "debug": "^4.1.1",
19
19
  "lodash": "^4.17.15",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "author": "",
24
24
  "license": "ISC",
25
- "gitHead": "41ec62fd9015443d35df1370d164c9e605e4d9d6",
25
+ "gitHead": "1d20148ed6abb750252b3cf604080abe71af5194",
26
26
  "main": "lib/index.js",
27
27
  "module": "src/index.js"
28
28
  }