@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.
- package/CHANGELOG.md +18 -0
- package/es/banks/api/banks.js +36 -8
- package/es/banks/components/Banks/presenter.js +10 -1
- package/es/banks/components/BanksList/presenter.js +5 -0
- package/es/banks/components/SharingModal/ShareList/index.js +20 -9
- package/es/banks/components/SharingModal/asyncSearch.js +65 -6
- package/es/banks/components/SharingModal/presenter.js +6 -2
- package/es/building/components/resources/BanksTray/presenter.js +7 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/ChoiceTypeWithInfo/index.js +1 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/ChoiceTypeWithInfo/presenter.js +90 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/index.js +1 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/presenter.js +255 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{shared/ChoiceGroupTypeTable → NumericType}/theme.js +1 -2
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{shared → RichFillBlankType}/ChoiceGroupTypeTable/presenter.js +23 -59
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/ChoiceGroupTypeTable/styles.js +10 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/presenter.js +11 -35
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/Table/index.js +120 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/Table/styles.js +38 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/Table/theme.js +11 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/index.js +55 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/presenter.js +14 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsTableWrapper/presenter.js +8 -2
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/index.js +1 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/presenter.js +104 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/{ChoiceGroupTypeTable → ExpandableCard}/styles.js +3 -2
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/theme.js +7 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +4 -1
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +52 -2
- package/lib/banks/api/banks.js +35 -7
- package/lib/banks/components/Banks/presenter.js +10 -1
- package/lib/banks/components/BanksList/presenter.js +5 -0
- package/lib/banks/components/SharingModal/ShareList/index.js +19 -8
- package/lib/banks/components/SharingModal/asyncSearch.js +64 -5
- package/lib/banks/components/SharingModal/presenter.js +6 -2
- package/lib/building/components/resources/BanksTray/presenter.js +7 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/ChoiceTypeWithInfo/index.js +13 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/ChoiceTypeWithInfo/presenter.js +113 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/index.js +13 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/NumericType/presenter.js +281 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{shared/ChoiceGroupTypeTable → NumericType}/theme.js +1 -2
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{shared → RichFillBlankType}/ChoiceGroupTypeTable/presenter.js +27 -64
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/ChoiceGroupTypeTable/styles.js +18 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/presenter.js +15 -39
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/Table/index.js +140 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/Table/styles.js +46 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/Table/theme.js +19 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ScoreDistributionType/index.js +80 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/presenter.js +20 -4
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsTableWrapper/presenter.js +8 -2
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/index.js +13 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/presenter.js +124 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/{ChoiceGroupTypeTable → ExpandableCard}/styles.js +3 -2
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/ExpandableCard/theme.js +15 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +4 -1
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +68 -3
- package/package.json +10 -10
- /package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{RichFillBlankType → NumericType}/styles.js +0 -0
- /package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{shared → RichFillBlankType}/ChoiceGroupTypeTable/index.js +0 -0
- /package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/{theme.js → ChoiceGroupTypeTable/theme.js} +0 -0
- /package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{RichFillBlankType → NumericType}/styles.js +0 -0
- /package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/{shared → RichFillBlankType}/ChoiceGroupTypeTable/index.js +0 -0
- /package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/RichFillBlankType/{theme.js → ChoiceGroupTypeTable/theme.js} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
3
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
4
|
+
import React, { Component } from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import ScoreDistributionTypeTable from "./Table/index.js";
|
|
7
|
+
import { scoreDistributionTypeAnswerSummaryPropType } from "../../propTypes.js";
|
|
8
|
+
import AggregationTable from "../shared/AggregationTable/index.js";
|
|
9
|
+
import { AfsPartsContainer } from "../shared/AfsPartsContainer/presenter.js";
|
|
10
|
+
import AfsTableWrapper from "../shared/AfsTableWrapper/index.js";
|
|
11
|
+
import t from '@instructure/quiz-i18n/es/format-message';
|
|
12
|
+
export var ScoreDistributionType = /*#__PURE__*/function (_Component) {
|
|
13
|
+
_inherits(ScoreDistributionType, _Component);
|
|
14
|
+
|
|
15
|
+
var _super = _createSuper(ScoreDistributionType);
|
|
16
|
+
|
|
17
|
+
function ScoreDistributionType() {
|
|
18
|
+
var _this;
|
|
19
|
+
|
|
20
|
+
_classCallCheck(this, ScoreDistributionType);
|
|
21
|
+
|
|
22
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
23
|
+
args[_key] = arguments[_key];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
27
|
+
|
|
28
|
+
_this.render = function () {
|
|
29
|
+
var _this$props = _this.props,
|
|
30
|
+
answerSummary = _this$props.answerSummary,
|
|
31
|
+
itemId = _this$props.itemId;
|
|
32
|
+
return /*#__PURE__*/React.createElement(AfsTableWrapper, {
|
|
33
|
+
tableHeader: t('Score Frequency Summary')
|
|
34
|
+
}, /*#__PURE__*/React.createElement(AfsPartsContainer, {
|
|
35
|
+
afsTable: /*#__PURE__*/React.createElement(ScoreDistributionTypeTable, {
|
|
36
|
+
itemId: itemId,
|
|
37
|
+
scores: answerSummary.score_distribution
|
|
38
|
+
}),
|
|
39
|
+
aggregationTable: /*#__PURE__*/React.createElement(AggregationTable, {
|
|
40
|
+
itemId: itemId,
|
|
41
|
+
answerSummary: answerSummary
|
|
42
|
+
})
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return _this;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return ScoreDistributionType;
|
|
50
|
+
}(Component);
|
|
51
|
+
ScoreDistributionType.propTypes = {
|
|
52
|
+
itemId: PropTypes.number,
|
|
53
|
+
answerSummary: scoreDistributionTypeAnswerSummaryPropType
|
|
54
|
+
}.isRequired;
|
|
55
|
+
export default ScoreDistributionType;
|
package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/presenter.js
CHANGED
|
@@ -7,7 +7,9 @@ import LegacyChoiceType from "./LegacyChoiceType/index.js";
|
|
|
7
7
|
import ChoiceType from "./ChoiceType/index.js";
|
|
8
8
|
import RichFillBlankType from "./RichFillBlankType/index.js";
|
|
9
9
|
import AggregationType from "./AggregationType/index.js";
|
|
10
|
+
import NumericType from "./NumericType/index.js";
|
|
10
11
|
import { MatchingType, OrderingType, CategorizationType } from "./MatchingType/index.js";
|
|
12
|
+
import { ScoreDistributionType } from "./ScoreDistributionType/index.js";
|
|
11
13
|
import { afsFlags, answerSummaryPropType } from "../propTypes.js";
|
|
12
14
|
export var AnswerFrequencySummary = /*#__PURE__*/function (_Component) {
|
|
13
15
|
_inherits(AnswerFrequencySummary, _Component);
|
|
@@ -62,6 +64,18 @@ export var AnswerFrequencySummary = /*#__PURE__*/function (_Component) {
|
|
|
62
64
|
if (afsFlags.fillInTheBlankEnabled) {
|
|
63
65
|
_this.afsTableComponentMap.set('rich-fill-blank', RichFillBlankType);
|
|
64
66
|
}
|
|
67
|
+
|
|
68
|
+
if (afsFlags.numericEnabled) {
|
|
69
|
+
_this.afsTableComponentMap.set('numeric', NumericType);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (afsFlags.essayEnabled) {
|
|
73
|
+
_this.afsTableComponentMap.set('essay', ScoreDistributionType);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (afsFlags.fileUploadEnabled) {
|
|
77
|
+
_this.afsTableComponentMap.set('file-upload', ScoreDistributionType);
|
|
78
|
+
}
|
|
65
79
|
};
|
|
66
80
|
|
|
67
81
|
_this.render = function () {
|
|
@@ -28,6 +28,11 @@ export var AfsTableWrapper = (_dec = withStyle(generateStyle, null), _dec(_class
|
|
|
28
28
|
|
|
29
29
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
30
30
|
|
|
31
|
+
_this.getHeader = function () {
|
|
32
|
+
var tableHeader = _this.props.tableHeader;
|
|
33
|
+
return tableHeader || t('Answer Frequency Summary');
|
|
34
|
+
};
|
|
35
|
+
|
|
31
36
|
_this.render = function () {
|
|
32
37
|
return jsx(Flex, {
|
|
33
38
|
direction: "row",
|
|
@@ -41,7 +46,7 @@ export var AfsTableWrapper = (_dec = withStyle(generateStyle, null), _dec(_class
|
|
|
41
46
|
level: "h3",
|
|
42
47
|
weight: "bold",
|
|
43
48
|
color: "primary"
|
|
44
|
-
},
|
|
49
|
+
}, _this.getHeader()), _this.props.children)));
|
|
45
50
|
};
|
|
46
51
|
|
|
47
52
|
return _this;
|
|
@@ -50,5 +55,6 @@ export var AfsTableWrapper = (_dec = withStyle(generateStyle, null), _dec(_class
|
|
|
50
55
|
return AfsTableWrapper;
|
|
51
56
|
}(Component), _class2.propTypes = {
|
|
52
57
|
children: PropTypes.node.isRequired,
|
|
53
|
-
styles: PropTypes.object
|
|
58
|
+
styles: PropTypes.object,
|
|
59
|
+
tableHeader: PropTypes.string
|
|
54
60
|
}, _temp)) || _class);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExpandableCard as default } from "./presenter.js";
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
3
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
4
|
+
|
|
5
|
+
var _dec, _class, _class2, _temp;
|
|
6
|
+
|
|
7
|
+
/** @jsx jsx */
|
|
8
|
+
import { Component } from 'react';
|
|
9
|
+
import Card from "../../../../../../../common/components/shared/Card/index.js";
|
|
10
|
+
import { Flex } from '@instructure/ui-flex';
|
|
11
|
+
import { jsx, withStyle } from '@instructure/emotion';
|
|
12
|
+
import ExpandButton from "../../../../../../../common/components/shared/ExpandButton/index.js";
|
|
13
|
+
import t from '@instructure/quiz-i18n/es/format-message';
|
|
14
|
+
import generateStyle from "./styles.js";
|
|
15
|
+
import generateComponentTheme from "./theme.js";
|
|
16
|
+
import PropTypes from 'prop-types';
|
|
17
|
+
export var ExpandableCard = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
18
|
+
_inherits(ExpandableCard, _Component);
|
|
19
|
+
|
|
20
|
+
var _super = _createSuper(ExpandableCard);
|
|
21
|
+
|
|
22
|
+
function ExpandableCard() {
|
|
23
|
+
var _this;
|
|
24
|
+
|
|
25
|
+
_classCallCheck(this, ExpandableCard);
|
|
26
|
+
|
|
27
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
|
+
args[_key] = arguments[_key];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
32
|
+
_this.state = {
|
|
33
|
+
bodyExpanded: false
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
_this.handleBodyToggle = function () {
|
|
37
|
+
_this.setState({
|
|
38
|
+
bodyExpanded: !_this.state.bodyExpanded
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
_this.renderGroup = function () {
|
|
43
|
+
var headLine = _this.props.headLine;
|
|
44
|
+
return jsx(Flex, {
|
|
45
|
+
direction: "row",
|
|
46
|
+
alignItems: "start"
|
|
47
|
+
}, jsx(Flex.Item, {
|
|
48
|
+
shouldShrink: true,
|
|
49
|
+
shouldGrow: true,
|
|
50
|
+
margin: "xx-small none none none"
|
|
51
|
+
}, headLine), jsx(Flex.Item, {
|
|
52
|
+
margin: "none none none x-small"
|
|
53
|
+
}, jsx(ExpandButton, {
|
|
54
|
+
onClick: _this.handleBodyToggle,
|
|
55
|
+
title: _this.state.bodyExpanded ? t('collapse group result') : t('expand group result'),
|
|
56
|
+
isExpanded: _this.state.bodyExpanded
|
|
57
|
+
})));
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
_this.renderBody = function () {
|
|
61
|
+
var _this$props = _this.props,
|
|
62
|
+
content = _this$props.content,
|
|
63
|
+
styles = _this$props.styles;
|
|
64
|
+
var bodyContainer = styles.bodyContainer;
|
|
65
|
+
return jsx(Flex.Item, {
|
|
66
|
+
shouldShrink: true,
|
|
67
|
+
padding: "x-small small x-small small"
|
|
68
|
+
}, jsx("div", {
|
|
69
|
+
css: bodyContainer
|
|
70
|
+
}, content));
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
_this.render = function () {
|
|
74
|
+
var styles = _this.props.styles;
|
|
75
|
+
var groupWrapper = styles.groupWrapper;
|
|
76
|
+
var bodyExpanded = _this.state.bodyExpanded;
|
|
77
|
+
return jsx("div", {
|
|
78
|
+
css: groupWrapper
|
|
79
|
+
}, jsx(Card, null, jsx(Flex, {
|
|
80
|
+
direction: "column",
|
|
81
|
+
justifyItems: "start"
|
|
82
|
+
}, jsx(Flex.Item, {
|
|
83
|
+
shouldGrow: true,
|
|
84
|
+
shouldShrink: true,
|
|
85
|
+
overflowY: "visible"
|
|
86
|
+
}, jsx(Flex, {
|
|
87
|
+
direction: "column",
|
|
88
|
+
justifyItems: "start"
|
|
89
|
+
}, jsx(Flex.Item, {
|
|
90
|
+
shouldShrink: true,
|
|
91
|
+
padding: "x-small small x-small small",
|
|
92
|
+
overflowY: "hidden"
|
|
93
|
+
}, _this.renderGroup()), bodyExpanded && _this.renderBody())))));
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return _this;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return ExpandableCard;
|
|
100
|
+
}(Component), _class2.propTypes = {
|
|
101
|
+
headLine: PropTypes.node,
|
|
102
|
+
content: PropTypes.node,
|
|
103
|
+
styles: PropTypes.object
|
|
104
|
+
}.isRequired, _temp)) || _class);
|
|
@@ -6,8 +6,9 @@ var generateStyle = function generateStyle(componentTheme) {
|
|
|
6
6
|
minWidth: componentTheme.cardMinWidth,
|
|
7
7
|
maxWidth: '100%'
|
|
8
8
|
},
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
bodyContainer: {
|
|
10
|
+
overflow: 'auto',
|
|
11
|
+
maxHeight: '600px'
|
|
11
12
|
}
|
|
12
13
|
};
|
|
13
14
|
};
|
|
@@ -13,7 +13,10 @@ function mapStateToProps(_state) {
|
|
|
13
13
|
trueFalseEnabled: featureOn('ia_true_false_afs'),
|
|
14
14
|
choiceEnabled: featureOn('ia_choice_afs'),
|
|
15
15
|
multiAnswerEnabled: featureOn('ia_multi_answer_afs'),
|
|
16
|
-
fillInTheBlankEnabled: featureOn('ia_rich_fill_blank_afs')
|
|
16
|
+
fillInTheBlankEnabled: featureOn('ia_rich_fill_blank_afs'),
|
|
17
|
+
essayEnabled: featureOn('ia_essay_afs'),
|
|
18
|
+
fileUploadEnabled: featureOn('ia_file_upload_afs'),
|
|
19
|
+
numericEnabled: featureOn('ia_numeric_afs')
|
|
17
20
|
}
|
|
18
21
|
};
|
|
19
22
|
}
|
|
@@ -50,6 +50,17 @@ export var choiceTypeAnswerSummaryPropType = PropTypes.shape({
|
|
|
50
50
|
no_answer: aggregateDetailPropType,
|
|
51
51
|
aggregate: aggregatePropType
|
|
52
52
|
});
|
|
53
|
+
export var scoreDistributionTypeAnswerSummaryPropType = PropTypes.shape({
|
|
54
|
+
no_answer: aggregateDetailPropType.isRequired,
|
|
55
|
+
aggregate: aggregatePropType.isRequired,
|
|
56
|
+
graded: aggregateDetailPropType.isRequired,
|
|
57
|
+
score_distribution: PropTypes.arrayOf(scoreDistributionType).isRequired
|
|
58
|
+
});
|
|
59
|
+
export var scoreDistributionType = PropTypes.shape({
|
|
60
|
+
count: PropTypes.number.isRequired,
|
|
61
|
+
score: PropTypes.number.isRequired,
|
|
62
|
+
percentage: PropTypes.number.isRequired
|
|
63
|
+
});
|
|
53
64
|
export var matchingTypeAnswerSummaryPropType = PropTypes.shape({
|
|
54
65
|
questions: PropTypes.objectOf(PropTypes.shape({
|
|
55
66
|
body: PropTypes.string,
|
|
@@ -77,7 +88,43 @@ export var richFillBlankTypeAnswerSummaryPropType = PropTypes.shape({
|
|
|
77
88
|
no_answer: aggregateDetailPropType,
|
|
78
89
|
aggregate: aggregatePropType
|
|
79
90
|
});
|
|
80
|
-
|
|
91
|
+
var withinARangeTypeObject = PropTypes.shape({
|
|
92
|
+
end: PropTypes.string.isRequired,
|
|
93
|
+
start: PropTypes.string.isRequired,
|
|
94
|
+
choices: PropTypes.arrayOf(choiceTypeObject).isRequired,
|
|
95
|
+
type: PropTypes.string.isRequired
|
|
96
|
+
});
|
|
97
|
+
var marginOfErrorTypeObject = PropTypes.shape({
|
|
98
|
+
margin: PropTypes.string.isRequired,
|
|
99
|
+
margin_type: PropTypes.string.isRequired,
|
|
100
|
+
value: PropTypes.string.isRequired,
|
|
101
|
+
type: PropTypes.string.isRequired,
|
|
102
|
+
choices: PropTypes.arrayOf(choiceTypeObject).isRequired
|
|
103
|
+
});
|
|
104
|
+
var exactResponseTypeObject = PropTypes.shape({
|
|
105
|
+
value: PropTypes.string.isRequired,
|
|
106
|
+
type: PropTypes.string.isRequired,
|
|
107
|
+
choices: PropTypes.arrayOf(choiceTypeObject).isRequired
|
|
108
|
+
});
|
|
109
|
+
var preciseResponseTypeObject = PropTypes.shape({
|
|
110
|
+
value: PropTypes.string.isRequired,
|
|
111
|
+
precision: PropTypes.string.isRequired,
|
|
112
|
+
precision_type: PropTypes.string.isRequired,
|
|
113
|
+
type: PropTypes.string.isRequired,
|
|
114
|
+
choices: PropTypes.arrayOf(choiceTypeObject).isRequired
|
|
115
|
+
});
|
|
116
|
+
var uncategorizedTypeObject = PropTypes.shape({
|
|
117
|
+
type: PropTypes.string.isRequired,
|
|
118
|
+
choices: PropTypes.arrayOf(choiceTypeObject).isRequired
|
|
119
|
+
});
|
|
120
|
+
var numericRequirementTypeObject = PropTypes.oneOfType([withinARangeTypeObject, marginOfErrorTypeObject, exactResponseTypeObject, preciseResponseTypeObject, uncategorizedTypeObject]);
|
|
121
|
+
export var numericTypeAnswerSummaryPropType = PropTypes.shape({
|
|
122
|
+
requirement: PropTypes.shape({
|
|
123
|
+
correct_answers: PropTypes.arrayOf(numericRequirementTypeObject).isRequired,
|
|
124
|
+
incorrect_answer_choices: PropTypes.arrayOf(choiceTypeObject).isRequired
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
export var answerSummaryPropType = PropTypes.oneOfType([choiceTypeAnswerSummaryPropType, onlyAggregatePropType, matchingTypeAnswerSummaryPropType, richFillBlankTypeAnswerSummaryPropType, scoreDistributionTypeAnswerSummaryPropType]);
|
|
81
128
|
export var itemAnalysisPropType = PropTypes.shape({
|
|
82
129
|
attempts: PropTypes.shape({
|
|
83
130
|
students_responded: PropTypes.number,
|
|
@@ -109,5 +156,8 @@ export var afsFlags = PropTypes.shape({
|
|
|
109
156
|
trueFalseEnabled: PropTypes.bool.isRequired,
|
|
110
157
|
choiceEnabled: PropTypes.bool.isRequired,
|
|
111
158
|
multiAnswerEnabled: PropTypes.bool.isRequired,
|
|
112
|
-
fillInTheBlankEnabled: PropTypes.bool.isRequired
|
|
159
|
+
fillInTheBlankEnabled: PropTypes.bool.isRequired,
|
|
160
|
+
numericEnabled: PropTypes.bool.isRequired,
|
|
161
|
+
essayEnabled: PropTypes.bool.isRequired,
|
|
162
|
+
fileUploadEnabled: PropTypes.bool.isRequired
|
|
113
163
|
});
|
package/lib/banks/api/banks.js
CHANGED
|
@@ -274,10 +274,10 @@ var shareBank = function shareBank(_shareBank) {
|
|
|
274
274
|
};
|
|
275
275
|
dispatch((0, _callHandlers.handleShareBankResponse)(sharedBank));
|
|
276
276
|
});
|
|
277
|
-
} else
|
|
277
|
+
} else {
|
|
278
278
|
var sharedBank = {
|
|
279
279
|
id: sharedBankInfo.id,
|
|
280
|
-
entityType:
|
|
280
|
+
entityType: _shareBank.entityType,
|
|
281
281
|
entityId: _shareBank.entityId,
|
|
282
282
|
title: _shareBank.title,
|
|
283
283
|
permission: sharedBankInfo.permission,
|
|
@@ -326,10 +326,8 @@ var getSharedBank = function getSharedBank(bankId, entityType, entityId) {
|
|
|
326
326
|
|
|
327
327
|
exports.getSharedBank = getSharedBank;
|
|
328
328
|
|
|
329
|
-
var getSharedBanks = function getSharedBanks(bank, getUserInfo, getCourseInfo) {
|
|
329
|
+
var getSharedBanks = function getSharedBanks(bank, getUserInfo, getCourseInfo, getAccountInfo) {
|
|
330
330
|
var url = "".concat(banksApiEndpoint, "/").concat(bank.id, "/shared_banks");
|
|
331
|
-
var userSharedBanks = [];
|
|
332
|
-
var courseSharedBanks = [];
|
|
333
331
|
return function (dispatch, getState) {
|
|
334
332
|
var fetcher = new _Fetcher.default({
|
|
335
333
|
onError: (0, _helpers.handleError)(dispatch, (0, _formatMessage.default)('Failed to fetch shared banks.'))
|
|
@@ -344,8 +342,10 @@ var getSharedBanks = function getSharedBanks(bank, getUserInfo, getCourseInfo) {
|
|
|
344
342
|
permission: _quizCommon.CAN_EDIT,
|
|
345
343
|
bank_id: bank.id
|
|
346
344
|
});
|
|
347
|
-
}
|
|
345
|
+
} // USERS
|
|
346
|
+
|
|
348
347
|
|
|
348
|
+
var userSharedBanks = [];
|
|
349
349
|
var userUuids = sharedBanksInfo.filter(function (sb) {
|
|
350
350
|
return sb.entity_type === _quizCommon.SHARED_WITH_USER;
|
|
351
351
|
}).map(function (sb) {
|
|
@@ -370,7 +370,9 @@ var getSharedBanks = function getSharedBanks(bank, getUserInfo, getCourseInfo) {
|
|
|
370
370
|
}
|
|
371
371
|
});
|
|
372
372
|
dispatch((0, _callHandlers.handleShareBanksResponse)(userSharedBanks));
|
|
373
|
-
});
|
|
373
|
+
}); // COURSES
|
|
374
|
+
|
|
375
|
+
var courseSharedBanks = [];
|
|
374
376
|
var courseUuids = sharedBanksInfo.filter(function (sb) {
|
|
375
377
|
return sb.entity_type === _quizCommon.SHARED_WITH_COURSE;
|
|
376
378
|
}).map(function (sb) {
|
|
@@ -394,6 +396,32 @@ var getSharedBanks = function getSharedBanks(bank, getUserInfo, getCourseInfo) {
|
|
|
394
396
|
}
|
|
395
397
|
});
|
|
396
398
|
dispatch((0, _callHandlers.handleShareBanksResponse)(courseSharedBanks));
|
|
399
|
+
}); // ACCOUNTS
|
|
400
|
+
|
|
401
|
+
var accountSharedBanks = [];
|
|
402
|
+
var accountUuids = sharedBanksInfo.filter(function (sb) {
|
|
403
|
+
return sb.entity_type === _quizCommon.SHARED_WITH_ACCOUNT;
|
|
404
|
+
}).map(function (sb) {
|
|
405
|
+
return sb.entity_id;
|
|
406
|
+
});
|
|
407
|
+
getAccountInfo(accountUuids).then(function (accountsInfo) {
|
|
408
|
+
accountsInfo.forEach(function (accountInfo) {
|
|
409
|
+
var sharedBankInfo = sharedBanksInfo.find(function (sb) {
|
|
410
|
+
return sb.entity_type === _quizCommon.SHARED_WITH_ACCOUNT && sb.entity_id === accountInfo.uuid;
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
if (sharedBankInfo) {
|
|
414
|
+
accountSharedBanks.push({
|
|
415
|
+
id: sharedBankInfo.id,
|
|
416
|
+
entityType: sharedBankInfo.entity_type,
|
|
417
|
+
entityId: sharedBankInfo.entity_id,
|
|
418
|
+
title: accountInfo.name,
|
|
419
|
+
permission: sharedBankInfo.permission,
|
|
420
|
+
bankId: sharedBankInfo.bank_id
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
dispatch((0, _callHandlers.handleShareBanksResponse)(accountSharedBanks));
|
|
397
425
|
});
|
|
398
426
|
});
|
|
399
427
|
};
|
|
@@ -208,8 +208,10 @@ var Banks = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
|
|
|
208
208
|
focusCreateBankButton: _this.focusCreateBankButton,
|
|
209
209
|
getCourseInfo: _this.props.getCourseInfo,
|
|
210
210
|
getUserInfo: _this.props.getUserInfo,
|
|
211
|
+
getSubaccountInfo: _this.props.getSubaccountInfo,
|
|
211
212
|
getShareableCourses: _this.props.getShareableCourses,
|
|
212
213
|
getShareableUsers: _this.props.getShareableUsers,
|
|
214
|
+
getShareableSubaccounts: _this.props.getShareableSubaccounts,
|
|
213
215
|
isCompact: _this.props.isCompact,
|
|
214
216
|
itemBankSearchTableEnabled: _this.props.itemBankSearchTableEnabled,
|
|
215
217
|
minChars: _this.props.minChars,
|
|
@@ -436,6 +438,7 @@ var Banks = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
|
|
|
436
438
|
createBank: _propTypes.default.func.isRequired,
|
|
437
439
|
currentUser: _propTypes.default.shape({
|
|
438
440
|
bank_admin: _propTypes.default.bool,
|
|
441
|
+
can_share_banks_with_subaccounts: _propTypes.default.bool,
|
|
439
442
|
email: _propTypes.default.string,
|
|
440
443
|
enrollment_names: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
441
444
|
full_name: _propTypes.default.string,
|
|
@@ -453,7 +456,11 @@ var Banks = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
|
|
|
453
456
|
getShareableCourses: _propTypes.default.func,
|
|
454
457
|
// from consumer
|
|
455
458
|
getShareableUsers: _propTypes.default.func,
|
|
456
|
-
// from consumer
|
|
459
|
+
// from consumer
|
|
460
|
+
getShareableSubaccounts: _propTypes.default.func,
|
|
461
|
+
// from consumer
|
|
462
|
+
getSubaccountInfo: _propTypes.default.func,
|
|
463
|
+
// from consumer
|
|
457
464
|
getCourseAssignments: _propTypes.default.func,
|
|
458
465
|
// from consumer
|
|
459
466
|
isCompact: _propTypes.default.bool,
|
|
@@ -490,6 +497,8 @@ var Banks = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
|
|
|
490
497
|
getShareableCourses: null,
|
|
491
498
|
getShareableUsers: null,
|
|
492
499
|
getCourseAssignments: null,
|
|
500
|
+
getShareableSubaccounts: null,
|
|
501
|
+
getSubaccountInfo: null,
|
|
493
502
|
minChars: void 0,
|
|
494
503
|
isCompact: false,
|
|
495
504
|
navigateToBuild: null,
|
|
@@ -434,6 +434,7 @@ var BanksList = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
434
434
|
focusCreateBankButton: this.props.focusCreateBankButton,
|
|
435
435
|
getCourseInfo: this.props.getCourseInfo,
|
|
436
436
|
getUserInfo: this.props.getUserInfo,
|
|
437
|
+
getSubaccountInfo: this.props.getSubaccountInfo,
|
|
437
438
|
isOpen: this.state.sharingModalOpen,
|
|
438
439
|
minChars: this.props.minChars,
|
|
439
440
|
modalTrigger: this.sharingButtons[this.state.sharingModalBank.id],
|
|
@@ -441,6 +442,7 @@ var BanksList = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
441
442
|
onShare: this.props.onShare,
|
|
442
443
|
getShareableCourses: this.props.getShareableCourses,
|
|
443
444
|
getShareableUsers: this.props.getShareableUsers,
|
|
445
|
+
getShareableSubaccounts: this.props.getShareableSubaccounts,
|
|
444
446
|
updateSharedCount: this.updateSharedCount
|
|
445
447
|
});
|
|
446
448
|
}
|
|
@@ -544,6 +546,7 @@ var BanksList = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
544
546
|
createBankCloneJob: _propTypes.default.func.isRequired,
|
|
545
547
|
currentUser: _propTypes.default.shape({
|
|
546
548
|
bank_admin: _propTypes.default.bool,
|
|
549
|
+
can_share_banks_with_subaccounts: _propTypes.default.bool,
|
|
547
550
|
email: _propTypes.default.string,
|
|
548
551
|
enrollment_names: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
549
552
|
full_name: _propTypes.default.string,
|
|
@@ -557,6 +560,7 @@ var BanksList = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
557
560
|
getUserInfo: _propTypes.default.func,
|
|
558
561
|
getShareableCourses: _propTypes.default.func,
|
|
559
562
|
getShareableUsers: _propTypes.default.func,
|
|
563
|
+
getShareableSubaccounts: _propTypes.default.func,
|
|
560
564
|
minChars: _propTypes.default.number,
|
|
561
565
|
navigateToBank: _propTypes.default.func.isRequired,
|
|
562
566
|
onShare: _propTypes.default.func,
|
|
@@ -572,6 +576,7 @@ var BanksList = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
572
576
|
getUserInfo: null,
|
|
573
577
|
getShareableCourses: null,
|
|
574
578
|
getShareableUsers: null,
|
|
579
|
+
getShareableSubaccounts: null,
|
|
575
580
|
minChars: void 0,
|
|
576
581
|
locale: null,
|
|
577
582
|
timezone: null,
|
|
@@ -178,11 +178,10 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
178
178
|
}, {
|
|
179
179
|
key: "render",
|
|
180
180
|
value: function render() {
|
|
181
|
-
var _this$props$currentUs;
|
|
182
|
-
|
|
183
181
|
var _this$props = this.props,
|
|
184
182
|
shares = _this$props.shares,
|
|
185
|
-
subAccountBankSharingEnabled = _this$props.subAccountBankSharingEnabled
|
|
183
|
+
subAccountBankSharingEnabled = _this$props.subAccountBankSharingEnabled,
|
|
184
|
+
currentUser = _this$props.currentUser;
|
|
186
185
|
var newEntityIds = this.props.newEntities.map(function (e) {
|
|
187
186
|
return e.get('id');
|
|
188
187
|
});
|
|
@@ -195,6 +194,9 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
195
194
|
var existingCourses = existingShares.filter(function (s) {
|
|
196
195
|
return s.get('entityType') === _quizCommon.SHARED_WITH_COURSE;
|
|
197
196
|
});
|
|
197
|
+
var existingAccounts = existingShares.filter(function (s) {
|
|
198
|
+
return s.get('entityType') === _quizCommon.SHARED_WITH_ACCOUNT;
|
|
199
|
+
});
|
|
198
200
|
return (0, _emotion.jsx)("div", {
|
|
199
201
|
className: "fs-mask"
|
|
200
202
|
}, !subAccountBankSharingEnabled && (0, _emotion.jsx)(_uiText.Text, {
|
|
@@ -229,16 +231,24 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
229
231
|
lineHeight: "double"
|
|
230
232
|
}, (0, _formatMessage.default)('Currently shared with')), (0, _emotion.jsx)(_uiGrid.Grid, {
|
|
231
233
|
vAlign: "middle"
|
|
232
|
-
}, existingCourses.map(this.renderEntity))), subAccountBankSharingEnabled && (0, _emotion.jsx)(_uiTabs.Tabs.Panel, {
|
|
233
|
-
renderTitle: (0, _formatMessage.default)('Accounts'
|
|
234
|
+
}, existingCourses.map(this.renderEntity))), subAccountBankSharingEnabled && ((currentUser === null || currentUser === void 0 ? void 0 : currentUser.bank_admin) || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.can_share_banks_with_subaccounts)) && (0, _emotion.jsx)(_uiTabs.Tabs.Panel, {
|
|
235
|
+
renderTitle: (0, _formatMessage.default)('Accounts ({ accountsCount })', {
|
|
236
|
+
accountsCount: existingAccounts.size
|
|
237
|
+
}),
|
|
234
238
|
isSelected: this.state.selectedTabIndex === 2,
|
|
235
239
|
padding: "large small small small"
|
|
236
|
-
}, (
|
|
240
|
+
}, (currentUser === null || currentUser === void 0 ? void 0 : currentUser.bank_admin) && (0, _emotion.jsx)(_RootAccountSharing.default, {
|
|
237
241
|
accountName: this.props.accountName,
|
|
238
242
|
onShareChange: this.props.onToggleAccountShare,
|
|
239
243
|
onShareTypeChange: this.props.onAccountPermissionChange,
|
|
240
244
|
accountPermission: this.props.accountPermission
|
|
241
|
-
}))))
|
|
245
|
+
}), (currentUser === null || currentUser === void 0 ? void 0 : currentUser.can_share_banks_with_subaccounts) && this.props.renderSearchSection(_quizCommon.SHARED_WITH_ACCOUNT), (0, _emotion.jsx)(_uiText.Text, {
|
|
246
|
+
as: "div",
|
|
247
|
+
weight: "bold",
|
|
248
|
+
lineHeight: "double"
|
|
249
|
+
}, (0, _formatMessage.default)('Currently shared with')), (0, _emotion.jsx)(_uiGrid.Grid, {
|
|
250
|
+
vAlign: "middle"
|
|
251
|
+
}, existingAccounts.map(this.renderEntity))))));
|
|
242
252
|
}
|
|
243
253
|
}]);
|
|
244
254
|
ShareList.displayName = "ShareList";
|
|
@@ -246,7 +256,8 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
246
256
|
}(_react.Component), _class2.propTypes = {
|
|
247
257
|
canEdit: _propTypes.default.bool.isRequired,
|
|
248
258
|
currentUser: _propTypes.default.shape({
|
|
249
|
-
bank_admin: _propTypes.default.bool
|
|
259
|
+
bank_admin: _propTypes.default.bool,
|
|
260
|
+
can_share_banks_with_subaccounts: _propTypes.default.bool
|
|
250
261
|
}),
|
|
251
262
|
improvedBankSharingEnabled: _propTypes.default.bool.isRequired,
|
|
252
263
|
newEntities: _reactImmutableProptypes.default.list,
|