@pie-element/math-inline 6.5.1-beta.0 → 6.5.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configure/package.json +3 -3
- package/package.json +3 -3
- package/configure/lib/configure.js +0 -249
- package/configure/lib/configure.js.map +0 -1
- package/configure/lib/defaults.js +0 -117
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/general-config-block.js +0 -631
- package/configure/lib/general-config-block.js.map +0 -1
- package/configure/lib/index.js +0 -166
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/response.js +0 -449
- package/configure/lib/response.js.map +0 -1
- package/configure/lib/utils.js +0 -29
- package/configure/lib/utils.js.map +0 -1
- package/controller/lib/defaults.js +0 -35
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -398
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/utils.js +0 -12
- package/controller/lib/utils.js.map +0 -1
- package/lib/index.js +0 -127
- package/lib/index.js.map +0 -1
- package/lib/main.js +0 -830
- package/lib/main.js.map +0 -1
- package/lib/print.js +0 -133
- package/lib/print.js.map +0 -1
- package/lib/simple-question-block.js +0 -195
- package/lib/simple-question-block.js.map +0 -1
- package/lib/utils.js +0 -12
- package/lib/utils.js.map +0 -1
|
@@ -1,631 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
|
|
14
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
-
|
|
20
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
|
-
var React = _interopRequireWildcard(require("react"));
|
|
29
|
-
|
|
30
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
33
|
-
|
|
34
|
-
var _editableHtml = _interopRequireDefault(require("@pie-lib/editable-html"));
|
|
35
|
-
|
|
36
|
-
var _configUi = require("@pie-lib/config-ui");
|
|
37
|
-
|
|
38
|
-
var _styles = require("@material-ui/core/styles");
|
|
39
|
-
|
|
40
|
-
var _InputLabel = _interopRequireDefault(require("@material-ui/core/InputLabel"));
|
|
41
|
-
|
|
42
|
-
var _Select = _interopRequireDefault(require("@material-ui/core/Select"));
|
|
43
|
-
|
|
44
|
-
var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
|
|
45
|
-
|
|
46
|
-
var _response = _interopRequireDefault(require("./response"));
|
|
47
|
-
|
|
48
|
-
var _mathToolbar = require("@pie-lib/math-toolbar");
|
|
49
|
-
|
|
50
|
-
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
51
|
-
|
|
52
|
-
var _utils = require("./utils");
|
|
53
|
-
|
|
54
|
-
var _mathquill = _interopRequireDefault(require("@pie-framework/mathquill"));
|
|
55
|
-
|
|
56
|
-
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
|
57
|
-
|
|
58
|
-
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
59
|
-
|
|
60
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
61
|
-
|
|
62
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
63
|
-
|
|
64
|
-
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; }
|
|
65
|
-
|
|
66
|
-
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; }
|
|
67
|
-
|
|
68
|
-
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); }; }
|
|
69
|
-
|
|
70
|
-
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; } }
|
|
71
|
-
|
|
72
|
-
var registered = false;
|
|
73
|
-
|
|
74
|
-
var styles = function styles(theme) {
|
|
75
|
-
return {
|
|
76
|
-
container: {
|
|
77
|
-
marginTop: theme.spacing.unit * 2,
|
|
78
|
-
marginBottom: theme.spacing.unit * 2,
|
|
79
|
-
display: 'flex',
|
|
80
|
-
flexDirection: 'column'
|
|
81
|
-
},
|
|
82
|
-
templateTitle: {
|
|
83
|
-
fontSize: '0.85rem'
|
|
84
|
-
},
|
|
85
|
-
addResponseButton: {
|
|
86
|
-
border: '1px solid lightgrey',
|
|
87
|
-
"float": 'right',
|
|
88
|
-
width: '150px'
|
|
89
|
-
},
|
|
90
|
-
flexContainer: {
|
|
91
|
-
display: 'flex',
|
|
92
|
-
alignItems: 'center',
|
|
93
|
-
justifyContent: 'space-between'
|
|
94
|
-
},
|
|
95
|
-
selectContainer: {
|
|
96
|
-
flex: 'initial',
|
|
97
|
-
width: '40%',
|
|
98
|
-
marginTop: theme.spacing.unit * 2,
|
|
99
|
-
marginBottom: theme.spacing.unit * 2
|
|
100
|
-
},
|
|
101
|
-
inputContainer: {
|
|
102
|
-
marginBottom: theme.spacing.unit * 4,
|
|
103
|
-
display: 'flex',
|
|
104
|
-
flexDirection: 'column',
|
|
105
|
-
width: '90%'
|
|
106
|
-
},
|
|
107
|
-
responseEditor: {
|
|
108
|
-
display: 'flex',
|
|
109
|
-
justifyContent: 'center',
|
|
110
|
-
width: '100%',
|
|
111
|
-
minWidth: '500px',
|
|
112
|
-
maxWidth: 'inherit',
|
|
113
|
-
height: 'auto',
|
|
114
|
-
minHeight: '130px',
|
|
115
|
-
textAlign: 'left',
|
|
116
|
-
padding: theme.spacing.unit
|
|
117
|
-
},
|
|
118
|
-
promptHolder: {
|
|
119
|
-
width: '100%',
|
|
120
|
-
paddingBottom: theme.spacing.unit * 2,
|
|
121
|
-
marginBottom: theme.spacing.unit * 2
|
|
122
|
-
},
|
|
123
|
-
prompt: {
|
|
124
|
-
paddingTop: theme.spacing.unit * 2,
|
|
125
|
-
width: '100%',
|
|
126
|
-
maxWidth: '600px'
|
|
127
|
-
},
|
|
128
|
-
blockContainer: {
|
|
129
|
-
margin: theme.spacing.unit,
|
|
130
|
-
display: 'inline-flex',
|
|
131
|
-
border: '2px solid grey'
|
|
132
|
-
},
|
|
133
|
-
blockContainerGeneric: {
|
|
134
|
-
margin: theme.spacing.unit / 2
|
|
135
|
-
},
|
|
136
|
-
blockResponse: {
|
|
137
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',
|
|
138
|
-
flex: 2,
|
|
139
|
-
color: 'grey',
|
|
140
|
-
background: 'lightgrey',
|
|
141
|
-
fontSize: '0.8rem',
|
|
142
|
-
padding: theme.spacing.unit / 2,
|
|
143
|
-
display: 'flex',
|
|
144
|
-
alignItems: 'center',
|
|
145
|
-
justifyContent: 'center',
|
|
146
|
-
borderRight: '2px solid grey'
|
|
147
|
-
},
|
|
148
|
-
blockResponseGeneric: {
|
|
149
|
-
borderRight: 0
|
|
150
|
-
},
|
|
151
|
-
blockMath: {
|
|
152
|
-
color: '#bdbdbd',
|
|
153
|
-
padding: theme.spacing.unit / 2,
|
|
154
|
-
display: 'flex',
|
|
155
|
-
alignItems: 'center',
|
|
156
|
-
justifyContent: 'center',
|
|
157
|
-
flex: 8,
|
|
158
|
-
'& > .mq-math-mode': {
|
|
159
|
-
'& > .mq-hasCursor': {
|
|
160
|
-
'& > .mq-cursor': {
|
|
161
|
-
display: 'none'
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
tooltip: {
|
|
167
|
-
fontSize: '12px',
|
|
168
|
-
whiteSpace: 'pre-wrap'
|
|
169
|
-
},
|
|
170
|
-
errorText: {
|
|
171
|
-
fontSize: '12px',
|
|
172
|
-
color: 'red',
|
|
173
|
-
padding: '5px 0'
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
var REGEX = /{{response}}/gm;
|
|
179
|
-
var TEMPORARY_RESPONSE_FIELD = /\\%response\\%/gm;
|
|
180
|
-
var ANSWER_BLOCK_REGEX = /\\embed\{answerBlock\}\[r\d*\]/g;
|
|
181
|
-
var NEWLINE_BLOCK = /\\embed\{newLine\}\[\]/g;
|
|
182
|
-
var NEWLINE_LATEX = /\\newline/g;
|
|
183
|
-
|
|
184
|
-
function prepareForStatic(expression) {
|
|
185
|
-
if (expression) {
|
|
186
|
-
var answerBlocks = 1; // assume one at least
|
|
187
|
-
|
|
188
|
-
return expression.replace(REGEX, function () {
|
|
189
|
-
return "\\embed{answerBlock}[r".concat(answerBlocks++, "]");
|
|
190
|
-
}).replace(NEWLINE_LATEX, '\\embed{newLine}[]');
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function prepareForModel(expression) {
|
|
195
|
-
if (expression) {
|
|
196
|
-
return expression.replace(ANSWER_BLOCK_REGEX, function () {
|
|
197
|
-
return '{{response}}';
|
|
198
|
-
}).replace(TEMPORARY_RESPONSE_FIELD, function () {
|
|
199
|
-
return '{{response}}';
|
|
200
|
-
}).replace(NEWLINE_BLOCK, function () {
|
|
201
|
-
return '\\newline';
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
var GeneralConfigBlock = /*#__PURE__*/function (_React$Component) {
|
|
207
|
-
(0, _inherits2["default"])(GeneralConfigBlock, _React$Component);
|
|
208
|
-
|
|
209
|
-
var _super = _createSuper(GeneralConfigBlock);
|
|
210
|
-
|
|
211
|
-
function GeneralConfigBlock(props) {
|
|
212
|
-
var _this;
|
|
213
|
-
|
|
214
|
-
(0, _classCallCheck2["default"])(this, GeneralConfigBlock);
|
|
215
|
-
_this = _super.call(this, props);
|
|
216
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (name) {
|
|
217
|
-
return function (evtOrValue) {
|
|
218
|
-
var _this$props = _this.props,
|
|
219
|
-
model = _this$props.model,
|
|
220
|
-
onChange = _this$props.onChange;
|
|
221
|
-
|
|
222
|
-
var newModel = _objectSpread({}, model);
|
|
223
|
-
|
|
224
|
-
if ((0, _typeof2["default"])(evtOrValue) === 'object') {
|
|
225
|
-
newModel[name] = evtOrValue.target.value;
|
|
226
|
-
} else {
|
|
227
|
-
newModel[name] = evtOrValue;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (name === 'expression') {
|
|
231
|
-
newModel[name] = prepareForModel(evtOrValue);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
onChange(newModel);
|
|
235
|
-
};
|
|
236
|
-
});
|
|
237
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDone", function () {
|
|
238
|
-
_this.setState({
|
|
239
|
-
showKeypad: false
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onFocus", function () {
|
|
243
|
-
_this.setState({
|
|
244
|
-
showKeypad: true
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPromptFocus", function () {
|
|
248
|
-
_this.setState({
|
|
249
|
-
showKeypad: false
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleAnswerBlockDomUpdate", function () {
|
|
253
|
-
var model = _this.props.model;
|
|
254
|
-
var responseAreas = {};
|
|
255
|
-
|
|
256
|
-
if (model && model.expression) {
|
|
257
|
-
var answerBlocks = 1; // assume one at least
|
|
258
|
-
// build out local state model using responses declared in expression
|
|
259
|
-
|
|
260
|
-
model.expression.replace(REGEX, function () {
|
|
261
|
-
responseAreas["r".concat(answerBlocks++)] = {
|
|
262
|
-
value: ''
|
|
263
|
-
};
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (!(0, _isEqual["default"])(responseAreas, _this.state.responseAreas)) {
|
|
268
|
-
_this.setState({
|
|
269
|
-
responseAreas: responseAreas
|
|
270
|
-
}, function () {
|
|
271
|
-
if (_this.root && Object.keys(responseAreas).length) {
|
|
272
|
-
Object.keys(responseAreas).forEach(function (responseId, idx) {
|
|
273
|
-
var el = _this.root.querySelector("#".concat(responseId));
|
|
274
|
-
|
|
275
|
-
var indexEl = _this.root.querySelector("#".concat(responseId, "Index"));
|
|
276
|
-
|
|
277
|
-
if (el) {
|
|
278
|
-
// const MathQuill = require('@pie-framework/mathquill');
|
|
279
|
-
var MQ = _mathquill["default"].getInterface(2); // We no longer have individual answers, so we cannot set text content of blocks
|
|
280
|
-
// el.textContent = response.answer;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
MQ.StaticMath(el);
|
|
284
|
-
indexEl.textContent = "R".concat(idx + 1);
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAddResponse", function () {
|
|
292
|
-
var _this$props2 = _this.props,
|
|
293
|
-
model = _this$props2.model,
|
|
294
|
-
onChange = _this$props2.onChange;
|
|
295
|
-
var responseIdCounter = _this.state.responseIdCounter;
|
|
296
|
-
|
|
297
|
-
var newModel = _objectSpread({}, model);
|
|
298
|
-
|
|
299
|
-
var newCounter = responseIdCounter;
|
|
300
|
-
|
|
301
|
-
while (model.responses.find(function (response) {
|
|
302
|
-
return response.id === newCounter;
|
|
303
|
-
})) {
|
|
304
|
-
newCounter++;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
var response = {
|
|
308
|
-
id: newCounter,
|
|
309
|
-
validation: 'literal',
|
|
310
|
-
answer: '',
|
|
311
|
-
alternates: {}
|
|
312
|
-
};
|
|
313
|
-
newModel.responses = newModel.responses.concat(response);
|
|
314
|
-
onChange(newModel);
|
|
315
|
-
|
|
316
|
-
_this.setState({
|
|
317
|
-
responseIdCounter: response.id
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onResponseChange", function (response, index) {
|
|
321
|
-
var _this$props3 = _this.props,
|
|
322
|
-
model = _this$props3.model,
|
|
323
|
-
onChange = _this$props3.onChange;
|
|
324
|
-
|
|
325
|
-
var newModel = _objectSpread({}, model);
|
|
326
|
-
|
|
327
|
-
newModel.responses[index] = response;
|
|
328
|
-
onChange(newModel);
|
|
329
|
-
});
|
|
330
|
-
var _responseAreas = {};
|
|
331
|
-
|
|
332
|
-
if (props.model && props.model.expression) {
|
|
333
|
-
var answerBlocks = 1; // assume one at least
|
|
334
|
-
// build out local state model using responses declared in expression
|
|
335
|
-
|
|
336
|
-
props.model.expression.replace(REGEX, function () {
|
|
337
|
-
_responseAreas["r".concat(answerBlocks++)] = {
|
|
338
|
-
value: ''
|
|
339
|
-
};
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
_this.state = {
|
|
344
|
-
showKeypad: false,
|
|
345
|
-
responseAreas: _responseAreas,
|
|
346
|
-
responseIdCounter: Object.keys(_responseAreas).length
|
|
347
|
-
};
|
|
348
|
-
return _this;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
(0, _createClass2["default"])(GeneralConfigBlock, [{
|
|
352
|
-
key: "UNSAFE_componentWillMount",
|
|
353
|
-
value: function UNSAFE_componentWillMount() {
|
|
354
|
-
var classes = this.props.classes;
|
|
355
|
-
|
|
356
|
-
if (typeof window !== 'undefined') {
|
|
357
|
-
// const MathQuill = require('@pie-framework/mathquill');
|
|
358
|
-
var MQ = _mathquill["default"].getInterface(2);
|
|
359
|
-
|
|
360
|
-
if (!registered) {
|
|
361
|
-
MQ.registerEmbed('answerBlock', function (data) {
|
|
362
|
-
// not used until we implement individual answer tracking
|
|
363
|
-
// const individualAnswerBlock = `<div class="${classes.blockContainer}">
|
|
364
|
-
// <div class="${classes.blockResponse}" id="${data}Index">R</div>
|
|
365
|
-
// <div class="${classes.blockMath}">
|
|
366
|
-
// <span id="${data}"></span>
|
|
367
|
-
// </div>
|
|
368
|
-
// </div>`;
|
|
369
|
-
var genericAnswerBlock = "<div class=\"".concat((0, _classnames["default"])(classes.blockContainer, classes.blockContainerGeneric), "\">\n <div class=\"").concat((0, _classnames["default"])(classes.blockResponse, classes.blockResponseGeneric), "\" id=\"").concat(data, "Index\">Response</div>\n </div>");
|
|
370
|
-
return {
|
|
371
|
-
htmlString: genericAnswerBlock,
|
|
372
|
-
text: function text() {
|
|
373
|
-
return 'text';
|
|
374
|
-
},
|
|
375
|
-
latex: function latex() {
|
|
376
|
-
return "\\embed{answerBlock}[".concat(data, "]");
|
|
377
|
-
}
|
|
378
|
-
};
|
|
379
|
-
});
|
|
380
|
-
registered = true;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}, {
|
|
385
|
-
key: "componentDidMount",
|
|
386
|
-
value: function componentDidMount() {
|
|
387
|
-
this.handleAnswerBlockDomUpdate();
|
|
388
|
-
}
|
|
389
|
-
}, {
|
|
390
|
-
key: "componentDidUpdate",
|
|
391
|
-
value: function componentDidUpdate() {
|
|
392
|
-
this.handleAnswerBlockDomUpdate();
|
|
393
|
-
}
|
|
394
|
-
}, {
|
|
395
|
-
key: "render",
|
|
396
|
-
value: function render() {
|
|
397
|
-
var _this2 = this;
|
|
398
|
-
|
|
399
|
-
var _this$props4 = this.props,
|
|
400
|
-
classes = _this$props4.classes,
|
|
401
|
-
model = _this$props4.model,
|
|
402
|
-
imageSupport = _this$props4.imageSupport,
|
|
403
|
-
uploadSoundSupport = _this$props4.uploadSoundSupport,
|
|
404
|
-
configuration = _this$props4.configuration,
|
|
405
|
-
promptEnabled = _this$props4.promptEnabled,
|
|
406
|
-
rationaleEnabled = _this$props4.rationaleEnabled,
|
|
407
|
-
toolbarOpts = _this$props4.toolbarOpts;
|
|
408
|
-
var showKeypad = this.state.showKeypad;
|
|
409
|
-
var prompt = model.prompt,
|
|
410
|
-
expression = model.expression,
|
|
411
|
-
equationEditor = model.equationEditor,
|
|
412
|
-
_model$promptEquation = model.promptEquationEditor,
|
|
413
|
-
promptEquationEditor = _model$promptEquation === void 0 ? '8' : _model$promptEquation,
|
|
414
|
-
responses = model.responses,
|
|
415
|
-
responseType = model.responseType,
|
|
416
|
-
rationale = model.rationale,
|
|
417
|
-
spellCheckEnabled = model.spellCheckEnabled,
|
|
418
|
-
_model$errors = model.errors,
|
|
419
|
-
errors = _model$errors === void 0 ? {} : _model$errors;
|
|
420
|
-
|
|
421
|
-
var _ref = configuration || {},
|
|
422
|
-
_ref$rationale = _ref.rationale,
|
|
423
|
-
cRationale = _ref$rationale === void 0 ? {} : _ref$rationale,
|
|
424
|
-
_ref$prompt = _ref.prompt,
|
|
425
|
-
cPrompt = _ref$prompt === void 0 ? {} : _ref$prompt,
|
|
426
|
-
_ref$ignoreOrder = _ref.ignoreOrder,
|
|
427
|
-
cIgnoreOrder = _ref$ignoreOrder === void 0 ? {} : _ref$ignoreOrder,
|
|
428
|
-
_ref$allowTrailingZer = _ref.allowTrailingZeros,
|
|
429
|
-
cAllowTrailingZeros = _ref$allowTrailingZer === void 0 ? {} : _ref$allowTrailingZer,
|
|
430
|
-
maxResponseAreas = _ref.maxResponseAreas,
|
|
431
|
-
_ref$maxImageWidth = _ref.maxImageWidth,
|
|
432
|
-
maxImageWidth = _ref$maxImageWidth === void 0 ? {} : _ref$maxImageWidth,
|
|
433
|
-
_ref$maxImageHeight = _ref.maxImageHeight,
|
|
434
|
-
maxImageHeight = _ref$maxImageHeight === void 0 ? {} : _ref$maxImageHeight;
|
|
435
|
-
|
|
436
|
-
var validationMessage = (0, _utils.generateValidationMessage)(configuration, model);
|
|
437
|
-
var responsesErrors = errors.responsesErrors,
|
|
438
|
-
responseAreasError = errors.responseAreasError;
|
|
439
|
-
var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
440
|
-
var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
441
|
-
var classNames = {
|
|
442
|
-
editor: classes.responseEditor,
|
|
443
|
-
mathToolbar: classes.mathToolbar
|
|
444
|
-
};
|
|
445
|
-
var responsesToUse = responseType === _utils.ResponseTypes.advanced ? responses : responses.slice(0, 1);
|
|
446
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
447
|
-
ref: function ref(r) {
|
|
448
|
-
return _this2.root = r || _this2.root;
|
|
449
|
-
},
|
|
450
|
-
className: classes.container
|
|
451
|
-
}, promptEnabled && /*#__PURE__*/React.createElement(_configUi.InputContainer, {
|
|
452
|
-
label: cPrompt.label,
|
|
453
|
-
className: classes.promptHolder
|
|
454
|
-
}, /*#__PURE__*/React.createElement(_editableHtml["default"], {
|
|
455
|
-
onFocus: this.onPromptFocus,
|
|
456
|
-
className: classes.prompt,
|
|
457
|
-
markup: prompt || '',
|
|
458
|
-
onChange: this.onChange('prompt'),
|
|
459
|
-
imageSupport: imageSupport,
|
|
460
|
-
nonEmpty: false,
|
|
461
|
-
toolbarOpts: toolbarOpts,
|
|
462
|
-
spellCheck: spellCheckEnabled,
|
|
463
|
-
maxImageWidth: defaultImageMaxWidth,
|
|
464
|
-
maxImageHeight: defaultImageMaxHeight,
|
|
465
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
466
|
-
languageCharactersProps: [{
|
|
467
|
-
language: 'spanish'
|
|
468
|
-
}, {
|
|
469
|
-
language: 'special'
|
|
470
|
-
}]
|
|
471
|
-
})), rationaleEnabled && /*#__PURE__*/React.createElement(_configUi.InputContainer, {
|
|
472
|
-
label: cRationale.label,
|
|
473
|
-
className: classes.promptHolder
|
|
474
|
-
}, /*#__PURE__*/React.createElement(_editableHtml["default"], {
|
|
475
|
-
className: classes.prompt,
|
|
476
|
-
markup: rationale || '',
|
|
477
|
-
pluginProps: {
|
|
478
|
-
math: {
|
|
479
|
-
controlledKeypadMode: false
|
|
480
|
-
}
|
|
481
|
-
},
|
|
482
|
-
onChange: this.onChange('rationale'),
|
|
483
|
-
imageSupport: imageSupport,
|
|
484
|
-
nonEmpty: false,
|
|
485
|
-
toolbarOpts: toolbarOpts,
|
|
486
|
-
spellCheck: spellCheckEnabled,
|
|
487
|
-
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
488
|
-
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
489
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
490
|
-
languageCharactersProps: [{
|
|
491
|
-
language: 'spanish'
|
|
492
|
-
}, {
|
|
493
|
-
language: 'special'
|
|
494
|
-
}]
|
|
495
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
496
|
-
className: classes.flexContainer,
|
|
497
|
-
style: {
|
|
498
|
-
justifyContent: 'flex-start'
|
|
499
|
-
}
|
|
500
|
-
}, /*#__PURE__*/React.createElement("h3", null, "Define Response"), /*#__PURE__*/React.createElement(_Tooltip["default"], {
|
|
501
|
-
classes: {
|
|
502
|
-
tooltip: classes.tooltip
|
|
503
|
-
},
|
|
504
|
-
disableFocusListener: true,
|
|
505
|
-
disableTouchListener: true,
|
|
506
|
-
placement: 'right',
|
|
507
|
-
title: validationMessage
|
|
508
|
-
}, /*#__PURE__*/React.createElement(_Info["default"], {
|
|
509
|
-
fontSize: 'small',
|
|
510
|
-
color: 'primary',
|
|
511
|
-
style: {
|
|
512
|
-
marginLeft: '5px'
|
|
513
|
-
}
|
|
514
|
-
}))), responseAreasError && /*#__PURE__*/React.createElement("div", {
|
|
515
|
-
className: classes.errorText
|
|
516
|
-
}, responseAreasError), responseType === _utils.ResponseTypes.advanced && [/*#__PURE__*/React.createElement(_configUi.InputContainer, {
|
|
517
|
-
key: "templateEditorType",
|
|
518
|
-
label: "Response Template Equation Editor",
|
|
519
|
-
className: classes.selectContainer
|
|
520
|
-
}, /*#__PURE__*/React.createElement(_Select["default"], {
|
|
521
|
-
className: classes.select,
|
|
522
|
-
onChange: this.onChange('promptEquationEditor'),
|
|
523
|
-
value: promptEquationEditor
|
|
524
|
-
}, /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
525
|
-
value: "non-negative-integers"
|
|
526
|
-
}, "Numeric - Non-Negative Integers"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
527
|
-
value: "integers"
|
|
528
|
-
}, "Numeric - Integers"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
529
|
-
value: "decimals"
|
|
530
|
-
}, "Numeric - Decimals"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
531
|
-
value: "fractions"
|
|
532
|
-
}, "Numeric - Fractions"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
533
|
-
value: 1
|
|
534
|
-
}, "Grade 1 - 2"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
535
|
-
value: 3
|
|
536
|
-
}, "Grade 3 - 5"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
537
|
-
value: 6
|
|
538
|
-
}, "Grade 6 - 7"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
539
|
-
value: 8
|
|
540
|
-
}, "Grade 8 - HS"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
541
|
-
value: 'geometry'
|
|
542
|
-
}, "Geometry"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
543
|
-
value: 'advanced-algebra'
|
|
544
|
-
}, "Advanced Algebra"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
545
|
-
value: 'statistics'
|
|
546
|
-
}, "Statistics"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
547
|
-
value: 'item-authoring'
|
|
548
|
-
}, "Item Authoring"))), /*#__PURE__*/React.createElement("div", {
|
|
549
|
-
className: classes.inputContainer,
|
|
550
|
-
key: "templateHolder"
|
|
551
|
-
}, /*#__PURE__*/React.createElement(_InputLabel["default"], {
|
|
552
|
-
className: classes.templateTitle
|
|
553
|
-
}, "RESPONSE TEMPLATE"), /*#__PURE__*/React.createElement(_mathToolbar.MathToolbar, {
|
|
554
|
-
classNames: classNames,
|
|
555
|
-
allowAnswerBlock: true,
|
|
556
|
-
keypadMode: promptEquationEditor,
|
|
557
|
-
controlledKeypad: true,
|
|
558
|
-
showKeypad: showKeypad,
|
|
559
|
-
latex: prepareForStatic(expression) || '',
|
|
560
|
-
onChange: this.onChange('expression'),
|
|
561
|
-
onFocus: this.onFocus,
|
|
562
|
-
onDone: this.onDone,
|
|
563
|
-
maxResponseAreas: maxResponseAreas,
|
|
564
|
-
error: responseAreasError
|
|
565
|
-
}))], /*#__PURE__*/React.createElement("h4", null, "Define Correct Response"), /*#__PURE__*/React.createElement("div", {
|
|
566
|
-
className: classes.flexContainer
|
|
567
|
-
}, /*#__PURE__*/React.createElement(_configUi.InputContainer, {
|
|
568
|
-
label: "Equation Editor",
|
|
569
|
-
className: classes.selectContainer
|
|
570
|
-
}, /*#__PURE__*/React.createElement(_Select["default"], {
|
|
571
|
-
className: classes.select,
|
|
572
|
-
onChange: this.onChange('equationEditor'),
|
|
573
|
-
value: equationEditor
|
|
574
|
-
}, /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
575
|
-
value: "non-negative-integers"
|
|
576
|
-
}, "Numeric - Non-Negative Integers"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
577
|
-
value: "integers"
|
|
578
|
-
}, "Numeric - Integers"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
579
|
-
value: "decimals"
|
|
580
|
-
}, "Numeric - Decimals"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
581
|
-
value: "fractions"
|
|
582
|
-
}, "Numeric - Fractions"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
583
|
-
value: 1
|
|
584
|
-
}, "Grade 1 - 2"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
585
|
-
value: 3
|
|
586
|
-
}, "Grade 3 - 5"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
587
|
-
value: 6
|
|
588
|
-
}, "Grade 6 - 7"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
589
|
-
value: 8
|
|
590
|
-
}, "Grade 8 - HS"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
591
|
-
value: 'geometry'
|
|
592
|
-
}, "Geometry"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
593
|
-
value: 'advanced-algebra'
|
|
594
|
-
}, "Advanced Algebra"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
595
|
-
value: 'statistics'
|
|
596
|
-
}, "Statistics"), /*#__PURE__*/React.createElement(_MenuItem["default"], {
|
|
597
|
-
value: 'item-authoring'
|
|
598
|
-
}, "Item Authoring")))), responsesToUse.map(function (response, idx) {
|
|
599
|
-
return /*#__PURE__*/React.createElement(_response["default"], {
|
|
600
|
-
key: response.id,
|
|
601
|
-
mode: equationEditor,
|
|
602
|
-
response: response,
|
|
603
|
-
defaultResponse: responseType === _utils.ResponseTypes.simple,
|
|
604
|
-
onResponseChange: _this2.onResponseChange,
|
|
605
|
-
index: idx,
|
|
606
|
-
cIgnoreOrder: cIgnoreOrder,
|
|
607
|
-
cAllowTrailingZeros: cAllowTrailingZeros,
|
|
608
|
-
error: responsesErrors && responsesErrors[idx]
|
|
609
|
-
});
|
|
610
|
-
}));
|
|
611
|
-
}
|
|
612
|
-
}]);
|
|
613
|
-
return GeneralConfigBlock;
|
|
614
|
-
}(React.Component);
|
|
615
|
-
|
|
616
|
-
(0, _defineProperty2["default"])(GeneralConfigBlock, "propTypes", {
|
|
617
|
-
classes: _propTypes["default"].object.isRequired,
|
|
618
|
-
model: _propTypes["default"].object.isRequired,
|
|
619
|
-
imageSupport: _propTypes["default"].object,
|
|
620
|
-
uploadSoundSupport: _propTypes["default"].object,
|
|
621
|
-
configuration: _propTypes["default"].object,
|
|
622
|
-
onChange: _propTypes["default"].func.isRequired,
|
|
623
|
-
promptEnabled: _propTypes["default"].bool,
|
|
624
|
-
rationaleEnabled: _propTypes["default"].bool,
|
|
625
|
-
toolbarOpts: _propTypes["default"].object
|
|
626
|
-
});
|
|
627
|
-
|
|
628
|
-
var _default = (0, _styles.withStyles)(styles)(GeneralConfigBlock);
|
|
629
|
-
|
|
630
|
-
exports["default"] = _default;
|
|
631
|
-
//# sourceMappingURL=general-config-block.js.map
|