@instructure/quiz-core 22.16.1 → 22.17.0
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/es/building/api/quizEntries.js +25 -5
- package/es/building/components/layout/header/BuildingButtons/index.js +1 -0
- package/es/building/components/layout/header/BuildingButtons/presenter.js +4 -0
- package/es/building/components/resources/ItemFeedbackModal/index.js +4 -1
- package/es/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
- package/es/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
- package/es/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
- package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
- package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
- package/es/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
- package/es/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
- package/es/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
- package/es/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
- package/es/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
- package/es/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
- package/es/common/actions/modal.js +2 -1
- package/es/common/components/ConfirmationModal/index.js +1 -1
- package/es/common/components/ConfirmationModal/presenter.js +49 -169
- package/es/common/components/SDKApp/index.js +22 -23
- package/es/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
- package/es/common/components/layout/sidebar/Sidebar/index.js +29 -57
- package/es/common/components/layout/sidebar/SidebarItem/index.js +5 -1
- package/es/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
- package/es/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
- package/es/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
- package/{lib/common/components/resources/quizSessionResult/Header → es/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
- package/es/common/components/resources/item/ItemEdit/index.js +5 -3
- package/es/common/components/resources/item/ItemEdit/presenter.js +3 -2
- package/es/common/components/resources/item/ItemShow/index.js +2 -1
- package/es/common/components/resources/quiz/AddContent/Body/index.js +4 -2
- package/es/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
- package/es/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
- package/es/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
- package/es/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
- package/es/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
- package/es/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
- package/es/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
- package/es/common/components/resources/stimulus/Stimulus/index.js +4 -1
- package/es/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
- package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
- package/es/common/middleware/appSyncMiddleware.js +19 -0
- package/es/common/records/Quiz.js +8 -1
- package/es/common/records/QuizEntry.js +8 -1
- package/es/common/records/SessionItem.js +2 -1
- package/es/common/records/SessionItemResult.js +24 -0
- package/es/common/util/interactionTypePropsHelper.js +4 -2
- package/es/common/util/isMissing.js +4 -0
- package/es/configureStore.js +3 -1
- package/es/index.js +4 -2
- package/es/moderating/components/resources/ModerateTable/presenter.js +14 -9
- package/es/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
- package/es/moderating/components/resources/ModerateTableRow/styles.js +0 -4
- package/es/reduxStore.js +4 -0
- package/es/taking/api/taking.js +45 -10
- package/lib/building/api/quizEntries.js +25 -5
- package/lib/building/components/layout/header/BuildingButtons/index.js +1 -0
- package/lib/building/components/layout/header/BuildingButtons/presenter.js +4 -0
- package/lib/building/components/resources/ItemFeedbackModal/index.js +4 -1
- package/lib/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
- package/lib/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
- package/lib/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
- package/lib/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
- package/lib/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
- package/lib/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
- package/lib/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
- package/lib/common/actions/modal.js +2 -1
- package/lib/common/components/ConfirmationModal/index.js +1 -1
- package/lib/common/components/ConfirmationModal/presenter.js +49 -169
- package/lib/common/components/SDKApp/index.js +22 -23
- package/lib/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
- package/lib/common/components/layout/sidebar/Sidebar/index.js +29 -57
- package/lib/common/components/layout/sidebar/SidebarItem/index.js +5 -1
- package/lib/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
- package/lib/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
- package/lib/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
- package/{es/common/components/resources/quizSessionResult/Header → lib/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
- package/lib/common/components/resources/item/ItemEdit/index.js +5 -3
- package/lib/common/components/resources/item/ItemEdit/presenter.js +3 -2
- package/lib/common/components/resources/item/ItemShow/index.js +2 -1
- package/lib/common/components/resources/quiz/AddContent/Body/index.js +4 -2
- package/lib/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
- package/lib/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
- package/lib/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
- package/lib/common/components/resources/stimulus/Stimulus/index.js +4 -1
- package/lib/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
- package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
- package/lib/common/middleware/appSyncMiddleware.js +19 -0
- package/lib/common/records/Quiz.js +8 -1
- package/lib/common/records/QuizEntry.js +8 -1
- package/lib/common/records/SessionItem.js +2 -1
- package/lib/common/records/SessionItemResult.js +24 -0
- package/lib/common/util/interactionTypePropsHelper.js +4 -2
- package/lib/common/util/isMissing.js +4 -0
- package/lib/configureStore.js +3 -1
- package/lib/index.js +4 -2
- package/lib/moderating/components/resources/ModerateTable/presenter.js +14 -9
- package/lib/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
- package/lib/moderating/components/resources/ModerateTableRow/styles.js +0 -4
- package/lib/reduxStore.js +4 -0
- package/lib/taking/api/taking.js +45 -10
- package/package.json +10 -10
- package/es/building/components/resources/ItemFeedbackModal/styles.js +0 -13
- package/es/building/components/resources/ItemFeedbackModal/theme.js +0 -7
- package/es/common/components/resources/quizSessionResult/Info/index.js +0 -410
- package/es/common/components/resources/quizSessionResult/Info/styles.js +0 -58
- package/es/common/components/resources/quizSessionResult/Info/theme.js +0 -13
- package/lib/building/components/resources/ItemFeedbackModal/styles.js +0 -13
- package/lib/building/components/resources/ItemFeedbackModal/theme.js +0 -7
- package/lib/common/components/resources/quizSessionResult/Info/index.js +0 -410
- package/lib/common/components/resources/quizSessionResult/Info/styles.js +0 -58
- package/lib/common/components/resources/quizSessionResult/Info/theme.js +0 -13
- /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
- /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
- /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
- /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { connect } from '../../../../../../common/react-redux';
|
|
2
2
|
import makeEditable from '../../../../../../common/components/shared/functionality/makeEditable';
|
|
3
3
|
import QuizEntryEditFooter from './presenter';
|
|
4
|
+
import { getActiveQuiz } from '../../../../../../common/selectors/quizzes';
|
|
4
5
|
export function mapStateToProps(state, props) {
|
|
5
6
|
var entry = props.entry, quizEntry = props.quizEntry, workingQuizEntry = props.workingQuizEntry;
|
|
6
7
|
var workingEntry;
|
|
@@ -12,8 +13,11 @@ export function mapStateToProps(state, props) {
|
|
|
12
13
|
// Bank quizEntry with Item entry.
|
|
13
14
|
workingEntry = entry.getWorkingInstance();
|
|
14
15
|
}
|
|
16
|
+
var quiz = getActiveQuiz(state);
|
|
17
|
+
var isSurvey = quiz.isSurvey();
|
|
15
18
|
return {
|
|
16
|
-
workingEntry: workingEntry
|
|
19
|
+
workingEntry: workingEntry,
|
|
20
|
+
isSurvey: isSurvey
|
|
17
21
|
};
|
|
18
22
|
}
|
|
19
23
|
export default makeEditable(connect(mapStateToProps)(QuizEntryEditFooter));
|
|
@@ -142,6 +142,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
142
142
|
import { View } from '@instructure/ui-view';
|
|
143
143
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
144
144
|
import { Text } from '@instructure/ui-text';
|
|
145
|
+
import { Checkbox } from '@instructure/ui-checkbox';
|
|
145
146
|
import NumberInput from '@instructure/quiz-number-input';
|
|
146
147
|
import { IconButton } from '@instructure/ui-buttons';
|
|
147
148
|
import { jsx } from '@instructure/emotion';
|
|
@@ -161,6 +162,18 @@ function countDecimals(normalizedPointsString) {
|
|
|
161
162
|
var _normalizedPointsString_split = _sliced_to_array(normalizedPointsString.split('.'), 2), _ = _normalizedPointsString_split[0], decimals = _normalizedPointsString_split[1];
|
|
162
163
|
return decimals ? decimals.length : 0;
|
|
163
164
|
}
|
|
165
|
+
function RequiredCheckbox(props) {
|
|
166
|
+
var isRequired = props.isRequired, onChange = props.onChange;
|
|
167
|
+
return /*#__PURE__*/ jsx(View, {
|
|
168
|
+
margin: "0 small 0 0"
|
|
169
|
+
}, /*#__PURE__*/ jsx(Checkbox, {
|
|
170
|
+
label: "Required",
|
|
171
|
+
value: "medium",
|
|
172
|
+
variant: "toggle",
|
|
173
|
+
onChange: onChange,
|
|
174
|
+
checked: isRequired
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
164
177
|
export var QuizEntryEditFooter = /*#__PURE__*/ function(Component) {
|
|
165
178
|
"use strict";
|
|
166
179
|
_inherits(QuizEntryEditFooter, Component);
|
|
@@ -200,13 +213,23 @@ export var QuizEntryEditFooter = /*#__PURE__*/ function(Component) {
|
|
|
200
213
|
normalizedPoints: normalizedPoints
|
|
201
214
|
});
|
|
202
215
|
}
|
|
216
|
+
}), _define_property(_this, "handleRequiredChange", function(event) {
|
|
217
|
+
var checked = event.target.checked;
|
|
218
|
+
_this.props.changeQuizEntryProperties(_this.props.quizEntry.id, {
|
|
219
|
+
required: checked
|
|
220
|
+
});
|
|
221
|
+
_this.setState({
|
|
222
|
+
isRequired: checked
|
|
223
|
+
});
|
|
203
224
|
}), _define_property(_this, "handleButtonRef", function(node) {
|
|
204
225
|
_this.addFeedbackButton = node;
|
|
205
226
|
});
|
|
206
227
|
var points = _this.getPoints();
|
|
228
|
+
var isRequired = _this.getIsRequired();
|
|
207
229
|
_this.state = {
|
|
208
230
|
points: points,
|
|
209
|
-
normalizedPoints: points
|
|
231
|
+
normalizedPoints: points,
|
|
232
|
+
isRequired: isRequired
|
|
210
233
|
};
|
|
211
234
|
return _this;
|
|
212
235
|
}
|
|
@@ -229,6 +252,12 @@ export var QuizEntryEditFooter = /*#__PURE__*/ function(Component) {
|
|
|
229
252
|
return workingQuizEntry.regradeAdjustedPointsPossible(workingEntry.id) || workingQuizEntry.pointsPossible || 0;
|
|
230
253
|
}
|
|
231
254
|
},
|
|
255
|
+
{
|
|
256
|
+
key: "getIsRequired",
|
|
257
|
+
value: function getIsRequired() {
|
|
258
|
+
return this.props.workingQuizEntry.isRequired || false;
|
|
259
|
+
}
|
|
260
|
+
},
|
|
232
261
|
{
|
|
233
262
|
key: "pointsDisabled",
|
|
234
263
|
value: function pointsDisabled() {
|
|
@@ -293,9 +322,14 @@ export var QuizEntryEditFooter = /*#__PURE__*/ function(Component) {
|
|
|
293
322
|
{
|
|
294
323
|
key: "renderLeftFooter",
|
|
295
324
|
value: function renderLeftFooter() {
|
|
325
|
+
var isRequired = this.state.isRequired;
|
|
326
|
+
var component = this.props.isSurvey ? /*#__PURE__*/ jsx(RequiredCheckbox, {
|
|
327
|
+
isRequired: isRequired,
|
|
328
|
+
onChange: this.handleRequiredChange
|
|
329
|
+
}) : this.renderPointsSection();
|
|
296
330
|
return /*#__PURE__*/ jsx("div", {
|
|
297
331
|
css: this.props.styles.leftFooter
|
|
298
|
-
},
|
|
332
|
+
}, component, this.renderFeedbackSection());
|
|
299
333
|
}
|
|
300
334
|
},
|
|
301
335
|
{
|
|
@@ -343,6 +377,7 @@ _define_property(QuizEntryEditFooter, "componentId", "Quizzes".concat(QuizEntryE
|
|
|
343
377
|
_define_property(QuizEntryEditFooter, "propTypes", {
|
|
344
378
|
alternativeRightFooter: PropTypes.func,
|
|
345
379
|
changeQuizEntryPoints: PropTypes.func.isRequired,
|
|
380
|
+
changeQuizEntryProperties: PropTypes.func.isRequired,
|
|
346
381
|
clearChanges: PropTypes.func.isRequired,
|
|
347
382
|
disableSubmit: PropTypes.bool,
|
|
348
383
|
displayPosition: PropTypes.number.isRequired,
|
|
@@ -359,7 +394,8 @@ _define_property(QuizEntryEditFooter, "propTypes", {
|
|
|
359
394
|
workingEntry: ImmutablePropTypes.record.isRequired,
|
|
360
395
|
// This prop is flagged as unused, but it is actually used
|
|
361
396
|
workingQuizEntry: ImmutablePropTypes.record.isRequired,
|
|
362
|
-
styles: PropTypes.object
|
|
397
|
+
styles: PropTypes.object,
|
|
398
|
+
isSurvey: PropTypes.bool.isRequired
|
|
363
399
|
});
|
|
364
400
|
_define_property(QuizEntryEditFooter, "defaultProps", {
|
|
365
401
|
alternativeRightFooter: null,
|
|
@@ -74,6 +74,7 @@ function mapDispatchToProps(dispatch) {
|
|
|
74
74
|
newActiveBank: bindActionCreators(newActiveBank, dispatch),
|
|
75
75
|
changeItemTitle: boundModificationActions.changeItemTitle,
|
|
76
76
|
changeQuizEntryPoints: boundModificationActions.changeQuizEntryPoints,
|
|
77
|
+
changeQuizEntryProperties: boundModificationActions.changeQuizEntryProperties,
|
|
77
78
|
clearModifications: boundModificationActions.clearModifications,
|
|
78
79
|
clearTemporaryItem: boundModificationActions.clearTemporaryItem,
|
|
79
80
|
clearNextQuizEntry: boundModificationActions.clearNextQuizEntry,
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _instanceof(left, right) {
|
|
15
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
16
|
+
return !!right[Symbol.hasInstance](left);
|
|
17
|
+
} else {
|
|
18
|
+
return left instanceof right;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function _object_spread(target) {
|
|
22
|
+
for(var i = 1; i < arguments.length; i++){
|
|
23
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
24
|
+
var ownKeys = Object.keys(source);
|
|
25
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
26
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
27
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
ownKeys.forEach(function(key) {
|
|
31
|
+
_define_property(target, key, source[key]);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
}
|
|
36
|
+
import React from 'react';
|
|
37
|
+
import PropTypes from 'prop-types';
|
|
38
|
+
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
39
|
+
import t from '@instructure/quiz-i18n/format-message';
|
|
40
|
+
import { IconBankLine, IconAiColoredSolid } from '@instructure/ui-icons';
|
|
41
|
+
import { Flex } from '@instructure/quiz-common';
|
|
42
|
+
import { TruncateText } from '@instructure/ui-truncate-text';
|
|
43
|
+
import { Text } from '@instructure/ui-text';
|
|
44
|
+
import { View } from '@instructure/ui-view';
|
|
45
|
+
import { Tooltip } from '@instructure/ui-tooltip';
|
|
46
|
+
import { Item } from '../../../../../../common/records';
|
|
47
|
+
function QuizEntryLeftHeaderText(param) {
|
|
48
|
+
var content = param.content, textProps = param.textProps, viewProps = param.viewProps;
|
|
49
|
+
return /*#__PURE__*/ React.createElement(View, _object_spread({
|
|
50
|
+
as: "div"
|
|
51
|
+
}, viewProps), /*#__PURE__*/ React.createElement(TruncateText, {
|
|
52
|
+
color: "secondary"
|
|
53
|
+
}, /*#__PURE__*/ React.createElement(Text, _object_spread({
|
|
54
|
+
color: "secondary",
|
|
55
|
+
size: "small"
|
|
56
|
+
}, textProps), content)));
|
|
57
|
+
}
|
|
58
|
+
QuizEntryLeftHeaderText.propTypes = {
|
|
59
|
+
content: PropTypes.string.isRequired,
|
|
60
|
+
textProps: PropTypes.shape(Text.propTypes),
|
|
61
|
+
viewProps: PropTypes.shape(View.propTypes)
|
|
62
|
+
};
|
|
63
|
+
function BankedContent(param) {
|
|
64
|
+
var quizEntry = param.quizEntry;
|
|
65
|
+
if (!quizEntry.isBank && !quizEntry.isBankEntry) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
69
|
+
stacking: "topmost"
|
|
70
|
+
}, /*#__PURE__*/ React.createElement(IconBankLine, null));
|
|
71
|
+
}
|
|
72
|
+
function AiGeneratedContent() {
|
|
73
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
74
|
+
stacking: "topmost"
|
|
75
|
+
}, /*#__PURE__*/ React.createElement(Tooltip, {
|
|
76
|
+
renderTip: t('This question was generated using AI'),
|
|
77
|
+
placement: "top center",
|
|
78
|
+
on: [
|
|
79
|
+
'hover',
|
|
80
|
+
'focus'
|
|
81
|
+
]
|
|
82
|
+
}, /*#__PURE__*/ React.createElement(IconAiColoredSolid, {
|
|
83
|
+
color: "primary",
|
|
84
|
+
"aria-label": t('This question was generated using AI')
|
|
85
|
+
})));
|
|
86
|
+
}
|
|
87
|
+
export function InteractionTypeName(param) {
|
|
88
|
+
var name = param.name, _param_defaultValue = param.defaultValue, defaultValue = _param_defaultValue === void 0 ? null : _param_defaultValue, textProps = param.textProps;
|
|
89
|
+
if (!name && !defaultValue) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
var interactionName = name || defaultValue;
|
|
93
|
+
return /*#__PURE__*/ React.createElement(QuizEntryLeftHeaderText, {
|
|
94
|
+
content: interactionName,
|
|
95
|
+
viewProps: {
|
|
96
|
+
'data-automation': 'sdk-interaction-type-name-div'
|
|
97
|
+
},
|
|
98
|
+
textProps: textProps
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
InteractionTypeName.propTypes = {
|
|
102
|
+
name: PropTypes.string.isRequired,
|
|
103
|
+
defaultValue: PropTypes.string,
|
|
104
|
+
textProps: PropTypes.shape(Text.propTypes)
|
|
105
|
+
};
|
|
106
|
+
export function RequiredIndicator() {
|
|
107
|
+
return /*#__PURE__*/ React.createElement(QuizEntryLeftHeaderText, {
|
|
108
|
+
content: t('(Required)'),
|
|
109
|
+
textProps: {
|
|
110
|
+
fontStyle: 'italic'
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
export function PointsPossible(param) {
|
|
115
|
+
var pointsPossible = param.pointsPossible;
|
|
116
|
+
return /*#__PURE__*/ React.createElement(QuizEntryLeftHeaderText, {
|
|
117
|
+
content: t("{\n points, plural,\n one {# point}\n other {# points}\n }", {
|
|
118
|
+
points: pointsPossible || 0
|
|
119
|
+
}),
|
|
120
|
+
viewProps: {
|
|
121
|
+
className: 'points',
|
|
122
|
+
'data-automation': 'sdk-points-possible-div'
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
export function LeftHeader(param) {
|
|
127
|
+
var quizEntry = param.quizEntry, entry = param.entry, interactionTypeName = param.interactionTypeName, isSurvey = param.isSurvey;
|
|
128
|
+
return /*#__PURE__*/ React.createElement(Flex, {
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
height: "100%",
|
|
131
|
+
gap: "mediumSmall"
|
|
132
|
+
}, /*#__PURE__*/ React.createElement(BankedContent, {
|
|
133
|
+
quizEntry: quizEntry
|
|
134
|
+
}), quizEntry.isAiGenerated && /*#__PURE__*/ React.createElement(AiGeneratedContent, null), _instanceof(entry, Item) && /*#__PURE__*/ React.createElement(InteractionTypeName, {
|
|
135
|
+
name: entry.getInteractionType().name,
|
|
136
|
+
defaultValue: interactionTypeName
|
|
137
|
+
}), !isSurvey && /*#__PURE__*/ React.createElement(PointsPossible, {
|
|
138
|
+
pointsPossible: quizEntry.pointsPossible
|
|
139
|
+
}), entry.title && /*#__PURE__*/ React.createElement(QuizEntryLeftHeaderText, {
|
|
140
|
+
content: entry.title,
|
|
141
|
+
viewProps: {
|
|
142
|
+
'data-automation': 'sdk-quiz-entry-title-div'
|
|
143
|
+
}
|
|
144
|
+
}), quizEntry.isRequired && /*#__PURE__*/ React.createElement(RequiredIndicator, null));
|
|
145
|
+
}
|
|
146
|
+
LeftHeader.propTypes = {
|
|
147
|
+
entry: ImmutablePropTypes.record.isRequired,
|
|
148
|
+
quizEntry: ImmutablePropTypes.record.isRequired,
|
|
149
|
+
isSurvey: PropTypes.bool,
|
|
150
|
+
interactionTypeName: PropTypes.string
|
|
151
|
+
};
|
|
@@ -5,7 +5,7 @@ import { createItem } from '../../../../../common/actions/modifications';
|
|
|
5
5
|
import { removeQuizEntry } from '../../../../api/quizEntries';
|
|
6
6
|
import { withConfirm } from '../../../../../common/actions/modal';
|
|
7
7
|
import { QuizEntryShowPresenter } from './presenter';
|
|
8
|
-
import { getQuizEntryWithErrorsShowing } from '../../../../../common/selectors/quizzes';
|
|
8
|
+
import { getQuizEntryWithErrorsShowing, getActiveQuiz } from '../../../../../common/selectors/quizzes';
|
|
9
9
|
import { CREATE_ITEM_CALL, UPDATE_ITEM_CALL } from '@instructure/quiz-common';
|
|
10
10
|
import { featureOn } from '../../../../../common/util/featureCheck';
|
|
11
11
|
function mapStateToProps(state, props) {
|
|
@@ -31,6 +31,8 @@ function mapStateToProps(state, props) {
|
|
|
31
31
|
], Map()).find(function(interactionType) {
|
|
32
32
|
return interactionType.get('slug') === 'rich-fill-blank';
|
|
33
33
|
});
|
|
34
|
+
var quiz = getActiveQuiz(state);
|
|
35
|
+
var isSurvey = quiz.isSurvey();
|
|
34
36
|
return {
|
|
35
37
|
createItemCallStatus: state.getIn([
|
|
36
38
|
'calls',
|
|
@@ -48,7 +50,8 @@ function mapStateToProps(state, props) {
|
|
|
48
50
|
'calls',
|
|
49
51
|
UPDATE_ITEM_CALL,
|
|
50
52
|
'requestStatus'
|
|
51
|
-
], '')
|
|
53
|
+
], ''),
|
|
54
|
+
isSurvey: isSurvey
|
|
52
55
|
};
|
|
53
56
|
}
|
|
54
57
|
var mapDispatchToProps = {
|
|
@@ -130,25 +130,17 @@ function _is_native_reflect_construct() {
|
|
|
130
130
|
return !!result;
|
|
131
131
|
})();
|
|
132
132
|
}
|
|
133
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
134
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
135
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
136
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
137
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
138
|
-
}
|
|
139
133
|
import { Component } from 'react';
|
|
140
134
|
import PropTypes from 'prop-types';
|
|
141
135
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
142
136
|
import partial from 'lodash/partial';
|
|
143
137
|
import { DragSource } from 'react-dnd';
|
|
144
|
-
import { IconAiColoredSolid, IconBankLine } from '@instructure/ui-icons';
|
|
145
138
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
146
139
|
import { jsx } from '@instructure/emotion';
|
|
147
140
|
import { FillBlankInteractionType } from '@instructure/quiz-interactions';
|
|
148
|
-
import { TOP, withStyleOverrides } from '@instructure/quiz-common';
|
|
141
|
+
import { TOP, withStyleOverrides, Flex } from '@instructure/quiz-common';
|
|
149
142
|
import t from '@instructure/quiz-i18n/format-message';
|
|
150
143
|
import { convertFITBtoRich } from '../../../../../common/util/fitbCopyHelper';
|
|
151
|
-
import Item from '../../../../../common/records/Item';
|
|
152
144
|
import Overlay from '../../../../../common/components/shared/overlay';
|
|
153
145
|
import ActionButtons from '../../ActionButtons';
|
|
154
146
|
import { ItemTypes, dragSource, collectDrag } from '../../../../../common/components/shared/drag_and_drop/dragAndDropUtils';
|
|
@@ -156,15 +148,14 @@ import PositionBox from '../../../../../common/components/resources/positionBox/
|
|
|
156
148
|
import DragAndDropZone from '../../../../../common/components/shared/drag_and_drop/DragAndDropZone';
|
|
157
149
|
import generateStyle from './styles';
|
|
158
150
|
import generateComponentTheme from './theme';
|
|
159
|
-
import {
|
|
160
|
-
|
|
161
|
-
var QuizEntryShow = /*#__PURE__*/ function(Component) {
|
|
151
|
+
import { LeftHeader } from './components/LeftHeader';
|
|
152
|
+
var BaseQuizEntryShow = /*#__PURE__*/ function(Component) {
|
|
162
153
|
"use strict";
|
|
163
|
-
_inherits(
|
|
164
|
-
function
|
|
165
|
-
_class_call_check(this,
|
|
154
|
+
_inherits(BaseQuizEntryShow, Component);
|
|
155
|
+
function BaseQuizEntryShow() {
|
|
156
|
+
_class_call_check(this, BaseQuizEntryShow);
|
|
166
157
|
var _this;
|
|
167
|
-
_this = _call_super(this,
|
|
158
|
+
_this = _call_super(this, BaseQuizEntryShow, arguments), _define_property(_this, "state", {
|
|
168
159
|
editAfterCall: null,
|
|
169
160
|
copyAfterCall: null
|
|
170
161
|
}), _define_property(_this, "editingOn", function() {
|
|
@@ -215,7 +206,7 @@ var QuizEntryShow = /*#__PURE__*/ function(Component) {
|
|
|
215
206
|
});
|
|
216
207
|
return _this;
|
|
217
208
|
}
|
|
218
|
-
_create_class(
|
|
209
|
+
_create_class(BaseQuizEntryShow, [
|
|
219
210
|
{
|
|
220
211
|
key: "componentDidUpdate",
|
|
221
212
|
value: function componentDidUpdate() {
|
|
@@ -266,14 +257,6 @@ var QuizEntryShow = /*#__PURE__*/ function(Component) {
|
|
|
266
257
|
return false;
|
|
267
258
|
}
|
|
268
259
|
},
|
|
269
|
-
{
|
|
270
|
-
key: "getPointsText",
|
|
271
|
-
value: function getPointsText(points) {
|
|
272
|
-
return t("{\n points, plural,\n one {# point}\n other {# points}\n }", {
|
|
273
|
-
points: points
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
260
|
{
|
|
278
261
|
key: "removalDialogData",
|
|
279
262
|
value: function removalDialogData() {
|
|
@@ -291,71 +274,6 @@ var QuizEntryShow = /*#__PURE__*/ function(Component) {
|
|
|
291
274
|
return this.props.quizEntries.size === 1;
|
|
292
275
|
}
|
|
293
276
|
},
|
|
294
|
-
{
|
|
295
|
-
key: "renderPointsPossible",
|
|
296
|
-
value: function renderPointsPossible() {
|
|
297
|
-
if (_instanceof(this.props.entry, Item)) {
|
|
298
|
-
var pointsPossible = this.props.quizEntry.pointsPossible;
|
|
299
|
-
return /*#__PURE__*/ jsx("div", {
|
|
300
|
-
className: "points",
|
|
301
|
-
css: this.props.styles.points,
|
|
302
|
-
"data-automation": "sdk-points-possible-div"
|
|
303
|
-
}, this.getPointsText(pointsPossible || 0));
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
key: "renderInteractionType",
|
|
309
|
-
value: function renderInteractionType() {
|
|
310
|
-
if (_instanceof(this.props.entry, Item)) {
|
|
311
|
-
var interactionTypeName = this.props.entry.getInteractionType().name || this.props.interactionTypeName;
|
|
312
|
-
return /*#__PURE__*/ jsx("div", {
|
|
313
|
-
css: this.props.styles.interactionTypeName,
|
|
314
|
-
"data-automation": "sdk-interaction-type-name-div"
|
|
315
|
-
}, interactionTypeName);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
key: "renderBankedContent",
|
|
321
|
-
value: function renderBankedContent() {
|
|
322
|
-
if (this.props.quizEntry.isBank || this.props.quizEntry.isBankEntry) {
|
|
323
|
-
return /*#__PURE__*/ jsx(IconBankLine, null);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
key: "renderAiGeneratedContent",
|
|
329
|
-
value: function renderAiGeneratedContent() {
|
|
330
|
-
if (!this.props.quizEntry.isAiGenerated) {
|
|
331
|
-
return null;
|
|
332
|
-
}
|
|
333
|
-
return /*#__PURE__*/ jsx(View, {
|
|
334
|
-
stacking: "topmost"
|
|
335
|
-
}, /*#__PURE__*/ jsx(Tooltip, {
|
|
336
|
-
renderTip: t('This question was generated using AI'),
|
|
337
|
-
placement: "top center",
|
|
338
|
-
on: [
|
|
339
|
-
'hover',
|
|
340
|
-
'focus'
|
|
341
|
-
]
|
|
342
|
-
}, /*#__PURE__*/ jsx(IconAiColoredSolid, {
|
|
343
|
-
color: "primary",
|
|
344
|
-
"aria-label": t('This question was generated using AI')
|
|
345
|
-
})));
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
key: "renderLeftHeader",
|
|
350
|
-
value: function renderLeftHeader() {
|
|
351
|
-
return /*#__PURE__*/ jsx("div", {
|
|
352
|
-
css: this.props.styles.leftHeader
|
|
353
|
-
}, this.renderBankedContent(), this.renderAiGeneratedContent(), this.renderInteractionType(), this.renderPointsPossible(), /*#__PURE__*/ jsx("div", {
|
|
354
|
-
css: this.props.styles.title,
|
|
355
|
-
"data-automation": "sdk-quiz-entry-title-div"
|
|
356
|
-
}, this.props.entry.title));
|
|
357
|
-
}
|
|
358
|
-
},
|
|
359
277
|
{
|
|
360
278
|
key: "setInert",
|
|
361
279
|
value: function setInert(node) {
|
|
@@ -365,7 +283,7 @@ var QuizEntryShow = /*#__PURE__*/ function(Component) {
|
|
|
365
283
|
{
|
|
366
284
|
key: "render",
|
|
367
285
|
value: function render() {
|
|
368
|
-
var _this_props = this.props, connectDragPreview = _this_props.connectDragPreview, displayPosition = _this_props.displayPosition, draggingOver = _this_props.draggingOver, draggingAboveHalf = _this_props.draggingAboveHalf, quizEntry = _this_props.quizEntry, stimulusOrientation = _this_props.stimulusOrientation, isContentLockedByBlueprint = _this_props.isContentLockedByBlueprint, lockBlueprintContentEnabled = _this_props.lockBlueprintContentEnabled;
|
|
286
|
+
var _this_props = this.props, connectDragPreview = _this_props.connectDragPreview, displayPosition = _this_props.displayPosition, draggingOver = _this_props.draggingOver, draggingAboveHalf = _this_props.draggingAboveHalf, quizEntry = _this_props.quizEntry, stimulusOrientation = _this_props.stimulusOrientation, isContentLockedByBlueprint = _this_props.isContentLockedByBlueprint, lockBlueprintContentEnabled = _this_props.lockBlueprintContentEnabled, interactionTypeName = _this_props.interactionTypeName, entry = _this_props.entry, isSurvey = _this_props.isSurvey;
|
|
369
287
|
var positionToDisplay = this.props.quizEntry.positionToDisplay(displayPosition);
|
|
370
288
|
var positionText = t('Preview of question at position {position}', {
|
|
371
289
|
position: positionToDisplay
|
|
@@ -398,7 +316,16 @@ var QuizEntryShow = /*#__PURE__*/ function(Component) {
|
|
|
398
316
|
position: positionToDisplay,
|
|
399
317
|
headingText: positionText,
|
|
400
318
|
headingLevel: quizEntry.isInStimulus ? 'h3' : 'h2'
|
|
401
|
-
}),
|
|
319
|
+
}), /*#__PURE__*/ jsx(Flex.Item, {
|
|
320
|
+
shouldGrow: true,
|
|
321
|
+
overflowX: "hidden",
|
|
322
|
+
overflowY: "hidden"
|
|
323
|
+
}, /*#__PURE__*/ jsx(LeftHeader, {
|
|
324
|
+
quizEntry: quizEntry,
|
|
325
|
+
entry: entry,
|
|
326
|
+
interactionTypeName: interactionTypeName,
|
|
327
|
+
isSurvey: isSurvey
|
|
328
|
+
})), /*#__PURE__*/ jsx(ActionButtons, {
|
|
402
329
|
connectDragSource: this.props.connectDragSource,
|
|
403
330
|
displayPosition: this.props.displayPosition,
|
|
404
331
|
onDelete: this.removeItem,
|
|
@@ -422,11 +349,11 @@ var QuizEntryShow = /*#__PURE__*/ function(Component) {
|
|
|
422
349
|
}
|
|
423
350
|
}
|
|
424
351
|
]);
|
|
425
|
-
return
|
|
352
|
+
return BaseQuizEntryShow;
|
|
426
353
|
}(Component);
|
|
427
|
-
_define_property(
|
|
428
|
-
_define_property(
|
|
429
|
-
_define_property(
|
|
354
|
+
_define_property(BaseQuizEntryShow, "displayName", 'QuizEntryShow');
|
|
355
|
+
_define_property(BaseQuizEntryShow, "componentId", "Quizzes".concat(BaseQuizEntryShow.displayName));
|
|
356
|
+
_define_property(BaseQuizEntryShow, "propTypes", {
|
|
430
357
|
children: PropTypes.oneOfType([
|
|
431
358
|
PropTypes.arrayOf(PropTypes.node),
|
|
432
359
|
PropTypes.node
|
|
@@ -461,9 +388,10 @@ _define_property(QuizEntryShow, "propTypes", {
|
|
|
461
388
|
switchOnEditing: PropTypes.func.isRequired,
|
|
462
389
|
updateItemCallStatus: PropTypes.string.isRequired,
|
|
463
390
|
withConfirm: PropTypes.func.isRequired,
|
|
464
|
-
styles: PropTypes.object
|
|
391
|
+
styles: PropTypes.object,
|
|
392
|
+
isSurvey: PropTypes.bool
|
|
465
393
|
});
|
|
466
|
-
_define_property(
|
|
394
|
+
_define_property(BaseQuizEntryShow, "defaultProps", {
|
|
467
395
|
children: null,
|
|
468
396
|
draggingOver: false,
|
|
469
397
|
draggingAboveHalf: false,
|
|
@@ -478,9 +406,6 @@ _define_property(QuizEntryShow, "defaultProps", {
|
|
|
478
406
|
richFITBInteractionID: '',
|
|
479
407
|
stimulusOrientation: null
|
|
480
408
|
});
|
|
481
|
-
QuizEntryShow =
|
|
482
|
-
withStyleOverrides(generateStyle, generateComponentTheme)
|
|
483
|
-
], QuizEntryShow);
|
|
484
|
-
export var QuizEntryShowRaw = QuizEntryShow;
|
|
409
|
+
export var QuizEntryShow = withStyleOverrides(generateStyle, generateComponentTheme)(BaseQuizEntryShow);
|
|
485
410
|
export var QuizEntryShowPresenter = DragSource(ItemTypes.QUIZ_ENTRY, dragSource, collectDrag)(QuizEntryShow);
|
|
486
411
|
export default QuizEntryShowPresenter;
|
|
@@ -52,15 +52,6 @@ function _object_spread_props(target, source) {
|
|
|
52
52
|
}
|
|
53
53
|
var generateStyle = function(componentTheme) {
|
|
54
54
|
var mp = '@media print';
|
|
55
|
-
var interactionTypeStyles = {
|
|
56
|
-
color: componentTheme.titleInteractionTypeNamePointsColor,
|
|
57
|
-
fontSize: componentTheme.titleInteractionTypeNamePointsFontSize,
|
|
58
|
-
marginLeft: componentTheme.titleInteractionTypeNamePointsLeftMargin,
|
|
59
|
-
marginRight: componentTheme.titleInteractionTypeNamePointsRightMargin,
|
|
60
|
-
textOverflow: 'ellipsis',
|
|
61
|
-
overflow: 'hidden',
|
|
62
|
-
whiteSpace: 'nowrap'
|
|
63
|
-
};
|
|
64
55
|
var optionsButtonDragDropStyle = {
|
|
65
56
|
backgroundColor: 'transparent',
|
|
66
57
|
border: 'none',
|
|
@@ -116,9 +107,6 @@ var generateStyle = function(componentTheme) {
|
|
|
116
107
|
backgroundColor: 'initial'
|
|
117
108
|
}
|
|
118
109
|
},
|
|
119
|
-
title: interactionTypeStyles,
|
|
120
|
-
interactionTypeName: interactionTypeStyles,
|
|
121
|
-
points: interactionTypeStyles,
|
|
122
110
|
itemHolder: {
|
|
123
111
|
overflowWrap: 'anywhere',
|
|
124
112
|
margin: componentTheme.itemHolderMargin
|
|
@@ -11,7 +11,8 @@ export function withConfirm(onContinue) {
|
|
|
11
11
|
continueVariant: void 0,
|
|
12
12
|
cancelText: void 0,
|
|
13
13
|
size: void 0,
|
|
14
|
-
shouldReturnFocus: true
|
|
14
|
+
shouldReturnFocus: true,
|
|
15
|
+
submitButtonDisabled: false
|
|
15
16
|
};
|
|
16
17
|
var modalOptions = Object.assign({}, defaultConfirmOptions, opts);
|
|
17
18
|
return {
|
|
@@ -30,7 +30,7 @@ import { bindActionCreators } from 'redux';
|
|
|
30
30
|
import { Map } from 'immutable';
|
|
31
31
|
import { connect } from '../../react-redux';
|
|
32
32
|
import { closeModal } from '../../actions/modal';
|
|
33
|
-
import ConfirmationModal from './presenter';
|
|
33
|
+
import { ConfirmationModal } from './presenter';
|
|
34
34
|
var mapStateToProps = function(state) {
|
|
35
35
|
var modal = state.get('modal');
|
|
36
36
|
return _object_spread({
|