@instructure/quiz-core 19.0.1-rc.1 → 19.0.1-rc.3
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/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/presenter.js +75 -34
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/theme.js +1 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/presenter.js +4 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsPartsContainer/presenter.js +6 -5
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsPartsContainer/theme.js +6 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +2 -1
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +2 -1
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/presenter.js +76 -34
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/theme.js +1 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/presenter.js +4 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsPartsContainer/presenter.js +7 -5
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsPartsContainer/theme.js +13 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +2 -1
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +2 -1
- package/package.json +9 -9
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
6
|
|
|
6
|
-
var _dec, _class, _class2, _temp;
|
|
7
|
+
var _rowStyleMap, _dec, _class, _class2, _temp;
|
|
7
8
|
|
|
8
9
|
import React, { Component } from 'react';
|
|
9
10
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
@@ -13,18 +14,19 @@ import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
|
13
14
|
import PropTypes from 'prop-types';
|
|
14
15
|
import { choiceTypeAnswerSummaryPropType } from "../../../propTypes.js";
|
|
15
16
|
var styles = {
|
|
16
|
-
componentId: '
|
|
17
|
+
componentId: 'elvBp',
|
|
17
18
|
template: function template(theme) {
|
|
18
|
-
return "\n\n.
|
|
19
|
+
return "\n\n.elvBp_rMrG{display:flex;flex-basis:100%;flex-direction:column;padding-bottom:".concat(theme.tableBottomPadding || 'inherit', "}\n\n.elvBp_SVtU{max-width:100%;width:calc(25% + 350px)}\n\n.elvBp_SVtU table{border-collapse:separate;border-spacing:0 1px}\n\n.elvBp_eviJ table thead tr td,.elvBp_eviJ table thead tr th{border-bottom:solid 0.0625rem ").concat(theme.colorGray || 'inherit', "}\n\n.elvBp_SVtU table tbody tr th{font-weight:400;width:33.33%}\n\n.elvBp_SVtU table tbody tr td{width:33.33%}\n\n.elvBp_cvRx{align-items:center;display:flex;height:100%;justify-content:center;min-height:47px;width:46px}\n\n.elvBp_EKAb{background-color:").concat(theme.colorGreen || 'inherit', "}\n\n.elvBp_EKAb svg{fill:#fff}\n\n.elvBp_cCmC{align-items:center;display:flex;height:calc(100% - 4px);justify-content:center}\n\n.elvBp_dJVn{padding:").concat(theme.cellPadding || 'inherit', "}\n\n.elvBp_eEOp td,.elvBp_eEOp th{border-bottom:solid 0.0625rem ").concat(theme.colorGray || 'inherit', "}\n\n.elvBp_UAZE td{border-width:2px 0 2px 0}\n\n.elvBp_UAZE td,.elvBp_UAZE th:first-child{border-color:").concat(theme.colorGreen || 'inherit', ";border-style:solid}\n\n.elvBp_UAZE th:first-child{border-radius:4px 0 0 4px;border-width:2px 0 2px 2px}\n\n.elvBp_UAZE td:last-child{border-color:").concat(theme.colorGreen || 'inherit', ";border-radius:0 4px 4px 0;border-style:solid;border-width:2px 2px 2px 0}");
|
|
19
20
|
},
|
|
20
|
-
'tableWrapper': '
|
|
21
|
-
'tableContainer': '
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
21
|
+
'tableWrapper': 'elvBp_rMrG',
|
|
22
|
+
'tableContainer': 'elvBp_SVtU',
|
|
23
|
+
'headerGrayBottomBorder': 'elvBp_eviJ',
|
|
24
|
+
'iconWrapper': 'elvBp_cvRx',
|
|
25
|
+
'iconCorrect': 'elvBp_EKAb',
|
|
26
|
+
'textContainer': 'elvBp_cCmC',
|
|
27
|
+
'firstTextContainer': 'elvBp_dJVn',
|
|
28
|
+
'incorrectRow': 'elvBp_eEOp',
|
|
29
|
+
'correctRow': 'elvBp_UAZE'
|
|
28
30
|
};
|
|
29
31
|
import theme from "./theme.js";
|
|
30
32
|
import classNames from 'classnames';
|
|
@@ -32,6 +34,9 @@ import { IconCheckSolid, IconXSolid } from '@instructure/ui-icons';
|
|
|
32
34
|
import { extractTextFromHtml } from '@instructure/quiz-interactions';
|
|
33
35
|
import { Flex } from '@instructure/ui-flex';
|
|
34
36
|
import { Text } from '@instructure/ui-text';
|
|
37
|
+
var correctAttribute = 'correct';
|
|
38
|
+
var incorrectAttribute = 'incorrect';
|
|
39
|
+
var rowStyleMap = (_rowStyleMap = {}, _defineProperty(_rowStyleMap, correctAttribute, styles.correctRow), _defineProperty(_rowStyleMap, incorrectAttribute, styles.incorrectRow), _rowStyleMap);
|
|
35
40
|
|
|
36
41
|
var _ref = /*#__PURE__*/React.createElement(IconCheckSolid, null);
|
|
37
42
|
|
|
@@ -60,24 +65,15 @@ export var ChoiceTypeTable = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
60
65
|
}, correct ? _ref : _ref2);
|
|
61
66
|
};
|
|
62
67
|
|
|
63
|
-
_this.renderFirstCell = function (
|
|
64
|
-
var className = classNames(styles.firstTextContainer
|
|
68
|
+
_this.renderFirstCell = function (content) {
|
|
69
|
+
var className = classNames(styles.firstTextContainer);
|
|
65
70
|
return /*#__PURE__*/React.createElement("div", {
|
|
66
71
|
className: className
|
|
67
72
|
}, content);
|
|
68
73
|
};
|
|
69
74
|
|
|
70
|
-
_this.
|
|
71
|
-
var className = classNames(styles.textContainer
|
|
72
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
-
className: className
|
|
74
|
-
}, content);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
_this.renderLastCell = function (correct, content) {
|
|
78
|
-
var _classNames4;
|
|
79
|
-
|
|
80
|
-
var className = classNames(styles.textContainer, (_classNames4 = {}, _defineProperty(_classNames4, styles.correctRowBorder, correct), _defineProperty(_classNames4, styles.correctRowBorderRadius, correct), _classNames4));
|
|
75
|
+
_this.renderCell = function (content) {
|
|
76
|
+
var className = classNames(styles.textContainer);
|
|
81
77
|
return /*#__PURE__*/React.createElement("div", {
|
|
82
78
|
className: className
|
|
83
79
|
}, content);
|
|
@@ -93,6 +89,23 @@ export var ChoiceTypeTable = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
93
89
|
return _this.answerLabel(correct);
|
|
94
90
|
};
|
|
95
91
|
|
|
92
|
+
_this.nextChoiceIsCorrect = function (choices, choiceIndex) {
|
|
93
|
+
var _choices$choiceIndex;
|
|
94
|
+
|
|
95
|
+
return (_choices$choiceIndex = choices[choiceIndex]) === null || _choices$choiceIndex === void 0 ? void 0 : _choices$choiceIndex.correct;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
_this.getDataIconAttribute = function (correct, choiceIndex) {
|
|
99
|
+
var answerSummary = _this.props.answerSummary;
|
|
100
|
+
var choices = answerSummary.choices;
|
|
101
|
+
|
|
102
|
+
if (_this.nextChoiceIsCorrect(choices, choiceIndex + 1) && !correct) {
|
|
103
|
+
return '';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return correct ? correctAttribute : incorrectAttribute;
|
|
107
|
+
};
|
|
108
|
+
|
|
96
109
|
_this.renderRow = function (choice, choiceIndex) {
|
|
97
110
|
var correct = choice.correct,
|
|
98
111
|
body = choice.body;
|
|
@@ -103,7 +116,7 @@ export var ChoiceTypeTable = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
103
116
|
return /*#__PURE__*/React.createElement(Table.Row, {
|
|
104
117
|
key: choiceIndex
|
|
105
118
|
}, /*#__PURE__*/React.createElement(Table.RowHeader, {
|
|
106
|
-
|
|
119
|
+
themeOverride: {
|
|
107
120
|
padding: '0'
|
|
108
121
|
}
|
|
109
122
|
}, /*#__PURE__*/React.createElement(ScreenReaderContent, null, screenReaderContent), /*#__PURE__*/React.createElement(Flex, {
|
|
@@ -114,20 +127,46 @@ export var ChoiceTypeTable = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
114
127
|
textAlign: "center",
|
|
115
128
|
align: "stretch"
|
|
116
129
|
}, /*#__PURE__*/React.createElement("div", {
|
|
130
|
+
"data-icon": _this.getDataIconAttribute(correct, choiceIndex),
|
|
117
131
|
className: classNames(styles.iconWrapper)
|
|
118
132
|
}, _this.renderIcon(correct))), /*#__PURE__*/React.createElement(Flex.Item, {
|
|
119
133
|
shouldShrink: true,
|
|
120
134
|
shouldGrow: true
|
|
121
|
-
}, /*#__PURE__*/React.createElement(Text, null, _this.renderFirstCell(
|
|
122
|
-
|
|
135
|
+
}, /*#__PURE__*/React.createElement(Text, null, _this.renderFirstCell(extractedBody))))), /*#__PURE__*/React.createElement(Table.Cell, {
|
|
136
|
+
themeOverride: {
|
|
123
137
|
padding: '0'
|
|
124
138
|
}
|
|
125
|
-
}, _this.
|
|
126
|
-
|
|
139
|
+
}, _this.renderCell(choice.count)), /*#__PURE__*/React.createElement(Table.Cell, {
|
|
140
|
+
themeOverride: {
|
|
127
141
|
padding: '0'
|
|
128
142
|
},
|
|
129
143
|
textAlign: "center"
|
|
130
|
-
}, _this.
|
|
144
|
+
}, _this.renderCell("".concat(choice.percentage, "%"))));
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
_this.componentDidMount = function () {
|
|
148
|
+
if (_this.tableRef) {
|
|
149
|
+
var _iterator = _createForOfIteratorHelper(_this.tableRef.rows),
|
|
150
|
+
_step;
|
|
151
|
+
|
|
152
|
+
try {
|
|
153
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
154
|
+
var _row$querySelector, _row$querySelector$da;
|
|
155
|
+
|
|
156
|
+
var row = _step.value;
|
|
157
|
+
var icon = (_row$querySelector = row.querySelector('tr th:first-child [data-icon]')) === null || _row$querySelector === void 0 ? void 0 : (_row$querySelector$da = _row$querySelector.dataset) === null || _row$querySelector$da === void 0 ? void 0 : _row$querySelector$da.icon;
|
|
158
|
+
row.classList.add(rowStyleMap[icon]);
|
|
159
|
+
}
|
|
160
|
+
} catch (err) {
|
|
161
|
+
_iterator.e(err);
|
|
162
|
+
} finally {
|
|
163
|
+
_iterator.f();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
_this.setTableRef = function (el) {
|
|
169
|
+
return _this.tableRef = el;
|
|
131
170
|
};
|
|
132
171
|
|
|
133
172
|
_this.render = function () {
|
|
@@ -138,14 +177,16 @@ export var ChoiceTypeTable = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
138
177
|
var answerHeaderId = "answer-frequency-summary-answer-".concat(itemId);
|
|
139
178
|
var respondentsHeaderId = "answer-frequency-summary-respondents-".concat(itemId);
|
|
140
179
|
var percentageHeaderId = "answer-frequency-summary-percentage-".concat(itemId);
|
|
180
|
+
var containerClasses = classNames(styles.tableContainer, _defineProperty({}, styles.headerGrayBottomBorder, !_this.nextChoiceIsCorrect(choices, 0)));
|
|
141
181
|
return /*#__PURE__*/React.createElement("div", {
|
|
142
|
-
className:
|
|
182
|
+
className: containerClasses
|
|
143
183
|
}, /*#__PURE__*/React.createElement(Table, {
|
|
144
|
-
caption: t('Answer Frequency Summary')
|
|
184
|
+
caption: t('Answer Frequency Summary'),
|
|
185
|
+
elementRef: _this.setTableRef
|
|
145
186
|
}, /*#__PURE__*/React.createElement(Table.Head, null, /*#__PURE__*/React.createElement(Table.Row, null, /*#__PURE__*/React.createElement(Table.ColHeader, {
|
|
146
187
|
id: answerHeaderId,
|
|
147
188
|
height: "47px",
|
|
148
|
-
|
|
189
|
+
themeOverride: {
|
|
149
190
|
padding: '0 0 0 57px'
|
|
150
191
|
}
|
|
151
192
|
}, t('Answer')), /*#__PURE__*/React.createElement(Table.ColHeader, {
|
package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/presenter.js
CHANGED
|
@@ -49,6 +49,10 @@ export var AnswerFrequencySummary = /*#__PURE__*/function (_Component) {
|
|
|
49
49
|
if (afsFlags.trueFalseEnabled) {
|
|
50
50
|
_this.afsTableComponentMap.set('true-false', ChoiceType);
|
|
51
51
|
}
|
|
52
|
+
|
|
53
|
+
if (afsFlags.choiceEnabled) {
|
|
54
|
+
_this.afsTableComponentMap.set('choice', ChoiceType);
|
|
55
|
+
}
|
|
52
56
|
};
|
|
53
57
|
|
|
54
58
|
_this.render = function () {
|
|
@@ -9,15 +9,16 @@ import React, { Component } from 'react';
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import { themeable } from '@instructure/ui-themeable';
|
|
11
11
|
var styles = {
|
|
12
|
-
componentId: '
|
|
12
|
+
componentId: 'DjkQc',
|
|
13
13
|
template: function template(theme) {
|
|
14
|
-
return "\n\n.
|
|
14
|
+
return "\n\n.DjkQc_SVtU{max-width:100%;width:calc(25% + 350px)}\n\n.DjkQc_ellB{margin-top:".concat(theme.marginOfTables || 'inherit', "}");
|
|
15
15
|
},
|
|
16
|
-
'tableContainer': '
|
|
17
|
-
'aggregateContainer': '
|
|
16
|
+
'tableContainer': 'DjkQc_SVtU',
|
|
17
|
+
'aggregateContainer': 'DjkQc_ellB'
|
|
18
18
|
};
|
|
19
19
|
import classNames from 'classnames';
|
|
20
|
-
|
|
20
|
+
import theme from "./theme.js";
|
|
21
|
+
export var AfsPartsContainer = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
21
22
|
_inherits(AfsPartsContainer, _Component);
|
|
22
23
|
|
|
23
24
|
var _super = _createSuper(AfsPartsContainer);
|
|
@@ -12,7 +12,8 @@ function mapStateToProps(_state) {
|
|
|
12
12
|
orderingEnabled: featureOn('ia_ordering_afs'),
|
|
13
13
|
hotSpotEnabled: featureOn('ia_hot_spot_afs'),
|
|
14
14
|
categorizationEnabled: featureOn('ia_categorization_afs'),
|
|
15
|
-
trueFalseEnabled: featureOn('ia_true_false_afs')
|
|
15
|
+
trueFalseEnabled: featureOn('ia_true_false_afs'),
|
|
16
|
+
choiceEnabled: featureOn('ia_choice_afs')
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
}
|
|
@@ -88,5 +88,6 @@ export var afsFlags = PropTypes.shape({
|
|
|
88
88
|
hotSpotEnabled: PropTypes.bool.isRequired,
|
|
89
89
|
orderingEnabled: PropTypes.bool.isRequired,
|
|
90
90
|
categorizationEnabled: PropTypes.bool.isRequired,
|
|
91
|
-
trueFalseEnabled: PropTypes.bool.isRequired
|
|
91
|
+
trueFalseEnabled: PropTypes.bool.isRequired,
|
|
92
|
+
choiceEnabled: PropTypes.bool.isRequired
|
|
92
93
|
});
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.ChoiceTypeTable = void 0;
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
|
13
13
|
|
|
14
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
15
|
|
|
@@ -17,6 +17,8 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
17
17
|
|
|
18
18
|
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
19
|
|
|
20
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
+
|
|
20
22
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
23
|
|
|
22
24
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
@@ -43,22 +45,26 @@ var _uiFlex = require("@instructure/ui-flex");
|
|
|
43
45
|
|
|
44
46
|
var _uiText = require("@instructure/ui-text");
|
|
45
47
|
|
|
46
|
-
var _dec, _class, _class2, _temp;
|
|
48
|
+
var _rowStyleMap, _dec, _class, _class2, _temp;
|
|
47
49
|
|
|
48
50
|
var styles = {
|
|
49
|
-
componentId: '
|
|
51
|
+
componentId: 'elvBp',
|
|
50
52
|
template: function template(theme) {
|
|
51
|
-
return "\n\n.
|
|
53
|
+
return "\n\n.elvBp_rMrG{display:flex;flex-basis:100%;flex-direction:column;padding-bottom:".concat(theme.tableBottomPadding || 'inherit', "}\n\n.elvBp_SVtU{max-width:100%;width:calc(25% + 350px)}\n\n.elvBp_SVtU table{border-collapse:separate;border-spacing:0 1px}\n\n.elvBp_eviJ table thead tr td,.elvBp_eviJ table thead tr th{border-bottom:solid 0.0625rem ").concat(theme.colorGray || 'inherit', "}\n\n.elvBp_SVtU table tbody tr th{font-weight:400;width:33.33%}\n\n.elvBp_SVtU table tbody tr td{width:33.33%}\n\n.elvBp_cvRx{align-items:center;display:flex;height:100%;justify-content:center;min-height:47px;width:46px}\n\n.elvBp_EKAb{background-color:").concat(theme.colorGreen || 'inherit', "}\n\n.elvBp_EKAb svg{fill:#fff}\n\n.elvBp_cCmC{align-items:center;display:flex;height:calc(100% - 4px);justify-content:center}\n\n.elvBp_dJVn{padding:").concat(theme.cellPadding || 'inherit', "}\n\n.elvBp_eEOp td,.elvBp_eEOp th{border-bottom:solid 0.0625rem ").concat(theme.colorGray || 'inherit', "}\n\n.elvBp_UAZE td{border-width:2px 0 2px 0}\n\n.elvBp_UAZE td,.elvBp_UAZE th:first-child{border-color:").concat(theme.colorGreen || 'inherit', ";border-style:solid}\n\n.elvBp_UAZE th:first-child{border-radius:4px 0 0 4px;border-width:2px 0 2px 2px}\n\n.elvBp_UAZE td:last-child{border-color:").concat(theme.colorGreen || 'inherit', ";border-radius:0 4px 4px 0;border-style:solid;border-width:2px 2px 2px 0}");
|
|
52
54
|
},
|
|
53
|
-
'tableWrapper': '
|
|
54
|
-
'tableContainer': '
|
|
55
|
-
'
|
|
56
|
-
'
|
|
57
|
-
'
|
|
58
|
-
'
|
|
59
|
-
'
|
|
60
|
-
'
|
|
55
|
+
'tableWrapper': 'elvBp_rMrG',
|
|
56
|
+
'tableContainer': 'elvBp_SVtU',
|
|
57
|
+
'headerGrayBottomBorder': 'elvBp_eviJ',
|
|
58
|
+
'iconWrapper': 'elvBp_cvRx',
|
|
59
|
+
'iconCorrect': 'elvBp_EKAb',
|
|
60
|
+
'textContainer': 'elvBp_cCmC',
|
|
61
|
+
'firstTextContainer': 'elvBp_dJVn',
|
|
62
|
+
'incorrectRow': 'elvBp_eEOp',
|
|
63
|
+
'correctRow': 'elvBp_UAZE'
|
|
61
64
|
};
|
|
65
|
+
var correctAttribute = 'correct';
|
|
66
|
+
var incorrectAttribute = 'incorrect';
|
|
67
|
+
var rowStyleMap = (_rowStyleMap = {}, (0, _defineProperty2.default)(_rowStyleMap, correctAttribute, styles.correctRow), (0, _defineProperty2.default)(_rowStyleMap, incorrectAttribute, styles.incorrectRow), _rowStyleMap);
|
|
62
68
|
|
|
63
69
|
var _ref = /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckSolid, null);
|
|
64
70
|
|
|
@@ -87,24 +93,15 @@ var ChoiceTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
87
93
|
}, correct ? _ref : _ref2);
|
|
88
94
|
};
|
|
89
95
|
|
|
90
|
-
_this.renderFirstCell = function (
|
|
91
|
-
var className = (0, _classnames.default)(styles.firstTextContainer
|
|
96
|
+
_this.renderFirstCell = function (content) {
|
|
97
|
+
var className = (0, _classnames.default)(styles.firstTextContainer);
|
|
92
98
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
93
99
|
className: className
|
|
94
100
|
}, content);
|
|
95
101
|
};
|
|
96
102
|
|
|
97
|
-
_this.
|
|
98
|
-
var className = (0, _classnames.default)(styles.textContainer
|
|
99
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
100
|
-
className: className
|
|
101
|
-
}, content);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
_this.renderLastCell = function (correct, content) {
|
|
105
|
-
var _classNames4;
|
|
106
|
-
|
|
107
|
-
var className = (0, _classnames.default)(styles.textContainer, (_classNames4 = {}, (0, _defineProperty2.default)(_classNames4, styles.correctRowBorder, correct), (0, _defineProperty2.default)(_classNames4, styles.correctRowBorderRadius, correct), _classNames4));
|
|
103
|
+
_this.renderCell = function (content) {
|
|
104
|
+
var className = (0, _classnames.default)(styles.textContainer);
|
|
108
105
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
109
106
|
className: className
|
|
110
107
|
}, content);
|
|
@@ -120,6 +117,23 @@ var ChoiceTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
120
117
|
return _this.answerLabel(correct);
|
|
121
118
|
};
|
|
122
119
|
|
|
120
|
+
_this.nextChoiceIsCorrect = function (choices, choiceIndex) {
|
|
121
|
+
var _choices$choiceIndex;
|
|
122
|
+
|
|
123
|
+
return (_choices$choiceIndex = choices[choiceIndex]) === null || _choices$choiceIndex === void 0 ? void 0 : _choices$choiceIndex.correct;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
_this.getDataIconAttribute = function (correct, choiceIndex) {
|
|
127
|
+
var answerSummary = _this.props.answerSummary;
|
|
128
|
+
var choices = answerSummary.choices;
|
|
129
|
+
|
|
130
|
+
if (_this.nextChoiceIsCorrect(choices, choiceIndex + 1) && !correct) {
|
|
131
|
+
return '';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return correct ? correctAttribute : incorrectAttribute;
|
|
135
|
+
};
|
|
136
|
+
|
|
123
137
|
_this.renderRow = function (choice, choiceIndex) {
|
|
124
138
|
var correct = choice.correct,
|
|
125
139
|
body = choice.body;
|
|
@@ -130,7 +144,7 @@ var ChoiceTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
130
144
|
return /*#__PURE__*/_react.default.createElement(_uiTable.Table.Row, {
|
|
131
145
|
key: choiceIndex
|
|
132
146
|
}, /*#__PURE__*/_react.default.createElement(_uiTable.Table.RowHeader, {
|
|
133
|
-
|
|
147
|
+
themeOverride: {
|
|
134
148
|
padding: '0'
|
|
135
149
|
}
|
|
136
150
|
}, /*#__PURE__*/_react.default.createElement(_uiA11yContent.ScreenReaderContent, null, screenReaderContent), /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
|
|
@@ -141,20 +155,46 @@ var ChoiceTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
141
155
|
textAlign: "center",
|
|
142
156
|
align: "stretch"
|
|
143
157
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
158
|
+
"data-icon": _this.getDataIconAttribute(correct, choiceIndex),
|
|
144
159
|
className: (0, _classnames.default)(styles.iconWrapper)
|
|
145
160
|
}, _this.renderIcon(correct))), /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, {
|
|
146
161
|
shouldShrink: true,
|
|
147
162
|
shouldGrow: true
|
|
148
|
-
}, /*#__PURE__*/_react.default.createElement(_uiText.Text, null, _this.renderFirstCell(
|
|
149
|
-
|
|
163
|
+
}, /*#__PURE__*/_react.default.createElement(_uiText.Text, null, _this.renderFirstCell(extractedBody))))), /*#__PURE__*/_react.default.createElement(_uiTable.Table.Cell, {
|
|
164
|
+
themeOverride: {
|
|
150
165
|
padding: '0'
|
|
151
166
|
}
|
|
152
|
-
}, _this.
|
|
153
|
-
|
|
167
|
+
}, _this.renderCell(choice.count)), /*#__PURE__*/_react.default.createElement(_uiTable.Table.Cell, {
|
|
168
|
+
themeOverride: {
|
|
154
169
|
padding: '0'
|
|
155
170
|
},
|
|
156
171
|
textAlign: "center"
|
|
157
|
-
}, _this.
|
|
172
|
+
}, _this.renderCell("".concat(choice.percentage, "%"))));
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
_this.componentDidMount = function () {
|
|
176
|
+
if (_this.tableRef) {
|
|
177
|
+
var _iterator = (0, _createForOfIteratorHelper2.default)(_this.tableRef.rows),
|
|
178
|
+
_step;
|
|
179
|
+
|
|
180
|
+
try {
|
|
181
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
182
|
+
var _row$querySelector, _row$querySelector$da;
|
|
183
|
+
|
|
184
|
+
var row = _step.value;
|
|
185
|
+
var icon = (_row$querySelector = row.querySelector('tr th:first-child [data-icon]')) === null || _row$querySelector === void 0 ? void 0 : (_row$querySelector$da = _row$querySelector.dataset) === null || _row$querySelector$da === void 0 ? void 0 : _row$querySelector$da.icon;
|
|
186
|
+
row.classList.add(rowStyleMap[icon]);
|
|
187
|
+
}
|
|
188
|
+
} catch (err) {
|
|
189
|
+
_iterator.e(err);
|
|
190
|
+
} finally {
|
|
191
|
+
_iterator.f();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
_this.setTableRef = function (el) {
|
|
197
|
+
return _this.tableRef = el;
|
|
158
198
|
};
|
|
159
199
|
|
|
160
200
|
_this.render = function () {
|
|
@@ -165,14 +205,16 @@ var ChoiceTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
165
205
|
var answerHeaderId = "answer-frequency-summary-answer-".concat(itemId);
|
|
166
206
|
var respondentsHeaderId = "answer-frequency-summary-respondents-".concat(itemId);
|
|
167
207
|
var percentageHeaderId = "answer-frequency-summary-percentage-".concat(itemId);
|
|
208
|
+
var containerClasses = (0, _classnames.default)(styles.tableContainer, (0, _defineProperty2.default)({}, styles.headerGrayBottomBorder, !_this.nextChoiceIsCorrect(choices, 0)));
|
|
168
209
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
169
|
-
className:
|
|
210
|
+
className: containerClasses
|
|
170
211
|
}, /*#__PURE__*/_react.default.createElement(_uiTable.Table, {
|
|
171
|
-
caption: (0, _formatMessage.default)('Answer Frequency Summary')
|
|
212
|
+
caption: (0, _formatMessage.default)('Answer Frequency Summary'),
|
|
213
|
+
elementRef: _this.setTableRef
|
|
172
214
|
}, /*#__PURE__*/_react.default.createElement(_uiTable.Table.Head, null, /*#__PURE__*/_react.default.createElement(_uiTable.Table.Row, null, /*#__PURE__*/_react.default.createElement(_uiTable.Table.ColHeader, {
|
|
173
215
|
id: answerHeaderId,
|
|
174
216
|
height: "47px",
|
|
175
|
-
|
|
217
|
+
themeOverride: {
|
|
176
218
|
padding: '0 0 0 57px'
|
|
177
219
|
}
|
|
178
220
|
}, (0, _formatMessage.default)('Answer')), /*#__PURE__*/_react.default.createElement(_uiTable.Table.ColHeader, {
|
|
@@ -70,6 +70,10 @@ var AnswerFrequencySummary = /*#__PURE__*/function (_Component) {
|
|
|
70
70
|
if (afsFlags.trueFalseEnabled) {
|
|
71
71
|
_this.afsTableComponentMap.set('true-false', _index2.default);
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
if (afsFlags.choiceEnabled) {
|
|
75
|
+
_this.afsTableComponentMap.set('choice', _index2.default);
|
|
76
|
+
}
|
|
73
77
|
};
|
|
74
78
|
|
|
75
79
|
_this.render = function () {
|
|
@@ -25,17 +25,19 @@ var _uiThemeable = require("@instructure/ui-themeable");
|
|
|
25
25
|
|
|
26
26
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
27
27
|
|
|
28
|
+
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
29
|
+
|
|
28
30
|
var _dec, _class, _class2, _temp;
|
|
29
31
|
|
|
30
32
|
var styles = {
|
|
31
|
-
componentId: '
|
|
33
|
+
componentId: 'DjkQc',
|
|
32
34
|
template: function template(theme) {
|
|
33
|
-
return "\n\n.
|
|
35
|
+
return "\n\n.DjkQc_SVtU{max-width:100%;width:calc(25% + 350px)}\n\n.DjkQc_ellB{margin-top:".concat(theme.marginOfTables || 'inherit', "}");
|
|
34
36
|
},
|
|
35
|
-
'tableContainer': '
|
|
36
|
-
'aggregateContainer': '
|
|
37
|
+
'tableContainer': 'DjkQc_SVtU',
|
|
38
|
+
'aggregateContainer': 'DjkQc_ellB'
|
|
37
39
|
};
|
|
38
|
-
var AfsPartsContainer = (_dec = (0, _uiThemeable.themeable)(
|
|
40
|
+
var AfsPartsContainer = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
39
41
|
(0, _inherits2.default)(AfsPartsContainer, _Component);
|
|
40
42
|
|
|
41
43
|
var _super = (0, _createSuper2.default)(AfsPartsContainer);
|
|
@@ -21,7 +21,8 @@ function mapStateToProps(_state) {
|
|
|
21
21
|
orderingEnabled: (0, _featureCheck.featureOn)('ia_ordering_afs'),
|
|
22
22
|
hotSpotEnabled: (0, _featureCheck.featureOn)('ia_hot_spot_afs'),
|
|
23
23
|
categorizationEnabled: (0, _featureCheck.featureOn)('ia_categorization_afs'),
|
|
24
|
-
trueFalseEnabled: (0, _featureCheck.featureOn)('ia_true_false_afs')
|
|
24
|
+
trueFalseEnabled: (0, _featureCheck.featureOn)('ia_true_false_afs'),
|
|
25
|
+
choiceEnabled: (0, _featureCheck.featureOn)('ia_choice_afs')
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
28
|
}
|
|
@@ -121,7 +121,8 @@ var afsFlags = _propTypes.default.shape({
|
|
|
121
121
|
hotSpotEnabled: _propTypes.default.bool.isRequired,
|
|
122
122
|
orderingEnabled: _propTypes.default.bool.isRequired,
|
|
123
123
|
categorizationEnabled: _propTypes.default.bool.isRequired,
|
|
124
|
-
trueFalseEnabled: _propTypes.default.bool.isRequired
|
|
124
|
+
trueFalseEnabled: _propTypes.default.bool.isRequired,
|
|
125
|
+
choiceEnabled: _propTypes.default.bool.isRequired
|
|
125
126
|
});
|
|
126
127
|
|
|
127
128
|
exports.afsFlags = afsFlags;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "19.0.1-rc.
|
|
3
|
+
"version": "19.0.1-rc.3+ccf710abb",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@instructure/emotion": "^8.48.3",
|
|
45
45
|
"@instructure/grading-utils": "^1.0.0",
|
|
46
46
|
"@instructure/outcomes-ui": "^2.1.9",
|
|
47
|
-
"@instructure/quiz-common": "19.0.1-rc.
|
|
48
|
-
"@instructure/quiz-i18n": "19.0.1-rc.
|
|
49
|
-
"@instructure/quiz-interactions": "19.0.1-rc.
|
|
50
|
-
"@instructure/quiz-number-input": "19.0.1-rc.
|
|
51
|
-
"@instructure/quiz-rce": "19.0.1-rc.
|
|
47
|
+
"@instructure/quiz-common": "19.0.1-rc.3+ccf710abb",
|
|
48
|
+
"@instructure/quiz-i18n": "19.0.1-rc.3+ccf710abb",
|
|
49
|
+
"@instructure/quiz-interactions": "19.0.1-rc.3+ccf710abb",
|
|
50
|
+
"@instructure/quiz-number-input": "19.0.1-rc.3+ccf710abb",
|
|
51
|
+
"@instructure/quiz-rce": "19.0.1-rc.3+ccf710abb",
|
|
52
52
|
"@instructure/ui-a11y-content": "^8.48.3",
|
|
53
53
|
"@instructure/ui-alerts": "^8.48.3",
|
|
54
54
|
"@instructure/ui-avatar": "^8.48.3",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"file-saver": "~2.0.5",
|
|
111
111
|
"humps": "^2.0.0",
|
|
112
112
|
"immutable": "^3.8.1",
|
|
113
|
-
"instructure-validations": "19.0.1-rc.
|
|
113
|
+
"instructure-validations": "19.0.1-rc.3+ccf710abb",
|
|
114
114
|
"ipaddr.js": "^1.5.4",
|
|
115
115
|
"isomorphic-fetch": "^2.2.0",
|
|
116
116
|
"isuuid": "^0.1.0",
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
"intl": "^1.2.4",
|
|
162
162
|
"jquery": "^2.2.3",
|
|
163
163
|
"most-subject": "^5.3.0",
|
|
164
|
-
"quiz-presets": "19.0.1-rc.
|
|
164
|
+
"quiz-presets": "19.0.1-rc.3+ccf710abb",
|
|
165
165
|
"react": "^16.8.6",
|
|
166
166
|
"react-addons-test-utils": "^15.6.2",
|
|
167
167
|
"react-dom": "^16.8.6",
|
|
@@ -177,5 +177,5 @@
|
|
|
177
177
|
"publishConfig": {
|
|
178
178
|
"access": "public"
|
|
179
179
|
},
|
|
180
|
-
"gitHead": "
|
|
180
|
+
"gitHead": "ccf710abbb15a38788222e936bbdfbf710087793"
|
|
181
181
|
}
|