@instructure/quiz-core 20.4.2-rc.2 → 20.4.2-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/NewItemAnalysis/BlankIcon/index.js +1 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/BlankIcon/presenter.js +40 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/BlankIcon/styles.js +17 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/BlankIcon/theme.js +11 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +2 -1
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +59 -17
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +7 -2
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +2 -1
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/BlankIcon/index.js +13 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/BlankIcon/presenter.js +55 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/BlankIcon/styles.js +25 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/BlankIcon/theme.js +19 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +2 -1
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +60 -17
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +7 -2
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +2 -1
- package/package.json +9 -9
package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/BlankIcon/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BlankIcon as default } from "./presenter.js";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
|
|
6
|
+
var _dec, _class, _class2, _temp;
|
|
7
|
+
|
|
8
|
+
/** @jsx jsx */
|
|
9
|
+
import { Component } from 'react';
|
|
10
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
11
|
+
import generateStyle from "./styles.js";
|
|
12
|
+
import generateComponentTheme from "./theme.js";
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
export var BlankIcon = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
15
|
+
_inherits(BlankIcon, _Component);
|
|
16
|
+
|
|
17
|
+
var _super = _createSuper(BlankIcon);
|
|
18
|
+
|
|
19
|
+
function BlankIcon() {
|
|
20
|
+
_classCallCheck(this, BlankIcon);
|
|
21
|
+
|
|
22
|
+
return _super.apply(this, arguments);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_createClass(BlankIcon, [{
|
|
26
|
+
key: "render",
|
|
27
|
+
value: function render() {
|
|
28
|
+
var number = this.props.number;
|
|
29
|
+
return jsx("span", {
|
|
30
|
+
css: this.props.styles.blankSpace
|
|
31
|
+
}, number);
|
|
32
|
+
}
|
|
33
|
+
}]);
|
|
34
|
+
|
|
35
|
+
BlankIcon.displayName = "BlankIcon";
|
|
36
|
+
return BlankIcon;
|
|
37
|
+
}(Component), _class2.propTypes = {
|
|
38
|
+
number: PropTypes.number.isRequired,
|
|
39
|
+
styles: PropTypes.object
|
|
40
|
+
}.isRequired, _temp)) || _class);
|
package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/BlankIcon/styles.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
2
|
+
return {
|
|
3
|
+
blankSpace: {
|
|
4
|
+
display: 'inline-flex',
|
|
5
|
+
justifyContent: 'center',
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
height: componentTheme.blankHeight,
|
|
8
|
+
minWidth: componentTheme.blankMinWidth,
|
|
9
|
+
verticalAlign: 'middle',
|
|
10
|
+
border: "1px solid ".concat(componentTheme.blankBorderColor),
|
|
11
|
+
borderRadius: componentTheme.blankBorderRadius,
|
|
12
|
+
padding: '2px 2px'
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default generateStyle;
|
package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/BlankIcon/theme.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
|
+
var colors = _ref.colors;
|
|
3
|
+
return {
|
|
4
|
+
blankBorderColor: colors.tiara,
|
|
5
|
+
blankBorderRadius: '14px',
|
|
6
|
+
blankMinWidth: '20px',
|
|
7
|
+
blankHeight: '20px'
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default generateComponentTheme;
|
|
@@ -14,7 +14,8 @@ function mapStateToProps(_state) {
|
|
|
14
14
|
categorizationEnabled: featureOn('ia_categorization_afs'),
|
|
15
15
|
trueFalseEnabled: featureOn('ia_true_false_afs'),
|
|
16
16
|
choiceEnabled: featureOn('ia_choice_afs'),
|
|
17
|
-
multiAnswerEnabled: featureOn('ia_multi_answer_afs')
|
|
17
|
+
multiAnswerEnabled: featureOn('ia_multi_answer_afs'),
|
|
18
|
+
fillInTheBlankEnabled: featureOn('ia_rich_fill_blank_afs')
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
}
|
package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js
CHANGED
|
@@ -10,20 +10,21 @@ import { Heading } from '@instructure/ui-heading';
|
|
|
10
10
|
import { PresentationContent } from '@instructure/ui-a11y-content';
|
|
11
11
|
import React, { Component } from 'react';
|
|
12
12
|
var styles = {
|
|
13
|
-
componentId: '
|
|
13
|
+
componentId: 'eObAE',
|
|
14
14
|
template: function template(theme) {
|
|
15
|
-
return "\n\n.
|
|
15
|
+
return "\n\n.eObAE_eKXQ{padding:".concat(theme.cardWrapperPadding || 'inherit', "}\n\n.eObAE_bwlc{gap:24px;justify-content:space-between;position:relative;row-gap:32px}\n\n.eObAE_bwlc,.eObAE_bqdH{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:wrap}\n\n.eObAE_bqdH{row-gap:24px}\n\n.eObAE_eTaq{align-items:center;border:1px solid ").concat(theme.blankBorderColor || 'inherit', ";border-radius:").concat(theme.blankBorderRadius || 'inherit', ";display:inline-flex;height:").concat(theme.blankHeight || 'inherit', ";justify-content:center;min-width:").concat(theme.blankMinWidth || 'inherit', ";padding:2px 2px;vertical-align:middle}\n\n.eObAE_NpIG{position:absolute;right:").concat(theme.viewPaddingRight || 'inherit', ";top:0}\n\n.eObAE_eoBe{font-size:").concat(theme.metricNumberContextFontSize || 'inherit', ";font-weight:").concat(theme.metricNumberContextFontWeight || 'inherit', "}\n\n.eObAE_fFDJ{display:none}\n\n.eObAE_fxkJ{margin-top:-8px}\n\n.eObAE_esVF{min-height:48px}\n\n.eObAE_eTZq{position:relative}\n\n.eObAE_eTZq:after{background:linear-gradient(180deg,hsla(0,0%,100%,0),#fff);content:\"\";height:48px;left:0;position:absolute;top:0;width:100%}\n\n.eObAE_cVld{max-width:100%;width:calc(25% + 350px)}");
|
|
16
16
|
},
|
|
17
|
-
'cardWrapper': '
|
|
18
|
-
'itemCardInnerContainer': '
|
|
19
|
-
'metricsContainer': '
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
17
|
+
'cardWrapper': 'eObAE_eKXQ',
|
|
18
|
+
'itemCardInnerContainer': 'eObAE_bwlc',
|
|
19
|
+
'metricsContainer': 'eObAE_bqdH',
|
|
20
|
+
'blankSpace': 'eObAE_eTaq',
|
|
21
|
+
'itemCardToggleButtonWrapper': 'eObAE_NpIG',
|
|
22
|
+
'metricNumberContext': 'eObAE_eoBe',
|
|
23
|
+
'hiddenMetrics': 'eObAE_fFDJ',
|
|
24
|
+
'itemBodyToggleButtonWrapper': 'eObAE_fxkJ',
|
|
25
|
+
'itemBody': 'eObAE_esVF',
|
|
26
|
+
'hiddenItemBody': 'eObAE_eTZq',
|
|
27
|
+
'answerFrequencySummaryContainer': 'eObAE_cVld'
|
|
27
28
|
};
|
|
28
29
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
29
30
|
import ExpandButton from "../../../../../common/components/shared/ExpandButton/index.js";
|
|
@@ -42,6 +43,10 @@ import { Flex } from '@instructure/ui-flex';
|
|
|
42
43
|
import { RichContentRenderer } from '@instructure/quiz-rce';
|
|
43
44
|
import { ensureRCEContentIsLoaded } from "../../../../../common/util/rceChecker.js";
|
|
44
45
|
import { PropTypes } from '@instructure/quiz-interactions';
|
|
46
|
+
import { RICH_FILL_BLANK_SLUG } from '@instructure/quiz-common';
|
|
47
|
+
var parser = new DOMParser();
|
|
48
|
+
var parsererrorElement = 'parsererror';
|
|
49
|
+
var parseType = 'text/html';
|
|
45
50
|
export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
46
51
|
_inherits(NewItemAnalysis, _Component);
|
|
47
52
|
|
|
@@ -113,6 +118,34 @@ export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
113
118
|
}, _this.mapInteractionTypeToTranslation(interactionType));
|
|
114
119
|
};
|
|
115
120
|
|
|
121
|
+
_this.isBlank = function (element) {
|
|
122
|
+
if (element.textContent) return false;
|
|
123
|
+
if (!element.hasAttribute('id')) return false;
|
|
124
|
+
var regex = new RegExp('^blank_.+$');
|
|
125
|
+
return regex.test(element.getAttribute('id'));
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
_this.enhanceItemBody = function (itemBody) {
|
|
129
|
+
var tempDoc = parser.parseFromString(itemBody, parseType);
|
|
130
|
+
var errorNode = tempDoc.querySelector(parsererrorElement);
|
|
131
|
+
|
|
132
|
+
if (errorNode) {
|
|
133
|
+
// eslint-disable-next-line no-console
|
|
134
|
+
console.error('Parsing failed: ', errorNode);
|
|
135
|
+
return itemBody;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
Array.from(tempDoc.querySelectorAll('span')).filter(function (span) {
|
|
139
|
+
return _this.isBlank(span);
|
|
140
|
+
}).forEach(function (span, index) {
|
|
141
|
+
var newSpan = span.cloneNode();
|
|
142
|
+
newSpan.setAttribute('class', styles.blankSpace);
|
|
143
|
+
newSpan.innerHTML = "".concat(index + 1);
|
|
144
|
+
span.replaceWith(newSpan);
|
|
145
|
+
});
|
|
146
|
+
return tempDoc.querySelector('body').innerHTML;
|
|
147
|
+
};
|
|
148
|
+
|
|
116
149
|
_this.renderRichContent = function (itemBody, itemBodyClass, itemId) {
|
|
117
150
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
118
151
|
direction: "row",
|
|
@@ -203,6 +236,14 @@ export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
203
236
|
})));
|
|
204
237
|
};
|
|
205
238
|
|
|
239
|
+
_this.shouldEnhanceItemBody = function () {
|
|
240
|
+
var _this$props = _this.props,
|
|
241
|
+
itemAnalysis = _this$props.itemAnalysis,
|
|
242
|
+
afsFlags = _this$props.afsFlags;
|
|
243
|
+
var metadata = itemAnalysis.metadata;
|
|
244
|
+
return afsFlags.fillInTheBlankEnabled && metadata.interaction_type === RICH_FILL_BLANK_SLUG && metadata.item_body;
|
|
245
|
+
};
|
|
246
|
+
|
|
206
247
|
return _this;
|
|
207
248
|
}
|
|
208
249
|
|
|
@@ -243,10 +284,10 @@ export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
243
284
|
value: function render() {
|
|
244
285
|
var _metadata$item_title;
|
|
245
286
|
|
|
246
|
-
var _this$
|
|
247
|
-
showFrequencyTable = _this$
|
|
248
|
-
itemAnalysis = _this$
|
|
249
|
-
afsFlags = _this$
|
|
287
|
+
var _this$props2 = this.props,
|
|
288
|
+
showFrequencyTable = _this$props2.showFrequencyTable,
|
|
289
|
+
itemAnalysis = _this$props2.itemAnalysis,
|
|
290
|
+
afsFlags = _this$props2.afsFlags;
|
|
250
291
|
var answer_summary = itemAnalysis.answer_summary,
|
|
251
292
|
metadata = itemAnalysis.metadata,
|
|
252
293
|
scores = itemAnalysis.scores;
|
|
@@ -255,6 +296,7 @@ export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
255
296
|
var metricsClass = classnames(_defineProperty({}, styles.hiddenMetrics, !this.state.metricsExpanded));
|
|
256
297
|
var itemBodyClass = classnames(styles.itemBody, _defineProperty({}, styles.hiddenItemBody, this.isBodyHigherThanContainer() && !this.state.bodyExpanded));
|
|
257
298
|
var title = (_metadata$item_title = metadata.item_title) !== null && _metadata$item_title !== void 0 ? _metadata$item_title : t('Untitled item');
|
|
299
|
+
var itemBodyEnhanced = this.shouldEnhanceItemBody() ? this.enhanceItemBody(metadata.item_body) : metadata.item_body;
|
|
258
300
|
return /*#__PURE__*/React.createElement(Card, {
|
|
259
301
|
className: styles.cardWrapper
|
|
260
302
|
}, /*#__PURE__*/React.createElement(Flex, {
|
|
@@ -275,7 +317,7 @@ export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
275
317
|
padding: "small xx-small none none",
|
|
276
318
|
overflowY: "hidden",
|
|
277
319
|
size: !this.state.bodyExpanded ? '60px' : void 0
|
|
278
|
-
}, this.renderRichContent(
|
|
320
|
+
}, this.renderRichContent(itemBodyEnhanced, itemBodyClass, itemId)))), /*#__PURE__*/React.createElement(Flex.Item, null, this.renderMetrics(scores, metricsClass)))), showFrequencyTable && this.renderAnswerSummaryTable(itemId, answer_summary, metricsClass, interactionType, afsFlags)));
|
|
279
321
|
}
|
|
280
322
|
}]);
|
|
281
323
|
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
export default function generator(_ref) {
|
|
2
2
|
var spacing = _ref.spacing,
|
|
3
3
|
breakpoints = _ref.breakpoints,
|
|
4
|
-
typography = _ref.typography
|
|
4
|
+
typography = _ref.typography,
|
|
5
|
+
colors = _ref.colors;
|
|
5
6
|
return {
|
|
6
7
|
tabletBreakPoint: "max-width: ".concat(breakpoints.large),
|
|
7
8
|
cardWrapperPadding: spacing.medium,
|
|
8
9
|
viewPaddingRight: spacing.xxSmall,
|
|
9
10
|
metricNumberContextFontSize: typography.fontSizeMedium,
|
|
10
|
-
metricNumberContextFontWeight: typography.fontWeightNormal
|
|
11
|
+
metricNumberContextFontWeight: typography.fontWeightNormal,
|
|
12
|
+
blankBorderColor: colors.tiara,
|
|
13
|
+
blankBorderRadius: '14px',
|
|
14
|
+
blankMinWidth: '20px',
|
|
15
|
+
blankHeight: '20px'
|
|
11
16
|
};
|
|
12
17
|
}
|
|
@@ -90,5 +90,6 @@ export var afsFlags = PropTypes.shape({
|
|
|
90
90
|
categorizationEnabled: PropTypes.bool.isRequired,
|
|
91
91
|
trueFalseEnabled: PropTypes.bool.isRequired,
|
|
92
92
|
choiceEnabled: PropTypes.bool.isRequired,
|
|
93
|
-
multiAnswerEnabled: PropTypes.bool.isRequired
|
|
93
|
+
multiAnswerEnabled: PropTypes.bool.isRequired,
|
|
94
|
+
fillInTheBlankEnabled: PropTypes.bool.isRequired
|
|
94
95
|
});
|
package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/BlankIcon/index.js
ADDED
|
@@ -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.BlankIcon;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _presenter = require("./presenter.js");
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.BlankIcon = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
|
|
16
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
17
|
+
|
|
18
|
+
var _react = require("react");
|
|
19
|
+
|
|
20
|
+
var _emotion = require("@instructure/emotion");
|
|
21
|
+
|
|
22
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
23
|
+
|
|
24
|
+
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
25
|
+
|
|
26
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
+
|
|
28
|
+
var _dec, _class, _class2, _temp;
|
|
29
|
+
|
|
30
|
+
var BlankIcon = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
31
|
+
(0, _inherits2.default)(BlankIcon, _Component);
|
|
32
|
+
|
|
33
|
+
var _super = (0, _createSuper2.default)(BlankIcon);
|
|
34
|
+
|
|
35
|
+
function BlankIcon() {
|
|
36
|
+
(0, _classCallCheck2.default)(this, BlankIcon);
|
|
37
|
+
return _super.apply(this, arguments);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
(0, _createClass2.default)(BlankIcon, [{
|
|
41
|
+
key: "render",
|
|
42
|
+
value: function render() {
|
|
43
|
+
var number = this.props.number;
|
|
44
|
+
return (0, _emotion.jsx)("span", {
|
|
45
|
+
css: this.props.styles.blankSpace
|
|
46
|
+
}, number);
|
|
47
|
+
}
|
|
48
|
+
}]);
|
|
49
|
+
BlankIcon.displayName = "BlankIcon";
|
|
50
|
+
return BlankIcon;
|
|
51
|
+
}(_react.Component), _class2.propTypes = {
|
|
52
|
+
number: _propTypes.default.number.isRequired,
|
|
53
|
+
styles: _propTypes.default.object
|
|
54
|
+
}.isRequired, _temp)) || _class);
|
|
55
|
+
exports.BlankIcon = BlankIcon;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
9
|
+
return {
|
|
10
|
+
blankSpace: {
|
|
11
|
+
display: 'inline-flex',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
height: componentTheme.blankHeight,
|
|
15
|
+
minWidth: componentTheme.blankMinWidth,
|
|
16
|
+
verticalAlign: 'middle',
|
|
17
|
+
border: "1px solid ".concat(componentTheme.blankBorderColor),
|
|
18
|
+
borderRadius: componentTheme.blankBorderRadius,
|
|
19
|
+
padding: '2px 2px'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var _default = generateStyle;
|
|
25
|
+
exports.default = _default;
|
package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/BlankIcon/theme.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
9
|
+
var colors = _ref.colors;
|
|
10
|
+
return {
|
|
11
|
+
blankBorderColor: colors.tiara,
|
|
12
|
+
blankBorderRadius: '14px',
|
|
13
|
+
blankMinWidth: '20px',
|
|
14
|
+
blankHeight: '20px'
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
var _default = generateComponentTheme;
|
|
19
|
+
exports.default = _default;
|
|
@@ -23,7 +23,8 @@ function mapStateToProps(_state) {
|
|
|
23
23
|
categorizationEnabled: (0, _featureCheck.featureOn)('ia_categorization_afs'),
|
|
24
24
|
trueFalseEnabled: (0, _featureCheck.featureOn)('ia_true_false_afs'),
|
|
25
25
|
choiceEnabled: (0, _featureCheck.featureOn)('ia_choice_afs'),
|
|
26
|
-
multiAnswerEnabled: (0, _featureCheck.featureOn)('ia_multi_answer_afs')
|
|
26
|
+
multiAnswerEnabled: (0, _featureCheck.featureOn)('ia_multi_answer_afs'),
|
|
27
|
+
fillInTheBlankEnabled: (0, _featureCheck.featureOn)('ia_rich_fill_blank_afs')
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
30
|
}
|
package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js
CHANGED
|
@@ -59,24 +59,30 @@ var _rceChecker = require("../../../../../common/util/rceChecker.js");
|
|
|
59
59
|
|
|
60
60
|
var _quizInteractions = require("@instructure/quiz-interactions");
|
|
61
61
|
|
|
62
|
+
var _quizCommon = require("@instructure/quiz-common");
|
|
63
|
+
|
|
62
64
|
var _dec, _class, _class2, _temp;
|
|
63
65
|
|
|
64
66
|
var styles = {
|
|
65
|
-
componentId: '
|
|
67
|
+
componentId: 'eObAE',
|
|
66
68
|
template: function template(theme) {
|
|
67
|
-
return "\n\n.
|
|
69
|
+
return "\n\n.eObAE_eKXQ{padding:".concat(theme.cardWrapperPadding || 'inherit', "}\n\n.eObAE_bwlc{gap:24px;justify-content:space-between;position:relative;row-gap:32px}\n\n.eObAE_bwlc,.eObAE_bqdH{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:wrap}\n\n.eObAE_bqdH{row-gap:24px}\n\n.eObAE_eTaq{align-items:center;border:1px solid ").concat(theme.blankBorderColor || 'inherit', ";border-radius:").concat(theme.blankBorderRadius || 'inherit', ";display:inline-flex;height:").concat(theme.blankHeight || 'inherit', ";justify-content:center;min-width:").concat(theme.blankMinWidth || 'inherit', ";padding:2px 2px;vertical-align:middle}\n\n.eObAE_NpIG{position:absolute;right:").concat(theme.viewPaddingRight || 'inherit', ";top:0}\n\n.eObAE_eoBe{font-size:").concat(theme.metricNumberContextFontSize || 'inherit', ";font-weight:").concat(theme.metricNumberContextFontWeight || 'inherit', "}\n\n.eObAE_fFDJ{display:none}\n\n.eObAE_fxkJ{margin-top:-8px}\n\n.eObAE_esVF{min-height:48px}\n\n.eObAE_eTZq{position:relative}\n\n.eObAE_eTZq:after{background:linear-gradient(180deg,hsla(0,0%,100%,0),#fff);content:\"\";height:48px;left:0;position:absolute;top:0;width:100%}\n\n.eObAE_cVld{max-width:100%;width:calc(25% + 350px)}");
|
|
68
70
|
},
|
|
69
|
-
'cardWrapper': '
|
|
70
|
-
'itemCardInnerContainer': '
|
|
71
|
-
'metricsContainer': '
|
|
72
|
-
'
|
|
73
|
-
'
|
|
74
|
-
'
|
|
75
|
-
'
|
|
76
|
-
'
|
|
77
|
-
'
|
|
78
|
-
'
|
|
71
|
+
'cardWrapper': 'eObAE_eKXQ',
|
|
72
|
+
'itemCardInnerContainer': 'eObAE_bwlc',
|
|
73
|
+
'metricsContainer': 'eObAE_bqdH',
|
|
74
|
+
'blankSpace': 'eObAE_eTaq',
|
|
75
|
+
'itemCardToggleButtonWrapper': 'eObAE_NpIG',
|
|
76
|
+
'metricNumberContext': 'eObAE_eoBe',
|
|
77
|
+
'hiddenMetrics': 'eObAE_fFDJ',
|
|
78
|
+
'itemBodyToggleButtonWrapper': 'eObAE_fxkJ',
|
|
79
|
+
'itemBody': 'eObAE_esVF',
|
|
80
|
+
'hiddenItemBody': 'eObAE_eTZq',
|
|
81
|
+
'answerFrequencySummaryContainer': 'eObAE_cVld'
|
|
79
82
|
};
|
|
83
|
+
var parser = new DOMParser();
|
|
84
|
+
var parsererrorElement = 'parsererror';
|
|
85
|
+
var parseType = 'text/html';
|
|
80
86
|
var NewItemAnalysis = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
81
87
|
(0, _inherits2.default)(NewItemAnalysis, _Component);
|
|
82
88
|
|
|
@@ -148,6 +154,34 @@ var NewItemAnalysis = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
148
154
|
}, _this.mapInteractionTypeToTranslation(interactionType));
|
|
149
155
|
};
|
|
150
156
|
|
|
157
|
+
_this.isBlank = function (element) {
|
|
158
|
+
if (element.textContent) return false;
|
|
159
|
+
if (!element.hasAttribute('id')) return false;
|
|
160
|
+
var regex = new RegExp('^blank_.+$');
|
|
161
|
+
return regex.test(element.getAttribute('id'));
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
_this.enhanceItemBody = function (itemBody) {
|
|
165
|
+
var tempDoc = parser.parseFromString(itemBody, parseType);
|
|
166
|
+
var errorNode = tempDoc.querySelector(parsererrorElement);
|
|
167
|
+
|
|
168
|
+
if (errorNode) {
|
|
169
|
+
// eslint-disable-next-line no-console
|
|
170
|
+
console.error('Parsing failed: ', errorNode);
|
|
171
|
+
return itemBody;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
Array.from(tempDoc.querySelectorAll('span')).filter(function (span) {
|
|
175
|
+
return _this.isBlank(span);
|
|
176
|
+
}).forEach(function (span, index) {
|
|
177
|
+
var newSpan = span.cloneNode();
|
|
178
|
+
newSpan.setAttribute('class', styles.blankSpace);
|
|
179
|
+
newSpan.innerHTML = "".concat(index + 1);
|
|
180
|
+
span.replaceWith(newSpan);
|
|
181
|
+
});
|
|
182
|
+
return tempDoc.querySelector('body').innerHTML;
|
|
183
|
+
};
|
|
184
|
+
|
|
151
185
|
_this.renderRichContent = function (itemBody, itemBodyClass, itemId) {
|
|
152
186
|
return /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
|
|
153
187
|
direction: "row",
|
|
@@ -238,6 +272,14 @@ var NewItemAnalysis = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
238
272
|
})));
|
|
239
273
|
};
|
|
240
274
|
|
|
275
|
+
_this.shouldEnhanceItemBody = function () {
|
|
276
|
+
var _this$props = _this.props,
|
|
277
|
+
itemAnalysis = _this$props.itemAnalysis,
|
|
278
|
+
afsFlags = _this$props.afsFlags;
|
|
279
|
+
var metadata = itemAnalysis.metadata;
|
|
280
|
+
return afsFlags.fillInTheBlankEnabled && metadata.interaction_type === _quizCommon.RICH_FILL_BLANK_SLUG && metadata.item_body;
|
|
281
|
+
};
|
|
282
|
+
|
|
241
283
|
return _this;
|
|
242
284
|
}
|
|
243
285
|
|
|
@@ -278,10 +320,10 @@ var NewItemAnalysis = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
278
320
|
value: function render() {
|
|
279
321
|
var _metadata$item_title;
|
|
280
322
|
|
|
281
|
-
var _this$
|
|
282
|
-
showFrequencyTable = _this$
|
|
283
|
-
itemAnalysis = _this$
|
|
284
|
-
afsFlags = _this$
|
|
323
|
+
var _this$props2 = this.props,
|
|
324
|
+
showFrequencyTable = _this$props2.showFrequencyTable,
|
|
325
|
+
itemAnalysis = _this$props2.itemAnalysis,
|
|
326
|
+
afsFlags = _this$props2.afsFlags;
|
|
285
327
|
var answer_summary = itemAnalysis.answer_summary,
|
|
286
328
|
metadata = itemAnalysis.metadata,
|
|
287
329
|
scores = itemAnalysis.scores;
|
|
@@ -290,6 +332,7 @@ var NewItemAnalysis = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
290
332
|
var metricsClass = (0, _classnames3.default)((0, _defineProperty2.default)({}, styles.hiddenMetrics, !this.state.metricsExpanded));
|
|
291
333
|
var itemBodyClass = (0, _classnames3.default)(styles.itemBody, (0, _defineProperty2.default)({}, styles.hiddenItemBody, this.isBodyHigherThanContainer() && !this.state.bodyExpanded));
|
|
292
334
|
var title = (_metadata$item_title = metadata.item_title) !== null && _metadata$item_title !== void 0 ? _metadata$item_title : (0, _formatMessage.default)('Untitled item');
|
|
335
|
+
var itemBodyEnhanced = this.shouldEnhanceItemBody() ? this.enhanceItemBody(metadata.item_body) : metadata.item_body;
|
|
293
336
|
return /*#__PURE__*/_react.default.createElement(_index2.default, {
|
|
294
337
|
className: styles.cardWrapper
|
|
295
338
|
}, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
|
|
@@ -310,7 +353,7 @@ var NewItemAnalysis = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
|
|
|
310
353
|
padding: "small xx-small none none",
|
|
311
354
|
overflowY: "hidden",
|
|
312
355
|
size: !this.state.bodyExpanded ? '60px' : void 0
|
|
313
|
-
}, this.renderRichContent(
|
|
356
|
+
}, this.renderRichContent(itemBodyEnhanced, itemBodyClass, itemId)))), /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, null, this.renderMetrics(scores, metricsClass)))), showFrequencyTable && this.renderAnswerSummaryTable(itemId, answer_summary, metricsClass, interactionType, afsFlags)));
|
|
314
357
|
}
|
|
315
358
|
}]);
|
|
316
359
|
NewItemAnalysis.displayName = "NewItemAnalysis";
|
|
@@ -8,12 +8,17 @@ exports.default = generator;
|
|
|
8
8
|
function generator(_ref) {
|
|
9
9
|
var spacing = _ref.spacing,
|
|
10
10
|
breakpoints = _ref.breakpoints,
|
|
11
|
-
typography = _ref.typography
|
|
11
|
+
typography = _ref.typography,
|
|
12
|
+
colors = _ref.colors;
|
|
12
13
|
return {
|
|
13
14
|
tabletBreakPoint: "max-width: ".concat(breakpoints.large),
|
|
14
15
|
cardWrapperPadding: spacing.medium,
|
|
15
16
|
viewPaddingRight: spacing.xxSmall,
|
|
16
17
|
metricNumberContextFontSize: typography.fontSizeMedium,
|
|
17
|
-
metricNumberContextFontWeight: typography.fontWeightNormal
|
|
18
|
+
metricNumberContextFontWeight: typography.fontWeightNormal,
|
|
19
|
+
blankBorderColor: colors.tiara,
|
|
20
|
+
blankBorderRadius: '14px',
|
|
21
|
+
blankMinWidth: '20px',
|
|
22
|
+
blankHeight: '20px'
|
|
18
23
|
};
|
|
19
24
|
}
|
|
@@ -123,7 +123,8 @@ var afsFlags = _propTypes.default.shape({
|
|
|
123
123
|
categorizationEnabled: _propTypes.default.bool.isRequired,
|
|
124
124
|
trueFalseEnabled: _propTypes.default.bool.isRequired,
|
|
125
125
|
choiceEnabled: _propTypes.default.bool.isRequired,
|
|
126
|
-
multiAnswerEnabled: _propTypes.default.bool.isRequired
|
|
126
|
+
multiAnswerEnabled: _propTypes.default.bool.isRequired,
|
|
127
|
+
fillInTheBlankEnabled: _propTypes.default.bool.isRequired
|
|
127
128
|
});
|
|
128
129
|
|
|
129
130
|
exports.afsFlags = afsFlags;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "20.4.2-rc.
|
|
3
|
+
"version": "20.4.2-rc.3+22ec8e38d",
|
|
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.51.0",
|
|
45
45
|
"@instructure/grading-utils": "^1.0.0",
|
|
46
46
|
"@instructure/outcomes-ui": "^3.0.0",
|
|
47
|
-
"@instructure/quiz-common": "20.4.2-rc.
|
|
48
|
-
"@instructure/quiz-i18n": "20.4.2-rc.
|
|
49
|
-
"@instructure/quiz-interactions": "20.4.2-rc.
|
|
50
|
-
"@instructure/quiz-number-input": "20.4.2-rc.
|
|
51
|
-
"@instructure/quiz-rce": "20.4.2-rc.
|
|
47
|
+
"@instructure/quiz-common": "20.4.2-rc.3+22ec8e38d",
|
|
48
|
+
"@instructure/quiz-i18n": "20.4.2-rc.3+22ec8e38d",
|
|
49
|
+
"@instructure/quiz-interactions": "20.4.2-rc.3+22ec8e38d",
|
|
50
|
+
"@instructure/quiz-number-input": "20.4.2-rc.3+22ec8e38d",
|
|
51
|
+
"@instructure/quiz-rce": "20.4.2-rc.3+22ec8e38d",
|
|
52
52
|
"@instructure/ui-a11y-content": "^8.51.0",
|
|
53
53
|
"@instructure/ui-alerts": "^8.51.0",
|
|
54
54
|
"@instructure/ui-avatar": "^8.51.0",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"file-saver": "~2.0.5",
|
|
113
113
|
"humps": "^2.0.0",
|
|
114
114
|
"immutable": "^3.8.1",
|
|
115
|
-
"instructure-validations": "20.4.2-rc.
|
|
115
|
+
"instructure-validations": "20.4.2-rc.3+22ec8e38d",
|
|
116
116
|
"ipaddr.js": "^1.5.4",
|
|
117
117
|
"isomorphic-fetch": "^2.2.0",
|
|
118
118
|
"isuuid": "^0.1.0",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"intl": "^1.2.4",
|
|
164
164
|
"jquery": "^2.2.3",
|
|
165
165
|
"most-subject": "^5.3.0",
|
|
166
|
-
"quiz-presets": "20.4.2-rc.
|
|
166
|
+
"quiz-presets": "20.4.2-rc.3+22ec8e38d",
|
|
167
167
|
"react": "^16.8.6",
|
|
168
168
|
"react-addons-test-utils": "^15.6.2",
|
|
169
169
|
"react-dom": "^16.8.6",
|
|
@@ -179,5 +179,5 @@
|
|
|
179
179
|
"publishConfig": {
|
|
180
180
|
"access": "public"
|
|
181
181
|
},
|
|
182
|
-
"gitHead": "
|
|
182
|
+
"gitHead": "22ec8e38d00de672820ed31af18d8936f9d54d6f"
|
|
183
183
|
}
|