@instructure/quiz-core 20.7.1-rc.9 → 20.8.1-rc.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/es/banks/api/banks.js +36 -8
  3. package/es/banks/components/Banks/presenter.js +10 -1
  4. package/es/banks/components/BanksList/presenter.js +5 -0
  5. package/es/banks/components/SharingModal/ShareList/index.js +20 -9
  6. package/es/banks/components/SharingModal/asyncSearch.js +65 -6
  7. package/es/banks/components/SharingModal/presenter.js +6 -2
  8. package/es/building/components/resources/BanksTray/presenter.js +7 -0
  9. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/ChoiceTypeWithInfo/index.js +1 -0
  10. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/ChoiceTypeWithInfo/presenter.js +90 -0
  11. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/index.js +1 -0
  12. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/presenter.js +255 -0
  13. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{shared/ChoiceGroupTypeTable → NumericType}/theme.js +1 -2
  14. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{shared → RichFillBlankType}/ChoiceGroupTypeTable/presenter.js +23 -59
  15. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/ChoiceGroupTypeTable/styles.js +10 -0
  16. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/presenter.js +11 -35
  17. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/Table/index.js +120 -0
  18. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/Table/styles.js +38 -0
  19. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/Table/theme.js +11 -0
  20. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/index.js +55 -0
  21. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/presenter.js +14 -0
  22. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsTableWrapper/presenter.js +8 -2
  23. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/index.js +1 -0
  24. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/presenter.js +104 -0
  25. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/{ChoiceGroupTypeTable → ExpandableCard}/styles.js +3 -2
  26. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/theme.js +7 -0
  27. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +4 -1
  28. package/es/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +52 -2
  29. package/lib/banks/api/banks.js +35 -7
  30. package/lib/banks/components/Banks/presenter.js +10 -1
  31. package/lib/banks/components/BanksList/presenter.js +5 -0
  32. package/lib/banks/components/SharingModal/ShareList/index.js +19 -8
  33. package/lib/banks/components/SharingModal/asyncSearch.js +64 -5
  34. package/lib/banks/components/SharingModal/presenter.js +6 -2
  35. package/lib/building/components/resources/BanksTray/presenter.js +7 -0
  36. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/ChoiceTypeWithInfo/index.js +13 -0
  37. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/ChoiceTypeWithInfo/presenter.js +113 -0
  38. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/index.js +13 -0
  39. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/presenter.js +281 -0
  40. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{shared/ChoiceGroupTypeTable → NumericType}/theme.js +1 -2
  41. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{shared → RichFillBlankType}/ChoiceGroupTypeTable/presenter.js +27 -64
  42. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/ChoiceGroupTypeTable/styles.js +18 -0
  43. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/presenter.js +15 -39
  44. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/Table/index.js +140 -0
  45. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/Table/styles.js +46 -0
  46. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/Table/theme.js +19 -0
  47. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/index.js +80 -0
  48. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/presenter.js +20 -4
  49. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsTableWrapper/presenter.js +8 -2
  50. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/index.js +13 -0
  51. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/presenter.js +124 -0
  52. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/{ChoiceGroupTypeTable → ExpandableCard}/styles.js +3 -2
  53. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/theme.js +15 -0
  54. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +4 -1
  55. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +68 -3
  56. package/package.json +10 -10
  57. /package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{RichFillBlankType → NumericType}/styles.js +0 -0
  58. /package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{shared → RichFillBlankType}/ChoiceGroupTypeTable/index.js +0 -0
  59. /package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/{theme.js → ChoiceGroupTypeTable/theme.js} +0 -0
  60. /package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{RichFillBlankType → NumericType}/styles.js +0 -0
  61. /package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{shared → RichFillBlankType}/ChoiceGroupTypeTable/index.js +0 -0
  62. /package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/{theme.js → ChoiceGroupTypeTable/theme.js} +0 -0
@@ -59,6 +59,7 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
59
59
  isShowingOptions: false,
60
60
  isLoading: false,
61
61
  highlightedOptionId: null,
62
+ shareableSubaccounts: [],
62
63
  shareableCourses: [],
63
64
  shareableUsers: []
64
65
  };
@@ -70,7 +71,7 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
70
71
  };
71
72
 
