@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
|
@@ -53,7 +53,10 @@ export var AddBankEntryModal = /*#__PURE__*/function (_Component) {
|
|
|
53
53
|
_this2.props.navigateToBankEntry('new', _this2.props.bankId);
|
|
54
54
|
});
|
|
55
55
|
_defineProperty(_this2, "addStimulus", function () {
|
|
56
|
-
|
|
56
|
+
var isPassage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
57
|
+
_this2.props.createBankItem(_this2.props.bankId, 'Stimulus', {
|
|
58
|
+
passage: isPassage
|
|
59
|
+
});
|
|
57
60
|
_this2.closeAction();
|
|
58
61
|
_this2.props.navigateToBankEntry('new', _this2.props.bankId);
|
|
59
62
|
});
|
|
@@ -233,18 +233,69 @@ export var BankEntry = (_dec = withStyleOverrides(generateStyle, generateCompone
|
|
|
233
233
|
value: function isTemporary() {
|
|
234
234
|
return this.props.entry && this.props.entry.isTemporary();
|
|
235
235
|
}
|
|
236
|
+
}, {
|
|
237
|
+
key: "getBankEntryTypeSlug",
|
|
238
|
+
value: function getBankEntryTypeSlug() {
|
|
239
|
+
return this.props.bankEntry.entryType;
|
|
240
|
+
}
|
|
241
|
+
}, {
|
|
242
|
+
key: "getEntry",
|
|
243
|
+
value: function getEntry() {
|
|
244
|
+
return this.props.entry;
|
|
245
|
+
}
|
|
236
246
|
}, {
|
|
237
247
|
key: "isItemEntry",
|
|
238
248
|
value: function isItemEntry() {
|
|
239
249
|
return this.props.bankEntry.entryType === 'Item';
|
|
240
250
|
}
|
|
251
|
+
}, {
|
|
252
|
+
key: "isStimulusEntry",
|
|
253
|
+
value: function isStimulusEntry() {
|
|
254
|
+
var entry = this.getEntry();
|
|
255
|
+
if (!entry) return false;
|
|
256
|
+
return entry.isStimulus && !entry.isPassage;
|
|
257
|
+
}
|
|
258
|
+
}, {
|
|
259
|
+
key: "isPassageEntry",
|
|
260
|
+
value: function isPassageEntry() {
|
|
261
|
+
var entry = this.getEntry();
|
|
262
|
+
if (!entry) return false;
|
|
263
|
+
return entry.isStimulus && entry.isPassage;
|
|
264
|
+
}
|
|
265
|
+
}, {
|
|
266
|
+
key: "getEditWarning",
|
|
267
|
+
value: function getEditWarning() {
|
|
268
|
+
if (this.isStimulusEntry()) {
|
|
269
|
+
return t('Edits made here will appear on any assessment using this stimulus.');
|
|
270
|
+
}
|
|
271
|
+
if (this.isPassageEntry()) {
|
|
272
|
+
return t('Edits made here will appear on any assessment using this text block.');
|
|
273
|
+
}
|
|
274
|
+
return t('Edits made here will appear on any assessment using this question.');
|
|
275
|
+
}
|
|
241
276
|
}, {
|
|
242
277
|
key: "entryLinkName",
|
|
243
278
|
value: function entryLinkName() {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
279
|
+
var translations = {
|
|
280
|
+
"new": {
|
|
281
|
+
question: t('New Question'),
|
|
282
|
+
stimulus: t('New Stimulus'),
|
|
283
|
+
passage: t('New Text Block')
|
|
284
|
+
},
|
|
285
|
+
edit: {
|
|
286
|
+
question: t('Edit Question'),
|
|
287
|
+
stimulus: t('Edit Stimulus'),
|
|
288
|
+
passage: t('Edit Text Block')
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
var operation = this.isTemporary() ? 'new' : 'edit';
|
|
292
|
+
switch (true) {
|
|
293
|
+
case this.isItemEntry():
|
|
294
|
+
return translations[operation]['question'];
|
|
295
|
+
case this.isStimulusEntry():
|
|
296
|
+
return translations[operation]['stimulus'];
|
|
297
|
+
case this.isPassageEntry():
|
|
298
|
+
return translations[operation]['passage'];
|
|
248
299
|
}
|
|
249
300
|
}
|
|
250
301
|
}, {
|
|
@@ -297,19 +348,66 @@ export var BankEntry = (_dec = withStyleOverrides(generateStyle, generateCompone
|
|
|
297
348
|
});
|
|
298
349
|
}
|
|
299
350
|
}
|
|
351
|
+
}, {
|
|
352
|
+
key: "getIdentifier",
|
|
353
|
+
value: function getIdentifier(entry) {
|
|
354
|
+
if (!entry) return;
|
|
355
|
+
switch (true) {
|
|
356
|
+
case this.isItemEntry():
|
|
357
|
+
return t('Question { id }', {
|
|
358
|
+
id: entry.id
|
|
359
|
+
});
|
|
360
|
+
case this.isStimulusEntry():
|
|
361
|
+
return t('Stimulus { id }', {
|
|
362
|
+
id: entry.id
|
|
363
|
+
});
|
|
364
|
+
case this.isPassageEntry():
|
|
365
|
+
return t('Text Block { id }', {
|
|
366
|
+
id: entry.id
|
|
367
|
+
});
|
|
368
|
+
default:
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}, {
|
|
373
|
+
key: "getTemporaryIdentifier",
|
|
374
|
+
value: function getTemporaryIdentifier() {
|
|
375
|
+
switch (true) {
|
|
376
|
+
case this.isItemEntry():
|
|
377
|
+
return t('New Question');
|
|
378
|
+
case this.isStimulusEntry():
|
|
379
|
+
return t('New Stimulus');
|
|
380
|
+
case this.isPassageEntry():
|
|
381
|
+
return t('New Text Block');
|
|
382
|
+
default:
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}, {
|
|
387
|
+
key: "getEntryName",
|
|
388
|
+
value: function getEntryName(entry) {
|
|
389
|
+
var _entry$getInteraction;
|
|
390
|
+
if (!entry) return;
|
|
391
|
+
switch (true) {
|
|
392
|
+
case this.isItemEntry():
|
|
393
|
+
return (_entry$getInteraction = entry.getInteractionType()) === null || _entry$getInteraction === void 0 ? void 0 : _entry$getInteraction.name;
|
|
394
|
+
case this.isStimulusEntry():
|
|
395
|
+
return t('Stimulus');
|
|
396
|
+
case this.isPassageEntry():
|
|
397
|
+
return t('Text Block');
|
|
398
|
+
default:
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
300
402
|
}, {
|
|
301
403
|
key: "renderHeader",
|
|
302
404
|
value: function renderHeader(entry) {
|
|
303
405
|
if (!entry) return;
|
|
304
406
|
var props = this.editProps(entry);
|
|
305
|
-
var identifier = this.
|
|
306
|
-
|
|
307
|
-
}) : t('Stimulus { id }', {
|
|
308
|
-
id: entry.id
|
|
309
|
-
});
|
|
310
|
-
var tempIdentifier = this.isItemEntry() ? t('New Question') : t('New Stimulus');
|
|
407
|
+
var identifier = this.getIdentifier(entry);
|
|
408
|
+
var tempIdentifier = this.getTemporaryIdentifier();
|
|
311
409
|
var itemIdentifier = this.isTemporary() ? tempIdentifier : identifier;
|
|
312
|
-
var entryName = this.
|
|
410
|
+
var entryName = this.getEntryName(entry);
|
|
313
411
|
var separator = ' | ';
|
|
314
412
|
return jsx("div", {
|
|
315
413
|
css: this.props.styles.header
|
|
@@ -543,7 +641,7 @@ export var BankEntry = (_dec = withStyleOverrides(generateStyle, generateCompone
|
|
|
543
641
|
tags: _this3.visibleTags()
|
|
544
642
|
});
|
|
545
643
|
};
|
|
546
|
-
var editWarning = this.
|
|
644
|
+
var editWarning = this.getEditWarning();
|
|
547
645
|
return jsx("div", null, jsx("div", {
|
|
548
646
|
css: this.props.styles.entryEdit
|
|
549
647
|
}, jsx(WarningWrapper, versioningProps, canEdit && jsx(Alert, {
|
|
@@ -58,7 +58,6 @@ export var BankEntryRow = (_dec = withStyleOverrides(generateStyle, generateComp
|
|
|
58
58
|
_this2.props.setUi(BUILD_TRAY_POSITION, _this2.props.position + 1);
|
|
59
59
|
});
|
|
60
60
|
_defineProperty(_this2, "deleteBankEntry", function () {
|
|
61
|
-
var deletePreface = _this2.isItemEntry() ? t('Deleting this question:') : t('Deleting this stimulus:');
|
|
62
61
|
var confirmBody = jsx(Alert, {
|
|
63
62
|
variant: "error",
|
|
64
63
|
padding: "0"
|
|
@@ -66,7 +65,7 @@ export var BankEntryRow = (_dec = withStyleOverrides(generateStyle, generateComp
|
|
|
66
65
|
css: _this2.props.styles.deleteAlert
|
|
67
66
|
}, jsx("div", {
|
|
68
67
|
css: _this2.props.styles.deletePreface
|
|
69
|
-
},
|
|
68
|
+
}, _this2.getDeletePreface()), jsx(List, null, jsx(List.Item, null, t.rich('will <0>NOT</0> remove it from any assessments', [function (_ref) {
|
|
70
69
|
var children = _ref.children;
|
|
71
70
|
return jsx(Text, {
|
|
72
71
|
weight: "bold",
|
|
@@ -152,20 +151,60 @@ export var BankEntryRow = (_dec = withStyleOverrides(generateStyle, generateComp
|
|
|
152
151
|
value: function isItemEntry() {
|
|
153
152
|
return this.props.bankEntry.entryType === 'Item';
|
|
154
153
|
}
|
|
154
|
+
}, {
|
|
155
|
+
key: "isStimulusEntry",
|
|
156
|
+
value: function isStimulusEntry() {
|
|
157
|
+
var entry = this.getEntry();
|
|
158
|
+
if (!entry) return false;
|
|
159
|
+
return entry.isStimulus && !entry.isPassage;
|
|
160
|
+
}
|
|
161
|
+
}, {
|
|
162
|
+
key: "isPassageEntry",
|
|
163
|
+
value: function isPassageEntry() {
|
|
164
|
+
var entry = this.getEntry();
|
|
165
|
+
if (!entry) return false;
|
|
166
|
+
return entry.isStimulus && entry.isPassage;
|
|
167
|
+
}
|
|
155
168
|
}, {
|
|
156
169
|
key: "type",
|
|
157
170
|
value: function type() {
|
|
158
|
-
|
|
171
|
+
if (this.isStimulusEntry()) {
|
|
172
|
+
return t('Stimulus');
|
|
173
|
+
}
|
|
174
|
+
if (this.isPassageEntry()) {
|
|
175
|
+
return t('Text Block');
|
|
176
|
+
}
|
|
177
|
+
return t('Question');
|
|
159
178
|
}
|
|
160
179
|
}, {
|
|
161
180
|
key: "entryIdentifier",
|
|
162
181
|
value: function entryIdentifier() {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
182
|
+
var title = this.getEntry().title;
|
|
183
|
+
if (this.isStimulusEntry()) {
|
|
184
|
+
return t('Stimulus { title }', {
|
|
185
|
+
title: title
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
if (this.isPassageEntry()) {
|
|
189
|
+
return t('Text Block { title }', {
|
|
190
|
+
title: title
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
return t('Question { itemBody }', {
|
|
194
|
+
itemBody: extractTextFromHtml(title)
|
|
167
195
|
});
|
|
168
196
|
}
|
|
197
|
+
}, {
|
|
198
|
+
key: "getDeletePreface",
|
|
199
|
+
value: function getDeletePreface() {
|
|
200
|
+
if (this.isStimulusEntry()) {
|
|
201
|
+
return t('Deleting this stimulus:');
|
|
202
|
+
}
|
|
203
|
+
if (this.isPassageEntry()) {
|
|
204
|
+
return t('Deleting this text block:');
|
|
205
|
+
}
|
|
206
|
+
return t('Deleting this question:');
|
|
207
|
+
}
|
|
169
208
|
}, {
|
|
170
209
|
key: "moveModalTitle",
|
|
171
210
|
value: function moveModalTitle() {
|
|
@@ -234,7 +273,12 @@ export var BankEntryRow = (_dec = withStyleOverrides(generateStyle, generateComp
|
|
|
234
273
|
}, {
|
|
235
274
|
key: "entryHeader",
|
|
236
275
|
value: function entryHeader() {
|
|
237
|
-
|
|
276
|
+
var entry = this.getEntry();
|
|
277
|
+
if (this.isItemEntry()) {
|
|
278
|
+
return entry.getInteractionType().name;
|
|
279
|
+
} else {
|
|
280
|
+
return entry.isPassage ? t('Text Block') : t('Stimulus');
|
|
281
|
+
}
|
|
238
282
|
}
|
|
239
283
|
}, {
|
|
240
284
|
key: "renderHeader",
|
|
@@ -31,17 +31,27 @@ import BankSelection from '../../../common/components/resources/BankSelection/pr
|
|
|
31
31
|
import { Modal, ModalHeader, ModalBody, ModalFooter, COPY_MOVE_BANK_ENTRY_MODAL_KEEP_COPY, TextInput, XSMALL_SIDE_MARGIN } from '@instructure/quiz-common';
|
|
32
32
|
import { featureOn } from '../../../common/util/featureCheck';
|
|
33
33
|
export var CopyMoveBankEntryModal = /*#__PURE__*/function (_Component) {
|
|
34
|
-
function CopyMoveBankEntryModal() {
|
|
34
|
+
function CopyMoveBankEntryModal(props) {
|
|
35
35
|
var _this2;
|
|
36
36
|
_classCallCheck(this, CopyMoveBankEntryModal);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
_this2 = _callSuper(this, CopyMoveBankEntryModal, [props]);
|
|
38
|
+
/**
|
|
39
|
+
* @type {React.RefObject<RadioInput> | null}
|
|
40
|
+
*/
|
|
41
|
+
_defineProperty(_this2, "radioInputRef", null);
|
|
42
|
+
/**
|
|
43
|
+
* @type {React.RefObject<TextInput> | null}
|
|
44
|
+
*/
|
|
45
|
+
_defineProperty(_this2, "textInputRef", null);
|
|
41
46
|
_defineProperty(_this2, "state", {
|
|
42
47
|
bankType: 'existing',
|
|
43
48
|
newBankTitle: '',
|
|
44
|
-
selectedBank: null
|
|
49
|
+
selectedBank: null,
|
|
50
|
+
radioValidationError: null,
|
|
51
|
+
selectValidationError: null
|
|
52
|
+
});
|
|
53
|
+
_defineProperty(_this2, "setBankInputRef", function (ref) {
|
|
54
|
+
_this2.bankSelectionInputRef = ref;
|
|
45
55
|
});
|
|
46
56
|
_defineProperty(_this2, "copyOrMove", function (newBankId) {
|
|
47
57
|
if (_this2.props.keepCopy) {
|
|
@@ -51,7 +61,55 @@ export var CopyMoveBankEntryModal = /*#__PURE__*/function (_Component) {
|
|
|
51
61
|
}
|
|
52
62
|
_this2.closeAction();
|
|
53
63
|
});
|
|
64
|
+
_defineProperty(_this2, "clearValidationErrors", function () {
|
|
65
|
+
_this2.setState({
|
|
66
|
+
radioValidationError: null,
|
|
67
|
+
selectValidationError: null
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
_defineProperty(_this2, "validateAction", function () {
|
|
71
|
+
var _this2$state = _this2.state,
|
|
72
|
+
bankType = _this2$state.bankType,
|
|
73
|
+
newBankTitle = _this2$state.newBankTitle,
|
|
74
|
+
selectedBank = _this2$state.selectedBank;
|
|
75
|
+
if (!bankType) {
|
|
76
|
+
var _this2$radioInputRef;
|
|
77
|
+
(_this2$radioInputRef = _this2.radioInputRef) === null || _this2$radioInputRef === void 0 || (_this2$radioInputRef = _this2$radioInputRef.current) === null || _this2$radioInputRef === void 0 || _this2$radioInputRef.focus();
|
|
78
|
+
_this2.setState({
|
|
79
|
+
radioValidationError: [{
|
|
80
|
+
text: t('Please choose a Copy/Move option'),
|
|
81
|
+
type: 'newError'
|
|
82
|
+
}]
|
|
83
|
+
});
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (bankType === 'existing' && !selectedBank) {
|
|
87
|
+
_this2.bankSelectionInputRef.focus();
|
|
88
|
+
_this2.setState({
|
|
89
|
+
selectValidationError: [{
|
|
90
|
+
text: t('Please select a bank'),
|
|
91
|
+
type: 'newError'
|
|
92
|
+
}]
|
|
93
|
+
});
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
if (bankType === 'new' && (!newBankTitle || !newBankTitle.trim())) {
|
|
97
|
+
var _this2$textInputRef;
|
|
98
|
+
(_this2$textInputRef = _this2.textInputRef) === null || _this2$textInputRef === void 0 || (_this2$textInputRef = _this2$textInputRef.current) === null || _this2$textInputRef === void 0 || _this2$textInputRef.focus();
|
|
99
|
+
_this2.setState({
|
|
100
|
+
selectValidationError: [{
|
|
101
|
+
text: t('Please enter a new bank title'),
|
|
102
|
+
type: 'newError'
|
|
103
|
+
}]
|
|
104
|
+
});
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return true;
|
|
108
|
+
});
|
|
54
109
|
_defineProperty(_this2, "continueAction", function () {
|
|
110
|
+
if (!_this2.validateAction()) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
55
113
|
if (_this2.state.bankType === 'new') {
|
|
56
114
|
var newBank = Bank.create({
|
|
57
115
|
title: _this2.state.newBankTitle,
|
|
@@ -92,12 +150,14 @@ export var CopyMoveBankEntryModal = /*#__PURE__*/function (_Component) {
|
|
|
92
150
|
return _this2.initiateCopy(newBankId).then(_this2.props.onAdd);
|
|
93
151
|
});
|
|
94
152
|
_defineProperty(_this2, "closeAction", function () {
|
|
153
|
+
_this2.clearValidationErrors();
|
|
95
154
|
if (_this2.props.modalTrigger) {
|
|
96
155
|
_this2.props.modalTrigger.focus();
|
|
97
156
|
}
|
|
98
157
|
_this2.props.closeModal();
|
|
99
158
|
});
|
|
100
159
|
_defineProperty(_this2, "onBankSelection", function (e, option) {
|
|
160
|
+
_this2.clearValidationErrors();
|
|
101
161
|
_this2.setState({
|
|
102
162
|
selectedBank: new Bank(option)
|
|
103
163
|
});
|
|
@@ -106,15 +166,20 @@ export var CopyMoveBankEntryModal = /*#__PURE__*/function (_Component) {
|
|
|
106
166
|
_this2.props.uiSet(COPY_MOVE_BANK_ENTRY_MODAL_KEEP_COPY, e.target.checked);
|
|
107
167
|
});
|
|
108
168
|
_defineProperty(_this2, "handleRadioChange", function (event, value) {
|
|
169
|
+
_this2.clearValidationErrors();
|
|
109
170
|
_this2.setState({
|
|
110
171
|
bankType: value
|
|
111
172
|
});
|
|
112
173
|
});
|
|
113
174
|
_defineProperty(_this2, "onTitleChange", function (e) {
|
|
175
|
+
_this2.clearValidationErrors();
|
|
114
176
|
_this2.setState({
|
|
115
177
|
newBankTitle: e.target.value
|
|
116
178
|
});
|
|
117
179
|
});
|
|
180
|
+
_this2.radioInputRef = React.createRef();
|
|
181
|
+
_this2.textInputRef = React.createRef();
|
|
182
|
+
_this2.bankSelectionInputRef = React.createRef();
|
|
118
183
|
return _this2;
|
|
119
184
|
}
|
|
120
185
|
_inherits(CopyMoveBankEntryModal, _Component);
|
|
@@ -129,14 +194,9 @@ export var CopyMoveBankEntryModal = /*#__PURE__*/function (_Component) {
|
|
|
129
194
|
}, {
|
|
130
195
|
key: "addToBankButton",
|
|
131
196
|
value: function addToBankButton() {
|
|
132
|
-
var _this$state = this.state,
|
|
133
|
-
bankType = _this$state.bankType,
|
|
134
|
-
newBankTitle = _this$state.newBankTitle;
|
|
135
|
-
var disabled = bankType === 'existing' && !this.state.selectedBank || bankType === 'new' && (!newBankTitle || !newBankTitle.trim());
|
|
136
197
|
return /*#__PURE__*/React.createElement(Button, {
|
|
137
198
|
color: "primary",
|
|
138
199
|
onClick: this.continueAction,
|
|
139
|
-
disabled: disabled,
|
|
140
200
|
margin: XSMALL_SIDE_MARGIN,
|
|
141
201
|
"data-automation": "sdk-add-to-bank-button"
|
|
142
202
|
}, t('Add'));
|
|
@@ -146,16 +206,22 @@ export var CopyMoveBankEntryModal = /*#__PURE__*/function (_Component) {
|
|
|
146
206
|
value: function renderBankTypeContent() {
|
|
147
207
|
if (this.state.bankType === 'existing') {
|
|
148
208
|
return /*#__PURE__*/React.createElement(BankSelection, {
|
|
209
|
+
inputRef: this.setBankInputRef,
|
|
149
210
|
onBankSelection: this.onBankSelection,
|
|
150
211
|
selectedBank: this.state.selectedBank,
|
|
151
|
-
"data-automation": "sdk-bank-selection"
|
|
212
|
+
"data-automation": "sdk-bank-selection",
|
|
213
|
+
externalError: this.state.selectValidationError,
|
|
214
|
+
isRequired: true
|
|
152
215
|
});
|
|
153
216
|
}
|
|
154
217
|
return /*#__PURE__*/React.createElement(TextInput, {
|
|
155
218
|
onChange: this.onTitleChange,
|
|
156
219
|
value: this.state.newBankTitle,
|
|
157
220
|
renderLabel: t('New Bank Title'),
|
|
158
|
-
type: "text"
|
|
221
|
+
type: "text",
|
|
222
|
+
messages: this.state.selectValidationError,
|
|
223
|
+
ref: this.textInputRef,
|
|
224
|
+
isRequired: true
|
|
159
225
|
});
|
|
160
226
|
}
|
|
161
227
|
}, {
|
|
@@ -165,10 +231,13 @@ export var CopyMoveBankEntryModal = /*#__PURE__*/function (_Component) {
|
|
|
165
231
|
onChange: this.handleRadioChange,
|
|
166
232
|
name: t('Bank Type'),
|
|
167
233
|
defaultValue: this.state.bankType,
|
|
168
|
-
description: /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('Bank Type'))
|
|
234
|
+
description: /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('Bank Type')),
|
|
235
|
+
messages: this.state.radioValidationError,
|
|
236
|
+
isRequired: true
|
|
169
237
|
}, /*#__PURE__*/React.createElement(RadioInput, {
|
|
170
238
|
value: "existing",
|
|
171
|
-
label: t('Existing item bank')
|
|
239
|
+
label: t('Existing item bank'),
|
|
240
|
+
ref: this.radioInputRef
|
|
172
241
|
}), /*#__PURE__*/React.createElement(RadioInput, {
|
|
173
242
|
value: "new",
|
|
174
243
|
label: t('New item bank')
|
|
@@ -156,8 +156,14 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
|
|
|
156
156
|
}, {
|
|
157
157
|
key: "isPassage",
|
|
158
158
|
value: function isPassage() {
|
|
159
|
-
var _this$props$stimulusE;
|
|
160
|
-
|
|
159
|
+
var _this$props$stimulusE, _this$props$stimulusE3;
|
|
160
|
+
if (((_this$props$stimulusE = this.props.stimulusEntry) === null || _this$props$stimulusE === void 0 ? void 0 : _this$props$stimulusE.entryType) === 'BankEntry') {
|
|
161
|
+
var _this$props$stimulusE2;
|
|
162
|
+
var bankEntry = (_this$props$stimulusE2 = this.props.stimulusEntry) === null || _this$props$stimulusE2 === void 0 ? void 0 : _this$props$stimulusE2.getEntry();
|
|
163
|
+
var stimulusEntry = bankEntry === null || bankEntry === void 0 ? void 0 : bankEntry.getEntry();
|
|
164
|
+
return stimulusEntry === null || stimulusEntry === void 0 ? void 0 : stimulusEntry.isPassage;
|
|
165
|
+
}
|
|
166
|
+
return (_this$props$stimulusE3 = this.props.stimulusEntry) === null || _this$props$stimulusE3 === void 0 ? void 0 : _this$props$stimulusE3.getEntry().passage;
|
|
161
167
|
}
|
|
162
168
|
}, {
|
|
163
169
|
key: "anyImmutableKeepers",
|
|
@@ -188,7 +194,7 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
|
|
|
188
194
|
onClick: this.closeAction,
|
|
189
195
|
margin: XSMALL_SIDE_MARGIN,
|
|
190
196
|
"data-automation": "sdk-keep-".concat(this.isPassage() ? 'passage' : 'stimulus', "-button")
|
|
191
|
-
}, this.isPassage() ? t('Keep
|
|
197
|
+
}, this.isPassage() ? t('Keep Text Block') : t('Keep Stimulus'));
|
|
192
198
|
}
|
|
193
199
|
}, {
|
|
194
200
|
key: "doneButton",
|
|
@@ -198,7 +204,7 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
|
|
|
198
204
|
onClick: this.handleSubmit,
|
|
199
205
|
margin: XSMALL_SIDE_MARGIN,
|
|
200
206
|
"data-automation": "sdk-remove-".concat(this.isPassage() ? 'passage' : 'stimulus', "-button")
|
|
201
|
-
}, this.isPassage() ? t('Remove
|
|
207
|
+
}, this.isPassage() ? t('Remove Text Block') : t('Remove Stimulus'));
|
|
202
208
|
}
|
|
203
209
|
}, {
|
|
204
210
|
key: "renderChooseWhich",
|
|
@@ -241,7 +247,7 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
|
|
|
241
247
|
}, {
|
|
242
248
|
key: "renderContent",
|
|
243
249
|
value: function renderContent() {
|
|
244
|
-
var message = this.isPassage() ? t('Are you sure you want to remove this
|
|
250
|
+
var message = this.isPassage() ? t('Are you sure you want to remove this text block?') : t('Are you sure you want to remove this stimulus?');
|
|
245
251
|
var content = this.props.childEntries.size === 0 ? jsx("span", null, message) : this.renderMainMenu();
|
|
246
252
|
var stimulusTitle = this.props.stimulusEntry && this.props.stimulusEntry.getEntry().title;
|
|
247
253
|
return jsx("div", {
|
|
@@ -258,11 +264,11 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
|
|
|
258
264
|
open: this.props.modalOpen,
|
|
259
265
|
onDismiss: this.closeAction,
|
|
260
266
|
size: "small",
|
|
261
|
-
label: this.isPassage() ? t('Confirm
|
|
267
|
+
label: this.isPassage() ? t('Confirm Text Block Removal') : t('Confirm Stimulus Removal')
|
|
262
268
|
}, jsx(ModalHeader, null, jsx(Heading, {
|
|
263
269
|
level: "reset",
|
|
264
270
|
as: "h2"
|
|
265
|
-
}, this.isPassage() ? t('Confirm
|
|
271
|
+
}, this.isPassage() ? t('Confirm Text Block Removal') : t('Confirm Stimulus Removal')), jsx(CloseButton, {
|
|
266
272
|
onClick: this.closeAction,
|
|
267
273
|
placement: "end",
|
|
268
274
|
offset: "medium",
|
|
@@ -89,6 +89,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
|
|
|
89
89
|
}, _this3.props.renderSidebarItem(item, displayPosition, sidebarOpen));
|
|
90
90
|
});
|
|
91
91
|
var transitionType = isShowingItems ? 'slide-down' : 'slide-up';
|
|
92
|
+
var screenReaderText = this.props.isPassage ? t('Collapse text block questions') : t('Collapse stimulus questions');
|
|
92
93
|
return jsx(Transition, {
|
|
93
94
|
"in": isShowingItems || this.shouldDisplayAllItems(),
|
|
94
95
|
type: transitionType
|
|
@@ -100,7 +101,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
|
|
|
100
101
|
withBackground: false,
|
|
101
102
|
withBorder: false,
|
|
102
103
|
renderIcon: IconArrowOpenUpLine,
|
|
103
|
-
screenReaderLabel:
|
|
104
|
+
screenReaderLabel: screenReaderText
|
|
104
105
|
})), jsx("div", null, itemComponents)));
|
|
105
106
|
}
|
|
106
107
|
}, {
|
|
@@ -111,6 +112,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
|
|
|
111
112
|
itemCollection = _this$props2.itemCollection,
|
|
112
113
|
isShowingItems = _this$props2.isShowingItems;
|
|
113
114
|
var transitionType = !isShowingItems ? 'slide-up' : 'slide-down';
|
|
115
|
+
var screenReaderText = this.props.isPassage ? t('Expand text block questions') : t('Expand stimulus questions');
|
|
114
116
|
return jsx(Transition, {
|
|
115
117
|
"in": !isShowingItems,
|
|
116
118
|
type: transitionType
|
|
@@ -124,7 +126,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
|
|
|
124
126
|
withBackground: false,
|
|
125
127
|
withBorder: false,
|
|
126
128
|
renderIcon: IconArrowOpenDownLine,
|
|
127
|
-
screenReaderLabel:
|
|
129
|
+
screenReaderLabel: screenReaderText
|
|
128
130
|
})));
|
|
129
131
|
}
|
|
130
132
|
}, {
|
|
@@ -155,7 +157,8 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
|
|
|
155
157
|
// set in connect
|
|
156
158
|
setSidebarStimulusIsShowing: PropTypes.func.isRequired,
|
|
157
159
|
styles: PropTypes.object,
|
|
158
|
-
makeStyles: PropTypes.func
|
|
160
|
+
makeStyles: PropTypes.func,
|
|
161
|
+
isPassage: PropTypes.bool
|
|
159
162
|
}), _defineProperty(_Collection, "defaultProps", {
|
|
160
163
|
isShowingItems: false
|
|
161
164
|
}), _Collection)) || _class);
|