@instructure/quiz-core 20.3.1-rc.2 → 20.3.1-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/banks/components/SharingModal/ShareList/index.js +3 -3
- package/es/building/components/layout/header/BuildingButtonsICE/index.js +40 -0
- package/es/building/components/layout/header/BuildingButtonsICE/presenter.js +249 -0
- package/es/common/components/SDKNavBar.js +11 -0
- package/es/common/components/layout/navbar/index.js +39 -0
- package/es/common/components/layout/navbar/presenter.js +111 -0
- package/es/index.js +2 -0
- package/lib/banks/components/SharingModal/ShareList/index.js +3 -3
- package/lib/building/components/layout/header/BuildingButtonsICE/index.js +65 -0
- package/lib/building/components/layout/header/BuildingButtonsICE/presenter.js +274 -0
- package/lib/common/components/SDKNavBar.js +27 -0
- package/lib/common/components/layout/navbar/index.js +65 -0
- package/lib/common/components/layout/navbar/presenter.js +133 -0
- package/lib/index.js +82 -62
- package/package.json +11 -9
|
@@ -101,7 +101,7 @@ export var ShareList = (_dec = withStyle(generateStyle, null), _dec(_class = (_t
|
|
|
101
101
|
key: entity.get('entityId'),
|
|
102
102
|
"data-automation": "sdk-shared-with-entity-row"
|
|
103
103
|
}, jsx(Grid.Col, {
|
|
104
|
-
width:
|
|
104
|
+
width: "small"
|
|
105
105
|
}, isCourse ? _ref4 : jsx(Avatar, {
|
|
106
106
|
name: entity.get('title'),
|
|
107
107
|
src: entity.get('avatar'),
|
|
@@ -177,7 +177,7 @@ export var ShareList = (_dec = withStyle(generateStyle, null), _dec(_class = (_t
|
|
|
177
177
|
peopleCount: existingPeople.size
|
|
178
178
|
}),
|
|
179
179
|
isSelected: this.state.selectedTabIndex === 0,
|
|
180
|
-
padding: "large
|
|
180
|
+
padding: "large small small small"
|
|
181
181
|
}, subAccountBankSharingEnabled && this.props.renderSearchSection(SHARED_WITH_USER), subAccountBankSharingEnabled && jsx(Text, {
|
|
182
182
|
as: "div",
|
|
183
183
|
weight: "bold",
|
|
@@ -189,7 +189,7 @@ export var ShareList = (_dec = withStyle(generateStyle, null), _dec(_class = (_t
|
|
|
189
189
|
coursesCount: existingCourses.size
|
|
190
190
|
}),
|
|
191
191
|
isSelected: this.state.selectedTabIndex === 1,
|
|
192
|
-
padding: "large
|
|
192
|
+
padding: "large small small small"
|
|
193
193
|
}, subAccountBankSharingEnabled && this.props.renderSearchSection(SHARED_WITH_COURSE), subAccountBankSharingEnabled && jsx(Text, {
|
|
194
194
|
as: "div",
|
|
195
195
|
weight: "bold",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { bindActionCreators } from 'redux';
|
|
2
|
+
import partial from 'lodash/partial';
|
|
3
|
+
import { connect } from "../../../../../common/react-redux.js";
|
|
4
|
+
import * as modalActions from "../../../../../common/actions/modal.js";
|
|
5
|
+
import { set as setUI } from "../../../../../common/actions/ui.js";
|
|
6
|
+
import { BUILD_TRAY_OPEN, BUILD_TRAY_BUTTON_REF } from '@instructure/quiz-common';
|
|
7
|
+
import { generateImportModalId } from "../../../../../common/components/ImportModal/index.js";
|
|
8
|
+
import { BuildingButtonsICE as BuildingButtonsICEPresenter } from "./presenter.js";
|
|
9
|
+
import { getActiveQuiz } from "../../../../../common/selectors/quizzes.js";
|
|
10
|
+
import { featureOn } from "../../../../../common/util/featureCheck.js";
|
|
11
|
+
import { startQuizExportJob } from "../../../../../common/actions/quizExport.js";
|
|
12
|
+
import { addAlert, addInfo } from "../../../../../common/actions/alerts.js";
|
|
13
|
+
export function mapStateToProps(state) {
|
|
14
|
+
var quiz = getActiveQuiz(state);
|
|
15
|
+
return {
|
|
16
|
+
activeQuizId: quiz.id,
|
|
17
|
+
canExport: !state.getIn(['quizExport', "activeQuiz".concat(quiz.id)]),
|
|
18
|
+
canImport: quiz.canImport(),
|
|
19
|
+
hasQuestions: quiz.hasQuestions(),
|
|
20
|
+
isEditing: state.get('editing') && state.get('editing').some(function (elem) {
|
|
21
|
+
return elem;
|
|
22
|
+
}),
|
|
23
|
+
printingEnabled: featureOn('printing')
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
28
|
+
return {
|
|
29
|
+
addAlert: bindActionCreators(addAlert, dispatch),
|
|
30
|
+
addInfo: bindActionCreators(addInfo, dispatch),
|
|
31
|
+
openBanksTray: bindActionCreators(setUI.bind(void 0, BUILD_TRAY_OPEN, true), dispatch),
|
|
32
|
+
setBanksTrayButtonRef: bindActionCreators(partial(setUI, BUILD_TRAY_BUTTON_REF), dispatch),
|
|
33
|
+
startExport: bindActionCreators(startQuizExportJob, dispatch),
|
|
34
|
+
openModal: bindActionCreators(modalActions.openModal.bind(modalActions, generateImportModalId('qtiImport')), dispatch)
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
var BuildingButtonsICE = connect(mapStateToProps, mapDispatchToProps)(BuildingButtonsICEPresenter);
|
|
39
|
+
BuildingButtonsICE.displayName = 'TopNavBarItem';
|
|
40
|
+
export default BuildingButtonsICE;
|
|
@@ -0,0 +1,249 @@
|
|
|
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
|
+
import React, { Component } from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { Drilldown } from '@instructure/ui-drilldown';
|
|
8
|
+
import { View } from '@instructure/ui-view';
|
|
9
|
+
import { TopNavBar } from '@instructure/ui-top-nav-bar';
|
|
10
|
+
import { IconExportLine, IconImportLine, IconBankLine, IconPrinterLine, IconSpeedGraderLine } from '@instructure/ui-icons';
|
|
11
|
+
import PrintTrigger from "../../../../../common/components/shared/PrintTrigger/index.js";
|
|
12
|
+
import { PRINT_CURRENT_PAGE, PRINT_BLANK } from '@instructure/quiz-common';
|
|
13
|
+
import t from '@instructure/quiz-i18n/es/format-message';
|
|
14
|
+
|
|
15
|
+
var _ref = /*#__PURE__*/React.createElement(IconSpeedGraderLine, null);
|
|
16
|
+
|
|
17
|
+
var _ref2 = /*#__PURE__*/React.createElement(IconImportLine, {
|
|
18
|
+
"data-automation": "sdk-import-content-icon"
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
var _ref3 = /*#__PURE__*/React.createElement(IconExportLine, {
|
|
22
|
+
"data-automation": "sdk-export-content-icon"
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
var _ref4 = /*#__PURE__*/React.createElement(IconBankLine, {
|
|
26
|
+
"data-automation": "sdk-manage-item-banks-icon"
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
var _ref5 = /*#__PURE__*/React.createElement(IconPrinterLine, {
|
|
30
|
+
"data-automation": "sdk-print-icon"
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _ref6 = /*#__PURE__*/React.createElement(IconPrinterLine, {
|
|
34
|
+
"data-automation": "sdk-print-blank-icon"
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export var BuildingButtonsICE = /*#__PURE__*/function (_Component) {
|
|
38
|
+
_inherits(BuildingButtonsICE, _Component);
|
|
39
|
+
|
|
40
|
+
var _super = _createSuper(BuildingButtonsICE);
|
|
41
|
+
|
|
42
|
+
function BuildingButtonsICE() {
|
|
43
|
+
var _this;
|
|
44
|
+
|
|
45
|
+
_classCallCheck(this, BuildingButtonsICE);
|
|
46
|
+
|
|
47
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
48
|
+
args[_key] = arguments[_key];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
52
|
+
|
|
53
|
+
_this.quizExportAlert = function () {
|
|
54
|
+
_this.props.addInfo(t("The export process has been started. This can take a while for larger quizzes.\n You can leave the page and you'll get notified when the export is completed."));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
_this.openBanksTray = function () {
|
|
58
|
+
_this.props.setBanksTrayButtonRef(_this.banksTrayButton);
|
|
59
|
+
|
|
60
|
+
_this.props.openBanksTray();
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
_this.openSpeedgraderLink = function () {
|
|
64
|
+
window.open(_this.props.speedgraderLink, '_blank');
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
_this.startQuizExportJob = function () {
|
|
68
|
+
if (_this.props.canExport) {
|
|
69
|
+
var _this$props = _this.props,
|
|
70
|
+
activeQuizId = _this$props.activeQuizId,
|
|
71
|
+
contextUuid = _this$props.contextUuid;
|
|
72
|
+
var exportSettings = {
|
|
73
|
+
export_type: 'qti',
|
|
74
|
+
everything: false,
|
|
75
|
+
quizzes: [activeQuizId]
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
_this.quizExportAlert();
|
|
79
|
+
|
|
80
|
+
_this.props.contentExport({
|
|
81
|
+
contextUuid: contextUuid,
|
|
82
|
+
exportSettings: exportSettings
|
|
83
|
+
}, _this.props.addAlert);
|
|
84
|
+
|
|
85
|
+
_this.props.startExport(activeQuizId);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return _this;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
_createClass(BuildingButtonsICE, [{
|
|
93
|
+
key: "isBuildingPage",
|
|
94
|
+
value: function isBuildingPage() {
|
|
95
|
+
return 'building' === this.props.app;
|
|
96
|
+
}
|
|
97
|
+
}, {
|
|
98
|
+
key: "renderOptions",
|
|
99
|
+
value: function renderOptions(handlePrint) {
|
|
100
|
+
if (!this.isBuildingPage()) return;
|
|
101
|
+
var options = [];
|
|
102
|
+
|
|
103
|
+
if (this.props.speedgraderLink) {
|
|
104
|
+
options.push( /*#__PURE__*/React.createElement(Drilldown.Option, {
|
|
105
|
+
id: "speedgrader",
|
|
106
|
+
key: "speedgrader",
|
|
107
|
+
onOptionClick: this.openSpeedgraderLink
|
|
108
|
+
}, _ref, /*#__PURE__*/React.createElement(View, {
|
|
109
|
+
as: "span",
|
|
110
|
+
margin: "0 0 0 x-small"
|
|
111
|
+
}, t('Speedgrader'))));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
options.push( /*#__PURE__*/React.createElement(Drilldown.Option, {
|
|
115
|
+
id: "import",
|
|
116
|
+
key: "import",
|
|
117
|
+
disabled: !this.props.canImport,
|
|
118
|
+
onOptionClick: this.props.openModal,
|
|
119
|
+
"data-automation": "sdk-import-content-menuitem"
|
|
120
|
+
}, _ref2, /*#__PURE__*/React.createElement(View, {
|
|
121
|
+
as: "span",
|
|
122
|
+
margin: "0 0 0 x-small"
|
|
123
|
+
}, t('Import Content'))));
|
|
124
|
+
|
|
125
|
+
if (this.props.contentExportEnabled) {
|
|
126
|
+
options.push( /*#__PURE__*/React.createElement(Drilldown.Option, {
|
|
127
|
+
id: "export",
|
|
128
|
+
key: "export",
|
|
129
|
+
disabled: !this.props.canExport,
|
|
130
|
+
onOptionClick: this.startQuizExportJob,
|
|
131
|
+
"data-automation": "sdk-export-content-menuitem"
|
|
132
|
+
}, _ref3, /*#__PURE__*/React.createElement(View, {
|
|
133
|
+
as: "span",
|
|
134
|
+
margin: "0 0 0 x-small"
|
|
135
|
+
}, t('Export Content'))));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (this.props.enableItemBanking) {
|
|
139
|
+
options.push( /*#__PURE__*/React.createElement(Drilldown.Option, {
|
|
140
|
+
id: "banks",
|
|
141
|
+
key: "banks",
|
|
142
|
+
onOptionClick: this.props.navigateToBanks,
|
|
143
|
+
"data-automation": "sdk-manage-item-banks-menuitem"
|
|
144
|
+
}, _ref4, /*#__PURE__*/React.createElement(View, {
|
|
145
|
+
as: "span",
|
|
146
|
+
margin: "0 0 0 x-small"
|
|
147
|
+
}, t('Manage Item Banks'))));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (this.props.printingEnabled) {
|
|
151
|
+
{
|
|
152
|
+
/* eslint-disable react/jsx-no-bind */
|
|
153
|
+
}
|
|
154
|
+
options.push( /*#__PURE__*/React.createElement(Drilldown.Option, {
|
|
155
|
+
id: "printKey",
|
|
156
|
+
key: "printKey",
|
|
157
|
+
disabled: !this.props.hasQuestions || this.props.isEditing,
|
|
158
|
+
onOptionClick: function onOptionClick() {
|
|
159
|
+
return handlePrint(PRINT_CURRENT_PAGE);
|
|
160
|
+
},
|
|
161
|
+
"data-automation": "sdk-print-key-menuitem"
|
|
162
|
+
}, _ref5, /*#__PURE__*/React.createElement(View, {
|
|
163
|
+
as: "span",
|
|
164
|
+
margin: "0 0 0 x-small"
|
|
165
|
+
}, t('Print Key (With Answers)'))));
|
|
166
|
+
options.push( /*#__PURE__*/React.createElement(Drilldown.Option, {
|
|
167
|
+
id: "printBlank",
|
|
168
|
+
key: "printBlank",
|
|
169
|
+
disabled: !this.props.hasQuestions || this.props.isEditing,
|
|
170
|
+
onOptionClick: function onOptionClick() {
|
|
171
|
+
return handlePrint(PRINT_BLANK);
|
|
172
|
+
},
|
|
173
|
+
"data-automation": "sdk-print-blank-menuitem"
|
|
174
|
+
}, _ref6, /*#__PURE__*/React.createElement(View, {
|
|
175
|
+
as: "span",
|
|
176
|
+
margin: "0 0 0 x-small"
|
|
177
|
+
}, t('Print Blank Quiz'))));
|
|
178
|
+
{
|
|
179
|
+
/* eslint-enable react/jsx-no-bind */
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (options.length < 1) return;
|
|
184
|
+
return /*#__PURE__*/React.createElement(TopNavBar.Item, {
|
|
185
|
+
id: this.props.id,
|
|
186
|
+
variant: "icon",
|
|
187
|
+
renderIcon: this.props.renderIcon,
|
|
188
|
+
showSubmenuChevron: false,
|
|
189
|
+
renderSubmenu: /*#__PURE__*/React.createElement(Drilldown, {
|
|
190
|
+
rootPageId: "root"
|
|
191
|
+
}, /*#__PURE__*/React.createElement(Drilldown.Page, {
|
|
192
|
+
id: "root"
|
|
193
|
+
}, options))
|
|
194
|
+
}, t('More'));
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
key: "render",
|
|
198
|
+
value: function render() {
|
|
199
|
+
var _this2 = this;
|
|
200
|
+
|
|
201
|
+
/* eslint-disable react/jsx-no-bind */
|
|
202
|
+
return /*#__PURE__*/React.createElement(PrintTrigger, {
|
|
203
|
+
render: function render(handlePrint) {
|
|
204
|
+
return _this2.renderOptions(handlePrint);
|
|
205
|
+
},
|
|
206
|
+
navigateToPreviewPrint: this.props.navigateToPreviewPrint
|
|
207
|
+
});
|
|
208
|
+
/* eslint-enable react/jsx-no-bind */
|
|
209
|
+
}
|
|
210
|
+
}]);
|
|
211
|
+
|
|
212
|
+
BuildingButtonsICE.displayName = "BuildingButtonsICE";
|
|
213
|
+
return BuildingButtonsICE;
|
|
214
|
+
}(Component);
|
|
215
|
+
BuildingButtonsICE.propTypes = {
|
|
216
|
+
id: PropTypes.string.isRequired,
|
|
217
|
+
renderIcon: PropTypes.element.isRequired,
|
|
218
|
+
app: PropTypes.string,
|
|
219
|
+
addAlert: PropTypes.func.isRequired,
|
|
220
|
+
addInfo: PropTypes.func,
|
|
221
|
+
activeQuizId: PropTypes.string,
|
|
222
|
+
canExport: PropTypes.bool.isRequired,
|
|
223
|
+
canImport: PropTypes.bool.isRequired,
|
|
224
|
+
contentExportEnabled: PropTypes.bool,
|
|
225
|
+
contentExport: PropTypes.func,
|
|
226
|
+
enableItemBanking: PropTypes.bool,
|
|
227
|
+
hasQuestions: PropTypes.bool.isRequired,
|
|
228
|
+
isEditing: PropTypes.bool.isRequired,
|
|
229
|
+
navigateToBanks: PropTypes.func.isRequired,
|
|
230
|
+
navigateToPreviewPrint: PropTypes.func.isRequired,
|
|
231
|
+
openBanksTray: PropTypes.func.isRequired,
|
|
232
|
+
openModal: PropTypes.func.isRequired,
|
|
233
|
+
printingEnabled: PropTypes.bool.isRequired,
|
|
234
|
+
setBanksTrayButtonRef: PropTypes.func.isRequired,
|
|
235
|
+
speedgraderLink: PropTypes.string,
|
|
236
|
+
startExport: PropTypes.func.isRequired,
|
|
237
|
+
contextUuid: PropTypes.string
|
|
238
|
+
};
|
|
239
|
+
BuildingButtonsICE.defaultProps = {
|
|
240
|
+
activeQuizId: null,
|
|
241
|
+
addInfo: function addInfo() {},
|
|
242
|
+
app: null,
|
|
243
|
+
contentExportEnabled: false,
|
|
244
|
+
contentExport: null,
|
|
245
|
+
enableItemBanking: true,
|
|
246
|
+
speedgraderLink: null,
|
|
247
|
+
contextUuid: null
|
|
248
|
+
};
|
|
249
|
+
export default BuildingButtonsICE;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Provider } from "../react-redux.js";
|
|
3
|
+
import store from "../../reduxStore.js";
|
|
4
|
+
import NavBar from "./layout/navbar/index.js";
|
|
5
|
+
export var SDKNavBar = function SDKNavBar(props) {
|
|
6
|
+
return /*#__PURE__*/React.createElement(Provider, {
|
|
7
|
+
store: store
|
|
8
|
+
}, /*#__PURE__*/React.createElement(NavBar, props));
|
|
9
|
+
};
|
|
10
|
+
NavBar.displayName = 'SDKNavBar';
|
|
11
|
+
export default SDKNavBar;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { bindActionCreators } from 'redux';
|
|
2
|
+
import partial from 'lodash/partial';
|
|
3
|
+
import { connect } from "../../../../common/react-redux.js";
|
|
4
|
+
import * as modalActions from "../../../../common/actions/modal.js";
|
|
5
|
+
import { set as setUI } from "../../../../common/actions/ui.js";
|
|
6
|
+
import { BUILD_TRAY_OPEN, BUILD_TRAY_BUTTON_REF } from '@instructure/quiz-common';
|
|
7
|
+
import { generateImportModalId } from "../../ImportModal/index.js";
|
|
8
|
+
import { NavBar as NavBarPresenter } from "./presenter.js";
|
|
9
|
+
import { getActiveQuiz } from "../../../selectors/quizzes.js";
|
|
10
|
+
import { featureOn } from "../../../util/featureCheck.js";
|
|
11
|
+
import { startQuizExportJob } from "../../../actions/quizExport.js";
|
|
12
|
+
import { addAlert, addInfo } from "../../../actions/alerts.js";
|
|
13
|
+
export function mapStateToProps(state) {
|
|
14
|
+
var quiz = getActiveQuiz(state);
|
|
15
|
+
return {
|
|
16
|
+
activeQuizId: quiz.id,
|
|
17
|
+
canExport: !state.getIn(['quizExport', "activeQuiz".concat(quiz.id)]),
|
|
18
|
+
canImport: quiz.canImport(),
|
|
19
|
+
hasQuestions: quiz.hasQuestions(),
|
|
20
|
+
isEditing: state.get('editing') && state.get('editing').some(function (elem) {
|
|
21
|
+
return elem;
|
|
22
|
+
}),
|
|
23
|
+
printingEnabled: featureOn('printing')
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
28
|
+
return {
|
|
29
|
+
addAlert: bindActionCreators(addAlert, dispatch),
|
|
30
|
+
addInfo: bindActionCreators(addInfo, dispatch),
|
|
31
|
+
openBanksTray: bindActionCreators(setUI.bind(void 0, BUILD_TRAY_OPEN, true), dispatch),
|
|
32
|
+
setBanksTrayButtonRef: bindActionCreators(partial(setUI, BUILD_TRAY_BUTTON_REF), dispatch),
|
|
33
|
+
startExport: bindActionCreators(startQuizExportJob, dispatch),
|
|
34
|
+
openModal: bindActionCreators(modalActions.openModal.bind(modalActions, generateImportModalId('qtiImport')), dispatch)
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export var NavBar = connect(mapStateToProps, mapDispatchToProps)(NavBarPresenter);
|
|
39
|
+
export default NavBar;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import React, { Component } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { TopNavBar } from '@instructure/ui-top-nav-bar';
|
|
9
|
+
import { IconQuizLine } from '@instructure/ui-icons';
|
|
10
|
+
import t from '@instructure/quiz-i18n/es/format-message';
|
|
11
|
+
|
|
12
|
+
var _ref = /*#__PURE__*/React.createElement(IconQuizLine, {
|
|
13
|
+
color: "primary",
|
|
14
|
+
size: "small"
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export var NavBar = /*#__PURE__*/function (_Component) {
|
|
18
|
+
_inherits(NavBar, _Component);
|
|
19
|
+
|
|
20
|
+
var _super = _createSuper(NavBar);
|
|
21
|
+
|
|
22
|
+
function NavBar() {
|
|
23
|
+
var _this;
|
|
24
|
+
|
|
25
|
+
_classCallCheck(this, NavBar);
|
|
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
|
+
|
|
33
|
+
_this.hiddenActionItemsMenuTriggerLabel = function (hiddenChildrenCount) {
|
|
34
|
+
return t('{hiddenChildrenCount} more actions', {
|
|
35
|
+
hiddenChildrenCount: hiddenChildrenCount
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
_this.hiddenMenuItemsMenuTriggerLabel = function (hiddenChildrenCount) {
|
|
40
|
+
return t('{hiddenChildrenCount} More', {
|
|
41
|
+
hiddenChildrenCount: hiddenChildrenCount
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return _this;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
_createClass(NavBar, [{
|
|
49
|
+
key: "render",
|
|
50
|
+
value: function render() {
|
|
51
|
+
var _this2 = this;
|
|
52
|
+
|
|
53
|
+
return /*#__PURE__*/React.createElement(TopNavBar, {
|
|
54
|
+
breakpoint: "48em",
|
|
55
|
+
mediaQueryMatch: "element",
|
|
56
|
+
inverseColor: true
|
|
57
|
+
}, function () {
|
|
58
|
+
return /*#__PURE__*/React.createElement(TopNavBar.Layout, {
|
|
59
|
+
themeOverride: {
|
|
60
|
+
desktopBackgroundInverse: '#f5f5f5',
|
|
61
|
+
smallViewportBackgroundInverse: '#f5f5f5'
|
|
62
|
+
},
|
|
63
|
+
navLabel: t('Quizzes navigation bar'),
|
|
64
|
+
desktopConfig: {
|
|
65
|
+
hideActionsUserSeparator: true
|
|
66
|
+
},
|
|
67
|
+
smallViewportConfig: {
|
|
68
|
+
dropdownMenuToggleButtonLabel: t('Toggle Menu'),
|
|
69
|
+
dropdownMenuLabel: t('Main Menu')
|
|
70
|
+
},
|
|
71
|
+
renderBrand: /*#__PURE__*/React.createElement(TopNavBar.Brand, {
|
|
72
|
+
screenReaderLabel: t('Quizzes'),
|
|
73
|
+
renderIcon: _ref
|
|
74
|
+
}),
|
|
75
|
+
renderMenuItems: /*#__PURE__*/React.createElement(TopNavBar.MenuItems, {
|
|
76
|
+
listLabel: t('Page navigation'),
|
|
77
|
+
currentPageId: window.location.pathname,
|
|
78
|
+
renderHiddenItemsMenuTriggerLabel: _this2.hiddenMenuItemsMenuTriggerLabel
|
|
79
|
+
}, _this2.props.menuItems.map(function (menuItem) {
|
|
80
|
+
return /*#__PURE__*/React.createElement(TopNavBar.Item, {
|
|
81
|
+
id: menuItem.path,
|
|
82
|
+
key: menuItem.path,
|
|
83
|
+
onClick: _this2.props.handleMenuItemChange
|
|
84
|
+
}, menuItem.text);
|
|
85
|
+
})),
|
|
86
|
+
renderActionItems: /*#__PURE__*/React.createElement(TopNavBar.ActionItems, {
|
|
87
|
+
listLabel: t('Actions'),
|
|
88
|
+
renderHiddenItemsMenuTriggerLabel: _this2.hiddenActionItemsMenuTriggerLabel
|
|
89
|
+
}, _toConsumableArray(_this2.props.actionItems))
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}]);
|
|
94
|
+
|
|
95
|
+
NavBar.displayName = "NavBar";
|
|
96
|
+
return NavBar;
|
|
97
|
+
}(Component);
|
|
98
|
+
NavBar.propTypes = {
|
|
99
|
+
menuItems: PropTypes.arrayOf(PropTypes.shape({
|
|
100
|
+
path: PropTypes.string.isRequired,
|
|
101
|
+
text: PropTypes.string.isRequired
|
|
102
|
+
})),
|
|
103
|
+
handleMenuItemChange: PropTypes.func,
|
|
104
|
+
actionItems: PropTypes.arrayOf(PropTypes.node)
|
|
105
|
+
};
|
|
106
|
+
NavBar.defaultProps = {
|
|
107
|
+
menuItems: [],
|
|
108
|
+
handleMenuItemChange: function handleMenuItemChange() {},
|
|
109
|
+
actionItems: []
|
|
110
|
+
};
|
|
111
|
+
export default NavBar;
|
package/es/index.js
CHANGED
|
@@ -32,9 +32,11 @@ export { Banks as BanksPage } from "./banks/components/Banks/index.js";
|
|
|
32
32
|
export { Bank as BankPage } from "./banks/components/Bank/index.js";
|
|
33
33
|
export { BankEntry as BankEntryPage } from "./banks/components/BankEntry/index.js";
|
|
34
34
|
export { SDKBuildingButtons } from "./building/components/layout/header/SDKBuildingButtons/index.js";
|
|
35
|
+
export { default as SDKBuildingButtonsICE } from "./building/components/layout/header/BuildingButtonsICE/index.js";
|
|
35
36
|
export { Paginator } from "./common/components/shared/Paginator/index.js";
|
|
36
37
|
export { SDKMenuButton } from "./common/components/SDKMenuButton.js";
|
|
37
38
|
export { SDKTimer } from "./common/components/SDKTimer.js";
|
|
39
|
+
export { SDKNavBar } from "./common/components/SDKNavBar.js";
|
|
38
40
|
export { CentileDistribution } from "./reporting/components/charts/Distribution/CentileDistribution.js";
|
|
39
41
|
export { OutcomeAnalysis } from "./reporting/components/resources/OutcomeAnalysis/index.js";
|
|
40
42
|
export { PositionBox } from "./common/components/resources/positionBox/PositionBox.js";
|
|
@@ -130,7 +130,7 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
130
130
|
key: entity.get('entityId'),
|
|
131
131
|
"data-automation": "sdk-shared-with-entity-row"
|
|
132
132
|
}, (0, _emotion.jsx)(_uiGrid.Grid.Col, {
|
|
133
|
-
width:
|
|
133
|
+
width: "small"
|
|
134
134
|
}, isCourse ? _ref4 : (0, _emotion.jsx)(_uiAvatar.Avatar, {
|
|
135
135
|
name: entity.get('title'),
|
|
136
136
|
src: entity.get('avatar'),
|
|
@@ -206,7 +206,7 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
206
206
|
peopleCount: existingPeople.size
|
|
207
207
|
}),
|
|
208
208
|
isSelected: this.state.selectedTabIndex === 0,
|
|
209
|
-
padding: "large
|
|
209
|
+
padding: "large small small small"
|
|
210
210
|
}, subAccountBankSharingEnabled && this.props.renderSearchSection(_quizCommon.SHARED_WITH_USER), subAccountBankSharingEnabled && (0, _emotion.jsx)(_uiText.Text, {
|
|
211
211
|
as: "div",
|
|
212
212
|
weight: "bold",
|
|
@@ -218,7 +218,7 @@ var ShareList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_cl
|
|
|
218
218
|
coursesCount: existingCourses.size
|
|
219
219
|
}),
|
|
220
220
|
isSelected: this.state.selectedTabIndex === 1,
|
|
221
|
-
padding: "large
|
|
221
|
+
padding: "large small small small"
|
|
222
222
|
}, subAccountBankSharingEnabled && this.props.renderSearchSection(_quizCommon.SHARED_WITH_COURSE), subAccountBankSharingEnabled && (0, _emotion.jsx)(_uiText.Text, {
|
|
223
223
|
as: "div",
|
|
224
224
|
weight: "bold",
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.mapStateToProps = mapStateToProps;
|
|
11
|
+
exports.default = void 0;
|
|
12
|
+
|
|
13
|
+
var _redux = require("redux");
|
|
14
|
+
|
|
15
|
+
var _partial = _interopRequireDefault(require("lodash/partial"));
|
|
16
|
+
|
|
17
|
+
var _reactRedux = require("../../../../../common/react-redux.js");
|
|
18
|
+
|
|
19
|
+
var modalActions = _interopRequireWildcard(require("../../../../../common/actions/modal.js"));
|
|
20
|
+
|
|
21
|
+
var _ui = require("../../../../../common/actions/ui.js");
|
|
22
|
+
|
|
23
|
+
var _quizCommon = require("@instructure/quiz-common");
|
|
24
|
+
|
|
25
|
+
var _index = require("../../../../../common/components/ImportModal/index.js");
|
|
26
|
+
|
|
27
|
+
var _presenter = require("./presenter.js");
|
|
28
|
+
|
|
29
|
+
var _quizzes = require("../../../../../common/selectors/quizzes.js");
|
|
30
|
+
|
|
31
|
+
var _featureCheck = require("../../../../../common/util/featureCheck.js");
|
|
32
|
+
|
|
33
|
+
var _quizExport = require("../../../../../common/actions/quizExport.js");
|
|
34
|
+
|
|
35
|
+
var _alerts = require("../../../../../common/actions/alerts.js");
|
|
36
|
+
|
|
37
|
+
function mapStateToProps(state) {
|
|
38
|
+
var quiz = (0, _quizzes.getActiveQuiz)(state);
|
|
39
|
+
return {
|
|
40
|
+
activeQuizId: quiz.id,
|
|
41
|
+
canExport: !state.getIn(['quizExport', "activeQuiz".concat(quiz.id)]),
|
|
42
|
+
canImport: quiz.canImport(),
|
|
43
|
+
hasQuestions: quiz.hasQuestions(),
|
|
44
|
+
isEditing: state.get('editing') && state.get('editing').some(function (elem) {
|
|
45
|
+
return elem;
|
|
46
|
+
}),
|
|
47
|
+
printingEnabled: (0, _featureCheck.featureOn)('printing')
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
52
|
+
return {
|
|
53
|
+
addAlert: (0, _redux.bindActionCreators)(_alerts.addAlert, dispatch),
|
|
54
|
+
addInfo: (0, _redux.bindActionCreators)(_alerts.addInfo, dispatch),
|
|
55
|
+
openBanksTray: (0, _redux.bindActionCreators)(_ui.set.bind(void 0, _quizCommon.BUILD_TRAY_OPEN, true), dispatch),
|
|
56
|
+
setBanksTrayButtonRef: (0, _redux.bindActionCreators)((0, _partial.default)(_ui.set, _quizCommon.BUILD_TRAY_BUTTON_REF), dispatch),
|
|
57
|
+
startExport: (0, _redux.bindActionCreators)(_quizExport.startQuizExportJob, dispatch),
|
|
58
|
+
openModal: (0, _redux.bindActionCreators)(modalActions.openModal.bind(modalActions, (0, _index.generateImportModalId)('qtiImport')), dispatch)
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var BuildingButtonsICE = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_presenter.BuildingButtonsICE);
|
|
63
|
+
BuildingButtonsICE.displayName = 'TopNavBarItem';
|
|
64
|
+
var _default = BuildingButtonsICE;
|
|
65
|
+
exports.default = _default;
|