UNPKG

@instructure/quiz-interactions

Version:

A React UI component Library for quiz interaction types.

609 lines (601 loc) • 29.8 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); var _react = _interopRequireWildcard(require("react")); var _propTypes = _interopRequireDefault(require("prop-types")); var _striptags = _interopRequireDefault(require("striptags")); var _uuid = require("uuid"); var _getOr = _interopRequireDefault(require("lodash/fp/getOr")); var _set = _interopRequireDefault(require("lodash/fp/set")); var _sortBy = _interopRequireDefault(require("lodash/fp/sortBy")); var _findIndex = _interopRequireDefault(require("lodash/fp/findIndex")); var _filter = _interopRequireDefault(require("lodash/fp/filter")); var _last = _interopRequireDefault(require("lodash/fp/last")); var _map = _interopRequireDefault(require("lodash/fp/map")); var _xor = _interopRequireDefault(require("lodash/fp/xor")); var _remove = _interopRequireDefault(require("lodash/fp/remove")); var _uiRadioInput = require("@instructure/ui-radio-input"); var _uiCheckbox = require("@instructure/ui-checkbox"); var _uiA11yContent = require("@instructure/ui-a11y-content"); var _uiButtons = require("@instructure/ui-buttons"); var _uiIcons = require("@instructure/ui-icons"); var _uiView = require("@instructure/ui-view"); var _uiLink = require("@instructure/ui-link"); var _uiText = require("@instructure/ui-text"); var _quizCommon = require("@instructure/quiz-common"); var _ChoiceInput = _interopRequireDefault(require("../../common/edit/components/ChoiceInput")); var _Footer = _interopRequireDefault(require("../../common/edit/components/Footer")); var _multiple_answer = _interopRequireDefault(require("../../../records/interactions/multiple_answer")); var _QuestionSettingsContainer = _interopRequireDefault(require("../../common/edit/components/QuestionSettingsContainer")); var _QuestionContainer = _interopRequireDefault(require("../../common/edit/components/QuestionContainer")); var _withEditTools = _interopRequireDefault(require("../../../util/withEditTools")); var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message")); var _QuestionSettingsPanel = _interopRequireDefault(require("../../common/edit/components/QuestionSettingsPanel")); var _CalculatorOptionWithOqaatAlert = _interopRequireDefault(require("../../common/edit/components/CalculatorOptionWithOqaatAlert")); var _normalizeErrors = require("../../../util/normalizeErrors"); var _class, _MultipleAnswerEdit; function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _callSuper(_this, derived, args) { function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (e) { return false; } } derived = (0, _getPrototypeOf2["default"])(derived); return (0, _possibleConstructorReturn2["default"])(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], (0, _getPrototypeOf2["default"])(_this).constructor) : derived.apply(_this, args)); } // Scoring Algorithms: var ALL_OR_NOTHING = 'AllOrNothing'; var PARTIAL_SCORE = 'PartialScore'; /** --- category: MultipleAnswer --- Multiple Answer Edit component ```jsx_example function Example (props) { const exampleProps = { itemBody: 'Who was in the first cabinet of the USA?', interactionData: { choices: [ { id: 'uuid1', position: 1, itemBody: 'Thomas Jefferson' }, { id: 'uuid2', position: 2, itemBody: 'John Marshall' }, { id: 'uuid3', position: 3, itemBody: 'John Knox' }, { id: 'uuid4', position: 4, itemBody: 'Alexander Hamilton' }, { id: 'uuid5', position: 5, itemBody: 'Aaron Burr' }, { id: 'uuid6', position: 6, itemBody: 'Ben Franklin' } ] }, itemId: '1', scoringData: { value: ['uuid1', 'uuid3', 'uuid4'] }, properties: { shuffleRules: { choices: { shuffled: true, toLock: [0, 1] } } } } return ( <MultipleAnswerEdit {...exampleProps} {...props} /> ) } <SettingsSwitcher locales={LOCALES}> <EditStateProvider> <Example /> </EditStateProvider> </SettingsSwitcher> ``` **/ var MultipleAnswerEdit = exports["default"] = (0, _withEditTools["default"])(_class = (_MultipleAnswerEdit = /*#__PURE__*/function (_Component) { function MultipleAnswerEdit() { var _this2; (0, _classCallCheck2["default"])(this, MultipleAnswerEdit); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this2 = _callSuper(this, MultipleAnswerEdit, [].concat(args)); (0, _defineProperty2["default"])(_this2, "state", { isModalOpen: false }); (0, _defineProperty2["default"])(_this2, "_choiceWasCreated", false); (0, _defineProperty2["default"])(_this2, "stemElement", null); (0, _defineProperty2["default"])(_this2, "choiceRefs", []); (0, _defineProperty2["default"])(_this2, "_timeouts", []); // =========== // HANDLERS // =========== (0, _defineProperty2["default"])(_this2, "handleScoringAlgoChange", function (e, value) { _this2.props.changeItemState({ scoringAlgorithm: value }, { scoringAlgorithm: value }); }); (0, _defineProperty2["default"])(_this2, "handleCloseModal", function () { _this2.setState({ isModalOpen: false }); }); (0, _defineProperty2["default"])(_this2, "handleOpenModal", function () { _this2.setState({ isModalOpen: true }); }); (0, _defineProperty2["default"])(_this2, "handleCalculatorTypeChange", function (e, value) { _this2.props.changeItemState({ calculatorType: value }); }); (0, _defineProperty2["default"])(_this2, "handleStemRef", function (node) { _this2.stemElement = node; }); (0, _defineProperty2["default"])(_this2, "handleRemoveChoice", function (choiceId, index) { var choices = _this2.getChoices(); var shuffleRules = _this2.props.properties.shuffleRules; _this2.updateFocusOnRemove(index); // Move the locks in conjuntion with the answers var toLock = (0, _map["default"])(function (value) { return value < index ? value : value - 1; }, (0, _filter["default"])(function (lock) { return lock !== index; }, shuffleRules.choices.toLock)); _this2.props.changeItemState({ interactionData: _objectSpread(_objectSpread({}, _this2.props.interactionData), {}, { choices: (0, _remove["default"])({ id: choiceId }, choices) }), scoringData: _objectSpread(_objectSpread({}, _this2.props.scoringData), {}, { value: (0, _filter["default"])(function (v) { return v !== choiceId; }, _this2.props.scoringData.value) }), properties: _objectSpread(_objectSpread({}, _this2.props.properties), {}, { shuffleRules: (0, _set["default"])('choices.toLock', toLock, shuffleRules) }) }); }); (0, _defineProperty2["default"])(_this2, "handleInputChange", function (choiceId, event, _ref) { var editorContent = _ref.editorContent; var choices = _this2.getChoices(); var index = (0, _findIndex["default"])({ id: choiceId }, choices); _this2.props.changeItemState({ interactionData: _objectSpread(_objectSpread({}, _this2.props.interactionData), {}, { choices: (0, _set["default"])("[".concat(index, "].itemBody"), editorContent, choices) }) }); }); (0, _defineProperty2["default"])(_this2, "handleCreateChoice", function () { _this2._choiceWasCreated = true; _this2.props.changeItemState({ interactionData: _objectSpread(_objectSpread({}, _this2.props.interactionData), {}, { choices: [].concat((0, _toConsumableArray2["default"])(_this2.getChoices()), [{ id: _this2.props.newId(), itemBody: '', position: Math.max.apply(Math, [-1].concat((0, _toConsumableArray2["default"])((0, _map["default"])('position', _this2.getChoices())))) + 1 }]) }) }); }); (0, _defineProperty2["default"])(_this2, "handleShuffleChange", function (event) { _this2.toggleShuffleChoices(); }); (0, _defineProperty2["default"])(_this2, "focusErrors", function () { var stemErrors = (0, _getOr["default"])([], 'itemBody', _this2.props.errors); var groupErrors = (0, _getOr["default"])([], 'scoringData.value', _this2.props.errors); var choiceErrors = (0, _getOr["default"])([], 'interactionData.choices', _this2.props.errors); var choiceErrorsKeys = Object.keys(choiceErrors).map(Number); if (stemErrors.length) { _this2.stemElement.focus(); } else if (groupErrors.length) { _this2.choiceRefs[0].focusOnAnswerInput(); } else if (choiceErrorsKeys.length) { var index = Math.min.apply(Math, (0, _toConsumableArray2["default"])(choiceErrorsKeys)); _this2.choiceRefs[index].focusOnAnswerInput(); } }); return _this2; } (0, _inherits2["default"])(MultipleAnswerEdit, _Component); return (0, _createClass2["default"])(MultipleAnswerEdit, [{ key: "componentDidMount", value: function componentDidMount() { this.setDefaultScoringAlgorithm(); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { // prevent timeouts from being called after unmount this._timeouts.forEach(clearTimeout); } }, { key: "componentDidUpdate", value: function componentDidUpdate() { if (this._choiceWasCreated) { this._choiceWasCreated = false; (0, _last["default"])(this.choiceRefs).focusOnAnswerInput(); } this.setDefaultScoringAlgorithm(); } }, { key: "setDefaultScoringAlgorithm", value: function setDefaultScoringAlgorithm() { // ALL_OR_NOTHING is the default, // but we want PARTIAL_SCORE to be the default when enabled if (!this.props.scoringAlgorithm && this.props.partialScoringEnabled) { this.props.changeItemState({ scoringAlgorithm: PARTIAL_SCORE }); } } }, { key: "overrideEditable", value: function overrideEditable() { return this.props.overrideEditableForItem || this.props.overrideEditableForRegrading; } // =========== // HELPERS // =========== }, { key: "getChoices", value: function getChoices() { return (0, _getOr["default"])([], 'interactionData.choices', this.props); } }, { key: "isShuffled", value: function isShuffled() { return (0, _getOr["default"])(false, 'properties.shuffleRules.choices.shuffled', this.props); } }, { key: "isChoiceLocked", value: function isChoiceLocked(choiceId) { var index = (0, _findIndex["default"])({ id: choiceId }, this.getChoices()); var lockedChoices = (0, _getOr["default"])(false, 'properties.shuffleRules.choices.toLock', this.props); if (lockedChoices) { return lockedChoices.includes(index); } return false; } }, { key: "updateFocusOnRemove", value: function updateFocusOnRemove(index) { var _this3 = this; if (index === 0) { // if removing the first choice, focus on stem this.stemElement.focus(); } else if (this.getChoices().length === 2) { // if removing the second choice out of two choices this._timeouts = [].concat((0, _toConsumableArray2["default"])(this._timeouts), [setTimeout(function () { return _this3.choiceRefs[index - 1].focusLast(); })]); } else { // all the other cases this.choiceRefs[index - 1].focusLast(); } } }, { key: "toggleShuffleChoices", value: function toggleShuffleChoices() { var newShuffled = !this.isShuffled(); var properties; if (this.props.properties.shuffleRules !== void 0) { properties = (0, _set["default"])('shuffleRules.choices.shuffled', newShuffled, this.props.properties); } else { properties = { shuffleRules: { choices: { shuffled: newShuffled } } }; } var messageForScreenreader = newShuffled ? (0, _formatMessage["default"])('Shuffling turned on. Navigate to a choice to lock it in place.') : (0, _formatMessage["default"])('Shuffling turned off.'); this.props.notifyScreenreader(messageForScreenreader); this.props.changeItemState({ properties: properties }, { properties: { shuffleRules: { choices: { shuffled: newShuffled } } } }); } }, { key: "makeCheckAnswerToggler", value: function makeCheckAnswerToggler(choiceId) { var _this4 = this; return function () { _this4.props.changeItemState({ scoringData: _objectSpread(_objectSpread({}, _this4.props.scoringData), {}, { value: (0, _xor["default"])([choiceId], _this4.props.scoringData.value) }) }); }; } }, { key: "makeChoiceLockedToggler", value: function makeChoiceLockedToggler(choiceId) { var _this5 = this; return function () { var index = (0, _findIndex["default"])({ id: choiceId }, _this5.getChoices()); var toLock = (0, _xor["default"])([index], _this5.props.properties.shuffleRules.choices.toLock); var properties = (0, _set["default"])('shuffleRules.choices.toLock', toLock, _this5.props.properties); var messageForScreenreader = _this5.isChoiceLocked(choiceId) ? (0, _formatMessage["default"])('Distractor unlocked') : (0, _formatMessage["default"])('Distractor locked'); _this5.props.notifyScreenreader(messageForScreenreader); _this5.props.changeItemState({ properties: properties }, { properties: { shuffleRules: { choices: { toLock: toLock } } } }); }; } // =========== // RENDERS // =========== }, { key: "renderChoice", value: function renderChoice(choice, index) { var _this6 = this; var choiceErrors = this.props.getErrors("interactionData.choices.".concat(index, ".itemBody")); var shouldRenderRemoveChoice = this.getChoices().length !== 1 && !this.overrideEditable(); var disabledFields = [].concat((0, _toConsumableArray2["default"])(this.overrideEditable() ? ['answerInput'] : []), (0, _toConsumableArray2["default"])(this.props.overrideEditableForRegrading ? ['lockChoiceButton'] : [])); var choiceInputProps = { disabledFields: disabledFields, errors: choiceErrors, key: choice.id, id: choice.id, ref: function ref(node) { _this6.choiceRefs[index] = node; }, itemBody: choice.itemBody, noRCE: !this.props.enableRichContentEditor, notifyScreenreader: this.props.notifyScreenreader, onInputChange: this.handleInputChange, onRemoveChoice: function onRemoveChoice() { return _this6.handleRemoveChoice(choice.id, index); }, onModalClose: this.props.onModalClose, onModalOpen: this.props.onModalOpen, openImportModal: this.props.openImportModal, removeButtonScreenReaderText: (0, _formatMessage["default"])('Remove Answer Value: { choice }', { choice: (0, _striptags["default"])(choice.itemBody) }), shouldRenderRemoveChoice: shouldRenderRemoveChoice, isRequired: true, automationData: "sdk-multiple-answer-".concat(index) }; if (this.isShuffled()) { choiceInputProps.showLock = true; choiceInputProps.isLocked = this.isChoiceLocked(choice.id); choiceInputProps.toggleChoiceLocked = this.makeChoiceLockedToggler(choice.id); } var checked = this.props.scoringData.value.includes(choice.id); var onCheckboxChange = this.makeCheckAnswerToggler(choice.id); var labelText = choice.itemBody.trim() === '' ? (0, _formatMessage["default"])('Checkbox for blank distractor') : (0, _formatMessage["default"])('Checkbox for distractor { distractor }', { distractor: (0, _striptags["default"])(choice.itemBody) }); var renderCheckBox = function renderCheckBox() { return /*#__PURE__*/_react["default"].createElement(_uiCheckbox.Checkbox, { disabled: _this6.props.overrideEditableForItem, onChange: onCheckboxChange, checked: checked, key: choice.id, label: /*#__PURE__*/_react["default"].createElement(_uiA11yContent.ScreenReaderContent, null, labelText), value: choice.id }); }; return /*#__PURE__*/_react["default"].createElement(_ChoiceInput["default"], Object.assign({}, choiceInputProps, { renderBeforeComponent: renderCheckBox() })); } }, { key: "renderInputGroup", value: function renderInputGroup() { var _this7 = this; var choices = (0, _sortBy["default"])('position', this.getChoices()); var name = "edit_interaction_".concat(this.props.itemId); var errors = [].concat((0, _toConsumableArray2["default"])(this.props.getErrors('interactionData.choices.$errors')), (0, _toConsumableArray2["default"])(this.props.getErrors('scoringData.value.$errors'))); return /*#__PURE__*/_react["default"].createElement(_quizCommon.FormFieldGroup, { rowSpacing: "small", name: name, description: (0, _formatMessage["default"])('Possible answers'), messages: (0, _normalizeErrors.normalizeErrors)(errors) }, choices.map(function (choice, index) { return _this7.renderChoice(choice, index); })); } }, { key: "renderOptionsDescription", value: function renderOptionsDescription() { return /*#__PURE__*/_react["default"].createElement(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage["default"])('Multiple answer options')); } }, { key: "renderGradingOptionsModal", value: function renderGradingOptionsModal() { return /*#__PURE__*/_react["default"].createElement(_quizCommon.SimpleModal, { size: "small", title: (0, _formatMessage["default"])('Grading'), label: (0, _formatMessage["default"])('Grading'), isModalOpen: this.state.isModalOpen, onModalDismiss: this.handleCloseModal }, /*#__PURE__*/_react["default"].createElement(_uiText.Text, { weight: "bold", lineHeight: "double" }, (0, _formatMessage["default"])('Partial credit with penalty')), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_uiText.Text, null, (0, _formatMessage["default"])('Students are awarded points for every correct answer selected and deducted points for every incorrect answer selected.'), "\xA0", /*#__PURE__*/_react["default"].createElement(_uiLink.Link, { target: "_blank", href: "https://community.canvaslms.com/docs/DOC-15039-4152780608" }, (0, _formatMessage["default"])('Learn More'))), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_uiText.Text, { weight: "bold", lineHeight: "double" }, (0, _formatMessage["default"])('Exact match')), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_uiText.Text, null, (0, _formatMessage["default"])('Students are awarded full credit if all correct answers are selected and no incorrect answers are selected.'))); } }, { key: "renderGradingOptions", value: function renderGradingOptions() { return /*#__PURE__*/_react["default"].createElement(_uiView.View, { as: "div", margin: "medium 0", position: "relative" }, /*#__PURE__*/_react["default"].createElement(_uiRadioInput.RadioInputGroup, { onChange: this.handleScoringAlgoChange, name: (0, _formatMessage["default"])('Grading'), value: this.props.scoringAlgorithm, description: /*#__PURE__*/_react["default"].createElement("span", null, (0, _formatMessage["default"])('Grading'), /*#__PURE__*/_react["default"].createElement(_uiButtons.IconButton, { size: "small", withBackground: false, withBorder: false, renderIcon: _uiIcons.IconQuestionLine, onClick: this.handleOpenModal, screenReaderLabel: (0, _formatMessage["default"])('Open grading option information') })) }, /*#__PURE__*/_react["default"].createElement(_uiRadioInput.RadioInput, { value: PARTIAL_SCORE, label: (0, _formatMessage["default"])('Partial credit with penalty'), "data-automation": "sdk-matching-partial" }), /*#__PURE__*/_react["default"].createElement(_uiRadioInput.RadioInput, { value: ALL_OR_NOTHING, label: (0, _formatMessage["default"])('Exact Match'), "data-automation": "sdk-matching-exact" }))); } }, { key: "render", value: function render() { // clean up the references to ChoiceInputs this.choiceRefs = []; var shuffleChoicesLabel = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("span", null, (0, _formatMessage["default"])('Shuffle Choices')), /*#__PURE__*/_react["default"].createElement(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage["default"])('Lock distractor position buttons are displayed for each option when checked'))); return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_QuestionContainer["default"], { disabled: this.overrideEditable(), enableRichContentEditor: this.props.enableRichContentEditor, itemBody: this.props.itemBody, onDescriptionChange: this.props.onDescriptionChange, onModalClose: this.props.onModalClose, onModalOpen: this.props.onModalOpen, openImportModal: this.props.openImportModal, stemErrors: this.props.getErrors('itemBody'), textareaRef: this.handleStemRef }, this.renderInputGroup(), !this.overrideEditable() && /*#__PURE__*/_react["default"].createElement(_Footer["default"], { onCreateChoice: this.handleCreateChoice, notifyScreenreader: this.props.notifyScreenreader })), /*#__PURE__*/_react["default"].createElement(_QuestionSettingsContainer["default"], { additionalOptions: this.props.additionalOptions }, /*#__PURE__*/_react["default"].createElement(_QuestionSettingsPanel["default"], { label: (0, _formatMessage["default"])('Options'), defaultExpanded: true }, /*#__PURE__*/_react["default"].createElement(_quizCommon.FormFieldGroup, { rowSpacing: "small", description: this.renderOptionsDescription() }, this.props.showCalculatorOption && /*#__PURE__*/_react["default"].createElement(_CalculatorOptionWithOqaatAlert["default"], { disabled: this.props.overrideEditableForRegrading, calculatorValue: this.props.calculatorType, onCalculatorTypeChange: this.handleCalculatorTypeChange, oqaatChecked: this.props.oneQuestionAtATime, onOqaatChange: this.props.setOneQuestionAtATime }), /*#__PURE__*/_react["default"].createElement(_uiCheckbox.Checkbox, { label: shuffleChoicesLabel, onChange: this.handleShuffleChange, checked: this.isShuffled(), disabled: this.props.overrideEditableForRegrading, "data-automation": "sdk-multiple-answer-shuffle-choices-checkbox" }), this.props.partialScoringEnabled && this.renderGradingOptions()))), this.renderGradingOptionsModal()); } }]); }(_react.Component), (0, _defineProperty2["default"])(_MultipleAnswerEdit, "interactionType", _multiple_answer["default"]), (0, _defineProperty2["default"])(_MultipleAnswerEdit, "propTypes", _objectSpread(_objectSpread({ additionalOptions: _QuestionSettingsContainer["default"].propTypes.additionalOptions, calculatorType: _propTypes["default"].string, changeItemState: _propTypes["default"].func, // TODO: This appears to be unused, can we remove it? Hard to tell with all of the indirection (i.e. withEditTools) errors: _propTypes["default"].object, errorsAreShowing: _propTypes["default"].bool, enableRichContentEditor: _propTypes["default"].bool, interactionData: _propTypes["default"].shape({ choices: _propTypes["default"].arrayOf(_propTypes["default"].shape({ id: _propTypes["default"].string, itemBody: _propTypes["default"].string, position: _propTypes["default"].number })) }).isRequired, itemBody: _propTypes["default"].string.isRequired, itemId: _propTypes["default"].string, newId: _propTypes["default"].func, notifyScreenreader: _propTypes["default"].func, onModalClose: _propTypes["default"].func, onModalOpen: _propTypes["default"].func, oneQuestionAtATime: _propTypes["default"].bool, overrideEditableForItem: _propTypes["default"].bool, overrideEditableForRegrading: _propTypes["default"].bool, partialScoringEnabled: _propTypes["default"].bool, properties: _propTypes["default"].shape({ shuffleRules: _propTypes["default"].shape({ choices: _propTypes["default"].shape({ shuffled: _propTypes["default"].bool, toLock: _propTypes["default"].arrayOf(_propTypes["default"].number) }) }) }).isRequired, scoringAlgorithm: _propTypes["default"].string, scoringData: _propTypes["default"].shape({ value: _propTypes["default"].arrayOf(_propTypes["default"].string) }).isRequired, setOneQuestionAtATime: _propTypes["default"].func, openImportModal: _propTypes["default"].func }, _withEditTools["default"].injectedProps), {}, { showCalculatorOption: _propTypes["default"].bool })), (0, _defineProperty2["default"])(_MultipleAnswerEdit, "defaultProps", { calculatorType: 'none', enableRichContentEditor: true, oneQuestionAtATime: false, overrideEditableForItem: false, overrideEditableForRegrading: false, partialScoringEnabled: false, newId: _uuid.v4, notifyScreenreader: Function.prototype, setOneQuestionAtATime: Function.prototype, additionalOptions: void 0, changeItemState: void 0, errors: void 0, errorsAreShowing: void 0, itemId: void 0, onModalClose: void 0, onModalOpen: void 0, openImportModal: void 0, scoringAlgorithm: null, showCalculatorOption: true }), _MultipleAnswerEdit)) || _class;