@instructure/quiz-core 22.0.0 → 22.1.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/CopyMoveBankEntryModal/presenter.js +84 -15
- package/es/common/components/layout/sidebar/Stimulus/Collection/presenter.js +6 -3
- package/es/common/components/layout/sidebar/Stimulus/presenter.js +98 -38
- 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/StimulusEdit/presenter.js +31 -29
- package/es/common/components/resources/stimulus/StimulusEditInfo/presenter.js +2 -1
- package/es/common/components/shared/GenericAsyncSearch/GenericAsyncSearch.js +10 -3
- package/es/common/records/QuizEntry.js +29 -17
- package/es/common/records/SessionItem.js +6 -0
- package/es/taking/api/taking.js +1 -1
- package/lib/banks/components/CopyMoveBankEntryModal/presenter.js +84 -15
- package/lib/common/components/layout/sidebar/Stimulus/Collection/presenter.js +6 -3
- package/lib/common/components/layout/sidebar/Stimulus/presenter.js +98 -38
- 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/StimulusEdit/presenter.js +31 -29
- package/lib/common/components/resources/stimulus/StimulusEditInfo/presenter.js +2 -1
- package/lib/common/components/shared/GenericAsyncSearch/GenericAsyncSearch.js +10 -3
- package/lib/common/records/QuizEntry.js +29 -17
- package/lib/common/records/SessionItem.js +6 -0
- package/lib/taking/api/taking.js +1 -1
- package/package.json +9 -9
|
@@ -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('Passage 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 passage 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
|
}
|
|
@@ -164,9 +164,10 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
|
|
|
164
164
|
var textAreaId = "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent);
|
|
165
165
|
var stimulusBodyId = "stimulusBodyEdit_".concat(stimulus.id, "_body");
|
|
166
166
|
var automationPrefix = stimulus.passage ? 'passage' : 'stimulus';
|
|
167
|
+
var message = stimulus.passage ? t('Edit Passage') : 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"
|
|
@@ -30,7 +30,9 @@ export var GenericAsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
30
30
|
_classCallCheck(this, GenericAsyncSearch);
|
|
31
31
|
_this2 = _callSuper(this, GenericAsyncSearch, arguments);
|
|
32
32
|
_defineProperty(_this2, "setInputRef", function (inputRef) {
|
|
33
|
+
var _this2$props$inputRef, _this2$props;
|
|
33
34
|
_this2.inputRef = inputRef;
|
|
35
|
+
(_this2$props$inputRef = (_this2$props = _this2.props).inputRef) === null || _this2$props$inputRef === void 0 || _this2$props$inputRef.call(_this2$props, inputRef);
|
|
34
36
|
});
|
|
35
37
|
_defineProperty(_this2, "state", {
|
|
36
38
|
inputValue: _this2.props.selectedOption ? _this2.props.selectedOption.text : '',
|
|
@@ -161,7 +163,8 @@ export var GenericAsyncSearch = /*#__PURE__*/function (_Component) {
|
|
|
161
163
|
onRequestHighlightOption: this.handleHighlightOption,
|
|
162
164
|
onRequestSelectOption: this.handleSelectOption,
|
|
163
165
|
onKeyDown: this.handleKeyDown,
|
|
164
|
-
messages: this.props.messages
|
|
166
|
+
messages: this.props.messages,
|
|
167
|
+
isRequired: this.props.isRequired
|
|
165
168
|
}, this.renderOptions());
|
|
166
169
|
}
|
|
167
170
|
}]);
|
|
@@ -178,13 +181,17 @@ _defineProperty(GenericAsyncSearch, "propTypes", {
|
|
|
178
181
|
}),
|
|
179
182
|
messages: PropTypes.array,
|
|
180
183
|
selectAutomation: PropTypes.string,
|
|
181
|
-
getOptions: PropTypes.func.isRequired
|
|
184
|
+
getOptions: PropTypes.func.isRequired,
|
|
185
|
+
inputRef: PropTypes.func,
|
|
186
|
+
isRequired: PropTypes.bool
|
|
182
187
|
});
|
|
183
188
|
_defineProperty(GenericAsyncSearch, "defaultProps", {
|
|
184
189
|
debounceDelay: 500,
|
|
185
190
|
minChars: 3,
|
|
186
191
|
label: null,
|
|
187
192
|
placeholder: null,
|
|
188
|
-
selectAutomation: null
|
|
193
|
+
selectAutomation: null,
|
|
194
|
+
inputRef: function inputRef() {},
|
|
195
|
+
isRequired: false
|
|
189
196
|
});
|
|
190
197
|
export default GenericAsyncSearch;
|
|
@@ -366,51 +366,63 @@ export var QuizEntry = (_dec = withStateCache(function () {
|
|
|
366
366
|
// their own possible string so that translators can better translate the meaning
|
|
367
367
|
var type;
|
|
368
368
|
if (this.hasStimulus || this.isBank) {
|
|
369
|
+
if (this.isPassage) {
|
|
370
|
+
type = t('Passage');
|
|
371
|
+
var opts = {
|
|
372
|
+
type: type,
|
|
373
|
+
start: displayPosition - 1
|
|
374
|
+
};
|
|
375
|
+
return {
|
|
376
|
+
Remove: t('Remove {type} located after position {start, number}.', opts),
|
|
377
|
+
Edit: t('Edit {type} located after position {start, number}.', opts),
|
|
378
|
+
Move: t('Move {type} located after position {start, number}.', opts)
|
|
379
|
+
}[verb];
|
|
380
|
+
}
|
|
369
381
|
type = this.hasStimulus ? t('Stimulus') : t('Bank');
|
|
370
382
|
if (this.numItems > 1) {
|
|
371
|
-
var
|
|
383
|
+
var _opts = {
|
|
372
384
|
type: type,
|
|
373
385
|
start: displayPosition,
|
|
374
386
|
end: displayPosition + this.numItems - 1
|
|
375
387
|
};
|
|
376
388
|
return {
|
|
377
|
-
Remove: t('Remove {type} containing questions {start, number} through {end, number}.',
|
|
378
|
-
Edit: t('Edit {type} containing questions {start, number} through {end, number}.',
|
|
379
|
-
Move: t('Move {type} containing questions {start, number} through {end, number}.',
|
|
389
|
+
Remove: t('Remove {type} containing questions {start, number} through {end, number}.', _opts),
|
|
390
|
+
Edit: t('Edit {type} containing questions {start, number} through {end, number}.', _opts),
|
|
391
|
+
Move: t('Move {type} containing questions {start, number} through {end, number}.', _opts)
|
|
380
392
|
}[verb];
|
|
381
393
|
} else if (this.numItems === 1) {
|
|
382
|
-
var
|
|
394
|
+
var _opts2 = {
|
|
383
395
|
type: type,
|
|
384
396
|
start: displayPosition
|
|
385
397
|
};
|
|
386
398
|
return {
|
|
387
|
-
Remove: t('Remove {type} containing question {start, number}.',
|
|
388
|
-
Edit: t('Edit {type} containing question {start, number}.',
|
|
389
|
-
Move: t('Move {type} containing question {start, number}.',
|
|
399
|
+
Remove: t('Remove {type} containing question {start, number}.', _opts2),
|
|
400
|
+
Edit: t('Edit {type} containing question {start, number}.', _opts2),
|
|
401
|
+
Move: t('Move {type} containing question {start, number}.', _opts2)
|
|
390
402
|
}[verb];
|
|
391
403
|
} else {
|
|
392
|
-
var
|
|
404
|
+
var _opts3 = {
|
|
393
405
|
type: type,
|
|
394
406
|
start: displayPosition - 1
|
|
395
407
|
};
|
|
396
408
|
return {
|
|
397
|
-
Remove: t('Remove empty {type} located after position {start, number}.',
|
|
398
|
-
Edit: t('Edit empty {type} located after position {start, number}.',
|
|
399
|
-
Move: t('Move empty {type} located after position {start, number}.',
|
|
409
|
+
Remove: t('Remove empty {type} located after position {start, number}.', _opts3),
|
|
410
|
+
Edit: t('Edit empty {type} located after position {start, number}.', _opts3),
|
|
411
|
+
Move: t('Move empty {type} located after position {start, number}.', _opts3)
|
|
400
412
|
}[verb];
|
|
401
413
|
}
|
|
402
414
|
} else {
|
|
403
415
|
type = t('Question');
|
|
404
|
-
var
|
|
416
|
+
var _opts4 = {
|
|
405
417
|
verb: verb,
|
|
406
418
|
type: type,
|
|
407
419
|
position: displayPosition
|
|
408
420
|
};
|
|
409
421
|
return {
|
|
410
|
-
Remove: t('Remove {type} at position {position, number}.',
|
|
411
|
-
Edit: t('Edit {type} at position {position, number}.',
|
|
412
|
-
Move: t('Move {type} at position {position, number}.',
|
|
413
|
-
Copy: t('Copy {type} at position {position, number}.',
|
|
422
|
+
Remove: t('Remove {type} at position {position, number}.', _opts4),
|
|
423
|
+
Edit: t('Edit {type} at position {position, number}.', _opts4),
|
|
424
|
+
Move: t('Move {type} at position {position, number}.', _opts4),
|
|
425
|
+
Copy: t('Copy {type} at position {position, number}.', _opts4)
|
|
414
426
|
}[verb];
|
|
415
427
|
}
|
|
416
428
|
}
|
|
@@ -85,6 +85,11 @@ export var SessionItem = /*#__PURE__*/function (_ReduxRecord) {
|
|
|
85
85
|
get: function get() {
|
|
86
86
|
return this.type === 'Stimulus';
|
|
87
87
|
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "isPassage",
|
|
90
|
+
get: function get() {
|
|
91
|
+
return this.isStimulus && this.stimulusRecord.isPassage;
|
|
92
|
+
}
|
|
88
93
|
}, {
|
|
89
94
|
key: "stimulusRecord",
|
|
90
95
|
get: function get() {
|
|
@@ -123,6 +128,7 @@ export var SessionItem = /*#__PURE__*/function (_ReduxRecord) {
|
|
|
123
128
|
item: {},
|
|
124
129
|
pointsPossible: null,
|
|
125
130
|
position: null,
|
|
131
|
+
questionNumber: null,
|
|
126
132
|
quizEntryId: null,
|
|
127
133
|
quizSessionId: null,
|
|
128
134
|
scoringData: {},
|
package/es/taking/api/taking.js
CHANGED
|
@@ -211,7 +211,7 @@ var __remainingQuestionPositions = function __remainingQuestionPositions(session
|
|
|
211
211
|
var itemUserResponse = __getResponseForSessionItem(si, responses);
|
|
212
212
|
return item.hasResponse(itemUserResponse);
|
|
213
213
|
}).map(function (si) {
|
|
214
|
-
return si.get('
|
|
214
|
+
return si.get('questionNumber');
|
|
215
215
|
}).toSet().toJS();
|
|
216
216
|
};
|
|
217
217
|
export function showSubmitConfirmModal(quizSessionId) {
|
|
@@ -40,17 +40,27 @@ function _callSuper(_this, derived, args) {
|
|
|
40
40
|
return (0, _possibleConstructorReturn2["default"])(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], (0, _getPrototypeOf2["default"])(_this).constructor) : derived.apply(_this, args));
|
|
41
41
|
}
|
|
42
42
|
var CopyMoveBankEntryModal = exports.CopyMoveBankEntryModal = /*#__PURE__*/function (_Component) {
|
|
43
|
-
function CopyMoveBankEntryModal() {
|
|
43
|
+
function CopyMoveBankEntryModal(props) {
|
|
44
44
|
var _this2;
|
|
45
45
|
(0, _classCallCheck2["default"])(this, CopyMoveBankEntryModal);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
_this2 = _callSuper(this, CopyMoveBankEntryModal, [props]);
|
|
47
|
+
/**
|
|
48
|
+
* @type {React.RefObject<RadioInput> | null}
|
|
49
|
+
*/
|
|
50
|
+
(0, _defineProperty2["default"])(_this2, "radioInputRef", null);
|
|
51
|
+
/**
|
|
52
|
+
* @type {React.RefObject<TextInput> | null}
|
|
53
|
+
*/
|
|
54
|
+
(0, _defineProperty2["default"])(_this2, "textInputRef", null);
|
|
50
55
|
(0, _defineProperty2["default"])(_this2, "state", {
|
|
51
56
|
bankType: 'existing',
|
|
52
57
|
newBankTitle: '',
|
|
53
|
-
selectedBank: null
|
|
58
|
+
selectedBank: null,
|
|
59
|
+
radioValidationError: null,
|
|
60
|
+
selectValidationError: null
|
|
61
|
+
});
|
|
62
|
+
(0, _defineProperty2["default"])(_this2, "setBankInputRef", function (ref) {
|
|
63
|
+
_this2.bankSelectionInputRef = ref;
|
|
54
64
|
});
|
|
55
65
|
(0, _defineProperty2["default"])(_this2, "copyOrMove", function (newBankId) {
|
|
56
66
|
if (_this2.props.keepCopy) {
|
|
@@ -60,7 +70,55 @@ var CopyMoveBankEntryModal = exports.CopyMoveBankEntryModal = /*#__PURE__*/funct
|
|
|
60
70
|
}
|
|
61
71
|
_this2.closeAction();
|
|
62
72
|
});
|
|
73
|
+
(0, _defineProperty2["default"])(_this2, "clearValidationErrors", function () {
|
|
74
|
+
_this2.setState({
|
|
75
|
+
radioValidationError: null,
|
|
76
|
+
selectValidationError: null
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
(0, _defineProperty2["default"])(_this2, "validateAction", function () {
|
|
80
|
+
var _this2$state = _this2.state,
|
|
81
|
+
bankType = _this2$state.bankType,
|
|
82
|
+
newBankTitle = _this2$state.newBankTitle,
|
|
83
|
+
selectedBank = _this2$state.selectedBank;
|
|
84
|
+
if (!bankType) {
|
|
85
|
+
var _this2$radioInputRef;
|
|
86
|
+
(_this2$radioInputRef = _this2.radioInputRef) === null || _this2$radioInputRef === void 0 || (_this2$radioInputRef = _this2$radioInputRef.current) === null || _this2$radioInputRef === void 0 || _this2$radioInputRef.focus();
|
|
87
|
+
_this2.setState({
|
|
88
|
+
radioValidationError: [{
|
|
89
|
+
text: (0, _formatMessage["default"])('Please choose a Copy/Move option'),
|
|
90
|
+
type: 'newError'
|
|
91
|
+
}]
|
|
92
|
+
});
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
if (bankType === 'existing' && !selectedBank) {
|
|
96
|
+
_this2.bankSelectionInputRef.focus();
|
|
97
|
+
_this2.setState({
|
|
98
|
+
selectValidationError: [{
|
|
99
|
+
text: (0, _formatMessage["default"])('Please select a bank'),
|
|
100
|
+
type: 'newError'
|
|
101
|
+
}]
|
|
102
|
+
});
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
if (bankType === 'new' && (!newBankTitle || !newBankTitle.trim())) {
|
|
106
|
+
var _this2$textInputRef;
|
|
107
|
+
(_this2$textInputRef = _this2.textInputRef) === null || _this2$textInputRef === void 0 || (_this2$textInputRef = _this2$textInputRef.current) === null || _this2$textInputRef === void 0 || _this2$textInputRef.focus();
|
|
108
|
+
_this2.setState({
|
|
109
|
+
selectValidationError: [{
|
|
110
|
+
text: (0, _formatMessage["default"])('Please enter a new bank title'),
|
|
111
|
+
type: 'newError'
|
|
112
|
+
}]
|
|
113
|
+
});
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
});
|
|
63
118
|
(0, _defineProperty2["default"])(_this2, "continueAction", function () {
|
|
119
|
+
if (!_this2.validateAction()) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
64
122
|
if (_this2.state.bankType === 'new') {
|
|
65
123
|
var newBank = _Bank["default"].create({
|
|
66
124
|
title: _this2.state.newBankTitle,
|
|
@@ -101,12 +159,14 @@ var CopyMoveBankEntryModal = exports.CopyMoveBankEntryModal = /*#__PURE__*/funct
|
|
|
101
159
|
return _this2.initiateCopy(newBankId).then(_this2.props.onAdd);
|
|
102
160
|
});
|
|
103
161
|
(0, _defineProperty2["default"])(_this2, "closeAction", function () {
|
|
162
|
+
_this2.clearValidationErrors();
|
|
104
163
|
if (_this2.props.modalTrigger) {
|
|
105
164
|
_this2.props.modalTrigger.focus();
|
|
106
165
|
}
|
|
107
166
|
_this2.props.closeModal();
|
|
108
167
|
});
|
|
109
168
|
(0, _defineProperty2["default"])(_this2, "onBankSelection", function (e, option) {
|
|
169
|
+
_this2.clearValidationErrors();
|
|
110
170
|
_this2.setState({
|
|
111
171
|
selectedBank: new _Bank["default"](option)
|
|
112
172
|
});
|
|
@@ -115,15 +175,20 @@ var CopyMoveBankEntryModal = exports.CopyMoveBankEntryModal = /*#__PURE__*/funct
|
|
|
115
175
|
_this2.props.uiSet(_quizCommon.COPY_MOVE_BANK_ENTRY_MODAL_KEEP_COPY, e.target.checked);
|
|
116
176
|
});
|
|
117
177
|
(0, _defineProperty2["default"])(_this2, "handleRadioChange", function (event, value) {
|
|
178
|
+
_this2.clearValidationErrors();
|
|
118
179
|
_this2.setState({
|
|
119
180
|
bankType: value
|
|
120
181
|
});
|
|
121
182
|
});
|
|
122
183
|
(0, _defineProperty2["default"])(_this2, "onTitleChange", function (e) {
|
|
184
|
+
_this2.clearValidationErrors();
|
|
123
185
|
_this2.setState({
|
|
124
186
|
newBankTitle: e.target.value
|
|
125
187
|
});
|
|
126
188
|
});
|
|
189
|
+
_this2.radioInputRef = _react["default"].createRef();
|
|
190
|
+
_this2.textInputRef = _react["default"].createRef();
|
|
191
|
+
_this2.bankSelectionInputRef = _react["default"].createRef();
|
|
127
192
|
return _this2;
|
|
128
193
|
}
|
|
129
194
|
(0, _inherits2["default"])(CopyMoveBankEntryModal, _Component);
|
|
@@ -138,14 +203,9 @@ var CopyMoveBankEntryModal = exports.CopyMoveBankEntryModal = /*#__PURE__*/funct
|
|
|
138
203
|
}, {
|
|
139
204
|
key: "addToBankButton",
|
|
140
205
|
value: function addToBankButton() {
|
|
141
|
-
var _this$state = this.state,
|
|
142
|
-
bankType = _this$state.bankType,
|
|
143
|
-
newBankTitle = _this$state.newBankTitle;
|
|
144
|
-
var disabled = bankType === 'existing' && !this.state.selectedBank || bankType === 'new' && (!newBankTitle || !newBankTitle.trim());
|
|
145
206
|
return /*#__PURE__*/_react["default"].createElement(_uiButtons.Button, {
|
|
146
207
|
color: "primary",
|
|
147
208
|
onClick: this.continueAction,
|
|
148
|
-
disabled: disabled,
|
|
149
209
|
margin: _quizCommon.XSMALL_SIDE_MARGIN,
|
|
150
210
|
"data-automation": "sdk-add-to-bank-button"
|
|
151
211
|
}, (0, _formatMessage["default"])('Add'));
|
|
@@ -155,16 +215,22 @@ var CopyMoveBankEntryModal = exports.CopyMoveBankEntryModal = /*#__PURE__*/funct
|
|
|
155
215
|
value: function renderBankTypeContent() {
|
|
156
216
|
if (this.state.bankType === 'existing') {
|
|
157
217
|
return /*#__PURE__*/_react["default"].createElement(_presenter["default"], {
|
|
218
|
+
inputRef: this.setBankInputRef,
|
|
158
219
|
onBankSelection: this.onBankSelection,
|
|
159
220
|
selectedBank: this.state.selectedBank,
|
|
160
|
-
"data-automation": "sdk-bank-selection"
|
|
221
|
+
"data-automation": "sdk-bank-selection",
|
|
222
|
+
externalError: this.state.selectValidationError,
|
|
223
|
+
isRequired: true
|
|
161
224
|
});
|
|
162
225
|
}
|
|
163
226
|
return /*#__PURE__*/_react["default"].createElement(_quizCommon.TextInput, {
|
|
164
227
|
onChange: this.onTitleChange,
|
|
165
228
|
value: this.state.newBankTitle,
|
|
166
229
|
renderLabel: (0, _formatMessage["default"])('New Bank Title'),
|
|
167
|
-
type: "text"
|
|
230
|
+
type: "text",
|
|
231
|
+
messages: this.state.selectValidationError,
|
|
232
|
+
ref: this.textInputRef,
|
|
233
|
+
isRequired: true
|
|
168
234
|
});
|
|
169
235
|
}
|
|
170
236
|
}, {
|
|
@@ -174,10 +240,13 @@ var CopyMoveBankEntryModal = exports.CopyMoveBankEntryModal = /*#__PURE__*/funct
|
|
|
174
240
|
onChange: this.handleRadioChange,
|
|
175
241
|
name: (0, _formatMessage["default"])('Bank Type'),
|
|
176
242
|
defaultValue: this.state.bankType,
|
|
177
|
-
description: /*#__PURE__*/_react["default"].createElement(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage["default"])('Bank Type'))
|
|
243
|
+
description: /*#__PURE__*/_react["default"].createElement(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage["default"])('Bank Type')),
|
|
244
|
+
messages: this.state.radioValidationError,
|
|
245
|
+
isRequired: true
|
|
178
246
|
}, /*#__PURE__*/_react["default"].createElement(_uiRadioInput.RadioInput, {
|
|
179
247
|
value: "existing",
|
|
180
|
-
label: (0, _formatMessage["default"])('Existing item bank')
|
|
248
|
+
label: (0, _formatMessage["default"])('Existing item bank'),
|
|
249
|
+
ref: this.radioInputRef
|
|
181
250
|
}), /*#__PURE__*/_react["default"].createElement(_uiRadioInput.RadioInput, {
|
|
182
251
|
value: "new",
|
|
183
252
|
label: (0, _formatMessage["default"])('New item bank')
|
|
@@ -96,6 +96,7 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
|
|
|
96
96
|
}, _this3.props.renderSidebarItem(item, displayPosition, sidebarOpen));
|
|
97
97
|
});
|
|
98
98
|
var transitionType = isShowingItems ? 'slide-down' : 'slide-up';
|
|
99
|
+
var screenReaderText = this.props.isPassage ? (0, _formatMessage["default"])('Collapse passage questions') : (0, _formatMessage["default"])('Collapse stimulus questions');
|
|
99
100
|
return (0, _emotion.jsx)(_uiMotion.Transition, {
|
|
100
101
|
"in": isShowingItems || this.shouldDisplayAllItems(),
|
|
101
102
|
type: transitionType
|
|
@@ -107,7 +108,7 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
|
|
|
107
108
|
withBackground: false,
|
|
108
109
|
withBorder: false,
|
|
109
110
|
renderIcon: _uiIcons.IconArrowOpenUpLine,
|
|
110
|
-
screenReaderLabel:
|
|
111
|
+
screenReaderLabel: screenReaderText
|
|
111
112
|
})), (0, _emotion.jsx)("div", null, itemComponents)));
|
|
112
113
|
}
|
|
113
114
|
}, {
|
|
@@ -118,6 +119,7 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
|
|
|
118
119
|
itemCollection = _this$props2.itemCollection,
|
|
119
120
|
isShowingItems = _this$props2.isShowingItems;
|
|
120
121
|
var transitionType = !isShowingItems ? 'slide-up' : 'slide-down';
|
|
122
|
+
var screenReaderText = this.props.isPassage ? (0, _formatMessage["default"])('Expand passage questions') : (0, _formatMessage["default"])('Expand stimulus questions');
|
|
121
123
|
return (0, _emotion.jsx)(_uiMotion.Transition, {
|
|
122
124
|
"in": !isShowingItems,
|
|
123
125
|
type: transitionType
|
|
@@ -131,7 +133,7 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
|
|
|
131
133
|
withBackground: false,
|
|
132
134
|
withBorder: false,
|
|
133
135
|
renderIcon: _uiIcons.IconArrowOpenDownLine,
|
|
134
|
-
screenReaderLabel:
|
|
136
|
+
screenReaderLabel: screenReaderText
|
|
135
137
|
})));
|
|
136
138
|
}
|
|
137
139
|
}, {
|
|
@@ -162,7 +164,8 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
|
|
|
162
164
|
// set in connect
|
|
163
165
|
setSidebarStimulusIsShowing: _propTypes["default"].func.isRequired,
|
|
164
166
|
styles: _propTypes["default"].object,
|
|
165
|
-
makeStyles: _propTypes["default"].func
|
|
167
|
+
makeStyles: _propTypes["default"].func,
|
|
168
|
+
isPassage: _propTypes["default"].bool
|
|
166
169
|
}), (0, _defineProperty2["default"])(_Collection, "defaultProps", {
|
|
167
170
|
isShowingItems: false
|
|
168
171
|
}), _Collection)) || _class);
|