72
73
  _this.handleHideOptions = function () {
73
- var allOptions = [].concat((0, _toConsumableArray2.default)(_this.filterOptions(_this.state.shareableCourses)), (0, _toConsumableArray2.default)(_this.filterOptions(_this.state.shareableUsers))); // an option matching user input exists
74
+ var allOptions = [].concat((0, _toConsumableArray2.default)(_this.filterOptions(_this.state.shareableSubaccounts)), (0, _toConsumableArray2.default)(_this.filterOptions(_this.state.shareableCourses)), (0, _toConsumableArray2.default)(_this.filterOptions(_this.state.shareableUsers))); // an option matching user input exists
74
75
 
75
76
  if (allOptions.length === 1) {
76
77
  var onlyOption = allOptions[0]; // automatically select the matching option
@@ -191,7 +192,8 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
191
192
 
192
193
  _this.search = (0, _debounce.default)(_this.props.debounceDelay, function (value) {
193
194
  var shouldSearchPeople = !_this.props.searchType || _this.props.searchType === _quizCommon.SHARED_WITH_USER;
194
- var shouldSearchCourses = !_this.props.searchType || _this.props.searchType === _quizCommon.SHARED_WITH_COURSE; // TODO add the promise cancellation for avoiding having disordered requests
195
+ var shouldSearchCourses = !_this.props.searchType || _this.props.searchType === _quizCommon.SHARED_WITH_COURSE;
196
+ var shouldSearchSubaccounts = _this.props.searchType === _quizCommon.SHARED_WITH_ACCOUNT; // TODO add the promise cancellation for avoiding having disordered requests
195
197
 
196
198
  if (shouldSearchPeople) {
197
199
  _this.props.getShareableUsers(value).then(function (shareableUsers) {
@@ -216,6 +218,18 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
216
218
  });
217
219
  });
218
220
  }
221
+
222
+ if (shouldSearchSubaccounts) {
223
+ _this.props.getShareableSubaccounts(value).then(function (shareableSubaccounts) {
224
+ var filteredAccounts = _this.filterOptions(shareableSubaccounts);
225
+
226
+ _this.setState({
227
+ shareableSubaccounts: shareableSubaccounts,
228
+ highlightedOptionId: filteredAccounts.length ? filteredAccounts[0].uuid : _this.state.highlightedOptionId,
229
+ isLoading: false
230
+ });
231
+ });
232
+ }
219
233
  });
220
234
  return _this;
221
235
  }
@@ -243,6 +257,16 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
243
257
  });
244
258
  }
245
259
 
260
+ var account = (0, _find.default)({
261
+ uuid: id
262
+ }, this.state.shareableSubaccounts);
263
+
264
+ if (account) {
265
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, account), {}, {
266
+ entityType: _quizCommon.SHARED_WITH_ACCOUNT
267
+ });
268
+ }
269
+
246
270
  return (0, _find.default)({
247
271
  uuid: id
248
272
  }, this.props.selectedOption);
@@ -257,7 +281,7 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
257
281
  key: option.uuid,
258
282
  id: option.uuid,
259
283
  index: index,
260
- text: option.fullName || option.title,
284
+ text: option.fullName || option.title || option.name,
261
285
  onClick: _this2.dismissTag
262
286
  });
263
287
  });
@@ -309,6 +333,24 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
309
333
  }, course.title);
310
334
  }));
311
335
  }
336
+ }, {
337
+ key: "renderSubaccountsOptions",
338
+ value: function renderSubaccountsOptions(subaccounts) {
339
+ var _this6 = this;
340
+
341
+ return /*#__PURE__*/_react.default.createElement(_uiSelect.Select.Group, {
342
+ key: _quizCommon.SHARED_WITH_ACCOUNT,
343
+ renderLabel: (0, _formatMessage.default)('Accounts')
344
+ }, subaccounts.map(function (subaccount) {
345
+ return /*#__PURE__*/_react.default.createElement(_uiSelect.Select.Option, {
346
+ // eslint-disable-next-line react/jsx-no-literals
347
+ "data-automation": "sdk-item-bank-option-subaccount-".concat(subaccount.uuid),
348
+ id: subaccount.uuid,
349
+ key: subaccount.uuid,
350
+ isHighlighted: subaccount.uuid === _this6.state.highlightedOptionId
351
+ }, subaccount.name);
352
+ }));
353
+ }
312
354
  }, {
313
355
  key: "emptyOption",
314
356
  value: function emptyOption() {
@@ -338,6 +380,12 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
338
380
  groups.push(this.renderCoursesOptions(courses));
339
381
  }
340
382
 
383
+ var subaccounts = this.filterOptions(this.state.shareableSubaccounts);
384
+
385
+ if (subaccounts.length) {
386
+ groups.push(this.renderSubaccountsOptions(subaccounts));
387
+ }
388
+
341
389
  return groups.length ? groups : /*#__PURE__*/_react.default.createElement(_uiSelect.Select.Option, {
342
390
  id: _quizCommon.SELECT_EMPTY_OPTION,
343
391
  key: _quizCommon.SELECT_EMPTY_OPTION
@@ -346,17 +394,27 @@ var AsyncSearch = /*#__PURE__*/function (_Component) {
346
394
  size: "x-small"
347
395
  }) : this.emptyOption());
348
396
  }
