@pie-element/ebsr 7.0.24-next.2 → 7.0.26
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 +48 -0
- package/{configure/node_modules/@pie-element/multiple-choice/LICENSE.md → LICENSE.md} +0 -0
- package/configure/CHANGELOG.md +48 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +8 -0
- package/controller/package.json +1 -1
- package/package.json +3 -3
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.json +0 -1972
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.md +0 -1793
- package/configure/node_modules/@pie-element/multiple-choice/PRINT.md +0 -35
- package/configure/node_modules/@pie-element/multiple-choice/README.md +0 -56
- package/configure/node_modules/@pie-element/multiple-choice/choice.png +0 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.json +0 -1387
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.md +0 -1334
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js +0 -104
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js +0 -198
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js +0 -599
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js +0 -18
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/package.json +0 -20
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.json +0 -527
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.md +0 -768
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js +0 -18
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js +0 -305
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js +0 -36
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/controller/package.json +0 -15
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json +0 -353
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json.md +0 -277
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/config.js +0 -8
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/generate.js +0 -52
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/index.html +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/session.js +0 -7
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json +0 -338
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json.md +0 -274
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js +0 -298
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js +0 -157
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js +0 -174
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js +0 -151
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js +0 -97
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js +0 -254
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js +0 -129
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js +0 -35
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/module/configure.js +0 -843
- package/configure/node_modules/@pie-element/multiple-choice/module/controller.js +0 -20686
- package/configure/node_modules/@pie-element/multiple-choice/module/demo.js +0 -77
- package/configure/node_modules/@pie-element/multiple-choice/module/element.js +0 -2019
- package/configure/node_modules/@pie-element/multiple-choice/module/index.html +0 -21
- package/configure/node_modules/@pie-element/multiple-choice/module/manifest.json +0 -14
- package/configure/node_modules/@pie-element/multiple-choice/module/print-demo.js +0 -115
- package/configure/node_modules/@pie-element/multiple-choice/module/print.html +0 -18
- package/configure/node_modules/@pie-element/multiple-choice/module/print.js +0 -1983
- package/configure/node_modules/@pie-element/multiple-choice/package.json +0 -34
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.json +0 -672
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.md +0 -427
- package/configure/node_modules/@pie-lib/math-rendering/LICENSE.md +0 -5
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js +0 -30
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js +0 -316
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js +0 -23
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js +0 -123
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js +0 -103
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js +0 -275
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/package.json +0 -19
- package/configure/node_modules/@pie-lib/math-rendering/playground/demo.html +0 -872
- package/configure/node_modules/@pie-lib/math-rendering/playground/demo.js +0 -108
- package/configure/node_modules/@pie-lib/math-rendering/playground/main.html +0 -156
- package/configure/node_modules/@pie-lib/math-rendering/playground/main.js +0 -16
- package/configure/node_modules/@pie-lib/math-rendering/playground/webpack.config.js +0 -29
- package/configure/node_modules/@pie-lib/math-rendering/src/index.js +0 -4
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/chtml.js +0 -215
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/index.js +0 -13
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/mml.js +0 -24
- package/configure/node_modules/@pie-lib/math-rendering/src/normalization.js +0 -69
- package/configure/node_modules/@pie-lib/math-rendering/src/render-math.js +0 -234
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.json +0 -937
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.md +0 -602
- package/configure/node_modules/@pie-lib/render-ui/LICENSE.md +0 -5
- package/configure/node_modules/@pie-lib/render-ui/README.md +0 -33
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js +0 -146
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js +0 -134
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js +0 -160
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js +0 -24
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js +0 -102
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js +0 -104
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js +0 -60
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js +0 -133
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js +0 -162
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js +0 -28
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js +0 -28
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js +0 -160
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js +0 -206
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/package.json +0 -30
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/index.jsx +0 -68
- package/configure/node_modules/@pie-lib/render-ui/src/color.js +0 -48
- package/configure/node_modules/@pie-lib/render-ui/src/feedback.jsx +0 -100
- package/configure/node_modules/@pie-lib/render-ui/src/has-text.js +0 -14
- package/configure/node_modules/@pie-lib/render-ui/src/html-and-math.js +0 -40
- package/configure/node_modules/@pie-lib/render-ui/src/index.js +0 -27
- package/configure/node_modules/@pie-lib/render-ui/src/input-container.jsx +0 -41
- package/configure/node_modules/@pie-lib/render-ui/src/preview-layout.jsx +0 -77
- package/configure/node_modules/@pie-lib/render-ui/src/preview-prompt.jsx +0 -90
- package/configure/node_modules/@pie-lib/render-ui/src/purpose.jsx +0 -19
- package/configure/node_modules/@pie-lib/render-ui/src/readable.jsx +0 -19
- package/configure/node_modules/@pie-lib/render-ui/src/response-indicators.jsx +0 -89
- package/configure/node_modules/@pie-lib/render-ui/src/withUndoReset.jsx +0 -118
|
@@ -1,599 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = exports.Main = void 0;
|
|
9
|
-
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
-
|
|
18
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
|
|
20
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
-
|
|
22
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
-
|
|
24
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
-
|
|
26
|
-
var _react = _interopRequireDefault(require("react"));
|
|
27
|
-
|
|
28
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
29
|
-
|
|
30
|
-
var _editableHtml = _interopRequireDefault(require("@pie-lib/editable-html"));
|
|
31
|
-
|
|
32
|
-
var _configUi = require("@pie-lib/config-ui");
|
|
33
|
-
|
|
34
|
-
var _renderUi = require("@pie-lib/render-ui");
|
|
35
|
-
|
|
36
|
-
var _styles = require("@material-ui/core/styles");
|
|
37
|
-
|
|
38
|
-
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
39
|
-
|
|
40
|
-
var _merge = _interopRequireDefault(require("lodash/merge"));
|
|
41
|
-
|
|
42
|
-
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
43
|
-
|
|
44
|
-
var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
|
|
45
|
-
|
|
46
|
-
var _DialogTitle = _interopRequireDefault(require("@material-ui/core/DialogTitle"));
|
|
47
|
-
|
|
48
|
-
var _DialogActions = _interopRequireDefault(require("@material-ui/core/DialogActions"));
|
|
49
|
-
|
|
50
|
-
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
|
|
51
|
-
|
|
52
|
-
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
|
53
|
-
|
|
54
|
-
var _utils = require("./utils");
|
|
55
|
-
|
|
56
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
57
|
-
|
|
58
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
59
|
-
|
|
60
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
61
|
-
|
|
62
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
63
|
-
|
|
64
|
-
var Panel = _configUi.settings.Panel,
|
|
65
|
-
toggle = _configUi.settings.toggle,
|
|
66
|
-
radio = _configUi.settings.radio,
|
|
67
|
-
dropdown = _configUi.settings.dropdown;
|
|
68
|
-
var MAX_CHOICES = 9;
|
|
69
|
-
|
|
70
|
-
var styles = function styles(theme) {
|
|
71
|
-
return {
|
|
72
|
-
promptHolder: {
|
|
73
|
-
width: '100%',
|
|
74
|
-
paddingBottom: theme.spacing.unit * 2,
|
|
75
|
-
marginBottom: theme.spacing.unit * 2
|
|
76
|
-
},
|
|
77
|
-
prompt: {
|
|
78
|
-
paddingTop: theme.spacing.unit * 2,
|
|
79
|
-
width: '100%'
|
|
80
|
-
},
|
|
81
|
-
rationaleHolder: {
|
|
82
|
-
width: '70%'
|
|
83
|
-
},
|
|
84
|
-
accessibilityHolder: {
|
|
85
|
-
width: '70%'
|
|
86
|
-
},
|
|
87
|
-
rationale: {
|
|
88
|
-
paddingTop: theme.spacing.unit * 2
|
|
89
|
-
},
|
|
90
|
-
accessibility: {
|
|
91
|
-
paddingTop: theme.spacing.unit * 2
|
|
92
|
-
},
|
|
93
|
-
design: {
|
|
94
|
-
paddingTop: theme.spacing.unit * 3
|
|
95
|
-
},
|
|
96
|
-
choiceConfigurationHolder: {
|
|
97
|
-
display: 'flex',
|
|
98
|
-
flexDirection: 'column',
|
|
99
|
-
alignItems: 'center'
|
|
100
|
-
},
|
|
101
|
-
choiceConfiguration: {
|
|
102
|
-
width: '100%',
|
|
103
|
-
paddingTop: theme.spacing.unit * 2,
|
|
104
|
-
paddingBottom: theme.spacing.unit * 2
|
|
105
|
-
},
|
|
106
|
-
switchElement: {
|
|
107
|
-
justifyContent: 'space-between',
|
|
108
|
-
margin: 0
|
|
109
|
-
},
|
|
110
|
-
addButton: {
|
|
111
|
-
"float": 'right'
|
|
112
|
-
},
|
|
113
|
-
disableButton: {
|
|
114
|
-
cursor: 'not-allowed',
|
|
115
|
-
pointerEvents: 'all',
|
|
116
|
-
backgroundColor: _renderUi.color.disabled(),
|
|
117
|
-
'&:hover': {
|
|
118
|
-
backgroundColor: _renderUi.color.disabled()
|
|
119
|
-
},
|
|
120
|
-
'&:focus': {
|
|
121
|
-
backgroundColor: _renderUi.color.disabled()
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
flexContainer: {
|
|
125
|
-
display: 'flex',
|
|
126
|
-
alignItems: 'center',
|
|
127
|
-
marginBottom: '5px'
|
|
128
|
-
},
|
|
129
|
-
titleText: {
|
|
130
|
-
fontFamily: 'Cerebri Sans',
|
|
131
|
-
fontSize: '18px',
|
|
132
|
-
lineHeight: '19px',
|
|
133
|
-
color: '#495B8F',
|
|
134
|
-
marginRight: '5px'
|
|
135
|
-
},
|
|
136
|
-
tooltip: {
|
|
137
|
-
fontSize: '12px',
|
|
138
|
-
whiteSpace: 'pre',
|
|
139
|
-
maxWidth: '500px'
|
|
140
|
-
},
|
|
141
|
-
errorText: {
|
|
142
|
-
fontSize: '12px',
|
|
143
|
-
color: 'red',
|
|
144
|
-
paddingTop: '5px'
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
var Design = (0, _styles.withStyles)(styles)(function (props) {
|
|
150
|
-
var classes = props.classes,
|
|
151
|
-
model = props.model,
|
|
152
|
-
configuration = props.configuration,
|
|
153
|
-
onPromptChanged = props.onPromptChanged,
|
|
154
|
-
onChoiceChanged = props.onChoiceChanged,
|
|
155
|
-
onRemoveChoice = props.onRemoveChoice,
|
|
156
|
-
onAddChoice = props.onAddChoice,
|
|
157
|
-
imageSupport = props.imageSupport,
|
|
158
|
-
onChangeModel = props.onChangeModel,
|
|
159
|
-
onConfigurationChanged = props.onConfigurationChanged,
|
|
160
|
-
onTeacherInstructionsChanged = props.onTeacherInstructionsChanged;
|
|
161
|
-
|
|
162
|
-
var _ref = configuration || {},
|
|
163
|
-
_ref$prompt = _ref.prompt,
|
|
164
|
-
prompt = _ref$prompt === void 0 ? {} : _ref$prompt,
|
|
165
|
-
_ref$addChoiceButton = _ref.addChoiceButton,
|
|
166
|
-
addChoiceButton = _ref$addChoiceButton === void 0 ? {} : _ref$addChoiceButton,
|
|
167
|
-
_ref$feedback = _ref.feedback,
|
|
168
|
-
feedback = _ref$feedback === void 0 ? {} : _ref$feedback,
|
|
169
|
-
_ref$deleteChoice = _ref.deleteChoice,
|
|
170
|
-
deleteChoice = _ref$deleteChoice === void 0 ? {} : _ref$deleteChoice,
|
|
171
|
-
_ref$choiceMode = _ref.choiceMode,
|
|
172
|
-
choiceMode = _ref$choiceMode === void 0 ? {} : _ref$choiceMode,
|
|
173
|
-
_ref$choicePrefix = _ref.choicePrefix,
|
|
174
|
-
choicePrefix = _ref$choicePrefix === void 0 ? {} : _ref$choicePrefix,
|
|
175
|
-
_ref$partialScoring = _ref.partialScoring,
|
|
176
|
-
partialScoring = _ref$partialScoring === void 0 ? {} : _ref$partialScoring,
|
|
177
|
-
_ref$lockChoiceOrder = _ref.lockChoiceOrder,
|
|
178
|
-
lockChoiceOrder = _ref$lockChoiceOrder === void 0 ? {} : _ref$lockChoiceOrder,
|
|
179
|
-
_ref$teacherInstructi = _ref.teacherInstructions,
|
|
180
|
-
teacherInstructions = _ref$teacherInstructi === void 0 ? {} : _ref$teacherInstructi,
|
|
181
|
-
_ref$studentInstructi = _ref.studentInstructions,
|
|
182
|
-
studentInstructions = _ref$studentInstructi === void 0 ? {} : _ref$studentInstructi,
|
|
183
|
-
_ref$rationale = _ref.rationale,
|
|
184
|
-
rationale = _ref$rationale === void 0 ? {} : _ref$rationale,
|
|
185
|
-
_ref$accessibility = _ref.accessibility,
|
|
186
|
-
accessibility = _ref$accessibility === void 0 ? {} : _ref$accessibility,
|
|
187
|
-
_ref$scoringType = _ref.scoringType,
|
|
188
|
-
scoringType = _ref$scoringType === void 0 ? {} : _ref$scoringType,
|
|
189
|
-
_ref$sequentialChoice = _ref.sequentialChoiceLabels,
|
|
190
|
-
sequentialChoiceLabels = _ref$sequentialChoice === void 0 ? {} : _ref$sequentialChoice,
|
|
191
|
-
settingsPanelDisabled = _ref.settingsPanelDisabled,
|
|
192
|
-
choicesLayout = _ref.choicesLayout,
|
|
193
|
-
_ref$spellCheck = _ref.spellCheck,
|
|
194
|
-
spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck,
|
|
195
|
-
gridColumns = _ref.gridColumns;
|
|
196
|
-
|
|
197
|
-
var _ref2 = configuration || {},
|
|
198
|
-
maxAnswerChoices = _ref2.maxAnswerChoices;
|
|
199
|
-
|
|
200
|
-
var _ref3 = model || {},
|
|
201
|
-
limitChoicesNumber = _ref3.limitChoicesNumber,
|
|
202
|
-
teacherInstructionsEnabled = _ref3.teacherInstructionsEnabled,
|
|
203
|
-
rationaleEnabled = _ref3.rationaleEnabled,
|
|
204
|
-
accessibilityLabelsEnabled = _ref3.accessibilityLabelsEnabled,
|
|
205
|
-
feedbackEnabled = _ref3.feedbackEnabled,
|
|
206
|
-
promptEnabled = _ref3.promptEnabled,
|
|
207
|
-
spellCheckEnabled = _ref3.spellCheckEnabled,
|
|
208
|
-
choices = _ref3.choices,
|
|
209
|
-
errors = _ref3.errors;
|
|
210
|
-
|
|
211
|
-
var _ref4 = errors || {},
|
|
212
|
-
choicesErrors = _ref4.choicesErrors,
|
|
213
|
-
correctResponseError = _ref4.correctResponseError,
|
|
214
|
-
answerChoicesError = _ref4.answerChoicesError;
|
|
215
|
-
|
|
216
|
-
var nrOfColumnsAvailable = choices && choices.length ? Array.from({
|
|
217
|
-
length: choices.length
|
|
218
|
-
}, function (_, i) {
|
|
219
|
-
return "".concat(i + 1);
|
|
220
|
-
}) : [];
|
|
221
|
-
var labelPlugins = {
|
|
222
|
-
audio: {
|
|
223
|
-
disabled: true
|
|
224
|
-
},
|
|
225
|
-
video: {
|
|
226
|
-
disabled: true
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
var toolbarOpts = {};
|
|
230
|
-
|
|
231
|
-
switch (model.toolbarEditorPosition) {
|
|
232
|
-
case 'top':
|
|
233
|
-
toolbarOpts.position = 'top';
|
|
234
|
-
break;
|
|
235
|
-
|
|
236
|
-
default:
|
|
237
|
-
toolbarOpts.position = 'bottom';
|
|
238
|
-
break;
|
|
239
|
-
} // if old property is used, set maxAnswerChoices to 9
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (limitChoicesNumber) {
|
|
243
|
-
maxAnswerChoices = MAX_CHOICES;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
var validationMessage = (0, _utils.generateValidationMessage)(configuration);
|
|
247
|
-
|
|
248
|
-
var Content = /*#__PURE__*/_react["default"].createElement("div", null, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
249
|
-
label: teacherInstructions.label,
|
|
250
|
-
className: classes.promptHolder
|
|
251
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
252
|
-
className: classes.prompt,
|
|
253
|
-
markup: model.teacherInstructions || '',
|
|
254
|
-
onChange: onTeacherInstructionsChanged,
|
|
255
|
-
imageSupport: imageSupport,
|
|
256
|
-
nonEmpty: false,
|
|
257
|
-
toolbarOpts: toolbarOpts,
|
|
258
|
-
spellCheck: spellCheckEnabled
|
|
259
|
-
})), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
260
|
-
label: prompt.label,
|
|
261
|
-
className: classes.promptHolder
|
|
262
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
263
|
-
className: classes.prompt,
|
|
264
|
-
markup: model.prompt,
|
|
265
|
-
onChange: onPromptChanged,
|
|
266
|
-
imageSupport: imageSupport,
|
|
267
|
-
nonEmpty: false,
|
|
268
|
-
disableUnderline: true,
|
|
269
|
-
toolbarOpts: toolbarOpts,
|
|
270
|
-
spellCheck: spellCheckEnabled
|
|
271
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
272
|
-
className: classes.flexContainer
|
|
273
|
-
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
274
|
-
className: classes.titleText
|
|
275
|
-
}, "Choices"), /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
276
|
-
classes: {
|
|
277
|
-
tooltip: classes.tooltip
|
|
278
|
-
},
|
|
279
|
-
disableFocusListener: true,
|
|
280
|
-
disableTouchListener: true,
|
|
281
|
-
placement: 'right',
|
|
282
|
-
title: validationMessage
|
|
283
|
-
}, /*#__PURE__*/_react["default"].createElement(_Info["default"], {
|
|
284
|
-
fontSize: 'small',
|
|
285
|
-
color: 'primary'
|
|
286
|
-
}))), correctResponseError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
287
|
-
className: classes.errorText
|
|
288
|
-
}, correctResponseError), answerChoicesError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
289
|
-
className: classes.errorText
|
|
290
|
-
}, answerChoicesError), choices.map(function (choice, index) {
|
|
291
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
292
|
-
key: "choice-".concat(index),
|
|
293
|
-
className: classes.choiceConfigurationHolder
|
|
294
|
-
}, /*#__PURE__*/_react["default"].createElement(_configUi.ChoiceConfiguration, {
|
|
295
|
-
key: index,
|
|
296
|
-
index: index + 1,
|
|
297
|
-
useLetterOrdering: model.choicePrefix === 'letters',
|
|
298
|
-
className: classes.choiceConfiguration,
|
|
299
|
-
mode: model.choiceMode,
|
|
300
|
-
data: choice,
|
|
301
|
-
defaultFeedback: {},
|
|
302
|
-
imageSupport: imageSupport,
|
|
303
|
-
onDelete: function onDelete() {
|
|
304
|
-
return onRemoveChoice(index);
|
|
305
|
-
},
|
|
306
|
-
onChange: function onChange(c) {
|
|
307
|
-
return onChoiceChanged(index, c);
|
|
308
|
-
},
|
|
309
|
-
allowFeedBack: feedbackEnabled,
|
|
310
|
-
allowDelete: deleteChoice.settings,
|
|
311
|
-
noLabels: true,
|
|
312
|
-
toolbarOpts: toolbarOpts,
|
|
313
|
-
spellCheck: spellCheckEnabled,
|
|
314
|
-
error: choicesErrors && choicesErrors[choice.value] ? choicesErrors[choice.value] : null,
|
|
315
|
-
noCorrectAnswerError: correctResponseError
|
|
316
|
-
}), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
317
|
-
key: "rationale-".concat(index),
|
|
318
|
-
label: rationale.label,
|
|
319
|
-
className: classes.rationaleHolder
|
|
320
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
321
|
-
className: classes.rationale,
|
|
322
|
-
markup: choice.rationale || '',
|
|
323
|
-
onChange: function onChange(c) {
|
|
324
|
-
return onChoiceChanged(index, _objectSpread(_objectSpread({}, choice), {}, {
|
|
325
|
-
rationale: c
|
|
326
|
-
}));
|
|
327
|
-
},
|
|
328
|
-
imageSupport: imageSupport,
|
|
329
|
-
toolbarOpts: toolbarOpts,
|
|
330
|
-
pluginProps: labelPlugins,
|
|
331
|
-
spellCheck: spellCheckEnabled
|
|
332
|
-
})), accessibilityLabelsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
333
|
-
key: "accessibility-".concat(index),
|
|
334
|
-
label: accessibility.label,
|
|
335
|
-
className: classes.accessibilityHolder
|
|
336
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
337
|
-
className: classes.accessibility,
|
|
338
|
-
markup: choice.accessibility || '',
|
|
339
|
-
onChange: function onChange(c) {
|
|
340
|
-
return onChoiceChanged(index, _objectSpread(_objectSpread({}, choice), {}, {
|
|
341
|
-
accessibility: c
|
|
342
|
-
}));
|
|
343
|
-
},
|
|
344
|
-
imageSupport: imageSupport,
|
|
345
|
-
pluginProps: labelPlugins,
|
|
346
|
-
spellCheck: spellCheckEnabled
|
|
347
|
-
})));
|
|
348
|
-
}), /*#__PURE__*/_react["default"].createElement("br", null), addChoiceButton.settings && /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
349
|
-
title: maxAnswerChoices && model.choices.length >= maxAnswerChoices ? "Only ".concat(maxAnswerChoices, " allowed maximum") : '',
|
|
350
|
-
classes: {
|
|
351
|
-
tooltip: classes.tooltip
|
|
352
|
-
}
|
|
353
|
-
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
354
|
-
classes: {
|
|
355
|
-
root: maxAnswerChoices && model.choices.length >= maxAnswerChoices && classes.disableButton
|
|
356
|
-
},
|
|
357
|
-
className: classes.addButton,
|
|
358
|
-
variant: "contained",
|
|
359
|
-
color: "primary",
|
|
360
|
-
onClick: onAddChoice
|
|
361
|
-
}, addChoiceButton.label)));
|
|
362
|
-
|
|
363
|
-
var settingsInPanel = {
|
|
364
|
-
choiceMode: choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),
|
|
365
|
-
'sequentialChoiceLabels.enabled': sequentialChoiceLabels.settings && toggle(sequentialChoiceLabels.label, true),
|
|
366
|
-
choicePrefix: choicePrefix.settings && radio(choicePrefix.label, ['numbers', 'letters']),
|
|
367
|
-
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
368
|
-
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
369
|
-
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
370
|
-
choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),
|
|
371
|
-
gridColumns: choicesLayout.settings && model.choicesLayout === 'grid' && nrOfColumnsAvailable.length > 0 && dropdown(gridColumns.label, nrOfColumnsAvailable)
|
|
372
|
-
};
|
|
373
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
374
|
-
className: classes.design
|
|
375
|
-
}, settingsPanelDisabled ? Content : /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
376
|
-
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
377
|
-
model: model,
|
|
378
|
-
onChangeModel: onChangeModel,
|
|
379
|
-
configuration: configuration,
|
|
380
|
-
onChangeConfiguration: onConfigurationChanged,
|
|
381
|
-
groups: {
|
|
382
|
-
Settings: settingsInPanel,
|
|
383
|
-
Properties: {
|
|
384
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
385
|
-
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
386
|
-
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
387
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
388
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
389
|
-
accessibilityLabelsEnabled: accessibility.settings && toggle(accessibility.label),
|
|
390
|
-
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric'])
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
})
|
|
394
|
-
}, Content));
|
|
395
|
-
});
|
|
396
|
-
|
|
397
|
-
var InfoDialog = function InfoDialog(_ref5) {
|
|
398
|
-
var open = _ref5.open,
|
|
399
|
-
onCancel = _ref5.onCancel,
|
|
400
|
-
onOk = _ref5.onOk,
|
|
401
|
-
title = _ref5.title;
|
|
402
|
-
return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
403
|
-
open: open
|
|
404
|
-
}, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], null, title), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, onOk && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
405
|
-
onClick: onOk,
|
|
406
|
-
color: "primary"
|
|
407
|
-
}, "OK"), onCancel && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
408
|
-
onClick: onCancel,
|
|
409
|
-
color: "primary"
|
|
410
|
-
}, "Cancel")));
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
InfoDialog.propTypes = {
|
|
414
|
-
open: _propTypes["default"].bool,
|
|
415
|
-
onCancel: _propTypes["default"].func,
|
|
416
|
-
onOk: _propTypes["default"].func,
|
|
417
|
-
title: _propTypes["default"].string
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
var Main = /*#__PURE__*/function (_React$Component) {
|
|
421
|
-
(0, _inherits2["default"])(Main, _React$Component);
|
|
422
|
-
|
|
423
|
-
var _super = _createSuper(Main);
|
|
424
|
-
|
|
425
|
-
function Main() {
|
|
426
|
-
var _this;
|
|
427
|
-
|
|
428
|
-
(0, _classCallCheck2["default"])(this, Main);
|
|
429
|
-
|
|
430
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
431
|
-
args[_key] = arguments[_key];
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
435
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
436
|
-
dialog: {
|
|
437
|
-
open: false
|
|
438
|
-
}
|
|
439
|
-
});
|
|
440
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRemoveChoice", function (index) {
|
|
441
|
-
var _this$props = _this.props,
|
|
442
|
-
model = _this$props.model,
|
|
443
|
-
configuration = _this$props.configuration;
|
|
444
|
-
|
|
445
|
-
var _ref6 = configuration || {},
|
|
446
|
-
minAnswerChoices = _ref6.minAnswerChoices;
|
|
447
|
-
|
|
448
|
-
if (minAnswerChoices && model.choices.length === minAnswerChoices) {
|
|
449
|
-
_this.setState({
|
|
450
|
-
dialog: {
|
|
451
|
-
open: true,
|
|
452
|
-
message: "There can't be less than ".concat(minAnswerChoices, " choices."),
|
|
453
|
-
onOk: function onOk() {
|
|
454
|
-
_this.setState({
|
|
455
|
-
dialog: {
|
|
456
|
-
open: false
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
} else {
|
|
463
|
-
model.choices.splice(index, 1);
|
|
464
|
-
|
|
465
|
-
_this.props.onModelChanged(model);
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAddChoice", function () {
|
|
469
|
-
var _this$props2 = _this.props,
|
|
470
|
-
model = _this$props2.model,
|
|
471
|
-
configuration = _this$props2.configuration;
|
|
472
|
-
|
|
473
|
-
var _ref7 = configuration || {},
|
|
474
|
-
maxAnswerChoices = _ref7.maxAnswerChoices;
|
|
475
|
-
|
|
476
|
-
var _ref8 = model || {},
|
|
477
|
-
limitChoicesNumber = _ref8.limitChoicesNumber; // if old property is used, set maxAnswerChoices to 9
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
if (limitChoicesNumber) {
|
|
481
|
-
maxAnswerChoices = MAX_CHOICES;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {
|
|
485
|
-
return;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
model.choices.push({
|
|
489
|
-
label: '',
|
|
490
|
-
value: _configUi.choiceUtils.firstAvailableIndex(model.choices.map(function (c) {
|
|
491
|
-
return c.value;
|
|
492
|
-
}), 0),
|
|
493
|
-
feedback: {
|
|
494
|
-
type: 'none'
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
_this.props.onModelChanged(model);
|
|
499
|
-
});
|
|
500
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChoiceChanged", function (index, choice) {
|
|
501
|
-
var model = _this.props.model;
|
|
502
|
-
|
|
503
|
-
if (choice.correct && model.choiceMode === 'radio') {
|
|
504
|
-
model.choices = model.choices.map(function (c) {
|
|
505
|
-
return (0, _merge["default"])({}, c, {
|
|
506
|
-
correct: false
|
|
507
|
-
});
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
model.choices.splice(index, 1, choice);
|
|
512
|
-
|
|
513
|
-
_this.props.onModelChanged(model);
|
|
514
|
-
});
|
|
515
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPromptChanged", function (prompt) {
|
|
516
|
-
_this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
517
|
-
prompt: prompt
|
|
518
|
-
}));
|
|
519
|
-
});
|
|
520
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onTeacherInstructionsChanged", function (teacherInstructions) {
|
|
521
|
-
_this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
522
|
-
teacherInstructions: teacherInstructions
|
|
523
|
-
}));
|
|
524
|
-
});
|
|
525
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onModelChanged", function (model, key) {
|
|
526
|
-
var onModelChanged = _this.props.onModelChanged;
|
|
527
|
-
|
|
528
|
-
switch (key) {
|
|
529
|
-
case 'choiceMode':
|
|
530
|
-
{
|
|
531
|
-
var value = model.choiceMode;
|
|
532
|
-
|
|
533
|
-
if (value === 'radio') {
|
|
534
|
-
var correctFound = false;
|
|
535
|
-
model.choices = model.choices.map(function (c) {
|
|
536
|
-
if (correctFound) {
|
|
537
|
-
c.correct = false;
|
|
538
|
-
return c;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
if (c.correct) {
|
|
542
|
-
correctFound = true;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
return c;
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
onModelChanged(model, true);
|
|
550
|
-
break;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
default:
|
|
554
|
-
onModelChanged(model);
|
|
555
|
-
break;
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
return _this;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
(0, _createClass2["default"])(Main, [{
|
|
562
|
-
key: "render",
|
|
563
|
-
value: function render() {
|
|
564
|
-
var dialog = this.state.dialog;
|
|
565
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(InfoDialog, {
|
|
566
|
-
open: dialog.open,
|
|
567
|
-
title: dialog.message,
|
|
568
|
-
onCancel: dialog.onCancel,
|
|
569
|
-
onOk: dialog.onOk
|
|
570
|
-
}), /*#__PURE__*/_react["default"].createElement(Design, (0, _extends2["default"])({}, this.props, {
|
|
571
|
-
onChangeModel: this.onModelChanged,
|
|
572
|
-
onRemoveChoice: this.onRemoveChoice,
|
|
573
|
-
onChoiceChanged: this.onChoiceChanged,
|
|
574
|
-
onAddChoice: this.onAddChoice,
|
|
575
|
-
onPromptChanged: this.onPromptChanged,
|
|
576
|
-
onTeacherInstructionsChanged: this.onTeacherInstructionsChanged
|
|
577
|
-
})));
|
|
578
|
-
}
|
|
579
|
-
}]);
|
|
580
|
-
return Main;
|
|
581
|
-
}(_react["default"].Component);
|
|
582
|
-
|
|
583
|
-
exports.Main = Main;
|
|
584
|
-
(0, _defineProperty2["default"])(Main, "propTypes", {
|
|
585
|
-
model: _propTypes["default"].object.isRequired,
|
|
586
|
-
configuration: _propTypes["default"].object.isRequired,
|
|
587
|
-
disableSidePanel: _propTypes["default"].bool,
|
|
588
|
-
onModelChanged: _propTypes["default"].func.isRequired,
|
|
589
|
-
onConfigurationChanged: _propTypes["default"].func.isRequired,
|
|
590
|
-
classes: _propTypes["default"].object.isRequired,
|
|
591
|
-
imageSupport: _propTypes["default"].shape({
|
|
592
|
-
add: _propTypes["default"].func.isRequired,
|
|
593
|
-
"delete": _propTypes["default"].func.isRequired
|
|
594
|
-
})
|
|
595
|
-
});
|
|
596
|
-
var Styled = (0, _styles.withStyles)(styles)(Main);
|
|
597
|
-
var _default = Styled;
|
|
598
|
-
exports["default"] = _default;
|
|
599
|
-
//# sourceMappingURL=main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","radio","dropdown","MAX_CHOICES","styles","theme","promptHolder","width","paddingBottom","spacing","unit","marginBottom","prompt","paddingTop","rationaleHolder","accessibilityHolder","rationale","accessibility","design","choiceConfigurationHolder","display","flexDirection","alignItems","choiceConfiguration","switchElement","justifyContent","margin","addButton","disableButton","cursor","pointerEvents","backgroundColor","color","disabled","flexContainer","titleText","fontFamily","fontSize","lineHeight","marginRight","tooltip","whiteSpace","maxWidth","errorText","Design","props","classes","model","configuration","onPromptChanged","onChoiceChanged","onRemoveChoice","onAddChoice","imageSupport","onChangeModel","onConfigurationChanged","onTeacherInstructionsChanged","addChoiceButton","feedback","deleteChoice","choiceMode","choicePrefix","partialScoring","lockChoiceOrder","teacherInstructions","studentInstructions","scoringType","sequentialChoiceLabels","settingsPanelDisabled","choicesLayout","spellCheck","gridColumns","maxAnswerChoices","limitChoicesNumber","teacherInstructionsEnabled","rationaleEnabled","accessibilityLabelsEnabled","feedbackEnabled","promptEnabled","spellCheckEnabled","choices","errors","choicesErrors","correctResponseError","answerChoicesError","nrOfColumnsAvailable","length","Array","from","_","i","labelPlugins","audio","video","toolbarOpts","toolbarEditorPosition","position","validationMessage","Content","label","map","choice","index","c","value","root","settingsInPanel","Settings","Properties","studentInstructionsEnabled","InfoDialog","open","onCancel","onOk","title","propTypes","PropTypes","bool","func","string","Main","dialog","minAnswerChoices","setState","message","splice","onModelChanged","push","utils","firstAvailableIndex","type","correct","key","correctFound","state","React","Component","object","isRequired","disableSidePanel","shape","add","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA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B,CAAQb,MAAR;AAEA,0BACE,+EACE,gCAAC,UAAD;AACE,QAAA,IAAI,EAAEA,MAAM,CAACV,IADf;AAEE,QAAA,KAAK,EAAEU,MAAM,CAACG,OAFhB;AAGE,QAAA,QAAQ,EAAEH,MAAM,CAACT,QAHnB;AAIE,QAAA,IAAI,EAAES,MAAM,CAACR;AAJf,QADF,eAOE,gCAAC,MAAD,gCACM,KAAKpE,KADX;AAEE,QAAA,aAAa,EAAE,KAAKiF,cAFtB;AAGE,QAAA,cAAc,EAAE,KAAK3E,cAHvB;AAIE,QAAA,eAAe,EAAE,KAAKD,eAJxB;AAKE,QAAA,WAAW,EAAE,KAAKE,WALpB;AAME,QAAA,eAAe,EAAE,KAAKH,eANxB;AAOE,QAAA,4BAA4B,EAAE,KAAKO;AAPrC,SAPF,CADF;AAmBD;;;EAtJuB+E,kBAAMC,S;;;iCAAnBhB,I,eACQ;AACjBzE,EAAAA,KAAK,EAAEqE,sBAAUqB,MAAV,CAAiBC,UADP;AAEjB1F,EAAAA,aAAa,EAAEoE,sBAAUqB,MAAV,CAAiBC,UAFf;AAGjBC,EAAAA,gBAAgB,EAAEvB,sBAAUC,IAHX;AAIjBS,EAAAA,cAAc,EAAEV,sBAAUE,IAAV,CAAeoB,UAJd;AAKjBnF,EAAAA,sBAAsB,EAAE6D,sBAAUE,IAAV,CAAeoB,UALtB;AAMjB5F,EAAAA,OAAO,EAAEsE,sBAAUqB,MAAV,CAAiBC,UANT;AAOjBrF,EAAAA,YAAY,EAAE+D,sBAAUwB,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEzB,sBAAUE,IAAV,CAAeoB,UADQ;AAE5B,cAAQtB,sBAAUE,IAAV,CAAeoB;AAFK,GAAhB;AAPG,C;AAwJrB,IAAMI,MAAM,GAAG,wBAAW1I,MAAX,EAAmBoH,IAAnB,CAAf;eAEesB,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html';\nimport {\n InputContainer,\n ChoiceConfiguration,\n settings,\n layout,\n choiceUtils as utils,\n} from '@pie-lib/config-ui';\nimport { color } from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport Button from '@material-ui/core/Button';\nimport merge from 'lodash/merge';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport Typography from '@material-ui/core/Typography';\nimport Info from '@material-ui/icons/Info';\nimport { generateValidationMessage } from './utils';\n\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst MAX_CHOICES = 9;\n\nconst styles = (theme) => ({\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n },\n rationaleHolder: {\n width: '70%',\n },\n accessibilityHolder: {\n width: '70%',\n },\n rationale: {\n paddingTop: theme.spacing.unit * 2,\n },\n accessibility: {\n paddingTop: theme.spacing.unit * 2,\n },\n design: {\n paddingTop: theme.spacing.unit * 3,\n },\n choiceConfigurationHolder: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n },\n choiceConfiguration: {\n width: '100%',\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2,\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0,\n },\n addButton: {\n float: 'right',\n },\n disableButton: {\n cursor: 'not-allowed',\n pointerEvents: 'all',\n backgroundColor: color.disabled(),\n '&:hover': {\n backgroundColor: color.disabled(),\n },\n '&:focus': {\n backgroundColor: color.disabled(),\n },\n },\n flexContainer: {\n display: 'flex',\n alignItems: 'center',\n marginBottom: '5px'\n },\n titleText: {\n fontFamily: 'Cerebri Sans',\n fontSize: '18px',\n lineHeight: '19px',\n color: '#495B8F',\n marginRight: '5px'\n },\n tooltip: {\n fontSize: '12px',\n whiteSpace: 'pre',\n maxWidth: '500px'\n },\n errorText: {\n fontSize: '12px',\n color: 'red',\n paddingTop: '5px'\n }\n});\n\nconst Design = withStyles(styles)((props) => {\n const {\n classes,\n model,\n configuration,\n onPromptChanged,\n onChoiceChanged,\n onRemoveChoice,\n onAddChoice,\n imageSupport,\n onChangeModel,\n onConfigurationChanged,\n onTeacherInstructionsChanged,\n } = props;\n const {\n prompt = {},\n addChoiceButton = {},\n feedback = {},\n deleteChoice = {},\n choiceMode = {},\n choicePrefix = {},\n partialScoring = {},\n lockChoiceOrder = {},\n teacherInstructions = {},\n studentInstructions = {},\n rationale = {},\n accessibility = {},\n scoringType = {},\n sequentialChoiceLabels = {},\n settingsPanelDisabled,\n choicesLayout,\n spellCheck = {},\n gridColumns\n } = configuration || {};\n let { maxAnswerChoices } = configuration || {};\n const {\n limitChoicesNumber,\n teacherInstructionsEnabled,\n rationaleEnabled,\n accessibilityLabelsEnabled,\n feedbackEnabled,\n promptEnabled,\n spellCheckEnabled,\n choices,\n errors\n } = model || {};\n\n const { choicesErrors, correctResponseError, answerChoicesError } = errors || {};\n const nrOfColumnsAvailable = choices && choices.length\n ? Array.from({ length: choices.length }, (_, i) => `${i + 1}`)\n : [];\n\n const labelPlugins = {\n audio: { disabled: true },\n video: { disabled: true },\n };\n\n const toolbarOpts = {};\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n const validationMessage = generateValidationMessage(configuration);\n\n const Content = (\n <div>\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n <div className={classes.flexContainer}>\n <Typography className={classes.titleText}>Choices</Typography>\n <Tooltip\n classes={{ tooltip: classes.tooltip }}\n disableFocusListener\n disableTouchListener\n placement={'right'}\n title={validationMessage}\n >\n <Info fontSize={'small'} color={'primary'}/>\n </Tooltip>\n </div>\n {correctResponseError && <div className={classes.errorText}>{correctResponseError}</div>}\n {answerChoicesError && <div className={classes.errorText}>{answerChoicesError}</div>}\n {choices.map((choice, index) => (\n <div\n key={`choice-${index}`}\n className={classes.choiceConfigurationHolder}\n >\n <ChoiceConfiguration\n key={index}\n index={index + 1}\n useLetterOrdering={model.choicePrefix === 'letters'}\n className={classes.choiceConfiguration}\n mode={model.choiceMode}\n data={choice}\n defaultFeedback={{}}\n imageSupport={imageSupport}\n onDelete={() => onRemoveChoice(index)}\n onChange={(c) => onChoiceChanged(index, c)}\n allowFeedBack={feedbackEnabled}\n allowDelete={deleteChoice.settings}\n noLabels\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n error={choicesErrors && choicesErrors[choice.value] ? choicesErrors[choice.value] : null}\n noCorrectAnswerError={correctResponseError}\n />\n {rationaleEnabled && (\n <InputContainer\n key={`rationale-${index}`}\n label={rationale.label}\n className={classes.rationaleHolder}\n >\n <EditableHtml\n className={classes.rationale}\n markup={choice.rationale || ''}\n onChange={(c) =>\n onChoiceChanged(index, {\n ...choice,\n rationale: c,\n })\n }\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n pluginProps={labelPlugins}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n {accessibilityLabelsEnabled && (\n <InputContainer\n key={`accessibility-${index}`}\n label={accessibility.label}\n className={classes.accessibilityHolder}\n >\n <EditableHtml\n className={classes.accessibility}\n markup={choice.accessibility || ''}\n onChange={(c) =>\n onChoiceChanged(index, {\n ...choice,\n accessibility: c,\n })\n }\n imageSupport={imageSupport}\n pluginProps={labelPlugins}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n </div>\n ))}\n <br/>\n {addChoiceButton.settings && (\n <Tooltip\n title={\n maxAnswerChoices && model.choices.length >= maxAnswerChoices\n ? `Only ${maxAnswerChoices} allowed maximum`\n : ''\n }\n classes={{ tooltip: classes.tooltip }}\n >\n <Button\n classes={{ root: maxAnswerChoices && model.choices.length >= maxAnswerChoices && classes.disableButton }}\n className={classes.addButton}\n variant=\"contained\"\n color=\"primary\"\n onClick={onAddChoice}\n >\n {addChoiceButton.label}\n </Button>\n </Tooltip>\n )}\n </div>\n );\n\n const settingsInPanel = {\n choiceMode:\n choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),\n 'sequentialChoiceLabels.enabled':\n sequentialChoiceLabels.settings &&\n toggle(sequentialChoiceLabels.label, true),\n choicePrefix:\n choicePrefix.settings &&\n radio(choicePrefix.label, ['numbers', 'letters']),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n choicesLayout:\n choicesLayout.settings &&\n dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),\n gridColumns:\n choicesLayout.settings &&\n model.choicesLayout === 'grid' &&\n nrOfColumnsAvailable.length > 0 &&\n dropdown(gridColumns.label, nrOfColumnsAvailable),\n };\n\n return (\n <div className={classes.design}>\n {settingsPanelDisabled ? (\n Content\n ) : (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n onChangeModel={onChangeModel}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: settingsInPanel,\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n studentInstructionsEnabled:\n studentInstructions.settings &&\n toggle(studentInstructions.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n rationaleEnabled:\n rationale.settings && toggle(rationale.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n accessibilityLabelsEnabled:\n accessibility.settings && toggle(accessibility.label),\n scoringType:\n scoringType.settings &&\n radio(scoringType.label, ['auto', 'rubric']),\n },\n }}\n />\n }\n >\n {Content}\n </layout.ConfigLayout>\n )}\n </div>\n );\n});\n\nconst InfoDialog = ({ open, onCancel, onOk, title }) => (\n <Dialog open={open}>\n <DialogTitle>{title}</DialogTitle>\n <DialogActions>\n {onOk && (\n <Button onClick={onOk} color=\"primary\">\n OK\n </Button>\n )}\n {onCancel && (\n <Button onClick={onCancel} color=\"primary\">\n Cancel\n </Button>\n )}\n </DialogActions>\n </Dialog>\n);\n\nInfoDialog.propTypes = {\n open: PropTypes.bool,\n onCancel: PropTypes.func,\n onOk: PropTypes.func,\n title: PropTypes.string,\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n };\n\n state = {\n dialog: {\n open: false,\n },\n };\n\n onRemoveChoice = (index) => {\n const { model, configuration } = this.props;\n const { minAnswerChoices } = configuration || {};\n\n if (minAnswerChoices && model.choices.length === minAnswerChoices) {\n this.setState({\n dialog: {\n open: true,\n message: `There can't be less than ${minAnswerChoices} choices.`,\n onOk: () => {\n this.setState({\n dialog: {\n open: false,\n },\n });\n }\n }\n });\n } else {\n model.choices.splice(index, 1);\n this.props.onModelChanged(model);\n }\n };\n\n onAddChoice = () => {\n const { model, configuration } = this.props;\n let { maxAnswerChoices } = configuration || {};\n const { limitChoicesNumber } = model || {};\n\n // if old property is used, set maxAnswerChoices to 9\n if (limitChoicesNumber) {\n maxAnswerChoices = MAX_CHOICES;\n }\n\n if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {\n return;\n }\n\n model.choices.push({\n label: '',\n value: utils.firstAvailableIndex(model.choices.map((c) => c.value), 0),\n feedback: { type: 'none' }\n });\n\n this.props.onModelChanged(model);\n };\n\n onChoiceChanged = (index, choice) => {\n const { model } = this.props;\n\n if (choice.correct && model.choiceMode === 'radio') {\n model.choices = model.choices.map((c) => {\n return merge({}, c, { correct: false });\n });\n }\n\n model.choices.splice(index, 1, choice);\n this.props.onModelChanged(model);\n };\n\n onPromptChanged = (prompt) => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt,\n });\n };\n\n onTeacherInstructionsChanged = (teacherInstructions) => {\n this.props.onModelChanged({\n ...this.props.model,\n teacherInstructions,\n });\n };\n\n onModelChanged = (model, key) => {\n const { onModelChanged } = this.props;\n\n switch (key) {\n case 'choiceMode': {\n let value = model.choiceMode;\n\n if (value === 'radio') {\n let correctFound = false;\n\n model.choices = model.choices.map((c) => {\n if (correctFound) {\n c.correct = false;\n\n return c;\n }\n\n if (c.correct) {\n correctFound = true;\n }\n\n return c;\n });\n }\n\n onModelChanged(model, true);\n break;\n }\n default:\n onModelChanged(model);\n break;\n }\n };\n\n render() {\n const { dialog } = this.state;\n\n return (\n <>\n <InfoDialog\n open={dialog.open}\n title={dialog.message}\n onCancel={dialog.onCancel}\n onOk={dialog.onOk}\n />\n <Design\n {...this.props}\n onChangeModel={this.onModelChanged}\n onRemoveChoice={this.onRemoveChoice}\n onChoiceChanged={this.onChoiceChanged}\n onAddChoice={this.onAddChoice}\n onPromptChanged={this.onPromptChanged}\n onTeacherInstructionsChanged={this.onTeacherInstructionsChanged}\n />\n </>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
|