@instructure/quiz-core 22.16.0 → 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/banks/components/BankEntry/presenter.js +1 -1
- package/es/banks/components/SharingModal/presenter.js +1 -1
- 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/ApiFeatureFlagInitializer/index.js +1 -1
- package/es/common/components/ConfirmationModal/index.js +1 -1
- package/es/common/components/ConfirmationModal/presenter.js +49 -169
- package/es/common/components/RceConfigProvider/presenter.js +1 -1
- package/es/common/components/SDKApp/index.js +38 -39
- 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/components/shared/PaginatedCollection/presenter.js +1 -1
- package/es/common/components/shared/PrintTrigger/presenter.js +1 -1
- package/es/common/components/shared/spinner/Spinner.js +15 -16
- 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 +6 -4
- package/es/moderating/components/resources/ModerateTable/presenter.js +15 -10
- 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/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +1 -1
- package/es/reporting/components/quizAnalysis/QuizAnalysisOverview.js +1 -1
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +1 -1
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +4 -4
- package/es/reporting/components/resources/QuizAndItemAnalysis/presenter.js +1 -1
- package/es/reporting/components/resources/StudentAnalysis/ReportCard/presenter.js +1 -1
- package/es/taking/api/taking.js +45 -10
- package/lib/banks/components/BankEntry/presenter.js +1 -1
- package/lib/banks/components/SharingModal/presenter.js +1 -1
- 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/ApiFeatureFlagInitializer/index.js +1 -1
- package/lib/common/components/ConfirmationModal/index.js +1 -1
- package/lib/common/components/ConfirmationModal/presenter.js +49 -169
- package/lib/common/components/RceConfigProvider/presenter.js +1 -1
- package/lib/common/components/SDKApp/index.js +38 -39
- 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/components/shared/PaginatedCollection/presenter.js +1 -1
- package/lib/common/components/shared/PrintTrigger/presenter.js +1 -1
- package/lib/common/components/shared/spinner/Spinner.js +15 -16
- 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 +6 -4
- package/lib/moderating/components/resources/ModerateTable/presenter.js +15 -10
- 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/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +1 -1
- package/lib/reporting/components/quizAnalysis/QuizAnalysisOverview.js +1 -1
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +1 -1
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +4 -4
- package/lib/reporting/components/resources/QuizAndItemAnalysis/presenter.js +1 -1
- package/lib/reporting/components/resources/StudentAnalysis/ReportCard/presenter.js +1 -1
- 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
|
@@ -8,6 +8,7 @@ import { set } from '../../../../common/actions/ui';
|
|
|
8
8
|
import { getModalTrigger } from '../../../../common/util/modalHelpers';
|
|
9
9
|
import { generateImportModalId } from '../../../../common/components/ImportModal';
|
|
10
10
|
import { ITEM_FEEDBACK_MODAL, ITEM_FEEDBACK_MODAL_ITEM, ITEM_FEEDBACK_MODAL_FEEDBACK } from '@instructure/quiz-common';
|
|
11
|
+
import { getActiveQuiz } from '../../../../common/selectors/quizzes';
|
|
11
12
|
function mapStateToProps(state, props) {
|
|
12
13
|
var nestedModals = [
|
|
13
14
|
'correct',
|
|
@@ -19,6 +20,7 @@ function mapStateToProps(state, props) {
|
|
|
19
20
|
'isOpen'
|
|
20
21
|
]);
|
|
21
22
|
var importModalOpen = nestedModals.includes(openModal);
|
|
23
|
+
var quiz = getActiveQuiz(state);
|
|
22
24
|
return {
|
|
23
25
|
importModalOpen: importModalOpen,
|
|
24
26
|
modalOpen: openModal === ITEM_FEEDBACK_MODAL,
|
|
@@ -30,7 +32,8 @@ function mapStateToProps(state, props) {
|
|
|
30
32
|
'ui',
|
|
31
33
|
ITEM_FEEDBACK_MODAL_FEEDBACK
|
|
32
34
|
]) || Map(),
|
|
33
|
-
modalTrigger: getModalTrigger(state)
|
|
35
|
+
modalTrigger: getModalTrigger(state),
|
|
36
|
+
isSurvey: quiz.isSurvey()
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
var mapDispatchToProps = {
|
|
@@ -84,23 +84,27 @@ function _is_native_reflect_construct() {
|
|
|
84
84
|
return !!result;
|
|
85
85
|
})();
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
89
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
90
|
-
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;
|
|
91
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
92
|
-
}
|
|
93
|
-
import { Component } from 'react';
|
|
87
|
+
import React, { Component } from 'react';
|
|
94
88
|
import PropTypes from 'prop-types';
|
|
95
89
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
96
90
|
import { Button, CloseButton } from '@instructure/ui-buttons';
|
|
91
|
+
import { View } from '@instructure/ui-view';
|
|
97
92
|
import { Heading } from '@instructure/ui-heading';
|
|
98
93
|
import { jsx } from '@instructure/emotion';
|
|
99
94
|
import { RichContentRenderer, RichContentInput, RCE_THREE_LINES_HEIGHT } from '@instructure/quiz-rce';
|
|
100
95
|
import t from '@instructure/quiz-i18n/format-message';
|
|
101
|
-
import { Modal, ModalHeader, ModalBody, ModalFooter, ITEM_FEEDBACK_MODAL_FEEDBACK, XSMALL_SIDE_MARGIN
|
|
102
|
-
|
|
103
|
-
|
|
96
|
+
import { Modal, ModalHeader, ModalBody, ModalFooter, ITEM_FEEDBACK_MODAL_FEEDBACK, XSMALL_SIDE_MARGIN } from '@instructure/quiz-common';
|
|
97
|
+
function FeedbackInput(param) {
|
|
98
|
+
var textAreaId = param.textAreaId, label = param.label, content = param.content, onChange = param.onChange;
|
|
99
|
+
return /*#__PURE__*/ jsx(RichContentInput, {
|
|
100
|
+
textareaId: textAreaId,
|
|
101
|
+
label: label,
|
|
102
|
+
plainTextLabel: label,
|
|
103
|
+
defaultContent: content,
|
|
104
|
+
onChange: onChange,
|
|
105
|
+
height: RCE_THREE_LINES_HEIGHT
|
|
106
|
+
});
|
|
107
|
+
}
|
|
104
108
|
export var ItemFeedbackModal = /*#__PURE__*/ function(Component) {
|
|
105
109
|
"use strict";
|
|
106
110
|
_inherits(ItemFeedbackModal, Component);
|
|
@@ -145,35 +149,12 @@ export var ItemFeedbackModal = /*#__PURE__*/ function(Component) {
|
|
|
145
149
|
}, t('Done'));
|
|
146
150
|
}
|
|
147
151
|
},
|
|
148
|
-
{
|
|
149
|
-
key: "renderRichContentInput",
|
|
150
|
-
value: function renderRichContentInput(key, label) {
|
|
151
|
-
return /*#__PURE__*/ jsx("div", null, /*#__PURE__*/ jsx("br", null), /*#__PURE__*/ jsx("label", {
|
|
152
|
-
css: this.props.styles.feedbackLabel,
|
|
153
|
-
htmlFor: key
|
|
154
|
-
}, label), /*#__PURE__*/ jsx(RichContentInput, {
|
|
155
|
-
label: "",
|
|
156
|
-
textareaId: key,
|
|
157
|
-
defaultContent: this.props.feedback.get(key),
|
|
158
|
-
onChange: this.onFeedbackWrapper(key),
|
|
159
|
-
height: RCE_THREE_LINES_HEIGHT
|
|
160
|
-
}));
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
key: "renderContent",
|
|
165
|
-
value: function renderContent() {
|
|
166
|
-
return /*#__PURE__*/ jsx("div", null, /*#__PURE__*/ jsx(RichContentRenderer, {
|
|
167
|
-
customStyles: this.props.styles.itemStem,
|
|
168
|
-
content: this.props.item.itemBody
|
|
169
|
-
}), this.renderRichContentInput('correct', t('For a correct answer')), this.renderRichContentInput('incorrect', t('For an incorrect answer')), this.renderRichContentInput('neutral', t('Provide general feedback (regardless of answer)')));
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
152
|
{
|
|
173
153
|
key: "render",
|
|
174
154
|
value: function render() {
|
|
175
|
-
|
|
176
|
-
|
|
155
|
+
var _this_props = this.props, modalOpen = _this_props.modalOpen, importModalOpen = _this_props.importModalOpen, feedback = _this_props.feedback, item = _this_props.item, isSurvey = _this_props.isSurvey;
|
|
156
|
+
return /*#__PURE__*/ jsx(Modal, {
|
|
157
|
+
open: modalOpen || importModalOpen,
|
|
177
158
|
onClose: this.closeAction,
|
|
178
159
|
size: "large",
|
|
179
160
|
label: t('Student Feedback'),
|
|
@@ -187,7 +168,32 @@ export var ItemFeedbackModal = /*#__PURE__*/ function(Component) {
|
|
|
187
168
|
placement: "end",
|
|
188
169
|
offset: "medium",
|
|
189
170
|
screenReaderLabel: t('Close')
|
|
190
|
-
})), /*#__PURE__*/ jsx(ModalBody, null,
|
|
171
|
+
})), /*#__PURE__*/ jsx(ModalBody, null, /*#__PURE__*/ jsx(View, {
|
|
172
|
+
as: "div",
|
|
173
|
+
margin: "0 0 medium 0"
|
|
174
|
+
}, /*#__PURE__*/ jsx(RichContentRenderer, {
|
|
175
|
+
customStyles: {
|
|
176
|
+
whiteSpace: 'nowrap',
|
|
177
|
+
overflow: 'hidden',
|
|
178
|
+
textOverflow: 'ellipsis'
|
|
179
|
+
},
|
|
180
|
+
content: item.itemBody
|
|
181
|
+
})), !isSurvey && /*#__PURE__*/ jsx(React.Fragment, null, /*#__PURE__*/ jsx(FeedbackInput, {
|
|
182
|
+
textAreaId: "correct",
|
|
183
|
+
label: t('For a correct answer'),
|
|
184
|
+
content: feedback.get('correct'),
|
|
185
|
+
onChange: this.onFeedbackWrapper('correct')
|
|
186
|
+
}), /*#__PURE__*/ jsx(FeedbackInput, {
|
|
187
|
+
textAreaId: "incorrect",
|
|
188
|
+
label: t('For an incorrect answer'),
|
|
189
|
+
content: feedback.get('incorrect'),
|
|
190
|
+
onChange: this.onFeedbackWrapper('incorrect')
|
|
191
|
+
})), /*#__PURE__*/ jsx(FeedbackInput, {
|
|
192
|
+
textAreaId: "neutral",
|
|
193
|
+
label: t('Provide general feedback (regardless of answer)'),
|
|
194
|
+
content: feedback.get('neutral'),
|
|
195
|
+
onChange: this.onFeedbackWrapper('neutral')
|
|
196
|
+
})), /*#__PURE__*/ jsx(ModalFooter, null, this.cancelButton(), this.doneButton()));
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
199
|
]);
|
|
@@ -204,12 +210,9 @@ _define_property(ItemFeedbackModal, "propTypes", {
|
|
|
204
210
|
modalOpen: PropTypes.bool.isRequired,
|
|
205
211
|
setUi: PropTypes.func.isRequired,
|
|
206
212
|
modalTrigger: PropTypes.instanceOf(Component),
|
|
207
|
-
|
|
213
|
+
isSurvey: PropTypes.bool.isRequired
|
|
208
214
|
});
|
|
209
215
|
_define_property(ItemFeedbackModal, "defaultProps", {
|
|
210
216
|
modalTrigger: null
|
|
211
217
|
});
|
|
212
|
-
ItemFeedbackModal = _ts_decorate([
|
|
213
|
-
withStyleOverrides(generateStyle, generateComponentTheme)
|
|
214
|
-
], ItemFeedbackModal);
|
|
215
218
|
export default ItemFeedbackModal;
|
|
@@ -58,7 +58,8 @@ export var mapStateToProps = function(state, props) {
|
|
|
58
58
|
tagAssociations: tagAssociations,
|
|
59
59
|
useBankTags: useBankTags,
|
|
60
60
|
workingEntry: entry.getWorkingInstance(),
|
|
61
|
-
workingQuizEntry: props.quizEntry.getWorkingInstance()
|
|
61
|
+
workingQuizEntry: props.quizEntry.getWorkingInstance(),
|
|
62
|
+
isSurvey: activeQuiz.isSurvey()
|
|
62
63
|
};
|
|
63
64
|
};
|
|
64
65
|
var dispatchToProps = {
|
|
@@ -265,7 +265,8 @@ export var QuizEntry = /*#__PURE__*/ function(Component) {
|
|
|
265
265
|
key: "additionalEditOptions",
|
|
266
266
|
value: function additionalEditOptions(item) {
|
|
267
267
|
var options = [];
|
|
268
|
-
|
|
268
|
+
// Don't show item banking options for surveys (both graded and ungraded)
|
|
269
|
+
if (this.props.quizEntry.entryType === 'Item' && !this.props.isSurvey) {
|
|
269
270
|
options.push({
|
|
270
271
|
key: 'banks',
|
|
271
272
|
title: t('Item Banking'),
|
|
@@ -293,7 +294,8 @@ export var QuizEntry = /*#__PURE__*/ function(Component) {
|
|
|
293
294
|
initialFocusId: this.props.initialFocusId,
|
|
294
295
|
validationErrorsFromApi: this.props.validationErrorsFromApi,
|
|
295
296
|
clearValidationErrorsFromApi: this.props.clearValidationErrorsFromApi,
|
|
296
|
-
separatorConfig: this.props.separatorConfig
|
|
297
|
+
separatorConfig: this.props.separatorConfig,
|
|
298
|
+
isSurvey: this.props.isSurvey
|
|
297
299
|
};
|
|
298
300
|
}
|
|
299
301
|
},
|
|
@@ -538,6 +540,7 @@ _define_property(QuizEntry, "propTypes", {
|
|
|
538
540
|
decimalSeparator: PropTypes.string,
|
|
539
541
|
thousandSeparator: PropTypes.string
|
|
540
542
|
}),
|
|
543
|
+
isSurvey: PropTypes.bool,
|
|
541
544
|
styles: PropTypes.object
|
|
542
545
|
});
|
|
543
546
|
_define_property(QuizEntry, "defaultProps", {
|
|
@@ -548,6 +551,7 @@ _define_property(QuizEntry, "defaultProps", {
|
|
|
548
551
|
initialFocusId: null,
|
|
549
552
|
isContentLockedByBlueprint: false,
|
|
550
553
|
isEditing: false,
|
|
554
|
+
isSurvey: false,
|
|
551
555
|
partialDeepScoringEnabled: false,
|
|
552
556
|
partialScoringEnabled: false,
|
|
553
557
|
scrollKey: void 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 = {
|