@pie-element/multiple-choice 9.5.2-next.34 → 9.5.2-next.40
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 +2 -1
- package/configure/lib/defaults.js.map +1 -1
- package/configure/package.json +1 -1
- package/controller/lib/defaults.js +2 -1
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +1 -0
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/lib/choice.js +10 -2
- package/lib/choice.js.map +1 -1
- package/lib/multiple-choice.js +2 -0
- package/lib/multiple-choice.js.map +1 -1
- package/module/configure.js +3 -2
- package/module/controller.js +2 -0
- package/module/element.js +39 -18
- package/module/manifest.json +1 -1
- package/module/print.js +39 -18
- package/package.json +3 -3
|
@@ -28,7 +28,8 @@ var _default = {
|
|
|
28
28
|
studentInstructionsEnabled: true,
|
|
29
29
|
teacherInstructions: '',
|
|
30
30
|
teacherInstructionsEnabled: true,
|
|
31
|
-
toolbarEditorPosition: 'bottom'
|
|
31
|
+
toolbarEditorPosition: 'bottom',
|
|
32
|
+
selectedAnswerBackgroundColor: 'initial'
|
|
32
33
|
},
|
|
33
34
|
configuration: {
|
|
34
35
|
baseInputConfiguration: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","accessibilityLabelsEnabled","choiceMode","choicePrefix","choices","choicesLayout","feedbackEnabled","gridColumns","lockChoiceOrder","partialScoring","prompt","promptEnabled","rationale","rationaleEnabled","scoringType","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","configuration","baseInputConfiguration","audio","disabled","video","image","inputConfiguration","spellCheck","label","settings","enabled","answerChoiceCount","addChoiceButton","deleteChoice","feedback","required","accessibility","studentInstructions","minAnswerChoices","maxAnswerChoices","maxImageWidth","maxImageHeight","withRubric","mathMlOptions","mmlOutput","mmlEditing","language","languageChoices","options"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;eACe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,0BAA0B,EAAE,KADvB;AAELC,IAAAA,UAAU,EAAE,UAFP;AAGLC,IAAAA,YAAY,EAAE,SAHT;AAILC,IAAAA,OAAO,EAAE,EAJJ;AAKLC,IAAAA,aAAa,EAAE,UALV;AAMLC,IAAAA,eAAe,EAAE,KANZ;AAOLC,IAAAA,WAAW,EAAE,CAPR;AAQLC,IAAAA,eAAe,EAAE,IARZ;AASLC,IAAAA,cAAc,EAAE,IATX;AAULC,IAAAA,MAAM,EAAE,EAVH;AAWLC,IAAAA,aAAa,EAAE,IAXV;AAYLC,IAAAA,SAAS,EAAE,EAZN;AAaLC,IAAAA,gBAAgB,EAAE,IAbb;AAcLC,IAAAA,WAAW,EAAE,MAdR;AAeLC,IAAAA,0BAA0B,EAAE,IAfvB;AAgBLC,IAAAA,mBAAmB,EAAE,EAhBhB;AAiBLC,IAAAA,0BAA0B,EAAE,IAjBvB;AAkBLC,IAAAA,qBAAqB,EAAE;
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","accessibilityLabelsEnabled","choiceMode","choicePrefix","choices","choicesLayout","feedbackEnabled","gridColumns","lockChoiceOrder","partialScoring","prompt","promptEnabled","rationale","rationaleEnabled","scoringType","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","selectedAnswerBackgroundColor","configuration","baseInputConfiguration","audio","disabled","video","image","inputConfiguration","spellCheck","label","settings","enabled","answerChoiceCount","addChoiceButton","deleteChoice","feedback","required","accessibility","studentInstructions","minAnswerChoices","maxAnswerChoices","maxImageWidth","maxImageHeight","withRubric","mathMlOptions","mmlOutput","mmlEditing","language","languageChoices","options"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;eACe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,0BAA0B,EAAE,KADvB;AAELC,IAAAA,UAAU,EAAE,UAFP;AAGLC,IAAAA,YAAY,EAAE,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Z;AAHW,OAHD;AAQnBY,MAAAA,QAAQ,EAAE;AARS,KA1FR;AAoGbjB,IAAAA,qBAAqB,EAAE;AACrBW,MAAAA,QAAQ,EAAE,KADW;AAErBD,MAAAA,KAAK,EAAE;AAFc,KApGV;AAwGbU,IAAAA,gBAAgB,EAAE,CAxGL;AAyGbC,IAAAA,gBAAgB,EAAE,CAzGL;AA0GbC,IAAAA,aAAa,EAAE;AACbxB,MAAAA,mBAAmB,EAAE,GADR;AAEbN,MAAAA,MAAM,EAAE,GAFK;AAGbE,MAAAA,SAAS,EAAE,GAHE;AAIbR,MAAAA,OAAO,EAAE;AAJI,KA1GF;AAgHbqC,IAAAA,cAAc,EAAE;AACdzB,MAAAA,mBAAmB,EAAE,GADP;AAEdN,MAAAA,MAAM,EAAE,GAFM;AAGdE,MAAAA,SAAS,EAAE,GAHG;AAIdR,MAAAA,OAAO,EAAE;AAJK,KAhHH;AAsHbsC,IAAAA,UAAU,EAAE;AACVb,MAAAA,QAAQ,EAAE,KADA;AAEVD,MAAAA,KAAK,EAAE;AAFG,KAtHC;AA0Hbe,IAAAA,aAAa,EAAE;AACbC,MAAAA,SAAS,EAAE,KADE;AAEbC,MAAAA,UAAU,EAAE;AAFC,KA1HF;AA8HbC,IAAAA,QAAQ,EAAE;AACRjB,MAAAA,QAAQ,EAAE,KADF;AAERD,MAAAA,KAAK,EAAE,kBAFC;AAGRE,MAAAA,OAAO,EAAE;AAHD,KA9HG;AAmIbiB,IAAAA,eAAe,EAAE;AACfnB,MAAAA,KAAK,EAAE,kBADQ;AAEfoB,MAAAA,OAAO,EAAE;AAFM;AAnIJ;AAtBF,C","sourcesContent":["/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType\n * functionalities are not defined yet - the value for those can belong to\n * model or to configure\n */\nexport default {\n model: {\n accessibilityLabelsEnabled: false,\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 },\n configuration: {\n baseInputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\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 accessibility: {\n settings: false,\n label: 'Accessibility Label',\n inputConfiguration: {\n audio: { disabled: true },\n video: { disabled: true },\n image: { disabled: false },\n },\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"],"file":"defaults.js"}
|
package/configure/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@material-ui/core": "^3.9.2",
|
|
9
9
|
"@material-ui/icons": "^3.0.1",
|
|
10
10
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
11
|
-
"@pie-lib/pie-toolbox": "2.
|
|
11
|
+
"@pie-lib/pie-toolbox": "2.5.0",
|
|
12
12
|
"debug": "^3.1.0",
|
|
13
13
|
"lodash": "^4.17.15",
|
|
14
14
|
"prop-types": "^15.6.2",
|
|
@@ -22,7 +22,8 @@ var _default = {
|
|
|
22
22
|
studentInstructionsEnabled: true,
|
|
23
23
|
teacherInstructions: '',
|
|
24
24
|
teacherInstructionsEnabled: true,
|
|
25
|
-
toolbarEditorPosition: 'bottom'
|
|
25
|
+
toolbarEditorPosition: 'bottom',
|
|
26
|
+
selectedAnswerBackgroundColor: 'initial'
|
|
26
27
|
};
|
|
27
28
|
exports["default"] = _default;
|
|
28
29
|
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["accessibilityLabelsEnabled","choiceMode","choicePrefix","choices","choicesLayout","feedbackEnabled","gridColumns","lockChoiceOrder","partialScoring","prompt","promptEnabled","rationale","rationaleEnabled","scoringType","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition"],"mappings":";;;;;;eAAe;AACbA,EAAAA,0BAA0B,EAAE,KADf;AAEbC,EAAAA,UAAU,EAAE,UAFC;AAGbC,EAAAA,YAAY,EAAE,SAHD;AAIbC,EAAAA,OAAO,EAAE,EAJI;AAKbC,EAAAA,aAAa,EAAE,UALF;AAMbC,EAAAA,eAAe,EAAE,KANJ;AAObC,EAAAA,WAAW,EAAE,CAPA;AAQbC,EAAAA,eAAe,EAAE,IARJ;AASbC,EAAAA,cAAc,EAAE,IATH;AAUbC,EAAAA,MAAM,EAAE,EAVK;AAWbC,EAAAA,aAAa,EAAE,IAXF;AAYbC,EAAAA,SAAS,EAAE,EAZE;AAabC,EAAAA,gBAAgB,EAAE,IAbL;AAcbC,EAAAA,WAAW,EAAE,MAdA;AAebC,EAAAA,0BAA0B,EAAE,IAff;AAgBbC,EAAAA,mBAAmB,EAAE,EAhBR;AAiBbC,EAAAA,0BAA0B,EAAE,IAjBf;AAkBbC,EAAAA,qBAAqB,EAAE;
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["accessibilityLabelsEnabled","choiceMode","choicePrefix","choices","choicesLayout","feedbackEnabled","gridColumns","lockChoiceOrder","partialScoring","prompt","promptEnabled","rationale","rationaleEnabled","scoringType","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","selectedAnswerBackgroundColor"],"mappings":";;;;;;eAAe;AACbA,EAAAA,0BAA0B,EAAE,KADf;AAEbC,EAAAA,UAAU,EAAE,UAFC;AAGbC,EAAAA,YAAY,EAAE,SAHD;AAIbC,EAAAA,OAAO,EAAE,EAJI;AAKbC,EAAAA,aAAa,EAAE,UALF;AAMbC,EAAAA,eAAe,EAAE,KANJ;AAObC,EAAAA,WAAW,EAAE,CAPA;AAQbC,EAAAA,eAAe,EAAE,IARJ;AASbC,EAAAA,cAAc,EAAE,IATH;AAUbC,EAAAA,MAAM,EAAE,EAVK;AAWbC,EAAAA,aAAa,EAAE,IAXF;AAYbC,EAAAA,SAAS,EAAE,EAZE;AAabC,EAAAA,gBAAgB,EAAE,IAbL;AAcbC,EAAAA,WAAW,EAAE,MAdA;AAebC,EAAAA,0BAA0B,EAAE,IAff;AAgBbC,EAAAA,mBAAmB,EAAE,EAhBR;AAiBbC,EAAAA,0BAA0B,EAAE,IAjBf;AAkBbC,EAAAA,qBAAqB,EAAE,QAlBV;AAmBbC,EAAAA,6BAA6B,EAAE;AAnBlB,C","sourcesContent":["export default {\n accessibilityLabelsEnabled: false,\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};\n"],"file":"defaults.js"}
|
package/controller/lib/index.js
CHANGED
|
@@ -152,6 +152,7 @@ function _model() {
|
|
|
152
152
|
extraCSSRules: normalizedQuestion.extraCSSRules,
|
|
153
153
|
fontSizeFactor: normalizedQuestion.fontSizeFactor,
|
|
154
154
|
isSelectionButtonBelow: normalizedQuestion.isSelectionButtonBelow,
|
|
155
|
+
selectedAnswerBackgroundColor: normalizedQuestion.selectedAnswerBackgroundColor || 'initial',
|
|
155
156
|
minSelections: normalizedQuestion.minSelections,
|
|
156
157
|
maxSelections: normalizedQuestion.maxSelections
|
|
157
158
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["prepareChoice","model","env","defaultFeedback","choice","role","mode","out","label","value","accessibilityLabelsEnabled","accessibility","textContent","rationale","rationaleEnabled","correct","feedbackEnabled","feedbackType","feedback","type","createDefaultModel","Promise","resolve","defaults","normalize","question","verticalMode","choicesLayout","questionProps","session","updateSession","normalizedQuestion","Object","assign","incorrect","choices","map","lockChoiceOrder","disabled","prompt","promptEnabled","gridColumns","choiceMode","keyMode","choicePrefix","responseCorrect","undefined","language","extraCSSRules","fontSizeFactor","isSelectionButtonBelow","minSelections","maxSelections","teacherInstructions","teacherInstructionsEnabled","getScore","config","selectedChoices","correctChoices","filter","ch","score","reduce","acc","selectedChoice","find","length","str","parseFloat","toFixed","outcome","empty","partialScoringEnabled","partialScoring","enabled","createCorrectResponseSession","id","c","getInnerText","html","replaceAll","getContent","replace","validate","minAnswerChoices","maxAnswerChoices","reversedChoices","reverse","choicesErrors","rationaleErrors","errors","forEach","field","required","hasCorrectResponse","index","identicalAnswer","slice","some","nbOfChoices","answerChoices","correctResponse"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,EAAQC,GAAR,EAAaC,eAAb;AAAA,SAAiC,UAACC,MAAD,EAAY;AACjE,eAAuBF,GAAG,IAAI,EAA9B;AAAA,QAAQG,IAAR,QAAQA,IAAR;AAAA,QAAcC,IAAd,QAAcA,IAAd;;AACA,QAAMC,GAAG,GAAG;AACVC,MAAAA,KAAK,EAAEJ,MAAM,CAACI,KADJ;AAEVC,MAAAA,KAAK,EAAEL,MAAM,CAACK;AAFJ,KAAZ;;AAKA,QAAIR,KAAK,CAACS,0BAAV,EAAsC;AACpCH,MAAAA,GAAG,CAACI,aAAJ,GAAoB,sBAAUP,MAAM,CAACO,aAAjB,EAAgCC,WAAhC,IAA+CR,MAAM,CAACK,KAA1E;AACD;;AAED,QAAIJ,IAAI,KAAK,YAAT,KAA0BC,IAAI,KAAK,MAAT,IAAmBA,IAAI,KAAK,UAAtD,CAAJ,EAAuE;AACrEC,MAAAA,GAAG,CAACM,SAAJ,GAAgBZ,KAAK,CAACa,gBAAN,GAAyBV,MAAM,CAACS,SAAhC,GAA4C,IAA5D;AACD,KAFD,MAEO;AACLN,MAAAA,GAAG,CAACM,SAAJ,GAAgB,IAAhB;AACD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KAAhB,CAAsBF,KAAK,GAAG,CAA9B,EAAiCG,IAAjC,CAAsC,UAACrB,CAAD;AAAA,eAAOA,CAAC,CAACrE,KAAF,KAAYA,KAAnB;AAAA,OAAtC,CAAxB;;AAEA,UAAIwF,eAAJ,EAAqB;AACnBR,QAAAA,aAAa,CAAC/E,KAAD,CAAb,GAAuB,2BAAvB;AACD;AACF;;AAED,QAAI,qBAAA+C,MAAM,CAAC3C,SAAP,gEAAkBgF,QAAlB,IAA8B,CAACZ,UAAU,CAACpE,SAAD,CAA7C,EAA0D;AACxD4E,MAAAA,eAAe,CAAChF,KAAD,CAAf,GAAyB,yBAAzB;AACD;AACF,GApBD;AAsBA,MAAM0F,WAAW,GAAG,CAAChE,OAAO,IAAI,EAAZ,EAAgB+B,MAApC;;AAEA,MAAIiC,WAAW,GAAGf,gBAAlB,EAAoC;AAClCM,IAAAA,MAAM,CAACU,aAAP,sCAAmDhB,gBAAnD;AACD,GAFD,MAEO,IAAIe,WAAW,GAAGd,gBAAlB,EAAoC;AACzCK,IAAAA,MAAM,CAACU,aAAP,0BAAuCf,gBAAvC;AACD;;AAED,MAAI,CAACS,kBAAL,EAAyB;AACvBJ,IAAAA,MAAM,CAACW,eAAP,GAAyB,8BAAzB;AACD;;AAED,MAAI,CAAC,yBAAQb,aAAR,CAAL,EAA6B;AAC3BE,IAAAA,MAAM,CAACvD,OAAP,GAAiBqD,aAAjB;AACD;;AAED,MAAI,CAAC,yBAAQC,eAAR,CAAL,EAA+B;AAC7BC,IAAAA,MAAM,CAAC7E,SAAP,GAAmB4E,eAAnB;AACD;;AAED,SAAOC,MAAP;AACD,CA3DM","sourcesContent":["/* eslint-disable no-console */\nimport isEmpty from 'lodash/isEmpty';\nimport { isResponseCorrect, parseHTML } from './utils';\nimport defaults from './defaults';\nimport { lockChoices, partialScoring, getShuffledChoices } from '@pie-lib/pie-toolbox/controller-utils';\n\nconst prepareChoice = (model, env, defaultFeedback) => (choice) => {\n const { role, mode } = env || {};\n const out = {\n label: choice.label,\n value: choice.value,\n };\n\n if (model.accessibilityLabelsEnabled) {\n out.accessibility = parseHTML(choice.accessibility).textContent || choice.value;\n }\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = model.rationaleEnabled ? choice.rationale : null;\n } else {\n out.rationale = null;\n }\n\n if (mode === 'evaluate') {\n out.correct = !!choice.correct;\n\n if (model.feedbackEnabled) {\n const feedbackType = (choice.feedback && choice.feedback.type) || 'none';\n\n if (feedbackType === 'default') {\n out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];\n } else if (feedbackType === 'custom') {\n out.feedback = choice.feedback.value;\n }\n }\n }\n\n return out;\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = (question) => {\n const { verticalMode, choicesLayout, ...questionProps } = question || {};\n\n return {\n ...defaults,\n ...questionProps,\n // This is used for offering support for old models which have the property verticalMode\n // Same thing is set in authoring : packages/multiple-choice/configure/src/index.jsx - createDefaultModel\n choicesLayout: choicesLayout || (verticalMode === false && 'horizontal') || defaults.choicesLayout,\n };\n};\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n\n const defaultFeedback = Object.assign(\n { correct: 'Correct', incorrect: 'Incorrect' },\n normalizedQuestion.defaultFeedback,\n );\n\n let choices = (normalizedQuestion.choices || []).map(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 minSelections: normalizedQuestion.minSelections,\n maxSelections: normalizedQuestion.maxSelections,\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 and iframe\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe)([^>]+)>)/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"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["prepareChoice","model","env","defaultFeedback","choice","role","mode","out","label","value","accessibilityLabelsEnabled","accessibility","textContent","rationale","rationaleEnabled","correct","feedbackEnabled","feedbackType","feedback","type","createDefaultModel","Promise","resolve","defaults","normalize","question","verticalMode","choicesLayout","questionProps","session","updateSession","normalizedQuestion","Object","assign","incorrect","choices","map","lockChoiceOrder","disabled","prompt","promptEnabled","gridColumns","choiceMode","keyMode","choicePrefix","responseCorrect","undefined","language","extraCSSRules","fontSizeFactor","isSelectionButtonBelow","selectedAnswerBackgroundColor","minSelections","maxSelections","teacherInstructions","teacherInstructionsEnabled","getScore","config","selectedChoices","correctChoices","filter","ch","score","reduce","acc","selectedChoice","find","length","str","parseFloat","toFixed","outcome","empty","partialScoringEnabled","partialScoring","enabled","createCorrectResponseSession","id","c","getInnerText","html","replaceAll","getContent","replace","validate","minAnswerChoices","maxAnswerChoices","reversedChoices","reverse","choicesErrors","rationaleErrors","errors","forEach","field","required","hasCorrectResponse","index","identicalAnswer","slice","some","nbOfChoices","answerChoices","correctResponse"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,EAAQC,GAAR,EAAaC,eAAb;AAAA,SAAiC,UAACC,MAAD,EAAY;AACjE,eAAuBF,GAAG,IAAI,EAA9B;AAAA,QAAQG,IAAR,QAAQA,IAAR;AAAA,QAAcC,IAAd,QAAcA,IAAd;;AACA,QAAMC,GAAG,GAAG;AACVC,MAAAA,KAAK,EAAEJ,MAAM,CAACI,KADJ;AAEVC,MAAAA,KAAK,EAAEL,MAAM,CAACK;AAFJ,KAAZ;;AAKA,QAAIR,KAAK,CAACS,0BAAV,EAAsC;AACpCH,MAAAA,GAAG,CAACI,aAAJ,GAAoB,sBAAUP,MAAM,CAACO,aAAjB,EAAgCC,WAAhC,IAA+CR,MAAM,CAACK,KAA1E;AACD;;AAED,QAAIJ,IAAI,KAAK,YAAT,KAA0BC,IAAI,K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AA,MAAM,CAAC9E,SAAP,GAAmB6E,eAAnB;AACD;;AAED,SAAOC,MAAP;AACD,CA3DM","sourcesContent":["/* eslint-disable no-console */\nimport isEmpty from 'lodash/isEmpty';\nimport { isResponseCorrect, parseHTML } from './utils';\nimport defaults from './defaults';\nimport { lockChoices, partialScoring, getShuffledChoices } from '@pie-lib/pie-toolbox/controller-utils';\n\nconst prepareChoice = (model, env, defaultFeedback) => (choice) => {\n const { role, mode } = env || {};\n const out = {\n label: choice.label,\n value: choice.value,\n };\n\n if (model.accessibilityLabelsEnabled) {\n out.accessibility = parseHTML(choice.accessibility).textContent || choice.value;\n }\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.rationale = model.rationaleEnabled ? choice.rationale : null;\n } else {\n out.rationale = null;\n }\n\n if (mode === 'evaluate') {\n out.correct = !!choice.correct;\n\n if (model.feedbackEnabled) {\n const feedbackType = (choice.feedback && choice.feedback.type) || 'none';\n\n if (feedbackType === 'default') {\n out.feedback = defaultFeedback[choice.correct ? 'correct' : 'incorrect'];\n } else if (feedbackType === 'custom') {\n out.feedback = choice.feedback.value;\n }\n }\n }\n\n return out;\n};\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => resolve({ ...defaults, ...model }));\n}\n\nexport const normalize = (question) => {\n const { verticalMode, choicesLayout, ...questionProps } = question || {};\n\n return {\n ...defaults,\n ...questionProps,\n // This is used for offering support for old models which have the property verticalMode\n // Same thing is set in authoring : packages/multiple-choice/configure/src/index.jsx - createDefaultModel\n choicesLayout: choicesLayout || (verticalMode === false && 'horizontal') || defaults.choicesLayout,\n };\n};\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(question, session, env, updateSession) {\n const normalizedQuestion = normalize(question);\n\n const defaultFeedback = Object.assign(\n { correct: 'Correct', incorrect: 'Incorrect' },\n normalizedQuestion.defaultFeedback,\n );\n\n let choices = (normalizedQuestion.choices || []).map(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 minSelections: normalizedQuestion.minSelections,\n maxSelections: normalizedQuestion.maxSelections,\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 and iframe\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe)([^>]+)>)/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"],"file":"index.js"}
|
package/controller/package.json
CHANGED
package/lib/choice.js
CHANGED
|
@@ -87,7 +87,8 @@ var Choice = /*#__PURE__*/function (_React$Component) {
|
|
|
87
87
|
classes = _this$props2.classes,
|
|
88
88
|
choicesLayout = _this$props2.choicesLayout,
|
|
89
89
|
gridColumns = _this$props2.gridColumns,
|
|
90
|
-
isSelectionButtonBelow = _this$props2.isSelectionButtonBelow
|
|
90
|
+
isSelectionButtonBelow = _this$props2.isSelectionButtonBelow,
|
|
91
|
+
selectedAnswerBackgroundColor = _this$props2.selectedAnswerBackgroundColor;
|
|
91
92
|
var choiceClass = 'choice' + (index === choicesLength - 1 ? ' last' : '');
|
|
92
93
|
var feedback = !isEvaluateMode || showCorrect ? '' : choice.feedback;
|
|
93
94
|
|
|
@@ -107,9 +108,13 @@ var Choice = /*#__PURE__*/function (_React$Component) {
|
|
|
107
108
|
});
|
|
108
109
|
|
|
109
110
|
var names = (0, _classnames["default"])(classes.choice, (_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.noBorder, index === choicesLength - 1 || choicesLayout !== 'vertical'), (0, _defineProperty2["default"])(_classNames, classes.horizontalLayout, choicesLayout === 'horizontal'), _classNames));
|
|
111
|
+
var choiceBackground = selectedAnswerBackgroundColor && checked ? selectedAnswerBackgroundColor : 'initial';
|
|
110
112
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
111
113
|
className: choiceClass,
|
|
112
|
-
key: index
|
|
114
|
+
key: index,
|
|
115
|
+
style: {
|
|
116
|
+
backgroundColor: choiceBackground
|
|
117
|
+
}
|
|
113
118
|
}, /*#__PURE__*/_react["default"].createElement(_choiceInput["default"], (0, _extends2["default"])({}, choiceProps, {
|
|
114
119
|
className: names
|
|
115
120
|
})));
|
|
@@ -135,6 +140,7 @@ Choice.propTypes = {
|
|
|
135
140
|
displayKey: _propTypes["default"].string,
|
|
136
141
|
choicesLayout: _propTypes["default"].oneOf(['vertical', 'grid', 'horizontal']),
|
|
137
142
|
gridColumns: _propTypes["default"].string,
|
|
143
|
+
selectedAnswerBackgroundColor: _propTypes["default"].string,
|
|
138
144
|
isSelectionButtonBelow: _propTypes["default"].bool
|
|
139
145
|
};
|
|
140
146
|
|
|
@@ -143,6 +149,8 @@ var _default = (0, _styles.withStyles)(function (theme) {
|
|
|
143
149
|
choice: {
|
|
144
150
|
paddingTop: theme.spacing.unit * 2.5,
|
|
145
151
|
paddingBottom: theme.spacing.unit + 2,
|
|
152
|
+
paddingLeft: theme.spacing.unit + 2,
|
|
153
|
+
paddingRight: theme.spacing.unit + 2,
|
|
146
154
|
borderBottom: "1px solid ".concat(theme.palette.grey[300])
|
|
147
155
|
},
|
|
148
156
|
noBorder: {
|
package/lib/choice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/choice.jsx"],"names":["Choice","choice","props","disabled","onChoiceChanged","index","choicesLength","showCorrect","isEvaluateMode","choiceMode","checked","correctness","displayKey","classes","choicesLayout","gridColumns","isSelectionButtonBelow","choiceClass","feedback","choiceProps","onChange","names","noBorder","horizontalLayout","React","Component","propTypes","PropTypes","oneOf","object","bool","isRequired","func","number","string","theme","paddingTop","spacing","unit","paddingBottom","borderBottom","palette","grey","
|
|
1
|
+
{"version":3,"sources":["../src/choice.jsx"],"names":["Choice","choice","props","disabled","onChoiceChanged","index","choicesLength","showCorrect","isEvaluateMode","choiceMode","checked","correctness","displayKey","classes","choicesLayout","gridColumns","isSelectionButtonBelow","selectedAnswerBackgroundColor","choiceClass","feedback","choiceProps","onChange","names","noBorder","horizontalLayout","choiceBackground","backgroundColor","React","Component","propTypes","PropTypes","oneOf","object","bool","isRequired","func","number","string","theme","paddingTop","spacing","unit","paddingBottom","paddingLeft","paddingRight","borderBottom","palette","grey","marginRight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;IAEaA,M;;;;;;;;;;;;;;;iGAGA,UAACC,MAAD,EAAY;AACrB,wBAAsC,MAAKC,KAA3C;AAAA,UAAQC,QAAR,eAAQA,QAAR;AAAA,UAAkBC,eAAlB,eAAkBA,eAAlB;;AAEA,UAAI,CAACD,QAAL,EAAe;AACbC,QAAAA,eAAe,CAACH,MAAD,CAAf;AACD;AACF,K;;;;;;WAED,kBAAS;AAAA;;AACP,yBAgBI,KAAKC,KAhBT;AAAA,UACED,MADF,gBACEA,MADF;AAAA,UAEEI,KAFF,gBAEEA,KAFF;AAAA,UAGEC,aAHF,gBAGEA,aAHF;AAAA,UAIEC,WAJF,gBAIEA,WAJF;AAAA,UAKEC,cALF,gBAKEA,cALF;AAAA,UAMEC,UANF,gBAMEA,UANF;AAAA,UAOEN,QAPF,gBAOEA,QAPF;AAAA,UAQEO,OARF,gBAQEA,OARF;AAAA,UASEC,WATF,gBASEA,WATF;AAAA,UAUEC,UAVF,gBAUEA,UAVF;AAAA,UAWEC,OAXF,gBAWEA,OAXF;AAAA,UAYEC,aAZF,gBAYEA,aAZF;AAAA,UAaEC,WAbF,gBAaEA,WAbF;AAAA,UAcEC,sBAdF,gBAcEA,sBAdF;AAAA,UAeEC,6BAfF,gBAeEA,6BAfF;AAiBA,UAAMC,WAAW,GAAG,YAAYb,KAAK,KAAKC,aAAa,GAAG,CAA1B,GAA8B,OAA9B,GAAwC,EAApD,CAApB;AAEA,UAAMa,QAAQ,GAAG,CAACX,cAAD,IAAmBD,WAAnB,GAAiC,EAAjC,GAAsCN,MAAM,CAACkB,QAA9D;;AAEA,UAAMC,WAAW,mCACZnB,MADY;AAEf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,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB,GADnB;AAEhB,iBAAW;AACTO,QAAAA,WAAW,EAAEV,KAAK,CAACE,OAAN,CAAcC,IADlB,CAET;AACA;AACA;;AAJS;AAFK;AAXkB,GAAZ;AAAA,CAAX,EAoBXzC,MApBW,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nimport ChoiceInput from './choice-input';\n\nexport class Choice extends React.Component {\n static propTypes = {};\n\n onChange = (choice) => {\n const { disabled, onChoiceChanged } = this.props;\n\n if (!disabled) {\n onChoiceChanged(choice);\n }\n };\n\n render() {\n const {\n choice,\n index,\n choicesLength,\n showCorrect,\n isEvaluateMode,\n choiceMode,\n disabled,\n checked,\n correctness,\n displayKey,\n classes,\n choicesLayout,\n gridColumns,\n isSelectionButtonBelow,\n selectedAnswerBackgroundColor\n } = this.props;\n const choiceClass = 'choice' + (index === choicesLength - 1 ? ' last' : '');\n\n const feedback = !isEvaluateMode || showCorrect ? '' : choice.feedback;\n\n const choiceProps = {\n ...choice,\n checked,\n choiceMode,\n disabled,\n feedback,\n correctness,\n displayKey,\n index,\n choicesLayout,\n gridColumns,\n onChange: this.onChange,\n isEvaluateMode,\n isSelectionButtonBelow,\n };\n\n const names = classNames(classes.choice, {\n [classes.noBorder]: index === choicesLength - 1 || choicesLayout !== 'vertical',\n [classes.horizontalLayout]: choicesLayout === 'horizontal',\n });\n\n const choiceBackground = selectedAnswerBackgroundColor && checked ? selectedAnswerBackgroundColor : 'initial';\n\n return (\n <div className={choiceClass} key={index} style={{ backgroundColor: choiceBackground }}>\n <ChoiceInput {...choiceProps} className={names} />\n </div>\n );\n }\n}\n\nChoice.propTypes = {\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n choice: PropTypes.object,\n disabled: PropTypes.bool.isRequired,\n onChoiceChanged: PropTypes.func,\n classes: PropTypes.object.isRequired,\n index: PropTypes.number,\n choicesLength: PropTypes.number,\n showCorrect: PropTypes.bool,\n isEvaluateMode: PropTypes.bool,\n checked: PropTypes.bool,\n correctness: PropTypes.string,\n displayKey: PropTypes.string,\n choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),\n gridColumns: PropTypes.string,\n selectedAnswerBackgroundColor: PropTypes.string,\n isSelectionButtonBelow: PropTypes.bool\n};\n\nexport default withStyles((theme) => ({\n choice: {\n paddingTop: theme.spacing.unit * 2.5,\n paddingBottom: theme.spacing.unit + 2,\n paddingLeft: theme.spacing.unit + 2,\n paddingRight: theme.spacing.unit + 2,\n borderBottom: `1px solid ${theme.palette.grey[300]}`,\n },\n noBorder: {\n borderBottom: 'none',\n },\n horizontalLayout: {\n paddingRight: theme.spacing.unit * 2.5,\n '& label': {\n marginRight: theme.spacing.unit,\n // '& span:first-child': {\n // paddingRight: 0\n // }\n },\n },\n}))(Choice);\n"],"file":"choice.js"}
|
package/lib/multiple-choice.js
CHANGED
|
@@ -336,6 +336,7 @@ var MultipleChoice = /*#__PURE__*/function (_React$Component) {
|
|
|
336
336
|
}, choices.map(function (choice, index) {
|
|
337
337
|
return /*#__PURE__*/_react["default"].createElement(_choice["default"], {
|
|
338
338
|
choicesLayout: _this3.props.choicesLayout,
|
|
339
|
+
selectedAnswerBackgroundColor: _this3.props.selectedAnswerBackgroundColor,
|
|
339
340
|
gridColumns: gridColumns,
|
|
340
341
|
key: "choice-".concat(index),
|
|
341
342
|
choice: choice,
|
|
@@ -389,6 +390,7 @@ exports.MultipleChoice = MultipleChoice;
|
|
|
389
390
|
alwaysShowCorrect: _propTypes["default"].bool,
|
|
390
391
|
animationsDisabled: _propTypes["default"].bool,
|
|
391
392
|
language: _propTypes["default"].string,
|
|
393
|
+
selectedAnswerBackgroundColor: _propTypes["default"].string,
|
|
392
394
|
onShowCorrectToggle: _propTypes["default"].func,
|
|
393
395
|
isSelectionButtonBelow: _propTypes["default"].bool,
|
|
394
396
|
minSelections: _propTypes["default"].number,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/multiple-choice.jsx"],"names":["translator","Translator","styles","theme","main","color","text","backgroundColor","background","partLabel","display","fontSize","margin","fontWeight","paddingBottom","spacing","unit","teacherInstructions","marginBottom","horizontalLayout","flexDirection","flexWrap","gridLayout","fieldset","border","padding","minWidth","srOnly","position","left","top","width","height","overflow","errorText","typography","palette","error","paddingTop","MultipleChoice","props","event","target","value","checked","choiceMode","maxSelections","onChoiceChanged","setState","selectedValue","selectedValues","state","length","prevState","filter","currentValue","selected","mode","showCorrect","onShowCorrectToggle","choice","isCorrect","correct","isChecked","isSelected","undefined","alwaysShowCorrect","onToggle","bind","sessionValue","session","indexOf","nextProps","correctResponse","index","keyMode","String","fromCharCode","toUpperCase","includes","classes","disabled","className","choices","gridColumns","prompt","responseCorrect","animationsDisabled","language","isSelectionButtonBelow","minSelections","isEvaluateMode","showCorrectAnswerToggle","columnsStyle","gridTemplateColumns","selections","teacherInstructionsDiv","renderHeading","hidden","visible","choicesLayout","map","handleChange","hideTick","getChecked","getCorrectness","indexToSymbol","t","lng","React","Component","PropTypes","string","oneOf","array","object","bool","func","isRequired","number","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAEA;AAEA,IAAQA,UAAR,GAAuBC,sBAAvB,CAAQD,UAAR;;AAEA,IAAME,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EADH;AAEJC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN,EAFb;AAGJ,aAAO;AACL,kCAA0B;AADrB;AAHH,KADmB;AAQzBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,OAAO,EAAE,OADA;AAETC,MAAAA,QAAQ,EAAE,SAFD;AAGTC,MAAAA,MAAM,EAAE,GAHC;AAITC,MAAAA,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,sBAAUG,KAdV;AAejBd,EAAAA,aAAa,EAAEW,sBAAUE,KAAV,CAAgB,CAAC,UAAD,EAAa,MAAb,EAAqB,YAArB,CAAhB,CAfE;AAgBjB7B,EAAAA,WAAW,EAAE2B,sBAAUC,MAhBN;AAiBjB9C,EAAAA,iBAAiB,EAAE6C,sBAAUK,IAjBZ;AAkBjB7B,EAAAA,kBAAkB,EAAEwB,sBAAUK,IAlBb;AAmBjB5B,EAAAA,QAAQ,EAAEuB,sBAAUC,MAnBH;AAoBjBrD,EAAAA,mBAAmB,EAAEoD,sBAAUM,IApBd;AAqBjB5B,EAAAA,sBAAsB,EAAEsB,sBAAUK,IArBjB;AAsBjB1B,EAAAA,aAAa,EAAEqB,sBAAUQ,MAtBR;AAuBjBzE,EAAAA,aAAa,EAAEiE,sBAAUQ;AAvBR,C;AAiSrBhF,cAAc,CAACiF,YAAf,GAA8B;AAC5BlD,EAAAA,OAAO,EAAE;AACP3B,IAAAA,KAAK,EAAE;AADA;AADmB,CAA9B;;eAMe,wBAAWzC,MAAX,EAAmBqC,cAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { CorrectAnswerToggle } from '@pie-lib/pie-toolbox/correct-answer-toggle';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color, Collapsible, PreviewPrompt } from '@pie-lib/pie-toolbox/render-ui';\nimport Translator from '@pie-lib/pie-toolbox/translator';\n\nimport StyledChoice from './choice';\n\n// MultipleChoice\n\nconst { translator } = Translator;\n\nconst styles = (theme) => ({\n main: {\n color: color.text(),\n backgroundColor: color.background(),\n '& *': {\n '-webkit-font-smoothing': 'antialiased',\n },\n },\n partLabel: {\n display: 'block',\n fontSize: 'inherit',\n margin: '0',\n fontWeight: 'normal',\n paddingBottom: theme.spacing.unit * 2,\n },\n teacherInstructions: {\n marginBottom: theme.spacing.unit * 2,\n },\n horizontalLayout: {\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n },\n gridLayout: {\n display: 'grid',\n },\n fieldset: {\n border: '0px',\n padding: '0.01em 0 0 0',\n margin: '0px',\n minWidth: '0px',\n },\n srOnly: {\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit,\n },\n});\n\nexport class MultipleChoice extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n mode: PropTypes.oneOf(['gather', 'view', 'evaluate']),\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n keyMode: PropTypes.oneOf(['numbers', 'letters', 'none']),\n choices: PropTypes.array,\n partLabel: PropTypes.string,\n prompt: PropTypes.string,\n teacherInstructions: PropTypes.string,\n session: PropTypes.object,\n disabled: PropTypes.bool,\n onChoiceChanged: PropTypes.func,\n responseCorrect: PropTypes.bool,\n classes: PropTypes.object.isRequired,\n correctResponse: PropTypes.array,\n choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),\n gridColumns: PropTypes.string,\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n language: PropTypes.string,\n onShowCorrectToggle: PropTypes.func,\n isSelectionButtonBelow: PropTypes.bool,\n minSelections: PropTypes.number,\n maxSelections: PropTypes.number,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n selectedValue: null,\n selectedValues: [],\n showCorrect: this.props.alwaysShowCorrect || false,\n };\n\n this.onToggle = this.onToggle.bind(this);\n }\n\n isSelected(value) {\n const sessionValue = this.props.session && this.props.session.value;\n\n return sessionValue && sessionValue.indexOf && sessionValue.indexOf(value) >= 0;\n }\n\n // handleChange was added for accessibility. Please see comments and videos from PD-2441.\n // TODO: Should only be removed if a better solution is found.\n handleChange = (event) => {\n const { value, checked } = event.target;\n const { choiceMode, maxSelections, onChoiceChanged } = this.props;\n\n if (choiceMode === 'radio') {\n this.setState({ selectedValue: value });\n } else {\n const { selectedValues } = this.state;\n\n if (checked && selectedValues.length >= maxSelections) {\n return;\n }\n\n this.setState((prevState) => {\n const selectedValues = checked\n ? [...prevState.selectedValues, value]\n : prevState.selectedValues.filter((currentValue) => currentValue !== value);\n\n return { selectedValues };\n });\n }\n\n onChoiceChanged({ value, selected: checked });\n };\n\n onToggle = () => {\n if (this.props.mode === 'evaluate') {\n this.setState({ showCorrect: !this.state.showCorrect }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (!nextProps.correctResponse && this.state.showCorrect !== false) {\n this.setState({ showCorrect: false }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n\n if (nextProps.alwaysShowCorrect && this.state.showCorrect !== true) {\n this.setState({ showCorrect: true }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n }\n\n indexToSymbol(index) {\n if (this.props.keyMode === 'numbers') {\n return `${index + 1}`;\n }\n\n if (this.props.keyMode === 'letters') {\n return String.fromCharCode(97 + index).toUpperCase();\n }\n\n return '';\n }\n\n getCorrectness = (choice = {}) => {\n const isCorrect = choice.correct;\n const isChecked = this.isSelected(choice.value);\n\n if (this.state.showCorrect) {\n return isCorrect ? 'correct' : undefined;\n }\n\n if (isCorrect) {\n if (isChecked) {\n // A correct answer is selected: marked with a green checkmark\n return 'correct';\n } else {\n // A correct answer is NOT selected: marked with an orange X\n return 'incorrect';\n }\n } else {\n if (isChecked) {\n // An incorrect answer is selected: marked with an orange X\n return 'incorrect';\n } else {\n // An incorrect answer is NOT selected: not marked\n return undefined;\n }\n }\n };\n\n getChecked(choice) {\n if (this.state.showCorrect) {\n return choice.correct || false;\n }\n\n if (this.isSelected(choice.value)) {\n return true;\n }\n\n return this.props.choiceMode === 'radio'\n ? this.state.selectedValue === choice.value\n : this.state.selectedValues.includes(choice.value);\n }\n\n // renderHeading function was added for accessibility.\n renderHeading() {\n const { mode, choiceMode, classes } = this.props;\n\n if (mode !== 'gather') {\n return null;\n }\n\n return choiceMode === 'radio' ? (\n <h2 className={classes.srOnly}>Multiple Choice Question</h2>\n ) : (\n <h2 className={classes.srOnly}>Multiple Select Question</h2>\n );\n }\n\n render() {\n const {\n mode,\n disabled,\n className,\n choices = [],\n choiceMode,\n gridColumns,\n partLabel,\n prompt,\n responseCorrect,\n teacherInstructions,\n classes,\n alwaysShowCorrect,\n animationsDisabled,\n language,\n isSelectionButtonBelow,\n minSelections,\n maxSelections,\n session,\n } = this.props;\n const { showCorrect } = this.state;\n const isEvaluateMode = mode === 'evaluate';\n const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;\n const columnsStyle = gridColumns > 1 ? { gridTemplateColumns: `repeat(${gridColumns}, 1fr)` } : undefined;\n const selections = (session.value && session.value.length) || 0;\n\n const teacherInstructionsDiv = (\n <PreviewPrompt\n tagName=\"div\"\n className=\"prompt\"\n defaultClassName=\"teacher-instructions\"\n prompt={teacherInstructions}\n />\n );\n\n return (\n <div className={classNames(classes.main, className, 'multiple-choice')}>\n {partLabel && <h3 className={classes.partLabel}>{partLabel}</h3>}\n\n {this.renderHeading()}\n\n {teacherInstructions && (\n <div className={classes.teacherInstructions}>\n {!animationsDisabled ? (\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </div>\n )}\n\n <fieldset className={classes.fieldset}>\n <PreviewPrompt className=\"prompt\" defaultClassName=\"prompt\" prompt={prompt} tagName={'legend'} />\n\n {!alwaysShowCorrect && (\n <CorrectAnswerToggle\n show={showCorrectAnswerToggle}\n toggled={showCorrect}\n onToggle={this.onToggle.bind(this)}\n language={language}\n />\n )}\n\n <div\n className={classNames({\n [classes.gridLayout]: this.props.choicesLayout === 'grid',\n [classes.horizontalLayout]: this.props.choicesLayout === 'horizontal',\n })}\n style={columnsStyle}\n >\n {choices.map((choice, index) => (\n <StyledChoice\n choicesLayout={this.props.choicesLayout}\n gridColumns={gridColumns}\n key={`choice-${index}`}\n choice={choice}\n index={index}\n choicesLength={choices.length}\n showCorrect={showCorrect}\n isEvaluateMode={isEvaluateMode}\n choiceMode={choiceMode}\n disabled={disabled}\n onChoiceChanged={this.handleChange}\n hideTick={choice.hideTick}\n checked={this.getChecked(choice)}\n correctness={isEvaluateMode ? this.getCorrectness(choice) : undefined}\n displayKey={this.indexToSymbol(index)}\n isSelectionButtonBelow={isSelectionButtonBelow}\n />\n ))}\n </div>\n </fieldset>\n\n {choiceMode === 'checkbox' && selections < minSelections && (\n <div className={classes.errorText}>\n {translator.t(`translation:multipleChoice:minSelections_${minSelections === 1 ? 'one' : 'other'}`, {\n lng: language,\n minSelections,\n })}\n </div>\n )}\n {choiceMode === 'checkbox' && selections >= maxSelections && (\n <div className={classes.errorText}>\n {translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {\n lng: language,\n maxSelections,\n })}\n </div>\n )}\n </div>\n );\n }\n}\n\nMultipleChoice.defaultProps = {\n session: {\n value: [],\n },\n};\n\nexport default withStyles(styles)(MultipleChoice);\n"],"file":"multiple-choice.js"}
|
|
1
|
+
{"version":3,"sources":["../src/multiple-choice.jsx"],"names":["translator","Translator","styles","theme","main","color","text","backgroundColor","background","partLabel","display","fontSize","margin","fontWeight","paddingBottom","spacing","unit","teacherInstructions","marginBottom","horizontalLayout","flexDirection","flexWrap","gridLayout","fieldset","border","padding","minWidth","srOnly","position","left","top","width","height","overflow","errorText","typography","palette","error","paddingTop","MultipleChoice","props","event","target","value","checked","choiceMode","maxSelections","onChoiceChanged","setState","selectedValue","selectedValues","state","length","prevState","filter","currentValue","selected","mode","showCorrect","onShowCorrectToggle","choice","isCorrect","correct","isChecked","isSelected","undefined","alwaysShowCorrect","onToggle","bind","sessionValue","session","indexOf","nextProps","correctResponse","index","keyMode","String","fromCharCode","toUpperCase","includes","classes","disabled","className","choices","gridColumns","prompt","responseCorrect","animationsDisabled","language","isSelectionButtonBelow","minSelections","isEvaluateMode","showCorrectAnswerToggle","columnsStyle","gridTemplateColumns","selections","teacherInstructionsDiv","renderHeading","hidden","visible","choicesLayout","map","selectedAnswerBackgroundColor","handleChange","hideTick","getChecked","getCorrectness","indexToSymbol","t","lng","React","Component","PropTypes","string","oneOf","array","object","bool","func","isRequired","number","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAEA;AAEA,IAAQA,UAAR,GAAuBC,sBAAvB,CAAQD,UAAR;;AAEA,IAAME,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EADH;AAEJC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN,EAFb;AAGJ,aAAO;AACL,kCAA0B;AADrB;AAHH,KADmB;AAQzBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,OAAO,EAAE,OADA;AAETC,MAAAA,QAAQ,EAAE,SAFD;AAGTC,MAAAA,MAAM,EAAE,GAHC;AAITC,MAAAA,UAAU,EAAE,QAJH;AAKTC,MAAAA,aAAa,EAAEX,KAAK,CAACY,OAAN,CAAcC,IAAd,GAAqB;AAL3B,KARc;AAezBC,IAAAA,mBAAmB,EAAE;AACnBC,MAAAA,YAAY,EAAEf,KAAK,CAACY,OAAN,CAAcC,IAAd,GAAqB;AADhB,KAfI;AAkBzBG,IAAAA,gBAAgB,EAAE;AAChBT,MAAAA,OAAO,EAAE,MADO;AAEhBU,MAAAA,aAAa,EAAE,KAFC;AAGhBC,MAAAA,QAAQ,EAAE;AAHM,KAlBO;AAuBzBC,IAAAA,UAAU,EAAE;AACVZ,MAAAA,OAAO,EAAE;AADC,KAvBa;AA0BzBa,IAAAA,QAAQ,EAAE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EAAAA,mBAAmB,EAAEqD,sBAAUM,IArBd;AAsBjB7B,EAAAA,sBAAsB,EAAEuB,sBAAUK,IAtBjB;AAuBjB3B,EAAAA,aAAa,EAAEsB,sBAAUQ,MAvBR;AAwBjB1E,EAAAA,aAAa,EAAEkE,sBAAUQ;AAxBR,C;AAmSrBjF,cAAc,CAACkF,YAAf,GAA8B;AAC5BnD,EAAAA,OAAO,EAAE;AACP3B,IAAAA,KAAK,EAAE;AADA;AADmB,CAA9B;;eAMe,wBAAWzC,MAAX,EAAmBqC,cAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { CorrectAnswerToggle } from '@pie-lib/pie-toolbox/correct-answer-toggle';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color, Collapsible, PreviewPrompt } from '@pie-lib/pie-toolbox/render-ui';\nimport Translator from '@pie-lib/pie-toolbox/translator';\n\nimport StyledChoice from './choice';\n\n// MultipleChoice\n\nconst { translator } = Translator;\n\nconst styles = (theme) => ({\n main: {\n color: color.text(),\n backgroundColor: color.background(),\n '& *': {\n '-webkit-font-smoothing': 'antialiased',\n },\n },\n partLabel: {\n display: 'block',\n fontSize: 'inherit',\n margin: '0',\n fontWeight: 'normal',\n paddingBottom: theme.spacing.unit * 2,\n },\n teacherInstructions: {\n marginBottom: theme.spacing.unit * 2,\n },\n horizontalLayout: {\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n },\n gridLayout: {\n display: 'grid',\n },\n fieldset: {\n border: '0px',\n padding: '0.01em 0 0 0',\n margin: '0px',\n minWidth: '0px',\n },\n srOnly: {\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit,\n },\n});\n\nexport class MultipleChoice extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n mode: PropTypes.oneOf(['gather', 'view', 'evaluate']),\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n keyMode: PropTypes.oneOf(['numbers', 'letters', 'none']),\n choices: PropTypes.array,\n partLabel: PropTypes.string,\n prompt: PropTypes.string,\n teacherInstructions: PropTypes.string,\n session: PropTypes.object,\n disabled: PropTypes.bool,\n onChoiceChanged: PropTypes.func,\n responseCorrect: PropTypes.bool,\n classes: PropTypes.object.isRequired,\n correctResponse: PropTypes.array,\n choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),\n gridColumns: PropTypes.string,\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n language: PropTypes.string,\n selectedAnswerBackgroundColor: PropTypes.string,\n onShowCorrectToggle: PropTypes.func,\n isSelectionButtonBelow: PropTypes.bool,\n minSelections: PropTypes.number,\n maxSelections: PropTypes.number,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n selectedValue: null,\n selectedValues: [],\n showCorrect: this.props.alwaysShowCorrect || false,\n };\n\n this.onToggle = this.onToggle.bind(this);\n }\n\n isSelected(value) {\n const sessionValue = this.props.session && this.props.session.value;\n\n return sessionValue && sessionValue.indexOf && sessionValue.indexOf(value) >= 0;\n }\n\n // handleChange was added for accessibility. Please see comments and videos from PD-2441.\n // TODO: Should only be removed if a better solution is found.\n handleChange = (event) => {\n const { value, checked } = event.target;\n const { choiceMode, maxSelections, onChoiceChanged } = this.props;\n\n if (choiceMode === 'radio') {\n this.setState({ selectedValue: value });\n } else {\n const { selectedValues } = this.state;\n\n if (checked && selectedValues.length >= maxSelections) {\n return;\n }\n\n this.setState((prevState) => {\n const selectedValues = checked\n ? [...prevState.selectedValues, value]\n : prevState.selectedValues.filter((currentValue) => currentValue !== value);\n\n return { selectedValues };\n });\n }\n\n onChoiceChanged({ value, selected: checked });\n };\n\n onToggle = () => {\n if (this.props.mode === 'evaluate') {\n this.setState({ showCorrect: !this.state.showCorrect }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (!nextProps.correctResponse && this.state.showCorrect !== false) {\n this.setState({ showCorrect: false }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n\n if (nextProps.alwaysShowCorrect && this.state.showCorrect !== true) {\n this.setState({ showCorrect: true }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n }\n\n indexToSymbol(index) {\n if (this.props.keyMode === 'numbers') {\n return `${index + 1}`;\n }\n\n if (this.props.keyMode === 'letters') {\n return String.fromCharCode(97 + index).toUpperCase();\n }\n\n return '';\n }\n\n getCorrectness = (choice = {}) => {\n const isCorrect = choice.correct;\n const isChecked = this.isSelected(choice.value);\n\n if (this.state.showCorrect) {\n return isCorrect ? 'correct' : undefined;\n }\n\n if (isCorrect) {\n if (isChecked) {\n // A correct answer is selected: marked with a green checkmark\n return 'correct';\n } else {\n // A correct answer is NOT selected: marked with an orange X\n return 'incorrect';\n }\n } else {\n if (isChecked) {\n // An incorrect answer is selected: marked with an orange X\n return 'incorrect';\n } else {\n // An incorrect answer is NOT selected: not marked\n return undefined;\n }\n }\n };\n\n getChecked(choice) {\n if (this.state.showCorrect) {\n return choice.correct || false;\n }\n\n if (this.isSelected(choice.value)) {\n return true;\n }\n\n return this.props.choiceMode === 'radio'\n ? this.state.selectedValue === choice.value\n : this.state.selectedValues.includes(choice.value);\n }\n\n // renderHeading function was added for accessibility.\n renderHeading() {\n const { mode, choiceMode, classes } = this.props;\n\n if (mode !== 'gather') {\n return null;\n }\n\n return choiceMode === 'radio' ? (\n <h2 className={classes.srOnly}>Multiple Choice Question</h2>\n ) : (\n <h2 className={classes.srOnly}>Multiple Select Question</h2>\n );\n }\n\n render() {\n const {\n mode,\n disabled,\n className,\n choices = [],\n choiceMode,\n gridColumns,\n partLabel,\n prompt,\n responseCorrect,\n teacherInstructions,\n classes,\n alwaysShowCorrect,\n animationsDisabled,\n language,\n isSelectionButtonBelow,\n minSelections,\n maxSelections,\n session,\n } = this.props;\n const { showCorrect } = this.state;\n const isEvaluateMode = mode === 'evaluate';\n const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;\n const columnsStyle = gridColumns > 1 ? { gridTemplateColumns: `repeat(${gridColumns}, 1fr)` } : undefined;\n const selections = (session.value && session.value.length) || 0;\n\n const teacherInstructionsDiv = (\n <PreviewPrompt\n tagName=\"div\"\n className=\"prompt\"\n defaultClassName=\"teacher-instructions\"\n prompt={teacherInstructions}\n />\n );\n\n return (\n <div className={classNames(classes.main, className, 'multiple-choice')}>\n {partLabel && <h3 className={classes.partLabel}>{partLabel}</h3>}\n\n {this.renderHeading()}\n\n {teacherInstructions && (\n <div className={classes.teacherInstructions}>\n {!animationsDisabled ? (\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </div>\n )}\n\n <fieldset className={classes.fieldset}>\n <PreviewPrompt className=\"prompt\" defaultClassName=\"prompt\" prompt={prompt} tagName={'legend'} />\n\n {!alwaysShowCorrect && (\n <CorrectAnswerToggle\n show={showCorrectAnswerToggle}\n toggled={showCorrect}\n onToggle={this.onToggle.bind(this)}\n language={language}\n />\n )}\n\n <div\n className={classNames({\n [classes.gridLayout]: this.props.choicesLayout === 'grid',\n [classes.horizontalLayout]: this.props.choicesLayout === 'horizontal',\n })}\n style={columnsStyle}\n >\n {choices.map((choice, index) => (\n <StyledChoice\n choicesLayout={this.props.choicesLayout}\n selectedAnswerBackgroundColor={this.props.selectedAnswerBackgroundColor}\n gridColumns={gridColumns}\n key={`choice-${index}`}\n choice={choice}\n index={index}\n choicesLength={choices.length}\n showCorrect={showCorrect}\n isEvaluateMode={isEvaluateMode}\n choiceMode={choiceMode}\n disabled={disabled}\n onChoiceChanged={this.handleChange}\n hideTick={choice.hideTick}\n checked={this.getChecked(choice)}\n correctness={isEvaluateMode ? this.getCorrectness(choice) : undefined}\n displayKey={this.indexToSymbol(index)}\n isSelectionButtonBelow={isSelectionButtonBelow}\n />\n ))}\n </div>\n </fieldset>\n\n {choiceMode === 'checkbox' && selections < minSelections && (\n <div className={classes.errorText}>\n {translator.t(`translation:multipleChoice:minSelections_${minSelections === 1 ? 'one' : 'other'}`, {\n lng: language,\n minSelections,\n })}\n </div>\n )}\n {choiceMode === 'checkbox' && selections >= maxSelections && (\n <div className={classes.errorText}>\n {translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {\n lng: language,\n maxSelections,\n })}\n </div>\n )}\n </div>\n );\n }\n}\n\nMultipleChoice.defaultProps = {\n session: {\n value: [],\n },\n};\n\nexport default withStyles(styles)(MultipleChoice);\n"],"file":"multiple-choice.js"}
|
package/module/configure.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.4.1/module/index.js";
|
|
2
|
-
import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.4.
|
|
2
|
+
import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.4.1/module/index.js";
|
|
3
3
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
4
|
function getDefaultExportFromCjs(x) {
|
|
5
5
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -10779,7 +10779,8 @@ var sensibleDefaults = {
|
|
|
10779
10779
|
studentInstructionsEnabled: true,
|
|
10780
10780
|
teacherInstructions: '',
|
|
10781
10781
|
teacherInstructionsEnabled: true,
|
|
10782
|
-
toolbarEditorPosition: 'bottom'
|
|
10782
|
+
toolbarEditorPosition: 'bottom',
|
|
10783
|
+
selectedAnswerBackgroundColor: 'initial'
|
|
10783
10784
|
},
|
|
10784
10785
|
configuration: {
|
|
10785
10786
|
baseInputConfiguration: {
|
package/module/controller.js
CHANGED
|
@@ -2539,6 +2539,7 @@ var defaults = {
|
|
|
2539
2539
|
teacherInstructions: '',
|
|
2540
2540
|
teacherInstructionsEnabled: true,
|
|
2541
2541
|
toolbarEditorPosition: 'bottom',
|
|
2542
|
+
selectedAnswerBackgroundColor: 'initial',
|
|
2542
2543
|
};
|
|
2543
2544
|
|
|
2544
2545
|
var controllerUtils$1 = {};
|
|
@@ -20711,6 +20712,7 @@ async function model(question, session, env, updateSession) {
|
|
|
20711
20712
|
extraCSSRules: normalizedQuestion.extraCSSRules,
|
|
20712
20713
|
fontSizeFactor: normalizedQuestion.fontSizeFactor,
|
|
20713
20714
|
isSelectionButtonBelow: normalizedQuestion.isSelectionButtonBelow,
|
|
20715
|
+
selectedAnswerBackgroundColor: normalizedQuestion.selectedAnswerBackgroundColor || 'initial',
|
|
20714
20716
|
minSelections: normalizedQuestion.minSelections,
|
|
20715
20717
|
maxSelections: normalizedQuestion.maxSelections,
|
|
20716
20718
|
};
|
package/module/element.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.4.1/module/index.js";
|
|
2
|
-
import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.4.
|
|
2
|
+
import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.4.1/module/index.js";
|
|
3
3
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
4
|
function getDefaultExportFromCjs(x) {
|
|
5
5
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -8456,6 +8456,12 @@ var en = {};
|
|
|
8456
8456
|
mathInline: {
|
|
8457
8457
|
primaryCorrectWithAlternates: 'Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.'
|
|
8458
8458
|
},
|
|
8459
|
+
multipleChoice: {
|
|
8460
|
+
minSelections_one: 'This question requires at least {{minSelections}} answer.',
|
|
8461
|
+
minSelections_other: 'This question requires at least {{minSelections}} answers.',
|
|
8462
|
+
maxSelections_one: 'Only {{maxSelections}} answer is allowed.',
|
|
8463
|
+
maxSelections_other: 'Only {{maxSelections}} answers are allowed.'
|
|
8464
|
+
},
|
|
8459
8465
|
selectText: {
|
|
8460
8466
|
correctAnswerSelected: 'Correct answer selected',
|
|
8461
8467
|
correctAnswerNotSelected: 'Correct answer not selected',
|
|
@@ -8543,6 +8549,12 @@ var es = {};
|
|
|
8543
8549
|
mathInline: {
|
|
8544
8550
|
primaryCorrectWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.'
|
|
8545
8551
|
},
|
|
8552
|
+
multipleChoice: {
|
|
8553
|
+
minSelections_one: 'Esta pregunta requiere al menos {{minSelections}} respuesta.',
|
|
8554
|
+
minSelections_other: 'Esta pregunta requiere al menos {{minSelections}} respuestas.',
|
|
8555
|
+
maxSelections_one: 'Sólo se permite {{maxSelections}} respuesta.',
|
|
8556
|
+
maxSelections_other: 'Sólo se permiten {{maxSelections}} respuestas.'
|
|
8557
|
+
},
|
|
8546
8558
|
selectText: {
|
|
8547
8559
|
correctAnswerSelected: 'Respuesta correcta seleccionada',
|
|
8548
8560
|
correctAnswerNotSelected: 'Respuesta correcta no seleccionada',
|
|
@@ -12476,7 +12488,7 @@ class Choice extends React$3.Component {
|
|
|
12476
12488
|
};
|
|
12477
12489
|
}
|
|
12478
12490
|
render() {
|
|
12479
|
-
const {choice, index, choicesLength, showCorrect, isEvaluateMode, choiceMode, disabled, checked, correctness, displayKey, classes, choicesLayout, gridColumns, isSelectionButtonBelow} = this.props;
|
|
12491
|
+
const {choice, index, choicesLength, showCorrect, isEvaluateMode, choiceMode, disabled, checked, correctness, displayKey, classes, choicesLayout, gridColumns, isSelectionButtonBelow, selectedAnswerBackgroundColor} = this.props;
|
|
12480
12492
|
const choiceClass = 'choice' + (index === choicesLength - 1 ? ' last' : '');
|
|
12481
12493
|
const feedback = !isEvaluateMode || showCorrect ? '' : choice.feedback;
|
|
12482
12494
|
const choiceProps = {
|
|
@@ -12498,13 +12510,17 @@ class Choice extends React$3.Component {
|
|
|
12498
12510
|
[classes.noBorder]: index === choicesLength - 1 || choicesLayout !== 'vertical',
|
|
12499
12511
|
[classes.horizontalLayout]: choicesLayout === 'horizontal'
|
|
12500
12512
|
});
|
|
12513
|
+
const choiceBackground = selectedAnswerBackgroundColor && checked ? selectedAnswerBackgroundColor : 'initial';
|
|
12501
12514
|
return React$3.createElement('div', {
|
|
12502
12515
|
className: choiceClass,
|
|
12503
12516
|
key: index,
|
|
12517
|
+
style: {
|
|
12518
|
+
backgroundColor: choiceBackground
|
|
12519
|
+
},
|
|
12504
12520
|
__self: this,
|
|
12505
12521
|
__source: {
|
|
12506
12522
|
fileName: _jsxFileName$2,
|
|
12507
|
-
lineNumber:
|
|
12523
|
+
lineNumber: 65
|
|
12508
12524
|
}
|
|
12509
12525
|
}, React$3.createElement(ChoiceInput$1, {
|
|
12510
12526
|
...choiceProps,
|
|
@@ -12512,7 +12528,7 @@ class Choice extends React$3.Component {
|
|
|
12512
12528
|
__self: this,
|
|
12513
12529
|
__source: {
|
|
12514
12530
|
fileName: _jsxFileName$2,
|
|
12515
|
-
lineNumber:
|
|
12531
|
+
lineNumber: 66
|
|
12516
12532
|
}
|
|
12517
12533
|
}));
|
|
12518
12534
|
}
|
|
@@ -12533,12 +12549,15 @@ Choice.propTypes = {
|
|
|
12533
12549
|
displayKey: PropTypes$2.string,
|
|
12534
12550
|
choicesLayout: PropTypes$2.oneOf(['vertical', 'grid', 'horizontal']),
|
|
12535
12551
|
gridColumns: PropTypes$2.string,
|
|
12552
|
+
selectedAnswerBackgroundColor: PropTypes$2.string,
|
|
12536
12553
|
isSelectionButtonBelow: PropTypes$2.bool
|
|
12537
12554
|
};
|
|
12538
12555
|
var StyledChoice = styles$b.withStyles(theme => ({
|
|
12539
12556
|
choice: {
|
|
12540
12557
|
paddingTop: theme.spacing.unit * 2.5,
|
|
12541
12558
|
paddingBottom: theme.spacing.unit + 2,
|
|
12559
|
+
paddingLeft: theme.spacing.unit + 2,
|
|
12560
|
+
paddingRight: theme.spacing.unit + 2,
|
|
12542
12561
|
borderBottom: `1px solid ${theme.palette.grey[300]}`
|
|
12543
12562
|
},
|
|
12544
12563
|
noBorder: {
|
|
@@ -12628,6 +12647,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12628
12647
|
alwaysShowCorrect: PropTypes$1.bool,
|
|
12629
12648
|
animationsDisabled: PropTypes$1.bool,
|
|
12630
12649
|
language: PropTypes$1.string,
|
|
12650
|
+
selectedAnswerBackgroundColor: PropTypes$1.string,
|
|
12631
12651
|
onShowCorrectToggle: PropTypes$1.func,
|
|
12632
12652
|
isSelectionButtonBelow: PropTypes$1.bool,
|
|
12633
12653
|
minSelections: PropTypes$1.number,
|
|
@@ -12759,14 +12779,14 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12759
12779
|
__self: this,
|
|
12760
12780
|
__source: {
|
|
12761
12781
|
fileName: _jsxFileName$1,
|
|
12762
|
-
lineNumber:
|
|
12782
|
+
lineNumber: 225
|
|
12763
12783
|
}
|
|
12764
12784
|
}, "Multiple Choice Question") : React$2.createElement('h2', {
|
|
12765
12785
|
className: classes.srOnly,
|
|
12766
12786
|
__self: this,
|
|
12767
12787
|
__source: {
|
|
12768
12788
|
fileName: _jsxFileName$1,
|
|
12769
|
-
lineNumber:
|
|
12789
|
+
lineNumber: 227
|
|
12770
12790
|
}
|
|
12771
12791
|
}, "Multiple Select Question");
|
|
12772
12792
|
}
|
|
@@ -12787,7 +12807,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12787
12807
|
__self: this,
|
|
12788
12808
|
__source: {
|
|
12789
12809
|
fileName: _jsxFileName$1,
|
|
12790
|
-
lineNumber:
|
|
12810
|
+
lineNumber: 259
|
|
12791
12811
|
}
|
|
12792
12812
|
});
|
|
12793
12813
|
return React$2.createElement('div', {
|
|
@@ -12795,21 +12815,21 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12795
12815
|
__self: this,
|
|
12796
12816
|
__source: {
|
|
12797
12817
|
fileName: _jsxFileName$1,
|
|
12798
|
-
lineNumber:
|
|
12818
|
+
lineNumber: 268
|
|
12799
12819
|
}
|
|
12800
12820
|
}, partLabel && React$2.createElement('h3', {
|
|
12801
12821
|
className: classes.partLabel,
|
|
12802
12822
|
__self: this,
|
|
12803
12823
|
__source: {
|
|
12804
12824
|
fileName: _jsxFileName$1,
|
|
12805
|
-
lineNumber:
|
|
12825
|
+
lineNumber: 269
|
|
12806
12826
|
}
|
|
12807
12827
|
}, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
|
|
12808
12828
|
className: classes.teacherInstructions,
|
|
12809
12829
|
__self: this,
|
|
12810
12830
|
__source: {
|
|
12811
12831
|
fileName: _jsxFileName$1,
|
|
12812
|
-
lineNumber:
|
|
12832
|
+
lineNumber: 274
|
|
12813
12833
|
}
|
|
12814
12834
|
}, !animationsDisabled ? React$2.createElement(Collapsible, {
|
|
12815
12835
|
labels: {
|
|
@@ -12819,14 +12839,14 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12819
12839
|
__self: this,
|
|
12820
12840
|
__source: {
|
|
12821
12841
|
fileName: _jsxFileName$1,
|
|
12822
|
-
lineNumber:
|
|
12842
|
+
lineNumber: 276
|
|
12823
12843
|
}
|
|
12824
12844
|
}, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
|
|
12825
12845
|
className: classes.fieldset,
|
|
12826
12846
|
__self: this,
|
|
12827
12847
|
__source: {
|
|
12828
12848
|
fileName: _jsxFileName$1,
|
|
12829
|
-
lineNumber:
|
|
12849
|
+
lineNumber: 290
|
|
12830
12850
|
}
|
|
12831
12851
|
}, React$2.createElement(PreviewPrompt, {
|
|
12832
12852
|
className: "prompt",
|
|
@@ -12836,7 +12856,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12836
12856
|
__self: this,
|
|
12837
12857
|
__source: {
|
|
12838
12858
|
fileName: _jsxFileName$1,
|
|
12839
|
-
lineNumber:
|
|
12859
|
+
lineNumber: 291
|
|
12840
12860
|
}
|
|
12841
12861
|
}), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
|
|
12842
12862
|
show: showCorrectAnswerToggle,
|
|
@@ -12846,7 +12866,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12846
12866
|
__self: this,
|
|
12847
12867
|
__source: {
|
|
12848
12868
|
fileName: _jsxFileName$1,
|
|
12849
|
-
lineNumber:
|
|
12869
|
+
lineNumber: 294
|
|
12850
12870
|
}
|
|
12851
12871
|
}), React$2.createElement('div', {
|
|
12852
12872
|
className: classNames({
|
|
@@ -12857,10 +12877,11 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12857
12877
|
__self: this,
|
|
12858
12878
|
__source: {
|
|
12859
12879
|
fileName: _jsxFileName$1,
|
|
12860
|
-
lineNumber:
|
|
12880
|
+
lineNumber: 302
|
|
12861
12881
|
}
|
|
12862
12882
|
}, choices.map((choice, index) => React$2.createElement(StyledChoice, {
|
|
12863
12883
|
choicesLayout: this.props.choicesLayout,
|
|
12884
|
+
selectedAnswerBackgroundColor: this.props.selectedAnswerBackgroundColor,
|
|
12864
12885
|
gridColumns: gridColumns,
|
|
12865
12886
|
key: `choice-${index}`,
|
|
12866
12887
|
choice: choice,
|
|
@@ -12879,14 +12900,14 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12879
12900
|
__self: this,
|
|
12880
12901
|
__source: {
|
|
12881
12902
|
fileName: _jsxFileName$1,
|
|
12882
|
-
lineNumber:
|
|
12903
|
+
lineNumber: 310
|
|
12883
12904
|
}
|
|
12884
12905
|
})))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
|
|
12885
12906
|
className: classes.errorText,
|
|
12886
12907
|
__self: this,
|
|
12887
12908
|
__source: {
|
|
12888
12909
|
fileName: _jsxFileName$1,
|
|
12889
|
-
lineNumber:
|
|
12910
|
+
lineNumber: 334
|
|
12890
12911
|
}
|
|
12891
12912
|
}, translator.t(`translation:multipleChoice:minSelections_${minSelections === 1 ? 'one' : 'other'}`, {
|
|
12892
12913
|
lng: language,
|
|
@@ -12896,7 +12917,7 @@ class MultipleChoice$1 extends React$2.Component {
|
|
|
12896
12917
|
__self: this,
|
|
12897
12918
|
__source: {
|
|
12898
12919
|
fileName: _jsxFileName$1,
|
|
12899
|
-
lineNumber:
|
|
12920
|
+
lineNumber: 342
|
|
12900
12921
|
}
|
|
12901
12922
|
}, translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
|
|
12902
12923
|
lng: language,
|
package/module/manifest.json
CHANGED
package/module/print.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_pie_lib__pie_toolbox_math_rendering_accessible, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.4.1/module/index.js";
|
|
2
|
-
import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.4.
|
|
2
|
+
import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.4.1/module/index.js";
|
|
3
3
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
4
|
function getDefaultExportFromCjs(x) {
|
|
5
5
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -8456,6 +8456,12 @@ var en = {};
|
|
|
8456
8456
|
mathInline: {
|
|
8457
8457
|
primaryCorrectWithAlternates: 'Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.'
|
|
8458
8458
|
},
|
|
8459
|
+
multipleChoice: {
|
|
8460
|
+
minSelections_one: 'This question requires at least {{minSelections}} answer.',
|
|
8461
|
+
minSelections_other: 'This question requires at least {{minSelections}} answers.',
|
|
8462
|
+
maxSelections_one: 'Only {{maxSelections}} answer is allowed.',
|
|
8463
|
+
maxSelections_other: 'Only {{maxSelections}} answers are allowed.'
|
|
8464
|
+
},
|
|
8459
8465
|
selectText: {
|
|
8460
8466
|
correctAnswerSelected: 'Correct answer selected',
|
|
8461
8467
|
correctAnswerNotSelected: 'Correct answer not selected',
|
|
@@ -8543,6 +8549,12 @@ var es = {};
|
|
|
8543
8549
|
mathInline: {
|
|
8544
8550
|
primaryCorrectWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.'
|
|
8545
8551
|
},
|
|
8552
|
+
multipleChoice: {
|
|
8553
|
+
minSelections_one: 'Esta pregunta requiere al menos {{minSelections}} respuesta.',
|
|
8554
|
+
minSelections_other: 'Esta pregunta requiere al menos {{minSelections}} respuestas.',
|
|
8555
|
+
maxSelections_one: 'Sólo se permite {{maxSelections}} respuesta.',
|
|
8556
|
+
maxSelections_other: 'Sólo se permiten {{maxSelections}} respuestas.'
|
|
8557
|
+
},
|
|
8546
8558
|
selectText: {
|
|
8547
8559
|
correctAnswerSelected: 'Respuesta correcta seleccionada',
|
|
8548
8560
|
correctAnswerNotSelected: 'Respuesta correcta no seleccionada',
|
|
@@ -12476,7 +12488,7 @@ class Choice extends React$3.Component {
|
|
|
12476
12488
|
};
|
|
12477
12489
|
}
|
|
12478
12490
|
render() {
|
|
12479
|
-
const {choice, index, choicesLength, showCorrect, isEvaluateMode, choiceMode, disabled, checked, correctness, displayKey, classes, choicesLayout, gridColumns, isSelectionButtonBelow} = this.props;
|
|
12491
|
+
const {choice, index, choicesLength, showCorrect, isEvaluateMode, choiceMode, disabled, checked, correctness, displayKey, classes, choicesLayout, gridColumns, isSelectionButtonBelow, selectedAnswerBackgroundColor} = this.props;
|
|
12480
12492
|
const choiceClass = 'choice' + (index === choicesLength - 1 ? ' last' : '');
|
|
12481
12493
|
const feedback = !isEvaluateMode || showCorrect ? '' : choice.feedback;
|
|
12482
12494
|
const choiceProps = {
|
|
@@ -12498,13 +12510,17 @@ class Choice extends React$3.Component {
|
|
|
12498
12510
|
[classes.noBorder]: index === choicesLength - 1 || choicesLayout !== 'vertical',
|
|
12499
12511
|
[classes.horizontalLayout]: choicesLayout === 'horizontal'
|
|
12500
12512
|
});
|
|
12513
|
+
const choiceBackground = selectedAnswerBackgroundColor && checked ? selectedAnswerBackgroundColor : 'initial';
|
|
12501
12514
|
return React$3.createElement('div', {
|
|
12502
12515
|
className: choiceClass,
|
|
12503
12516
|
key: index,
|
|
12517
|
+
style: {
|
|
12518
|
+
backgroundColor: choiceBackground
|
|
12519
|
+
},
|
|
12504
12520
|
__self: this,
|
|
12505
12521
|
__source: {
|
|
12506
12522
|
fileName: _jsxFileName$2,
|
|
12507
|
-
lineNumber:
|
|
12523
|
+
lineNumber: 65
|
|
12508
12524
|
}
|
|
12509
12525
|
}, React$3.createElement(ChoiceInput$1, {
|
|
12510
12526
|
...choiceProps,
|
|
@@ -12512,7 +12528,7 @@ class Choice extends React$3.Component {
|
|
|
12512
12528
|
__self: this,
|
|
12513
12529
|
__source: {
|
|
12514
12530
|
fileName: _jsxFileName$2,
|
|
12515
|
-
lineNumber:
|
|
12531
|
+
lineNumber: 66
|
|
12516
12532
|
}
|
|
12517
12533
|
}));
|
|
12518
12534
|
}
|
|
@@ -12533,12 +12549,15 @@ Choice.propTypes = {
|
|
|
12533
12549
|
displayKey: PropTypes$2.string,
|
|
12534
12550
|
choicesLayout: PropTypes$2.oneOf(['vertical', 'grid', 'horizontal']),
|
|
12535
12551
|
gridColumns: PropTypes$2.string,
|
|
12552
|
+
selectedAnswerBackgroundColor: PropTypes$2.string,
|
|
12536
12553
|
isSelectionButtonBelow: PropTypes$2.bool
|
|
12537
12554
|
};
|
|
12538
12555
|
var StyledChoice = styles$b.withStyles(theme => ({
|
|
12539
12556
|
choice: {
|
|
12540
12557
|
paddingTop: theme.spacing.unit * 2.5,
|
|
12541
12558
|
paddingBottom: theme.spacing.unit + 2,
|
|
12559
|
+
paddingLeft: theme.spacing.unit + 2,
|
|
12560
|
+
paddingRight: theme.spacing.unit + 2,
|
|
12542
12561
|
borderBottom: `1px solid ${theme.palette.grey[300]}`
|
|
12543
12562
|
},
|
|
12544
12563
|
noBorder: {
|
|
@@ -12628,6 +12647,7 @@ class MultipleChoice extends React$2.Component {
|
|
|
12628
12647
|
alwaysShowCorrect: PropTypes$1.bool,
|
|
12629
12648
|
animationsDisabled: PropTypes$1.bool,
|
|
12630
12649
|
language: PropTypes$1.string,
|
|
12650
|
+
selectedAnswerBackgroundColor: PropTypes$1.string,
|
|
12631
12651
|
onShowCorrectToggle: PropTypes$1.func,
|
|
12632
12652
|
isSelectionButtonBelow: PropTypes$1.bool,
|
|
12633
12653
|
minSelections: PropTypes$1.number,
|
|
@@ -12759,14 +12779,14 @@ class MultipleChoice extends React$2.Component {
|
|
|
12759
12779
|
__self: this,
|
|
12760
12780
|
__source: {
|
|
12761
12781
|
fileName: _jsxFileName$1,
|
|
12762
|
-
lineNumber:
|
|
12782
|
+
lineNumber: 225
|
|
12763
12783
|
}
|
|
12764
12784
|
}, "Multiple Choice Question") : React$2.createElement('h2', {
|
|
12765
12785
|
className: classes.srOnly,
|
|
12766
12786
|
__self: this,
|
|
12767
12787
|
__source: {
|
|
12768
12788
|
fileName: _jsxFileName$1,
|
|
12769
|
-
lineNumber:
|
|
12789
|
+
lineNumber: 227
|
|
12770
12790
|
}
|
|
12771
12791
|
}, "Multiple Select Question");
|
|
12772
12792
|
}
|
|
@@ -12787,7 +12807,7 @@ class MultipleChoice extends React$2.Component {
|
|
|
12787
12807
|
__self: this,
|
|
12788
12808
|
__source: {
|
|
12789
12809
|
fileName: _jsxFileName$1,
|
|
12790
|
-
lineNumber:
|
|
12810
|
+
lineNumber: 259
|
|
12791
12811
|
}
|
|
12792
12812
|
});
|
|
12793
12813
|
return React$2.createElement('div', {
|
|
@@ -12795,21 +12815,21 @@ class MultipleChoice extends React$2.Component {
|
|
|
12795
12815
|
__self: this,
|
|
12796
12816
|
__source: {
|
|
12797
12817
|
fileName: _jsxFileName$1,
|
|
12798
|
-
lineNumber:
|
|
12818
|
+
lineNumber: 268
|
|
12799
12819
|
}
|
|
12800
12820
|
}, partLabel && React$2.createElement('h3', {
|
|
12801
12821
|
className: classes.partLabel,
|
|
12802
12822
|
__self: this,
|
|
12803
12823
|
__source: {
|
|
12804
12824
|
fileName: _jsxFileName$1,
|
|
12805
|
-
lineNumber:
|
|
12825
|
+
lineNumber: 269
|
|
12806
12826
|
}
|
|
12807
12827
|
}, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
|
|
12808
12828
|
className: classes.teacherInstructions,
|
|
12809
12829
|
__self: this,
|
|
12810
12830
|
__source: {
|
|
12811
12831
|
fileName: _jsxFileName$1,
|
|
12812
|
-
lineNumber:
|
|
12832
|
+
lineNumber: 274
|
|
12813
12833
|
}
|
|
12814
12834
|
}, !animationsDisabled ? React$2.createElement(Collapsible, {
|
|
12815
12835
|
labels: {
|
|
@@ -12819,14 +12839,14 @@ class MultipleChoice extends React$2.Component {
|
|
|
12819
12839
|
__self: this,
|
|
12820
12840
|
__source: {
|
|
12821
12841
|
fileName: _jsxFileName$1,
|
|
12822
|
-
lineNumber:
|
|
12842
|
+
lineNumber: 276
|
|
12823
12843
|
}
|
|
12824
12844
|
}, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
|
|
12825
12845
|
className: classes.fieldset,
|
|
12826
12846
|
__self: this,
|
|
12827
12847
|
__source: {
|
|
12828
12848
|
fileName: _jsxFileName$1,
|
|
12829
|
-
lineNumber:
|
|
12849
|
+
lineNumber: 290
|
|
12830
12850
|
}
|
|
12831
12851
|
}, React$2.createElement(PreviewPrompt, {
|
|
12832
12852
|
className: "prompt",
|
|
@@ -12836,7 +12856,7 @@ class MultipleChoice extends React$2.Component {
|
|
|
12836
12856
|
__self: this,
|
|
12837
12857
|
__source: {
|
|
12838
12858
|
fileName: _jsxFileName$1,
|
|
12839
|
-
lineNumber:
|
|
12859
|
+
lineNumber: 291
|
|
12840
12860
|
}
|
|
12841
12861
|
}), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
|
|
12842
12862
|
show: showCorrectAnswerToggle,
|
|
@@ -12846,7 +12866,7 @@ class MultipleChoice extends React$2.Component {
|
|
|
12846
12866
|
__self: this,
|
|
12847
12867
|
__source: {
|
|
12848
12868
|
fileName: _jsxFileName$1,
|
|
12849
|
-
lineNumber:
|
|
12869
|
+
lineNumber: 294
|
|
12850
12870
|
}
|
|
12851
12871
|
}), React$2.createElement('div', {
|
|
12852
12872
|
className: classNames({
|
|
@@ -12857,10 +12877,11 @@ class MultipleChoice extends React$2.Component {
|
|
|
12857
12877
|
__self: this,
|
|
12858
12878
|
__source: {
|
|
12859
12879
|
fileName: _jsxFileName$1,
|
|
12860
|
-
lineNumber:
|
|
12880
|
+
lineNumber: 302
|
|
12861
12881
|
}
|
|
12862
12882
|
}, choices.map((choice, index) => React$2.createElement(StyledChoice, {
|
|
12863
12883
|
choicesLayout: this.props.choicesLayout,
|
|
12884
|
+
selectedAnswerBackgroundColor: this.props.selectedAnswerBackgroundColor,
|
|
12864
12885
|
gridColumns: gridColumns,
|
|
12865
12886
|
key: `choice-${index}`,
|
|
12866
12887
|
choice: choice,
|
|
@@ -12879,14 +12900,14 @@ class MultipleChoice extends React$2.Component {
|
|
|
12879
12900
|
__self: this,
|
|
12880
12901
|
__source: {
|
|
12881
12902
|
fileName: _jsxFileName$1,
|
|
12882
|
-
lineNumber:
|
|
12903
|
+
lineNumber: 310
|
|
12883
12904
|
}
|
|
12884
12905
|
})))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
|
|
12885
12906
|
className: classes.errorText,
|
|
12886
12907
|
__self: this,
|
|
12887
12908
|
__source: {
|
|
12888
12909
|
fileName: _jsxFileName$1,
|
|
12889
|
-
lineNumber:
|
|
12910
|
+
lineNumber: 334
|
|
12890
12911
|
}
|
|
12891
12912
|
}, translator.t(`translation:multipleChoice:minSelections_${minSelections === 1 ? 'one' : 'other'}`, {
|
|
12892
12913
|
lng: language,
|
|
@@ -12896,7 +12917,7 @@ class MultipleChoice extends React$2.Component {
|
|
|
12896
12917
|
__self: this,
|
|
12897
12918
|
__source: {
|
|
12898
12919
|
fileName: _jsxFileName$1,
|
|
12899
|
-
lineNumber:
|
|
12920
|
+
lineNumber: 342
|
|
12900
12921
|
}
|
|
12901
12922
|
}, translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
|
|
12902
12923
|
lng: language,
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multiple-choice",
|
|
3
3
|
"repository": "pie-framework/pie-elements",
|
|
4
|
-
"version": "9.5.2-next.
|
|
4
|
+
"version": "9.5.2-next.40+c2131410e",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@material-ui/core": "^3.9.2",
|
|
10
|
-
"@pie-lib/pie-toolbox": "2.
|
|
10
|
+
"@pie-lib/pie-toolbox": "2.5.0",
|
|
11
11
|
"classnames": "^2.2.5",
|
|
12
12
|
"debug": "^4.1.1",
|
|
13
13
|
"enzyme-to-json": "^3.3.3",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"react-test-renderer": "^16.3.2",
|
|
19
19
|
"react-transition-group": "^2.3.1"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "c2131410e19605093ca77afb8234b31708db01b1",
|
|
22
22
|
"scripts": {
|
|
23
23
|
"postpublish": "../../scripts/postpublish"
|
|
24
24
|
},
|