@pie-element/multiple-choice 12.0.0-next.42 → 12.1.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configure/lib/defaults.js +3 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +7 -7
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +2 -2
- package/configure/lib/main.js.map +1 -1
- package/configure/package.json +7 -7
- package/controller/lib/index.js +5 -5
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +2 -3
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +3 -3
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/print.js +3 -4
- package/lib/print.js.map +1 -1
- package/module/configure.js +1 -1
- package/module/controller.js +1551 -3664
- package/module/element.js +1 -1
- package/module/index.html +1 -1
- package/module/manifest.json +3 -3
- package/module/print.html +1 -1
- package/module/print.js +1 -0
- package/package.json +18 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","names":["_default","exports","default","model","choiceMode","choicePrefix","choices","choicesLayout","feedbackEnabled","gridColumns","lockChoiceOrder","partialScoring","prompt","promptEnabled","rationale","rationaleEnabled","scoringType","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","selectedAnswerBackgroundColor","keyboardEventsEnabled","configuration","baseInputConfiguration","
|
|
1
|
+
{"version":3,"file":"defaults.js","names":["_default","exports","default","model","choiceMode","choicePrefix","choices","choicesLayout","feedbackEnabled","gridColumns","lockChoiceOrder","partialScoring","prompt","promptEnabled","rationale","rationaleEnabled","scoringType","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","selectedAnswerBackgroundColor","keyboardEventsEnabled","configuration","baseInputConfiguration","h3","disabled","audio","video","image","textAlign","showParagraphs","separateParagraphs","inputConfiguration","spellCheck","label","settings","enabled","answerChoiceCount","addChoiceButton","deleteChoice","feedback","required","studentInstructions","minAnswerChoices","maxAnswerChoices","maxImageWidth","maxImageHeight","withRubric","mathMlOptions","mmlOutput","mmlEditing","language","languageChoices","options"],"sources":["../src/defaults.js"],"sourcesContent":["/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType\n * functionalities are not defined yet - the value for those can belong to\n * model or to configure\n */\nexport default {\n model: {\n choiceMode: 'checkbox',\n choicePrefix: 'letters',\n choices: [],\n choicesLayout: 'vertical',\n feedbackEnabled: false,\n gridColumns: 2,\n lockChoiceOrder: true,\n partialScoring: true,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n scoringType: 'auto',\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n selectedAnswerBackgroundColor: 'initial',\n keyboardEventsEnabled: false,\n },\n configuration: {\n baseInputConfiguration: {\n h3: { disabled: true },\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n textAlign: { disabled: true },\n showParagraphs: { disabled: false },\n separateParagraphs: { disabled: true },\n },\n choices: {\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n },\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n choicesLayout: {\n settings: false,\n label: 'Choices Layout',\n },\n gridColumns: {\n label: 'Grid columns',\n },\n answerChoiceCount: 0,\n addChoiceButton: {\n settings: true,\n label: 'Add a Choice',\n },\n choiceMode: {\n settings: true,\n label: 'Response Type',\n },\n choicePrefix: {\n settings: true,\n label: 'Choice Labels',\n },\n deleteChoice: {\n settings: true,\n },\n feedback: {\n settings: true,\n label: 'Feedback',\n },\n prompt: {\n settings: true,\n label: 'Prompt',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n lockChoiceOrder: {\n settings: true,\n label: 'Lock Choice Order',\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n inputConfiguration: {\n audio: { disabled: true },\n video: { disabled: true },\n image: { disabled: false },\n },\n required: false,\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n toolbarEditorPosition: {\n settings: false,\n label: 'Toolbar Editor Position',\n },\n minAnswerChoices: 2,\n maxAnswerChoices: 5,\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 636,\n choices: 900,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n choices: 300,\n },\n withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n language: {\n settings: false,\n label: 'Specify Language',\n enabled: false,\n },\n languageChoices: {\n label: 'Language Choices',\n options: [],\n },\n },\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAHA,IAAAA,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAIe;EACbC,KAAK,EAAE;IACLC,UAAU,EAAE,UAAU;IACtBC,YAAY,EAAE,SAAS;IACvBC,OAAO,EAAE,EAAE;IACXC,aAAa,EAAE,UAAU;IACzBC,eAAe,EAAE,KAAK;IACtBC,WAAW,EAAE,CAAC;IACdC,eAAe,EAAE,IAAI;IACrBC,cAAc,EAAE,IAAI;IACpBC,MAAM,EAAE,EAAE;IACVC,aAAa,EAAE,IAAI;IACnBC,SAAS,EAAE,EAAE;IACbC,gBAAgB,EAAE,IAAI;IACtBC,WAAW,EAAE,MAAM;IACnBC,0BAA0B,EAAE,IAAI;IAChCC,mBAAmB,EAAE,EAAE;IACvBC,0BAA0B,EAAE,IAAI;IAChCC,qBAAqB,EAAE,QAAQ;IAC/BC,6BAA6B,EAAE,SAA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AE,KAAK;MACfD,KAAK,EAAE;IACT,CAAC;IACDS,gBAAgB,EAAE,CAAC;IACnBC,gBAAgB,EAAE,CAAC;IACnBC,aAAa,EAAE;MACb5B,mBAAmB,EAAE,GAAG;MACxBN,MAAM,EAAE,GAAG;MACXE,SAAS,EAAE,GAAG;MACdR,OAAO,EAAE;IACX,CAAC;IACDyC,cAAc,EAAE;MACd7B,mBAAmB,EAAE,GAAG;MACxBN,MAAM,EAAE,GAAG;MACXE,SAAS,EAAE,GAAG;MACdR,OAAO,EAAE;IACX,CAAC;IACD0C,UAAU,EAAE;MACVZ,QAAQ,EAAE,KAAK;MACfD,KAAK,EAAE;IACT,CAAC;IACDc,aAAa,EAAE;MACbC,SAAS,EAAE,KAAK;MAChBC,UAAU,EAAE;IACd,CAAC;IACDC,QAAQ,EAAE;MACRhB,QAAQ,EAAE,KAAK;MACfD,KAAK,EAAE,kBAAkB;MACzBE,OAAO,EAAE;IACX,CAAC;IACDgB,eAAe,EAAE;MACflB,KAAK,EAAE,kBAAkB;MACzBmB,OAAO,EAAE;IACX;EACF;AACF,CAAC","ignoreList":[]}
|
package/configure/lib/index.js
CHANGED
|
@@ -12,8 +12,8 @@ var _debug = _interopRequireDefault(require("debug"));
|
|
|
12
12
|
var _pieConfigureEvents = require("@pie-framework/pie-configure-events");
|
|
13
13
|
var _main = _interopRequireDefault(require("./main"));
|
|
14
14
|
var _configUi = require("@pie-lib/config-ui");
|
|
15
|
-
var
|
|
16
|
-
var
|
|
15
|
+
var _lodashEs = require("lodash-es");
|
|
16
|
+
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
17
17
|
const log = (0, _debug.default)('multiple-choice:configure');
|
|
18
18
|
const generateFormattedChoices = (choices, choiceCount = 0) => {
|
|
19
19
|
if (!choices || choices.length === 0) {
|
|
@@ -33,7 +33,7 @@ const generateFormattedChoices = (choices, choiceCount = 0) => {
|
|
|
33
33
|
return choices;
|
|
34
34
|
};
|
|
35
35
|
const prepareCustomizationObject = (config, model) => {
|
|
36
|
-
const configuration = (0,
|
|
36
|
+
const configuration = (0, _lodashEs.defaults)(config, _defaults.default.configuration);
|
|
37
37
|
return {
|
|
38
38
|
configuration,
|
|
39
39
|
model: {
|
|
@@ -48,7 +48,7 @@ class MultipleChoice extends HTMLElement {
|
|
|
48
48
|
this._root = null;
|
|
49
49
|
this._reactContainer = null;
|
|
50
50
|
this._model = MultipleChoice.createDefaultModel();
|
|
51
|
-
this._configuration =
|
|
51
|
+
this._configuration = _defaults.default.configuration;
|
|
52
52
|
this.onModelChanged = this.onModelChanged.bind(this);
|
|
53
53
|
this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
|
|
54
54
|
}
|
|
@@ -60,7 +60,7 @@ class MultipleChoice extends HTMLElement {
|
|
|
60
60
|
const info = prepareCustomizationObject(c, this._model);
|
|
61
61
|
this.onModelChanged(info.model);
|
|
62
62
|
const newConfiguration = {
|
|
63
|
-
...
|
|
63
|
+
..._defaults.default.configuration,
|
|
64
64
|
...info.configuration
|
|
65
65
|
};
|
|
66
66
|
this._configuration = newConfiguration;
|
|
@@ -199,13 +199,13 @@ class MultipleChoice extends HTMLElement {
|
|
|
199
199
|
exports.default = MultipleChoice;
|
|
200
200
|
(0, _defineProperty2.default)(MultipleChoice, "createDefaultModel", (model = {}) => {
|
|
201
201
|
const normalizedModel = _configUi.choiceUtils.normalizeChoices({
|
|
202
|
-
...
|
|
202
|
+
..._defaults.default.model,
|
|
203
203
|
...model,
|
|
204
204
|
choices: generateFormattedChoices(model && model.choices || [])
|
|
205
205
|
});
|
|
206
206
|
|
|
207
207
|
// This is used for offering support for old models which have the property "verticalMode"
|
|
208
|
-
normalizedModel.choicesLayout = model.choicesLayout || model.verticalMode === false && 'horizontal' ||
|
|
208
|
+
normalizedModel.choicesLayout = model.choicesLayout || model.verticalMode === false && 'horizontal' || _defaults.default.model.choicesLayout;
|
|
209
209
|
return normalizedModel;
|
|
210
210
|
});
|
|
211
211
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_debug","_pieConfigureEvents","_main","_configUi","_defaults","_defaults2","log","debug","generateFormattedChoices","choices","choiceCount","length","formattedChoices","i","push","value","label","feedback","type","prepareCustomizationObject","config","model","configuration","defaults","sensibleDefaults","answerChoiceCount","MultipleChoice","HTMLElement","constructor","_root","_reactContainer","_model","createDefaultModel","_configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","info","newConfiguration","language","enabled","languageChoices","options","settings","find","option","disableSidePanel","_disableSidePanel","dispatchModelUpdated","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","insertImage","handler","InsertImageEvent","onDeleteImage","src","done","DeleteImageEvent","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","console","element","React","createElement","Main","imageSupport","add","delete","uploadSoundSupport","document","className","appendChild","createRoot","render","error","stack","connectedCallback","disconnectedCallback","unmount","exports","default","_defineProperty2","normalizedModel","utils","normalizeChoices","choicesLayout","verticalMode"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport debug from 'debug';\nimport {\n DeleteImageEvent,\n InsertImageEvent,\n ModelUpdatedEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './main';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport defaults from 'lodash/defaults';\n\nimport sensibleDefaults from './defaults';\n\nconst log = debug('multiple-choice:configure');\n\nconst generateFormattedChoices = (choices, choiceCount = 0) => {\n if (!choices || choices.length === 0) {\n let formattedChoices = [];\n\n for (let i = 0; i < choiceCount; i++) {\n formattedChoices.push({\n value: `${i}`,\n label: '',\n feedback: {\n type: 'none',\n value: '',\n },\n });\n }\n\n return formattedChoices;\n }\n\n return choices;\n};\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n\n return {\n configuration,\n model: {\n ...model,\n choices: generateFormattedChoices(\n (model && model.choices) || [],\n configuration && configuration.answerChoiceCount,\n ),\n },\n };\n};\n\nexport default class MultipleChoice extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const normalizedModel = utils.normalizeChoices({\n ...sensibleDefaults.model,\n ...model,\n choices: generateFormattedChoices((model && model.choices) || []),\n });\n\n // This is used for offering support for old models which have the property \"verticalMode\"\n normalizedModel.choicesLayout =\n model.choicesLayout || (model.verticalMode === false && 'horizontal') || sensibleDefaults.model.choicesLayout;\n\n return normalizedModel;\n };\n\n constructor() {\n super();\n this._root = null;\n this._reactContainer = null;\n this._model = MultipleChoice.createDefaultModel();\n this._configuration = sensibleDefaults.configuration;\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(s) {\n this._model = MultipleChoice.createDefaultModel(s);\n\n this._render();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n\n const newConfiguration = {\n ...sensibleDefaults.configuration,\n ...info.configuration,\n };\n this._configuration = newConfiguration;\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n if (newConfiguration?.language?.enabled) {\n if (newConfiguration?.languageChoices?.options?.length) {\n this._model.language = newConfiguration?.languageChoices.options[0].value;\n }\n } else if (newConfiguration.language.settings && this._model.language) {\n this._configuration.language.enabled = true;\n\n if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {\n this._configuration.languageChoices.options = [];\n }\n\n // check if the language is already included in the languageChoices.options array\n // and if not, then add it.\n if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {\n this._configuration.languageChoices.options.push({\n value: this._model.language,\n label: this._model.language,\n });\n }\n } else {\n delete this._model.language;\n }\n\n this._render();\n }\n\n set disableSidePanel(s) {\n this._disableSidePanel = s;\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged(m, reset) {\n this._model = m;\n this._render();\n\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n this._configuration = prepareCustomizationObject(c, this._model).configuration;\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n }\n\n /** @param {done, progress, file} handler */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\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 _render() {\n console.log('🔧 [multiple-choice-configure] _render - Starting render');\n console.log('🔧 [multiple-choice-configure] _render - Model:', this._model ? 'present' : 'missing');\n console.log('🔧 [multiple-choice-configure] _render - Configuration:', this._configuration ? 'present' : 'missing');\n console.log('🔧 [multiple-choice-configure] _render - Root exists:', !!this._root);\n log('_render - Starting render');\n log('_render - Model:', this._model ? 'present' : 'missing');\n log('_render - Configuration:', this._configuration ? 'present' : 'missing');\n log('_render - Root exists:', !!this._root);\n \n try {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n disableSidePanel: this._disableSidePanel,\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n if (!this._root) {\n console.log('🔧 [multiple-choice-configure] _render - Creating React container');\n log('_render - Creating React container');\n \n // Create a container div for React to render into\n this._reactContainer = document.createElement('div');\n this._reactContainer.className = 'pie-configure-wrapper';\n this.appendChild(this._reactContainer);\n \n console.log('🔧 [multiple-choice-configure] _render - Creating new React root');\n log('_render - Creating new React root');\n this._root = createRoot(this._reactContainer);\n console.log('✅ [multiple-choice-configure] _render - React root created successfully');\n log('_render - React root created successfully');\n }\n \n console.log('🔧 [multiple-choice-configure] _render - Calling root.render()');\n log('_render - Calling root.render()');\n this._root.render(element);\n console.log('✅ [multiple-choice-configure] _render - Render completed successfully');\n log('_render - Render completed successfully');\n } catch (error) {\n console.error('❌ [multiple-choice-configure] Render error:', error);\n console.error('Error stack:', error.stack);\n throw error;\n }\n }\n\n connectedCallback() {\n console.log('🔧 [multiple-choice-configure] connectedCallback - Component connected to DOM');\n log('connectedCallback - Component connected to DOM');\n log('connectedCallback - Model:', this._model ? 'present' : 'missing');\n log('connectedCallback - Configuration:', this._configuration ? 'present' : 'missing');\n }\n\n disconnectedCallback() {\n console.log('🔧 [multiple-choice-configure] disconnectedCallback - Component disconnected from DOM');\n log('disconnectedCallback - Component disconnected from DOM');\n if (this._root) {\n console.log('🔧 [multiple-choice-configure] disconnectedCallback - Unmounting React root');\n log('disconnectedCallback - Unmounting React root');\n this._root.unmount();\n this._root = null;\n }\n if (this._reactContainer) {\n this._reactContainer = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAP,sBAAA,CAAAC,OAAA;AAEA,IAAAO,UAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA,MAAMQ,GAAG,GAAG,IAAAC,cAAK,EAAC,2BAA2B,CAAC;AAE9C,MAAMC,wBAAwB,GAAGA,CAACC,OAAO,EAAEC,WAAW,GAAG,CAAC,KAAK;E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,KAAK,CAACwE,aAAa,IAAKxE,KAAK,CAACyE,YAAY,KAAK,KAAK,IAAI,YAAa,IAAItE,kBAAgB,CAACH,KAAK,CAACwE,aAAa;EAE/G,OAAOH,eAAe;AACxB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_debug","_pieConfigureEvents","_main","_configUi","_lodashEs","_defaults","log","debug","generateFormattedChoices","choices","choiceCount","length","formattedChoices","i","push","value","label","feedback","type","prepareCustomizationObject","config","model","configuration","defaults","sensibleDefaults","answerChoiceCount","MultipleChoice","HTMLElement","constructor","_root","_reactContainer","_model","createDefaultModel","_configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","info","newConfiguration","language","enabled","languageChoices","options","settings","find","option","disableSidePanel","_disableSidePanel","dispatchModelUpdated","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","insertImage","handler","InsertImageEvent","onDeleteImage","src","done","DeleteImageEvent","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","console","element","React","createElement","Main","imageSupport","add","delete","uploadSoundSupport","document","className","appendChild","createRoot","render","error","stack","connectedCallback","disconnectedCallback","unmount","exports","default","_defineProperty2","normalizedModel","utils","normalizeChoices","choicesLayout","verticalMode"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport debug from 'debug';\nimport {\n DeleteImageEvent,\n InsertImageEvent,\n ModelUpdatedEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './main';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport { defaults } from 'lodash-es';\n\nimport sensibleDefaults from './defaults';\n\nconst log = debug('multiple-choice:configure');\n\nconst generateFormattedChoices = (choices, choiceCount = 0) => {\n if (!choices || choices.length === 0) {\n let formattedChoices = [];\n\n for (let i = 0; i < choiceCount; i++) {\n formattedChoices.push({\n value: `${i}`,\n label: '',\n feedback: {\n type: 'none',\n value: '',\n },\n });\n }\n\n return formattedChoices;\n }\n\n return choices;\n};\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n\n return {\n configuration,\n model: {\n ...model,\n choices: generateFormattedChoices(\n (model && model.choices) || [],\n configuration && configuration.answerChoiceCount,\n ),\n },\n };\n};\n\nexport default class MultipleChoice extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const normalizedModel = utils.normalizeChoices({\n ...sensibleDefaults.model,\n ...model,\n choices: generateFormattedChoices((model && model.choices) || []),\n });\n\n // This is used for offering support for old models which have the property \"verticalMode\"\n normalizedModel.choicesLayout =\n model.choicesLayout || (model.verticalMode === false && 'horizontal') || sensibleDefaults.model.choicesLayout;\n\n return normalizedModel;\n };\n\n constructor() {\n super();\n this._root = null;\n this._reactContainer = null;\n this._model = MultipleChoice.createDefaultModel();\n this._configuration = sensibleDefaults.configuration;\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(s) {\n this._model = MultipleChoice.createDefaultModel(s);\n\n this._render();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n\n const newConfiguration = {\n ...sensibleDefaults.configuration,\n ...info.configuration,\n };\n this._configuration = newConfiguration;\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n if (newConfiguration?.language?.enabled) {\n if (newConfiguration?.languageChoices?.options?.length) {\n this._model.language = newConfiguration?.languageChoices.options[0].value;\n }\n } else if (newConfiguration.language.settings && this._model.language) {\n this._configuration.language.enabled = true;\n\n if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {\n this._configuration.languageChoices.options = [];\n }\n\n // check if the language is already included in the languageChoices.options array\n // and if not, then add it.\n if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {\n this._configuration.languageChoices.options.push({\n value: this._model.language,\n label: this._model.language,\n });\n }\n } else {\n delete this._model.language;\n }\n\n this._render();\n }\n\n set disableSidePanel(s) {\n this._disableSidePanel = s;\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged(m, reset) {\n this._model = m;\n this._render();\n\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n this._configuration = prepareCustomizationObject(c, this._model).configuration;\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n }\n\n /** @param {done, progress, file} handler */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\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 _render() {\n console.log('🔧 [multiple-choice-configure] _render - Starting render');\n console.log('🔧 [multiple-choice-configure] _render - Model:', this._model ? 'present' : 'missing');\n console.log('🔧 [multiple-choice-configure] _render - Configuration:', this._configuration ? 'present' : 'missing');\n console.log('🔧 [multiple-choice-configure] _render - Root exists:', !!this._root);\n log('_render - Starting render');\n log('_render - Model:', this._model ? 'present' : 'missing');\n log('_render - Configuration:', this._configuration ? 'present' : 'missing');\n log('_render - Root exists:', !!this._root);\n\n try {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n disableSidePanel: this._disableSidePanel,\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n if (!this._root) {\n console.log('🔧 [multiple-choice-configure] _render - Creating React container');\n log('_render - Creating React container');\n\n // Create a container div for React to render into\n this._reactContainer = document.createElement('div');\n this._reactContainer.className = 'pie-configure-wrapper';\n this.appendChild(this._reactContainer);\n\n console.log('🔧 [multiple-choice-configure] _render - Creating new React root');\n log('_render - Creating new React root');\n this._root = createRoot(this._reactContainer);\n console.log('✅ [multiple-choice-configure] _render - React root created successfully');\n log('_render - React root created successfully');\n }\n\n console.log('🔧 [multiple-choice-configure] _render - Calling root.render()');\n log('_render - Calling root.render()');\n this._root.render(element);\n console.log('✅ [multiple-choice-configure] _render - Render completed successfully');\n log('_render - Render completed successfully');\n } catch (error) {\n console.error('❌ [multiple-choice-configure] Render error:', error);\n console.error('Error stack:', error.stack);\n throw error;\n }\n }\n\n connectedCallback() {\n console.log('🔧 [multiple-choice-configure] connectedCallback - Component connected to DOM');\n log('connectedCallback - Component connected to DOM');\n log('connectedCallback - Model:', this._model ? 'present' : 'missing');\n log('connectedCallback - Configuration:', this._configuration ? 'present' : 'missing');\n }\n\n disconnectedCallback() {\n console.log('🔧 [multiple-choice-configure] disconnectedCallback - Component disconnected from DOM');\n log('disconnectedCallback - Component disconnected from DOM');\n if (this._root) {\n console.log('🔧 [multiple-choice-configure] disconnectedCallback - Unmounting React root');\n log('disconnectedCallback - Unmounting React root');\n this._root.unmount();\n this._root = null;\n }\n if (this._reactContainer) {\n this._reactContainer = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA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AAO,EAAED,wBAAwB,CAAEa,KAAK,IAAIA,KAAK,CAACZ,OAAO,IAAK,EAAE;EAClE,CAAC,CAAC;;EAEF;EACAiF,eAAe,CAACG,aAAa,GAC3BxE,KAAK,CAACwE,aAAa,IAAKxE,KAAK,CAACyE,YAAY,KAAK,KAAK,IAAI,YAAa,IAAItE,iBAAgB,CAACH,KAAK,CAACwE,aAAa;EAE/G,OAAOH,eAAe;AACxB,CAAC","ignoreList":[]}
|
package/configure/lib/main.js
CHANGED
|
@@ -18,7 +18,7 @@ var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
|
18
18
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
19
19
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
20
20
|
var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
|
|
21
|
-
var
|
|
21
|
+
var _lodashEs = require("lodash-es");
|
|
22
22
|
var _utils = require("./utils");
|
|
23
23
|
const {
|
|
24
24
|
Panel,
|
|
@@ -386,7 +386,7 @@ class Main extends _react.default.Component {
|
|
|
386
386
|
onModelChanged
|
|
387
387
|
} = this.props;
|
|
388
388
|
if (choice.correct && model.choiceMode === 'radio') {
|
|
389
|
-
model.choices = model.choices.map(c => (0,
|
|
389
|
+
model.choices = model.choices.map(c => (0, _lodashEs.merge)({}, c, {
|
|
390
390
|
correct: false
|
|
391
391
|
}));
|
|
392
392
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_editableHtmlTipTap","_configUi","_renderUi","_Button","_Tooltip","_Typography","_Box","_Info","_merge","_utils","Panel","toggle","radio","dropdown","settings","MAX_CHOICES","PromptHolder","styled","InputContainer","theme","width","paddingTop","spacing","marginBottom","RationaleHolder","flex","marginTop","marginLeft","ChoiceConfigurationHolder","display","flexDirection","AddButton","Button","float","DisableButton","cursor","pointerEvents","backgroundColor","color","disabled","FlexContainer","Box","alignItems","TitleText","Typography","fontSize","typography","marginRight","StyledTooltip","Tooltip","whiteSpace","maxWidth","ErrorText","palette","error","main","Design","props","model","configuration","onPromptChanged","onChoiceChanged","onRemoveChoice","onAddChoice","imageSupport","uploadSoundSupport","onChangeModel","onConfigurationChanged","onTeacherInstructionsChanged","addChoiceButton","contentDimensions","feedback","deleteChoice","choiceMode","choicePrefix","partialScoring","lockChoiceOrder","teacherInstructions","studentInstructions","rationale","scoringType","sequentialChoiceLabels","settingsPanelDisabled","choicesLayout","spellCheck","gridColumns","maxImageWidth","maxImageHeight","prompt","withRubric","mathMlOptions","language","languageChoices","maxAnswerChoices","limitChoicesNumber","teacherInstructionsEnabled","rationaleEnabled","feedbackEnabled","promptEnabled","spellCheckEnabled","choices","errors","toolbarEditorPosition","extraCSSRules","answerChoices","answerChoicesError","choicesErrors","correctResponse","correctResponseError","promptError","rationaleErrors","teacherInstructionsError","nrOfColumnsAvailable","length","Array","from","_","i","baseInputConfiguration","toolbarOpts","position","getPluginProps","validationMessage","generateValidationMessage","defaultImageMaxWidth","defaultImageMaxHeight","addChoiceButtonTooltip","panelSettings","label","enabled","options","panelProperties","studentInstructionsEnabled","rubricEnabled","default","createElement","layout","ConfigLayout","dimensions","hideSettings","classes","onChangeConfiguration","groups","Settings","Properties","markup","onChange","nonEmpty","disableUnderline","pluginProps","inputConfiguration","languageCharactersProps","component","disableFocusListener","disableTouchListener","placement","title","map","choice","index","key","ChoiceConfiguration","useLetterOrdering","mode","data","defaultFeedback","disableImageAlignmentButtons","onDelete","c","allowFeedBack","allowDelete","noLabels","pluginOpts","value","noCorrectAnswerError","variant","onClick","Main","React","Component","constructor","args","_defineProperty2","showWarning","onModelChanged","minAnswerChoices","setState","splice","push","utils","firstAvailableIndex","type","correct","merge","correctFound","render","state","Fragment","AlertDialog","open","text","onConfirm","_extends2","exports","PropTypes","object","isRequired","disableSidePanel","bool","func","shape","add","delete","_default"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport {\n AlertDialog,\n InputContainer,\n ChoiceConfiguration,\n settings,\n layout,\n choiceUtils as utils,\n} from '@pie-lib/config-ui';\nimport { color } from '@pie-lib/render-ui';\nimport Button from '@mui/material/Button';\nimport Tooltip from '@mui/material/Tooltip';\nimport Typography from '@mui/material/Typography';\nimport Box from '@mui/material/Box';\nimport Info from '@mui/icons-material/Info';\nimport merge from 'lodash/merge';\nimport { generateValidationMessage } from './utils';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst MAX_CHOICES = 9;\n\nconst PromptHolder = styled(InputContainer)(({ theme }) => ({\n width: '100%',\n paddingTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n}));\n\nconst RationaleHolder = styled(InputContainer)(({ theme }) => ({\n flex: 1,\n marginTop: theme.spacing(1.5),\n paddingTop: theme.spacing(2),\n marginLeft: theme.spacing(3.5),\n}));\n\nconst ChoiceConfigurationHolder = styled(InputContainer)(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n marginBottom: theme.spacing(1),\n width: '100%',\n}));\n\n\nconst AddButton = styled(Button)(({ theme }) => ({\n marginTop: theme.spacing(1),\n float: 'right',\n}));\n\nconst DisableButton = styled(AddButton)({\n cursor: 'not-allowed',\n pointerEvents: 'all',\n backgroundColor: color.disabled(),\n '&:hover': {\n backgroundColor: color.disabled(),\n },\n '&:focus': {\n backgroundColor: color.disabled(),\n },\n});\n\nconst FlexContainer = styled(Box)({\n display: 'flex',\n alignItems: 'center',\n});\n\nconst TitleText = styled(Typography)(({ theme }) => ({\n fontSize: theme.typography.fontSize + 2,\n marginRight: theme.spacing(1),\n}));\n\nconst StyledTooltip = styled(Tooltip)(({ theme }) => ({\n '& .MuiTooltip-tooltip': {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nconst Design = (props) => {\n const {\n model,\n configuration,\n onPromptChanged,\n onChoiceChanged,\n onRemoveChoice,\n onAddChoice,\n imageSupport,\n uploadSoundSupport,\n onChangeModel,\n onConfigurationChanged,\n onTeacherInstructionsChanged,\n } = props;\n\n const {\n addChoiceButton = {},\n contentDimensions = {},\n feedback = {},\n deleteChoice = {},\n choiceMode = {},\n choicePrefix = {},\n partialScoring = {},\n lockChoiceOrder = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n scoringType = {},\n sequentialChoiceLabels = {},\n settingsPanelDisabled,\n choicesLayout,\n spellCheck = {},\n gridColumns,\n maxImageWidth = {},\n maxImageHeight = {},\n prompt = {},\n withRubric = {},\n mathMlOptions = {},\n language = {},\n languageChoices = {},\n } = configuration || {};\n let { maxAnswerChoices } = configuration || {};\n const {\n limitChoicesNumber,\n teacherInstructionsEnabled,\n rationaleEnabled,\n feedbackEnabled,\n promptEnabled,\n spellCheckEnabled,\n choices,\n errors,\n toolbarEditorPosition,\n extraCSSRules,\n } = model || {};\n\n const {\n answerChoices: answerChoicesError,\n choices: choicesErrors,\n correctResponse: correctResponseError,\n prompt: promptError,\n rationale: rationaleErrors,\n teacherInstructions: teacherInstructionsError,\n } = errors || {};\n const nrOfColumnsAvailable = choices?.length ? Array.from({ length: choices.length }, (_, i) => `${i + 1}`) : [];\n\n const { baseInputConfiguration = {} } = configuration;\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n const getPluginProps = (props = {}) => ({\n ...baseInputConfiguration,\n ...props,\n });\n\n const validationMessage = generateValidationMessage(configuration);\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n const addChoiceButtonTooltip =\n maxAnswerChoices && choices?.length >= maxAnswerChoices ? `Only ${maxAnswerChoices} allowed maximum` : '';\n\n const panelSettings = {\n choiceMode: choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),\n 'sequentialChoiceLabels.enabled': sequentialChoiceLabels.settings && toggle(sequentialChoiceLabels.label, true),\n choicePrefix: choicePrefix.settings && radio(choicePrefix.label, ['numbers', 'letters']),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),\n gridColumns:\n choicesLayout.settings &&\n model.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.length > 0 &&\n dropdown(gridColumns.label, nrOfColumnsAvailable),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n };\n\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n rationaleEnabled: rationale.settings && toggle(rationale.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 dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n extraCSSRules={extraCSSRules}\n classes={{}}\n settings={\n <Panel\n model={model}\n onChangeModel={onChangeModel}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <PromptHolder label={teacherInstructions.label}>\n <EditableHtml\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n error={teacherInstructionsError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(configuration?.teacherInstructions?.inputConfiguration)}\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 && <ErrorText>{teacherInstructionsError}</ErrorText>}\n </PromptHolder>\n )}\n\n {promptEnabled && (\n <PromptHolder label={prompt.label}>\n <EditableHtml\n markup={model.prompt}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n error={promptError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(configuration?.prompt?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.prompt}\n maxImageHeight={maxImageHeight && maxImageHeight.prompt}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {promptError && <ErrorText>{promptError}</ErrorText>}\n </PromptHolder>\n )}\n\n <FlexContainer>\n <TitleText component={'div'}>\n Choices\n </TitleText>\n <StyledTooltip\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} />\n </StyledTooltip>\n </FlexContainer>\n\n {choices.map((choice, index) => (\n <ChoiceConfigurationHolder key={`choice-${index}`}>\n <ChoiceConfiguration\n key={index}\n index={index + 1}\n useLetterOrdering={model.choicePrefix === 'letters'}\n mode={model.choiceMode}\n data={choice}\n defaultFeedback={{}}\n imageSupport={imageSupport}\n disableImageAlignmentButtons={true}\n onDelete={() => onRemoveChoice(index)}\n onChange={(c) => onChoiceChanged(index, c)}\n allowFeedBack={feedbackEnabled}\n allowDelete={deleteChoice.settings}\n noLabels\n pluginOpts={getPluginProps(configuration?.choices?.inputConfiguration)}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n error={choicesErrors?.[choice.value] || null}\n noCorrectAnswerError={correctResponseError}\n maxImageWidth={(maxImageWidth && maxImageWidth.choices) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.choices) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n mathMlOptions={mathMlOptions}\n />\n\n {rationaleEnabled && (\n <RationaleHolder key={`rationale-${index}`} label={rationale.label}>\n <EditableHtml\n markup={choice.rationale || ''}\n onChange={(c) => onChoiceChanged(index, { ...choice, rationale: c })}\n imageSupport={imageSupport}\n error={rationaleErrors?.[choice.value] || null}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(configuration?.rationale?.inputConfiguration)}\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 {rationaleErrors?.[choice.value] && (\n <ErrorText>{rationaleErrors?.[choice.value]}</ErrorText>\n )}\n </RationaleHolder>\n )}\n </ChoiceConfigurationHolder>\n ))}\n\n {correctResponseError && <ErrorText>{correctResponseError}</ErrorText>}\n {answerChoicesError && <ErrorText>{answerChoicesError}</ErrorText>}\n\n {addChoiceButton.settings && (\n <StyledTooltip title={addChoiceButtonTooltip}>\n {maxAnswerChoices && choices?.length >= maxAnswerChoices ? (\n <DisableButton\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n disabled\n >\n {addChoiceButton.label}\n </DisableButton>\n ) : (\n <AddButton\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n >\n {addChoiceButton.label}\n </AddButton>\n )}\n </StyledTooltip>\n )}\n </layout.ConfigLayout>\n );\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n };\n\n state = { showWarning: false };\n\n onRemoveChoice = (index) => {\n const { model, configuration, onModelChanged } = this.props;\n const { minAnswerChoices } = configuration || {};\n\n if (minAnswerChoices && model.choices.length === minAnswerChoices) {\n this.setState({ showWarning: true });\n\n return;\n }\n\n model.choices.splice(index, 1);\n onModelChanged(model);\n };\n\n onAddChoice = () => {\n const { model, configuration, onModelChanged } = this.props;\n let { maxAnswerChoices } = configuration || {};\n const { limitChoicesNumber } = model || {};\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {\n return;\n }\n\n model.choices.push({\n label: '',\n value: utils.firstAvailableIndex(\n model.choices.map((c) => c.value),\n 0,\n ),\n feedback: { type: 'none' },\n });\n\n onModelChanged(model);\n };\n\n onChoiceChanged = (index, choice) => {\n const { model, onModelChanged } = this.props;\n\n if (choice.correct && model.choiceMode === 'radio') {\n model.choices = model.choices.map((c) => merge({}, c, { correct: false }));\n }\n\n model.choices.splice(index, 1, choice);\n onModelChanged(model);\n };\n\n onPromptChanged = (prompt) => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt,\n });\n };\n\n onTeacherInstructionsChanged = (teacherInstructions) => {\n this.props.onModelChanged({\n ...this.props.model,\n teacherInstructions,\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n switch (key) {\n case 'choiceMode': {\n let value = model.choiceMode;\n\n if (value === 'radio') {\n let correctFound = false;\n\n model.choices = model.choices.map((c) => {\n if (correctFound) {\n c.correct = false;\n\n return c;\n }\n\n if (c.correct) {\n correctFound = true;\n }\n\n return c;\n });\n }\n\n onModelChanged(model, true);\n break;\n }\n\n default:\n onModelChanged(model);\n break;\n }\n };\n\n render() {\n const { configuration: { minAnswerChoices } = {} } = this.props;\n const { showWarning } = this.state;\n\n return (\n <React.Fragment>\n <AlertDialog\n open={showWarning}\n title=\"Warning\"\n text={`There can't be less than ${minAnswerChoices || 0} choices.`}\n onConfirm={() => this.setState({ showWarning: false })}\n />\n <Design\n {...this.props}\n onChangeModel={this.onModelChanged}\n onRemoveChoice={this.onRemoveChoice}\n onChoiceChanged={this.onChoiceChanged}\n onAddChoice={this.onAddChoice}\n onPromptChanged={this.onPromptChanged}\n onTeacherInstructionsChanged={this.onTeacherInstructionsChanged}\n />\n </React.Fragment>\n );\n }\n}\n\nexport default Main;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAQA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,QAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,WAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,IAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,KAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,MAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAEA,MAAM;EAAEa,KAAK;EAAEC,MAAM;EAAEC,KAAK;EAAEC;AAAS,CAAC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,CAAC,WAAY;MACnEgB,SAAS,EAAEA,CAAA,KAAM,IAAI,CAACf,QAAQ,CAAC;QAAEH,WAAW,EAAE;MAAM,CAAC;IAAE,CACxD,CAAC,eACF5L,MAAA,CAAA2I,OAAA,CAAAC,aAAA,CAAC/E,MAAM,MAAAkJ,SAAA,CAAApE,OAAA,MACD,IAAI,CAAC7E,KAAK;MACdS,aAAa,EAAE,IAAI,CAACsH,cAAe;MACnC1H,cAAc,EAAE,IAAI,CAACA,cAAe;MACpCD,eAAe,EAAE,IAAI,CAACA,eAAgB;MACtCE,WAAW,EAAE,IAAI,CAACA,WAAY;MAC9BH,eAAe,EAAE,IAAI,CAACA,eAAgB;MACtCQ,4BAA4B,EAAE,IAAI,CAACA;IAA6B,EACjE,CACa,CAAC;EAErB;AACF;AAACuI,OAAA,CAAA1B,IAAA,GAAAA,IAAA;AAAA,IAAAK,gBAAA,CAAAhD,OAAA,EA3IY2C,IAAI,eACI;EACjBvH,KAAK,EAAEkJ,kBAAS,CAACC,MAAM,CAACC,UAAU;EAClCnJ,aAAa,EAAEiJ,kBAAS,CAACC,MAAM,CAACC,UAAU;EAC1CC,gBAAgB,EAAEH,kBAAS,CAACI,IAAI;EAChCxB,cAAc,EAAEoB,kBAAS,CAACK,IAAI,CAACH,UAAU;EACzC3I,sBAAsB,EAAEyI,kBAAS,CAACK,IAAI,CAACH,UAAU;EACjD9I,YAAY,EAAE4I,kBAAS,CAACM,KAAK,CAAC;IAC5BC,GAAG,EAAEP,kBAAS,CAACK,IAAI,CAACH,UAAU;IAC9BM,MAAM,EAAER,kBAAS,CAACK,IAAI,CAACH;EACzB,CAAC;AACH,CAAC;AAAA,IAAAO,QAAA,GAAAV,OAAA,CAAArE,OAAA,GAkIY2C,IAAI","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_editableHtmlTipTap","_configUi","_renderUi","_Button","_Tooltip","_Typography","_Box","_Info","_lodashEs","_utils","Panel","toggle","radio","dropdown","settings","MAX_CHOICES","PromptHolder","styled","InputContainer","theme","width","paddingTop","spacing","marginBottom","RationaleHolder","flex","marginTop","marginLeft","ChoiceConfigurationHolder","display","flexDirection","AddButton","Button","float","DisableButton","cursor","pointerEvents","backgroundColor","color","disabled","FlexContainer","Box","alignItems","TitleText","Typography","fontSize","typography","marginRight","StyledTooltip","Tooltip","whiteSpace","maxWidth","ErrorText","palette","error","main","Design","props","model","configuration","onPromptChanged","onChoiceChanged","onRemoveChoice","onAddChoice","imageSupport","uploadSoundSupport","onChangeModel","onConfigurationChanged","onTeacherInstructionsChanged","addChoiceButton","contentDimensions","feedback","deleteChoice","choiceMode","choicePrefix","partialScoring","lockChoiceOrder","teacherInstructions","studentInstructions","rationale","scoringType","sequentialChoiceLabels","settingsPanelDisabled","choicesLayout","spellCheck","gridColumns","maxImageWidth","maxImageHeight","prompt","withRubric","mathMlOptions","language","languageChoices","maxAnswerChoices","limitChoicesNumber","teacherInstructionsEnabled","rationaleEnabled","feedbackEnabled","promptEnabled","spellCheckEnabled","choices","errors","toolbarEditorPosition","extraCSSRules","answerChoices","answerChoicesError","choicesErrors","correctResponse","correctResponseError","promptError","rationaleErrors","teacherInstructionsError","nrOfColumnsAvailable","length","Array","from","_","i","baseInputConfiguration","toolbarOpts","position","getPluginProps","validationMessage","generateValidationMessage","defaultImageMaxWidth","defaultImageMaxHeight","addChoiceButtonTooltip","panelSettings","label","enabled","options","panelProperties","studentInstructionsEnabled","rubricEnabled","default","createElement","layout","ConfigLayout","dimensions","hideSettings","classes","onChangeConfiguration","groups","Settings","Properties","markup","onChange","nonEmpty","disableUnderline","pluginProps","inputConfiguration","languageCharactersProps","component","disableFocusListener","disableTouchListener","placement","title","map","choice","index","key","ChoiceConfiguration","useLetterOrdering","mode","data","defaultFeedback","disableImageAlignmentButtons","onDelete","c","allowFeedBack","allowDelete","noLabels","pluginOpts","value","noCorrectAnswerError","variant","onClick","Main","React","Component","constructor","args","_defineProperty2","showWarning","onModelChanged","minAnswerChoices","setState","splice","push","utils","firstAvailableIndex","type","correct","merge","correctFound","render","state","Fragment","AlertDialog","open","text","onConfirm","_extends2","exports","PropTypes","object","isRequired","disableSidePanel","bool","func","shape","add","delete","_default"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport {\n AlertDialog,\n InputContainer,\n ChoiceConfiguration,\n settings,\n layout,\n choiceUtils as utils,\n} from '@pie-lib/config-ui';\nimport { color } from '@pie-lib/render-ui';\nimport Button from '@mui/material/Button';\nimport Tooltip from '@mui/material/Tooltip';\nimport Typography from '@mui/material/Typography';\nimport Box from '@mui/material/Box';\nimport Info from '@mui/icons-material/Info';\nimport { merge } from 'lodash-es';\nimport { generateValidationMessage } from './utils';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst MAX_CHOICES = 9;\n\nconst PromptHolder = styled(InputContainer)(({ theme }) => ({\n width: '100%',\n paddingTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n}));\n\nconst RationaleHolder = styled(InputContainer)(({ theme }) => ({\n flex: 1,\n marginTop: theme.spacing(1.5),\n paddingTop: theme.spacing(2),\n marginLeft: theme.spacing(3.5),\n}));\n\nconst ChoiceConfigurationHolder = styled(InputContainer)(({ theme }) => ({\n display: 'flex',\n flexDirection: 'column',\n marginBottom: theme.spacing(1),\n width: '100%',\n}));\n\n\nconst AddButton = styled(Button)(({ theme }) => ({\n marginTop: theme.spacing(1),\n float: 'right',\n}));\n\nconst DisableButton = styled(AddButton)({\n cursor: 'not-allowed',\n pointerEvents: 'all',\n backgroundColor: color.disabled(),\n '&:hover': {\n backgroundColor: color.disabled(),\n },\n '&:focus': {\n backgroundColor: color.disabled(),\n },\n});\n\nconst FlexContainer = styled(Box)({\n display: 'flex',\n alignItems: 'center',\n});\n\nconst TitleText = styled(Typography)(({ theme }) => ({\n fontSize: theme.typography.fontSize + 2,\n marginRight: theme.spacing(1),\n}));\n\nconst StyledTooltip = styled(Tooltip)(({ theme }) => ({\n '& .MuiTooltip-tooltip': {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nconst Design = (props) => {\n const {\n model,\n configuration,\n onPromptChanged,\n onChoiceChanged,\n onRemoveChoice,\n onAddChoice,\n imageSupport,\n uploadSoundSupport,\n onChangeModel,\n onConfigurationChanged,\n onTeacherInstructionsChanged,\n } = props;\n\n const {\n addChoiceButton = {},\n contentDimensions = {},\n feedback = {},\n deleteChoice = {},\n choiceMode = {},\n choicePrefix = {},\n partialScoring = {},\n lockChoiceOrder = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n scoringType = {},\n sequentialChoiceLabels = {},\n settingsPanelDisabled,\n choicesLayout,\n spellCheck = {},\n gridColumns,\n maxImageWidth = {},\n maxImageHeight = {},\n prompt = {},\n withRubric = {},\n mathMlOptions = {},\n language = {},\n languageChoices = {},\n } = configuration || {};\n let { maxAnswerChoices } = configuration || {};\n const {\n limitChoicesNumber,\n teacherInstructionsEnabled,\n rationaleEnabled,\n feedbackEnabled,\n promptEnabled,\n spellCheckEnabled,\n choices,\n errors,\n toolbarEditorPosition,\n extraCSSRules,\n } = model || {};\n\n const {\n answerChoices: answerChoicesError,\n choices: choicesErrors,\n correctResponse: correctResponseError,\n prompt: promptError,\n rationale: rationaleErrors,\n teacherInstructions: teacherInstructionsError,\n } = errors || {};\n const nrOfColumnsAvailable = choices?.length ? Array.from({ length: choices.length }, (_, i) => `${i + 1}`) : [];\n\n const { baseInputConfiguration = {} } = configuration;\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n const getPluginProps = (props = {}) => ({\n ...baseInputConfiguration,\n ...props,\n });\n\n const validationMessage = generateValidationMessage(configuration);\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n const addChoiceButtonTooltip =\n maxAnswerChoices && choices?.length >= maxAnswerChoices ? `Only ${maxAnswerChoices} allowed maximum` : '';\n\n const panelSettings = {\n choiceMode: choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),\n 'sequentialChoiceLabels.enabled': sequentialChoiceLabels.settings && toggle(sequentialChoiceLabels.label, true),\n choicePrefix: choicePrefix.settings && radio(choicePrefix.label, ['numbers', 'letters']),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),\n gridColumns:\n choicesLayout.settings &&\n model.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.length > 0 &&\n dropdown(gridColumns.label, nrOfColumnsAvailable),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n };\n\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n rationaleEnabled: rationale.settings && toggle(rationale.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 dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n extraCSSRules={extraCSSRules}\n classes={{}}\n settings={\n <Panel\n model={model}\n onChangeModel={onChangeModel}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <PromptHolder label={teacherInstructions.label}>\n <EditableHtml\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n error={teacherInstructionsError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(configuration?.teacherInstructions?.inputConfiguration)}\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 && <ErrorText>{teacherInstructionsError}</ErrorText>}\n </PromptHolder>\n )}\n\n {promptEnabled && (\n <PromptHolder label={prompt.label}>\n <EditableHtml\n markup={model.prompt}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n error={promptError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(configuration?.prompt?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.prompt}\n maxImageHeight={maxImageHeight && maxImageHeight.prompt}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {promptError && <ErrorText>{promptError}</ErrorText>}\n </PromptHolder>\n )}\n\n <FlexContainer>\n <TitleText component={'div'}>\n Choices\n </TitleText>\n <StyledTooltip\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'} />\n </StyledTooltip>\n </FlexContainer>\n\n {choices.map((choice, index) => (\n <ChoiceConfigurationHolder key={`choice-${index}`}>\n <ChoiceConfiguration\n key={index}\n index={index + 1}\n useLetterOrdering={model.choicePrefix === 'letters'}\n mode={model.choiceMode}\n data={choice}\n defaultFeedback={{}}\n imageSupport={imageSupport}\n disableImageAlignmentButtons={true}\n onDelete={() => onRemoveChoice(index)}\n onChange={(c) => onChoiceChanged(index, c)}\n allowFeedBack={feedbackEnabled}\n allowDelete={deleteChoice.settings}\n noLabels\n pluginOpts={getPluginProps(configuration?.choices?.inputConfiguration)}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n error={choicesErrors?.[choice.value] || null}\n noCorrectAnswerError={correctResponseError}\n maxImageWidth={(maxImageWidth && maxImageWidth.choices) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.choices) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n mathMlOptions={mathMlOptions}\n />\n\n {rationaleEnabled && (\n <RationaleHolder key={`rationale-${index}`} label={rationale.label}>\n <EditableHtml\n markup={choice.rationale || ''}\n onChange={(c) => onChoiceChanged(index, { ...choice, rationale: c })}\n imageSupport={imageSupport}\n error={rationaleErrors?.[choice.value] || null}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(configuration?.rationale?.inputConfiguration)}\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 {rationaleErrors?.[choice.value] && (\n <ErrorText>{rationaleErrors?.[choice.value]}</ErrorText>\n )}\n </RationaleHolder>\n )}\n </ChoiceConfigurationHolder>\n ))}\n\n {correctResponseError && <ErrorText>{correctResponseError}</ErrorText>}\n {answerChoicesError && <ErrorText>{answerChoicesError}</ErrorText>}\n\n {addChoiceButton.settings && (\n <StyledTooltip title={addChoiceButtonTooltip}>\n {maxAnswerChoices && choices?.length >= maxAnswerChoices ? (\n <DisableButton\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n disabled\n >\n {addChoiceButton.label}\n </DisableButton>\n ) : (\n <AddButton\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n >\n {addChoiceButton.label}\n </AddButton>\n )}\n </StyledTooltip>\n )}\n </layout.ConfigLayout>\n );\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n };\n\n state = { showWarning: false };\n\n onRemoveChoice = (index) => {\n const { model, configuration, onModelChanged } = this.props;\n const { minAnswerChoices } = configuration || {};\n\n if (minAnswerChoices && model.choices.length === minAnswerChoices) {\n this.setState({ showWarning: true });\n\n return;\n }\n\n model.choices.splice(index, 1);\n onModelChanged(model);\n };\n\n onAddChoice = () => {\n const { model, configuration, onModelChanged } = this.props;\n let { maxAnswerChoices } = configuration || {};\n const { limitChoicesNumber } = model || {};\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {\n return;\n }\n\n model.choices.push({\n label: '',\n value: utils.firstAvailableIndex(\n model.choices.map((c) => c.value),\n 0,\n ),\n feedback: { type: 'none' },\n });\n\n onModelChanged(model);\n };\n\n onChoiceChanged = (index, choice) => {\n const { model, onModelChanged } = this.props;\n\n if (choice.correct && model.choiceMode === 'radio') {\n model.choices = model.choices.map((c) => merge({}, c, { correct: false }));\n }\n\n model.choices.splice(index, 1, choice);\n onModelChanged(model);\n };\n\n onPromptChanged = (prompt) => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt,\n });\n };\n\n onTeacherInstructionsChanged = (teacherInstructions) => {\n this.props.onModelChanged({\n ...this.props.model,\n teacherInstructions,\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n switch (key) {\n case 'choiceMode': {\n let value = model.choiceMode;\n\n if (value === 'radio') {\n let correctFound = false;\n\n model.choices = model.choices.map((c) => {\n if (correctFound) {\n c.correct = false;\n\n return c;\n }\n\n if (c.correct) {\n correctFound = true;\n }\n\n return c;\n });\n }\n\n onModelChanged(model, true);\n break;\n }\n\n default:\n onModelChanged(model);\n break;\n }\n };\n\n render() {\n const { configuration: { minAnswerChoices } = {} } = this.props;\n const { showWarning } = this.state;\n\n return (\n <React.Fragment>\n <AlertDialog\n open={showWarning}\n title=\"Warning\"\n text={`There can't be less than ${minAnswerChoices || 0} choices.`}\n onConfirm={() => this.setState({ showWarning: false })}\n />\n <Design\n {...this.props}\n onChangeModel={this.onModelChanged}\n onRemoveChoice={this.onRemoveChoice}\n onChoiceChanged={this.onChoiceChanged}\n onAddChoice={this.onAddChoice}\n onPromptChanged={this.onPromptChanged}\n onTeacherInstructionsChanged={this.onTeacherInstructionsChanged}\n />\n </React.Fragment>\n );\n }\n}\n\nexport default Main;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAQA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,QAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,WAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,IAAA,GAAAV,sBAAA,CAAAC,OAAA;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AA,CAAArE,OAAA,GAkIY2C,IAAI","ignoreList":[]}
|
package/configure/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multiple-choice-configure",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.0-next.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"@mui/icons-material": "^7.3.4",
|
|
11
11
|
"@mui/material": "^7.3.4",
|
|
12
12
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
13
|
-
"@pie-lib/config-ui": "12.1.1-next.
|
|
14
|
-
"@pie-lib/editable-html-tip-tap": "1.1.1-next.
|
|
15
|
-
"@pie-lib/render-ui": "5.1.1-next.
|
|
13
|
+
"@pie-lib/config-ui": "12.1.1-next.3",
|
|
14
|
+
"@pie-lib/editable-html-tip-tap": "1.1.1-next.3",
|
|
15
|
+
"@pie-lib/render-ui": "5.1.1-next.1",
|
|
16
16
|
"debug": "^4.1.1",
|
|
17
|
-
"lodash": "^4.17.23",
|
|
17
|
+
"lodash-es": "^4.17.23",
|
|
18
18
|
"prop-types": "^15.8.1",
|
|
19
|
-
"react": "18.
|
|
20
|
-
"react-dom": "18.
|
|
19
|
+
"react": "18.3.1",
|
|
20
|
+
"react-dom": "18.3.1"
|
|
21
21
|
}
|
|
22
22
|
}
|
package/controller/lib/index.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.model = model;
|
|
|
11
11
|
exports.normalize = void 0;
|
|
12
12
|
exports.outcome = outcome;
|
|
13
13
|
exports.validate = void 0;
|
|
14
|
-
var
|
|
14
|
+
var _lodashEs = require("lodash-es");
|
|
15
15
|
var _utils = require("./utils");
|
|
16
16
|
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
17
17
|
var _controllerUtils = require("@pie-lib/controller-utils");
|
|
@@ -123,7 +123,7 @@ async function model(question, session, env, updateSession) {
|
|
|
123
123
|
return out;
|
|
124
124
|
}
|
|
125
125
|
const getScore = (config, session) => {
|
|
126
|
-
if (!session || (0,
|
|
126
|
+
if (!session || (0, _lodashEs.isEmpty)(session)) {
|
|
127
127
|
return 0;
|
|
128
128
|
}
|
|
129
129
|
const selectedChoices = session.value || [];
|
|
@@ -151,7 +151,7 @@ const getScore = (config, session) => {
|
|
|
151
151
|
exports.getScore = getScore;
|
|
152
152
|
function outcome(model, session, env) {
|
|
153
153
|
return new Promise(resolve => {
|
|
154
|
-
if (!session || (0,
|
|
154
|
+
if (!session || (0, _lodashEs.isEmpty)(session)) {
|
|
155
155
|
resolve({
|
|
156
156
|
score: 0,
|
|
157
157
|
empty: true
|
|
@@ -239,10 +239,10 @@ const validate = (model = {}, config = {}) => {
|
|
|
239
239
|
if (!hasCorrectResponse) {
|
|
240
240
|
errors.correctResponse = 'No correct response defined.';
|
|
241
241
|
}
|
|
242
|
-
if (!(0,
|
|
242
|
+
if (!(0, _lodashEs.isEmpty)(choicesErrors)) {
|
|
243
243
|
errors.choices = choicesErrors;
|
|
244
244
|
}
|
|
245
|
-
if (!(0,
|
|
245
|
+
if (!(0, _lodashEs.isEmpty)(rationaleErrors)) {
|
|
246
246
|
errors.rationale = rationaleErrors;
|
|
247
247
|
}
|
|
248
248
|
return errors;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_isEmpty","_interopRequireDefault","require","_utils","_defaults","_controllerUtils","prepareChoice","model","env","defaultFeedback","choice","role","mode","out","label","value","rationale","rationaleEnabled","correct","feedbackEnabled","feedbackType","feedback","type","createDefaultModel","Promise","resolve","defaults","normalize","question","verticalMode","choicesLayout","questionProps","exports","session","updateSession","normalizedQuestion","Object","assign","incorrect","choices","map","lockChoiceOrder","lockChoices","getShuffledChoices","disabled","prompt","promptEnabled","gridColumns","choiceMode","keyMode","choicePrefix","responseCorrect","isResponseCorrect","undefined","language","extraCSSRules","fontSizeFactor","isSelectionButtonBelow","selectedAnswerBackgroundColor","selectedAnswerStrokeColor","selectedAnswerStrokeWidth","hoverAnswerBackgroundColor","hoverAnswerStrokeColor","hoverAnswerStrokeWidth","minSelections","maxSelections","keyboardEventsEnabled","autoplayAudioEnabled","completeAudioEnabled","customAudioButton","teacherInstructions","teacherInstructionsEnabled","getScore","config","isEmpty","selectedChoices","correctChoices","filter","ch","score","reduce","acc","selectedChoice","find","length","str","parseFloat","toFixed","outcome","empty","partialScoringEnabled","partialScoring","enabled","createCorrectResponseSession","id","c","getInnerText","html","replaceAll","getContent","replace","validate","minAnswerChoices","maxAnswerChoices","reversedChoices","reverse","choicesErrors","rationaleErrors","errors","forEach","field","required","hasCorrectResponse","index","identicalAnswer","slice","some","nbOfChoices","answerChoices","correctResponse"],"sources":["../src/index.js"],"sourcesContent":["/* eslint-disable no-console */\nimport isEmpty from 'lodash/isEmpty';\nimport { isResponseCorrect } from './utils';\nimport defaults from './defaults';\nimport { lockChoices, partialScoring, getShuffledChoices } from '@pie-lib/controller-utils';\n\nconst prepareChoice = (model, env, defaultFeedback) => (choice) => {\n const { role, mode } = env || {};\n const out = {\n label: choice.label,\n value: choice.value,\n };\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = model.rationaleEnabled ? choice.rationale : null;\n } else {\n out.rationale = null;\n }\n\n if (mode === 'evaluate') {\n out.correct = !!choice.correct;\n\n if (model.feedbackEnabled) {\n const feedbackType = (choice.feedback && choice.feedback.type) || 'none';\n\n if (feedbackType === 'default') {\n out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];\n } else if (feedbackType === 'custom') {\n out.feedback = choice.feedback.value;\n }\n }\n }\n\n return out;\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = (question) => {\n const { verticalMode, choicesLayout, ...questionProps } = question || {};\n\n return {\n ...defaults,\n ...questionProps,\n // This is used for offering support for old models which have the property verticalMode\n // Same thing is set in authoring : packages/multiple-choice/configure/src/index.jsx - createDefaultModel\n choicesLayout: choicesLayout || (verticalMode === false && 'horizontal') || defaults.choicesLayout,\n };\n};\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n\n const defaultFeedback = Object.assign(\n { correct: 'Correct', incorrect: 'Incorrect' },\n normalizedQuestion.defaultFeedback,\n );\n\n let choices = (normalizedQuestion.choices || []).map(prepareChoice(normalizedQuestion, env, defaultFeedback));\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'value');\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n choicesLayout: normalizedQuestion.choicesLayout,\n gridColumns: normalizedQuestion.gridColumns,\n choiceMode: normalizedQuestion.choiceMode,\n keyMode: normalizedQuestion.choicePrefix,\n choices,\n responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n fontSizeFactor: normalizedQuestion.fontSizeFactor,\n isSelectionButtonBelow: normalizedQuestion.isSelectionButtonBelow,\n selectedAnswerBackgroundColor: normalizedQuestion.selectedAnswerBackgroundColor || 'initial',\n selectedAnswerStrokeColor: normalizedQuestion.selectedAnswerStrokeColor || 'initial',\n selectedAnswerStrokeWidth: normalizedQuestion.selectedAnswerStrokeWidth || 'initial',\n hoverAnswerBackgroundColor: normalizedQuestion.hoverAnswerBackgroundColor || 'initial',\n hoverAnswerStrokeColor: normalizedQuestion.hoverAnswerStrokeColor || 'initial',\n hoverAnswerStrokeWidth: normalizedQuestion.hoverAnswerStrokeWidth || 'initial',\n minSelections: normalizedQuestion.minSelections,\n maxSelections: normalizedQuestion.maxSelections,\n keyboardEventsEnabled: normalizedQuestion.keyboardEventsEnabled,\n autoplayAudioEnabled: normalizedQuestion.autoplayAudioEnabled,\n completeAudioEnabled: normalizedQuestion.completeAudioEnabled,\n customAudioButton: normalizedQuestion.customAudioButton,\n };\n\n const { role, mode } = env || {};\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n return out;\n}\n\nexport const getScore = (config, session) => {\n if (!session || isEmpty(session)) {\n return 0;\n }\n\n const selectedChoices = session.value || [];\n const correctChoices = (config.choices || []).filter((ch) => ch.correct);\n\n let score = selectedChoices.reduce(\n (acc, selectedChoice) => acc + (correctChoices.find((ch) => ch.value === selectedChoice) ? 1 : 0),\n 0,\n );\n\n if (correctChoices.length < selectedChoices.length) {\n score -= selectedChoices.length - correctChoices.length;\n\n if (score < 0) {\n score = 0;\n }\n }\n\n const str = correctChoices.length ? score / correctChoices.length : 0;\n\n return parseFloat(str.toFixed(2));\n};\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring = false. the value in `env` will\n * override the value in `model`.\n * @param {Object} model - the main model\n * @param {*} session\n * @param {Object} env\n */\nexport function outcome(model, session, env) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true });\n } else {\n const partialScoringEnabled = partialScoring.enabled(model, env) && model.choiceMode !== 'radio';\n const score = getScore(model, session);\n\n resolve({ score: partialScoringEnabled ? score : score === 1 ? 1 : 0, empty: false });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question || { choices: [] };\n\n resolve({\n id: '1',\n value: choices.filter((c) => c.correct).map((c) => c.value),\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { choices } = model;\n const { minAnswerChoices = 2, maxAnswerChoices } = config;\n const reversedChoices = [...(choices || [])].reverse();\n const choicesErrors = {};\n const rationaleErrors = {};\n const errors = {};\n\n ['teacherInstructions', 'prompt'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n let hasCorrectResponse = false;\n\n reversedChoices.forEach((choice, index) => {\n const { correct, value, label, rationale } = choice;\n\n if (correct) {\n hasCorrectResponse = true;\n }\n\n if (!getContent(label)) {\n choicesErrors[value] = 'Content should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.label === label);\n\n if (identicalAnswer) {\n choicesErrors[value] = 'Content should be unique.';\n }\n }\n\n if (config.rationale?.required && !getContent(rationale)) {\n rationaleErrors[value] = 'This field is required.';\n }\n });\n\n const nbOfChoices = (choices || []).length;\n\n if (nbOfChoices < minAnswerChoices) {\n errors.answerChoices = `There should be at least ${minAnswerChoices} choices defined.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.answerChoices = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (!hasCorrectResponse) {\n errors.correctResponse = 'No correct response defined.';\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choices = choicesErrors;\n }\n\n if (!isEmpty(rationaleErrors)) {\n errors.rationale = rationaleErrors;\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AAJA;;AA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AAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_lodashEs","require","_utils","_defaults","_interopRequireDefault","_controllerUtils","prepareChoice","model","env","defaultFeedback","choice","role","mode","out","label","value","rationale","rationaleEnabled","correct","feedbackEnabled","feedbackType","feedback","type","createDefaultModel","Promise","resolve","defaults","normalize","question","verticalMode","choicesLayout","questionProps","exports","session","updateSession","normalizedQuestion","Object","assign","incorrect","choices","map","lockChoiceOrder","lockChoices","getShuffledChoices","disabled","prompt","promptEnabled","gridColumns","choiceMode","keyMode","choicePrefix","responseCorrect","isResponseCorrect","undefined","language","extraCSSRules","fontSizeFactor","isSelectionButtonBelow","selectedAnswerBackgroundColor","selectedAnswerStrokeColor","selectedAnswerStrokeWidth","hoverAnswerBackgroundColor","hoverAnswerStrokeColor","hoverAnswerStrokeWidth","minSelections","maxSelections","keyboardEventsEnabled","autoplayAudioEnabled","completeAudioEnabled","customAudioButton","teacherInstructions","teacherInstructionsEnabled","getScore","config","isEmpty","selectedChoices","correctChoices","filter","ch","score","reduce","acc","selectedChoice","find","length","str","parseFloat","toFixed","outcome","empty","partialScoringEnabled","partialScoring","enabled","createCorrectResponseSession","id","c","getInnerText","html","replaceAll","getContent","replace","validate","minAnswerChoices","maxAnswerChoices","reversedChoices","reverse","choicesErrors","rationaleErrors","errors","forEach","field","required","hasCorrectResponse","index","identicalAnswer","slice","some","nbOfChoices","answerChoices","correctResponse"],"sources":["../src/index.js"],"sourcesContent":["/* eslint-disable no-console */\nimport { isEmpty } from 'lodash-es';\nimport { isResponseCorrect } from './utils';\nimport defaults from './defaults';\nimport { lockChoices, partialScoring, getShuffledChoices } from '@pie-lib/controller-utils';\n\nconst prepareChoice = (model, env, defaultFeedback) => (choice) => {\n const { role, mode } = env || {};\n const out = {\n label: choice.label,\n value: choice.value,\n };\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = model.rationaleEnabled ? choice.rationale : null;\n } else {\n out.rationale = null;\n }\n\n if (mode === 'evaluate') {\n out.correct = !!choice.correct;\n\n if (model.feedbackEnabled) {\n const feedbackType = (choice.feedback && choice.feedback.type) || 'none';\n\n if (feedbackType === 'default') {\n out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];\n } else if (feedbackType === 'custom') {\n out.feedback = choice.feedback.value;\n }\n }\n }\n\n return out;\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = (question) => {\n const { verticalMode, choicesLayout, ...questionProps } = question || {};\n\n return {\n ...defaults,\n ...questionProps,\n // This is used for offering support for old models which have the property verticalMode\n // Same thing is set in authoring : packages/multiple-choice/configure/src/index.jsx - createDefaultModel\n choicesLayout: choicesLayout || (verticalMode === false && 'horizontal') || defaults.choicesLayout,\n };\n};\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n\n const defaultFeedback = Object.assign(\n { correct: 'Correct', incorrect: 'Incorrect' },\n normalizedQuestion.defaultFeedback,\n );\n\n let choices = (normalizedQuestion.choices || []).map(prepareChoice(normalizedQuestion, env, defaultFeedback));\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(choices, session, updateSession, 'value');\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n choicesLayout: normalizedQuestion.choicesLayout,\n gridColumns: normalizedQuestion.gridColumns,\n choiceMode: normalizedQuestion.choiceMode,\n keyMode: normalizedQuestion.choicePrefix,\n choices,\n responseCorrect: env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n fontSizeFactor: normalizedQuestion.fontSizeFactor,\n isSelectionButtonBelow: normalizedQuestion.isSelectionButtonBelow,\n selectedAnswerBackgroundColor: normalizedQuestion.selectedAnswerBackgroundColor || 'initial',\n selectedAnswerStrokeColor: normalizedQuestion.selectedAnswerStrokeColor || 'initial',\n selectedAnswerStrokeWidth: normalizedQuestion.selectedAnswerStrokeWidth || 'initial',\n hoverAnswerBackgroundColor: normalizedQuestion.hoverAnswerBackgroundColor || 'initial',\n hoverAnswerStrokeColor: normalizedQuestion.hoverAnswerStrokeColor || 'initial',\n hoverAnswerStrokeWidth: normalizedQuestion.hoverAnswerStrokeWidth || 'initial',\n minSelections: normalizedQuestion.minSelections,\n maxSelections: normalizedQuestion.maxSelections,\n keyboardEventsEnabled: normalizedQuestion.keyboardEventsEnabled,\n autoplayAudioEnabled: normalizedQuestion.autoplayAudioEnabled,\n completeAudioEnabled: normalizedQuestion.completeAudioEnabled,\n customAudioButton: normalizedQuestion.customAudioButton,\n };\n\n const { role, mode } = env || {};\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n return out;\n}\n\nexport const getScore = (config, session) => {\n if (!session || isEmpty(session)) {\n return 0;\n }\n\n const selectedChoices = session.value || [];\n const correctChoices = (config.choices || []).filter((ch) => ch.correct);\n\n let score = selectedChoices.reduce(\n (acc, selectedChoice) => acc + (correctChoices.find((ch) => ch.value === selectedChoice) ? 1 : 0),\n 0,\n );\n\n if (correctChoices.length < selectedChoices.length) {\n score -= selectedChoices.length - correctChoices.length;\n\n if (score < 0) {\n score = 0;\n }\n }\n\n const str = correctChoices.length ? score / correctChoices.length : 0;\n\n return parseFloat(str.toFixed(2));\n};\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring = false. the value in `env` will\n * override the value in `model`.\n * @param {Object} model - the main model\n * @param {*} session\n * @param {Object} env\n */\nexport function outcome(model, session, env) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true });\n } else {\n const partialScoringEnabled = partialScoring.enabled(model, env) && model.choiceMode !== 'radio';\n const score = getScore(model, session);\n\n resolve({ score: partialScoringEnabled ? score : score === 1 ? 1 : 0, empty: false });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question || { choices: [] };\n\n resolve({\n id: '1',\n value: choices.filter((c) => c.correct).map((c) => c.value),\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { choices } = model;\n const { minAnswerChoices = 2, maxAnswerChoices } = config;\n const reversedChoices = [...(choices || [])].reverse();\n const choicesErrors = {};\n const rationaleErrors = {};\n const errors = {};\n\n ['teacherInstructions', 'prompt'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n let hasCorrectResponse = false;\n\n reversedChoices.forEach((choice, index) => {\n const { correct, value, label, rationale } = choice;\n\n if (correct) {\n hasCorrectResponse = true;\n }\n\n if (!getContent(label)) {\n choicesErrors[value] = 'Content should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.label === label);\n\n if (identicalAnswer) {\n choicesErrors[value] = 'Content should be unique.';\n }\n }\n\n if (config.rationale?.required && !getContent(rationale)) {\n rationaleErrors[value] = 'This field is required.';\n }\n });\n\n const nbOfChoices = (choices || []).length;\n\n if (nbOfChoices < minAnswerChoices) {\n errors.answerChoices = `There should be at least ${minAnswerChoices} choices defined.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.answerChoices = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (!hasCorrectResponse) {\n errors.correctResponse = 'No correct response defined.';\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choices = choicesErrors;\n }\n\n if (!isEmpty(rationaleErrors)) {\n errors.rationale = rationaleErrors;\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAJA;;AAMA,MAAMK,aAAa,GAAGA,CAACC,KAAK,EAAEC,GAAG,EAAEC,eAAe,KAAMC,MAAM,IAAK;EACjE,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAC,GAAGJ,GAAG,IAAI,CAAC,CAAC;EAChC,MAAMK,GAAG,GAAG;IACVC,KAAK,EAAEJ,MAAM,CAACI,KAAK;IACnBC,KAAK,EAAEL,MAAM,CAACK;EAChB,CAAC;EAED,IAAIJ,IAAI,KAAK,YAAY,KAAKC,IAAI,KAAK,MAAM,IAAIA,IAAI,KAAK,UAAU,CAAC,EAAE;IACrEC,GAAG,CAACG,SAAS,GAAGT,KAAK,CAACU,gBAAgB,GAAGP,MAAM,CAACM,SAAS,GAAG,IAAI;EAClE,CAAC,MAAM;IACLH,GAAG,CAACG,SAAS,GAAG,IAAI;EACtB;EAEA,IAAIJ,IAAI,KAAK,UAAU,EAAE;IACvBC,GAAG,CAACK,OAAO,GAAG,CAAC,CAACR,MAAM,CAACQ,OAAO;IAE9B,IAAIX,KAAK,CAACY,eAAe,EAAE;MACzB,MAAMC,YAAY,GAAIV,MAAM,CAACW,QAAQ,IAAIX,MAAM,CAACW,QAAQ,CAACC,IAAI,IAAK,MAAM;MAExE,IAAIF,YAAY,KAAK,SAAS,EAAE;QAC9BP,GAAG,CAACQ,QAAQ,GAAGZ,eAAe,CAACC,MAAM,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AAgBf,gBAAgB,6BAA6B;EACtF;EAEA,IAAI,CAACS,kBAAkB,EAAE;IACvBJ,MAAM,CAACW,eAAe,GAAG,8BAA8B;EACzD;EAEA,IAAI,CAAC,IAAA7C,iBAAO,EAACgC,aAAa,CAAC,EAAE;IAC3BE,MAAM,CAACrE,OAAO,GAAGmE,aAAa;EAChC;EAEA,IAAI,CAAC,IAAAhC,iBAAO,EAACiC,eAAe,CAAC,EAAE;IAC7BC,MAAM,CAAC5F,SAAS,GAAG2F,eAAe;EACpC;EAEA,OAAOC,MAAM;AACf,CAAC;AAAC5E,OAAA,CAAAqE,QAAA,GAAAA,QAAA","ignoreList":[]}
|
package/controller/lib/utils.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.isResponseCorrect = exports.getCorrectResponse = void 0;
|
|
8
|
-
var
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
9
8
|
const getCorrectResponse = choices => choices.filter(c => c.correct).map(c => c.value).sort();
|
|
10
9
|
exports.getCorrectResponse = getCorrectResponse;
|
|
11
10
|
const isResponseCorrect = (question, session) => {
|
|
12
11
|
let correctResponse = getCorrectResponse(question.choices);
|
|
13
|
-
return session && (0,
|
|
12
|
+
return session && (0, _lodashEs.isEqual)((session.value || []).sort(), correctResponse);
|
|
14
13
|
};
|
|
15
14
|
exports.isResponseCorrect = isResponseCorrect;
|
|
16
15
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_lodashEs","require","getCorrectResponse","choices","filter","c","correct","map","value","sort","exports","isResponseCorrect","question","session","correctResponse","isEqual"],"sources":["../src/utils.js"],"sourcesContent":["import { isEqual } from 'lodash-es';\n\nexport const getCorrectResponse = (choices) =>\n choices\n .filter((c) => c.correct)\n .map((c) => c.value)\n .sort();\n\nexport const isResponseCorrect = (question, session) => {\n let correctResponse = getCorrectResponse(question.choices);\n return session && isEqual((session.value || []).sort(), correctResponse);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEO,MAAMC,kBAAkB,GAAIC,OAAO,IACxCA,OAAO,CACJC,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,OAAO,CAAC,CACxBC,GAAG,CAAEF,CAAC,IAAKA,CAAC,CAACG,KAAK,CAAC,CACnBC,IAAI,CAAC,CAAC;AAACC,OAAA,CAAAR,kBAAA,GAAAA,kBAAA;AAEL,MAAMS,iBAAiB,GAAGA,CAACC,QAAQ,EAAEC,OAAO,KAAK;EACtD,IAAIC,eAAe,GAAGZ,kBAAkB,CAACU,QAAQ,CAACT,OAAO,CAAC;EAC1D,OAAOU,OAAO,IAAI,IAAAE,iBAAO,EAAC,CAACF,OAAO,CAACL,KAAK,IAAI,EAAE,EAAEC,IAAI,CAAC,CAAC,EAAEK,eAAe,CAAC;AAC1E,CAAC;AAACJ,OAAA,CAAAC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|