@instructure/quiz-core 22.0.0 → 22.2.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/AddBankEntryModal/presenter.js +4 -1
- package/es/banks/components/BankEntry/presenter.js +110 -12
- package/es/banks/components/BankEntryRow/presenter.js +52 -8
- package/es/banks/components/CopyMoveBankEntryModal/presenter.js +84 -15
- package/es/building/components/resources/DeleteStimulusModal/presenter.js +13 -7
- package/es/common/components/layout/sidebar/Stimulus/Collection/presenter.js +6 -3
- package/es/common/components/layout/sidebar/Stimulus/presenter.js +103 -40
- package/es/common/components/layout/sidebar/Stimulus/styles.js +2 -26
- package/es/common/components/layout/sidebar/Stimulus/theme.js +1 -10
- package/es/common/components/resources/BankSelection/presenter.js +31 -8
- package/es/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +20 -20
- package/es/common/components/resources/stimulus/Stimulus/presenter.js +2 -2
- package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +40 -37
- package/es/common/components/resources/stimulus/StimulusEditInfo/presenter.js +6 -5
- package/es/common/components/resources/stimulus/StimulusShow/index.js +1 -1
- package/es/common/components/resources/stimulus/StimulusShowInfo/index.js +1 -1
- package/es/common/components/shared/GenericAsyncSearch/GenericAsyncSearch.js +10 -3
- package/es/common/components/shared/InteractionTypes/presenter.js +3 -2
- package/es/common/components/shared/drag_and_drop/dragAndDropUtils.js +7 -0
- package/es/common/records/BankEntry.js +9 -1
- package/es/common/records/QuizEntry.js +29 -17
- package/es/common/records/SessionItem.js +6 -0
- package/es/common/reducers/modifications.js +21 -12
- package/es/common/util/warningHelpers.js +13 -3
- package/es/moderating/components/sidebar/ModerateTray/presenter.js +5 -5
- package/es/taking/api/taking.js +1 -1
- package/lib/banks/components/AddBankEntryModal/presenter.js +4 -1
- package/lib/banks/components/BankEntry/presenter.js +110 -12
- package/lib/banks/components/BankEntryRow/presenter.js +52 -8
- package/lib/banks/components/CopyMoveBankEntryModal/presenter.js +84 -15
- package/lib/building/components/resources/DeleteStimulusModal/presenter.js +13 -7
- package/lib/common/components/layout/sidebar/Stimulus/Collection/presenter.js +6 -3
- package/lib/common/components/layout/sidebar/Stimulus/presenter.js +103 -40
- package/lib/common/components/layout/sidebar/Stimulus/styles.js +2 -26
- package/lib/common/components/layout/sidebar/Stimulus/theme.js +1 -10
- package/lib/common/components/resources/BankSelection/presenter.js +31 -8
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +20 -20
- package/lib/common/components/resources/stimulus/Stimulus/presenter.js +2 -2
- package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +40 -37
- package/lib/common/components/resources/stimulus/StimulusEditInfo/presenter.js +6 -5
- package/lib/common/components/resources/stimulus/StimulusShow/index.js +1 -1
- package/lib/common/components/resources/stimulus/StimulusShowInfo/index.js +1 -1
- package/lib/common/components/shared/GenericAsyncSearch/GenericAsyncSearch.js +10 -3
- package/lib/common/components/shared/InteractionTypes/presenter.js +3 -2
- package/lib/common/components/shared/drag_and_drop/dragAndDropUtils.js +7 -0
- package/lib/common/records/BankEntry.js +9 -1
- package/lib/common/records/QuizEntry.js +29 -17
- package/lib/common/records/SessionItem.js +6 -0
- package/lib/common/reducers/modifications.js +21 -12
- package/lib/common/util/warningHelpers.js +13 -3
- package/lib/moderating/components/sidebar/ModerateTray/presenter.js +5 -5
- package/lib/taking/api/taking.js +1 -1
- package/package.json +8 -8
|
@@ -35,6 +35,8 @@ import t from '@instructure/quiz-i18n/es/format-message';
|
|
|
35
35
|
import { Flex, END_EDITING_TRIGGER_CLASSNAME, withStyleOverrides } from '@instructure/quiz-common';
|
|
36
36
|
import { Tooltip } from '@instructure/ui-tooltip';
|
|
37
37
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
38
|
+
import { View } from '@instructure/ui-view';
|
|
39
|
+
import { Text } from '@instructure/ui-text';
|
|
38
40
|
export var DISPLAY_AS_SUMMARY_LIMIT = 5;
|
|
39
41
|
export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateComponentTheme), _dec(_class = (_SidebarStimulus = /*#__PURE__*/function (_Component) {
|
|
40
42
|
function SidebarStimulus() {
|
|
@@ -64,18 +66,26 @@ export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateC
|
|
|
64
66
|
value: function componentDidUpdate() {
|
|
65
67
|
this.props.makeStyles();
|
|
66
68
|
}
|
|
69
|
+
}, {
|
|
70
|
+
key: "stimulusIsPassage",
|
|
71
|
+
value: function stimulusIsPassage() {
|
|
72
|
+
var _this$props$stimulus;
|
|
73
|
+
return (_this$props$stimulus = this.props.stimulus) === null || _this$props$stimulus === void 0 ? void 0 : _this$props$stimulus.isPassage;
|
|
74
|
+
}
|
|
67
75
|
}, {
|
|
68
76
|
key: "renderCollection",
|
|
69
77
|
value: function renderCollection() {
|
|
70
|
-
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
78
|
+
var _this$props$stimulus2;
|
|
73
79
|
var _this$props = this.props,
|
|
74
80
|
displayPosition = _this$props.displayPosition,
|
|
75
81
|
isOver = _this$props.isOver,
|
|
76
82
|
isShowingItems = _this$props.isShowingItems,
|
|
77
83
|
renderSidebarItem = _this$props.renderSidebarItem,
|
|
78
|
-
sidebarOpen = _this$props.sidebarOpen
|
|
84
|
+
sidebarOpen = _this$props.sidebarOpen,
|
|
85
|
+
isDragging = _this$props.isDragging;
|
|
86
|
+
if (this.stimulusIsPassage() || isDragging) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
79
89
|
return jsx(Collection, {
|
|
80
90
|
firstPosition: displayPosition,
|
|
81
91
|
isOver: isOver,
|
|
@@ -83,22 +93,33 @@ export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateC
|
|
|
83
93
|
itemCollection: this.props.childEntries,
|
|
84
94
|
renderSidebarItem: renderSidebarItem,
|
|
85
95
|
sidebarOpen: sidebarOpen,
|
|
86
|
-
stimulusId: this.props.stimulus.id
|
|
96
|
+
stimulusId: this.props.stimulus.id,
|
|
97
|
+
isPassage: (_this$props$stimulus2 = this.props.stimulus) === null || _this$props$stimulus2 === void 0 ? void 0 : _this$props$stimulus2.isPassage
|
|
87
98
|
});
|
|
88
99
|
}
|
|
89
100
|
}, {
|
|
90
101
|
key: "renderButton",
|
|
91
102
|
value: function renderButton() {
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
103
|
+
var _this$props2 = this.props,
|
|
104
|
+
displayPosition = _this$props2.displayPosition,
|
|
105
|
+
sidebarOpen = _this$props2.sidebarOpen;
|
|
106
|
+
var textForNavigation;
|
|
107
|
+
if (this.stimulusIsPassage()) {
|
|
108
|
+
textForNavigation = t('Navigate to text block');
|
|
109
|
+
} else {
|
|
110
|
+
textForNavigation = t('Navigate to stimulus at position {displayPosition}', {
|
|
111
|
+
displayPosition: displayPosition
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
var content = sidebarOpen ? '' : textForNavigation;
|
|
115
|
+
var tip = jsx(Text, {
|
|
116
|
+
"aria-hidden": !sidebarOpen,
|
|
117
|
+
"aria-label": content
|
|
118
|
+
}, content);
|
|
96
119
|
return jsx(Tooltip, {
|
|
97
|
-
renderTip:
|
|
98
|
-
"aria-hidden": "true"
|
|
99
|
-
}, textForNavigation),
|
|
120
|
+
renderTip: tip,
|
|
100
121
|
placement: "start",
|
|
101
|
-
on:
|
|
122
|
+
on: sidebarOpen ? [] : ['hover', 'focus']
|
|
102
123
|
}, jsx(Link, {
|
|
103
124
|
href: "#",
|
|
104
125
|
margin: "small",
|
|
@@ -110,33 +131,82 @@ export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateC
|
|
|
110
131
|
className: END_EDITING_TRIGGER_CLASSNAME
|
|
111
132
|
}, jsx(ScreenReaderContent, null, textForNavigation)));
|
|
112
133
|
}
|
|
134
|
+
}, {
|
|
135
|
+
key: "infoHeaderLabel",
|
|
136
|
+
value: function infoHeaderLabel() {
|
|
137
|
+
return this.stimulusIsPassage() ? t('Text Block') : t('Stimulus');
|
|
138
|
+
}
|
|
139
|
+
}, {
|
|
140
|
+
key: "renderSummary",
|
|
141
|
+
value: function renderSummary() {
|
|
142
|
+
var _this$props3 = this.props,
|
|
143
|
+
displayPosition = _this$props3.displayPosition,
|
|
144
|
+
isDragging = _this$props3.isDragging,
|
|
145
|
+
isShowingItems = _this$props3.isShowingItems,
|
|
146
|
+
sidebarOpen = _this$props3.sidebarOpen,
|
|
147
|
+
stimulus = _this$props3.stimulus;
|
|
148
|
+
if (this.stimulusIsPassage()) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
return jsx(Summary, {
|
|
152
|
+
startPosition: displayPosition,
|
|
153
|
+
isDragging: isDragging,
|
|
154
|
+
isShowingItems: isShowingItems,
|
|
155
|
+
stimulusId: stimulus.id,
|
|
156
|
+
sidebarOpen: sidebarOpen,
|
|
157
|
+
numberOfItems: this.props.childEntries.size
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: "stimulusHoverCss",
|
|
162
|
+
value: function stimulusHoverCss() {
|
|
163
|
+
return {
|
|
164
|
+
// TODO: figure out how to get rid of the last of these styles.
|
|
165
|
+
':hover': this.props.styles.onHover
|
|
166
|
+
};
|
|
167
|
+
}
|
|
113
168
|
}, {
|
|
114
169
|
key: "renderClosed",
|
|
115
170
|
value: function renderClosed() {
|
|
116
|
-
return jsx(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
171
|
+
return jsx(View, {
|
|
172
|
+
borderWidth: "0 0 small 0",
|
|
173
|
+
borderColor: "primary",
|
|
174
|
+
as: "div"
|
|
175
|
+
}, jsx(View, {
|
|
176
|
+
textAlign: "center",
|
|
177
|
+
padding: "xx-small 0",
|
|
178
|
+
borderWidth: "none large none none",
|
|
179
|
+
borderColor: "transparent",
|
|
180
|
+
css: this.stimulusHoverCss(),
|
|
181
|
+
as: "div"
|
|
120
182
|
}, this.renderButton()), this.renderCollection());
|
|
121
183
|
}
|
|
122
184
|
}, {
|
|
123
185
|
key: "renderOpen",
|
|
124
186
|
value: function renderOpen() {
|
|
125
|
-
var _this$
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
},
|
|
139
|
-
|
|
187
|
+
var _this$props4 = this.props,
|
|
188
|
+
stimulus = _this$props4.stimulus,
|
|
189
|
+
children = _this$props4.children;
|
|
190
|
+
return jsx(View, {
|
|
191
|
+
borderWidth: "0 0 small 0",
|
|
192
|
+
borderColor: "primary",
|
|
193
|
+
as: "div"
|
|
194
|
+
}, jsx(View, {
|
|
195
|
+
padding: "small 0",
|
|
196
|
+
borderWidth: "none large none none",
|
|
197
|
+
borderColor: "transparent",
|
|
198
|
+
css: this.stimulusHoverCss(),
|
|
199
|
+
as: "div"
|
|
200
|
+
}, jsx(View, {
|
|
201
|
+
margin: "auto auto x-small x-small",
|
|
202
|
+
padding: "auto auto auto x-small",
|
|
203
|
+
as: "div"
|
|
204
|
+
}, jsx(Text, {
|
|
205
|
+
size: "x-small",
|
|
206
|
+
color: "secondary"
|
|
207
|
+
}, this.infoHeaderLabel())), jsx(View, {
|
|
208
|
+
margin: "auto auto auto small",
|
|
209
|
+
as: "div"
|
|
140
210
|
}, jsx(Flex, {
|
|
141
211
|
justifyItems: "space-between"
|
|
142
212
|
}, jsx(Flex.Item, null, this.renderButton()), jsx(Flex.Item, {
|
|
@@ -146,14 +216,7 @@ export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateC
|
|
|
146
216
|
tabIndex: "-1"
|
|
147
217
|
}, jsx(Title, {
|
|
148
218
|
title: stimulus.title
|
|
149
|
-
})), jsx(Flex.Item, null, children)),
|
|
150
|
-
startPosition: displayPosition,
|
|
151
|
-
isDragging: isDragging,
|
|
152
|
-
isShowingItems: isShowingItems,
|
|
153
|
-
sidebarOpen: sidebarOpen,
|
|
154
|
-
stimulusId: stimulus.id,
|
|
155
|
-
numberOfItems: this.props.childEntries.size
|
|
156
|
-
}))), this.renderCollection());
|
|
219
|
+
})), jsx(Flex.Item, null, children)), this.renderSummary())), this.renderCollection());
|
|
157
220
|
}
|
|
158
221
|
}, {
|
|
159
222
|
key: "render",
|
|
@@ -1,31 +1,7 @@
|
|
|
1
1
|
var generateStyle = function generateStyle(componentTheme) {
|
|
2
2
|
return {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
},
|
|
6
|
-
sidebarItemClosedButton: {
|
|
7
|
-
borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.borderColor),
|
|
8
|
-
padding: componentTheme.sidebarClosedButtonPadding,
|
|
9
|
-
textAlign: 'center',
|
|
10
|
-
'&:hover': {
|
|
11
|
-
borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
stimulusHeader: {
|
|
15
|
-
padding: "".concat(componentTheme.sidebarHeaderPadding, " 0"),
|
|
16
|
-
borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.borderColor),
|
|
17
|
-
'&:hover:': {
|
|
18
|
-
borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
stimulusBody: {
|
|
22
|
-
marginLeft: '5%'
|
|
23
|
-
},
|
|
24
|
-
infoHeader: {
|
|
25
|
-
fontSize: componentTheme.sidebarIsOpenInfoHeaderFontSize,
|
|
26
|
-
color: componentTheme.sidebarIsOpenInfoHeaderColor,
|
|
27
|
-
marginBottom: componentTheme.sidebarIsOpenInfoHeaderMargin,
|
|
28
|
-
paddingLeft: componentTheme.sidebarIsOpenInfoHeaderPadding
|
|
3
|
+
onHover: {
|
|
4
|
+
borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
|
|
29
5
|
}
|
|
30
6
|
};
|
|
31
7
|
};
|
|
@@ -5,16 +5,7 @@ var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
|
5
5
|
typography = _ref.typography;
|
|
6
6
|
return {
|
|
7
7
|
borderColor: colors.contrasts.white1010,
|
|
8
|
-
hoverBorderColor: colors.contrasts.blue4570
|
|
9
|
-
hoverBorderWidth: borders.widthLarge,
|
|
10
|
-
sidebarClosedButtonPadding: "".concat(spacing.xxSmall, " 0"),
|
|
11
|
-
sidebarHeaderPadding: spacing.small,
|
|
12
|
-
sidebarItemBorderWidth: borders.widthSmall,
|
|
13
|
-
sidebarItemBorderColor: colors.contrasts.grey1214,
|
|
14
|
-
sidebarIsOpenInfoHeaderFontSize: typography.fontSizeXSmall,
|
|
15
|
-
sidebarIsOpenInfoHeaderPadding: spacing.xSmall,
|
|
16
|
-
sidebarIsOpenInfoHeaderMargin: spacing.xSmall,
|
|
17
|
-
sidebarIsOpenInfoHeaderColor: colors.contrasts.grey4570
|
|
8
|
+
hoverBorderColor: colors.contrasts.blue4570
|
|
18
9
|
};
|
|
19
10
|
};
|
|
20
11
|
export default generateComponentTheme;
|
|
@@ -27,13 +27,15 @@ import { toErrors } from '../../../util/instUIMessages';
|
|
|
27
27
|
import { simpleFetchBanks } from '../../../../banks/api/banks';
|
|
28
28
|
import { GenericAsyncSearch } from '../../shared/GenericAsyncSearch/GenericAsyncSearch';
|
|
29
29
|
export var BankSelection = /*#__PURE__*/function (_Component) {
|
|
30
|
-
function BankSelection() {
|
|
30
|
+
function BankSelection(props) {
|
|
31
31
|
var _this2;
|
|
32
32
|
_classCallCheck(this, BankSelection);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
_this2 = _callSuper(this, BankSelection, [props]);
|
|
34
|
+
_defineProperty(_this2, "setInputRef", function (ref) {
|
|
35
|
+
var _this2$props$inputRef, _this2$props;
|
|
36
|
+
_this2.inputRef = ref;
|
|
37
|
+
(_this2$props$inputRef = (_this2$props = _this2.props).inputRef) === null || _this2$props$inputRef === void 0 || _this2$props$inputRef.call(_this2$props, ref);
|
|
38
|
+
});
|
|
37
39
|
_defineProperty(_this2, "searchBanks", function (search) {
|
|
38
40
|
return _this2.props.simpleFetchBanks({
|
|
39
41
|
search: search
|
|
@@ -56,18 +58,31 @@ export var BankSelection = /*#__PURE__*/function (_Component) {
|
|
|
56
58
|
archived: bankOption.archived
|
|
57
59
|
});
|
|
58
60
|
});
|
|
61
|
+
_this2.inputRef = null;
|
|
59
62
|
return _this2;
|
|
60
63
|
}
|
|
61
64
|
_inherits(BankSelection, _Component);
|
|
62
65
|
return _createClass(BankSelection, [{
|
|
66
|
+
key: "focusSelectField",
|
|
67
|
+
value: function focusSelectField() {
|
|
68
|
+
if (this.inputRef) {
|
|
69
|
+
this.inputRef.focus();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
63
73
|
key: "getErrors",
|
|
64
74
|
value: function getErrors() {
|
|
65
75
|
var selectedBank = this.props.selectedBank;
|
|
66
76
|
if (selectedBank && selectedBank.archived) {
|
|
77
|
+
this.focusSelectField();
|
|
67
78
|
return toErrors([t('The item bank "{ bankTitle }" no longer exists. Please select a valid bank.', {
|
|
68
79
|
bankTitle: selectedBank.title
|
|
69
80
|
})]);
|
|
70
81
|
}
|
|
82
|
+
if (this.props.externalError) {
|
|
83
|
+
this.focusSelectField();
|
|
84
|
+
return this.props.externalError;
|
|
85
|
+
}
|
|
71
86
|
}
|
|
72
87
|
}, {
|
|
73
88
|
key: "selectedOption",
|
|
@@ -83,13 +98,15 @@ export var BankSelection = /*#__PURE__*/function (_Component) {
|
|
|
83
98
|
key: "render",
|
|
84
99
|
value: function render() {
|
|
85
100
|
return /*#__PURE__*/React.createElement(GenericAsyncSearch, {
|
|
101
|
+
inputRef: this.setInputRef,
|
|
86
102
|
onSelectionChange: this.onSelect,
|
|
87
103
|
label: this.props.label || t('Select the destination bank'),
|
|
88
104
|
placeholder: t('Search for a bank'),
|
|
89
105
|
selectedOption: this.selectedOption(),
|
|
90
106
|
getOptions: this.searchBanks,
|
|
91
107
|
messages: this.getErrors(),
|
|
92
|
-
selectAutomation: 'sdk-item-bank-modal'
|
|
108
|
+
selectAutomation: 'sdk-item-bank-modal',
|
|
109
|
+
isRequired: this.props.isRequired
|
|
93
110
|
});
|
|
94
111
|
}
|
|
95
112
|
}]);
|
|
@@ -98,12 +115,18 @@ _defineProperty(BankSelection, "propTypes", {
|
|
|
98
115
|
label: PropTypes.string,
|
|
99
116
|
onBankSelection: PropTypes.func,
|
|
100
117
|
selectedBank: ImmutablePropTypes.record,
|
|
101
|
-
simpleFetchBanks: PropTypes.func
|
|
118
|
+
simpleFetchBanks: PropTypes.func,
|
|
119
|
+
externalError: ImmutablePropTypes.record,
|
|
120
|
+
inputRef: PropTypes.func,
|
|
121
|
+
isRequired: PropTypes.bool
|
|
102
122
|
});
|
|
103
123
|
_defineProperty(BankSelection, "defaultProps", {
|
|
104
124
|
label: null,
|
|
105
125
|
onBankSelection: function onBankSelection() {},
|
|
106
126
|
selectedBank: null,
|
|
107
|
-
simpleFetchBanks: simpleFetchBanks
|
|
127
|
+
simpleFetchBanks: simpleFetchBanks,
|
|
128
|
+
externalError: null,
|
|
129
|
+
inputRef: function inputRef() {},
|
|
130
|
+
isRequired: false
|
|
108
131
|
});
|
|
109
132
|
export default BankSelection;
|
|
@@ -91,9 +91,9 @@ export var SessionItemResult = (_dec = withStyleOverrides(generateStyle, generat
|
|
|
91
91
|
return typeof this.pointsPossible === 'number';
|
|
92
92
|
}
|
|
93
93
|
}, {
|
|
94
|
-
key: "
|
|
95
|
-
value: function
|
|
96
|
-
return this.props.sessionItem.
|
|
94
|
+
key: "questionNumber",
|
|
95
|
+
value: function questionNumber() {
|
|
96
|
+
return this.props.sessionItem.questionNumber;
|
|
97
97
|
}
|
|
98
98
|
}, {
|
|
99
99
|
key: "unscorable",
|
|
@@ -179,38 +179,38 @@ export var SessionItemResult = (_dec = withStyleOverrides(generateStyle, generat
|
|
|
179
179
|
value: function renderHeader() {
|
|
180
180
|
return jsx("div", {
|
|
181
181
|
css: this.props.styles.sessionItemResultHeader
|
|
182
|
-
}, this.
|
|
182
|
+
}, this.renderResultQuestionNumber(), !this.props.restrictQuantitativeData && (this.hasRegradeInfo() ? this.renderRegradePoints() : this.renderPoints()));
|
|
183
183
|
}
|
|
184
184
|
}, {
|
|
185
|
-
key: "
|
|
186
|
-
value: function
|
|
187
|
-
var
|
|
188
|
-
var
|
|
185
|
+
key: "renderResultQuestionNumber",
|
|
186
|
+
value: function renderResultQuestionNumber() {
|
|
187
|
+
var questionNumber = this.questionNumber();
|
|
188
|
+
var questionNumberText;
|
|
189
189
|
if (this.regraded() && this.unscorable()) {
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
questionNumberText = t('Results for question {questionNumber, number}. There was a problem grading this question. This question has been regraded.', {
|
|
191
|
+
questionNumber: questionNumber
|
|
192
192
|
});
|
|
193
193
|
} else if (this.regraded()) {
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
questionNumberText = t('Results for question {questionNumber, number}. This question has been regraded.', {
|
|
195
|
+
questionNumber: questionNumber
|
|
196
196
|
});
|
|
197
197
|
} else if (this.unscorable() && this.props.editGraderFeedback) {
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
questionNumberText = t('Results for question {questionNumber, number}. There was a problem grading this question.', {
|
|
199
|
+
questionNumber: questionNumber
|
|
200
200
|
});
|
|
201
201
|
} else if (this.unscorable()) {
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
questionNumberText = t('Results for question {questionNumber, number}. There was a problem grading this question. Please inform your instructor.', {
|
|
203
|
+
questionNumber: questionNumber
|
|
204
204
|
});
|
|
205
205
|
} else {
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
questionNumberText = t('Results for question {questionNumber, number}.', {
|
|
207
|
+
questionNumber: questionNumber
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
210
|
return jsx(PositionBox, {
|
|
211
|
-
position:
|
|
211
|
+
position: questionNumber,
|
|
212
212
|
headingLevel: "h3",
|
|
213
|
-
headingText:
|
|
213
|
+
headingText: questionNumberText
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
216
|
}, {
|
|
@@ -114,7 +114,7 @@ export var Stimulus = (_dec = withStyleOverrides(generateStyle, generateComponen
|
|
|
114
114
|
key: "renderStimulusPanel",
|
|
115
115
|
value: function renderStimulusPanel() {
|
|
116
116
|
var StimulusComponent = this.props.isEditing ? StimulusEdit : StimulusShow;
|
|
117
|
-
var automationPrefix = this.isPassage() ? '
|
|
117
|
+
var automationPrefix = this.isPassage() ? 'text-block' : 'stimulus';
|
|
118
118
|
var connectDragPreview = this.props.connectDragPreview;
|
|
119
119
|
return connectDragPreview(jsx("div", {
|
|
120
120
|
"data-automation": "sdk-".concat(automationPrefix, "-LeftPanelShow")
|
|
@@ -142,7 +142,7 @@ export var Stimulus = (_dec = withStyleOverrides(generateStyle, generateComponen
|
|
|
142
142
|
}, {
|
|
143
143
|
key: "renderPanels",
|
|
144
144
|
value: function renderPanels(propsForDnDZone) {
|
|
145
|
-
var automationPrefix = this.isPassage() ? '
|
|
145
|
+
var automationPrefix = this.isPassage() ? 'text-block' : 'stimulus';
|
|
146
146
|
return jsx("div", {
|
|
147
147
|
css: this.props.styles.stimulus,
|
|
148
148
|
ref: this.props.dndRef,
|
|
@@ -80,11 +80,11 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
|
|
|
80
80
|
inStimulus: false
|
|
81
81
|
});
|
|
82
82
|
}, {
|
|
83
|
-
title: isPassage ? t('Confirm
|
|
84
|
-
text: isPassage ? t('Are you sure you want to remove this
|
|
85
|
-
continueText: isPassage ? t('Remove
|
|
86
|
-
cancelText: isPassage ? t('Keep
|
|
87
|
-
automationPrefix: isPassage ? '
|
|
83
|
+
title: isPassage ? t('Confirm Text Block Removal') : t('Confirm Stimulus Removal'),
|
|
84
|
+
text: isPassage ? t('Are you sure you want to remove this text block?') : t('Are you sure you want to remove this stimulus?'),
|
|
85
|
+
continueText: isPassage ? t('Remove Text Block') : t('Remove Stimulus'),
|
|
86
|
+
cancelText: isPassage ? t('Keep Text Block ') : t('Keep Stimulus'),
|
|
87
|
+
automationPrefix: isPassage ? 'text-block' : 'stimulus'
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
90
|
_defineProperty(_this2, "handleDeleteStimulus", function () {
|
|
@@ -145,73 +145,74 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
|
|
|
145
145
|
});
|
|
146
146
|
_defineProperty(_this2, "onSubmit", /*#__PURE__*/function () {
|
|
147
147
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
|
|
148
|
-
var _this2$props2, stimulus, workingStimulus, quizId, quizEntry, stimulusData;
|
|
148
|
+
var _this2$props2, stimulus, workingStimulus, quizId, quizEntry, message, stimulusData;
|
|
149
149
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
150
150
|
while (1) switch (_context2.prev = _context2.next) {
|
|
151
151
|
case 0:
|
|
152
152
|
_this2$props2 = _this2.props, stimulus = _this2$props2.stimulus, workingStimulus = _this2$props2.workingStimulus, quizId = _this2$props2.quizId, quizEntry = _this2$props2.quizEntry;
|
|
153
153
|
if (workingStimulus.isValid()) {
|
|
154
|
-
_context2.next =
|
|
154
|
+
_context2.next = 9;
|
|
155
155
|
break;
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
message = _this2.isPassage() ? t('Text Block not saved due to validation errors with the data.') : t('Stimulus not saved due to validation errors with the data.');
|
|
158
|
+
_context2.next = 5;
|
|
158
159
|
return _this2.props.showError(_this2.props.guid);
|
|
159
|
-
case
|
|
160
|
-
_this2.props.screenreaderNotification(
|
|
160
|
+
case 5:
|
|
161
|
+
_this2.props.screenreaderNotification(message);
|
|
161
162
|
_this2.props.clearNextQuizEntry();
|
|
162
163
|
_this2.focusFirstErrorField();
|
|
163
164
|
return _context2.abrupt("return");
|
|
164
|
-
case
|
|
165
|
+
case 9:
|
|
165
166
|
_this2.setState({
|
|
166
167
|
canSubmit: false
|
|
167
168
|
});
|
|
168
169
|
_this2.props.hideError(_this2.props.guid);
|
|
169
|
-
_context2.prev =
|
|
170
|
+
_context2.prev = 11;
|
|
170
171
|
if (!stimulus.isTemporary()) {
|
|
171
|
-
_context2.next =
|
|
172
|
+
_context2.next = 18;
|
|
172
173
|
break;
|
|
173
174
|
}
|
|
174
|
-
_context2.next =
|
|
175
|
+
_context2.next = 15;
|
|
175
176
|
return _this2.props.createStimulusAndQuizEntry(quizId, workingStimulus.toJS(), quizEntry);
|
|
176
|
-
case
|
|
177
|
+
case 15:
|
|
177
178
|
_this2.props.clearTemporaryStimulus(quizId);
|
|
178
|
-
_context2.next =
|
|
179
|
+
_context2.next = 29;
|
|
179
180
|
break;
|
|
180
|
-
case
|
|
181
|
+
case 18:
|
|
181
182
|
if (!_this2.props.shouldClone) {
|
|
182
|
-
_context2.next =
|
|
183
|
+
_context2.next = 27;
|
|
183
184
|
break;
|
|
184
185
|
}
|
|
185
|
-
_context2.next =
|
|
186
|
+
_context2.next = 21;
|
|
186
187
|
return _this2.props.createStimulus(workingStimulus, _this2.props.quizId, 'quiz', workingStimulus.id);
|
|
187
|
-
case
|
|
188
|
+
case 21:
|
|
188
189
|
stimulusData = _context2.sent;
|
|
189
|
-
_context2.next =
|
|
190
|
+
_context2.next = 24;
|
|
190
191
|
return _this2.handleStimulusCreated(stimulusData);
|
|
191
|
-
case
|
|
192
|
+
case 24:
|
|
192
193
|
_this2.props.clearTemporaryStimulus(quizId);
|
|
193
|
-
_context2.next =
|
|
194
|
+
_context2.next = 29;
|
|
194
195
|
break;
|
|
195
|
-
case
|
|
196
|
-
_context2.next =
|
|
196
|
+
case 27:
|
|
197
|
+
_context2.next = 29;
|
|
197
198
|
return _this2.props.updateStimulus(workingStimulus.toJS(), quizId);
|
|
198
|
-
case
|
|
199
|
-
_context2.next =
|
|
199
|
+
case 29:
|
|
200
|
+
_context2.next = 35;
|
|
200
201
|
break;
|
|
201
|
-
case
|
|
202
|
-
_context2.prev =
|
|
203
|
-
_context2.t0 = _context2["catch"](
|
|
202
|
+
case 31:
|
|
203
|
+
_context2.prev = 31;
|
|
204
|
+
_context2.t0 = _context2["catch"](11);
|
|
204
205
|
_this2.setState({
|
|
205
206
|
canSubmit: true
|
|
206
207
|
});
|
|
207
208
|
throw _context2.t0;
|
|
208
|
-
case 34:
|
|
209
|
-
_this2.afterSubmit();
|
|
210
209
|
case 35:
|
|
210
|
+
_this2.afterSubmit();
|
|
211
|
+
case 36:
|
|
211
212
|
case "end":
|
|
212
213
|
return _context2.stop();
|
|
213
214
|
}
|
|
214
|
-
}, _callee2, null, [[
|
|
215
|
+
}, _callee2, null, [[11, 31]]);
|
|
215
216
|
}));
|
|
216
217
|
return function (_x2) {
|
|
217
218
|
return _ref2.apply(this, arguments);
|
|
@@ -315,10 +316,11 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
|
|
|
315
316
|
}, {
|
|
316
317
|
key: "afterSubmit",
|
|
317
318
|
value: function afterSubmit() {
|
|
319
|
+
var message = this.isPassage() ? t('Changes to text block saved.') : t('Changes to stimulus saved.');
|
|
318
320
|
this.props.switchOffEditing();
|
|
319
321
|
this.clearModifications();
|
|
320
322
|
this.props.setUi(SHOULD_CLONE_ITEM, false);
|
|
321
|
-
this.props.screenreaderNotification(
|
|
323
|
+
this.props.screenreaderNotification(message);
|
|
322
324
|
if (this.props.nextQuizEntry) {
|
|
323
325
|
this.createNextQuizEntry();
|
|
324
326
|
}
|
|
@@ -364,8 +366,8 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
|
|
|
364
366
|
}, {
|
|
365
367
|
key: "renderStimulusEdit",
|
|
366
368
|
value: function renderStimulusEdit() {
|
|
367
|
-
var stimulusLabel = this.isPassage() ? t('
|
|
368
|
-
var automationPrefix = this.isPassage() ? '
|
|
369
|
+
var stimulusLabel = this.isPassage() ? t('Text Block') : t('Stimulus');
|
|
370
|
+
var automationPrefix = this.isPassage() ? 'text-block' : 'stimulus';
|
|
369
371
|
return jsx("div", null, jsx("div", {
|
|
370
372
|
css: this.props.styles.stimulus,
|
|
371
373
|
ref: this.handleRef
|
|
@@ -421,9 +423,10 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
|
|
|
421
423
|
var _this$props = this.props,
|
|
422
424
|
stimulus = _this$props.stimulus,
|
|
423
425
|
quizEntry = _this$props.quizEntry;
|
|
426
|
+
var isPassage = stimulus.isPassage;
|
|
424
427
|
var needsWarning = stimulus.isImmutable() || quizEntry.isArchivedBankEntry;
|
|
425
428
|
var propForWrapperFunc = quizEntry.isArchivedBankEntry ? propsForBankEntryVersioningWrapper : propsForStimulusVersioningWrapper;
|
|
426
|
-
var propsForStimulusVersioning = propForWrapperFunc(needsWarning, this.props.shouldClone, partial(this.props.setUi, SHOULD_CLONE_ITEM), this.props.switchOffEditing, true, quizEntry.isArchivedBankEntry ? 'info' : 'warning');
|
|
429
|
+
var propsForStimulusVersioning = propForWrapperFunc(needsWarning, this.props.shouldClone, partial(this.props.setUi, SHOULD_CLONE_ITEM), this.props.switchOffEditing, true, quizEntry.isArchivedBankEntry ? 'info' : 'warning', isPassage);
|
|
427
430
|
var hasWarningWrapper = needsWarning && !this.props.shouldClone;
|
|
428
431
|
return jsx(WarningWrapper, propsForStimulusVersioning, hasWarningWrapper ? jsx(StimulusShowInfo, this.props) : this.renderStimulusEdit());
|
|
429
432
|
}
|
|
@@ -72,9 +72,9 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
|
|
|
72
72
|
key: "headerText",
|
|
73
73
|
value: function headerText(stimulus) {
|
|
74
74
|
if (stimulus.isTemporary()) {
|
|
75
|
-
return stimulus.passage ? t('Add
|
|
75
|
+
return stimulus.passage ? t('Add Text Block') : t('Add Stimulus');
|
|
76
76
|
} else {
|
|
77
|
-
return stimulus.passage ? t('Edit
|
|
77
|
+
return stimulus.passage ? t('Edit Text Block') : t('Edit Stimulus');
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}, {
|
|
@@ -118,7 +118,7 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
|
|
|
118
118
|
}
|
|
119
119
|
return jsx(Alert, {
|
|
120
120
|
variant: "warning"
|
|
121
|
-
}, t('The
|
|
121
|
+
}, t('The text block sections may not appear in their original order due to the shuffle setting.'));
|
|
122
122
|
}
|
|
123
123
|
}, {
|
|
124
124
|
key: "renderInstructions",
|
|
@@ -163,10 +163,11 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
|
|
|
163
163
|
var stimulus = this.props.workingStimulus;
|
|
164
164
|
var textAreaId = "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent);
|
|
165
165
|
var stimulusBodyId = "stimulusBodyEdit_".concat(stimulus.id, "_body");
|
|
166
|
-
var automationPrefix = stimulus.passage ? '
|
|
166
|
+
var automationPrefix = stimulus.passage ? 'text-block' : 'stimulus';
|
|
167
|
+
var message = stimulus.passage ? t('Edit Text Block') : t('Edit Stimulus');
|
|
167
168
|
return jsx(FormFieldGroup, {
|
|
168
169
|
messages: this.inputErrors('onSelf'),
|
|
169
|
-
description: jsx(ScreenReaderContent, null,
|
|
170
|
+
description: jsx(ScreenReaderContent, null, message)
|
|
170
171
|
}, jsx(Heading, {
|
|
171
172
|
level: "h3",
|
|
172
173
|
as: "h2"
|
|
@@ -58,7 +58,7 @@ export var StimulusShow = (_dec = withStyleOverrides(generateStyle, generateComp
|
|
|
58
58
|
}, {
|
|
59
59
|
key: "render",
|
|
60
60
|
value: function render() {
|
|
61
|
-
var stimulusLabel = this.props.stimulus.passage ? t('
|
|
61
|
+
var stimulusLabel = this.props.stimulus.passage ? t('Text Block') : t('Stimulus');
|
|
62
62
|
return jsx(Overlay, {
|
|
63
63
|
onClick: this.switchOnEditing,
|
|
64
64
|
wrapperStyles: this.props.styles.stimulusWrapper,
|
|
@@ -35,7 +35,7 @@ var StimulusShowInfo = /*#__PURE__*/function (_Component) {
|
|
|
35
35
|
key: "render",
|
|
36
36
|
value: function render() {
|
|
37
37
|
var stimulus = this.props.stimulus;
|
|
38
|
-
var automationPrefix = stimulus.passage ? '
|
|
38
|
+
var automationPrefix = stimulus.passage ? 'text-block' : 'stimulus';
|
|
39
39
|
var instructions = stimulus.instructions && /*#__PURE__*/React.createElement(View, {
|
|
40
40
|
as: "div",
|
|
41
41
|
padding: "small",
|