@pie-element/ebsr 8.7.1-next.4 → 8.7.1-next.85
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/main.js +15 -13
- package/configure/lib/main.js.map +1 -1
- package/configure/src/main.jsx +47 -51
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.js +2 -0
package/configure/lib/main.js
CHANGED
|
@@ -48,12 +48,12 @@ var Panel = _configUi.settings.Panel,
|
|
|
48
48
|
|
|
49
49
|
var styles = function styles(theme) {
|
|
50
50
|
return {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
partLabel: {
|
|
52
|
+
paddingBottom: theme.spacing.unit * 2
|
|
53
|
+
},
|
|
54
|
+
divider: {
|
|
55
|
+
flex: 1,
|
|
56
|
+
height: theme.spacing.unit * 2.5
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
};
|
|
@@ -238,9 +238,9 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
238
238
|
'Settings for both': panelSettings
|
|
239
239
|
}, (0, _defineProperty2["default"])(_ref3, "Settings ".concat(firstPart), panelSettingsPartA), (0, _defineProperty2["default"])(_ref3, "Properties ".concat(firstPart), panelPropertiesPartA), (0, _defineProperty2["default"])(_ref3, "Settings ".concat(secondPart), panelSettingsPartB), (0, _defineProperty2["default"])(_ref3, "Properties ".concat(secondPart), panelPropertiesPartB), _ref3)
|
|
240
240
|
})
|
|
241
|
-
},
|
|
242
|
-
className: classes.
|
|
243
|
-
},
|
|
241
|
+
}, model.partLabels && /*#__PURE__*/_react["default"].createElement("div", {
|
|
242
|
+
className: classes.partLabel
|
|
243
|
+
}, firstPart), /*#__PURE__*/_react["default"].createElement("ebsr-multiple-choice-configure", {
|
|
244
244
|
id: "A",
|
|
245
245
|
key: "partA",
|
|
246
246
|
ref: function ref(_ref4) {
|
|
@@ -253,9 +253,11 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
253
253
|
_this2.partA.configuration = _objectSpread(_objectSpread({}, partA), generalConfiguration);
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
})
|
|
257
|
-
className: classes.
|
|
258
|
-
}, model.partLabels && /*#__PURE__*/_react["default"].createElement("div",
|
|
256
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
257
|
+
className: classes.divider
|
|
258
|
+
}), model.partLabels && /*#__PURE__*/_react["default"].createElement("div", {
|
|
259
|
+
className: classes.partLabel
|
|
260
|
+
}, secondPart), /*#__PURE__*/_react["default"].createElement("ebsr-multiple-choice-configure", {
|
|
259
261
|
id: "B",
|
|
260
262
|
key: "partB",
|
|
261
263
|
ref: function ref(_ref5) {
|
|
@@ -268,7 +270,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
268
270
|
_this2.partB.configuration = _objectSpread(_objectSpread({}, partB), generalConfiguration);
|
|
269
271
|
}
|
|
270
272
|
}
|
|
271
|
-
}))
|
|
273
|
+
}));
|
|
272
274
|
}
|
|
273
275
|
}]);
|
|
274
276
|
return Main;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","radio","dropdown","styles","theme","part","display","flexDirection","paddingTop","spacing","unit","Main","choices","correctFound","map","choice","correct","model","key","onModelChanged","props","partA","choiceMode","removeExtraChoices","partB","classes","configuration","onConfigurationChanged","partLabelType","modelPartA","modelPartB","partialScoring","settingsPanelDisabled","scoringType","generalConfiguration","feedback","feedbackA","choiceModeA","choicePrefix","choicePrefixA","lockChoiceOrder","lockChoiceOrderA","prompt","promptA","teacherInstructions","teacherInstructionsA","studentInstructions","studentInstructionsA","choicesLayout","choicesLayoutA","gridColumns","gridColumnsA","rationale","rationaleA","spellCheck","spellCheckA","feedbackB","choiceModeB","choicePrefixB","lockChoiceOrderB","promptB","teacherInstructionsB","studentInstructionsB","choicesLayoutB","gridColumnsB","rationaleB","spellCheckB","type","typeIsNumber","firstPart","secondPart","nrOfColumnsAvailable","length","Array","from","_","i","panelSettings","partLabels","label","panelSettingsPartA","panelPropertiesPartA","panelSettingsPartB","panelPropertiesPartB","ref","_model","errors","React","Component","PropTypes","object","func","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAQA,KAAR,GAA2CC,kBAA3C,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA2CD,kBAA3C,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAA2CF,kBAA3C,CAAuBE,KAAvB;AAAA,IAA8BC,QAA9B,GAA2CH,kBAA3C,CAA8BG,QAA9B;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,OAAO,EAAE,MADL;AAEJC,MAAAA,aAAa,EAAE,QAFX;AAGJ,6BAAuB;AACrBC,QAAAA,UAAU,EAAEJ,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB;AADZ;AAHnB;AADmB,GAAZ;AAAA,CAAf;;IAUaC,I;;;;;;;;;;;;;;;2GASU,UAACC,OAAD,EAAa;AAChC,UAAIC,YAAY,GAAG,KAAnB;AAEA,aAAO,CAACD,OAAO,IAAI,EAAZ,EAAgBE,GAAhB,CAAoB,UAACC,MAAD,EAAY;AACrC,YAAIF,YAAJ,EAAkB;AAChBE,UAAAA,MAAM,CAACC,OAAP,GAAiB,KAAjB;AAEA,iBAAOD,MAAP;AACD;;AAED,YAAIA,MAAM,CAACC,OAAX,EAAoB;AAClBH,UAAAA,YAAY,GAAG,IAAf;AACD;;AAED,eAAOE,MAAP;AACD,OAZM,CAAP;AAaD,K;uGAEgB,UAACE,KAAD,EAAQC,GAAR,EAAgB;AAC/B,UAAQC,cAAR,GAA2B,MAAKC,KAAhC,CAAQD,cAAR;;AAEA,U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'prop-types';\nimport { settings, layout } from '@pie-lib/config-ui';\nimport { withStyles } from '@material-ui/core/styles';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst styles = (theme) => ({\n part: {\n display: 'flex',\n flexDirection: 'column',\n '&:not(:first-child)': {\n paddingTop: theme.spacing.unit * 4,\n },\n },\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n configuration: PropTypes.object,\n model: PropTypes.object,\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n };\n\n removeExtraChoices = (choices) => {\n let correctFound = false;\n\n return (choices || []).map((choice) => {\n if (correctFound) {\n choice.correct = false;\n\n return choice;\n }\n\n if (choice.correct) {\n correctFound = true;\n }\n\n return choice;\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n if (key === 'partA.choiceMode' && model.partA.choiceMode === 'radio') {\n model.partA.choices = this.removeExtraChoices(model.partA.choices);\n\n return onModelChanged(model, true);\n }\n\n if (key === 'partB.choiceMode' && model.partB.choiceMode === 'radio') {\n model.partB.choices = this.removeExtraChoices(model.partB.choices);\n\n return onModelChanged(model, true);\n }\n\n return onModelChanged(model);\n };\n\n render() {\n const { classes, model, configuration, onConfigurationChanged } = this.props;\n const { partLabelType, partA: modelPartA, partB: modelPartB } = model;\n const { partA, partB, partialScoring, settingsPanelDisabled, scoringType, ...generalConfiguration } = configuration;\n const {\n feedback: feedbackA = {},\n choiceMode: choiceModeA = {},\n choicePrefix: choicePrefixA = {},\n lockChoiceOrder: lockChoiceOrderA = {},\n prompt: promptA = {},\n teacherInstructions: teacherInstructionsA = {},\n studentInstructions: studentInstructionsA = {},\n choicesLayout: choicesLayoutA = {},\n gridColumns: gridColumnsA = {},\n rationale: rationaleA = {},\n spellCheck: spellCheckA = {},\n } = partA || {};\n const {\n feedback: feedbackB = {},\n choiceMode: choiceModeB = {},\n choicePrefix: choicePrefixB = {},\n lockChoiceOrder: lockChoiceOrderB = {},\n prompt: promptB = {},\n teacherInstructions: teacherInstructionsB = {},\n studentInstructions: studentInstructionsB = {},\n choicesLayout: choicesLayoutB = {},\n gridColumns: gridColumnsB = {},\n rationale: rationaleB = {},\n spellCheck: spellCheckB = {},\n } = partB || {};\n\n const type = partLabelType || 'Numbers';\n const typeIsNumber = type === 'Numbers';\n const firstPart = `Part ${typeIsNumber ? '1' : 'A'}`;\n const secondPart = `Part ${typeIsNumber ? '2' : 'B'}`;\n const nrOfColumnsAvailable = {\n partA:\n modelPartA.choices && modelPartA.choices.length\n ? Array.from({ length: modelPartA.choices.length }, (_, i) => `${i + 1}`)\n : [],\n partB:\n modelPartB.choices && modelPartB.choices.length\n ? Array.from({ length: modelPartB.choices.length }, (_, i) => `${i + 1}`)\n : [],\n };\n\n const panelSettings = {\n partLabels: generalConfiguration.partLabels.settings && toggle(generalConfiguration.partLabels.label),\n partLabelType: model.partLabels && dropdown('', ['Numbers', 'Letters']),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),\n };\n\n const panelSettingsPartA = {\n 'partA.choiceMode': choiceModeA.settings && radio(choiceModeA.label, ['checkbox', 'radio']),\n 'partA.choicePrefix': choicePrefixA.settings && radio(choicePrefixA.label, ['numbers', 'letters']),\n 'partA.lockChoiceOrder': lockChoiceOrderA.settings && toggle(lockChoiceOrderA.label),\n 'partA.choicesLayout':\n choicesLayoutA.settings && dropdown(choicesLayoutA.label, ['vertical', 'grid', 'horizontal']),\n 'partA.gridColumns':\n choicesLayoutA.settings &&\n modelPartA.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.partA.length > 0 &&\n dropdown(gridColumnsA.label, nrOfColumnsAvailable.partA),\n };\n const panelPropertiesPartA = {\n 'partA.feedbackEnabled': feedbackA.settings && toggle(feedbackA.label),\n 'partA.promptEnabled': promptA.settings && toggle(promptA.label),\n 'partA.teacherInstructionsEnabled': teacherInstructionsA.settings && toggle(teacherInstructionsA.label),\n 'partA.studentInstructionsEnabled': studentInstructionsA.settings && toggle(studentInstructionsA.label),\n 'partA.rationaleEnabled': rationaleA.settings && toggle(rationaleA.label),\n 'partA.spellCheckEnabled': spellCheckA.settings && toggle(spellCheckA.label),\n };\n\n const panelSettingsPartB = {\n 'partB.choiceMode': choiceModeB.settings && radio(choiceModeB.label, ['checkbox', 'radio']),\n 'partB.choicePrefix': choicePrefixB.settings && radio(choicePrefixB.label, ['numbers', 'letters']),\n 'partB.lockChoiceOrder': lockChoiceOrderB.settings && toggle(lockChoiceOrderB.label),\n 'partB.choicesLayout':\n choicesLayoutB.settings && dropdown(choicesLayoutB.label, ['vertical', 'grid', 'horizontal']),\n 'partB.gridColumns':\n choicesLayoutB.settings &&\n modelPartB.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.partB.length > 0 &&\n dropdown(gridColumnsB.label, nrOfColumnsAvailable.partB),\n };\n const panelPropertiesPartB = {\n 'partB.feedbackEnabled': feedbackB.settings && toggle(feedbackB.label),\n 'partB.promptEnabled': promptB.settings && toggle(promptB.label),\n 'partB.teacherInstructionsEnabled': teacherInstructionsB.settings && toggle(teacherInstructionsB.label),\n 'partB.studentInstructionsEnabled': studentInstructionsB.settings && toggle(studentInstructionsB.label),\n 'partB.rationaleEnabled': rationaleB.settings && toggle(rationaleB.label),\n 'partB.spellCheckEnabled': spellCheckB.settings && toggle(spellCheckB.label),\n };\n\n return (\n <layout.ConfigLayout\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={this.onModelChanged}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n 'Settings for both': panelSettings,\n [`Settings ${firstPart}`]: panelSettingsPartA,\n [`Properties ${firstPart}`]: panelPropertiesPartA,\n [`Settings ${secondPart}`]: panelSettingsPartB,\n [`Properties ${secondPart}`]: panelPropertiesPartB,\n }}\n />\n }\n >\n <div>\n <div className={classes.part}>\n {model.partLabels && <div>{firstPart}</div>}\n <ebsr-multiple-choice-configure\n id=\"A\"\n key=\"partA\"\n ref={(ref) => {\n if (ref) {\n // do not use destructuring to get model from props\n this.partA = ref;\n this.partA._model = {\n ...this.props.model.partA,\n errors: (this.props.model.errors && this.props.model.errors.partA) || {},\n };\n this.partA.configuration = {\n ...partA,\n ...generalConfiguration,\n };\n }\n }}\n />\n </div>\n\n <div className={classes.part}>\n {model.partLabels && <div>{secondPart}</div>}\n <ebsr-multiple-choice-configure\n id=\"B\"\n key=\"partB\"\n ref={(ref) => {\n if (ref) {\n // do not use destructuring to get model from props\n this.partB = ref;\n this.partB._model = {\n ...this.props.model.partB,\n errors: (this.props.model.errors && this.props.model.errors.partB) || {},\n };\n this.partB.configuration = {\n ...partB,\n ...generalConfiguration,\n };\n }\n }}\n />\n </div>\n </div>\n </layout.ConfigLayout>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","radio","dropdown","styles","theme","partLabel","paddingBottom","spacing","unit","divider","flex","height","Main","choices","correctFound","map","choice","correct","model","key","onModelChanged","props","partA","choiceMode","removeExtraChoices","partB","classes","configuration","onConfigurationChanged","partLabelType","modelPartA","modelPartB","partialScoring","settingsPanelDisabled","scoringType","generalConfiguration","feedback","feedbackA","choiceModeA","choicePrefix","choicePrefixA","lockChoiceOrder","lockChoiceOrderA","prompt","promptA","teacherInstructions","teacherInstructionsA","studentInstructions","studentInstructionsA","choicesLayout","choicesLayoutA","gridColumns","gridColumnsA","rationale","rationaleA","spellCheck","spellCheckA","feedbackB","choiceModeB","choicePrefixB","lockChoiceOrderB","promptB","teacherInstructionsB","studentInstructionsB","choicesLayoutB","gridColumnsB","rationaleB","spellCheckB","type","typeIsNumber","firstPart","secondPart","nrOfColumnsAvailable","length","Array","from","_","i","panelSettings","partLabels","label","panelSettingsPartA","panelPropertiesPartA","panelSettingsPartB","panelPropertiesPartB","ref","_model","errors","React","Component","PropTypes","object","func","Styled"],"m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ID;AACF;AAhBH,QAnBF,eAsCE;AAAK,QAAA,SAAS,EAAET,OAAO,CAACjB;AAAxB,QAtCF,EAwCGS,KAAK,CAAC6D,UAAN,iBAAoB;AAAK,QAAA,SAAS,EAAErD,OAAO,CAACrB;AAAxB,SAAoCkE,UAApC,CAxCvB,eAyCE;AACE,QAAA,EAAE,EAAC,GADL;AAEE,QAAA,GAAG,EAAC,OAFN;AAGE,QAAA,GAAG,EAAE,aAACc,KAAD,EAAS;AACZ,cAAIA,KAAJ,EAAS;AACP;AACA,YAAA,MAAI,CAAC5D,KAAL,GAAa4D,KAAb;AACA,YAAA,MAAI,CAAC5D,KAAL,CAAW6D,MAAX,mCACK,MAAI,CAACjE,KAAL,CAAWH,KAAX,CAAiBO,KADtB;AAEE8D,cAAAA,MAAM,EAAG,MAAI,CAAClE,KAAL,CAAWH,KAAX,CAAiBqE,MAAjB,IAA2B,MAAI,CAAClE,KAAL,CAAWH,KAAX,CAAiBqE,MAAjB,CAAwB9D,KAApD,IAA8D;AAFxE;AAIA,YAAA,MAAI,CAACA,KAAL,CAAWE,aAAX,mCACKF,KADL,GAEKU,oBAFL;AAID;AACF;AAhBH,QAzCF,CADF;AA8DD;;;EA1MuBqD,kBAAMC,S;;;iCAAnB7E,I,eACQ;AACjBc,EAAAA,OAAO,EAAEgE,sBAAUC,MADF;AAEjBhE,EAAAA,aAAa,EAAE+D,sBAAUC,MAFR;AAGjBzE,EAAAA,KAAK,EAAEwE,sBAAUC,MAHA;AAIjBvE,EAAAA,cAAc,EAAEsE,sBAAUE,IAJT;AAKjBhE,EAAAA,sBAAsB,EAAE8D,sBAAUE;AALjB,C;AA4MrB,IAAMC,MAAM,GAAG,wBAAW1F,MAAX,EAAmBS,IAAnB,CAAf;eAEeiF,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { settings, layout } from '@pie-lib/config-ui';\nimport { withStyles } from '@material-ui/core/styles';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst styles = (theme) => ({\n partLabel: {\n paddingBottom: theme.spacing.unit * 2,\n },\n divider: {\n flex: 1,\n height: theme.spacing.unit * 2.5,\n },\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n configuration: PropTypes.object,\n model: PropTypes.object,\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n };\n\n removeExtraChoices = (choices) => {\n let correctFound = false;\n\n return (choices || []).map((choice) => {\n if (correctFound) {\n choice.correct = false;\n\n return choice;\n }\n\n if (choice.correct) {\n correctFound = true;\n }\n\n return choice;\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n if (key === 'partA.choiceMode' && model.partA.choiceMode === 'radio') {\n model.partA.choices = this.removeExtraChoices(model.partA.choices);\n\n return onModelChanged(model, true);\n }\n\n if (key === 'partB.choiceMode' && model.partB.choiceMode === 'radio') {\n model.partB.choices = this.removeExtraChoices(model.partB.choices);\n\n return onModelChanged(model, true);\n }\n\n return onModelChanged(model);\n };\n\n render() {\n const { classes, model, configuration, onConfigurationChanged } = this.props;\n const { partLabelType, partA: modelPartA, partB: modelPartB } = model;\n const { partA, partB, partialScoring, settingsPanelDisabled, scoringType, ...generalConfiguration } = configuration;\n const {\n feedback: feedbackA = {},\n choiceMode: choiceModeA = {},\n choicePrefix: choicePrefixA = {},\n lockChoiceOrder: lockChoiceOrderA = {},\n prompt: promptA = {},\n teacherInstructions: teacherInstructionsA = {},\n studentInstructions: studentInstructionsA = {},\n choicesLayout: choicesLayoutA = {},\n gridColumns: gridColumnsA = {},\n rationale: rationaleA = {},\n spellCheck: spellCheckA = {},\n } = partA || {};\n const {\n feedback: feedbackB = {},\n choiceMode: choiceModeB = {},\n choicePrefix: choicePrefixB = {},\n lockChoiceOrder: lockChoiceOrderB = {},\n prompt: promptB = {},\n teacherInstructions: teacherInstructionsB = {},\n studentInstructions: studentInstructionsB = {},\n choicesLayout: choicesLayoutB = {},\n gridColumns: gridColumnsB = {},\n rationale: rationaleB = {},\n spellCheck: spellCheckB = {},\n } = partB || {};\n\n const type = partLabelType || 'Numbers';\n const typeIsNumber = type === 'Numbers';\n const firstPart = `Part ${typeIsNumber ? '1' : 'A'}`;\n const secondPart = `Part ${typeIsNumber ? '2' : 'B'}`;\n const nrOfColumnsAvailable = {\n partA:\n modelPartA.choices && modelPartA.choices.length\n ? Array.from({ length: modelPartA.choices.length }, (_, i) => `${i + 1}`)\n : [],\n partB:\n modelPartB.choices && modelPartB.choices.length\n ? Array.from({ length: modelPartB.choices.length }, (_, i) => `${i + 1}`)\n : [],\n };\n\n const panelSettings = {\n partLabels: generalConfiguration.partLabels.settings && toggle(generalConfiguration.partLabels.label),\n partLabelType: model.partLabels && dropdown('', ['Numbers', 'Letters']),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),\n };\n\n const panelSettingsPartA = {\n 'partA.choiceMode': choiceModeA.settings && radio(choiceModeA.label, ['checkbox', 'radio']),\n 'partA.choicePrefix': choicePrefixA.settings && radio(choicePrefixA.label, ['numbers', 'letters']),\n 'partA.lockChoiceOrder': lockChoiceOrderA.settings && toggle(lockChoiceOrderA.label),\n 'partA.choicesLayout':\n choicesLayoutA.settings && dropdown(choicesLayoutA.label, ['vertical', 'grid', 'horizontal']),\n 'partA.gridColumns':\n choicesLayoutA.settings &&\n modelPartA.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.partA.length > 0 &&\n dropdown(gridColumnsA.label, nrOfColumnsAvailable.partA),\n };\n const panelPropertiesPartA = {\n 'partA.feedbackEnabled': feedbackA.settings && toggle(feedbackA.label),\n 'partA.promptEnabled': promptA.settings && toggle(promptA.label),\n 'partA.teacherInstructionsEnabled': teacherInstructionsA.settings && toggle(teacherInstructionsA.label),\n 'partA.studentInstructionsEnabled': studentInstructionsA.settings && toggle(studentInstructionsA.label),\n 'partA.rationaleEnabled': rationaleA.settings && toggle(rationaleA.label),\n 'partA.spellCheckEnabled': spellCheckA.settings && toggle(spellCheckA.label),\n };\n\n const panelSettingsPartB = {\n 'partB.choiceMode': choiceModeB.settings && radio(choiceModeB.label, ['checkbox', 'radio']),\n 'partB.choicePrefix': choicePrefixB.settings && radio(choicePrefixB.label, ['numbers', 'letters']),\n 'partB.lockChoiceOrder': lockChoiceOrderB.settings && toggle(lockChoiceOrderB.label),\n 'partB.choicesLayout':\n choicesLayoutB.settings && dropdown(choicesLayoutB.label, ['vertical', 'grid', 'horizontal']),\n 'partB.gridColumns':\n choicesLayoutB.settings &&\n modelPartB.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.partB.length > 0 &&\n dropdown(gridColumnsB.label, nrOfColumnsAvailable.partB),\n };\n const panelPropertiesPartB = {\n 'partB.feedbackEnabled': feedbackB.settings && toggle(feedbackB.label),\n 'partB.promptEnabled': promptB.settings && toggle(promptB.label),\n 'partB.teacherInstructionsEnabled': teacherInstructionsB.settings && toggle(teacherInstructionsB.label),\n 'partB.studentInstructionsEnabled': studentInstructionsB.settings && toggle(studentInstructionsB.label),\n 'partB.rationaleEnabled': rationaleB.settings && toggle(rationaleB.label),\n 'partB.spellCheckEnabled': spellCheckB.settings && toggle(spellCheckB.label),\n };\n\n return (\n <layout.ConfigLayout\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={this.onModelChanged}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n 'Settings for both': panelSettings,\n [`Settings ${firstPart}`]: panelSettingsPartA,\n [`Properties ${firstPart}`]: panelPropertiesPartA,\n [`Settings ${secondPart}`]: panelSettingsPartB,\n [`Properties ${secondPart}`]: panelPropertiesPartB,\n }}\n />\n }\n >\n {model.partLabels && <div className={classes.partLabel}>{firstPart}</div>}\n <ebsr-multiple-choice-configure\n id=\"A\"\n key=\"partA\"\n ref={(ref) => {\n if (ref) {\n // do not use destructuring to get model from props\n this.partA = ref;\n this.partA._model = {\n ...this.props.model.partA,\n errors: (this.props.model.errors && this.props.model.errors.partA) || {},\n };\n this.partA.configuration = {\n ...partA,\n ...generalConfiguration,\n };\n }\n }}\n />\n\n <div className={classes.divider} />\n\n {model.partLabels && <div className={classes.partLabel}>{secondPart}</div>}\n <ebsr-multiple-choice-configure\n id=\"B\"\n key=\"partB\"\n ref={(ref) => {\n if (ref) {\n // do not use destructuring to get model from props\n this.partB = ref;\n this.partB._model = {\n ...this.props.model.partB,\n errors: (this.props.model.errors && this.props.model.errors.partB) || {},\n };\n this.partB.configuration = {\n ...partB,\n ...generalConfiguration,\n };\n }\n }}\n />\n </layout.ConfigLayout>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
|
package/configure/src/main.jsx
CHANGED
|
@@ -6,12 +6,12 @@ import { withStyles } from '@material-ui/core/styles';
|
|
|
6
6
|
const { Panel, toggle, radio, dropdown } = settings;
|
|
7
7
|
|
|
8
8
|
const styles = (theme) => ({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
partLabel: {
|
|
10
|
+
paddingBottom: theme.spacing.unit * 2,
|
|
11
|
+
},
|
|
12
|
+
divider: {
|
|
13
|
+
flex: 1,
|
|
14
|
+
height: theme.spacing.unit * 2.5,
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
|
|
@@ -174,51 +174,47 @@ export class Main extends React.Component {
|
|
|
174
174
|
/>
|
|
175
175
|
}
|
|
176
176
|
>
|
|
177
|
-
<div>
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}}
|
|
219
|
-
/>
|
|
220
|
-
</div>
|
|
221
|
-
</div>
|
|
177
|
+
{model.partLabels && <div className={classes.partLabel}>{firstPart}</div>}
|
|
178
|
+
<ebsr-multiple-choice-configure
|
|
179
|
+
id="A"
|
|
180
|
+
key="partA"
|
|
181
|
+
ref={(ref) => {
|
|
182
|
+
if (ref) {
|
|
183
|
+
// do not use destructuring to get model from props
|
|
184
|
+
this.partA = ref;
|
|
185
|
+
this.partA._model = {
|
|
186
|
+
...this.props.model.partA,
|
|
187
|
+
errors: (this.props.model.errors && this.props.model.errors.partA) || {},
|
|
188
|
+
};
|
|
189
|
+
this.partA.configuration = {
|
|
190
|
+
...partA,
|
|
191
|
+
...generalConfiguration,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}}
|
|
195
|
+
/>
|
|
196
|
+
|
|
197
|
+
<div className={classes.divider} />
|
|
198
|
+
|
|
199
|
+
{model.partLabels && <div className={classes.partLabel}>{secondPart}</div>}
|
|
200
|
+
<ebsr-multiple-choice-configure
|
|
201
|
+
id="B"
|
|
202
|
+
key="partB"
|
|
203
|
+
ref={(ref) => {
|
|
204
|
+
if (ref) {
|
|
205
|
+
// do not use destructuring to get model from props
|
|
206
|
+
this.partB = ref;
|
|
207
|
+
this.partB._model = {
|
|
208
|
+
...this.props.model.partB,
|
|
209
|
+
errors: (this.props.model.errors && this.props.model.errors.partB) || {},
|
|
210
|
+
};
|
|
211
|
+
this.partB.configuration = {
|
|
212
|
+
...partB,
|
|
213
|
+
...generalConfiguration,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
}}
|
|
217
|
+
/>
|
|
222
218
|
</layout.ConfigLayout>
|
|
223
219
|
);
|
|
224
220
|
}
|
package/lib/index.js
CHANGED
|
@@ -180,6 +180,8 @@ var Ebsr = /*#__PURE__*/function (_HTMLElement) {
|
|
|
180
180
|
}, {
|
|
181
181
|
key: "connectedCallback",
|
|
182
182
|
value: function connectedCallback() {
|
|
183
|
+
// this.setAttribute('aria-label', 'Two-Part Question');
|
|
184
|
+
// this.setAttribute('role', 'region');
|
|
183
185
|
this._render();
|
|
184
186
|
|
|
185
187
|
this.addEventListener(SESSION_CHANGED, this.onSessionUpdated);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["SESSION_CHANGED","SessionChangedEvent","TYPE","MC_TAG_NAME","log","EbsrMC","MultipleChoice","defineMultipleChoice","customElements","get","define","isNonEmptyArray","a","Array","isArray","length","isSessionComplete","session","b","Ebsr","e","target","preventDefault","stopImmediatePropagation","id","getAttribute","key","toUpperCase","update","_model","dispatchSessionChanged","srcElement","_session","m","whenDefined","then","setPartModel","partA","partB","s","setPartSession","part","mode","model","keyMode","choicePrefix","value","partSession","complete","dispatchEvent","tagName","toLowerCase","querySelector","_render","addEventListener","onSessionUpdated","removeEventListener","innerHTML","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;AACA,IAAMA,eAAe,GAAGC,qCAAoBC,IAA5C;AACA,IAAMC,WAAW,GAAG,sBAApB;AACA,IAAMC,GAAG,GAAG,uBAAM,mBAAN,CAAZ;;IAEMC,M;;;;;;;;;;;EAAeC,0B;;AAErB,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,GAAM;AACjC,MAAI,CAACC,cAAc,CAACC,GAAf,CAAmBN,WAAnB,CAAL,EAAsC;AACpCK,IAAAA,cAAc,CAACE,MAAf,CAAsBP,WAAtB,EAAmCE,MAAnC;AACD;AACF,CAJD;;AAMAE,oBAAoB;;AAEpB,IAAMI,eAAe,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,GAApC,EAAyC;AACvC,WAAKM,QAAL,CAAcc,KAAd,mCACK,KAAKd,QAAL,CAAcc,KADnB,4CAEGpB,GAFH,EAESqB,WAFT;AAKA3C,MAAAA,GAAG,CAAC,8BAAD,EAAiC,KAAK4B,QAAtC,CAAH;AACA,UAAMgB,QAAQ,GAAGhC,iBAAiB,CAAC,KAAKgB,QAAN,CAAlC;AACA,WAAKiB,aAAL,CAAmB,IAAIhD,oCAAJ,CAAwB,KAAKiD,OAAL,CAAaC,WAAb,EAAxB,EAAoDH,QAApD,CAAnB;AACD;;;SAED,eAAY;AACV,aAAO,KAAKI,aAAL,WAAsBjD,WAAtB,QAAP;AACD;;;SAED,eAAY;AACV,aAAO,KAAKiD,aAAL,WAAsBjD,WAAtB,QAAP;AACD;;;WAED,6BAAoB;AAClB,WAAKkD,OAAL;;AACA,WAAKC,gBAAL,CAAsBtD,eAAtB,EAAuC,KAAKuD,gBAA5C;AACD;;;WAED,gCAAuB;AACrB,WAAKC,mBAAL,CAAyBxD,eAAzB,EAA0C,KAAKuD,gBAA/C;AACD;;;WAED,mBAAU;AACR,WAAKE,SAAL,qCAEOtD,WAFP,yBAE+BA,WAF/B,yBAGOA,WAHP,yBAG+BA,WAH/B;AAMD;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["SESSION_CHANGED","SessionChangedEvent","TYPE","MC_TAG_NAME","log","EbsrMC","MultipleChoice","defineMultipleChoice","customElements","get","define","isNonEmptyArray","a","Array","isArray","length","isSessionComplete","session","b","Ebsr","e","target","preventDefault","stopImmediatePropagation","id","getAttribute","key","toUpperCase","update","_model","dispatchSessionChanged","srcElement","_session","m","whenDefined","then","setPartModel","partA","partB","s","setPartSession","part","mode","model","keyMode","choicePrefix","value","partSession","complete","dispatchEvent","tagName","toLowerCase","querySelector","_render","addEventListener","onSessionUpdated","removeEventListener","innerHTML","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;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ultipleChoice from '@pie-element/multiple-choice';\nimport get from 'lodash/get';\nimport debug from 'debug';\nconst SESSION_CHANGED = SessionChangedEvent.TYPE;\nconst MC_TAG_NAME = 'ebsr-multiple-choice';\nconst log = debug('pie-elements:ebsr');\n\nclass EbsrMC extends MultipleChoice {}\n\nconst defineMultipleChoice = () => {\n if (!customElements.get(MC_TAG_NAME)) {\n customElements.define(MC_TAG_NAME, EbsrMC);\n }\n};\n\ndefineMultipleChoice();\n\nconst isNonEmptyArray = (a) => Array.isArray(a) && a.length > 0;\n\nexport const isSessionComplete = (session) => {\n const a = get(session, 'value.partA.value');\n const b = get(session, 'value.partB.value');\n\n return isNonEmptyArray(a) && isNonEmptyArray(b);\n};\n\nexport default class Ebsr extends HTMLElement {\n constructor() {\n super();\n this._model = {};\n this._session = {};\n }\n\n onSessionUpdated = (e) => {\n if (e.target === this) {\n return;\n }\n\n e.preventDefault();\n e.stopImmediatePropagation();\n\n const id = e.target.getAttribute('id');\n\n if (id) {\n const key = `part${id.toUpperCase()}`;\n\n if (e.update) {\n this._model[key] = e.update;\n }\n //TODO: accessing a private property here. The session event should contain the update in future to prevent this.\n this.dispatchSessionChanged(e.srcElement._session, key);\n }\n };\n\n set model(m) {\n this._model = m;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartModel(this.partA, 'partA');\n this.setPartModel(this.partB, 'partB');\n });\n }\n\n set session(s) {\n this._session = s;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartSession(this.partA, 'partA');\n this.setPartSession(this.partB, 'partB');\n });\n }\n\n get session() {\n return this._session;\n }\n\n setPartModel(part, key) {\n if (this._model && this._model[key] && part) {\n const { mode } = this._model;\n\n part.model = {\n ...this._model[key],\n mode,\n keyMode: this._model[key].choicePrefix,\n };\n }\n }\n\n setPartSession(part, key) {\n if (this._session && this._model && part) {\n const { value } = this._session;\n part.session = value && value[key] ? value[key] : { id: key };\n }\n }\n\n dispatchSessionChanged(partSession, key) {\n this._session.value = {\n ...this._session.value,\n [key]: partSession,\n };\n\n log('[onSessionChanged] session: ', this._session);\n const complete = isSessionComplete(this._session);\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), complete));\n }\n\n get partA() {\n return this.querySelector(`${MC_TAG_NAME}#a`);\n }\n\n get partB() {\n return this.querySelector(`${MC_TAG_NAME}#b`);\n }\n\n connectedCallback() {\n // this.setAttribute('aria-label', 'Two-Part Question');\n // this.setAttribute('role', 'region');\n this._render();\n this.addEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n disconnectedCallback() {\n this.removeEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n _render() {\n this.innerHTML = `\n <div>\n <${MC_TAG_NAME} id=\"a\"></${MC_TAG_NAME}>\n <${MC_TAG_NAME} id=\"b\"></${MC_TAG_NAME}>\n </div>\n `;\n }\n}\n"],"file":"index.js"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/ebsr",
|
|
3
|
-
"version": "8.7.1-next.
|
|
3
|
+
"version": "8.7.1-next.85+157e5bf9b",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@pie-element/multiple-choice": "^7.8.1-next.
|
|
10
|
+
"@pie-element/multiple-choice": "^7.8.1-next.85+157e5bf9b",
|
|
11
11
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"debug": "^4.1.1",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"author": "pie framework developers",
|
|
17
17
|
"license": "ISC",
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "157e5bf9b8e05cc8e64a1eaa4888f74fb1ab1e92",
|
|
19
19
|
"scripts": {
|
|
20
20
|
"postpublish": "../../scripts/postpublish"
|
|
21
21
|
},
|
package/src/index.js
CHANGED
|
@@ -114,6 +114,8 @@ export default class Ebsr extends HTMLElement {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
connectedCallback() {
|
|
117
|
+
// this.setAttribute('aria-label', 'Two-Part Question');
|
|
118
|
+
// this.setAttribute('role', 'region');
|
|
117
119
|
this._render();
|
|
118
120
|
this.addEventListener(SESSION_CHANGED, this.onSessionUpdated);
|
|
119
121
|
}
|