397
+ }, {
398
+ key: "placeholder",
399
+ value: function placeholder() {
400
+ if (this.props.searchType === _quizCommon.SHARED_WITH_ACCOUNT) {
401
+ return (0, _formatMessage.default)('Enter subaccount name');
402
+ } else if (this.props.searchType === _quizCommon.SHARED_WITH_COURSE) {
403
+ return (0, _formatMessage.default)('Enter course name or course id');
404
+ } else {
405
+ return (0, _formatMessage.default)('Enter name or login id');
406
+ }
407
+ }
349
408
  }, {
350
409
  key: "render",
351
410
  value: function render() {
352
411
  var _this$state = this.state,
353
412
  inputValue = _this$state.inputValue,
354
413
  isShowingOptions = _this$state.isShowingOptions;
355
- var placeholder = this.props.searchType === _quizCommon.SHARED_WITH_COURSE ? (0, _formatMessage.default)('Enter course name or course id') : (0, _formatMessage.default)('Enter name or login id');
356
414
  return /*#__PURE__*/_react.default.createElement(_uiSelect.Select, {
357
415
  "data-automation": "sdk-item-bank-share-input",
358
416
  renderLabel: (0, _formatMessage.default)('Share With'),
359
- placeholder: placeholder,
417
+ placeholder: this.placeholder(),
360
418
  inputValue: inputValue,
361
419
  isShowingOptions: isShowingOptions,
362
420
  inputRef: this.setInputRef,
@@ -383,6 +441,7 @@ AsyncSearch.propTypes = {
383
441
  onSelectionChange: _propTypes.default.func.isRequired,
384
442
  getShareableCourses: _propTypes.default.func.isRequired,
385
443
  getShareableUsers: _propTypes.default.func.isRequired,
444
+ getShareableSubaccounts: _propTypes.default.func.isRequired,
386
445
  searchType: _propTypes.default.string,
387
446
  selectedOption: _propTypes.default.arrayOf(_propTypes.default.shape({
388
447
  avatar: _propTypes.default.string,
@@ -119,7 +119,7 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
119
119
  var size = _this.props.sharedBanks.size;
120
120
 
121
121
  if (size >= 0 && size !== _this.props.bank.sharedCount || size === 0) {
122
- _this.props.getSharedBanks(_this.props.bank, _this.props.getUserInfo, _this.props.getCourseInfo);
122
+ _this.props.getSharedBanks(_this.props.bank, _this.props.getUserInfo, _this.props.getCourseInfo, _this.props.getSubaccountInfo);
123
123
  } else {
124
124
  // eslint-disable-next-line react/no-did-mount-set-state
125
125
  _this.setState({
@@ -291,7 +291,7 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
291
291
  id: entity.uuid,
292
292
  entityType: entity.entityType,
293
293
  entityId: entity.uuid,
294
- title: entity.fullName || entity.title,
294
+ title: entity.fullName || entity.title || entity.name,
295
295
  avatar: entity.avatar,
296
296
  email: entity.email,
297
297
  permission: _this.state.searchPermission
@@ -415,6 +415,7 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
415
415
  }, (0, _emotion.jsx)(_uiGrid.Grid.Row, null, (0, _emotion.jsx)(_uiGrid.Grid.Col, null, (0, _emotion.jsx)(_asyncSearch.default, {
416
416
  getShareableCourses: _this.props.getShareableCourses,
417
417
  getShareableUsers: _this.props.getShareableUsers,
418
+ getShareableSubaccounts: _this.props.getShareableSubaccounts,
418
419
  improvedBankSharingEnabled: _this.props.improvedBankSharingEnabled,
419
420
  minChars: _this.props.minChars,
420
421
  onSelectionChange: _this.handleSearchSelectionChange,
@@ -602,6 +603,7 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
602
603
  bank: _reactImmutableProptypes.default.record.isRequired,
603
604
  currentUser: _propTypes.default.shape({
604
605
  bank_admin: _propTypes.default.bool,
606
+ can_share_banks_with_subaccounts: _propTypes.default.bool,
605
607
  email: _propTypes.default.string,
606
608
  enrollment_names: _propTypes.default.arrayOf(_propTypes.default.string),
607
609
  full_name: _propTypes.default.string,
@@ -615,6 +617,8 @@ var SharingModalPresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _th
615
617
  getShareableUsers: _propTypes.default.func.isRequired,
616
618
  getSharedBanks: _propTypes.default.func.isRequired,
617
619
  getUserInfo: _propTypes.default.func.isRequired,
620
+ getShareableSubaccounts: _propTypes.default.func.isRequired,
621
+ getSubaccountInfo: _propTypes.default.func.isRequired,
618
622
  improvedBankSharingEnabled: _propTypes.default.bool,
619
623
  isOpen: _propTypes.default.bool,
620
624
  minChars: _propTypes.default.number,
@@ -136,8 +136,10 @@ var BanksTray = /*#__PURE__*/function (_Component) {
136
136
  getCourseInfo: this.props.getCourseInfo,
137
137
  getCourseAssignments: this.props.getCourseAssignments,
138
138
  getUserInfo: this.props.getUserInfo,
139
+ getSubaccountInfo: this.props.getSubaccountInfo,
139
140
  getShareableCourses: this.props.getShareableCourses,
140
141
  getShareableUsers: this.props.getShareableUsers,
142
+ getShareableSubaccounts: this.props.getShareableSubaccounts,
141
143
  minChars: this.props.minChars,
142
144
  onShare: this.props.onShare,
143
145
  scope: this.props.itemBanksScope
@@ -200,6 +202,7 @@ BanksTray.propTypes = {
200
202
  clear: _propTypes.default.func.isRequired,
201
203
  currentUser: _propTypes.default.shape({
202
204
  bank_admin: _propTypes.default.bool,
205
+ can_share_banks_with_subaccounts: _propTypes.default.bool,
203
206
  email: _propTypes.default.string,
204
207
  enrollment_names: _propTypes.default.arrayOf(_propTypes.default.string),
205
208
  full_name: _propTypes.default.string,
@@ -211,6 +214,8 @@ BanksTray.propTypes = {
211
214
  getUserInfo: _propTypes.default.func,
212
215
  getShareableCourses: _propTypes.default.func,
213
216
  getShareableUsers: _propTypes.default.func,
217
+ getShareableSubaccounts: _propTypes.default.func,
218
+ getSubaccountInfo: _propTypes.default.func,
214
219
  minChars: _propTypes.default.number,
215
220
  newActiveBank: _propTypes.default.func.isRequired,
216
221
  newActiveBankEntry: _propTypes.default.func.isRequired,
@@ -233,6 +238,8 @@ BanksTray.defaultProps = {
233
238
  currentUser: null,
234
239
  getShareableCourses: null,
235
240
  getShareableUsers: null,
241
+ getShareableSubaccounts: null,
242
+ getSubaccountInfo: null,
236
243
  minChars: void 0,
237
244
  getCourseInfo: null,
238
245
  getCourseAssignments: null,
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _presenter.ChoiceTypeWithInfo;
10
+ }
11
+ });
12
+
13
+ var _presenter = require("./presenter.js");
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.ChoiceTypeWithInfo = void 0;
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+
16
+ var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
17
+
18
+ var _react = _interopRequireWildcard(require("react"));
19
+
20
+ var _propTypes = _interopRequireDefault(require("prop-types"));
21
+
22
+ var _propTypes2 = require("../../../propTypes.js");
23
+
24
+ var _uiFlex = require("@instructure/ui-flex");
25
+
26
+ var _index = _interopRequireDefault(require("../../shared/ChoiceTypeTable/index.js"));
27
+
28
+ var _uiText = require("@instructure/ui-text");
29
+
30
+ var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
31
+
32
+ var ChoiceTypeWithInfo = /*#__PURE__*/function (_Component) {
33
+ (0, _inherits2.default)(ChoiceTypeWithInfo, _Component);
34
+
35
+ var _super = (0, _createSuper2.default)(ChoiceTypeWithInfo);
36
+
37
+ function ChoiceTypeWithInfo() {
38
+ var _this;
39
+
40
+ (0, _classCallCheck2.default)(this, ChoiceTypeWithInfo);
41
+
42
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
+ args[_key] = arguments[_key];
44
+ }
45
+
46
+ _this = _super.call.apply(_super, [this].concat(args));
47
+
48
+ _this.renderTable = function () {
49
+ var _this$props = _this.props,
50
+ itemId = _this$props.itemId,
51
+ choices = _this$props.choices,
52
+ index = _this$props.index;
53
+ var tableId = "".concat(itemId, "_").concat(index, "_choiceGroup");
54
+ var tableContainerSizeClass = '';
55
+ return /*#__PURE__*/_react.default.createElement(_index.default, {
56
+ itemId: tableId,
57
+ choices: choices,
58
+ tableContainerSizeClass: tableContainerSizeClass
59
+ });
60
+ };
61
+
62
+ _this.renderEmptyRequirement = function () {
63
+ return /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, null, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, {
64
+ padding: "medium none none none"
65
+ }, /*#__PURE__*/_react.default.createElement(_uiText.Text, null, (0, _formatMessage.default)('There are no entries for this requirement.'))));
66
+ };
67
+
68
+ _this.render = function () {
69
+ var _this$props2 = _this.props,
70
+ headLine = _this$props2.headLine,
71
+ choices = _this$props2.choices;
72
+ var areThereChoices = Array.isArray(choices) && choices.length > 0;
73
+ return /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
74
+ direction: "column",
75
+ justifyItems: "start"
76
+ }, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, {
77
+ overflowY: "visible",
78
+ shouldGrow: true,
79
+ shouldShrink: true
80
+ }, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
81
+ direction: "column",
82
+ justifyItems: "start"
83
+ }, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, {
84
+ shouldShrink: true,
85
+ padding: "none none none none",
86
+ overflowY: "hidden"
87
+ }, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
88
+ direction: "row",
89
+ alignItems: "start"
90
+ }, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, {
91
+ shouldShrink: true,
92
+ shouldGrow: true,
93
+ margin: "none none none none"
94
+ }, headLine))), /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, {
95
+ shouldShrink: true,
96
+ padding: "none none medium none"
97
+ }, areThereChoices ? _this.renderTable() : _this.renderEmptyRequirement()))));
98
+ };
99
+
100
+ return _this;
101
+ }
102
+
103
+ return ChoiceTypeWithInfo;
104
+ }(_react.Component);
105
+
106
+ exports.ChoiceTypeWithInfo = ChoiceTypeWithInfo;
107
+ ChoiceTypeWithInfo.propTypes = {
108
+ itemId: _propTypes.default.number.isRequired,
109
+ index: _propTypes.default.number.isRequired,
110
+ choices: _propTypes2.choiceTypeObject.isRequired,
111
+ headLine: _propTypes.default.node,
112
+ styles: _propTypes.default.object
113
+ }.isRequired;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _presenter.NumericType;
10
+ }
11
+ });
12
+
13
+ var _presenter = require("./presenter.js");
@@ -0,0 +1,281 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.NumericType = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
+
14
+ var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
15
+
16
+ var _react = require("react");
17
+
18
+ var _propTypes = _interopRequireDefault(require("prop-types"));
19
+
20
+ var _index = _interopRequireDefault(require("../shared/AfsTableWrapper/index.js"));
21
+
22
+ var _presenter = require("../shared/AfsPartsContainer/presenter.js");
23
+
24
+ var _index2 = _interopRequireDefault(require("../shared/AggregationTable/index.js"));
25
+
26
+ var _index3 = _interopRequireDefault(require("../shared/ExpandableCard/index.js"));
27
+
28
+ var _uiText = require("@instructure/ui-text");
29
+
30
+ var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
31
+
32
+ var _index4 = _interopRequireDefault(require("../shared/ChoiceTypeTable/index.js"));
33
+
34
+ var _emotion = require("@instructure/emotion");
35
+
36
+ var _index5 = _interopRequireDefault(require("./ChoiceTypeWithInfo/index.js"));
37
+
38
+ var _styles = _interopRequireDefault(require("./styles.js"));
39
+
40
+ var _theme = _interopRequireDefault(require("./theme.js"));
41
+
42
+ var _uiFlex = require("@instructure/ui-flex");
43
+
44
+ var _propTypes2 = require("../../propTypes.js");
45
+
46
+ var _dec, _class, _class2, _temp;
47
+
48
+ var NumericType = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
49
+ (0, _inherits2.default)(NumericType, _Component);
50
+
51
+ var _super = (0, _createSuper2.default)(NumericType);
52
+
53
+ function NumericType() {
54
+ var _this;
55
+
56
+ (0, _classCallCheck2.default)(this, NumericType);
57
+
58
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
59
+ args[_key] = arguments[_key];
60
+ }
61
+
62
+ _this = _super.call.apply(_super, [this].concat(args));
63
+
64
+ _this.renderIncorrectTable = function () {
65
+ var _this$props = _this.props,
66
+ itemId = _this$props.itemId,
67
+ answerSummary = _this$props.answerSummary;
68
+ var incorrect_answer_choices = answerSummary.requirements.incorrect_answer_choices;
69
+ var tableId = "".concat(itemId, "_incorrect_choices");
70
+ var tableContainerSizeClass = '';
71
+ return (0, _emotion.jsx)(_index4.default, {
72
+ itemId: tableId,
73
+ choices: incorrect_answer_choices,
74
+ tableContainerSizeClass: tableContainerSizeClass
75
+ });
76
+ };
77
+
78
+ _this.getPreciseTypeTranslatable = function (precisionType) {
79
+ switch (precisionType) {
80
+ case 'significantDigits':
81
+ return (0, _formatMessage.default)('Significant Digits');
82
+
83
+ case 'decimals':
84
+ return (0, _formatMessage.default)('Decimal Places');
85
+
86
+ default:
87
+ return precisionType;
88
+ }
89
+ };
90
+
91
+ _this.renderPreciseResponse = function (correct_answers) {
92
+ var typeString = "".concat((0, _formatMessage.default)('Correct answer'), " - ").concat((0, _formatMessage.default)('Precise Response'), " ");
93
+ var answerString = "".concat((0, _formatMessage.default)('Answer'), ": ").concat(correct_answers.value, " ");
94
+ var precisionString = "".concat((0, _formatMessage.default)('Precision'), ": ").concat(correct_answers.precision, " ");
95
+
96
+ var translatablePrecisionType = _this.getPreciseTypeTranslatable(correct_answers.precision_type);
97
+
98
+ var precisionTypeString = "".concat((0, _formatMessage.default)('Type'), ": ").concat(translatablePrecisionType, " ");
99
+ return (0, _emotion.jsx)("div", {
100
+ css: _this.props.styles.groupAggregationContainer
101
+ }, (0, _emotion.jsx)(_uiText.Text, {
102
+ transform: "capitalize",
103
+ weight: "bold"
104
+ }, typeString), (0, _emotion.jsx)(_uiText.Text, {
105
+ transform: "capitalize"
106
+ }, answerString), (0, _emotion.jsx)(_uiText.Text, {
107
+ transform: "capitalize"
108
+ }, precisionString), (0, _emotion.jsx)(_uiText.Text, {
109
+ transform: "capitalize"
110
+ }, precisionTypeString));
111
+ };
112
+
113
+ _this.getMarginTypeTranslatable = function (marginType) {
114
+ switch (marginType) {
115
+ case 'absolute':
116
+ return (0, _formatMessage.default)('Absolute');
117
+
118
+ case 'percent':
119
+ return (0, _formatMessage.default)('Percent');
120
+
121
+ default:
122
+ return marginType;
123
+ }
124
+ };
125
+
126
+ _this.renderMarginOfError = function (correct_answers) {
127
+ var typeString = "".concat((0, _formatMessage.default)('Correct answer'), " - ").concat((0, _formatMessage.default)('Margin Of Error'), " ");
128
+ var answerString = "".concat((0, _formatMessage.default)('Answer'), ": ").concat(correct_answers.value, " ");
129
+ var marginString = "".concat((0, _formatMessage.default)('+/- margin'), ": ").concat(correct_answers.margin, " ");
130
+
131
+ var translatableMarginType = _this.getMarginTypeTranslatable(correct_answers.margin_type);
132
+
133
+ var marginTypeString = "".concat((0, _formatMessage.default)('Type'), ": ").concat(translatableMarginType, " ");
134
+ return (0, _emotion.jsx)("div", {
135
+ css: _this.props.styles.groupAggregationContainer
136
+ }, (0, _emotion.jsx)(_uiText.Text, {
137
+ transform: "capitalize",
138
+ weight: "bold"
139
+ }, typeString), (0, _emotion.jsx)(_uiText.Text, {
140
+ transform: "capitalize"
141
+ }, answerString), (0, _emotion.jsx)(_uiText.Text, {
142
+ transform: "capitalize"
143
+ }, marginString), (0, _emotion.jsx)(_uiText.Text, {
144
+ transform: "capitalize"
145
+ }, marginTypeString));
146
+ };
147
+
148
+ _this.renderExactResponse = function (correct_answers) {
149
+ var typeString = "".concat((0, _formatMessage.default)('Correct answer'), " - ").concat((0, _formatMessage.default)('Exact Response'), " ");
150
+ var answerString = "".concat((0, _formatMessage.default)('Answer'), ": ").concat(correct_answers.value, " ");
151
+ return (0, _emotion.jsx)("div", {
152
+ css: _this.props.styles.groupAggregationContainer
153
+ }, (0, _emotion.jsx)(_uiText.Text, {
154
+ transform: "capitalize",
155
+ weight: "bold"
156
+ }, typeString), (0, _emotion.jsx)(_uiText.Text, {
157
+ transform: "capitalize"
158
+ }, answerString));
159
+ };
160
+
161
+ _this.renderWithinRange = function (correct_answers) {
162
+ var typeString = "".concat((0, _formatMessage.default)('Correct answer'), " - ").concat((0, _formatMessage.default)('Within A Range'), " ");
163
+ var startString = "".concat((0, _formatMessage.default)('Range Starts'), ": ").concat(correct_answers.start, " ");
164
+ var endString = "".concat((0, _formatMessage.default)('Range Ends'), ": ").concat(correct_answers.end, " ");
165
+ return (0, _emotion.jsx)("div", {
166
+ css: _this.props.styles.groupAggregationContainer
167
+ }, (0, _emotion.jsx)(_uiText.Text, {
168
+ transform: "capitalize",
169
+ weight: "bold"
170
+ }, typeString), (0, _emotion.jsx)(_uiText.Text, {
171
+ transform: "capitalize"
172
+ }, startString), (0, _emotion.jsx)(_uiText.Text, {
173
+ transform: "capitalize"
174
+ }, endString));
175
+ };
176
+
177
+ _this.renderUncategorized = function () {
178
+ var typeString = "".concat((0, _formatMessage.default)('Correct answer'), " - ").concat((0, _formatMessage.default)('Uncategorized'), " ");
179
+ return (0, _emotion.jsx)("div", {
180
+ css: _this.props.styles.groupAggregationContainer
181
+ }, (0, _emotion.jsx)(_uiText.Text, {
182
+ transform: "capitalize",
183
+ weight: "bold"
184
+ }, typeString));
185
+ };
186
+
187
+ _this.getHeadLineByType = function (correct_answer) {
188
+ switch (correct_answer.type) {
189
+ case 'withinARange':
190
+ return _this.renderWithinRange(correct_answer);
191
+
192
+ case 'exactResponse':
193
+ return _this.renderExactResponse(correct_answer);
194
+
195
+ case 'preciseResponse':
196
+ return _this.renderPreciseResponse(correct_answer);
197
+
198
+ case 'marginOfError':
199
+ return _this.renderMarginOfError(correct_answer);
200
+
201
+ default:
202
+ return _this.renderUncategorized();
203
+ }
204
+ };
205
+
206
+ _this.renderChoiceTypeWithInfo = function (correct_answer, index, itemId) {
207
+ var key = "ChoiceTypeWithInfo_".concat(itemId, "_").concat(index);
208
+ return (0, _emotion.jsx)(_index5.default, {
209
+ key: key,
210
+ itemId: itemId,
211
+ choices: correct_answer.choices,
212
+ headLine: _this.getHeadLineByType(correct_answer),
213
+ index: index
214
+ });
215
+ };
216
+
217
+ _this.renderCorrectChoiceTypes = function () {
218
+ var _this$props2 = _this.props,
219
+ itemId = _this$props2.itemId,
220
+ answerSummary = _this$props2.answerSummary;
221
+ var correct_answers = answerSummary.requirements.correct_answers;
222
+ return correct_answers.map(function (correct_answer, index) {
223
+ return _this.renderChoiceTypeWithInfo(correct_answer, index, itemId);
224
+ });
225
+ };
226
+
227
+ _this.renderEmptyIncorrect = function () {
228
+ return (0, _emotion.jsx)(_uiFlex.Flex, null, (0, _emotion.jsx)(_uiFlex.Flex.Item, {
229
+ padding: "small none small none"
230
+ }, (0, _emotion.jsx)(_uiText.Text, null, (0, _formatMessage.default)('There are no incorrect answers.'))));
231
+ };
232
+
233
+ _this.renderEmptyCorrect = function () {
234
+ return (0, _emotion.jsx)(_uiFlex.Flex, null, (0, _emotion.jsx)(_uiFlex.Flex.Item, {
235
+ padding: "small none small none"
236
+ }, (0, _emotion.jsx)(_uiText.Text, null, (0, _formatMessage.default)('There are no correct answers.'))));
237
+ };
238
+
239
+ _this.renderAfsTable = function () {
240
+ var answerSummary = _this.props.answerSummary;
241
+ var _answerSummary$requir = answerSummary.requirements,
242
+ correct_answers = _answerSummary$requir.correct_answers,
243
+ incorrect_answer_choices = _answerSummary$requir.incorrect_answer_choices;
244
+ var areThereIncorrectChoices = Array.isArray(incorrect_answer_choices) && incorrect_answer_choices.length > 0;
245
+ var areThereCorrectAnswers = Array.isArray(correct_answers) && correct_answers.length > 0;
246
+ return (0, _emotion.jsx)("div", null, (0, _emotion.jsx)(_index3.default, {
247
+ content: areThereCorrectAnswers ? _this.renderCorrectChoiceTypes() : _this.renderEmptyCorrect(),
248
+ headLine: (0, _emotion.jsx)(_uiText.Text, {
249
+ weight: "bold"
250
+ }, (0, _formatMessage.default)('Correct Answers'))
251
+ }), (0, _emotion.jsx)(_index3.default, {
252
+ content: areThereIncorrectChoices ? _this.renderIncorrectTable() : _this.renderEmptyIncorrect(),
253
+ headLine: (0, _emotion.jsx)(_uiText.Text, {
254
+ weight: "bold"
255
+ }, (0, _formatMessage.default)('Incorrect Answers'))
256
+ }));
257
+ };
258
+
259
+ _this.render = function () {
260
+ var _this$props3 = _this.props,
261
+ answerSummary = _this$props3.answerSummary,
262
+ itemId = _this$props3.itemId;
263
+ return (0, _emotion.jsx)(_index.default, null, (0, _emotion.jsx)(_presenter.AfsPartsContainer, {
264
+ afsTable: _this.renderAfsTable(),
265
+ aggregationTable: (0, _emotion.jsx)(_index2.default, {
266
+ itemId: itemId,
267
+ answerSummary: answerSummary
268
+ })
269
+ }));
270
+ };
271
+
272
+ return _this;
273
+ }
274
+
275
+ return NumericType;
276
+ }(_react.Component), _class2.propTypes = {
277
+ itemId: _propTypes.default.number.isRequired,
278
+ answerSummary: _propTypes2.numericTypeAnswerSummaryPropType.isRequired,
279
+ styles: _propTypes.default.object
280
+ }.isRequired, _temp)) || _class);
281
+ exports.NumericType = NumericType;
@@ -8,8 +8,7 @@ exports.default = void 0;
8
8
  var generateComponentTheme = function generateComponentTheme(_ref) {
9
9
  var spacing = _ref.spacing;
10
10
  return {
11
- cardBottomMargin: spacing.xSmall,
12
- cardMinWidth: '500px'
11
+ aggregateSpacing: spacing.small
13
12
  };
14
13
  };
15
14