@pie-element/multiple-choice 5.8.0 → 5.8.1-beta.587
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 +529 -0
- package/PRINT.md +35 -0
- package/README.md +1 -1
- package/configure/CHANGELOG.md +468 -0
- package/configure/lib/defaults.js +39 -8
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +24 -5
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +290 -77
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/utils.js +18 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +5 -5
- package/controller/CHANGELOG.md +97 -0
- package/controller/lib/defaults.js +4 -2
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +85 -9
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +9 -1
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +2 -2
- package/docs/config-schema.json +158 -1
- package/docs/config-schema.json.md +123 -3
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +18 -11
- package/docs/demo/index.html +1 -1
- package/docs/demo/session.js +1 -1
- package/docs/pie-schema.json +69 -4
- package/docs/pie-schema.json.md +57 -2
- package/lib/choice-input.js +44 -20
- package/lib/choice-input.js.map +1 -1
- package/lib/choice.js +157 -0
- package/lib/choice.js.map +1 -0
- package/lib/feedback-tick.js +1 -1
- package/lib/feedback-tick.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/main.js +5 -2
- package/lib/main.js.map +1 -1
- package/lib/multiple-choice.js +85 -148
- package/lib/multiple-choice.js.map +1 -1
- package/lib/print.js +129 -0
- package/lib/print.js.map +1 -0
- package/lib/session-updater.js.map +1 -1
- package/package.json +12 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["log","generateFormattedChoices","choices","choiceCount","length","formattedChoices","i","push","value","label","feedback","type","prepareCustomizationObject","config","model","configuration","sensibleDefaults","answerChoiceCount","MultipleChoice","_model","createDefaultModel","_configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","info","_disableSidePanel","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","dispatchModelUpdated","handler","InsertImageEvent","src","done","DeleteImageEvent","element","React","createElement","Main","disableSidePanel","imageSupport","add","insertImage","onDeleteImage","ReactDOM","render","HTMLElement","utils","normalizeChoices"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["log","generateFormattedChoices","choices","choiceCount","length","formattedChoices","i","push","value","label","feedback","type","prepareCustomizationObject","config","model","configuration","sensibleDefaults","answerChoiceCount","MultipleChoice","_model","createDefaultModel","_configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","info","_disableSidePanel","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","dispatchModelUpdated","handler","InsertImageEvent","src","done","DeleteImageEvent","InsertSoundEvent","DeleteSoundEvent","element","React","createElement","Main","disableSidePanel","imageSupport","add","insertImage","onDeleteImage","uploadSoundSupport","insertSound","onDeleteSound","ReactDOM","render","HTMLElement","normalizedModel","utils","normalizeChoices","choicesLayout","verticalMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AAEA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,2BAAN,CAAZ;;AAEA,IAAMC,wBAAwB,GAAG,SAA3BA,wBAA2B,CAACC,OAAD,EAA8B;AAAA,MAApBC,WAAoB,uEAAN,CAAM;;AAC7D,MAAI,CAACD,OAAD,IAAYA,OAAO,CAACE,MAAR,KAAmB,CAAnC,EAAsC;AACpC,QAAIC,gBAAgB,GAAG,EAAvB;;AAEA,SAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,WAApB,EAAiCG,CAAC,EAAl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,\n InsertImageEvent,\n ModelUpdatedEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './main';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport defaults from 'lodash/defaults';\n\nimport sensibleDefaults from './defaults';\n\nconst log = debug('multiple-choice:configure');\n\nconst generateFormattedChoices = (choices, choiceCount = 0) => {\n if (!choices || choices.length === 0) {\n let formattedChoices = [];\n\n for (let i = 0; i < choiceCount; i++) {\n formattedChoices.push({\n value: `${i}`,\n label: '',\n feedback: {\n type: 'none',\n value: '',\n },\n });\n }\n\n return formattedChoices;\n }\n\n return choices;\n};\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n\n return {\n configuration,\n model: {\n ...model,\n choices: generateFormattedChoices(\n (model && model.choices) || [],\n configuration && configuration.answerChoiceCount,\n ),\n },\n };\n};\n\nexport default class MultipleChoice extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const normalizedModel = utils.normalizeChoices({\n ...sensibleDefaults.model,\n ...model,\n choices: generateFormattedChoices((model && model.choices) || []),\n });\n\n // This is used for offering support for old models which have the property \"verticalMode\"\n normalizedModel.choicesLayout =\n model.choicesLayout || (model.verticalMode === false && 'horizontal') || sensibleDefaults.model.choicesLayout;\n\n return normalizedModel;\n };\n\n constructor() {\n super();\n this._model = MultipleChoice.createDefaultModel();\n this._configuration = sensibleDefaults.configuration;\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(s) {\n this._model = MultipleChoice.createDefaultModel(s);\n\n this._render();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n this._configuration = info.configuration;\n this._render();\n }\n\n set disableSidePanel(s) {\n this._disableSidePanel = s;\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged(m, reset) {\n this._model = m;\n this._render();\n\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n this._configuration = prepareCustomizationObject(c, this._model).configuration;\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n }\n\n /** @param {done, progress, file} handler */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n _render() {\n log('_render');\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n disableSidePanel: this._disableSidePanel,\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}
|
package/configure/lib/main.js
CHANGED
|
@@ -37,21 +37,28 @@ var _styles = require("@material-ui/core/styles");
|
|
|
37
37
|
|
|
38
38
|
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
39
39
|
|
|
40
|
+
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
41
|
+
|
|
42
|
+
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
|
|
43
|
+
|
|
44
|
+
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
|
45
|
+
|
|
40
46
|
var _merge = _interopRequireDefault(require("lodash/merge"));
|
|
41
47
|
|
|
42
|
-
var
|
|
48
|
+
var _utils = require("./utils");
|
|
43
49
|
|
|
44
50
|
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); }; }
|
|
45
51
|
|
|
46
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
52
|
+
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
53
|
|
|
48
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
54
|
+
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
55
|
|
|
50
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
56
|
+
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
57
|
|
|
52
58
|
var Panel = _configUi.settings.Panel,
|
|
53
59
|
toggle = _configUi.settings.toggle,
|
|
54
|
-
radio = _configUi.settings.radio
|
|
60
|
+
radio = _configUi.settings.radio,
|
|
61
|
+
dropdown = _configUi.settings.dropdown;
|
|
55
62
|
var MAX_CHOICES = 9;
|
|
56
63
|
|
|
57
64
|
var styles = function styles(theme) {
|
|
@@ -68,11 +75,14 @@ var styles = function styles(theme) {
|
|
|
68
75
|
rationaleHolder: {
|
|
69
76
|
width: '70%'
|
|
70
77
|
},
|
|
78
|
+
accessibilityHolder: {
|
|
79
|
+
width: '70%'
|
|
80
|
+
},
|
|
71
81
|
rationale: {
|
|
72
82
|
paddingTop: theme.spacing.unit * 2
|
|
73
83
|
},
|
|
74
|
-
|
|
75
|
-
paddingTop: theme.spacing.unit *
|
|
84
|
+
accessibility: {
|
|
85
|
+
paddingTop: theme.spacing.unit * 2
|
|
76
86
|
},
|
|
77
87
|
choiceConfigurationHolder: {
|
|
78
88
|
display: 'flex',
|
|
@@ -89,6 +99,7 @@ var styles = function styles(theme) {
|
|
|
89
99
|
margin: 0
|
|
90
100
|
},
|
|
91
101
|
addButton: {
|
|
102
|
+
marginTop: theme.spacing.unit * 3,
|
|
92
103
|
"float": 'right'
|
|
93
104
|
},
|
|
94
105
|
disableButton: {
|
|
@@ -101,6 +112,28 @@ var styles = function styles(theme) {
|
|
|
101
112
|
'&:focus': {
|
|
102
113
|
backgroundColor: _renderUi.color.disabled()
|
|
103
114
|
}
|
|
115
|
+
},
|
|
116
|
+
flexContainer: {
|
|
117
|
+
display: 'flex',
|
|
118
|
+
alignItems: 'center',
|
|
119
|
+
marginBottom: theme.spacing.unit
|
|
120
|
+
},
|
|
121
|
+
titleText: {
|
|
122
|
+
fontFamily: 'Cerebri Sans',
|
|
123
|
+
fontSize: theme.typography.fontSize + 2,
|
|
124
|
+
lineHeight: '19px',
|
|
125
|
+
color: '#495B8F',
|
|
126
|
+
marginRight: theme.spacing.unit
|
|
127
|
+
},
|
|
128
|
+
tooltip: {
|
|
129
|
+
fontSize: theme.typography.fontSize - 2,
|
|
130
|
+
whiteSpace: 'pre',
|
|
131
|
+
maxWidth: '500px'
|
|
132
|
+
},
|
|
133
|
+
errorText: {
|
|
134
|
+
fontSize: theme.typography.fontSize - 2,
|
|
135
|
+
color: 'red',
|
|
136
|
+
paddingTop: theme.spacing.unit
|
|
104
137
|
}
|
|
105
138
|
};
|
|
106
139
|
};
|
|
@@ -114,6 +147,7 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
114
147
|
onRemoveChoice = props.onRemoveChoice,
|
|
115
148
|
onAddChoice = props.onAddChoice,
|
|
116
149
|
imageSupport = props.imageSupport,
|
|
150
|
+
uploadSoundSupport = props.uploadSoundSupport,
|
|
117
151
|
onChangeModel = props.onChangeModel,
|
|
118
152
|
onConfigurationChanged = props.onConfigurationChanged,
|
|
119
153
|
onTeacherInstructionsChanged = props.onTeacherInstructionsChanged;
|
|
@@ -123,8 +157,6 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
123
157
|
prompt = _ref$prompt === void 0 ? {} : _ref$prompt,
|
|
124
158
|
_ref$addChoiceButton = _ref.addChoiceButton,
|
|
125
159
|
addChoiceButton = _ref$addChoiceButton === void 0 ? {} : _ref$addChoiceButton,
|
|
126
|
-
_ref$limitChoicesNumb = _ref.limitChoicesNumber,
|
|
127
|
-
limitChoicesNumber = _ref$limitChoicesNumb === void 0 ? {} : _ref$limitChoicesNumb,
|
|
128
160
|
_ref$feedback = _ref.feedback,
|
|
129
161
|
feedback = _ref$feedback === void 0 ? {} : _ref$feedback,
|
|
130
162
|
_ref$deleteChoice = _ref.deleteChoice,
|
|
@@ -143,21 +175,102 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
143
175
|
studentInstructions = _ref$studentInstructi === void 0 ? {} : _ref$studentInstructi,
|
|
144
176
|
_ref$rationale = _ref.rationale,
|
|
145
177
|
rationale = _ref$rationale === void 0 ? {} : _ref$rationale,
|
|
178
|
+
_ref$accessibility = _ref.accessibility,
|
|
179
|
+
accessibility = _ref$accessibility === void 0 ? {} : _ref$accessibility,
|
|
146
180
|
_ref$scoringType = _ref.scoringType,
|
|
147
181
|
scoringType = _ref$scoringType === void 0 ? {} : _ref$scoringType,
|
|
148
182
|
_ref$sequentialChoice = _ref.sequentialChoiceLabels,
|
|
149
183
|
sequentialChoiceLabels = _ref$sequentialChoice === void 0 ? {} : _ref$sequentialChoice,
|
|
150
184
|
settingsPanelDisabled = _ref.settingsPanelDisabled,
|
|
151
|
-
|
|
185
|
+
choicesLayout = _ref.choicesLayout,
|
|
186
|
+
_ref$spellCheck = _ref.spellCheck,
|
|
187
|
+
spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck,
|
|
188
|
+
gridColumns = _ref.gridColumns,
|
|
189
|
+
_ref$maxImageWidth = _ref.maxImageWidth,
|
|
190
|
+
maxImageWidth = _ref$maxImageWidth === void 0 ? {} : _ref$maxImageWidth,
|
|
191
|
+
_ref$maxImageHeight = _ref.maxImageHeight,
|
|
192
|
+
maxImageHeight = _ref$maxImageHeight === void 0 ? {} : _ref$maxImageHeight,
|
|
193
|
+
_ref$withRubric = _ref.withRubric,
|
|
194
|
+
withRubric = _ref$withRubric === void 0 ? {} : _ref$withRubric;
|
|
195
|
+
|
|
196
|
+
var _ref2 = configuration || {},
|
|
197
|
+
maxAnswerChoices = _ref2.maxAnswerChoices;
|
|
198
|
+
|
|
199
|
+
var _ref3 = model || {},
|
|
200
|
+
limitChoicesNumber = _ref3.limitChoicesNumber,
|
|
201
|
+
teacherInstructionsEnabled = _ref3.teacherInstructionsEnabled,
|
|
202
|
+
rationaleEnabled = _ref3.rationaleEnabled,
|
|
203
|
+
accessibilityLabelsEnabled = _ref3.accessibilityLabelsEnabled,
|
|
204
|
+
feedbackEnabled = _ref3.feedbackEnabled,
|
|
205
|
+
promptEnabled = _ref3.promptEnabled,
|
|
206
|
+
spellCheckEnabled = _ref3.spellCheckEnabled,
|
|
207
|
+
choices = _ref3.choices,
|
|
208
|
+
errors = _ref3.errors,
|
|
209
|
+
toolbarEditorPosition = _ref3.toolbarEditorPosition;
|
|
210
|
+
|
|
211
|
+
var _ref4 = errors || {},
|
|
212
|
+
choicesErrors = _ref4.choicesErrors,
|
|
213
|
+
correctResponseError = _ref4.correctResponseError,
|
|
214
|
+
answerChoicesError = _ref4.answerChoicesError;
|
|
215
|
+
|
|
216
|
+
var nrOfColumnsAvailable = choices !== null && choices !== void 0 && choices.length ? Array.from({
|
|
217
|
+
length: choices.length
|
|
218
|
+
}, function (_, i) {
|
|
219
|
+
return "".concat(i + 1);
|
|
220
|
+
}) : [];
|
|
221
|
+
var labelPlugins = {
|
|
222
|
+
audio: {
|
|
223
|
+
disabled: true
|
|
224
|
+
},
|
|
225
|
+
video: {
|
|
226
|
+
disabled: true
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
var toolbarOpts = {
|
|
230
|
+
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
231
|
+
}; // if old property is used, set maxAnswerChoices to 9
|
|
152
232
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
rationaleEnabled = _ref2.rationaleEnabled,
|
|
157
|
-
feedbackEnabled = _ref2.feedbackEnabled,
|
|
158
|
-
promptEnabled = _ref2.promptEnabled;
|
|
233
|
+
if (limitChoicesNumber) {
|
|
234
|
+
maxAnswerChoices = MAX_CHOICES;
|
|
235
|
+
}
|
|
159
236
|
|
|
160
|
-
var
|
|
237
|
+
var validationMessage = (0, _utils.generateValidationMessage)(configuration);
|
|
238
|
+
var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
239
|
+
var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
240
|
+
var addChoiceButtonTooltip = maxAnswerChoices && (choices === null || choices === void 0 ? void 0 : choices.length) >= maxAnswerChoices ? "Only ".concat(maxAnswerChoices, " allowed maximum") : '';
|
|
241
|
+
var panelSettings = {
|
|
242
|
+
choiceMode: choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),
|
|
243
|
+
'sequentialChoiceLabels.enabled': sequentialChoiceLabels.settings && toggle(sequentialChoiceLabels.label, true),
|
|
244
|
+
choicePrefix: choicePrefix.settings && radio(choicePrefix.label, ['numbers', 'letters']),
|
|
245
|
+
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
246
|
+
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
247
|
+
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
248
|
+
choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),
|
|
249
|
+
gridColumns: choicesLayout.settings && model.choicesLayout === 'grid' && nrOfColumnsAvailable.length > 0 && dropdown(gridColumns.label, nrOfColumnsAvailable)
|
|
250
|
+
};
|
|
251
|
+
var panelProperties = {
|
|
252
|
+
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
253
|
+
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
254
|
+
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
255
|
+
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
256
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
257
|
+
accessibilityLabelsEnabled: accessibility.settings && toggle(accessibility.label),
|
|
258
|
+
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
|
|
259
|
+
rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label)
|
|
260
|
+
};
|
|
261
|
+
return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
262
|
+
hideSettings: settingsPanelDisabled,
|
|
263
|
+
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
264
|
+
model: model,
|
|
265
|
+
onChangeModel: onChangeModel,
|
|
266
|
+
configuration: configuration,
|
|
267
|
+
onChangeConfiguration: onConfigurationChanged,
|
|
268
|
+
groups: {
|
|
269
|
+
Settings: panelSettings,
|
|
270
|
+
Properties: panelProperties
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
161
274
|
label: teacherInstructions.label,
|
|
162
275
|
className: classes.promptHolder
|
|
163
276
|
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
@@ -165,7 +278,17 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
165
278
|
markup: model.teacherInstructions || '',
|
|
166
279
|
onChange: onTeacherInstructionsChanged,
|
|
167
280
|
imageSupport: imageSupport,
|
|
168
|
-
nonEmpty: false
|
|
281
|
+
nonEmpty: false,
|
|
282
|
+
toolbarOpts: toolbarOpts,
|
|
283
|
+
spellCheck: spellCheckEnabled,
|
|
284
|
+
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
285
|
+
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
286
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
287
|
+
languageCharactersProps: [{
|
|
288
|
+
language: 'spanish'
|
|
289
|
+
}, {
|
|
290
|
+
language: 'special'
|
|
291
|
+
}]
|
|
169
292
|
})), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
170
293
|
label: prompt.label,
|
|
171
294
|
className: classes.promptHolder
|
|
@@ -175,8 +298,33 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
175
298
|
onChange: onPromptChanged,
|
|
176
299
|
imageSupport: imageSupport,
|
|
177
300
|
nonEmpty: false,
|
|
178
|
-
disableUnderline: true
|
|
179
|
-
|
|
301
|
+
disableUnderline: true,
|
|
302
|
+
toolbarOpts: toolbarOpts,
|
|
303
|
+
spellCheck: spellCheckEnabled,
|
|
304
|
+
maxImageWidth: maxImageWidth && maxImageWidth.prompt,
|
|
305
|
+
maxImageHeight: maxImageHeight && maxImageHeight.prompt,
|
|
306
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
307
|
+
languageCharactersProps: [{
|
|
308
|
+
language: 'spanish'
|
|
309
|
+
}, {
|
|
310
|
+
language: 'special'
|
|
311
|
+
}]
|
|
312
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
313
|
+
className: classes.flexContainer
|
|
314
|
+
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
315
|
+
className: classes.titleText
|
|
316
|
+
}, "Choices"), /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
317
|
+
classes: {
|
|
318
|
+
tooltip: classes.tooltip
|
|
319
|
+
},
|
|
320
|
+
disableFocusListener: true,
|
|
321
|
+
disableTouchListener: true,
|
|
322
|
+
placement: 'right',
|
|
323
|
+
title: validationMessage
|
|
324
|
+
}, /*#__PURE__*/_react["default"].createElement(_Info["default"], {
|
|
325
|
+
fontSize: 'small',
|
|
326
|
+
color: 'primary'
|
|
327
|
+
}))), choices.map(function (choice, index) {
|
|
180
328
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
181
329
|
key: "choice-".concat(index),
|
|
182
330
|
className: classes.choiceConfigurationHolder
|
|
@@ -189,6 +337,7 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
189
337
|
data: choice,
|
|
190
338
|
defaultFeedback: {},
|
|
191
339
|
imageSupport: imageSupport,
|
|
340
|
+
disableImageAlignmentButtons: true,
|
|
192
341
|
onDelete: function onDelete() {
|
|
193
342
|
return onRemoveChoice(index);
|
|
194
343
|
},
|
|
@@ -197,7 +346,14 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
197
346
|
},
|
|
198
347
|
allowFeedBack: feedbackEnabled,
|
|
199
348
|
allowDelete: deleteChoice.settings,
|
|
200
|
-
noLabels: true
|
|
349
|
+
noLabels: true,
|
|
350
|
+
toolbarOpts: toolbarOpts,
|
|
351
|
+
spellCheck: spellCheckEnabled,
|
|
352
|
+
error: (choicesErrors === null || choicesErrors === void 0 ? void 0 : choicesErrors[choice.value]) || null,
|
|
353
|
+
noCorrectAnswerError: correctResponseError,
|
|
354
|
+
maxImageWidth: maxImageWidth && maxImageWidth.choices || defaultImageMaxWidth,
|
|
355
|
+
maxImageHeight: maxImageHeight && maxImageHeight.choices || defaultImageMaxHeight,
|
|
356
|
+
uploadSoundSupport: uploadSoundSupport
|
|
201
357
|
}), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
202
358
|
key: "rationale-".concat(index),
|
|
203
359
|
label: rationale.label,
|
|
@@ -210,52 +366,60 @@ var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
|
210
366
|
rationale: c
|
|
211
367
|
}));
|
|
212
368
|
},
|
|
213
|
-
imageSupport: imageSupport
|
|
369
|
+
imageSupport: imageSupport,
|
|
370
|
+
toolbarOpts: toolbarOpts,
|
|
371
|
+
pluginProps: labelPlugins,
|
|
372
|
+
spellCheck: spellCheckEnabled,
|
|
373
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
374
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
375
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
376
|
+
languageCharactersProps: [{
|
|
377
|
+
language: 'spanish'
|
|
378
|
+
}, {
|
|
379
|
+
language: 'special'
|
|
380
|
+
}]
|
|
381
|
+
})), accessibilityLabelsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
382
|
+
key: "accessibility-".concat(index),
|
|
383
|
+
label: accessibility.label,
|
|
384
|
+
className: classes.accessibilityHolder
|
|
385
|
+
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
386
|
+
className: classes.accessibility,
|
|
387
|
+
markup: choice.accessibility || '',
|
|
388
|
+
onChange: function onChange(c) {
|
|
389
|
+
return onChoiceChanged(index, _objectSpread(_objectSpread({}, choice), {}, {
|
|
390
|
+
accessibility: c
|
|
391
|
+
}));
|
|
392
|
+
},
|
|
393
|
+
imageSupport: imageSupport,
|
|
394
|
+
pluginProps: labelPlugins,
|
|
395
|
+
spellCheck: spellCheckEnabled,
|
|
396
|
+
maxImageWidth: maxImageWidth && maxImageWidth.choices || defaultImageMaxWidth,
|
|
397
|
+
maxImageHeight: maxImageHeight && maxImageHeight.choices || defaultImageMaxHeight,
|
|
398
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
399
|
+
languageCharactersProps: [{
|
|
400
|
+
language: 'spanish'
|
|
401
|
+
}, {
|
|
402
|
+
language: 'special'
|
|
403
|
+
}]
|
|
214
404
|
})));
|
|
215
|
-
}),
|
|
216
|
-
|
|
405
|
+
}), correctResponseError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
406
|
+
className: classes.errorText
|
|
407
|
+
}, correctResponseError), answerChoicesError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
408
|
+
className: classes.errorText
|
|
409
|
+
}, answerChoicesError), addChoiceButton.settings && /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
410
|
+
title: addChoiceButtonTooltip,
|
|
217
411
|
classes: {
|
|
218
412
|
tooltip: classes.tooltip
|
|
219
413
|
}
|
|
220
414
|
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
221
415
|
classes: {
|
|
222
|
-
root:
|
|
416
|
+
root: maxAnswerChoices && (choices === null || choices === void 0 ? void 0 : choices.length) >= maxAnswerChoices && classes.disableButton
|
|
223
417
|
},
|
|
224
418
|
className: classes.addButton,
|
|
225
419
|
variant: "contained",
|
|
226
420
|
color: "primary",
|
|
227
421
|
onClick: onAddChoice
|
|
228
|
-
}, addChoiceButton.label)));
|
|
229
|
-
|
|
230
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
231
|
-
className: classes.design
|
|
232
|
-
}, settingsPanelDisabled ? Content : /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
233
|
-
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
234
|
-
model: model,
|
|
235
|
-
onChangeModel: onChangeModel,
|
|
236
|
-
configuration: configuration,
|
|
237
|
-
onChangeConfiguration: onConfigurationChanged,
|
|
238
|
-
groups: {
|
|
239
|
-
Settings: {
|
|
240
|
-
choiceMode: choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),
|
|
241
|
-
'sequentialChoiceLabels.enabled': sequentialChoiceLabels.settings && toggle(sequentialChoiceLabels.label, true),
|
|
242
|
-
choicePrefix: choicePrefix.settings && radio(choicePrefix.label, ['numbers', 'letters']),
|
|
243
|
-
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
244
|
-
limitChoicesNumber: limitChoicesNumber.settings && toggle(limitChoicesNumber.label),
|
|
245
|
-
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
246
|
-
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
247
|
-
verticalMode: verticalMode.settings && toggle(verticalMode.label)
|
|
248
|
-
},
|
|
249
|
-
Properties: {
|
|
250
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
251
|
-
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
252
|
-
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
253
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
254
|
-
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric'])
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
})
|
|
258
|
-
}, Content));
|
|
422
|
+
}, addChoiceButton.label))));
|
|
259
423
|
});
|
|
260
424
|
|
|
261
425
|
var Main = /*#__PURE__*/function (_React$Component) {
|
|
@@ -273,31 +437,65 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
273
437
|
}
|
|
274
438
|
|
|
275
439
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
440
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
441
|
+
showWarning: false
|
|
442
|
+
});
|
|
276
443
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRemoveChoice", function (index) {
|
|
277
|
-
var
|
|
278
|
-
|
|
444
|
+
var _this$props = _this.props,
|
|
445
|
+
model = _this$props.model,
|
|
446
|
+
configuration = _this$props.configuration,
|
|
447
|
+
onModelChanged = _this$props.onModelChanged;
|
|
448
|
+
|
|
449
|
+
var _ref5 = configuration || {},
|
|
450
|
+
minAnswerChoices = _ref5.minAnswerChoices;
|
|
451
|
+
|
|
452
|
+
if (minAnswerChoices && model.choices.length === minAnswerChoices) {
|
|
453
|
+
_this.setState({
|
|
454
|
+
showWarning: true
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
279
459
|
|
|
280
|
-
|
|
460
|
+
model.choices.splice(index, 1);
|
|
461
|
+
onModelChanged(model);
|
|
281
462
|
});
|
|
282
463
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAddChoice", function () {
|
|
283
|
-
var
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
});
|
|
464
|
+
var _this$props2 = _this.props,
|
|
465
|
+
model = _this$props2.model,
|
|
466
|
+
configuration = _this$props2.configuration,
|
|
467
|
+
onModelChanged = _this$props2.onModelChanged;
|
|
468
|
+
|
|
469
|
+
var _ref6 = configuration || {},
|
|
470
|
+
maxAnswerChoices = _ref6.maxAnswerChoices;
|
|
471
|
+
|
|
472
|
+
var _ref7 = model || {},
|
|
473
|
+
limitChoicesNumber = _ref7.limitChoicesNumber; // if old property is used, set maxAnswerChoices to 9
|
|
474
|
+
|
|
295
475
|
|
|
296
|
-
|
|
476
|
+
if (limitChoicesNumber) {
|
|
477
|
+
maxAnswerChoices = MAX_CHOICES;
|
|
297
478
|
}
|
|
479
|
+
|
|
480
|
+
if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
model.choices.push({
|
|
485
|
+
label: '',
|
|
486
|
+
value: _configUi.choiceUtils.firstAvailableIndex(model.choices.map(function (c) {
|
|
487
|
+
return c.value;
|
|
488
|
+
}), 0),
|
|
489
|
+
feedback: {
|
|
490
|
+
type: 'none'
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
onModelChanged(model);
|
|
298
494
|
});
|
|
299
495
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChoiceChanged", function (index, choice) {
|
|
300
|
-
var
|
|
496
|
+
var _this$props3 = _this.props,
|
|
497
|
+
model = _this$props3.model,
|
|
498
|
+
onModelChanged = _this$props3.onModelChanged;
|
|
301
499
|
|
|
302
500
|
if (choice.correct && model.choiceMode === 'radio') {
|
|
303
501
|
model.choices = model.choices.map(function (c) {
|
|
@@ -308,8 +506,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
308
506
|
}
|
|
309
507
|
|
|
310
508
|
model.choices.splice(index, 1, choice);
|
|
311
|
-
|
|
312
|
-
_this.props.onModelChanged(model);
|
|
509
|
+
onModelChanged(model);
|
|
313
510
|
});
|
|
314
511
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPromptChanged", function (prompt) {
|
|
315
512
|
_this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
@@ -360,14 +557,29 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
360
557
|
(0, _createClass2["default"])(Main, [{
|
|
361
558
|
key: "render",
|
|
362
559
|
value: function render() {
|
|
363
|
-
|
|
560
|
+
var _this2 = this;
|
|
561
|
+
|
|
562
|
+
var _this$props$configura = this.props.configuration;
|
|
563
|
+
_this$props$configura = _this$props$configura === void 0 ? {} : _this$props$configura;
|
|
564
|
+
var minAnswerChoices = _this$props$configura.minAnswerChoices;
|
|
565
|
+
var showWarning = this.state.showWarning;
|
|
566
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_configUi.AlertDialog, {
|
|
567
|
+
open: showWarning,
|
|
568
|
+
title: "Warning",
|
|
569
|
+
text: "There can't be less than ".concat(minAnswerChoices || 0, " choices."),
|
|
570
|
+
onConfirm: function onConfirm() {
|
|
571
|
+
return _this2.setState({
|
|
572
|
+
showWarning: false
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
}), /*#__PURE__*/_react["default"].createElement(Design, (0, _extends2["default"])({}, this.props, {
|
|
364
576
|
onChangeModel: this.onModelChanged,
|
|
365
577
|
onRemoveChoice: this.onRemoveChoice,
|
|
366
578
|
onChoiceChanged: this.onChoiceChanged,
|
|
367
579
|
onAddChoice: this.onAddChoice,
|
|
368
580
|
onPromptChanged: this.onPromptChanged,
|
|
369
581
|
onTeacherInstructionsChanged: this.onTeacherInstructionsChanged
|
|
370
|
-
}));
|
|
582
|
+
})));
|
|
371
583
|
}
|
|
372
584
|
}]);
|
|
373
585
|
return Main;
|
|
@@ -376,6 +588,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
376
588
|
exports.Main = Main;
|
|
377
589
|
(0, _defineProperty2["default"])(Main, "propTypes", {
|
|
378
590
|
model: _propTypes["default"].object.isRequired,
|
|
591
|
+
configuration: _propTypes["default"].object.isRequired,
|
|
379
592
|
disableSidePanel: _propTypes["default"].bool,
|
|
380
593
|
onModelChanged: _propTypes["default"].func.isRequired,
|
|
381
594
|
onConfigurationChanged: _propTypes["default"].func.isRequired,
|