@pie-element/multiple-choice 6.2.4 → 6.2.7
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/CHANGELOG.md +24 -0
- package/configure/CHANGELOG.md +24 -0
- package/configure/lib/defaults.js +5 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +2 -2
- package/configure/lib/main.js +47 -9
- package/configure/lib/main.js.map +1 -1
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +8 -0
- package/controller/lib/index.js +61 -3
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +16 -0
- package/docs/config-schema.json.md +12 -0
- package/docs/pie-schema.json +6 -0
- package/docs/pie-schema.json.md +4 -0
- package/lib/choice-input.js +3 -3
- package/lib/choice.js +2 -2
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/module/configure.js +63 -30
- package/module/controller.js +46 -1
- package/module/element.js +3 -4
- package/module/index.html +1 -1
- package/module/manifest.json +3 -3
- package/module/print.html +1 -1
- package/module/print.js +3 -4
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.2.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.2.6...@pie-element/multiple-choice@6.2.7) (2022-04-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/multiple-choice
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [6.2.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.2.5...@pie-element/multiple-choice@6.2.6) (2022-03-28)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @pie-element/multiple-choice
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [6.2.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.2.4...@pie-element/multiple-choice@6.2.5) (2022-03-22)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @pie-element/multiple-choice
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [6.2.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.2.3...@pie-element/multiple-choice@6.2.4) (2022-03-08)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @pie-element/multiple-choice
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.1.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.6...@pie-element/multiple-choice-configure@4.1.7) (2022-04-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [4.1.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.5...@pie-element/multiple-choice-configure@4.1.6) (2022-03-28)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [4.1.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.4...@pie-element/multiple-choice-configure@4.1.5) (2022-03-22)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [4.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.3...@pie-element/multiple-choice-configure@4.1.4) (2022-03-08)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","choiceMode","choicePrefix","choices","prompt","lockChoiceOrder","partialScoring","scoringType","feedbackEnabled","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","choicesLayout","gridColumns","configuration","
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","choiceMode","choicePrefix","choices","prompt","lockChoiceOrder","partialScoring","scoringType","feedbackEnabled","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","choicesLayout","gridColumns","configuration","spellCheck","label","settings","enabled","answerChoiceCount","addChoiceButton","deleteChoice","feedback","rationale","accessibility","studentInstructions","teacherInstructions","minAnswerChoices","maxAnswerChoices"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;eACe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,UAAU,EAAE,UADP;AAELC,IAAAA,YAAY,EAAE,SAFT;AAGLC,IAAAA,OAAO,EAAE,EAHJ;AAILC,IAAAA,MAAM,EAAE,2BAJH;AAKLC,IAAAA,eAAe,EAAE,IALZ;AAMLC,IAAAA,cAAc,EAAE,IANX;AAOLC,IAAAA,WAAW,EAAE,MAPR;AAQLC,IAAAA,eAAe,EAAE,IARZ;AASLC,IAAAA,aAAa,EAAE,IATV;AAULC,IAAAA,gBAAgB,EAAE,IAVb;AAWLC,IAAAA,0BAA0B,EAAE,IAXvB;AAYLC,IAAAA,0BAA0B,EAAE,IAZvB;AAaLC,IAAAA,qBAAqB,EAAE,QAblB;AAcLC,IAAAA,aAAa,EAAE,UAdV;AAeLC,IAAAA,WAAW,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,IAAAA,aAAa,EAAE;AACbP,MAAAA,QAAQ,EAAE,KADG;AAEbD,MAAAA,KAAK,EAAE;AAFM,KAjDF;AAqDbX,IAAAA,WAAW,EAAE;AACXY,MAAAA,QAAQ,EAAE,KADC;AAEXD,MAAAA,KAAK,EAAE;AAFI,KArDA;AAyDbS,IAAAA,mBAAmB,EAAE;AACnBR,MAAAA,QAAQ,EAAE,KADS;AAEnBD,MAAAA,KAAK,EAAE;AAFY,KAzDR;AA6DbU,IAAAA,mBAAmB,EAAE;AACnBT,MAAAA,QAAQ,EAAE,IADS;AAEnBD,MAAAA,KAAK,EAAE;AAFY,KA7DR;AAiEbL,IAAAA,qBAAqB,EAAE;AACrBM,MAAAA,QAAQ,EAAE,KADW;AAErBD,MAAAA,KAAK,EAAE;AAFc,KAjEV;AAqEbW,IAAAA,gBAAgB,EAAE,CArEL;AAsEbC,IAAAA,gBAAgB,EAAE;AAtEL;AAlBF,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 choiceMode: 'checkbox',\n choicePrefix: 'letters',\n choices: [],\n prompt: 'Question Prompt goes here',\n lockChoiceOrder: true,\n partialScoring: true,\n scoringType: 'auto',\n feedbackEnabled: true,\n promptEnabled: true,\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n choicesLayout: 'vertical',\n gridColumns: '2',\n },\n configuration: {\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 },\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 },\n accessibility: {\n settings: false,\n label: 'Accessibility Label'\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 },\n toolbarEditorPosition: {\n settings: false,\n label: 'Toolbar Editor Position',\n },\n minAnswerChoices: 2,\n maxAnswerChoices: 5\n },\n};\n"],"file":"defaults.js"}
|
package/configure/lib/index.js
CHANGED
|
@@ -43,9 +43,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
43
43
|
|
|
44
44
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
45
|
|
|
46
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
46
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
47
47
|
|
|
48
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
48
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
49
49
|
|
|
50
50
|
var log = (0, _debug["default"])('multiple-choice:configure');
|
|
51
51
|
|
package/configure/lib/main.js
CHANGED
|
@@ -47,13 +47,17 @@ var _DialogTitle = _interopRequireDefault(require("@material-ui/core/DialogTitle
|
|
|
47
47
|
|
|
48
48
|
var _DialogActions = _interopRequireDefault(require("@material-ui/core/DialogActions"));
|
|
49
49
|
|
|
50
|
+
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
|
|
51
|
+
|
|
52
|
+
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
|
53
|
+
|
|
50
54
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
51
55
|
|
|
52
56
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
53
57
|
|
|
54
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
58
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
55
59
|
|
|
56
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
60
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
57
61
|
|
|
58
62
|
var Panel = _configUi.settings.Panel,
|
|
59
63
|
toggle = _configUi.settings.toggle,
|
|
@@ -114,6 +118,28 @@ var styles = function styles(theme) {
|
|
|
114
118
|
'&:focus': {
|
|
115
119
|
backgroundColor: _renderUi.color.disabled()
|
|
116
120
|
}
|
|
121
|
+
},
|
|
122
|
+
flexContainer: {
|
|
123
|
+
display: 'flex',
|
|
124
|
+
alignItems: 'center'
|
|
125
|
+
},
|
|
126
|
+
titleText: {
|
|
127
|
+
fontFamily: 'Cerebri Sans',
|
|
128
|
+
fontSize: '18px',
|
|
129
|
+
lineHeight: '19px',
|
|
130
|
+
color: '#495B8F',
|
|
131
|
+
marginRight: '5px',
|
|
132
|
+
marginBottom: '5px'
|
|
133
|
+
},
|
|
134
|
+
tooltip: {
|
|
135
|
+
fontSize: '12px',
|
|
136
|
+
whiteSpace: 'pre',
|
|
137
|
+
maxWidth: '500px'
|
|
138
|
+
},
|
|
139
|
+
errorText: {
|
|
140
|
+
fontSize: '12px',
|
|
141
|
+
color: 'red',
|
|
142
|
+
paddingTop: '5px'
|
|
117
143
|
}
|
|
118
144
|
};
|
|
119
145
|
};
|
|
@@ -162,6 +188,8 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
162
188
|
sequentialChoiceLabels = _ref$sequentialChoice === void 0 ? {} : _ref$sequentialChoice,
|
|
163
189
|
settingsPanelDisabled = _ref.settingsPanelDisabled,
|
|
164
190
|
choicesLayout = _ref.choicesLayout,
|
|
191
|
+
_ref$spellCheck = _ref.spellCheck,
|
|
192
|
+
spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck,
|
|
165
193
|
gridColumns = _ref.gridColumns;
|
|
166
194
|
|
|
167
195
|
var _ref2 = configuration || {},
|
|
@@ -174,7 +202,9 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
174
202
|
accessibilityLabelsEnabled = _ref3.accessibilityLabelsEnabled,
|
|
175
203
|
feedbackEnabled = _ref3.feedbackEnabled,
|
|
176
204
|
promptEnabled = _ref3.promptEnabled,
|
|
177
|
-
|
|
205
|
+
spellCheckEnabled = _ref3.spellCheckEnabled,
|
|
206
|
+
choices = _ref3.choices; // const { choicesErrors, correctResponseError, answerChoicesError } = errors || {};
|
|
207
|
+
|
|
178
208
|
|
|
179
209
|
var nrOfColumnsAvailable = choices && choices.length ? Array.from({
|
|
180
210
|
length: choices.length
|
|
@@ -215,7 +245,8 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
215
245
|
onChange: onTeacherInstructionsChanged,
|
|
216
246
|
imageSupport: imageSupport,
|
|
217
247
|
nonEmpty: false,
|
|
218
|
-
toolbarOpts: toolbarOpts
|
|
248
|
+
toolbarOpts: toolbarOpts,
|
|
249
|
+
spellCheck: spellCheckEnabled
|
|
219
250
|
})), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
220
251
|
label: prompt.label,
|
|
221
252
|
className: classes.promptHolder
|
|
@@ -226,8 +257,9 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
226
257
|
imageSupport: imageSupport,
|
|
227
258
|
nonEmpty: false,
|
|
228
259
|
disableUnderline: true,
|
|
229
|
-
toolbarOpts: toolbarOpts
|
|
230
|
-
|
|
260
|
+
toolbarOpts: toolbarOpts,
|
|
261
|
+
spellCheck: spellCheckEnabled
|
|
262
|
+
})), choices.map(function (choice, index) {
|
|
231
263
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
232
264
|
key: "choice-".concat(index),
|
|
233
265
|
className: classes.choiceConfigurationHolder
|
|
@@ -249,7 +281,10 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
249
281
|
allowFeedBack: feedbackEnabled,
|
|
250
282
|
allowDelete: deleteChoice.settings,
|
|
251
283
|
noLabels: true,
|
|
252
|
-
toolbarOpts: toolbarOpts
|
|
284
|
+
toolbarOpts: toolbarOpts,
|
|
285
|
+
spellCheck: spellCheckEnabled // error={choicesErrors && choicesErrors[choice.value] ? choicesErrors[choice.value] : null}
|
|
286
|
+
// noCorrectAnswerError={correctResponseError}
|
|
287
|
+
|
|
253
288
|
}), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
254
289
|
key: "rationale-".concat(index),
|
|
255
290
|
label: rationale.label,
|
|
@@ -264,7 +299,8 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
264
299
|
},
|
|
265
300
|
imageSupport: imageSupport,
|
|
266
301
|
toolbarOpts: toolbarOpts,
|
|
267
|
-
pluginProps: labelPlugins
|
|
302
|
+
pluginProps: labelPlugins,
|
|
303
|
+
spellCheck: spellCheckEnabled
|
|
268
304
|
})), accessibilityLabelsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
269
305
|
key: "accessibility-".concat(index),
|
|
270
306
|
label: accessibility.label,
|
|
@@ -278,7 +314,8 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
278
314
|
}));
|
|
279
315
|
},
|
|
280
316
|
imageSupport: imageSupport,
|
|
281
|
-
pluginProps: labelPlugins
|
|
317
|
+
pluginProps: labelPlugins,
|
|
318
|
+
spellCheck: spellCheckEnabled
|
|
282
319
|
})));
|
|
283
320
|
}), /*#__PURE__*/_react["default"].createElement("br", null), addChoiceButton.settings && /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
284
321
|
title: maxAnswerChoices && model.choices.length >= maxAnswerChoices ? "Only ".concat(maxAnswerChoices, " allowed maximum") : '',
|
|
@@ -320,6 +357,7 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
320
357
|
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
321
358
|
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
322
359
|
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
360
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
323
361
|
accessibilityLabelsEnabled: accessibility.settings && toggle(accessibility.label),
|
|
324
362
|
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric'])
|
|
325
363
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","radio","dropdown","MAX_CHOICES","styles","theme","promptHolder","width","paddingBottom","spacing","unit","marginBottom","prompt","paddingTop","rationaleHolder","accessibilityHolder","rationale","accessibility","design","choiceConfigurationHolder","display","flexDirection","alignItems","choiceConfiguration","switchElement","justifyContent","margin","addButton","disableButton","cursor","pointerEvents","backgroundColor","color","disabled","Design","props","classes","model","configuration","onPromptChanged","onChoiceChanged","onRemoveChoice","onAddChoice","imageSupport","onChangeModel","onConfigurationChanged","onTeacherInstructionsChanged","addChoiceButton","feedback","deleteChoice","choiceMode","choicePrefix","partialScoring","lockChoiceOrder","teacherInstructions","studentInstructions","scoringType","sequentialChoiceLabels","settingsPanelDisabled","choicesLayout","gridColumns","maxAnswerChoices","limitChoicesNumber","teacherInstructionsEnabled","rationaleEnabled","accessibilityLabelsEnabled","feedbackEnabled","promptEnabled","choices","nrOfColumnsAvailable","length","Array","from","_","i","labelPlugins","audio","video","toolbarOpts","toolbarEditorPosition","position","Content","label","map","choice","index","c","tooltip","root","undefined","settingsInPanel","Settings","Properties","studentInstructionsEnabled","InfoDialog","open","onCancel","onOk","title","propTypes","PropTypes","bool","func","string","Main","dialog","minAnswerChoices","setState","message","splice","onModelChanged","push","value","utils","firstAvailableIndex","type","correct","key","correctFound","state","React","Component","object","isRequired","disableSidePanel","shape","add","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;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,WAAW,GAAG,CAApB;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBC,IAAAA,YAAY,EAAE;AACZC,MAAAA,KAAK,EAAE,MADK;AAEZC,MAAAA,aAAa,EAAEH,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAFxB;AAGZC,MAAAA,YAAY,EAAEN,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB;AAHvB,KADS;AAMvBE,IAAAA,MAAM,EAAE;AACNC,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAD3B;AAENH,MAAAA,KAAK,EAAE;AAFD,KANe;AAUvBO,IAAAA,eAAe,EAAE;AACfP,MAAAA,KAAK,EAAE;AADQ,KAVM;AAavBQ,IAAAA,mBAAmB,EAAE;AACnBR,MAAAA,KAAK,EAAE;AADY,KAbE;AAgBvBS,IAAAA,SAAS,EAAE;AACTH,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB;AADxB,KAhBY;AAmBvBO,IAAAA,aAAa,EAAE;AACbJ,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB;AADpB,KAnBQ;AAsBvBQ,IAAAA,MA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,CAAQd,MAAR;AAEA,0BACE,+EACA,gCAAC,UAAD;AACI,QAAA,IAAI,EAAEA,MAAM,CAACV,IADjB;AAEI,QAAA,KAAK,EAAEU,MAAM,CAACG,OAFlB;AAGI,QAAA,QAAQ,EAAEH,MAAM,CAACT,QAHrB;AAII,QAAA,IAAI,EAAES,MAAM,CAACR;AAJjB,QADA,eAMI,gCAAC,MAAD,gCACI,KAAK9D,KADT;AAEA,QAAA,aAAa,EAAE,KAAK2E,cAFpB;AAGA,QAAA,cAAc,EAAE,KAAKrE,cAHrB;AAIA,QAAA,eAAe,EAAE,KAAKD,eAJtB;AAKA,QAAA,WAAW,EAAE,KAAKE,WALlB;AAMA,QAAA,eAAe,EAAE,KAAKH,eANtB;AAOA,QAAA,4BAA4B,EAAE,KAAKO;AAPnC,SANJ,CADF;AAiBD;;;EAjLuB0E,kBAAMC,S;;;iCAAnBjB,I,eACQ;AACjBnE,EAAAA,KAAK,EAAE+D,sBAAUsB,MAAV,CAAiBC,UADP;AAEjBrF,EAAAA,aAAa,EAAE8D,sBAAUsB,MAAV,CAAiBC,UAFf;AAGjBC,EAAAA,gBAAgB,EAAExB,sBAAUC,IAHX;AAIjBS,EAAAA,cAAc,EAAEV,sBAAUE,IAAV,CAAeqB,UAJd;AAKjB9E,EAAAA,sBAAsB,EAAEuD,sBAAUE,IAAV,CAAeqB,UALtB;AAMjBvF,EAAAA,OAAO,EAAEgE,sBAAUsB,MAAV,CAAiBC,UANT;AAOjBhF,EAAAA,YAAY,EAAEyD,sBAAUyB,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAE1B,sBAAUE,IAAV,CAAeqB,UADQ;AAE5B,cAAQvB,sBAAUE,IAAV,CAAeqB;AAFK,GAAhB;AAPG,C;AAmLrB,IAAMI,MAAM,GAAG,wBAAW3H,MAAX,EAAmBoG,IAAnB,CAAf;eAEeuB,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html';\nimport {\n InputContainer,\n ChoiceConfiguration,\n settings,\n layout,\n choiceUtils as utils\n} from '@pie-lib/config-ui';\nimport { color } from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport Button from '@material-ui/core/Button';\nimport merge from 'lodash/merge';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport DialogActions from '@material-ui/core/DialogActions';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst MAX_CHOICES = 9;\n\nconst styles = theme => ({\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%'\n },\n rationaleHolder: {\n width: '70%'\n },\n accessibilityHolder: {\n width: '70%'\n },\n rationale: {\n paddingTop: theme.spacing.unit * 2\n },\n accessibility: {\n paddingTop: theme.spacing.unit * 2\n },\n design: {\n paddingTop: theme.spacing.unit * 3\n },\n choiceConfigurationHolder: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center'\n },\n choiceConfiguration: {\n width: '100%',\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0\n },\n addButton: {\n float: 'right'\n },\n disableButton: {\n cursor: 'not-allowed',\n pointerEvents: 'all',\n backgroundColor: color.disabled(),\n '&:hover': {\n backgroundColor: color.disabled(),\n },\n '&:focus': {\n backgroundColor: color.disabled(),\n }\n }\n});\n\nconst Design = withStyles(styles)(props => {\n const {\n classes,\n model,\n configuration,\n onPromptChanged,\n onChoiceChanged,\n onRemoveChoice,\n onAddChoice,\n imageSupport,\n onChangeModel,\n onConfigurationChanged,\n onTeacherInstructionsChanged\n } = props;\n const {\n prompt = {},\n addChoiceButton = {},\n feedback = {},\n deleteChoice = {},\n choiceMode = {},\n choicePrefix = {},\n partialScoring = {},\n lockChoiceOrder = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n accessibility = {},\n scoringType = {},\n sequentialChoiceLabels = {},\n settingsPanelDisabled,\n choicesLayout,\n gridColumns,\n } = configuration || {};\n let { maxAnswerChoices } = configuration || {};\n const {\n limitChoicesNumber,\n teacherInstructionsEnabled,\n rationaleEnabled,\n accessibilityLabelsEnabled,\n feedbackEnabled,\n promptEnabled,\n choices\n } = model || {};\n\n const nrOfColumnsAvailable = (choices && choices.length)\n ? Array.from({length: choices.length}, (_, i) => (`${i + 1}`))\n : [];\n\n const labelPlugins = {\n audio: { disabled: true },\n video: { disabled: true }\n };\n\n const toolbarOpts = {};\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n const Content = (\n <div>\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n />\n </InputContainer>\n )}\n {model.choices.map((choice, index) => (\n <div\n key={`choice-${index}`}\n className={classes.choiceConfigurationHolder}\n >\n <ChoiceConfiguration\n key={index}\n index={index + 1}\n useLetterOrdering={model.choicePrefix === 'letters'}\n className={classes.choiceConfiguration}\n mode={model.choiceMode}\n data={choice}\n defaultFeedback={{}}\n imageSupport={imageSupport}\n onDelete={() => onRemoveChoice(index)}\n onChange={c => onChoiceChanged(index, c)}\n allowFeedBack={feedbackEnabled}\n allowDelete={deleteChoice.settings}\n noLabels\n toolbarOpts={toolbarOpts}\n />\n {rationaleEnabled && (\n <InputContainer\n key={`rationale-${index}`}\n label={rationale.label}\n className={classes.rationaleHolder}\n >\n <EditableHtml\n className={classes.rationale}\n markup={choice.rationale || ''}\n onChange={c =>\n onChoiceChanged(index, {\n ...choice,\n rationale: c\n })\n }\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n pluginProps={labelPlugins}\n />\n </InputContainer>\n )}\n {accessibilityLabelsEnabled && (\n <InputContainer\n key={`accessibility-${index}`}\n label={accessibility.label}\n className={classes.accessibilityHolder}\n >\n <EditableHtml\n className={classes.accessibility}\n markup={choice.accessibility || ''}\n onChange={c =>\n onChoiceChanged(index, {\n ...choice,\n accessibility: c\n })\n }\n imageSupport={imageSupport}\n pluginProps={labelPlugins}\n />\n </InputContainer>\n )}\n </div>\n ))}\n <br />\n {addChoiceButton.settings && (\n <Tooltip title={maxAnswerChoices && model.choices.length >= maxAnswerChoices ? `Only ${maxAnswerChoices} allowed maximum` : ''} classes={{ tooltip: classes.tooltip }}>\n <Button\n classes={{ root: maxAnswerChoices && model.choices.length >= maxAnswerChoices ? classes.disableButton : undefined }}\n className={classes.addButton}\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n >\n {addChoiceButton.label}\n </Button>\n </Tooltip>\n )}\n </div>\n );\n\n const settingsInPanel = {\n choiceMode:\n choiceMode.settings &&\n radio(choiceMode.label, ['checkbox', 'radio']),\n 'sequentialChoiceLabels.enabled':\n sequentialChoiceLabels.settings &&\n toggle(sequentialChoiceLabels.label, true),\n choicePrefix:\n choicePrefix.settings &&\n radio(choicePrefix.label, ['numbers', 'letters']),\n partialScoring:\n partialScoring.settings && toggle(partialScoring.label),\n lockChoiceOrder:\n lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n feedbackEnabled:\n feedback.settings && toggle(feedback.label),\n choicesLayout:\n choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),\n gridColumns:\n choicesLayout.settings && model.choicesLayout === 'grid' && nrOfColumnsAvailable.length > 0 &&\n dropdown(gridColumns.label, nrOfColumnsAvailable)\n };\n\n return (\n <div className={classes.design}>\n {settingsPanelDisabled ? (\n Content\n ) : (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n onChangeModel={onChangeModel}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: settingsInPanel,\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n studentInstructionsEnabled:\n studentInstructions.settings &&\n toggle(studentInstructions.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n rationaleEnabled:\n rationale.settings && toggle(rationale.label),\n accessibilityLabelsEnabled:\n accessibility.settings && toggle(accessibility.label),\n scoringType:\n scoringType.settings &&\n radio(scoringType.label, ['auto', 'rubric'])\n }\n }}\n />\n }\n >\n {Content}\n </layout.ConfigLayout>\n )}\n </div>\n );\n});\n\nconst InfoDialog = ({ open, onCancel, onOk, title }) => (\n <Dialog open={open}>\n <DialogTitle>{title}</DialogTitle>\n <DialogActions>\n {onOk && (\n <Button onClick={onOk} color=\"primary\">\n OK\n </Button>\n )}\n {onCancel && (\n <Button onClick={onCancel} color=\"primary\">\n Cancel\n </Button>\n )}\n </DialogActions>\n </Dialog>\n);\n\nInfoDialog.propTypes = {\n open: PropTypes.bool,\n onCancel: PropTypes.func,\n onOk: PropTypes.func,\n title: PropTypes.string\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired\n })\n };\n\n state = {\n dialog: {\n open: false\n }\n };\n\n onRemoveChoice = index => {\n const { model, configuration } = this.props;\n const { minAnswerChoices } = configuration || {};\n\n if (minAnswerChoices && model.choices.length === minAnswerChoices) {\n this.setState({\n dialog: {\n open: true,\n message:\n `There can't be less than ${minAnswerChoices} choices.`,\n onOk: () => {\n this.setState(\n {\n dialog: {\n open: false\n }\n },\n );\n },\n onCancel: () =>\n this.setState({\n dialog: {\n open: false\n }\n })\n }\n });\n } else {\n model.choices.splice(index, 1);\n this.props.onModelChanged(model);\n }\n };\n\n onAddChoice = () => {\n const { model, configuration } = this.props;\n let { maxAnswerChoices } = configuration || {};\n const { limitChoicesNumber } = model || {};\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n if (maxAnswerChoices && model.choices.length === maxAnswerChoices) {\n this.setState({\n dialog: {\n open: true,\n message:\n `There can't be more than ${maxAnswerChoices} choices.`,\n onOk: () => {\n this.setState(\n {\n dialog: {\n open: false\n }\n },\n );\n },\n onCancel: () =>\n this.setState({\n dialog: {\n open: false\n }\n })\n }\n });\n } else {\n model.choices.push({\n label: '',\n value: utils.firstAvailableIndex(model.choices.map(c => c.value), 0),\n feedback: {\n type: 'none'\n }\n });\n\n this.props.onModelChanged(model);\n }\n };\n\n onChoiceChanged = (index, choice) => {\n const { model } = this.props;\n\n if (choice.correct && model.choiceMode === 'radio') {\n model.choices = model.choices.map(c => {\n return merge({}, c, { correct: false });\n });\n }\n\n model.choices.splice(index, 1, choice);\n this.props.onModelChanged(model);\n };\n\n onPromptChanged = prompt => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt\n });\n };\n\n onTeacherInstructionsChanged = teacherInstructions => {\n this.props.onModelChanged({\n ...this.props.model,\n teacherInstructions\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n switch (key) {\n case 'choiceMode': {\n let value = model.choiceMode;\n\n if (value === 'radio') {\n let correctFound = false;\n\n model.choices = model.choices.map(c => {\n if (correctFound) {\n c.correct = false;\n return c;\n }\n\n if (c.correct) {\n correctFound = true;\n }\n return c;\n });\n }\n onModelChanged(model, true);\n break;\n }\n default:\n onModelChanged(model);\n break;\n }\n };\n\n render() {\n const { dialog} = this.state;\n\n return (\n <>\n <InfoDialog\n open={dialog.open}\n title={dialog.message}\n onCancel={dialog.onCancel}\n onOk={dialog.onOk}\n /><Design\n {...this.props}\n onChangeModel={this.onModelChanged}\n onRemoveChoice={this.onRemoveChoice}\n onChoiceChanged={this.onChoiceChanged}\n onAddChoice={this.onAddChoice}\n onPromptChanged={this.onPromptChanged}\n onTeacherInstructionsChanged={this.onTeacherInstructionsChanged}\n /></>\n );\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","MAX_CHOICES","styles","theme","promptHolder","width","paddingBottom","spacing","unit","marginBottom","prompt","paddingTop","rationaleHolder","accessibilityHolder","rationale","accessibility","design","choiceConfigurationHolder","display","flexDirection","alignItems","choiceConfiguration","switchElement","justifyContent","margin","addButton","disableButton","cursor","pointerEvents","backgroundColor","color","disabled","flexContainer","titleText","fontFamily","fontSize","lineHeight","marginRight","tooltip","whiteSpace","maxWidth","errorText","Design","props","classes","model","configuration","onPromptChanged","onChoiceChanged","onRemoveChoice","onAddChoice","imageSupport","onChangeModel","onConfigurationChanged","onTeacherInstructionsChanged","addChoiceButton","feedback","deleteChoice","choiceMode","choicePrefix","partialScoring","lockChoiceOrder","teacherInstructions","studentInstructions","scoringType","sequentialChoiceLabels","settingsPanelDisabled","choicesLayout","spellCheck","gridColumns","maxAnswerChoices","limitChoicesNumber","teacherInstructionsEnabled","rationaleEnabled","accessibilityLabelsEnabled","feedbackEnabled","promptEnabled","spellCheckEnabled","choices","nrOfColumnsAvailable","length","Array","from","_","i","labelPlugins","audio","video","toolbarOpts","toolbarEditorPosition","position","Content","label","map","choice","index","c","root","undefined","settingsInPanel","Settings","Properties","studentInstructionsEnabled","InfoDialog","open","onCancel","onOk","title","propTypes","PropTypes","bool","func","string","Main","dialog","minAnswerChoices","setState","message","splice","onModelChanged","push","value","utils","firstAvailableIndex","type","correct","key","correctFound","state","React","Component","object","isRequired","disableSidePanel","shape","add","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;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,WAAW,GAAG,CAApB;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,YAAY,EAAE;AACZC,MAAAA,KAAK,EAAE,MADK;AAEZC,MAAAA,aAAa,EAAEH,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAFxB;AAGZC,MAAAA,YAAY,EAAEN,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB;AAHvB,KADW;AAMzBE,IAAAA,MAAM,EAAE;AACNC,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAD3B;AAENH,MAAAA,KAAK,EAAE;AAFD,KANiB;AAUzBO,IAAAA,eAAe,EAAE;AACfP,MAAAA,KAAK,EAAE;AADQ,KAVQ;AAazBQ,IAAAA,mBAAmB,EAAE;AACnBR,MAAAA,KAAK,EAAE;AADY,KAbI;AAgBzBS,IAAAA,SAAS,EAAE;AACTH,MAAAA,UAAU,EAAER,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB;AADxB,KAhBc;AAmBzBO,IAAAA,a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QAAA,IAAI,EAAES,MAAM,CAACR;AAJf,QADF,eAOE,gCAAC,MAAD,gCACM,KAAK/D,KADX;AAEE,QAAA,aAAa,EAAE,KAAK4E,cAFtB;AAGE,QAAA,cAAc,EAAE,KAAKtE,cAHvB;AAIE,QAAA,eAAe,EAAE,KAAKD,eAJxB;AAKE,QAAA,WAAW,EAAE,KAAKE,WALpB;AAME,QAAA,eAAe,EAAE,KAAKH,eANxB;AAOE,QAAA,4BAA4B,EAAE,KAAKO;AAPrC,SAPF,CADF;AAmBD;;;EAhLuB2E,kBAAMC,S;;;iCAAnBjB,I,eACQ;AACjBpE,EAAAA,KAAK,EAAEgE,sBAAUsB,MAAV,CAAiBC,UADP;AAEjBtF,EAAAA,aAAa,EAAE+D,sBAAUsB,MAAV,CAAiBC,UAFf;AAGjBC,EAAAA,gBAAgB,EAAExB,sBAAUC,IAHX;AAIjBS,EAAAA,cAAc,EAAEV,sBAAUE,IAAV,CAAeqB,UAJd;AAKjB/E,EAAAA,sBAAsB,EAAEwD,sBAAUE,IAAV,CAAeqB,UALtB;AAMjBxF,EAAAA,OAAO,EAAEiE,sBAAUsB,MAAV,CAAiBC,UANT;AAOjBjF,EAAAA,YAAY,EAAE0D,sBAAUyB,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAE1B,sBAAUE,IAAV,CAAeqB,UADQ;AAE5B,cAAQvB,sBAAUE,IAAV,CAAeqB;AAFK,GAAhB;AAPG,C;AAkLrB,IAAMI,MAAM,GAAG,wBAAWtI,MAAX,EAAmB+G,IAAnB,CAAf;eAEeuB,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html';\nimport {\n InputContainer,\n ChoiceConfiguration,\n settings,\n layout,\n choiceUtils as utils,\n} from '@pie-lib/config-ui';\nimport { color } from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport Button from '@material-ui/core/Button';\nimport merge from 'lodash/merge';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport Typography from '@material-ui/core/Typography';\nimport Info from '@material-ui/icons/Info';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst MAX_CHOICES = 9;\n\nconst styles = (theme) => ({\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n },\n rationaleHolder: {\n width: '70%',\n },\n accessibilityHolder: {\n width: '70%',\n },\n rationale: {\n paddingTop: theme.spacing.unit * 2,\n },\n accessibility: {\n paddingTop: theme.spacing.unit * 2,\n },\n design: {\n paddingTop: theme.spacing.unit * 3,\n },\n choiceConfigurationHolder: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n },\n choiceConfiguration: {\n width: '100%',\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2,\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0,\n },\n addButton: {\n float: 'right',\n },\n disableButton: {\n cursor: 'not-allowed',\n pointerEvents: 'all',\n backgroundColor: color.disabled(),\n '&:hover': {\n backgroundColor: color.disabled(),\n },\n '&:focus': {\n backgroundColor: color.disabled(),\n },\n },\n flexContainer: {\n display: 'flex',\n alignItems: 'center',\n },\n titleText: {\n fontFamily: 'Cerebri Sans',\n fontSize: '18px',\n lineHeight: '19px',\n color: '#495B8F',\n marginRight: '5px',\n marginBottom: '5px'\n },\n tooltip: {\n fontSize: '12px',\n whiteSpace: 'pre',\n maxWidth: '500px'\n },\n errorText: {\n fontSize: '12px',\n color: 'red',\n paddingTop: '5px'\n }\n});\n\nconst Design = withStyles(styles)((props) => {\n const {\n classes,\n model,\n configuration,\n onPromptChanged,\n onChoiceChanged,\n onRemoveChoice,\n onAddChoice,\n imageSupport,\n onChangeModel,\n onConfigurationChanged,\n onTeacherInstructionsChanged,\n } = props;\n const {\n prompt = {},\n addChoiceButton = {},\n feedback = {},\n deleteChoice = {},\n choiceMode = {},\n choicePrefix = {},\n partialScoring = {},\n lockChoiceOrder = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n accessibility = {},\n scoringType = {},\n sequentialChoiceLabels = {},\n settingsPanelDisabled,\n choicesLayout,\n spellCheck = {},\n gridColumns,\n } = configuration || {};\n let { maxAnswerChoices } = configuration || {};\n const {\n limitChoicesNumber,\n teacherInstructionsEnabled,\n rationaleEnabled,\n accessibilityLabelsEnabled,\n feedbackEnabled,\n promptEnabled,\n spellCheckEnabled,\n choices,\n // errors\n } = model || {};\n\n // const { choicesErrors, correctResponseError, answerChoicesError } = errors || {};\n const nrOfColumnsAvailable =\n choices && choices.length\n ? Array.from({ length: choices.length }, (_, i) => `${i + 1}`)\n : [];\n\n const labelPlugins = {\n audio: { disabled: true },\n video: { disabled: true },\n };\n\n const toolbarOpts = {};\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n const Content = (\n <div>\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n {/*<div className={classes.flexContainer}>*/}\n {/* <Typography className={classes.titleText}>Choices</Typography>*/}\n {/*<Tooltip*/}\n {/* classes={{tooltip: classes.tooltip}}*/}\n {/* disableFocusListener*/}\n {/* disableTouchListener*/}\n {/* placement={'right'}*/}\n {/* title={'Validation requirements:\\nThere should at least two answer choices, non-blank and unique.\\nA correct answer must be defined.'}*/}\n {/*>*/}\n {/* <Info fontSize={'small'} color={'primary'}/>*/}\n {/*</Tooltip>*/}\n {/*</div>*/}\n {/*{correctResponseError && <div className={classes.errorText}>{correctResponseError}</div>}*/}\n {/*{answerChoicesError && <div className={classes.errorText}>{answerChoicesError}</div>}*/}\n {choices.map((choice, index) => (\n <div\n key={`choice-${index}`}\n className={classes.choiceConfigurationHolder}\n >\n <ChoiceConfiguration\n key={index}\n index={index + 1}\n useLetterOrdering={model.choicePrefix === 'letters'}\n className={classes.choiceConfiguration}\n mode={model.choiceMode}\n data={choice}\n defaultFeedback={{}}\n imageSupport={imageSupport}\n onDelete={() => onRemoveChoice(index)}\n onChange={(c) => onChoiceChanged(index, c)}\n allowFeedBack={feedbackEnabled}\n allowDelete={deleteChoice.settings}\n noLabels\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n // error={choicesErrors && choicesErrors[choice.value] ? choicesErrors[choice.value] : null}\n // noCorrectAnswerError={correctResponseError}\n />\n {rationaleEnabled && (\n <InputContainer\n key={`rationale-${index}`}\n label={rationale.label}\n className={classes.rationaleHolder}\n >\n <EditableHtml\n className={classes.rationale}\n markup={choice.rationale || ''}\n onChange={(c) =>\n onChoiceChanged(index, {\n ...choice,\n rationale: c,\n })\n }\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n pluginProps={labelPlugins}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n {accessibilityLabelsEnabled && (\n <InputContainer\n key={`accessibility-${index}`}\n label={accessibility.label}\n className={classes.accessibilityHolder}\n >\n <EditableHtml\n className={classes.accessibility}\n markup={choice.accessibility || ''}\n onChange={(c) =>\n onChoiceChanged(index, {\n ...choice,\n accessibility: c,\n })\n }\n imageSupport={imageSupport}\n pluginProps={labelPlugins}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n </div>\n ))}\n <br />\n {addChoiceButton.settings && (\n <Tooltip\n title={\n maxAnswerChoices && model.choices.length >= maxAnswerChoices\n ? `Only ${maxAnswerChoices} allowed maximum`\n : ''\n }\n classes={{ tooltip: classes.tooltip }}\n >\n <Button\n classes={{\n root:\n maxAnswerChoices && model.choices.length >= maxAnswerChoices\n ? classes.disableButton\n : undefined,\n }}\n className={classes.addButton}\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n >\n {addChoiceButton.label}\n </Button>\n </Tooltip>\n )}\n </div>\n );\n\n const settingsInPanel = {\n choiceMode:\n choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),\n 'sequentialChoiceLabels.enabled':\n sequentialChoiceLabels.settings &&\n toggle(sequentialChoiceLabels.label, true),\n choicePrefix:\n choicePrefix.settings &&\n radio(choicePrefix.label, ['numbers', 'letters']),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n choicesLayout:\n choicesLayout.settings &&\n dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),\n gridColumns:\n choicesLayout.settings &&\n model.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.length > 0 &&\n dropdown(gridColumns.label, nrOfColumnsAvailable),\n };\n\n return (\n <div className={classes.design}>\n {settingsPanelDisabled ? (\n Content\n ) : (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n onChangeModel={onChangeModel}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: settingsInPanel,\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n studentInstructionsEnabled:\n studentInstructions.settings &&\n toggle(studentInstructions.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n rationaleEnabled:\n rationale.settings && toggle(rationale.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n accessibilityLabelsEnabled:\n accessibility.settings && toggle(accessibility.label),\n scoringType:\n scoringType.settings &&\n radio(scoringType.label, ['auto', 'rubric']),\n },\n }}\n />\n }\n >\n {Content}\n </layout.ConfigLayout>\n )}\n </div>\n );\n});\n\nconst InfoDialog = ({ open, onCancel, onOk, title }) => (\n <Dialog open={open}>\n <DialogTitle>{title}</DialogTitle>\n <DialogActions>\n {onOk && (\n <Button onClick={onOk} color=\"primary\">\n OK\n </Button>\n )}\n {onCancel && (\n <Button onClick={onCancel} color=\"primary\">\n Cancel\n </Button>\n )}\n </DialogActions>\n </Dialog>\n);\n\nInfoDialog.propTypes = {\n open: PropTypes.bool,\n onCancel: PropTypes.func,\n onOk: PropTypes.func,\n title: PropTypes.string,\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n };\n\n state = {\n dialog: {\n open: false,\n },\n };\n\n onRemoveChoice = (index) => {\n const { model, configuration } = this.props;\n const { minAnswerChoices } = configuration || {};\n\n if (minAnswerChoices && model.choices.length === minAnswerChoices) {\n this.setState({\n dialog: {\n open: true,\n message: `There can't be less than ${minAnswerChoices} choices.`,\n onOk: () => {\n this.setState({\n dialog: {\n open: false,\n },\n });\n },\n onCancel: () =>\n this.setState({\n dialog: {\n open: false,\n },\n }),\n },\n });\n } else {\n model.choices.splice(index, 1);\n this.props.onModelChanged(model);\n }\n };\n\n onAddChoice = () => {\n const { model, configuration } = this.props;\n let { maxAnswerChoices } = configuration || {};\n const { limitChoicesNumber } = model || {};\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n if (maxAnswerChoices && model.choices.length === maxAnswerChoices) {\n this.setState({\n dialog: {\n open: true,\n message: `There can't be more than ${maxAnswerChoices} choices.`,\n onOk: () => {\n this.setState({\n dialog: {\n open: false,\n },\n });\n },\n onCancel: () =>\n this.setState({\n dialog: {\n open: false,\n },\n }),\n },\n });\n } else {\n model.choices.push({\n label: '',\n value: utils.firstAvailableIndex(\n model.choices.map((c) => c.value),\n 0\n ),\n feedback: {\n type: 'none',\n },\n });\n\n this.props.onModelChanged(model);\n }\n };\n\n onChoiceChanged = (index, choice) => {\n const { model } = this.props;\n\n if (choice.correct && model.choiceMode === 'radio') {\n model.choices = model.choices.map((c) => {\n return merge({}, c, { correct: false });\n });\n }\n\n model.choices.splice(index, 1, choice);\n this.props.onModelChanged(model);\n };\n\n onPromptChanged = (prompt) => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt,\n });\n };\n\n onTeacherInstructionsChanged = (teacherInstructions) => {\n this.props.onModelChanged({\n ...this.props.model,\n teacherInstructions,\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n switch (key) {\n case 'choiceMode': {\n let value = model.choiceMode;\n\n if (value === 'radio') {\n let correctFound = false;\n\n model.choices = model.choices.map((c) => {\n if (correctFound) {\n c.correct = false;\n return c;\n }\n\n if (c.correct) {\n correctFound = true;\n }\n return c;\n });\n }\n onModelChanged(model, true);\n break;\n }\n default:\n onModelChanged(model);\n break;\n }\n };\n\n render() {\n const { dialog } = this.state;\n\n return (\n <>\n <InfoDialog\n open={dialog.open}\n title={dialog.message}\n onCancel={dialog.onCancel}\n onOk={dialog.onOk}\n />\n <Design\n {...this.props}\n onChangeModel={this.onModelChanged}\n onRemoveChoice={this.onRemoveChoice}\n onChoiceChanged={this.onChoiceChanged}\n onAddChoice={this.onAddChoice}\n onPromptChanged={this.onPromptChanged}\n onTeacherInstructionsChanged={this.onTeacherInstructionsChanged}\n />\n </>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
|
package/configure/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multiple-choice-configure",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.7",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"@material-ui/core": "^3.9.2",
|
|
9
9
|
"@material-ui/icons": "^3.0.1",
|
|
10
10
|
"@pie-framework/pie-configure-events": "^1.2.0",
|
|
11
|
-
"@pie-lib/config-ui": "^10.
|
|
12
|
-
"@pie-lib/editable-html": "^7.
|
|
13
|
-
"@pie-lib/scoring-config": "^3.5.
|
|
11
|
+
"@pie-lib/config-ui": "^10.11.0",
|
|
12
|
+
"@pie-lib/editable-html": "^7.20.0",
|
|
13
|
+
"@pie-lib/scoring-config": "^3.5.154",
|
|
14
14
|
"debug": "^3.1.0",
|
|
15
15
|
"lodash": "^4.17.15",
|
|
16
16
|
"prop-types": "^15.6.2",
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.5.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@3.5.4...@pie-element/multiple-choice-controller@3.5.5) (2022-04-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-controller
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [3.5.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@3.4.1...@pie-element/multiple-choice-controller@3.5.1) (2021-11-11)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/multiple-choice-controller
|
package/controller/lib/index.js
CHANGED
|
@@ -5,13 +5,18 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
exports.createCorrectResponseSession = void 0;
|
|
8
9
|
exports.createDefaultModel = createDefaultModel;
|
|
10
|
+
exports.getScore = void 0;
|
|
9
11
|
exports.model = model;
|
|
12
|
+
exports.normalize = void 0;
|
|
10
13
|
exports.outcome = outcome;
|
|
11
|
-
exports.
|
|
14
|
+
exports.validate = void 0;
|
|
12
15
|
|
|
13
16
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
14
17
|
|
|
18
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
19
|
+
|
|
15
20
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
16
21
|
|
|
17
22
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -28,9 +33,9 @@ var _controllerUtils = require("@pie-lib/controller-utils");
|
|
|
28
33
|
|
|
29
34
|
var _excluded = ["verticalMode", "choicesLayout"];
|
|
30
35
|
|
|
31
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
36
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
32
37
|
|
|
33
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
38
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
34
39
|
|
|
35
40
|
var prepareChoice = function prepareChoice(model, env, defaultFeedback) {
|
|
36
41
|
return function (choice) {
|
|
@@ -244,4 +249,57 @@ var createCorrectResponseSession = function createCorrectResponseSession(questio
|
|
|
244
249
|
};
|
|
245
250
|
|
|
246
251
|
exports.createCorrectResponseSession = createCorrectResponseSession;
|
|
252
|
+
|
|
253
|
+
var validate = function validate() {
|
|
254
|
+
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
255
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
256
|
+
var choices = model.choices;
|
|
257
|
+
var _config$minAnswerChoi = config.minAnswerChoices,
|
|
258
|
+
minAnswerChoices = _config$minAnswerChoi === void 0 ? 2 : _config$minAnswerChoi,
|
|
259
|
+
maxAnswerChoices = config.maxAnswerChoices;
|
|
260
|
+
var reversedChoices = (0, _toConsumableArray2["default"])(choices || []).reverse();
|
|
261
|
+
var choicesErrors = {};
|
|
262
|
+
var hasCorrectResponse = false;
|
|
263
|
+
reversedChoices.forEach(function (choice, index) {
|
|
264
|
+
var correct = choice.correct,
|
|
265
|
+
value = choice.value,
|
|
266
|
+
label = choice.label;
|
|
267
|
+
|
|
268
|
+
if (correct) {
|
|
269
|
+
hasCorrectResponse = true;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (label === '' || label === '<div></div>') {
|
|
273
|
+
choicesErrors[value] = 'Content should not be empty.';
|
|
274
|
+
} else {
|
|
275
|
+
var identicalAnswer = reversedChoices.slice(index + 1).some(function (c) {
|
|
276
|
+
return c.label === label;
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
if (identicalAnswer) {
|
|
280
|
+
choicesErrors[value] = 'Content should be unique.';
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
var errors = {};
|
|
285
|
+
var nbOfChoices = (choices || []).length;
|
|
286
|
+
|
|
287
|
+
if (nbOfChoices < minAnswerChoices) {
|
|
288
|
+
errors.answerChoicesError = "Should be defined at least ".concat(minAnswerChoices, " choices.");
|
|
289
|
+
} else if (nbOfChoices > maxAnswerChoices) {
|
|
290
|
+
errors.answerChoicesError = "No more than ".concat(maxAnswerChoices, " choices should be defined.");
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (!hasCorrectResponse) {
|
|
294
|
+
errors.correctResponseError = 'No correct response defined.';
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (!(0, _isEmpty["default"])(choicesErrors)) {
|
|
298
|
+
errors.choicesErrors = choicesErrors;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return errors;
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
exports.validate = validate;
|
|
247
305
|
//# sourceMappingURL=index.js.map
|
|
@@ -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","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"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,EAAQC,GAAR,EAAaC,eAAb;AAAA,SAAiC,UAAAC,MAAM,EAAI;AAC/D,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;;AAED,QAAIP,IAAI,KAAK,UAAb,EAAyB;AACvBC,MAAAA,GAAG,CAACQ,OAAJ,GAAc,CAAC,CAACX,MAAM,CAACW,OAAvB;;AAEA,UAAId,KAAK,CAACe,eAAV,EAA2B;AACzB,YAAMC,YAAY,GAAIb,MAAM,CAACc,QAAP,IAAmBd,MAAM,CAACc,QAAP,CAAgBC,IAApC,IAA6C,MAAlE;;AAEA,YAAIF,YAAY,KAAK,SAArB,EAAgC;AAC9BV,UAAAA,GAAG,CAACW,QAAJ,GAAef,eAAe,CAACC,MAA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C;AAAA,iBAAIA,CAAC,CAAC9D,KAAN;AAAA,SAApC;AAFD,OAAD,CAAP;AAID,KAPD,MAOO;AACLa,MAAAA,OAAO,CAAC,IAAD,CAAP;AACD;AACF,GAXM,CAAP;AAYD,CAbM","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/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(\n prepareChoice(normalizedQuestion, env, defaultFeedback)\n );\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(\n choices,\n session,\n updateSession,\n 'value'\n );\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:\n env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined\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\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((acc, selectedChoice) =>\n acc + (correctChoices.find(ch => ch.value === selectedChoice) ? 1 : 0), 0);\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 =\n 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"],"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","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","validate","minAnswerChoices","maxAnswerChoices","reversedChoices","reverse","choicesErrors","hasCorrectResponse","forEach","index","identicalAnswer","slice","some","errors","nbOfChoices","answerChoicesError","correctResponseError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,EAAQC,GAAR,EAAaC,eAAb;AAAA,SAAiC,UAAAC,MAAM,EAAI;AAC/D,eAAuBF,GAAG,IAAI,EAA9B;AAAA,QAAQG,IAAR,QAAQA,IAAR;AAAA,QAAcC,IAAd,QAAcA,IAAd;;AACA,QAAMC,GAAG,GAAG;AACVC,MA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AM,CAACE,kBAAP,0BAA4CZ,gBAA5C;AACD;;AAED,MAAI,CAACI,kBAAL,EAAyB;AACvBM,IAAAA,MAAM,CAACG,oBAAP,GAA8B,8BAA9B;AACD;;AAED,MAAI,CAAC,yBAAQV,aAAR,CAAL,EAA6B;AAC3BO,IAAAA,MAAM,CAACP,aAAP,GAAuBA,aAAvB;AACD;;AAED,SAAOO,MAAP;AACD,CA3CM","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/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(\n prepareChoice(normalizedQuestion, env, defaultFeedback)\n );\n\n const lockChoiceOrder = lockChoices(normalizedQuestion, session, env);\n\n if (!lockChoiceOrder) {\n choices = await getShuffledChoices(\n choices,\n session,\n updateSession,\n 'value'\n );\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:\n env.mode === 'evaluate' ? isResponseCorrect(normalizedQuestion, session) : undefined\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\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((acc, selectedChoice) =>\n acc + (correctChoices.find(ch => ch.value === selectedChoice) ? 1 : 0), 0);\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 =\n 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\nexport const validate = (model = {}, config = {}) => {\n const { choices } = model;\n const { minAnswerChoices = 2, maxAnswerChoices } = config;\n const reversedChoices = [...choices || []].reverse();\n const choicesErrors = {};\n let hasCorrectResponse = false;\n\n reversedChoices.forEach((choice, index) => {\n const { correct, value, label } = choice;\n\n if (correct) {\n hasCorrectResponse = true;\n }\n\n if (label === '' || label === '<div></div>') {\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\n const errors = {};\n const nbOfChoices = (choices || []).length;\n\n if (nbOfChoices < minAnswerChoices) {\n errors.answerChoicesError = `Should be defined at least ${minAnswerChoices} choices.`;\n } else if (nbOfChoices > maxAnswerChoices) {\n errors.answerChoicesError = `No more than ${maxAnswerChoices} choices should be defined.`;\n }\n\n if (!hasCorrectResponse) {\n errors.correctResponseError = 'No correct response defined.';\n }\n\n if (!isEmpty(choicesErrors)) {\n errors.choicesErrors = choicesErrors;\n }\n\n return errors;\n};\n"],"file":"index.js"}
|
package/controller/package.json
CHANGED
package/docs/config-schema.json
CHANGED
|
@@ -106,6 +106,22 @@
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
},
|
|
109
|
+
"spellCheck": {
|
|
110
|
+
"title": "ConfigureProp",
|
|
111
|
+
"type": "object",
|
|
112
|
+
"properties": {
|
|
113
|
+
"settings": {
|
|
114
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
115
|
+
"type": "boolean",
|
|
116
|
+
"title": "settings"
|
|
117
|
+
},
|
|
118
|
+
"label": {
|
|
119
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
120
|
+
"type": "string",
|
|
121
|
+
"title": "label"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
109
125
|
"choicesLayout": {
|
|
110
126
|
"title": "ConfigureProp",
|
|
111
127
|
"type": "object",
|
|
@@ -84,6 +84,18 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
84
84
|
|
|
85
85
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
86
86
|
|
|
87
|
+
# `spellCheck` (object)
|
|
88
|
+
|
|
89
|
+
Properties of the `spellCheck` object:
|
|
90
|
+
|
|
91
|
+
## `settings` (boolean)
|
|
92
|
+
|
|
93
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
94
|
+
|
|
95
|
+
## `label` (string)
|
|
96
|
+
|
|
97
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
98
|
+
|
|
87
99
|
# `choicesLayout` (object)
|
|
88
100
|
|
|
89
101
|
Properties of the `choicesLayout` object:
|
package/docs/pie-schema.json
CHANGED
|
@@ -163,6 +163,11 @@
|
|
|
163
163
|
"type": "boolean",
|
|
164
164
|
"title": "rationaleEnabled"
|
|
165
165
|
},
|
|
166
|
+
"spellCheckEnabled": {
|
|
167
|
+
"description": "Indicates if spellcheck is enabled for the author. Default value is true",
|
|
168
|
+
"type": "boolean",
|
|
169
|
+
"title": "spellCheckEnabled"
|
|
170
|
+
},
|
|
166
171
|
"studentInstructionsEnabled": {
|
|
167
172
|
"description": "Indicates if Student Instructions are enabled",
|
|
168
173
|
"type": "boolean",
|
|
@@ -196,6 +201,7 @@
|
|
|
196
201
|
"feedbackEnabled",
|
|
197
202
|
"id",
|
|
198
203
|
"rationaleEnabled",
|
|
204
|
+
"spellCheckEnabled",
|
|
199
205
|
"studentInstructionsEnabled",
|
|
200
206
|
"teacherInstructionsEnabled"
|
|
201
207
|
],
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -142,6 +142,10 @@ Indicates if feedback is enabled
|
|
|
142
142
|
|
|
143
143
|
Indicates if Rationale are enabled
|
|
144
144
|
|
|
145
|
+
# `spellCheckEnabled` (boolean, required)
|
|
146
|
+
|
|
147
|
+
Indicates if spellcheck is enabled for the author. Default value is true
|
|
148
|
+
|
|
145
149
|
# `studentInstructionsEnabled` (boolean, required)
|
|
146
150
|
|
|
147
151
|
Indicates if Student Instructions are enabled
|
package/lib/choice-input.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = exports.
|
|
8
|
+
exports["default"] = exports.StyledRadio = exports.StyledFormControlLabel = exports.StyledCheckbox = exports.ChoiceInput = void 0;
|
|
9
9
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
|
|
@@ -45,9 +45,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
45
45
|
|
|
46
46
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
47
|
|
|
48
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
48
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
49
49
|
|
|
50
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
50
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
51
51
|
|
|
52
52
|
var styleSheet = function styleSheet() {
|
|
53
53
|
return {
|
package/lib/choice.js
CHANGED
|
@@ -33,9 +33,9 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
33
33
|
|
|
34
34
|
var _choiceInput = _interopRequireDefault(require("./choice-input"));
|
|
35
35
|
|
|
36
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
36
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
37
37
|
|
|
38
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
38
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
39
39
|
|
|
40
40
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
41
41
|
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] =
|
|
8
|
+
exports.isComplete = exports["default"] = void 0;
|
|
9
9
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["log","isComplete","session","value","length","MultipleChoice","_model","_session","_rerender","element","React","createElement","Main","model","onChoiceChanged","_onChange","bind","ReactDOM","render","leading","trailing","_dispatchResponseChanged","event","CustomEvent","bubbles","composed","detail","complete","component","tagName","toLowerCase","dispatchEvent","_dispatchModelSet","hasModel","undefined","s","data","choiceMode","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,wBAAN,CAAZ;;AAEO,IAAMC,UAAU,GAAG,SAAbA,UAAa,CAAAC,OAAO;AAAA,SAAI,CAAC,EAAEA,OAAO,IAAIA,OAAO,CAACC,KAAnB,IAA4BD,OAAO,CAACC,KAAR,CAAcC,MAA5C,CAAL;AAAA,CAA1B;;;;IAEcC,c;;;;;AACnB,4BAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,IAAhB;AAEA,UAAKC,SAAL,GAAiB,0BACf,YAAM;AACJ,UAAI,MAAKF,MAAL,IAAe,MAAKC,QAAxB,EAAkC;AAChC,YAAIE,OAAO,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACtCC,UAAAA,KAAK,EAAE,MAAKP,MAD0B;AAEtCJ,UAAAA,OAAO,EAAE,MAAKK,QAFwB;AAGtCO,UAAAA,eAAe,EAAE,MAAKC,SAAL,CAAeC,IAAf;AAHqB,SAA1B,CAAd;;
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["log","isComplete","session","value","length","MultipleChoice","_model","_session","_rerender","element","React","createElement","Main","model","onChoiceChanged","_onChange","bind","ReactDOM","render","leading","trailing","_dispatchResponseChanged","event","CustomEvent","bubbles","composed","detail","complete","component","tagName","toLowerCase","dispatchEvent","_dispatchModelSet","hasModel","undefined","s","data","choiceMode","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,wBAAN,CAAZ;;AAEO,IAAMC,UAAU,GAAG,SAAbA,UAAa,CAAAC,OAAO;AAAA,SAAI,CAAC,EAAEA,OAAO,IAAIA,OAAO,CAACC,KAAnB,IAA4BD,OAAO,CAACC,KAAR,CAAcC,MAA5C,CAAL;AAAA,CAA1B;;;;IAEcC,c;;;;;AACnB,4BAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,IAAhB;AAEA,UAAKC,SAAL,GAAiB,0BACf,YAAM;AACJ,UAAI,MAAKF,MAAL,IAAe,MAAKC,QAAxB,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NG,UAAAA,QAAQ,EAAE,MAAK3B,MAAL,KAAgB4B;AAHpB;AAHmB,OAA7B,CADF;AAWD,KAbsB,EAcvB,EAduB,EAevB;AAAEf,MAAAA,OAAO,EAAE,KAAX;AAAkBC,MAAAA,QAAQ,EAAE;AAA5B,KAfuB,CAAzB;AAvCY;AAwDb;;;;SAED,aAAUe,CAAV,EAAa;AACX,WAAK7B,MAAL,GAAc6B,CAAd;;AACA,WAAK3B,SAAL;;AACA,WAAKwB,iBAAL;AACD;;;SAED,eAAc;AACZ,aAAO,KAAKzB,QAAZ;AACD,K;SAED,aAAY4B,CAAZ,EAAe;AACb,WAAK5B,QAAL,GAAgB4B,CAAhB;;AACA,WAAK3B,SAAL,GAFa,CAGb;;;AACA,WAAKa,wBAAL;AACD;;;WAED,mBAAUe,IAAV,EAAgB;AACd,8CAAmB,KAAK7B,QAAxB,EAAkC,KAAKD,MAAL,CAAY+B,UAA9C,EAA0DD,IAA1D;;AACA,WAAKf,wBAAL;;AACA,WAAKb,SAAL;AACD;;;WAED,6BAAoB;AAClB,WAAKA,SAAL;AACD;;;kDApFyC8B,W","sourcesContent":["import Main from './main';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport debounce from 'lodash/debounce';\nimport debug from 'debug';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { updateSessionValue } from './session-updater';\n\nconst log = debug('pie-ui:multiple-choice');\n\nexport const isComplete = session => !!(session && session.value && session.value.length);\n\nexport default class MultipleChoice extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n var element = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onChoiceChanged: this._onChange.bind(this)\n });\n\n ReactDOM.render(element, this, () => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true }\n );\n\n this._dispatchResponseChanged = debounce(() => {\n var event = new CustomEvent('session-changed', {\n bubbles: true,\n composed: true,\n detail: {\n complete: isComplete(this._session),\n component: this.tagName.toLowerCase()\n }\n });\n\n this.dispatchEvent(event);\n });\n\n this._dispatchModelSet = debounce(\n () => {\n this.dispatchEvent(\n new CustomEvent('model-set', {\n bubbles: true,\n composed: true,\n detail: {\n complete: isComplete(this._session),\n component: this.tagName.toLowerCase(),\n hasModel: this._model !== undefined\n }\n })\n );\n },\n 50,\n { leading: false, trailing: true }\n );\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n this._dispatchModelSet();\n }\n\n get session() {\n return this._session;\n }\n\n set session(s) {\n this._session = s;\n this._rerender();\n //TODO: remove this session-changed should only be emit on user change\n this._dispatchResponseChanged();\n }\n\n _onChange(data) {\n updateSessionValue(this._session, this._model.choiceMode, data);\n this._dispatchResponseChanged();\n this._rerender();\n }\n\n connectedCallback() {\n this._rerender();\n }\n}\n"],"file":"index.js"}
|
package/module/configure.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_lodash, _dll_pie_lib__render_ui, _dll_debug, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.
|
|
2
|
-
import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.
|
|
3
|
-
import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.2.
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_lodash, _dll_pie_lib__render_ui, _dll_debug, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.10/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.33/module/index.js";
|
|
3
|
+
import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.2.9/module/index.js";
|
|
4
4
|
var lib = {};
|
|
5
5
|
Object.defineProperty(lib, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -117,13 +117,35 @@ const styles = theme => ({
|
|
|
117
117
|
'&:focus': {
|
|
118
118
|
backgroundColor: color.disabled()
|
|
119
119
|
}
|
|
120
|
+
},
|
|
121
|
+
flexContainer: {
|
|
122
|
+
display: 'flex',
|
|
123
|
+
alignItems: 'center'
|
|
124
|
+
},
|
|
125
|
+
titleText: {
|
|
126
|
+
fontFamily: 'Cerebri Sans',
|
|
127
|
+
fontSize: '18px',
|
|
128
|
+
lineHeight: '19px',
|
|
129
|
+
color: '#495B8F',
|
|
130
|
+
marginRight: '5px',
|
|
131
|
+
marginBottom: '5px'
|
|
132
|
+
},
|
|
133
|
+
tooltip: {
|
|
134
|
+
fontSize: '12px',
|
|
135
|
+
whiteSpace: 'pre',
|
|
136
|
+
maxWidth: '500px'
|
|
137
|
+
},
|
|
138
|
+
errorText: {
|
|
139
|
+
fontSize: '12px',
|
|
140
|
+
color: 'red',
|
|
141
|
+
paddingTop: '5px'
|
|
120
142
|
}
|
|
121
143
|
});
|
|
122
144
|
const Design = withStyles(styles)(props => {
|
|
123
145
|
const {classes, model, configuration, onPromptChanged, onChoiceChanged, onRemoveChoice, onAddChoice, imageSupport, onChangeModel, onConfigurationChanged, onTeacherInstructionsChanged} = props;
|
|
124
|
-
const {prompt = {}, addChoiceButton = {}, feedback = {}, deleteChoice = {}, choiceMode = {}, choicePrefix = {}, partialScoring = {}, lockChoiceOrder = {}, teacherInstructions = {}, studentInstructions = {}, rationale = {}, accessibility = {}, scoringType = {}, sequentialChoiceLabels = {}, settingsPanelDisabled, choicesLayout, gridColumns} = configuration || ({});
|
|
146
|
+
const {prompt = {}, addChoiceButton = {}, feedback = {}, deleteChoice = {}, choiceMode = {}, choicePrefix = {}, partialScoring = {}, lockChoiceOrder = {}, teacherInstructions = {}, studentInstructions = {}, rationale = {}, accessibility = {}, scoringType = {}, sequentialChoiceLabels = {}, settingsPanelDisabled, choicesLayout, spellCheck = {}, gridColumns} = configuration || ({});
|
|
125
147
|
let {maxAnswerChoices} = configuration || ({});
|
|
126
|
-
const {limitChoicesNumber, teacherInstructionsEnabled, rationaleEnabled, accessibilityLabelsEnabled, feedbackEnabled, promptEnabled, choices} = model || ({});
|
|
148
|
+
const {limitChoicesNumber, teacherInstructionsEnabled, rationaleEnabled, accessibilityLabelsEnabled, feedbackEnabled, promptEnabled, spellCheckEnabled, choices} = model || ({});
|
|
127
149
|
const nrOfColumnsAvailable = choices && choices.length ? Array.from({
|
|
128
150
|
length: choices.length
|
|
129
151
|
}, (_, i) => `${i + 1}`) : [];
|
|
@@ -151,7 +173,7 @@ const Design = withStyles(styles)(props => {
|
|
|
151
173
|
__self: undefined,
|
|
152
174
|
__source: {
|
|
153
175
|
fileName: _jsxFileName,
|
|
154
|
-
lineNumber:
|
|
176
|
+
lineNumber: 178
|
|
155
177
|
}
|
|
156
178
|
}, teacherInstructionsEnabled && React$1.createElement(InputContainer, {
|
|
157
179
|
label: teacherInstructions.label,
|
|
@@ -159,7 +181,7 @@ const Design = withStyles(styles)(props => {
|
|
|
159
181
|
__self: undefined,
|
|
160
182
|
__source: {
|
|
161
183
|
fileName: _jsxFileName,
|
|
162
|
-
lineNumber:
|
|
184
|
+
lineNumber: 180
|
|
163
185
|
}
|
|
164
186
|
}, React$1.createElement(EditableHtml, {
|
|
165
187
|
className: classes.prompt,
|
|
@@ -168,10 +190,11 @@ const Design = withStyles(styles)(props => {
|
|
|
168
190
|
imageSupport: imageSupport,
|
|
169
191
|
nonEmpty: false,
|
|
170
192
|
toolbarOpts: toolbarOpts,
|
|
193
|
+
spellCheck: spellCheckEnabled,
|
|
171
194
|
__self: undefined,
|
|
172
195
|
__source: {
|
|
173
196
|
fileName: _jsxFileName,
|
|
174
|
-
lineNumber:
|
|
197
|
+
lineNumber: 184
|
|
175
198
|
}
|
|
176
199
|
})), promptEnabled && React$1.createElement(InputContainer, {
|
|
177
200
|
label: prompt.label,
|
|
@@ -179,7 +202,7 @@ const Design = withStyles(styles)(props => {
|
|
|
179
202
|
__self: undefined,
|
|
180
203
|
__source: {
|
|
181
204
|
fileName: _jsxFileName,
|
|
182
|
-
lineNumber:
|
|
205
|
+
lineNumber: 197
|
|
183
206
|
}
|
|
184
207
|
}, React$1.createElement(EditableHtml, {
|
|
185
208
|
className: classes.prompt,
|
|
@@ -189,18 +212,19 @@ const Design = withStyles(styles)(props => {
|
|
|
189
212
|
nonEmpty: false,
|
|
190
213
|
disableUnderline: true,
|
|
191
214
|
toolbarOpts: toolbarOpts,
|
|
215
|
+
spellCheck: spellCheckEnabled,
|
|
192
216
|
__self: undefined,
|
|
193
217
|
__source: {
|
|
194
218
|
fileName: _jsxFileName,
|
|
195
|
-
lineNumber:
|
|
219
|
+
lineNumber: 198
|
|
196
220
|
}
|
|
197
|
-
})),
|
|
221
|
+
})), choices.map((choice, index) => React$1.createElement('div', {
|
|
198
222
|
key: `choice-${index}`,
|
|
199
223
|
className: classes.choiceConfigurationHolder,
|
|
200
224
|
__self: undefined,
|
|
201
225
|
__source: {
|
|
202
226
|
fileName: _jsxFileName,
|
|
203
|
-
lineNumber:
|
|
227
|
+
lineNumber: 225
|
|
204
228
|
}
|
|
205
229
|
}, React$1.createElement(ChoiceConfiguration, {
|
|
206
230
|
key: index,
|
|
@@ -217,10 +241,11 @@ const Design = withStyles(styles)(props => {
|
|
|
217
241
|
allowDelete: deleteChoice.settings,
|
|
218
242
|
noLabels: true,
|
|
219
243
|
toolbarOpts: toolbarOpts,
|
|
244
|
+
spellCheck: spellCheckEnabled,
|
|
220
245
|
__self: undefined,
|
|
221
246
|
__source: {
|
|
222
247
|
fileName: _jsxFileName,
|
|
223
|
-
lineNumber:
|
|
248
|
+
lineNumber: 229
|
|
224
249
|
}
|
|
225
250
|
}), rationaleEnabled && React$1.createElement(InputContainer, {
|
|
226
251
|
key: `rationale-${index}`,
|
|
@@ -229,7 +254,7 @@ const Design = withStyles(styles)(props => {
|
|
|
229
254
|
__self: undefined,
|
|
230
255
|
__source: {
|
|
231
256
|
fileName: _jsxFileName,
|
|
232
|
-
lineNumber:
|
|
257
|
+
lineNumber: 249
|
|
233
258
|
}
|
|
234
259
|
}, React$1.createElement(EditableHtml, {
|
|
235
260
|
className: classes.rationale,
|
|
@@ -241,10 +266,11 @@ const Design = withStyles(styles)(props => {
|
|
|
241
266
|
imageSupport: imageSupport,
|
|
242
267
|
toolbarOpts: toolbarOpts,
|
|
243
268
|
pluginProps: labelPlugins,
|
|
269
|
+
spellCheck: spellCheckEnabled,
|
|
244
270
|
__self: undefined,
|
|
245
271
|
__source: {
|
|
246
272
|
fileName: _jsxFileName,
|
|
247
|
-
lineNumber:
|
|
273
|
+
lineNumber: 254
|
|
248
274
|
}
|
|
249
275
|
})), accessibilityLabelsEnabled && React$1.createElement(InputContainer, {
|
|
250
276
|
key: `accessibility-${index}`,
|
|
@@ -253,7 +279,7 @@ const Design = withStyles(styles)(props => {
|
|
|
253
279
|
__self: undefined,
|
|
254
280
|
__source: {
|
|
255
281
|
fileName: _jsxFileName,
|
|
256
|
-
lineNumber:
|
|
282
|
+
lineNumber: 271
|
|
257
283
|
}
|
|
258
284
|
}, React$1.createElement(EditableHtml, {
|
|
259
285
|
className: classes.accessibility,
|
|
@@ -264,16 +290,17 @@ const Design = withStyles(styles)(props => {
|
|
|
264
290
|
}),
|
|
265
291
|
imageSupport: imageSupport,
|
|
266
292
|
pluginProps: labelPlugins,
|
|
293
|
+
spellCheck: spellCheckEnabled,
|
|
267
294
|
__self: undefined,
|
|
268
295
|
__source: {
|
|
269
296
|
fileName: _jsxFileName,
|
|
270
|
-
lineNumber:
|
|
297
|
+
lineNumber: 276
|
|
271
298
|
}
|
|
272
299
|
})))), React$1.createElement('br', {
|
|
273
300
|
__self: undefined,
|
|
274
301
|
__source: {
|
|
275
302
|
fileName: _jsxFileName,
|
|
276
|
-
lineNumber:
|
|
303
|
+
lineNumber: 293
|
|
277
304
|
}
|
|
278
305
|
}), addChoiceButton.settings && React$1.createElement(Tooltip, {
|
|
279
306
|
title: maxAnswerChoices && model.choices.length >= maxAnswerChoices ? `Only ${maxAnswerChoices} allowed maximum` : '',
|
|
@@ -283,7 +310,7 @@ const Design = withStyles(styles)(props => {
|
|
|
283
310
|
__self: undefined,
|
|
284
311
|
__source: {
|
|
285
312
|
fileName: _jsxFileName,
|
|
286
|
-
lineNumber:
|
|
313
|
+
lineNumber: 295
|
|
287
314
|
}
|
|
288
315
|
}, React$1.createElement(Button, {
|
|
289
316
|
classes: {
|
|
@@ -296,7 +323,7 @@ const Design = withStyles(styles)(props => {
|
|
|
296
323
|
__self: undefined,
|
|
297
324
|
__source: {
|
|
298
325
|
fileName: _jsxFileName,
|
|
299
|
-
lineNumber:
|
|
326
|
+
lineNumber: 303
|
|
300
327
|
}
|
|
301
328
|
}, addChoiceButton.label)));
|
|
302
329
|
const settingsInPanel = {
|
|
@@ -314,7 +341,7 @@ const Design = withStyles(styles)(props => {
|
|
|
314
341
|
__self: undefined,
|
|
315
342
|
__source: {
|
|
316
343
|
fileName: _jsxFileName,
|
|
317
|
-
lineNumber:
|
|
344
|
+
lineNumber: 345
|
|
318
345
|
}
|
|
319
346
|
}, settingsPanelDisabled ? Content : React$1.createElement(layout.ConfigLayout, {
|
|
320
347
|
settings: React$1.createElement(Panel, {
|
|
@@ -329,6 +356,7 @@ const Design = withStyles(styles)(props => {
|
|
|
329
356
|
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
330
357
|
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
331
358
|
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
359
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
332
360
|
accessibilityLabelsEnabled: accessibility.settings && toggle(accessibility.label),
|
|
333
361
|
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric'])
|
|
334
362
|
}
|
|
@@ -336,13 +364,13 @@ const Design = withStyles(styles)(props => {
|
|
|
336
364
|
__self: undefined,
|
|
337
365
|
__source: {
|
|
338
366
|
fileName: _jsxFileName,
|
|
339
|
-
lineNumber:
|
|
367
|
+
lineNumber: 351
|
|
340
368
|
}
|
|
341
369
|
}),
|
|
342
370
|
__self: undefined,
|
|
343
371
|
__source: {
|
|
344
372
|
fileName: _jsxFileName,
|
|
345
|
-
lineNumber:
|
|
373
|
+
lineNumber: 349
|
|
346
374
|
}
|
|
347
375
|
}, Content));
|
|
348
376
|
});
|
|
@@ -351,19 +379,19 @@ const InfoDialog = ({open, onCancel, onOk, title}) => React$1.createElement(Dial
|
|
|
351
379
|
__self: undefined,
|
|
352
380
|
__source: {
|
|
353
381
|
fileName: _jsxFileName,
|
|
354
|
-
lineNumber:
|
|
382
|
+
lineNumber: 388
|
|
355
383
|
}
|
|
356
384
|
}, React$1.createElement(DialogTitle, {
|
|
357
385
|
__self: undefined,
|
|
358
386
|
__source: {
|
|
359
387
|
fileName: _jsxFileName,
|
|
360
|
-
lineNumber:
|
|
388
|
+
lineNumber: 389
|
|
361
389
|
}
|
|
362
390
|
}, title), React$1.createElement(DialogActions, {
|
|
363
391
|
__self: undefined,
|
|
364
392
|
__source: {
|
|
365
393
|
fileName: _jsxFileName,
|
|
366
|
-
lineNumber:
|
|
394
|
+
lineNumber: 390
|
|
367
395
|
}
|
|
368
396
|
}, onOk && React$1.createElement(Button, {
|
|
369
397
|
onClick: onOk,
|
|
@@ -371,7 +399,7 @@ const InfoDialog = ({open, onCancel, onOk, title}) => React$1.createElement(Dial
|
|
|
371
399
|
__self: undefined,
|
|
372
400
|
__source: {
|
|
373
401
|
fileName: _jsxFileName,
|
|
374
|
-
lineNumber:
|
|
402
|
+
lineNumber: 392
|
|
375
403
|
}
|
|
376
404
|
}, "OK"), onCancel && React$1.createElement(Button, {
|
|
377
405
|
onClick: onCancel,
|
|
@@ -379,7 +407,7 @@ const InfoDialog = ({open, onCancel, onOk, title}) => React$1.createElement(Dial
|
|
|
379
407
|
__self: undefined,
|
|
380
408
|
__source: {
|
|
381
409
|
fileName: _jsxFileName,
|
|
382
|
-
lineNumber:
|
|
410
|
+
lineNumber: 397
|
|
383
411
|
}
|
|
384
412
|
}, "Cancel")));
|
|
385
413
|
InfoDialog.propTypes = {
|
|
@@ -557,7 +585,7 @@ class Main extends React$1.Component {
|
|
|
557
585
|
__self: this,
|
|
558
586
|
__source: {
|
|
559
587
|
fileName: _jsxFileName,
|
|
560
|
-
lineNumber:
|
|
588
|
+
lineNumber: 571
|
|
561
589
|
}
|
|
562
590
|
}), React$1.createElement(Design, {
|
|
563
591
|
...this.props,
|
|
@@ -570,7 +598,7 @@ class Main extends React$1.Component {
|
|
|
570
598
|
__self: this,
|
|
571
599
|
__source: {
|
|
572
600
|
fileName: _jsxFileName,
|
|
573
|
-
lineNumber:
|
|
601
|
+
lineNumber: 577
|
|
574
602
|
}
|
|
575
603
|
}));
|
|
576
604
|
}
|
|
@@ -596,6 +624,11 @@ var sensibleDefaults = {
|
|
|
596
624
|
gridColumns: '2'
|
|
597
625
|
},
|
|
598
626
|
configuration: {
|
|
627
|
+
spellCheck: {
|
|
628
|
+
label: 'Spellcheck',
|
|
629
|
+
settings: false,
|
|
630
|
+
enabled: true
|
|
631
|
+
},
|
|
599
632
|
choicesLayout: {
|
|
600
633
|
settings: false,
|
|
601
634
|
label: 'Choices Layout'
|
package/module/controller.js
CHANGED
|
@@ -20638,4 +20638,49 @@ const createCorrectResponseSession = (question, env) => {
|
|
|
20638
20638
|
});
|
|
20639
20639
|
};
|
|
20640
20640
|
|
|
20641
|
-
|
|
20641
|
+
const validate = (model = {}, config = {}) => {
|
|
20642
|
+
const { choices } = model;
|
|
20643
|
+
const { minAnswerChoices = 2, maxAnswerChoices } = config;
|
|
20644
|
+
const reversedChoices = [...choices || []].reverse();
|
|
20645
|
+
const choicesErrors = {};
|
|
20646
|
+
let hasCorrectResponse = false;
|
|
20647
|
+
|
|
20648
|
+
reversedChoices.forEach((choice, index) => {
|
|
20649
|
+
const { correct, value, label } = choice;
|
|
20650
|
+
|
|
20651
|
+
if (correct) {
|
|
20652
|
+
hasCorrectResponse = true;
|
|
20653
|
+
}
|
|
20654
|
+
|
|
20655
|
+
if (label === '' || label === '<div></div>') {
|
|
20656
|
+
choicesErrors[value] = 'Content should not be empty.';
|
|
20657
|
+
} else {
|
|
20658
|
+
const identicalAnswer = reversedChoices.slice(index + 1).some(c => c.label === label);
|
|
20659
|
+
|
|
20660
|
+
if (identicalAnswer) {
|
|
20661
|
+
choicesErrors[value] = 'Content should be unique.';
|
|
20662
|
+
}
|
|
20663
|
+
}
|
|
20664
|
+
});
|
|
20665
|
+
|
|
20666
|
+
const errors = {};
|
|
20667
|
+
const nbOfChoices = (choices || []).length;
|
|
20668
|
+
|
|
20669
|
+
if (nbOfChoices < minAnswerChoices) {
|
|
20670
|
+
errors.answerChoicesError = `Should be defined at least ${minAnswerChoices} choices.`;
|
|
20671
|
+
} else if (nbOfChoices > maxAnswerChoices) {
|
|
20672
|
+
errors.answerChoicesError = `No more than ${maxAnswerChoices} choices should be defined.`;
|
|
20673
|
+
}
|
|
20674
|
+
|
|
20675
|
+
if (!hasCorrectResponse) {
|
|
20676
|
+
errors.correctResponseError = 'No correct response defined.';
|
|
20677
|
+
}
|
|
20678
|
+
|
|
20679
|
+
if (!isEmpty_1(choicesErrors)) {
|
|
20680
|
+
errors.choicesErrors = choicesErrors;
|
|
20681
|
+
}
|
|
20682
|
+
|
|
20683
|
+
return errors;
|
|
20684
|
+
};
|
|
20685
|
+
|
|
20686
|
+
export { createCorrectResponseSession, createDefaultModel, getScore, model, normalize, outcome, validate };
|
package/module/element.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.
|
|
2
|
-
import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.
|
|
1
|
+
import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.10/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.35/module/index.js";
|
|
3
3
|
function getDefaultExportFromCjs(x) {
|
|
4
4
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
5
|
}
|
|
@@ -34,8 +34,7 @@ var interopRequireDefault = {
|
|
|
34
34
|
"default": obj
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
module.exports = _interopRequireDefault;
|
|
38
|
-
(module.exports["default"] = module.exports, module.exports.__esModule = true);
|
|
37
|
+
(module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
39
38
|
})(interopRequireDefault);
|
|
40
39
|
getDefaultExportFromCjs(interopRequireDefault.exports);
|
|
41
40
|
var hasClass = {
|
package/module/index.html
CHANGED
package/module/manifest.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multiple-choice",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.6",
|
|
4
4
|
"modules": [
|
|
5
5
|
{
|
|
6
6
|
"name": "@pie-lib/shared-module",
|
|
7
|
-
"version": "^1.4.
|
|
7
|
+
"version": "^1.4.10"
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"name": "@pie-lib/math-rendering-module",
|
|
11
|
-
"version": "^1.0.
|
|
11
|
+
"version": "^1.0.35"
|
|
12
12
|
}
|
|
13
13
|
]
|
|
14
14
|
}
|
package/module/print.html
CHANGED
package/module/print.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.
|
|
2
|
-
import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.
|
|
1
|
+
import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.10/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.35/module/index.js";
|
|
3
3
|
function getDefaultExportFromCjs(x) {
|
|
4
4
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
5
|
}
|
|
@@ -34,8 +34,7 @@ var interopRequireDefault = {
|
|
|
34
34
|
"default": obj
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
module.exports = _interopRequireDefault;
|
|
38
|
-
(module.exports["default"] = module.exports, module.exports.__esModule = true);
|
|
37
|
+
(module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports);
|
|
39
38
|
})(interopRequireDefault);
|
|
40
39
|
getDefaultExportFromCjs(interopRequireDefault.exports);
|
|
41
40
|
var hasClass = {
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multiple-choice",
|
|
3
3
|
"repository": "pie-framework/pie-elements",
|
|
4
|
-
"version": "6.2.
|
|
4
|
+
"version": "6.2.7",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@material-ui/core": "^3.9.2",
|
|
10
|
-
"@pie-lib/config-ui": "^10.
|
|
11
|
-
"@pie-lib/correct-answer-toggle": "^2.3.
|
|
12
|
-
"@pie-lib/math-rendering": "^2.3.
|
|
13
|
-
"@pie-lib/render-ui": "^4.12.
|
|
10
|
+
"@pie-lib/config-ui": "^10.11.0",
|
|
11
|
+
"@pie-lib/correct-answer-toggle": "^2.3.35",
|
|
12
|
+
"@pie-lib/math-rendering": "^2.3.13",
|
|
13
|
+
"@pie-lib/render-ui": "^4.12.5",
|
|
14
14
|
"classnames": "^2.2.5",
|
|
15
15
|
"debug": "^4.1.1",
|
|
16
16
|
"enzyme-to-json": "^3.3.3",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"react-test-renderer": "^16.3.2",
|
|
22
22
|
"react-transition-group": "^2.3.1"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "de8f41ecfc06944b7bc890a167f81818d2bf1845",
|
|
25
25
|
"scripts": {
|
|
26
26
|
"postpublish": "../../scripts/postpublish"
|
|
27
27
|
},
|