UNPKG

@instructure/quiz-interactions

Version:

A React UI component Library for quiz interaction types.

100 lines (99 loc) 2.29 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _exampleImage = _interopRequireDefault(require("../exampleImage.png")); var _default = exports["default"] = { propValues: { shape: [{ type: 'square', coordinates: [{ x: 0.3, y: 0.3 }, { x: 0.7, y: 0.7 }] }, { type: 'oval', coordinates: [{ x: 0.3, y: 0.3 }, { x: 0.7, y: 0.7 }] }, { type: 'polygon', coordinates: [{ x: 0.3, y: 0.3 }, { x: 0.7, y: 0.2 }, { x: 0.8, y: 0.4 }, { x: 0.5, y: 0.5 }, { x: 0.7, y: 0.7 }, { x: 0.2, y: 0.6 }, { x: 0.3, y: 0.3 }] }, null], overrideEditableForRegrading: [false, true] }, getComponentProps: function getComponentProps(props) { var overrideEditableForRegrading = props.overrideEditableForRegrading, shape = props.shape; var itemBody; if (shape) { itemBody = "Hotspot Edit (".concat(shape.type, ")"); if (overrideEditableForRegrading) { itemBody += ' - overrideEditableForRegrading'; } } var interactionData = shape ? { imageUrl: _exampleImage["default"] } : {}; var scoringData = { value: shape || {} }; var errors, errorsAreShowing; if (!shape) { errors = { itemBody: ['You must have an item body'], interactionData: { imageUrl: ['You must upload a file'] }, scoringData: { value: { type: ['You must select a hot spot type'], coordinates: ['You must draw a hot spot'] } } }; errorsAreShowing = true; } return { enableRichContentEditor: false, itemBody: itemBody, interactionData: interactionData, scoringData: scoringData, errors: errors, errorsAreShowing: errorsAreShowing, changeItemState: Function.prototype, mediaUpload: Function.prototype, openImportModal: Function.prototype }; } };