@pie-element/math-inline 5.9.11 → 5.9.12
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 +8 -0
- package/configure/CHANGELOG.md +8 -0
- package/configure/package.json +5 -5
- package/package.json +6 -6
- package/module/configure.js +0 -1568
- package/module/controller.js +0 -1424
- package/module/demo.js +0 -48
- package/module/element.js +0 -5191
- package/module/index.html +0 -21
- package/module/manifest.json +0 -18
- package/module/print-demo.js +0 -86
- package/module/print.html +0 -18
- package/module/print.js +0 -5045
package/module/configure.js
DELETED
|
@@ -1,1568 +0,0 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_material_ui__core, _dll_material_ui__core_styles, _dll_classnames, _dll_lodash, _dll_material_ui__icons, _dll_debug, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.19/module/index.js";
|
|
2
|
-
import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.3.1/module/index.js";
|
|
3
|
-
import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.5.6/module/index.js";
|
|
4
|
-
import {_dll_pie_lib__math_toolbar, _dll_pie_framework__mathquill} from "../../../@pie-lib/math-edit-module@^1.2.6/module/index.js";
|
|
5
|
-
const React$3 = _dll_react;
|
|
6
|
-
const PropTypes$2 = _dll_prop_types;
|
|
7
|
-
const {Card: Card} = _dll_material_ui__core;
|
|
8
|
-
const {CardContent: CardContent} = _dll_material_ui__core;
|
|
9
|
-
const {Button: Button} = _dll_material_ui__core;
|
|
10
|
-
const {FormControlLabel: FormControlLabel} = _dll_material_ui__core;
|
|
11
|
-
const {Typography: Typography} = _dll_material_ui__core;
|
|
12
|
-
const {InputLabel: InputLabel$1} = _dll_material_ui__core;
|
|
13
|
-
const {Checkbox: Checkbox} = _dll_material_ui__core;
|
|
14
|
-
const {Select: Select$1} = _dll_material_ui__core;
|
|
15
|
-
const {MenuItem: MenuItem$1} = _dll_material_ui__core;
|
|
16
|
-
const {withStyles: withStyles$2} = _dll_material_ui__core_styles;
|
|
17
|
-
const {InputContainer: InputContainer$2} = _dll_pie_lib__config_ui;
|
|
18
|
-
const {MathToolbar: MathToolbar$1} = _dll_pie_lib__math_toolbar;
|
|
19
|
-
const _jsxFileName$2 = "/home/circleci/repo/packages/math-inline/configure/src/response.jsx";
|
|
20
|
-
const styles$2 = theme => ({
|
|
21
|
-
responseContainer: {
|
|
22
|
-
marginTop: theme.spacing.unit * 2,
|
|
23
|
-
width: '100%',
|
|
24
|
-
border: '1px solid darkgray',
|
|
25
|
-
display: 'flex',
|
|
26
|
-
flexDirection: 'column',
|
|
27
|
-
justifyContent: 'space-between'
|
|
28
|
-
},
|
|
29
|
-
cardContent: {
|
|
30
|
-
paddingBottom: `${theme.spacing.unit}px !important`
|
|
31
|
-
},
|
|
32
|
-
title: {
|
|
33
|
-
fontWeight: 700,
|
|
34
|
-
fontSize: '1.2rem',
|
|
35
|
-
flex: 3
|
|
36
|
-
},
|
|
37
|
-
selectContainer: {
|
|
38
|
-
flex: 2
|
|
39
|
-
},
|
|
40
|
-
inputContainer: {
|
|
41
|
-
marginTop: theme.spacing.unit
|
|
42
|
-
},
|
|
43
|
-
titleBar: {
|
|
44
|
-
display: 'flex',
|
|
45
|
-
alignItems: 'center',
|
|
46
|
-
justifyContent: 'space-between'
|
|
47
|
-
},
|
|
48
|
-
responseEditor: {
|
|
49
|
-
display: 'flex',
|
|
50
|
-
alignItems: 'center',
|
|
51
|
-
justifyContent: 'center',
|
|
52
|
-
width: '100%',
|
|
53
|
-
minWidth: '500px',
|
|
54
|
-
maxWidth: '900px',
|
|
55
|
-
height: 'auto',
|
|
56
|
-
minHeight: '40px'
|
|
57
|
-
},
|
|
58
|
-
mathToolbar: {
|
|
59
|
-
width: '100%'
|
|
60
|
-
},
|
|
61
|
-
configPanel: {
|
|
62
|
-
display: 'flex',
|
|
63
|
-
justifyContent: 'space-between',
|
|
64
|
-
alignItems: 'center'
|
|
65
|
-
},
|
|
66
|
-
alternateButton: {
|
|
67
|
-
border: '1px solid lightgrey'
|
|
68
|
-
},
|
|
69
|
-
removeAlternateButton: {
|
|
70
|
-
marginLeft: theme.spacing.unit * 2,
|
|
71
|
-
border: '1px solid lightgrey',
|
|
72
|
-
color: 'gray',
|
|
73
|
-
fontSize: '0.8rem'
|
|
74
|
-
},
|
|
75
|
-
checkboxContainer: {
|
|
76
|
-
marginTop: theme.spacing.unit * 2,
|
|
77
|
-
display: 'flex',
|
|
78
|
-
flexDirection: 'column',
|
|
79
|
-
alignItems: 'center'
|
|
80
|
-
},
|
|
81
|
-
configLabel: {
|
|
82
|
-
marginRight: 'auto'
|
|
83
|
-
},
|
|
84
|
-
errorText: {
|
|
85
|
-
fontSize: '12px',
|
|
86
|
-
color: 'red',
|
|
87
|
-
padding: '5px 0'
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
class Response extends React$3.Component {
|
|
91
|
-
static __initStatic() {
|
|
92
|
-
this.propTypes = {
|
|
93
|
-
classes: PropTypes$2.object.isRequired,
|
|
94
|
-
defaultResponse: PropTypes$2.bool,
|
|
95
|
-
mode: PropTypes$2.oneOfType([PropTypes$2.string, PropTypes$2.number]),
|
|
96
|
-
index: PropTypes$2.number,
|
|
97
|
-
onResponseChange: PropTypes$2.func.isRequired,
|
|
98
|
-
response: PropTypes$2.object.isRequired,
|
|
99
|
-
cIgnoreOrder: PropTypes$2.object.isRequired,
|
|
100
|
-
cAllowTrailingZeros: PropTypes$2.object.isRequired
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
static __initStatic2() {
|
|
104
|
-
this.defaultProps = {
|
|
105
|
-
defaultResponse: false,
|
|
106
|
-
mode: 'miscellaneous'
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
constructor(props) {
|
|
110
|
-
super(props);
|
|
111
|
-
Response.prototype.__init.call(this);
|
|
112
|
-
Response.prototype.__init2.call(this);
|
|
113
|
-
Response.prototype.__init3.call(this);
|
|
114
|
-
Response.prototype.__init4.call(this);
|
|
115
|
-
Response.prototype.__init5.call(this);
|
|
116
|
-
Response.prototype.__init6.call(this);
|
|
117
|
-
Response.prototype.__init7.call(this);
|
|
118
|
-
Response.prototype.__init8.call(this);
|
|
119
|
-
Response.prototype.__init9.call(this);
|
|
120
|
-
Response.prototype.__init10.call(this);
|
|
121
|
-
Response.prototype.__init11.call(this);
|
|
122
|
-
const {response: {alternates} = {}} = props || ({});
|
|
123
|
-
const alternatesLength = Object.keys(alternates || ({})).length;
|
|
124
|
-
this.state = {
|
|
125
|
-
alternateIdCounter: alternatesLength + 1,
|
|
126
|
-
showKeypad: {
|
|
127
|
-
openCount: 0,
|
|
128
|
-
main: false
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
__init() {
|
|
133
|
-
this.onChange = name => evt => {
|
|
134
|
-
const {response, onResponseChange, index} = this.props;
|
|
135
|
-
const newResponse = {
|
|
136
|
-
...response
|
|
137
|
-
};
|
|
138
|
-
newResponse[name] = evt.target.value;
|
|
139
|
-
onResponseChange(newResponse, index);
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
__init2() {
|
|
143
|
-
this.onConfigChanged = name => evt => {
|
|
144
|
-
const {response, onResponseChange, index} = this.props;
|
|
145
|
-
const newResponse = {
|
|
146
|
-
...response
|
|
147
|
-
};
|
|
148
|
-
newResponse[name] = evt.target.checked;
|
|
149
|
-
onResponseChange(newResponse, index);
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
__init3() {
|
|
153
|
-
this.onLiteralOptionsChange = name => evt => {
|
|
154
|
-
const {response, onResponseChange, index} = this.props;
|
|
155
|
-
const newResponse = {
|
|
156
|
-
...response
|
|
157
|
-
};
|
|
158
|
-
newResponse[name] = !response[name];
|
|
159
|
-
onResponseChange(newResponse, index);
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
__init4() {
|
|
163
|
-
this.onAnswerChange = answer => {
|
|
164
|
-
const {response, onResponseChange, index} = this.props;
|
|
165
|
-
const newResponse = {
|
|
166
|
-
...response
|
|
167
|
-
};
|
|
168
|
-
newResponse.answer = answer;
|
|
169
|
-
onResponseChange(newResponse, index);
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
__init5() {
|
|
173
|
-
this.onAlternateAnswerChange = alternateId => answer => {
|
|
174
|
-
const {response, onResponseChange, index} = this.props;
|
|
175
|
-
const newResponse = {
|
|
176
|
-
...response
|
|
177
|
-
};
|
|
178
|
-
newResponse.alternates[alternateId] = answer;
|
|
179
|
-
onResponseChange(newResponse, index);
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
__init6() {
|
|
183
|
-
this.onAddAlternate = () => {
|
|
184
|
-
const {response, onResponseChange, index} = this.props;
|
|
185
|
-
const {alternateIdCounter} = this.state;
|
|
186
|
-
const newResponse = {
|
|
187
|
-
...response
|
|
188
|
-
};
|
|
189
|
-
if (!newResponse.alternates) {
|
|
190
|
-
newResponse.alternates = {};
|
|
191
|
-
}
|
|
192
|
-
newResponse.alternates[alternateIdCounter] = '';
|
|
193
|
-
onResponseChange(newResponse, index);
|
|
194
|
-
this.setState({
|
|
195
|
-
alternateIdCounter: alternateIdCounter + 1
|
|
196
|
-
});
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
__init7() {
|
|
200
|
-
this.onRemoveAlternate = alternateId => () => {
|
|
201
|
-
const {response, onResponseChange, index} = this.props;
|
|
202
|
-
const newResponse = {
|
|
203
|
-
...response
|
|
204
|
-
};
|
|
205
|
-
delete newResponse.alternates[alternateId];
|
|
206
|
-
onResponseChange(newResponse, index);
|
|
207
|
-
this.setState(state => ({
|
|
208
|
-
showKeypad: {
|
|
209
|
-
...state.showKeypad,
|
|
210
|
-
openCount: !state.showKeypad[alternateId] ? state.showKeypad.openCount : state.showKeypad.openCount - 1
|
|
211
|
-
}
|
|
212
|
-
}));
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
__init8() {
|
|
216
|
-
this.onDone = () => {
|
|
217
|
-
this.setState(state => ({
|
|
218
|
-
showKeypad: {
|
|
219
|
-
...state.showKeypad,
|
|
220
|
-
openCount: state.showKeypad.openCount - 1,
|
|
221
|
-
main: false
|
|
222
|
-
}
|
|
223
|
-
}));
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
__init9() {
|
|
227
|
-
this.onFocus = () => {
|
|
228
|
-
this.setState(state => ({
|
|
229
|
-
showKeypad: {
|
|
230
|
-
...state.showKeypad,
|
|
231
|
-
openCount: !state.showKeypad.main ? state.showKeypad.openCount + 1 : state.showKeypad.openCount,
|
|
232
|
-
main: true
|
|
233
|
-
}
|
|
234
|
-
}));
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
__init10() {
|
|
238
|
-
this.onAlternateFocus = alternateId => () => {
|
|
239
|
-
this.setState(state => ({
|
|
240
|
-
showKeypad: {
|
|
241
|
-
...state.showKeypad,
|
|
242
|
-
openCount: !state.showKeypad[alternateId] ? state.showKeypad.openCount + 1 : state.showKeypad.openCount,
|
|
243
|
-
[alternateId]: true
|
|
244
|
-
}
|
|
245
|
-
}));
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
__init11() {
|
|
249
|
-
this.onAlternateDone = alternateId => () => {
|
|
250
|
-
this.setState(state => ({
|
|
251
|
-
showKeypad: {
|
|
252
|
-
...state.showKeypad,
|
|
253
|
-
openCount: state.showKeypad.openCount - 1,
|
|
254
|
-
[alternateId]: false
|
|
255
|
-
}
|
|
256
|
-
}));
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
render() {
|
|
260
|
-
const {classes, mode, defaultResponse, index, response, cAllowTrailingZeros, cIgnoreOrder, error} = this.props;
|
|
261
|
-
const {showKeypad} = this.state;
|
|
262
|
-
const {validation, answer, alternates, ignoreOrder, allowTrailingZeros} = response;
|
|
263
|
-
const hasAlternates = Object.keys(alternates || ({})).length > 0;
|
|
264
|
-
const classNames = {
|
|
265
|
-
editor: classes.responseEditor,
|
|
266
|
-
mathToolbar: classes.mathToolbar
|
|
267
|
-
};
|
|
268
|
-
const styles = {
|
|
269
|
-
minHeight: `${showKeypad.openCount > 0 ? 430 : 230}px`
|
|
270
|
-
};
|
|
271
|
-
return React$3.createElement(Card, {
|
|
272
|
-
className: classes.responseContainer,
|
|
273
|
-
style: styles,
|
|
274
|
-
__self: this,
|
|
275
|
-
__source: {
|
|
276
|
-
fileName: _jsxFileName$2,
|
|
277
|
-
lineNumber: 278
|
|
278
|
-
}
|
|
279
|
-
}, React$3.createElement(CardContent, {
|
|
280
|
-
className: classes.cardContent,
|
|
281
|
-
__self: this,
|
|
282
|
-
__source: {
|
|
283
|
-
fileName: _jsxFileName$2,
|
|
284
|
-
lineNumber: 279
|
|
285
|
-
}
|
|
286
|
-
}, React$3.createElement('div', {
|
|
287
|
-
className: classes.titleBar,
|
|
288
|
-
__self: this,
|
|
289
|
-
__source: {
|
|
290
|
-
fileName: _jsxFileName$2,
|
|
291
|
-
lineNumber: 280
|
|
292
|
-
}
|
|
293
|
-
}, React$3.createElement(Typography, {
|
|
294
|
-
className: classes.title,
|
|
295
|
-
component: "h2",
|
|
296
|
-
__self: this,
|
|
297
|
-
__source: {
|
|
298
|
-
fileName: _jsxFileName$2,
|
|
299
|
-
lineNumber: 281
|
|
300
|
-
}
|
|
301
|
-
}, "Response", ' ', ''), React$3.createElement(InputContainer$2, {
|
|
302
|
-
label: "Validation",
|
|
303
|
-
className: classes.selectContainer,
|
|
304
|
-
__self: this,
|
|
305
|
-
__source: {
|
|
306
|
-
fileName: _jsxFileName$2,
|
|
307
|
-
lineNumber: 289
|
|
308
|
-
}
|
|
309
|
-
}, React$3.createElement(Select$1, {
|
|
310
|
-
className: classes.select,
|
|
311
|
-
onChange: this.onChange('validation'),
|
|
312
|
-
value: validation || 'literal',
|
|
313
|
-
__self: this,
|
|
314
|
-
__source: {
|
|
315
|
-
fileName: _jsxFileName$2,
|
|
316
|
-
lineNumber: 293
|
|
317
|
-
}
|
|
318
|
-
}, React$3.createElement(MenuItem$1, {
|
|
319
|
-
value: "literal",
|
|
320
|
-
__self: this,
|
|
321
|
-
__source: {
|
|
322
|
-
fileName: _jsxFileName$2,
|
|
323
|
-
lineNumber: 298
|
|
324
|
-
}
|
|
325
|
-
}, "Literal Validation"), React$3.createElement(MenuItem$1, {
|
|
326
|
-
value: "symbolic",
|
|
327
|
-
__self: this,
|
|
328
|
-
__source: {
|
|
329
|
-
fileName: _jsxFileName$2,
|
|
330
|
-
lineNumber: 299
|
|
331
|
-
}
|
|
332
|
-
}, "Symbolic Validation")))), validation === 'literal' && React$3.createElement('div', {
|
|
333
|
-
className: classes.flexContainer,
|
|
334
|
-
__self: this,
|
|
335
|
-
__source: {
|
|
336
|
-
fileName: _jsxFileName$2,
|
|
337
|
-
lineNumber: 304
|
|
338
|
-
}
|
|
339
|
-
}, cAllowTrailingZeros.enabled && React$3.createElement(FormControlLabel, {
|
|
340
|
-
label: cAllowTrailingZeros.label,
|
|
341
|
-
control: React$3.createElement(Checkbox, {
|
|
342
|
-
checked: allowTrailingZeros,
|
|
343
|
-
onChange: this.onLiteralOptionsChange('allowTrailingZeros'),
|
|
344
|
-
__self: this,
|
|
345
|
-
__source: {
|
|
346
|
-
fileName: _jsxFileName$2,
|
|
347
|
-
lineNumber: 309
|
|
348
|
-
}
|
|
349
|
-
}),
|
|
350
|
-
__self: this,
|
|
351
|
-
__source: {
|
|
352
|
-
fileName: _jsxFileName$2,
|
|
353
|
-
lineNumber: 306
|
|
354
|
-
}
|
|
355
|
-
}), cIgnoreOrder.enabled && React$3.createElement(FormControlLabel, {
|
|
356
|
-
label: cIgnoreOrder.label,
|
|
357
|
-
control: React$3.createElement(Checkbox, {
|
|
358
|
-
checked: ignoreOrder,
|
|
359
|
-
onChange: this.onLiteralOptionsChange('ignoreOrder'),
|
|
360
|
-
__self: this,
|
|
361
|
-
__source: {
|
|
362
|
-
fileName: _jsxFileName$2,
|
|
363
|
-
lineNumber: 323
|
|
364
|
-
}
|
|
365
|
-
}),
|
|
366
|
-
__self: this,
|
|
367
|
-
__source: {
|
|
368
|
-
fileName: _jsxFileName$2,
|
|
369
|
-
lineNumber: 320
|
|
370
|
-
}
|
|
371
|
-
})), React$3.createElement('div', {
|
|
372
|
-
className: classes.inputContainer,
|
|
373
|
-
__self: this,
|
|
374
|
-
__source: {
|
|
375
|
-
fileName: _jsxFileName$2,
|
|
376
|
-
lineNumber: 332
|
|
377
|
-
}
|
|
378
|
-
}, React$3.createElement(InputLabel$1, {
|
|
379
|
-
__self: this,
|
|
380
|
-
__source: {
|
|
381
|
-
fileName: _jsxFileName$2,
|
|
382
|
-
lineNumber: 333
|
|
383
|
-
}
|
|
384
|
-
}, "Correct Answer"), React$3.createElement(MathToolbar$1, {
|
|
385
|
-
keypadMode: mode,
|
|
386
|
-
classNames: classNames,
|
|
387
|
-
controlledKeypad: true,
|
|
388
|
-
showKeypad: showKeypad.main,
|
|
389
|
-
latex: answer || '',
|
|
390
|
-
onChange: this.onAnswerChange,
|
|
391
|
-
onFocus: this.onFocus,
|
|
392
|
-
onDone: this.onDone,
|
|
393
|
-
error: error && error.answer,
|
|
394
|
-
__self: this,
|
|
395
|
-
__source: {
|
|
396
|
-
fileName: _jsxFileName$2,
|
|
397
|
-
lineNumber: 334
|
|
398
|
-
}
|
|
399
|
-
}), error && error.answer ? React$3.createElement('div', {
|
|
400
|
-
className: classes.errorText,
|
|
401
|
-
__self: this,
|
|
402
|
-
__source: {
|
|
403
|
-
fileName: _jsxFileName$2,
|
|
404
|
-
lineNumber: 345
|
|
405
|
-
}
|
|
406
|
-
}, error.answer) : null), hasAlternates && Object.keys(alternates).map((alternateId, altIdx) => React$3.createElement('div', {
|
|
407
|
-
className: classes.inputContainer,
|
|
408
|
-
key: alternateId,
|
|
409
|
-
__self: this,
|
|
410
|
-
__source: {
|
|
411
|
-
fileName: _jsxFileName$2,
|
|
412
|
-
lineNumber: 349
|
|
413
|
-
}
|
|
414
|
-
}, React$3.createElement('div', {
|
|
415
|
-
className: classes.alternateBar,
|
|
416
|
-
__self: this,
|
|
417
|
-
__source: {
|
|
418
|
-
fileName: _jsxFileName$2,
|
|
419
|
-
lineNumber: 350
|
|
420
|
-
}
|
|
421
|
-
}, React$3.createElement(InputLabel$1, {
|
|
422
|
-
__self: this,
|
|
423
|
-
__source: {
|
|
424
|
-
fileName: _jsxFileName$2,
|
|
425
|
-
lineNumber: 351
|
|
426
|
-
}
|
|
427
|
-
}, "Alternate", Object.keys(alternates).length > 1 ? ` ${altIdx + 1}` : ''), React$3.createElement(Button, {
|
|
428
|
-
className: classes.removeAlternateButton,
|
|
429
|
-
type: "secondary",
|
|
430
|
-
onClick: this.onRemoveAlternate(alternateId),
|
|
431
|
-
__self: this,
|
|
432
|
-
__source: {
|
|
433
|
-
fileName: _jsxFileName$2,
|
|
434
|
-
lineNumber: 355
|
|
435
|
-
}
|
|
436
|
-
}, "Remove")), React$3.createElement(MathToolbar$1, {
|
|
437
|
-
classNames: classNames,
|
|
438
|
-
controlledKeypad: true,
|
|
439
|
-
keypadMode: mode,
|
|
440
|
-
showKeypad: showKeypad[alternateId] || false,
|
|
441
|
-
latex: alternates[alternateId] || '',
|
|
442
|
-
onChange: this.onAlternateAnswerChange(alternateId),
|
|
443
|
-
onFocus: this.onAlternateFocus(alternateId),
|
|
444
|
-
onDone: this.onAlternateDone(alternateId),
|
|
445
|
-
error: error && error[altIdx + 1],
|
|
446
|
-
__self: this,
|
|
447
|
-
__source: {
|
|
448
|
-
fileName: _jsxFileName$2,
|
|
449
|
-
lineNumber: 363
|
|
450
|
-
}
|
|
451
|
-
}), error && error[altIdx + 1] ? React$3.createElement('div', {
|
|
452
|
-
className: classes.errorText,
|
|
453
|
-
__self: this,
|
|
454
|
-
__source: {
|
|
455
|
-
fileName: _jsxFileName$2,
|
|
456
|
-
lineNumber: 374
|
|
457
|
-
}
|
|
458
|
-
}, error[altIdx + 1]) : null)), React$3.createElement('div', {
|
|
459
|
-
className: classes.configPanel,
|
|
460
|
-
__self: this,
|
|
461
|
-
__source: {
|
|
462
|
-
fileName: _jsxFileName$2,
|
|
463
|
-
lineNumber: 377
|
|
464
|
-
}
|
|
465
|
-
}, React$3.createElement(Button, {
|
|
466
|
-
className: classes.alternateButton,
|
|
467
|
-
type: "primary",
|
|
468
|
-
onClick: this.onAddAlternate,
|
|
469
|
-
__self: this,
|
|
470
|
-
__source: {
|
|
471
|
-
fileName: _jsxFileName$2,
|
|
472
|
-
lineNumber: 378
|
|
473
|
-
}
|
|
474
|
-
}, "ADD ALTERNATE"), React$3.createElement('div', {
|
|
475
|
-
className: classes.checkboxContainer,
|
|
476
|
-
__self: this,
|
|
477
|
-
__source: {
|
|
478
|
-
fileName: _jsxFileName$2,
|
|
479
|
-
lineNumber: 385
|
|
480
|
-
}
|
|
481
|
-
}))));
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
Response.__initStatic();
|
|
485
|
-
Response.__initStatic2();
|
|
486
|
-
var Response$1 = withStyles$2(styles$2)(Response);
|
|
487
|
-
const ResponseTypes = {
|
|
488
|
-
advanced: 'Advanced Multi',
|
|
489
|
-
simple: 'Simple'
|
|
490
|
-
};
|
|
491
|
-
const generateValidationMessage = (model = {}, config = {}) => {
|
|
492
|
-
const {maxResponseAreas} = config;
|
|
493
|
-
const {responseType} = model;
|
|
494
|
-
let responseAreasMessage = '';
|
|
495
|
-
const answersMessage = '\nAll correct answers (the primary and any alternates) should not be empty and should be unique.';
|
|
496
|
-
if (responseType === 'Advanced Multi') {
|
|
497
|
-
responseAreasMessage = '\nThere should be at least 1 ' + (maxResponseAreas ? `and at most ${maxResponseAreas} ` : '') + 'response area' + (maxResponseAreas ? 's' : '') + ' defined.';
|
|
498
|
-
}
|
|
499
|
-
return 'Validation requirements:' + answersMessage + responseAreasMessage;
|
|
500
|
-
};
|
|
501
|
-
const React$2 = _dll_react;
|
|
502
|
-
const PropTypes$1 = _dll_prop_types;
|
|
503
|
-
const cx = _dll_classnames;
|
|
504
|
-
const {withStyles: withStyles$1} = _dll_material_ui__core_styles;
|
|
505
|
-
const {InputLabel: InputLabel} = _dll_material_ui__core;
|
|
506
|
-
const {Select: Select} = _dll_material_ui__core;
|
|
507
|
-
const {MenuItem: MenuItem} = _dll_material_ui__core;
|
|
508
|
-
const {Tooltip: Tooltip} = _dll_material_ui__core;
|
|
509
|
-
const {isEqual: isEqual} = _dll_lodash;
|
|
510
|
-
const {Info: Info} = _dll_material_ui__icons;
|
|
511
|
-
const EditableHtml$1 = _dll_pie_lib__editable_html;
|
|
512
|
-
const {InputContainer: InputContainer$1} = _dll_pie_lib__config_ui;
|
|
513
|
-
const {MathToolbar: MathToolbar} = _dll_pie_lib__math_toolbar;
|
|
514
|
-
const MathQuill = _dll_pie_framework__mathquill;
|
|
515
|
-
const _jsxFileName$1 = "/home/circleci/repo/packages/math-inline/configure/src/general-config-block.jsx";
|
|
516
|
-
let registered = false;
|
|
517
|
-
const styles$1 = theme => ({
|
|
518
|
-
container: {
|
|
519
|
-
marginTop: theme.spacing.unit * 2,
|
|
520
|
-
marginBottom: theme.spacing.unit * 2,
|
|
521
|
-
display: 'flex',
|
|
522
|
-
flexDirection: 'column'
|
|
523
|
-
},
|
|
524
|
-
templateTitle: {
|
|
525
|
-
fontSize: '0.85rem'
|
|
526
|
-
},
|
|
527
|
-
addResponseButton: {
|
|
528
|
-
border: '1px solid lightgrey',
|
|
529
|
-
float: 'right',
|
|
530
|
-
width: '150px'
|
|
531
|
-
},
|
|
532
|
-
flexContainer: {
|
|
533
|
-
display: 'flex',
|
|
534
|
-
alignItems: 'center',
|
|
535
|
-
justifyContent: 'space-between'
|
|
536
|
-
},
|
|
537
|
-
selectContainer: {
|
|
538
|
-
flex: 'initial',
|
|
539
|
-
width: '40%',
|
|
540
|
-
marginTop: theme.spacing.unit * 2,
|
|
541
|
-
marginBottom: theme.spacing.unit * 2
|
|
542
|
-
},
|
|
543
|
-
inputContainer: {
|
|
544
|
-
marginBottom: theme.spacing.unit * 4,
|
|
545
|
-
display: 'flex',
|
|
546
|
-
flexDirection: 'column',
|
|
547
|
-
width: '90%'
|
|
548
|
-
},
|
|
549
|
-
responseEditor: {
|
|
550
|
-
display: 'flex',
|
|
551
|
-
justifyContent: 'center',
|
|
552
|
-
width: '100%',
|
|
553
|
-
minWidth: '500px',
|
|
554
|
-
maxWidth: 'inherit',
|
|
555
|
-
height: 'auto',
|
|
556
|
-
minHeight: '130px',
|
|
557
|
-
textAlign: 'left',
|
|
558
|
-
padding: theme.spacing.unit
|
|
559
|
-
},
|
|
560
|
-
promptHolder: {
|
|
561
|
-
width: '100%',
|
|
562
|
-
paddingBottom: theme.spacing.unit * 2,
|
|
563
|
-
marginBottom: theme.spacing.unit * 2
|
|
564
|
-
},
|
|
565
|
-
prompt: {
|
|
566
|
-
paddingTop: theme.spacing.unit * 2,
|
|
567
|
-
width: '100%',
|
|
568
|
-
maxWidth: '600px'
|
|
569
|
-
},
|
|
570
|
-
blockContainer: {
|
|
571
|
-
margin: theme.spacing.unit,
|
|
572
|
-
display: 'inline-flex',
|
|
573
|
-
border: '2px solid grey'
|
|
574
|
-
},
|
|
575
|
-
blockContainerGeneric: {
|
|
576
|
-
margin: theme.spacing.unit / 2
|
|
577
|
-
},
|
|
578
|
-
blockResponse: {
|
|
579
|
-
flex: 2,
|
|
580
|
-
color: 'grey',
|
|
581
|
-
background: 'lightgrey',
|
|
582
|
-
fontSize: '0.8rem',
|
|
583
|
-
padding: theme.spacing.unit / 2,
|
|
584
|
-
display: 'flex',
|
|
585
|
-
alignItems: 'center',
|
|
586
|
-
justifyContent: 'center',
|
|
587
|
-
borderRight: '2px solid grey'
|
|
588
|
-
},
|
|
589
|
-
blockResponseGeneric: {
|
|
590
|
-
borderRight: 0
|
|
591
|
-
},
|
|
592
|
-
blockMath: {
|
|
593
|
-
color: '#bdbdbd',
|
|
594
|
-
padding: theme.spacing.unit / 2,
|
|
595
|
-
display: 'flex',
|
|
596
|
-
alignItems: 'center',
|
|
597
|
-
justifyContent: 'center',
|
|
598
|
-
flex: 8,
|
|
599
|
-
'& > .mq-math-mode': {
|
|
600
|
-
'& > .mq-hasCursor': {
|
|
601
|
-
'& > .mq-cursor': {
|
|
602
|
-
display: 'none'
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
},
|
|
607
|
-
tooltip: {
|
|
608
|
-
fontSize: '12px',
|
|
609
|
-
whiteSpace: 'pre',
|
|
610
|
-
maxWidth: '500px'
|
|
611
|
-
},
|
|
612
|
-
errorText: {
|
|
613
|
-
fontSize: '12px',
|
|
614
|
-
color: 'red',
|
|
615
|
-
padding: '5px 0'
|
|
616
|
-
}
|
|
617
|
-
});
|
|
618
|
-
const REGEX = /{{response}}/gm;
|
|
619
|
-
const TEMPORARY_RESPONSE_FIELD = /\\%response\\%/gm;
|
|
620
|
-
const ANSWER_BLOCK_REGEX = /\\embed\{answerBlock\}\[r\d*\]/g;
|
|
621
|
-
const NEWLINE_BLOCK = /\\embed\{newLine\}\[\]/g;
|
|
622
|
-
const NEWLINE_LATEX = /\\newline/g;
|
|
623
|
-
function prepareForStatic(expression) {
|
|
624
|
-
if (expression) {
|
|
625
|
-
let answerBlocks = 1;
|
|
626
|
-
return expression.replace(REGEX, () => `\\embed{answerBlock}[r${answerBlocks++}]`).replace(NEWLINE_LATEX, '\\embed{newLine}[]');
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
function prepareForModel(expression) {
|
|
630
|
-
if (expression) {
|
|
631
|
-
return expression.replace(ANSWER_BLOCK_REGEX, () => '{{response}}').replace(TEMPORARY_RESPONSE_FIELD, () => '{{response}}').replace(NEWLINE_BLOCK, () => '\\newline');
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
class GeneralConfigBlock extends React$2.Component {
|
|
635
|
-
static __initStatic() {
|
|
636
|
-
this.propTypes = {
|
|
637
|
-
classes: PropTypes$1.object.isRequired,
|
|
638
|
-
model: PropTypes$1.object.isRequired,
|
|
639
|
-
imageSupport: PropTypes$1.object,
|
|
640
|
-
configuration: PropTypes$1.object,
|
|
641
|
-
onChange: PropTypes$1.func.isRequired,
|
|
642
|
-
promptEnabled: PropTypes$1.bool,
|
|
643
|
-
rationaleEnabled: PropTypes$1.bool,
|
|
644
|
-
toolbarOpts: PropTypes$1.object
|
|
645
|
-
};
|
|
646
|
-
}
|
|
647
|
-
constructor(props) {
|
|
648
|
-
super(props);
|
|
649
|
-
GeneralConfigBlock.prototype.__init.call(this);
|
|
650
|
-
GeneralConfigBlock.prototype.__init2.call(this);
|
|
651
|
-
GeneralConfigBlock.prototype.__init3.call(this);
|
|
652
|
-
GeneralConfigBlock.prototype.__init4.call(this);
|
|
653
|
-
GeneralConfigBlock.prototype.__init5.call(this);
|
|
654
|
-
GeneralConfigBlock.prototype.__init6.call(this);
|
|
655
|
-
GeneralConfigBlock.prototype.__init7.call(this);
|
|
656
|
-
const responseAreas = {};
|
|
657
|
-
if (props.model && props.model.expression) {
|
|
658
|
-
let answerBlocks = 1;
|
|
659
|
-
props.model.expression.replace(REGEX, () => {
|
|
660
|
-
responseAreas[`r${answerBlocks++}`] = {
|
|
661
|
-
value: ''
|
|
662
|
-
};
|
|
663
|
-
});
|
|
664
|
-
}
|
|
665
|
-
this.state = {
|
|
666
|
-
showKeypad: false,
|
|
667
|
-
responseAreas,
|
|
668
|
-
responseIdCounter: Object.keys(responseAreas).length
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
__init() {
|
|
672
|
-
this.onChange = name => evtOrValue => {
|
|
673
|
-
const {model, onChange} = this.props;
|
|
674
|
-
const newModel = {
|
|
675
|
-
...model
|
|
676
|
-
};
|
|
677
|
-
if (typeof evtOrValue === 'object') {
|
|
678
|
-
newModel[name] = evtOrValue.target.value;
|
|
679
|
-
} else {
|
|
680
|
-
newModel[name] = evtOrValue;
|
|
681
|
-
}
|
|
682
|
-
if (name === 'expression') {
|
|
683
|
-
newModel[name] = prepareForModel(evtOrValue);
|
|
684
|
-
}
|
|
685
|
-
onChange(newModel);
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
__init2() {
|
|
689
|
-
this.onDone = () => {
|
|
690
|
-
this.setState({
|
|
691
|
-
showKeypad: false
|
|
692
|
-
});
|
|
693
|
-
};
|
|
694
|
-
}
|
|
695
|
-
__init3() {
|
|
696
|
-
this.onFocus = () => {
|
|
697
|
-
this.setState({
|
|
698
|
-
showKeypad: true
|
|
699
|
-
});
|
|
700
|
-
};
|
|
701
|
-
}
|
|
702
|
-
__init4() {
|
|
703
|
-
this.onPromptFocus = () => {
|
|
704
|
-
this.setState({
|
|
705
|
-
showKeypad: false
|
|
706
|
-
});
|
|
707
|
-
};
|
|
708
|
-
}
|
|
709
|
-
UNSAFE_componentWillMount() {
|
|
710
|
-
const {classes} = this.props;
|
|
711
|
-
if (typeof window !== 'undefined') {
|
|
712
|
-
let MQ = MathQuill.getInterface(2);
|
|
713
|
-
if (!registered) {
|
|
714
|
-
MQ.registerEmbed('answerBlock', data => {
|
|
715
|
-
const genericAnswerBlock = `<div class="${cx(classes.blockContainer, classes.blockContainerGeneric)}">
|
|
716
|
-
<div class="${cx(classes.blockResponse, classes.blockResponseGeneric)}" id="${data}Index">Response</div>
|
|
717
|
-
</div>`;
|
|
718
|
-
return {
|
|
719
|
-
htmlString: genericAnswerBlock,
|
|
720
|
-
text: () => 'text',
|
|
721
|
-
latex: () => `\\embed{answerBlock}[${data}]`
|
|
722
|
-
};
|
|
723
|
-
});
|
|
724
|
-
registered = true;
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
componentDidMount() {
|
|
729
|
-
this.handleAnswerBlockDomUpdate();
|
|
730
|
-
}
|
|
731
|
-
componentDidUpdate() {
|
|
732
|
-
this.handleAnswerBlockDomUpdate();
|
|
733
|
-
}
|
|
734
|
-
__init5() {
|
|
735
|
-
this.handleAnswerBlockDomUpdate = () => {
|
|
736
|
-
const {model} = this.props;
|
|
737
|
-
const responseAreas = {};
|
|
738
|
-
if (model && model.expression) {
|
|
739
|
-
let answerBlocks = 1;
|
|
740
|
-
model.expression.replace(REGEX, () => {
|
|
741
|
-
responseAreas[`r${answerBlocks++}`] = {
|
|
742
|
-
value: ''
|
|
743
|
-
};
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
if (!isEqual(responseAreas, this.state.responseAreas)) {
|
|
747
|
-
this.setState({
|
|
748
|
-
responseAreas
|
|
749
|
-
}, () => {
|
|
750
|
-
if (this.root && Object.keys(responseAreas).length) {
|
|
751
|
-
Object.keys(responseAreas).forEach((responseId, idx) => {
|
|
752
|
-
const el = this.root.querySelector(`#${responseId}`);
|
|
753
|
-
const indexEl = this.root.querySelector(`#${responseId}Index`);
|
|
754
|
-
if (el) {
|
|
755
|
-
let MQ = MathQuill.getInterface(2);
|
|
756
|
-
MQ.StaticMath(el);
|
|
757
|
-
indexEl.textContent = `R${idx + 1}`;
|
|
758
|
-
}
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
};
|
|
764
|
-
}
|
|
765
|
-
__init6() {
|
|
766
|
-
this.onAddResponse = () => {
|
|
767
|
-
const {model, onChange} = this.props;
|
|
768
|
-
const {responseIdCounter} = this.state;
|
|
769
|
-
const newModel = {
|
|
770
|
-
...model
|
|
771
|
-
};
|
|
772
|
-
let newCounter = responseIdCounter;
|
|
773
|
-
while (model.responses.find(response => response.id === newCounter)) {
|
|
774
|
-
newCounter++;
|
|
775
|
-
}
|
|
776
|
-
const response = {
|
|
777
|
-
id: newCounter,
|
|
778
|
-
validation: 'literal',
|
|
779
|
-
answer: '',
|
|
780
|
-
alternates: {}
|
|
781
|
-
};
|
|
782
|
-
newModel.responses = newModel.responses.concat(response);
|
|
783
|
-
onChange(newModel);
|
|
784
|
-
this.setState({
|
|
785
|
-
responseIdCounter: response.id
|
|
786
|
-
});
|
|
787
|
-
};
|
|
788
|
-
}
|
|
789
|
-
__init7() {
|
|
790
|
-
this.onResponseChange = (response, index) => {
|
|
791
|
-
const {model, onChange} = this.props;
|
|
792
|
-
const newModel = {
|
|
793
|
-
...model
|
|
794
|
-
};
|
|
795
|
-
newModel.responses[index] = response;
|
|
796
|
-
onChange(newModel);
|
|
797
|
-
};
|
|
798
|
-
}
|
|
799
|
-
render() {
|
|
800
|
-
const {classes, model, imageSupport, configuration, promptEnabled, rationaleEnabled, toolbarOpts} = this.props;
|
|
801
|
-
const {showKeypad} = this.state;
|
|
802
|
-
const {prompt, expression, equationEditor, promptEquationEditor = '8', responses, responseType, rationale, spellCheckEnabled, errors = {}} = model;
|
|
803
|
-
const {rationale: cRationale = {}, prompt: cPrompt = {}, ignoreOrder: cIgnoreOrder = {}, allowTrailingZeros: cAllowTrailingZeros = {}, maxResponseAreas} = configuration || ({});
|
|
804
|
-
const validationMessage = generateValidationMessage(configuration, model);
|
|
805
|
-
const {responsesErrors, responseAreasError} = errors;
|
|
806
|
-
const classNames = {
|
|
807
|
-
editor: classes.responseEditor,
|
|
808
|
-
mathToolbar: classes.mathToolbar
|
|
809
|
-
};
|
|
810
|
-
const responsesToUse = responseType === ResponseTypes.advanced ? responses : responses.slice(0, 1);
|
|
811
|
-
return React$2.createElement('div', {
|
|
812
|
-
ref: r => this.root = r || this.root,
|
|
813
|
-
className: classes.container,
|
|
814
|
-
__self: this,
|
|
815
|
-
__source: {
|
|
816
|
-
fileName: _jsxFileName$1,
|
|
817
|
-
lineNumber: 372
|
|
818
|
-
}
|
|
819
|
-
}, promptEnabled && React$2.createElement(InputContainer$1, {
|
|
820
|
-
label: cPrompt.label,
|
|
821
|
-
className: classes.promptHolder,
|
|
822
|
-
__self: this,
|
|
823
|
-
__source: {
|
|
824
|
-
fileName: _jsxFileName$1,
|
|
825
|
-
lineNumber: 377
|
|
826
|
-
}
|
|
827
|
-
}, React$2.createElement(EditableHtml$1, {
|
|
828
|
-
onFocus: this.onPromptFocus,
|
|
829
|
-
className: classes.prompt,
|
|
830
|
-
markup: prompt || '',
|
|
831
|
-
onChange: this.onChange('prompt'),
|
|
832
|
-
imageSupport: imageSupport,
|
|
833
|
-
nonEmpty: false,
|
|
834
|
-
toolbarOpts: toolbarOpts,
|
|
835
|
-
spellCheck: spellCheckEnabled,
|
|
836
|
-
__self: this,
|
|
837
|
-
__source: {
|
|
838
|
-
fileName: _jsxFileName$1,
|
|
839
|
-
lineNumber: 378
|
|
840
|
-
}
|
|
841
|
-
})), rationaleEnabled && React$2.createElement(InputContainer$1, {
|
|
842
|
-
label: cRationale.label,
|
|
843
|
-
className: classes.promptHolder,
|
|
844
|
-
__self: this,
|
|
845
|
-
__source: {
|
|
846
|
-
fileName: _jsxFileName$1,
|
|
847
|
-
lineNumber: 391
|
|
848
|
-
}
|
|
849
|
-
}, React$2.createElement(EditableHtml$1, {
|
|
850
|
-
className: classes.prompt,
|
|
851
|
-
markup: rationale || '',
|
|
852
|
-
pluginProps: {
|
|
853
|
-
math: {
|
|
854
|
-
controlledKeypadMode: false
|
|
855
|
-
}
|
|
856
|
-
},
|
|
857
|
-
onChange: this.onChange('rationale'),
|
|
858
|
-
imageSupport: imageSupport,
|
|
859
|
-
nonEmpty: false,
|
|
860
|
-
toolbarOpts: toolbarOpts,
|
|
861
|
-
spellCheck: spellCheckEnabled,
|
|
862
|
-
__self: this,
|
|
863
|
-
__source: {
|
|
864
|
-
fileName: _jsxFileName$1,
|
|
865
|
-
lineNumber: 395
|
|
866
|
-
}
|
|
867
|
-
})), React$2.createElement('div', {
|
|
868
|
-
className: classes.flexContainer,
|
|
869
|
-
style: {
|
|
870
|
-
justifyContent: 'flex-start'
|
|
871
|
-
},
|
|
872
|
-
__self: this,
|
|
873
|
-
__source: {
|
|
874
|
-
fileName: _jsxFileName$1,
|
|
875
|
-
lineNumber: 411
|
|
876
|
-
}
|
|
877
|
-
}, React$2.createElement('h3', {
|
|
878
|
-
__self: this,
|
|
879
|
-
__source: {
|
|
880
|
-
fileName: _jsxFileName$1,
|
|
881
|
-
lineNumber: 412
|
|
882
|
-
}
|
|
883
|
-
}, "Define Response"), React$2.createElement(Tooltip, {
|
|
884
|
-
classes: {
|
|
885
|
-
tooltip: classes.tooltip
|
|
886
|
-
},
|
|
887
|
-
disableFocusListener: true,
|
|
888
|
-
disableTouchListener: true,
|
|
889
|
-
placement: 'right',
|
|
890
|
-
title: validationMessage,
|
|
891
|
-
__self: this,
|
|
892
|
-
__source: {
|
|
893
|
-
fileName: _jsxFileName$1,
|
|
894
|
-
lineNumber: 413
|
|
895
|
-
}
|
|
896
|
-
}, React$2.createElement(Info, {
|
|
897
|
-
fontSize: 'small',
|
|
898
|
-
color: 'primary',
|
|
899
|
-
style: {
|
|
900
|
-
marginLeft: '5px'
|
|
901
|
-
},
|
|
902
|
-
__self: this,
|
|
903
|
-
__source: {
|
|
904
|
-
fileName: _jsxFileName$1,
|
|
905
|
-
lineNumber: 420
|
|
906
|
-
}
|
|
907
|
-
}))), responseAreasError && React$2.createElement('div', {
|
|
908
|
-
className: classes.errorText,
|
|
909
|
-
__self: this,
|
|
910
|
-
__source: {
|
|
911
|
-
fileName: _jsxFileName$1,
|
|
912
|
-
lineNumber: 423
|
|
913
|
-
}
|
|
914
|
-
}, responseAreasError), responseType === ResponseTypes.advanced && [React$2.createElement(InputContainer$1, {
|
|
915
|
-
key: "templateEditorType",
|
|
916
|
-
label: "Response Template Equation Editor",
|
|
917
|
-
className: classes.selectContainer,
|
|
918
|
-
__self: this,
|
|
919
|
-
__source: {
|
|
920
|
-
fileName: _jsxFileName$1,
|
|
921
|
-
lineNumber: 426
|
|
922
|
-
}
|
|
923
|
-
}, React$2.createElement(Select, {
|
|
924
|
-
className: classes.select,
|
|
925
|
-
onChange: this.onChange('promptEquationEditor'),
|
|
926
|
-
value: promptEquationEditor,
|
|
927
|
-
__self: this,
|
|
928
|
-
__source: {
|
|
929
|
-
fileName: _jsxFileName$1,
|
|
930
|
-
lineNumber: 431
|
|
931
|
-
}
|
|
932
|
-
}, React$2.createElement(MenuItem, {
|
|
933
|
-
value: "non-negative-integers",
|
|
934
|
-
__self: this,
|
|
935
|
-
__source: {
|
|
936
|
-
fileName: _jsxFileName$1,
|
|
937
|
-
lineNumber: 436
|
|
938
|
-
}
|
|
939
|
-
}, "Numeric - Non-Negative Integers"), React$2.createElement(MenuItem, {
|
|
940
|
-
value: "integers",
|
|
941
|
-
__self: this,
|
|
942
|
-
__source: {
|
|
943
|
-
fileName: _jsxFileName$1,
|
|
944
|
-
lineNumber: 437
|
|
945
|
-
}
|
|
946
|
-
}, "Numeric - Integers"), React$2.createElement(MenuItem, {
|
|
947
|
-
value: "decimals",
|
|
948
|
-
__self: this,
|
|
949
|
-
__source: {
|
|
950
|
-
fileName: _jsxFileName$1,
|
|
951
|
-
lineNumber: 438
|
|
952
|
-
}
|
|
953
|
-
}, "Numeric - Decimals"), React$2.createElement(MenuItem, {
|
|
954
|
-
value: "fractions",
|
|
955
|
-
__self: this,
|
|
956
|
-
__source: {
|
|
957
|
-
fileName: _jsxFileName$1,
|
|
958
|
-
lineNumber: 439
|
|
959
|
-
}
|
|
960
|
-
}, "Numeric - Fractions"), React$2.createElement(MenuItem, {
|
|
961
|
-
value: 1,
|
|
962
|
-
__self: this,
|
|
963
|
-
__source: {
|
|
964
|
-
fileName: _jsxFileName$1,
|
|
965
|
-
lineNumber: 440
|
|
966
|
-
}
|
|
967
|
-
}, "Grade 1 - 2"), React$2.createElement(MenuItem, {
|
|
968
|
-
value: 3,
|
|
969
|
-
__self: this,
|
|
970
|
-
__source: {
|
|
971
|
-
fileName: _jsxFileName$1,
|
|
972
|
-
lineNumber: 441
|
|
973
|
-
}
|
|
974
|
-
}, "Grade 3 - 5"), React$2.createElement(MenuItem, {
|
|
975
|
-
value: 6,
|
|
976
|
-
__self: this,
|
|
977
|
-
__source: {
|
|
978
|
-
fileName: _jsxFileName$1,
|
|
979
|
-
lineNumber: 442
|
|
980
|
-
}
|
|
981
|
-
}, "Grade 6 - 7"), React$2.createElement(MenuItem, {
|
|
982
|
-
value: 8,
|
|
983
|
-
__self: this,
|
|
984
|
-
__source: {
|
|
985
|
-
fileName: _jsxFileName$1,
|
|
986
|
-
lineNumber: 443
|
|
987
|
-
}
|
|
988
|
-
}, "Grade 8 - HS"), React$2.createElement(MenuItem, {
|
|
989
|
-
value: 'geometry',
|
|
990
|
-
__self: this,
|
|
991
|
-
__source: {
|
|
992
|
-
fileName: _jsxFileName$1,
|
|
993
|
-
lineNumber: 444
|
|
994
|
-
}
|
|
995
|
-
}, "Geometry"), React$2.createElement(MenuItem, {
|
|
996
|
-
value: 'advanced-algebra',
|
|
997
|
-
__self: this,
|
|
998
|
-
__source: {
|
|
999
|
-
fileName: _jsxFileName$1,
|
|
1000
|
-
lineNumber: 445
|
|
1001
|
-
}
|
|
1002
|
-
}, "Advanced Algebra"), React$2.createElement(MenuItem, {
|
|
1003
|
-
value: 'statistics',
|
|
1004
|
-
__self: this,
|
|
1005
|
-
__source: {
|
|
1006
|
-
fileName: _jsxFileName$1,
|
|
1007
|
-
lineNumber: 446
|
|
1008
|
-
}
|
|
1009
|
-
}, "Statistics"), React$2.createElement(MenuItem, {
|
|
1010
|
-
value: 'item-authoring',
|
|
1011
|
-
__self: this,
|
|
1012
|
-
__source: {
|
|
1013
|
-
fileName: _jsxFileName$1,
|
|
1014
|
-
lineNumber: 447
|
|
1015
|
-
}
|
|
1016
|
-
}, "Item Authoring"))), React$2.createElement('div', {
|
|
1017
|
-
className: classes.inputContainer,
|
|
1018
|
-
key: "templateHolder",
|
|
1019
|
-
__self: this,
|
|
1020
|
-
__source: {
|
|
1021
|
-
fileName: _jsxFileName$1,
|
|
1022
|
-
lineNumber: 450
|
|
1023
|
-
}
|
|
1024
|
-
}, React$2.createElement(InputLabel, {
|
|
1025
|
-
className: classes.templateTitle,
|
|
1026
|
-
__self: this,
|
|
1027
|
-
__source: {
|
|
1028
|
-
fileName: _jsxFileName$1,
|
|
1029
|
-
lineNumber: 451
|
|
1030
|
-
}
|
|
1031
|
-
}, "RESPONSE TEMPLATE"), React$2.createElement(MathToolbar, {
|
|
1032
|
-
classNames: classNames,
|
|
1033
|
-
allowAnswerBlock: true,
|
|
1034
|
-
keypadMode: promptEquationEditor,
|
|
1035
|
-
controlledKeypad: true,
|
|
1036
|
-
showKeypad: showKeypad,
|
|
1037
|
-
latex: prepareForStatic(expression) || '',
|
|
1038
|
-
onChange: this.onChange('expression'),
|
|
1039
|
-
onFocus: this.onFocus,
|
|
1040
|
-
onDone: this.onDone,
|
|
1041
|
-
maxResponseAreas: maxResponseAreas,
|
|
1042
|
-
error: responseAreasError,
|
|
1043
|
-
__self: this,
|
|
1044
|
-
__source: {
|
|
1045
|
-
fileName: _jsxFileName$1,
|
|
1046
|
-
lineNumber: 454
|
|
1047
|
-
}
|
|
1048
|
-
}))], React$2.createElement('h4', {
|
|
1049
|
-
__self: this,
|
|
1050
|
-
__source: {
|
|
1051
|
-
fileName: _jsxFileName$1,
|
|
1052
|
-
lineNumber: 469
|
|
1053
|
-
}
|
|
1054
|
-
}, "Define Correct Response"), React$2.createElement('div', {
|
|
1055
|
-
className: classes.flexContainer,
|
|
1056
|
-
__self: this,
|
|
1057
|
-
__source: {
|
|
1058
|
-
fileName: _jsxFileName$1,
|
|
1059
|
-
lineNumber: 470
|
|
1060
|
-
}
|
|
1061
|
-
}, React$2.createElement(InputContainer$1, {
|
|
1062
|
-
label: "Equation Editor",
|
|
1063
|
-
className: classes.selectContainer,
|
|
1064
|
-
__self: this,
|
|
1065
|
-
__source: {
|
|
1066
|
-
fileName: _jsxFileName$1,
|
|
1067
|
-
lineNumber: 471
|
|
1068
|
-
}
|
|
1069
|
-
}, React$2.createElement(Select, {
|
|
1070
|
-
className: classes.select,
|
|
1071
|
-
onChange: this.onChange('equationEditor'),
|
|
1072
|
-
value: equationEditor,
|
|
1073
|
-
__self: this,
|
|
1074
|
-
__source: {
|
|
1075
|
-
fileName: _jsxFileName$1,
|
|
1076
|
-
lineNumber: 475
|
|
1077
|
-
}
|
|
1078
|
-
}, React$2.createElement(MenuItem, {
|
|
1079
|
-
value: "non-negative-integers",
|
|
1080
|
-
__self: this,
|
|
1081
|
-
__source: {
|
|
1082
|
-
fileName: _jsxFileName$1,
|
|
1083
|
-
lineNumber: 480
|
|
1084
|
-
}
|
|
1085
|
-
}, "Numeric - Non-Negative Integers"), React$2.createElement(MenuItem, {
|
|
1086
|
-
value: "integers",
|
|
1087
|
-
__self: this,
|
|
1088
|
-
__source: {
|
|
1089
|
-
fileName: _jsxFileName$1,
|
|
1090
|
-
lineNumber: 481
|
|
1091
|
-
}
|
|
1092
|
-
}, "Numeric - Integers"), React$2.createElement(MenuItem, {
|
|
1093
|
-
value: "decimals",
|
|
1094
|
-
__self: this,
|
|
1095
|
-
__source: {
|
|
1096
|
-
fileName: _jsxFileName$1,
|
|
1097
|
-
lineNumber: 482
|
|
1098
|
-
}
|
|
1099
|
-
}, "Numeric - Decimals"), React$2.createElement(MenuItem, {
|
|
1100
|
-
value: "fractions",
|
|
1101
|
-
__self: this,
|
|
1102
|
-
__source: {
|
|
1103
|
-
fileName: _jsxFileName$1,
|
|
1104
|
-
lineNumber: 483
|
|
1105
|
-
}
|
|
1106
|
-
}, "Numeric - Fractions"), React$2.createElement(MenuItem, {
|
|
1107
|
-
value: 1,
|
|
1108
|
-
__self: this,
|
|
1109
|
-
__source: {
|
|
1110
|
-
fileName: _jsxFileName$1,
|
|
1111
|
-
lineNumber: 484
|
|
1112
|
-
}
|
|
1113
|
-
}, "Grade 1 - 2"), React$2.createElement(MenuItem, {
|
|
1114
|
-
value: 3,
|
|
1115
|
-
__self: this,
|
|
1116
|
-
__source: {
|
|
1117
|
-
fileName: _jsxFileName$1,
|
|
1118
|
-
lineNumber: 485
|
|
1119
|
-
}
|
|
1120
|
-
}, "Grade 3 - 5"), React$2.createElement(MenuItem, {
|
|
1121
|
-
value: 6,
|
|
1122
|
-
__self: this,
|
|
1123
|
-
__source: {
|
|
1124
|
-
fileName: _jsxFileName$1,
|
|
1125
|
-
lineNumber: 486
|
|
1126
|
-
}
|
|
1127
|
-
}, "Grade 6 - 7"), React$2.createElement(MenuItem, {
|
|
1128
|
-
value: 8,
|
|
1129
|
-
__self: this,
|
|
1130
|
-
__source: {
|
|
1131
|
-
fileName: _jsxFileName$1,
|
|
1132
|
-
lineNumber: 487
|
|
1133
|
-
}
|
|
1134
|
-
}, "Grade 8 - HS"), React$2.createElement(MenuItem, {
|
|
1135
|
-
value: 'geometry',
|
|
1136
|
-
__self: this,
|
|
1137
|
-
__source: {
|
|
1138
|
-
fileName: _jsxFileName$1,
|
|
1139
|
-
lineNumber: 488
|
|
1140
|
-
}
|
|
1141
|
-
}, "Geometry"), React$2.createElement(MenuItem, {
|
|
1142
|
-
value: 'advanced-algebra',
|
|
1143
|
-
__self: this,
|
|
1144
|
-
__source: {
|
|
1145
|
-
fileName: _jsxFileName$1,
|
|
1146
|
-
lineNumber: 489
|
|
1147
|
-
}
|
|
1148
|
-
}, "Advanced Algebra"), React$2.createElement(MenuItem, {
|
|
1149
|
-
value: 'statistics',
|
|
1150
|
-
__self: this,
|
|
1151
|
-
__source: {
|
|
1152
|
-
fileName: _jsxFileName$1,
|
|
1153
|
-
lineNumber: 490
|
|
1154
|
-
}
|
|
1155
|
-
}, "Statistics"), React$2.createElement(MenuItem, {
|
|
1156
|
-
value: 'item-authoring',
|
|
1157
|
-
__self: this,
|
|
1158
|
-
__source: {
|
|
1159
|
-
fileName: _jsxFileName$1,
|
|
1160
|
-
lineNumber: 491
|
|
1161
|
-
}
|
|
1162
|
-
}, "Item Authoring")))), responsesToUse.map((response, idx) => React$2.createElement(Response$1, {
|
|
1163
|
-
key: response.id,
|
|
1164
|
-
mode: equationEditor,
|
|
1165
|
-
response: response,
|
|
1166
|
-
defaultResponse: responseType === ResponseTypes.simple,
|
|
1167
|
-
onResponseChange: this.onResponseChange,
|
|
1168
|
-
index: idx,
|
|
1169
|
-
cIgnoreOrder: cIgnoreOrder,
|
|
1170
|
-
cAllowTrailingZeros: cAllowTrailingZeros,
|
|
1171
|
-
error: responsesErrors && responsesErrors[idx],
|
|
1172
|
-
__self: this,
|
|
1173
|
-
__source: {
|
|
1174
|
-
fileName: _jsxFileName$1,
|
|
1175
|
-
lineNumber: 496
|
|
1176
|
-
}
|
|
1177
|
-
})));
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
GeneralConfigBlock.__initStatic();
|
|
1181
|
-
var GeneralConfigBlock$1 = withStyles$1(styles$1)(GeneralConfigBlock);
|
|
1182
|
-
const React$1 = _dll_react;
|
|
1183
|
-
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
1184
|
-
const PropTypes = _dll_prop_types;
|
|
1185
|
-
const debug$1 = _dll_debug;
|
|
1186
|
-
const {FeedbackConfig: FeedbackConfig} = _dll_pie_lib__config_ui;
|
|
1187
|
-
const {settings: settings} = _dll_pie_lib__config_ui;
|
|
1188
|
-
const {layout: layout} = _dll_pie_lib__config_ui;
|
|
1189
|
-
const {InputContainer: InputContainer} = _dll_pie_lib__config_ui;
|
|
1190
|
-
const EditableHtml = _dll_pie_lib__editable_html;
|
|
1191
|
-
const _jsxFileName = "/home/circleci/repo/packages/math-inline/configure/src/configure.jsx";
|
|
1192
|
-
const log$1 = debug$1('@pie-element:math-inline:configure');
|
|
1193
|
-
const {Panel, toggle, radio} = settings;
|
|
1194
|
-
const styles = theme => ({
|
|
1195
|
-
title: {
|
|
1196
|
-
fontSize: '1.1rem',
|
|
1197
|
-
display: 'block',
|
|
1198
|
-
marginTop: theme.spacing.unit * 2,
|
|
1199
|
-
marginBottom: theme.spacing.unit
|
|
1200
|
-
},
|
|
1201
|
-
content: {
|
|
1202
|
-
marginTop: theme.spacing.unit * 2
|
|
1203
|
-
},
|
|
1204
|
-
promptHolder: {
|
|
1205
|
-
width: '100%',
|
|
1206
|
-
paddingTop: theme.spacing.unit * 2
|
|
1207
|
-
},
|
|
1208
|
-
prompt: {
|
|
1209
|
-
paddingTop: theme.spacing.unit * 2,
|
|
1210
|
-
width: '100%'
|
|
1211
|
-
}
|
|
1212
|
-
});
|
|
1213
|
-
class Configure extends React$1.Component {
|
|
1214
|
-
constructor(...args) {
|
|
1215
|
-
super(...args);
|
|
1216
|
-
Configure.prototype.__init.call(this);
|
|
1217
|
-
Configure.prototype.__init2.call(this);
|
|
1218
|
-
Configure.prototype.__init3.call(this);
|
|
1219
|
-
}
|
|
1220
|
-
static __initStatic() {
|
|
1221
|
-
this.propTypes = {
|
|
1222
|
-
onModelChanged: PropTypes.func,
|
|
1223
|
-
onConfigurationChanged: PropTypes.func,
|
|
1224
|
-
classes: PropTypes.object,
|
|
1225
|
-
model: PropTypes.object.isRequired,
|
|
1226
|
-
configuration: PropTypes.object.isRequired,
|
|
1227
|
-
imageSupport: PropTypes.object
|
|
1228
|
-
};
|
|
1229
|
-
}
|
|
1230
|
-
__init() {
|
|
1231
|
-
this.onChange = model => {
|
|
1232
|
-
this.props.onModelChanged(model);
|
|
1233
|
-
};
|
|
1234
|
-
}
|
|
1235
|
-
__init2() {
|
|
1236
|
-
this.changeTeacherInstructions = teacherInstructions => {
|
|
1237
|
-
this.props.onModelChanged({
|
|
1238
|
-
...this.props.model,
|
|
1239
|
-
teacherInstructions
|
|
1240
|
-
});
|
|
1241
|
-
};
|
|
1242
|
-
}
|
|
1243
|
-
__init3() {
|
|
1244
|
-
this.onFeedbackChange = feedback => {
|
|
1245
|
-
const {model, onModelChanged} = this.props;
|
|
1246
|
-
model.feedback = feedback;
|
|
1247
|
-
onModelChanged(model);
|
|
1248
|
-
};
|
|
1249
|
-
}
|
|
1250
|
-
render() {
|
|
1251
|
-
const {classes, model, imageSupport, onModelChanged, configuration, onConfigurationChanged} = this.props;
|
|
1252
|
-
const {feedback = {}, responseType = {}, teacherInstructions = {}, studentInstructions = {}, rationale = {}, prompt = {}, scoringType = {}, ignoreOrder = {}, allowTrailingZeros = {}, spellCheck = {}} = configuration || ({});
|
|
1253
|
-
log$1('[render] model', model);
|
|
1254
|
-
const {rationaleEnabled, promptEnabled, teacherInstructionsEnabled, feedbackEnabled, spellCheckEnabled} = model || ({});
|
|
1255
|
-
const toolbarOpts = {};
|
|
1256
|
-
switch (model.toolbarEditorPosition) {
|
|
1257
|
-
case 'top':
|
|
1258
|
-
toolbarOpts.position = 'top';
|
|
1259
|
-
break;
|
|
1260
|
-
default:
|
|
1261
|
-
toolbarOpts.position = 'bottom';
|
|
1262
|
-
break;
|
|
1263
|
-
}
|
|
1264
|
-
return React$1.createElement('div', {
|
|
1265
|
-
__self: this,
|
|
1266
|
-
__source: {
|
|
1267
|
-
fileName: _jsxFileName,
|
|
1268
|
-
lineNumber: 93
|
|
1269
|
-
}
|
|
1270
|
-
}, React$1.createElement(layout.ConfigLayout, {
|
|
1271
|
-
settings: React$1.createElement(Panel, {
|
|
1272
|
-
model: model,
|
|
1273
|
-
configuration: configuration,
|
|
1274
|
-
onChangeModel: model => onModelChanged(model),
|
|
1275
|
-
onChangeConfiguration: config => onConfigurationChanged(config),
|
|
1276
|
-
groups: {
|
|
1277
|
-
'Settings': {
|
|
1278
|
-
responseType: responseType.settings && radio(responseType.label, [ResponseTypes.simple, ResponseTypes.advanced]),
|
|
1279
|
-
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
1280
|
-
'promptEnabled': prompt.settings && toggle(prompt.label)
|
|
1281
|
-
},
|
|
1282
|
-
'Properties': {
|
|
1283
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
1284
|
-
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
1285
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
1286
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
1287
|
-
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
|
|
1288
|
-
'ignoreOrder.enabled': ignoreOrder.settings && toggle(ignoreOrder.label),
|
|
1289
|
-
'allowTrailingZeros.enabled': allowTrailingZeros.settings && toggle(allowTrailingZeros.label)
|
|
1290
|
-
}
|
|
1291
|
-
},
|
|
1292
|
-
__self: this,
|
|
1293
|
-
__source: {
|
|
1294
|
-
fileName: _jsxFileName,
|
|
1295
|
-
lineNumber: 96
|
|
1296
|
-
}
|
|
1297
|
-
}),
|
|
1298
|
-
__self: this,
|
|
1299
|
-
__source: {
|
|
1300
|
-
fileName: _jsxFileName,
|
|
1301
|
-
lineNumber: 94
|
|
1302
|
-
}
|
|
1303
|
-
}, React$1.createElement('div', {
|
|
1304
|
-
__self: this,
|
|
1305
|
-
__source: {
|
|
1306
|
-
fileName: _jsxFileName,
|
|
1307
|
-
lineNumber: 129
|
|
1308
|
-
}
|
|
1309
|
-
}, React$1.createElement('div', {
|
|
1310
|
-
className: classes.content,
|
|
1311
|
-
__self: this,
|
|
1312
|
-
__source: {
|
|
1313
|
-
fileName: _jsxFileName,
|
|
1314
|
-
lineNumber: 130
|
|
1315
|
-
}
|
|
1316
|
-
}, teacherInstructionsEnabled && React$1.createElement(InputContainer, {
|
|
1317
|
-
label: teacherInstructions.label,
|
|
1318
|
-
className: classes.promptHolder,
|
|
1319
|
-
__self: this,
|
|
1320
|
-
__source: {
|
|
1321
|
-
fileName: _jsxFileName,
|
|
1322
|
-
lineNumber: 132
|
|
1323
|
-
}
|
|
1324
|
-
}, React$1.createElement(EditableHtml, {
|
|
1325
|
-
className: classes.prompt,
|
|
1326
|
-
markup: model.teacherInstructions || '',
|
|
1327
|
-
onChange: this.changeTeacherInstructions,
|
|
1328
|
-
imageSupport: imageSupport,
|
|
1329
|
-
nonEmpty: false,
|
|
1330
|
-
toolbarOpts: toolbarOpts,
|
|
1331
|
-
spellCheck: spellCheckEnabled,
|
|
1332
|
-
__self: this,
|
|
1333
|
-
__source: {
|
|
1334
|
-
fileName: _jsxFileName,
|
|
1335
|
-
lineNumber: 133
|
|
1336
|
-
}
|
|
1337
|
-
})), React$1.createElement(GeneralConfigBlock$1, {
|
|
1338
|
-
imageSupport: imageSupport,
|
|
1339
|
-
model: model,
|
|
1340
|
-
configuration: configuration,
|
|
1341
|
-
onChange: this.onChange,
|
|
1342
|
-
rationaleEnabled: rationaleEnabled,
|
|
1343
|
-
promptEnabled: promptEnabled,
|
|
1344
|
-
toolbarOpts: toolbarOpts,
|
|
1345
|
-
spellCheck: spellCheckEnabled,
|
|
1346
|
-
__self: this,
|
|
1347
|
-
__source: {
|
|
1348
|
-
fileName: _jsxFileName,
|
|
1349
|
-
lineNumber: 145
|
|
1350
|
-
}
|
|
1351
|
-
}), feedbackEnabled && React$1.createElement(FeedbackConfig, {
|
|
1352
|
-
feedback: model.feedback,
|
|
1353
|
-
onChange: this.onFeedbackChange,
|
|
1354
|
-
toolbarOpts: toolbarOpts,
|
|
1355
|
-
__self: this,
|
|
1356
|
-
__source: {
|
|
1357
|
-
fileName: _jsxFileName,
|
|
1358
|
-
lineNumber: 157
|
|
1359
|
-
}
|
|
1360
|
-
})))));
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
Configure.__initStatic();
|
|
1364
|
-
var Configure$1 = withStyles(styles)(Configure);
|
|
1365
|
-
var lib = {};
|
|
1366
|
-
Object.defineProperty(lib, "__esModule", {
|
|
1367
|
-
value: true
|
|
1368
|
-
});
|
|
1369
|
-
class ModelUpdatedEvent extends CustomEvent {
|
|
1370
|
-
constructor(update, reset = false) {
|
|
1371
|
-
super(ModelUpdatedEvent.TYPE, {
|
|
1372
|
-
bubbles: true,
|
|
1373
|
-
detail: {
|
|
1374
|
-
update,
|
|
1375
|
-
reset
|
|
1376
|
-
}
|
|
1377
|
-
});
|
|
1378
|
-
this.update = update;
|
|
1379
|
-
this.reset = reset;
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
ModelUpdatedEvent.TYPE = 'model.updated';
|
|
1383
|
-
var ModelUpdatedEvent_1 = lib.ModelUpdatedEvent = ModelUpdatedEvent;
|
|
1384
|
-
class DeleteImageEvent extends CustomEvent {
|
|
1385
|
-
constructor(src, done) {
|
|
1386
|
-
super(DeleteImageEvent.TYPE, {
|
|
1387
|
-
bubbles: true,
|
|
1388
|
-
detail: {
|
|
1389
|
-
src,
|
|
1390
|
-
done
|
|
1391
|
-
}
|
|
1392
|
-
});
|
|
1393
|
-
this.src = src;
|
|
1394
|
-
this.done = done;
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1397
|
-
DeleteImageEvent.TYPE = 'delete.image';
|
|
1398
|
-
var DeleteImageEvent_1 = lib.DeleteImageEvent = DeleteImageEvent;
|
|
1399
|
-
class InsertImageEvent extends CustomEvent {
|
|
1400
|
-
constructor(handler) {
|
|
1401
|
-
super(InsertImageEvent.TYPE, {
|
|
1402
|
-
bubbles: true,
|
|
1403
|
-
detail: handler
|
|
1404
|
-
});
|
|
1405
|
-
this.handler = handler;
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
InsertImageEvent.TYPE = 'insert.image';
|
|
1409
|
-
var InsertImageEvent_1 = lib.InsertImageEvent = InsertImageEvent;
|
|
1410
|
-
var defaults = {
|
|
1411
|
-
model: {
|
|
1412
|
-
partialScoring: true,
|
|
1413
|
-
responseType: ResponseTypes.advanced,
|
|
1414
|
-
element: 'math-inline',
|
|
1415
|
-
feedback: {
|
|
1416
|
-
correct: {
|
|
1417
|
-
default: 'Correct',
|
|
1418
|
-
type: 'none'
|
|
1419
|
-
},
|
|
1420
|
-
incorrect: {
|
|
1421
|
-
default: 'Incorrect',
|
|
1422
|
-
type: 'none'
|
|
1423
|
-
},
|
|
1424
|
-
partial: {
|
|
1425
|
-
default: 'Nearly',
|
|
1426
|
-
type: 'none'
|
|
1427
|
-
}
|
|
1428
|
-
},
|
|
1429
|
-
equationEditor: '8',
|
|
1430
|
-
expression: '',
|
|
1431
|
-
rationale: 'Rationale goes here.',
|
|
1432
|
-
note: 'The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.',
|
|
1433
|
-
prompt: '',
|
|
1434
|
-
responses: [],
|
|
1435
|
-
customKeys: [],
|
|
1436
|
-
scoringType: 'auto',
|
|
1437
|
-
feedbackEnabled: true,
|
|
1438
|
-
promptEnabled: true,
|
|
1439
|
-
rationaleEnabled: true,
|
|
1440
|
-
teacherInstructionsEnabled: true,
|
|
1441
|
-
studentInstructionsEnabled: true,
|
|
1442
|
-
toolbarEditorPosition: 'bottom',
|
|
1443
|
-
validationDefault: 'literal',
|
|
1444
|
-
ignoreOrderDefault: false,
|
|
1445
|
-
allowTrailingZerosDefault: false
|
|
1446
|
-
},
|
|
1447
|
-
configuration: {
|
|
1448
|
-
prompt: {
|
|
1449
|
-
settings: true,
|
|
1450
|
-
label: 'Prompt'
|
|
1451
|
-
},
|
|
1452
|
-
feedback: {
|
|
1453
|
-
settings: true,
|
|
1454
|
-
label: 'Feedback'
|
|
1455
|
-
},
|
|
1456
|
-
responseType: {
|
|
1457
|
-
settings: true,
|
|
1458
|
-
label: 'Response type'
|
|
1459
|
-
},
|
|
1460
|
-
rationale: {
|
|
1461
|
-
settings: true,
|
|
1462
|
-
label: 'Rationale'
|
|
1463
|
-
},
|
|
1464
|
-
spellCheck: {
|
|
1465
|
-
label: 'Spellcheck',
|
|
1466
|
-
settings: false,
|
|
1467
|
-
enabled: true
|
|
1468
|
-
},
|
|
1469
|
-
scoringType: {
|
|
1470
|
-
settings: false,
|
|
1471
|
-
label: 'Scoring Type'
|
|
1472
|
-
},
|
|
1473
|
-
studentInstructions: {
|
|
1474
|
-
settings: false,
|
|
1475
|
-
label: 'Student Instructions'
|
|
1476
|
-
},
|
|
1477
|
-
teacherInstructions: {
|
|
1478
|
-
settings: true,
|
|
1479
|
-
label: 'Teacher Instructions'
|
|
1480
|
-
},
|
|
1481
|
-
partialScoring: {
|
|
1482
|
-
settings: false,
|
|
1483
|
-
label: 'Allow Partial Scoring'
|
|
1484
|
-
},
|
|
1485
|
-
ignoreOrder: {
|
|
1486
|
-
settings: false,
|
|
1487
|
-
label: 'Ignore Order',
|
|
1488
|
-
enabled: true
|
|
1489
|
-
},
|
|
1490
|
-
allowTrailingZeros: {
|
|
1491
|
-
settings: false,
|
|
1492
|
-
label: 'Allow Trailing Zeros',
|
|
1493
|
-
enabled: true
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
};
|
|
1497
|
-
const React = _dll_react;
|
|
1498
|
-
const ReactDOM = _dll_react_dom;
|
|
1499
|
-
const {isEmpty: isEmpty} = _dll_lodash;
|
|
1500
|
-
const debug = _dll_debug;
|
|
1501
|
-
const log = debug('pie-elements:math-inline:configure');
|
|
1502
|
-
class MathInlineConfigure extends HTMLElement {
|
|
1503
|
-
static __initStatic() {
|
|
1504
|
-
this.createDefaultModel = (model = {}) => {
|
|
1505
|
-
if (!isEmpty(model.responses)) {
|
|
1506
|
-
model.responses = model.responses.map(correctResponse => ({
|
|
1507
|
-
...correctResponse,
|
|
1508
|
-
validation: correctResponse.validation || defaults.model.validationDefault,
|
|
1509
|
-
allowTrailingZeros: correctResponse.allowTrailingZeros || defaults.model.allowTrailingZerosDefault,
|
|
1510
|
-
ignoreOrder: correctResponse.ignoreOrder || defaults.model.ignoreOrderDefault || false
|
|
1511
|
-
}));
|
|
1512
|
-
}
|
|
1513
|
-
return {
|
|
1514
|
-
...defaults.model,
|
|
1515
|
-
...model
|
|
1516
|
-
};
|
|
1517
|
-
};
|
|
1518
|
-
}
|
|
1519
|
-
constructor() {
|
|
1520
|
-
super();
|
|
1521
|
-
this._model = MathInlineConfigure.createDefaultModel();
|
|
1522
|
-
this._configuration = defaults.configuration;
|
|
1523
|
-
}
|
|
1524
|
-
set model(m) {
|
|
1525
|
-
this._model = MathInlineConfigure.createDefaultModel(m);
|
|
1526
|
-
this._render();
|
|
1527
|
-
}
|
|
1528
|
-
set configuration(c) {
|
|
1529
|
-
this._configuration = c;
|
|
1530
|
-
this._render();
|
|
1531
|
-
}
|
|
1532
|
-
onModelChanged(model) {
|
|
1533
|
-
this._model = model;
|
|
1534
|
-
log('[onModelChanged]: ', this._model);
|
|
1535
|
-
this._render();
|
|
1536
|
-
this.dispatchEvent(new ModelUpdatedEvent_1(this._model));
|
|
1537
|
-
}
|
|
1538
|
-
onConfigurationChanged(c) {
|
|
1539
|
-
this._configuration = c;
|
|
1540
|
-
if (this._model) {
|
|
1541
|
-
this.onModelChanged(this._model);
|
|
1542
|
-
}
|
|
1543
|
-
this._render();
|
|
1544
|
-
}
|
|
1545
|
-
insertImage(handler) {
|
|
1546
|
-
this.dispatchEvent(new InsertImageEvent_1(handler));
|
|
1547
|
-
}
|
|
1548
|
-
onDeleteImage(src, done) {
|
|
1549
|
-
this.dispatchEvent(new DeleteImageEvent_1(src, done));
|
|
1550
|
-
}
|
|
1551
|
-
_render() {
|
|
1552
|
-
if (this._model) {
|
|
1553
|
-
const el = React.createElement(Configure$1, {
|
|
1554
|
-
onModelChanged: this.onModelChanged.bind(this),
|
|
1555
|
-
onConfigurationChanged: this.onConfigurationChanged.bind(this),
|
|
1556
|
-
model: this._model,
|
|
1557
|
-
configuration: this._configuration,
|
|
1558
|
-
imageSupport: {
|
|
1559
|
-
add: this.insertImage.bind(this),
|
|
1560
|
-
delete: this.onDeleteImage.bind(this)
|
|
1561
|
-
}
|
|
1562
|
-
});
|
|
1563
|
-
ReactDOM.render(el, this);
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
}
|
|
1567
|
-
MathInlineConfigure.__initStatic();
|
|
1568
|
-
export {MathInlineConfigure as default};
|