@pie-element/math-inline 5.9.7 → 5.9.10
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 +24 -0
- package/configure/CHANGELOG.md +24 -0
- package/configure/lib/general-config-block.js +50 -6
- package/configure/lib/general-config-block.js.map +1 -1
- package/configure/lib/response.js +19 -5
- package/configure/lib/response.js.map +1 -1
- package/configure/lib/utils.js +18 -1
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +8 -0
- package/controller/lib/index.js +70 -1
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +5 -0
- package/docs/config-schema.json.md +4 -0
- package/module/configure.js +169 -74
- package/module/controller.js +53 -1
- package/module/element.js +31 -2238
- package/module/index.html +1 -1
- package/module/manifest.json +4 -4
- package/module/print.html +1 -1
- package/module/print.js +17 -2237
- package/package.json +5 -5
package/module/element.js
CHANGED
|
@@ -1,2240 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
const lessThan = set$f({
|
|
9
|
-
name: 'Less than',
|
|
10
|
-
latex: '<',
|
|
11
|
-
command: '\\lt'
|
|
12
|
-
});
|
|
13
|
-
const greaterThan = set$f({
|
|
14
|
-
name: 'Greater than',
|
|
15
|
-
latex: '>',
|
|
16
|
-
command: '\\gt'
|
|
17
|
-
});
|
|
18
|
-
const lessThanEqual = set$f({
|
|
19
|
-
name: 'Less than or equal',
|
|
20
|
-
latex: '\\le',
|
|
21
|
-
symbol: '<=',
|
|
22
|
-
command: '\\le'
|
|
23
|
-
});
|
|
24
|
-
const greaterThanEqual = set$f({
|
|
25
|
-
name: 'Greater than or equal',
|
|
26
|
-
symbol: '>=',
|
|
27
|
-
command: '\\ge',
|
|
28
|
-
latex: '\\ge'
|
|
29
|
-
});
|
|
30
|
-
var comparison = Object.freeze({
|
|
31
|
-
__proto__: null,
|
|
32
|
-
lessThan: lessThan,
|
|
33
|
-
greaterThan: greaterThan,
|
|
34
|
-
lessThanEqual: lessThanEqual,
|
|
35
|
-
greaterThanEqual: greaterThanEqual
|
|
36
|
-
});
|
|
37
|
-
const _$3 = _dll_lodash;
|
|
38
|
-
const mkSet = category => o => ({
|
|
39
|
-
...o,
|
|
40
|
-
category
|
|
41
|
-
});
|
|
42
|
-
const transformToKeySetStructure = (data = []) => {
|
|
43
|
-
const structure = [];
|
|
44
|
-
_$3.times(5, () => {
|
|
45
|
-
structure.push([]);
|
|
46
|
-
});
|
|
47
|
-
let ln = data.length;
|
|
48
|
-
let i = 0;
|
|
49
|
-
let j = 0;
|
|
50
|
-
while (j < ln) {
|
|
51
|
-
structure[i++].push(data[j++]);
|
|
52
|
-
if (i === 5) {
|
|
53
|
-
i = 0;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return structure;
|
|
57
|
-
};
|
|
58
|
-
const latexAndNameDontExist = base => k => {
|
|
59
|
-
const flattened = _$3.flatten(base);
|
|
60
|
-
const latexExists = flattened.some(b => b.latex === k.latex);
|
|
61
|
-
const nameExists = flattened.some(b => b.name === k.name);
|
|
62
|
-
return !latexExists && !nameExists;
|
|
63
|
-
};
|
|
64
|
-
const extendKeySet = (base = [], keySetData = []) => {
|
|
65
|
-
keySetData = keySetData.filter(latexAndNameDontExist(base));
|
|
66
|
-
const final = [];
|
|
67
|
-
_$3.times(5 - base.length, () => {
|
|
68
|
-
base.push([]);
|
|
69
|
-
});
|
|
70
|
-
_$3.times(5, () => {
|
|
71
|
-
final.push([]);
|
|
72
|
-
});
|
|
73
|
-
const extra = transformToKeySetStructure(keySetData);
|
|
74
|
-
for (let i = 0; i < 5; i++) {
|
|
75
|
-
final[i] = [...base[i], ...extra[i]];
|
|
76
|
-
}
|
|
77
|
-
return final;
|
|
78
|
-
};
|
|
79
|
-
const set$e = mkSet('vars');
|
|
80
|
-
const x = set$e({
|
|
81
|
-
name: 'X',
|
|
82
|
-
latex: 'x',
|
|
83
|
-
write: 'x'
|
|
84
|
-
});
|
|
85
|
-
const y = set$e({
|
|
86
|
-
name: 'Y',
|
|
87
|
-
latex: 'y',
|
|
88
|
-
write: 'y'
|
|
89
|
-
});
|
|
90
|
-
const theta = set$e({
|
|
91
|
-
name: 'Theta',
|
|
92
|
-
latex: '\\theta',
|
|
93
|
-
write: '\\theta'
|
|
94
|
-
});
|
|
95
|
-
var vars = Object.freeze({
|
|
96
|
-
__proto__: null,
|
|
97
|
-
x: x,
|
|
98
|
-
y: y,
|
|
99
|
-
theta: theta
|
|
100
|
-
});
|
|
101
|
-
const set$d = mkSet('fractions');
|
|
102
|
-
const blankOverBlank = set$d({
|
|
103
|
-
name: 'blank/blank',
|
|
104
|
-
latex: '\\frac{}{}',
|
|
105
|
-
command: '\\frac'
|
|
106
|
-
});
|
|
107
|
-
const xOverBlank = set$d({
|
|
108
|
-
latex: '\\frac{x}{ }',
|
|
109
|
-
name: 'X/blank',
|
|
110
|
-
label: 'x/[]',
|
|
111
|
-
command: '/'
|
|
112
|
-
});
|
|
113
|
-
const xBlankBlank = set$d({
|
|
114
|
-
name: 'X (blank/blank)',
|
|
115
|
-
latex: 'x\\frac{}{}',
|
|
116
|
-
label: 'x([]/[])',
|
|
117
|
-
command: '\\frac'
|
|
118
|
-
});
|
|
119
|
-
var fractions = Object.freeze({
|
|
120
|
-
__proto__: null,
|
|
121
|
-
blankOverBlank: blankOverBlank,
|
|
122
|
-
xOverBlank: xOverBlank,
|
|
123
|
-
xBlankBlank: xBlankBlank
|
|
124
|
-
});
|
|
125
|
-
const set$c = mkSet('exponent');
|
|
126
|
-
const squared = set$c({
|
|
127
|
-
name: 'Squared',
|
|
128
|
-
latex: 'x^2',
|
|
129
|
-
write: '^2'
|
|
130
|
-
});
|
|
131
|
-
const xToPowerOfN = set$c({
|
|
132
|
-
name: 'X to the power of n',
|
|
133
|
-
latex: 'x^{}',
|
|
134
|
-
command: '^'
|
|
135
|
-
});
|
|
136
|
-
const squareRoot = set$c({
|
|
137
|
-
name: 'Square root',
|
|
138
|
-
latex: '\\sqrt{}',
|
|
139
|
-
command: '\\sqrt'
|
|
140
|
-
});
|
|
141
|
-
const nthRoot = set$c({
|
|
142
|
-
name: 'Nth root',
|
|
143
|
-
latex: '\\sqrt[{}]{}',
|
|
144
|
-
command: '\\nthroot'
|
|
145
|
-
});
|
|
146
|
-
var exponent = Object.freeze({
|
|
147
|
-
__proto__: null,
|
|
148
|
-
squared: squared,
|
|
149
|
-
xToPowerOfN: xToPowerOfN,
|
|
150
|
-
squareRoot: squareRoot,
|
|
151
|
-
nthRoot: nthRoot
|
|
152
|
-
});
|
|
153
|
-
const set$b = mkSet('misc');
|
|
154
|
-
const plusMinus = set$b({
|
|
155
|
-
name: 'Plus/Minus',
|
|
156
|
-
latex: '\\pm',
|
|
157
|
-
write: '\\pm'
|
|
158
|
-
});
|
|
159
|
-
const absValue = set$b({
|
|
160
|
-
name: 'Absolute Value',
|
|
161
|
-
latex: '\\abs{}',
|
|
162
|
-
symbol: '| |',
|
|
163
|
-
command: '|'
|
|
164
|
-
});
|
|
165
|
-
const parenthesis = set$b({
|
|
166
|
-
name: 'Parenthesis',
|
|
167
|
-
latex: '\\left(\\right)',
|
|
168
|
-
symbol: '( )',
|
|
169
|
-
command: '('
|
|
170
|
-
});
|
|
171
|
-
const brackets = set$b({
|
|
172
|
-
name: 'Brackets',
|
|
173
|
-
latex: '\\left[\\right]',
|
|
174
|
-
symbol: '[ ]',
|
|
175
|
-
command: '['
|
|
176
|
-
});
|
|
177
|
-
const percentage = set$b({
|
|
178
|
-
name: 'Percentage',
|
|
179
|
-
latex: '%',
|
|
180
|
-
command: '%'
|
|
181
|
-
});
|
|
182
|
-
const approx = set$b({
|
|
183
|
-
latex: '\\approx',
|
|
184
|
-
command: '\\approx'
|
|
185
|
-
});
|
|
186
|
-
const nApprox = set$b({
|
|
187
|
-
latex: '\\napprox',
|
|
188
|
-
command: '\\napprox'
|
|
189
|
-
});
|
|
190
|
-
const notEqual = set$b({
|
|
191
|
-
latex: '\\neq',
|
|
192
|
-
command: '\\neq'
|
|
193
|
-
});
|
|
194
|
-
const similar = set$b({
|
|
195
|
-
latex: '\\sim',
|
|
196
|
-
command: '\\sim'
|
|
197
|
-
});
|
|
198
|
-
const notSimilar = set$b({
|
|
199
|
-
latex: '\\nsim',
|
|
200
|
-
command: '\\nsim'
|
|
201
|
-
});
|
|
202
|
-
var misc = Object.freeze({
|
|
203
|
-
__proto__: null,
|
|
204
|
-
plusMinus: plusMinus,
|
|
205
|
-
absValue: absValue,
|
|
206
|
-
parenthesis: parenthesis,
|
|
207
|
-
brackets: brackets,
|
|
208
|
-
percentage: percentage,
|
|
209
|
-
approx: approx,
|
|
210
|
-
nApprox: nApprox,
|
|
211
|
-
notEqual: notEqual,
|
|
212
|
-
similar: similar,
|
|
213
|
-
notSimilar: notSimilar
|
|
214
|
-
});
|
|
215
|
-
const set$a = mkSet('constants');
|
|
216
|
-
const pi = set$a({
|
|
217
|
-
name: 'Pi',
|
|
218
|
-
label: 'π',
|
|
219
|
-
latex: '\\pi',
|
|
220
|
-
command: '\\pi',
|
|
221
|
-
category: 'constants'
|
|
222
|
-
});
|
|
223
|
-
const eulers = set$a({
|
|
224
|
-
name: 'Eulers',
|
|
225
|
-
label: 'e',
|
|
226
|
-
latex: 'e',
|
|
227
|
-
command: 'e',
|
|
228
|
-
category: 'constants'
|
|
229
|
-
});
|
|
230
|
-
const infinity = set$a({
|
|
231
|
-
name: 'Infinity',
|
|
232
|
-
label: '\\infty',
|
|
233
|
-
latex: '\\infty',
|
|
234
|
-
command: '\\infty',
|
|
235
|
-
category: 'constants'
|
|
236
|
-
});
|
|
237
|
-
const halfInfinity = set$a({
|
|
238
|
-
name: 'Half Infinity',
|
|
239
|
-
label: '\\propto',
|
|
240
|
-
latex: '\\propto',
|
|
241
|
-
command: '\\propto',
|
|
242
|
-
category: 'constants'
|
|
243
|
-
});
|
|
244
|
-
var constants = Object.freeze({
|
|
245
|
-
__proto__: null,
|
|
246
|
-
pi: pi,
|
|
247
|
-
eulers: eulers,
|
|
248
|
-
infinity: infinity,
|
|
249
|
-
halfInfinity: halfInfinity
|
|
250
|
-
});
|
|
251
|
-
const set$9 = mkSet('trigonometry');
|
|
252
|
-
const sin = set$9({
|
|
253
|
-
name: 'sin',
|
|
254
|
-
label: 'sin',
|
|
255
|
-
command: '\\sin',
|
|
256
|
-
latex: '\\sin'
|
|
257
|
-
});
|
|
258
|
-
const cos = set$9({
|
|
259
|
-
name: 'cos',
|
|
260
|
-
label: 'cos',
|
|
261
|
-
command: '\\cos',
|
|
262
|
-
latex: '\\cos'
|
|
263
|
-
});
|
|
264
|
-
const tan = set$9({
|
|
265
|
-
name: 'tan',
|
|
266
|
-
label: 'tan',
|
|
267
|
-
command: '\\tan',
|
|
268
|
-
latex: '\\tan'
|
|
269
|
-
});
|
|
270
|
-
const sec = set$9({
|
|
271
|
-
name: 'sec',
|
|
272
|
-
label: 'sec',
|
|
273
|
-
command: '\\sec',
|
|
274
|
-
latex: '\\sec'
|
|
275
|
-
});
|
|
276
|
-
const csc = set$9({
|
|
277
|
-
name: 'csc',
|
|
278
|
-
label: 'csc',
|
|
279
|
-
command: '\\csc',
|
|
280
|
-
latex: '\\csc'
|
|
281
|
-
});
|
|
282
|
-
const cot = set$9({
|
|
283
|
-
name: 'cot',
|
|
284
|
-
label: 'cot',
|
|
285
|
-
command: '\\cot',
|
|
286
|
-
latex: '\\cot'
|
|
287
|
-
});
|
|
288
|
-
var trigonometry = Object.freeze({
|
|
289
|
-
__proto__: null,
|
|
290
|
-
sin: sin,
|
|
291
|
-
cos: cos,
|
|
292
|
-
tan: tan,
|
|
293
|
-
sec: sec,
|
|
294
|
-
csc: csc,
|
|
295
|
-
cot: cot
|
|
296
|
-
});
|
|
297
|
-
const set$8 = o => ({
|
|
298
|
-
...o,
|
|
299
|
-
category: 'geometry'
|
|
300
|
-
});
|
|
301
|
-
const overline = set$8({
|
|
302
|
-
name: 'Overline',
|
|
303
|
-
latex: '\\overline{}',
|
|
304
|
-
command: '\\overline'
|
|
305
|
-
});
|
|
306
|
-
const overRightArrow = set$8({
|
|
307
|
-
name: 'Overline',
|
|
308
|
-
latex: '\\overrightarrow{}',
|
|
309
|
-
command: '\\overrightarrow'
|
|
310
|
-
});
|
|
311
|
-
const overLeftRightArrow = set$8({
|
|
312
|
-
name: 'Overline',
|
|
313
|
-
latex: '\\overleftrightarrow{\\overline{}}',
|
|
314
|
-
symbol: 'AB',
|
|
315
|
-
command: '\\overleftrightarrow'
|
|
316
|
-
});
|
|
317
|
-
const segment = set$8({
|
|
318
|
-
name: 'Segment',
|
|
319
|
-
latex: '\\overleftrightarrow{AB}',
|
|
320
|
-
write: '\\overleftrightarrow{AB}',
|
|
321
|
-
label: 'AB'
|
|
322
|
-
});
|
|
323
|
-
const parallel = set$8({
|
|
324
|
-
name: 'Parallel',
|
|
325
|
-
latex: '\\parallel',
|
|
326
|
-
command: '\\parallel'
|
|
327
|
-
});
|
|
328
|
-
const notParallel = set$8({
|
|
329
|
-
name: 'Not Parallel',
|
|
330
|
-
latex: '\\nparallel',
|
|
331
|
-
command: '\\nparallel'
|
|
332
|
-
});
|
|
333
|
-
const perpindicular = set$8({
|
|
334
|
-
name: 'Perpendicular',
|
|
335
|
-
latex: '\\perp',
|
|
336
|
-
command: '\\perpendicular'
|
|
337
|
-
});
|
|
338
|
-
const angle = set$8({
|
|
339
|
-
name: 'Angle',
|
|
340
|
-
latex: '\\angle',
|
|
341
|
-
command: '\\angle'
|
|
342
|
-
});
|
|
343
|
-
const overArc = set$8({
|
|
344
|
-
name: 'Over arc',
|
|
345
|
-
latex: '\\overarc{\\overline{}}',
|
|
346
|
-
command: '\\overarc'
|
|
347
|
-
});
|
|
348
|
-
const measureOfAngle = set$8({
|
|
349
|
-
name: 'Measure Of Angle',
|
|
350
|
-
latex: '\\measuredangle',
|
|
351
|
-
command: ['m', '\\angle']
|
|
352
|
-
});
|
|
353
|
-
const triangle = set$8({
|
|
354
|
-
name: 'Triangle',
|
|
355
|
-
latex: '\\triangle',
|
|
356
|
-
command: '\\triangle'
|
|
357
|
-
});
|
|
358
|
-
const square = set$8({
|
|
359
|
-
name: 'Square',
|
|
360
|
-
latex: '\\square',
|
|
361
|
-
command: '\\square'
|
|
362
|
-
});
|
|
363
|
-
const parallelogram = set$8({
|
|
364
|
-
name: 'Parallelogram',
|
|
365
|
-
latex: '\\parallelogram',
|
|
366
|
-
command: '\\parallelogram'
|
|
367
|
-
});
|
|
368
|
-
const circledDot = set$8({
|
|
369
|
-
name: 'Circled Dot',
|
|
370
|
-
latex: '\\odot',
|
|
371
|
-
command: '\\odot'
|
|
372
|
-
});
|
|
373
|
-
const degree = set$8({
|
|
374
|
-
name: 'Degree',
|
|
375
|
-
latex: '\\degree',
|
|
376
|
-
command: '\\degree'
|
|
377
|
-
});
|
|
378
|
-
const similarTo = set$8({
|
|
379
|
-
name: 'Similar To',
|
|
380
|
-
command: '\\sim',
|
|
381
|
-
latex: '\\sim'
|
|
382
|
-
});
|
|
383
|
-
const congruentTo = set$8({
|
|
384
|
-
name: 'Congruent To',
|
|
385
|
-
command: '\\cong',
|
|
386
|
-
latex: '\\cong'
|
|
387
|
-
});
|
|
388
|
-
const notCongruentTo = set$8({
|
|
389
|
-
name: 'Not Congruent To',
|
|
390
|
-
command: '\\ncong',
|
|
391
|
-
latex: '\\ncong'
|
|
392
|
-
});
|
|
393
|
-
const primeArcminute = set$8({
|
|
394
|
-
name: 'Prime',
|
|
395
|
-
label: 'pam',
|
|
396
|
-
latex: "'",
|
|
397
|
-
write: "'"
|
|
398
|
-
});
|
|
399
|
-
const doublePrimeArcSecond = set$8({
|
|
400
|
-
name: 'Double Prime/Arcsecond',
|
|
401
|
-
latex: '"',
|
|
402
|
-
write: '"'
|
|
403
|
-
});
|
|
404
|
-
const leftArrow = set$8({
|
|
405
|
-
name: 'Left Arrow',
|
|
406
|
-
latex: '\\leftarrow',
|
|
407
|
-
command: '\\leftarrow'
|
|
408
|
-
});
|
|
409
|
-
const rightArrow = set$8({
|
|
410
|
-
name: 'Right Arrow',
|
|
411
|
-
latex: '\\rightarrow',
|
|
412
|
-
command: '\\rightarrow'
|
|
413
|
-
});
|
|
414
|
-
const leftrightArrow = set$8({
|
|
415
|
-
name: 'Left Right Arrow',
|
|
416
|
-
latex: '\\leftrightarrow',
|
|
417
|
-
command: '\\leftrightarrow'
|
|
418
|
-
});
|
|
419
|
-
var geometry = Object.freeze({
|
|
420
|
-
__proto__: null,
|
|
421
|
-
overline: overline,
|
|
422
|
-
overRightArrow: overRightArrow,
|
|
423
|
-
overLeftRightArrow: overLeftRightArrow,
|
|
424
|
-
segment: segment,
|
|
425
|
-
parallel: parallel,
|
|
426
|
-
notParallel: notParallel,
|
|
427
|
-
perpindicular: perpindicular,
|
|
428
|
-
angle: angle,
|
|
429
|
-
overArc: overArc,
|
|
430
|
-
measureOfAngle: measureOfAngle,
|
|
431
|
-
triangle: triangle,
|
|
432
|
-
square: square,
|
|
433
|
-
parallelogram: parallelogram,
|
|
434
|
-
circledDot: circledDot,
|
|
435
|
-
degree: degree,
|
|
436
|
-
similarTo: similarTo,
|
|
437
|
-
congruentTo: congruentTo,
|
|
438
|
-
notCongruentTo: notCongruentTo,
|
|
439
|
-
primeArcminute: primeArcminute,
|
|
440
|
-
doublePrimeArcSecond: doublePrimeArcSecond,
|
|
441
|
-
leftArrow: leftArrow,
|
|
442
|
-
rightArrow: rightArrow,
|
|
443
|
-
leftrightArrow: leftrightArrow
|
|
444
|
-
});
|
|
445
|
-
const set$7 = mkSet('operators');
|
|
446
|
-
const circleDot = set$7({
|
|
447
|
-
name: 'CircleDot',
|
|
448
|
-
label: '⋅',
|
|
449
|
-
write: '\\cdot'
|
|
450
|
-
});
|
|
451
|
-
var operators = Object.freeze({
|
|
452
|
-
__proto__: null,
|
|
453
|
-
circleDot: circleDot
|
|
454
|
-
});
|
|
455
|
-
const set$6 = mkSet('log');
|
|
456
|
-
const log$6 = set$6({
|
|
457
|
-
name: 'Log',
|
|
458
|
-
label: 'log',
|
|
459
|
-
command: '\\log',
|
|
460
|
-
latex: '\\log'
|
|
461
|
-
});
|
|
462
|
-
const logSubscript = set$6({
|
|
463
|
-
name: 'Log with subscript',
|
|
464
|
-
label: 'log s',
|
|
465
|
-
latex: '\\log_{}',
|
|
466
|
-
command: ['\\log', '_', ' ']
|
|
467
|
-
});
|
|
468
|
-
const ln = set$6({
|
|
469
|
-
name: 'Ln',
|
|
470
|
-
label: 'ln',
|
|
471
|
-
command: '\\ln',
|
|
472
|
-
latex: '\\ln'
|
|
473
|
-
});
|
|
474
|
-
var log$7 = Object.freeze({
|
|
475
|
-
__proto__: null,
|
|
476
|
-
log: log$6,
|
|
477
|
-
logSubscript: logSubscript,
|
|
478
|
-
ln: ln
|
|
479
|
-
});
|
|
480
|
-
const set$5 = mkSet('sub-sup');
|
|
481
|
-
const superscript = set$5({
|
|
482
|
-
name: 'Superscript',
|
|
483
|
-
latex: 'x^{}',
|
|
484
|
-
command: '^'
|
|
485
|
-
});
|
|
486
|
-
const subscript = set$5({
|
|
487
|
-
name: 'Subscript',
|
|
488
|
-
latex: 'x_{}',
|
|
489
|
-
command: '_'
|
|
490
|
-
});
|
|
491
|
-
var subSup = Object.freeze({
|
|
492
|
-
__proto__: null,
|
|
493
|
-
superscript: superscript,
|
|
494
|
-
subscript: subscript
|
|
495
|
-
});
|
|
496
|
-
const set$4 = mkSet('statistics');
|
|
497
|
-
const xBar = set$4({
|
|
498
|
-
name: 'X Bar',
|
|
499
|
-
label: 'x̄',
|
|
500
|
-
latex: '\\overline{x}',
|
|
501
|
-
write: '\\overline{x}'
|
|
502
|
-
});
|
|
503
|
-
const yBar = set$4({
|
|
504
|
-
name: 'Y Bar',
|
|
505
|
-
latex: '\\overline{y}',
|
|
506
|
-
write: '\\overline{y}'
|
|
507
|
-
});
|
|
508
|
-
const mu = set$4({
|
|
509
|
-
name: 'mu',
|
|
510
|
-
label: 'mu',
|
|
511
|
-
latex: '\\mu',
|
|
512
|
-
write: '\\mu'
|
|
513
|
-
});
|
|
514
|
-
const sigma = set$4({
|
|
515
|
-
name: 'Sigma',
|
|
516
|
-
label: '\\Sigma',
|
|
517
|
-
latex: '\\Sigma',
|
|
518
|
-
write: '\\Sigma'
|
|
519
|
-
});
|
|
520
|
-
const smallSigma = set$4({
|
|
521
|
-
name: 'sigma',
|
|
522
|
-
label: '\\sigma',
|
|
523
|
-
latex: '\\sigma',
|
|
524
|
-
write: '\\sigma'
|
|
525
|
-
});
|
|
526
|
-
var statistics = Object.freeze({
|
|
527
|
-
__proto__: null,
|
|
528
|
-
xBar: xBar,
|
|
529
|
-
yBar: yBar,
|
|
530
|
-
mu: mu,
|
|
531
|
-
sigma: sigma,
|
|
532
|
-
smallSigma: smallSigma
|
|
533
|
-
});
|
|
534
|
-
const DELETE = '\u232B';
|
|
535
|
-
const LEFT_ARROW = '◀';
|
|
536
|
-
const RIGHT_ARROW = '▶';
|
|
537
|
-
const DIVIDE = '\u00F7';
|
|
538
|
-
const MULTIPLY = '\u00D7';
|
|
539
|
-
const set$3 = mkSet('operators');
|
|
540
|
-
const equals = set$3({
|
|
541
|
-
write: '=',
|
|
542
|
-
label: '='
|
|
543
|
-
});
|
|
544
|
-
const plus = set$3({
|
|
545
|
-
write: '+',
|
|
546
|
-
label: '+'
|
|
547
|
-
});
|
|
548
|
-
const minus = set$3({
|
|
549
|
-
write: '−',
|
|
550
|
-
label: '−'
|
|
551
|
-
});
|
|
552
|
-
const divide = set$3({
|
|
553
|
-
name: 'divide',
|
|
554
|
-
label: DIVIDE,
|
|
555
|
-
command: '\\divide',
|
|
556
|
-
otherNotation: '\\div'
|
|
557
|
-
});
|
|
558
|
-
const multiply = set$3({
|
|
559
|
-
name: 'multiply',
|
|
560
|
-
label: MULTIPLY,
|
|
561
|
-
command: '\\times'
|
|
562
|
-
});
|
|
563
|
-
var basicOperators = Object.freeze({
|
|
564
|
-
__proto__: null,
|
|
565
|
-
equals: equals,
|
|
566
|
-
plus: plus,
|
|
567
|
-
minus: minus,
|
|
568
|
-
divide: divide,
|
|
569
|
-
multiply: multiply
|
|
570
|
-
});
|
|
571
|
-
const set$2 = mkSet('matrices');
|
|
572
|
-
const singleCellMatrix = set$2({
|
|
573
|
-
name: 'Single Cell Matrix',
|
|
574
|
-
label: '[ ]',
|
|
575
|
-
write: '\\begin{pmatrix}\\end{pmatrix}'
|
|
576
|
-
});
|
|
577
|
-
const doubleCellMatrix = set$2({
|
|
578
|
-
name: 'Double Cell Matrix',
|
|
579
|
-
label: '[ ] [ ] \\\\newline [ ] [ ]',
|
|
580
|
-
write: '\\begin{bmatrix}&\\\\&\\end{bmatrix}'
|
|
581
|
-
});
|
|
582
|
-
var matrices = Object.freeze({
|
|
583
|
-
__proto__: null,
|
|
584
|
-
singleCellMatrix: singleCellMatrix,
|
|
585
|
-
doubleCellMatrix: doubleCellMatrix
|
|
586
|
-
});
|
|
587
|
-
const {times: times} = _dll_lodash;
|
|
588
|
-
const digitMap = {
|
|
589
|
-
0: 'zero',
|
|
590
|
-
1: 'one',
|
|
591
|
-
2: 'two',
|
|
592
|
-
3: 'three',
|
|
593
|
-
4: 'four',
|
|
594
|
-
5: 'five',
|
|
595
|
-
6: 'six',
|
|
596
|
-
7: 'seven',
|
|
597
|
-
8: 'eight',
|
|
598
|
-
9: 'nine'
|
|
599
|
-
};
|
|
600
|
-
const comma$1 = {
|
|
601
|
-
name: 'comma',
|
|
602
|
-
label: ',',
|
|
603
|
-
write: ',',
|
|
604
|
-
category: 'digit'
|
|
605
|
-
};
|
|
606
|
-
const decimalPoint$1 = {
|
|
607
|
-
name: 'decimal-point',
|
|
608
|
-
label: '.',
|
|
609
|
-
write: '.',
|
|
610
|
-
category: 'digit'
|
|
611
|
-
};
|
|
612
|
-
var digits = times(10, String).map(n => {
|
|
613
|
-
return {
|
|
614
|
-
name: digitMap[n],
|
|
615
|
-
write: n,
|
|
616
|
-
label: n,
|
|
617
|
-
category: 'digit'
|
|
618
|
-
};
|
|
619
|
-
}).reduce((acc, o) => {
|
|
620
|
-
acc[o.name] = o;
|
|
621
|
-
return acc;
|
|
622
|
-
}, {
|
|
623
|
-
comma: comma$1,
|
|
624
|
-
decimalPoint: decimalPoint$1
|
|
625
|
-
});
|
|
626
|
-
const set$1 = mkSet('logic');
|
|
627
|
-
const therefore = set$1({
|
|
628
|
-
name: 'Therefore',
|
|
629
|
-
label: '∴',
|
|
630
|
-
write: '∴'
|
|
631
|
-
});
|
|
632
|
-
const longDivision = set$1({
|
|
633
|
-
name: 'Long division',
|
|
634
|
-
latex: '\\longdiv{}',
|
|
635
|
-
command: '\\longdiv'
|
|
636
|
-
});
|
|
637
|
-
const set = mkSet('navigation');
|
|
638
|
-
const left = set({
|
|
639
|
-
label: LEFT_ARROW,
|
|
640
|
-
keystroke: 'Left'
|
|
641
|
-
});
|
|
642
|
-
const right = set({
|
|
643
|
-
label: RIGHT_ARROW,
|
|
644
|
-
keystroke: 'Right'
|
|
645
|
-
});
|
|
646
|
-
const del = {
|
|
647
|
-
label: DELETE,
|
|
648
|
-
category: 'edit',
|
|
649
|
-
keystroke: 'Backspace'
|
|
650
|
-
};
|
|
651
|
-
const hs = [[blankOverBlank, percentage, x, squared, squareRoot], [circleDot, y, subscript, xToPowerOfN, nthRoot], [plusMinus, lessThan, greaterThan, lessThanEqual, greaterThanEqual], [pi, theta, parenthesis, brackets, absValue], [notEqual, sin, cos, tan, degree]];
|
|
652
|
-
const advancedAlgebra = (() => {
|
|
653
|
-
const out = [...hs.map(arr => [...arr])];
|
|
654
|
-
out[0].push({
|
|
655
|
-
name: 'i',
|
|
656
|
-
latex: 'i',
|
|
657
|
-
write: 'i'
|
|
658
|
-
});
|
|
659
|
-
out[1].push(log$6);
|
|
660
|
-
out[2].push(logSubscript);
|
|
661
|
-
out[3].push(ln);
|
|
662
|
-
out[4].push(eulers);
|
|
663
|
-
return out;
|
|
664
|
-
})();
|
|
665
|
-
const statisticsSet = (() => {
|
|
666
|
-
const out = [...hs.map(arr => [...arr])];
|
|
667
|
-
out[0].push(mu);
|
|
668
|
-
out[1].push(xBar);
|
|
669
|
-
out[2].push(yBar);
|
|
670
|
-
out[3].push(sigma);
|
|
671
|
-
out[4].push(smallSigma);
|
|
672
|
-
return out;
|
|
673
|
-
})();
|
|
674
|
-
const gradeSets = [{
|
|
675
|
-
predicate: n => n >= 3 && n <= 5,
|
|
676
|
-
set: [[lessThan, greaterThan], [xOverBlank, xBlankBlank], [x, longDivision]]
|
|
677
|
-
}, {
|
|
678
|
-
predicate: n => n >= 6 && n <= 7,
|
|
679
|
-
set: [[degree, lessThan, greaterThan], [circleDot, lessThanEqual, greaterThanEqual], [x, y, squared, xToPowerOfN], [plusMinus, xOverBlank, xBlankBlank, squareRoot], [pi, parenthesis, absValue, nthRoot]]
|
|
680
|
-
}, {
|
|
681
|
-
predicate: n => n >= 8 || n === 'HS',
|
|
682
|
-
set: hs
|
|
683
|
-
}, {
|
|
684
|
-
predicate: 'non-negative-integers',
|
|
685
|
-
set: [[digits.seven, digits.eight, digits.nine], [digits.four, digits.five, digits.six], [digits.one, digits.two, digits.three], [digits.zero, {
|
|
686
|
-
name: '',
|
|
687
|
-
latex: '',
|
|
688
|
-
write: ''
|
|
689
|
-
}, {
|
|
690
|
-
name: '',
|
|
691
|
-
latex: '',
|
|
692
|
-
write: ''
|
|
693
|
-
}], [left, right, del]]
|
|
694
|
-
}, {
|
|
695
|
-
predicate: 'integers',
|
|
696
|
-
set: [[digits.seven, digits.eight, digits.nine], [digits.four, digits.five, digits.six], [digits.one, digits.two, digits.three], [digits.zero, {
|
|
697
|
-
name: '',
|
|
698
|
-
latex: '',
|
|
699
|
-
write: ''
|
|
700
|
-
}, minus], [left, right, del]]
|
|
701
|
-
}, {
|
|
702
|
-
predicate: 'decimals',
|
|
703
|
-
set: [[digits.seven, digits.eight, digits.nine], [digits.four, digits.five, digits.six], [digits.one, digits.two, digits.three], [digits.zero, digits.decimalPoint, minus], [left, right, del]]
|
|
704
|
-
}, {
|
|
705
|
-
predicate: 'fractions',
|
|
706
|
-
set: [[digits.seven, digits.eight, digits.nine], [digits.four, digits.five, digits.six], [digits.one, digits.two, digits.three], [digits.zero, blankOverBlank, minus], [left, right, del]]
|
|
707
|
-
}, {
|
|
708
|
-
predicate: 'geometry',
|
|
709
|
-
set: [[blankOverBlank, degree, primeArcminute, doublePrimeArcSecond, congruentTo, similarTo], [circleDot, angle, measureOfAngle, triangle, notCongruentTo, notSimilar], [sin, cos, tan, pi, squareRoot, nthRoot], [csc, sec, cot, theta, subscript, xToPowerOfN], [overline, overRightArrow, overLeftRightArrow, overArc, perpindicular, parallel]]
|
|
710
|
-
}, {
|
|
711
|
-
predicate: 'advanced-algebra',
|
|
712
|
-
set: advancedAlgebra
|
|
713
|
-
}, {
|
|
714
|
-
predicate: 'statistics',
|
|
715
|
-
set: statisticsSet
|
|
716
|
-
}, {
|
|
717
|
-
predicate: 'item-authoring',
|
|
718
|
-
set: [[divide, blankOverBlank, longDivision, halfInfinity, squared, squareRoot, overline, overRightArrow, overLeftRightArrow, log$6], [multiply, circleDot, {
|
|
719
|
-
name: '',
|
|
720
|
-
latex: '',
|
|
721
|
-
write: ''
|
|
722
|
-
}, subscript, xToPowerOfN, nthRoot, perpindicular, parallel, overArc, logSubscript], [plusMinus, pi, theta, degree, angle, leftArrow, rightArrow, triangle, square, ln], [notEqual, absValue, smallSigma, mu, therefore, sigma, leftrightArrow, sin, cos, tan], [lessThanEqual, greaterThanEqual, {
|
|
723
|
-
name: '',
|
|
724
|
-
latex: '',
|
|
725
|
-
write: ''
|
|
726
|
-
}, {
|
|
727
|
-
name: '',
|
|
728
|
-
latex: '',
|
|
729
|
-
write: ''
|
|
730
|
-
}, infinity, {
|
|
731
|
-
name: '',
|
|
732
|
-
latex: '',
|
|
733
|
-
write: ''
|
|
734
|
-
}, {
|
|
735
|
-
name: '',
|
|
736
|
-
latex: '',
|
|
737
|
-
write: ''
|
|
738
|
-
}, csc, sec, cot]]
|
|
739
|
-
}];
|
|
740
|
-
const keysForGrade = n => {
|
|
741
|
-
const number = parseInt(n, 10);
|
|
742
|
-
n = isNaN(number) ? n : number;
|
|
743
|
-
if (!n) {
|
|
744
|
-
return [];
|
|
745
|
-
}
|
|
746
|
-
const match = gradeSets.find(gs => {
|
|
747
|
-
if (typeof gs.predicate === 'string') {
|
|
748
|
-
return gs.predicate === n;
|
|
749
|
-
} else {
|
|
750
|
-
return gs.predicate(n);
|
|
751
|
-
}
|
|
752
|
-
});
|
|
753
|
-
if (match) {
|
|
754
|
-
return match.set || [];
|
|
755
|
-
}
|
|
756
|
-
};
|
|
757
|
-
const ALL_KEYS = [...Object.values(basicOperators), ...Object.values(comparison), ...Object.values(constants), ...Object.values(digits), ...Object.values(exponent), ...Object.values(fractions), ...Object.values(geometry), ...Object.values(log$7), ...Object.values(matrices), ...Object.values(misc), ...Object.values(operators), ...Object.values(statistics), ...Object.values(subSup), ...Object.values(trigonometry), ...Object.values(vars)];
|
|
758
|
-
const normalizeAdditionalKeys = additionalKeys => {
|
|
759
|
-
return (additionalKeys || []).map(additionalkey => {
|
|
760
|
-
const {latex} = additionalkey;
|
|
761
|
-
const predefinedKey = (ALL_KEYS || []).find(key => latex === key.latex || latex === key.write || latex === key.command || latex === key.otherNotation);
|
|
762
|
-
return predefinedKey || additionalkey;
|
|
763
|
-
});
|
|
764
|
-
};
|
|
765
|
-
const {one, two, three, four, five, six, seven, eight, nine, zero, comma, decimalPoint} = digits;
|
|
766
|
-
const baseSet = [[seven, eight, nine, divide], [four, five, six, multiply], [one, two, three, minus], [zero, decimalPoint, comma, plus], [left, right, del, equals]];
|
|
767
|
-
const _$2 = _dll_lodash;
|
|
768
|
-
const sortKeys = keys => {
|
|
769
|
-
_$2.times(5 - keys.length, () => {
|
|
770
|
-
keys.push([]);
|
|
771
|
-
});
|
|
772
|
-
const out = _$2.zip.apply(null, keys);
|
|
773
|
-
return out;
|
|
774
|
-
};
|
|
775
|
-
const registerLineBreak = function (MQ) {
|
|
776
|
-
MQ.registerEmbed('newLine', () => {
|
|
777
|
-
return {
|
|
778
|
-
htmlString: '<div class="newLine"></div>',
|
|
779
|
-
text: () => 'testText',
|
|
780
|
-
latex: () => '\\embed{newLine}[]'
|
|
781
|
-
};
|
|
782
|
-
});
|
|
783
|
-
};
|
|
784
|
-
const React$a = _dll_react;
|
|
785
|
-
const PropTypes$9 = _dll_prop_types;
|
|
786
|
-
const {withStyles: withStyles$7} = _dll_material_ui__core_styles;
|
|
787
|
-
const debug$5 = _dll_debug;
|
|
788
|
-
const classNames$2 = _dll_classnames;
|
|
789
|
-
const MathQuill$3 = _dll_pie_framework__mathquill;
|
|
790
|
-
const _jsxFileName$9 = "/home/circleci/repo/node_modules/@pie-lib/math-input/src/mq/input.jsx";
|
|
791
|
-
let MQ$1;
|
|
792
|
-
if (typeof window !== 'undefined') {
|
|
793
|
-
MQ$1 = MathQuill$3.getInterface(2);
|
|
794
|
-
if (MQ$1 && MQ$1.registerEmbed) {
|
|
795
|
-
registerLineBreak(MQ$1);
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
const log$5 = debug$5('math-input:mq:input');
|
|
799
|
-
class Input extends React$a.Component {
|
|
800
|
-
constructor(...args) {
|
|
801
|
-
super(...args);
|
|
802
|
-
Input.prototype.__init.call(this);
|
|
803
|
-
Input.prototype.__init2.call(this);
|
|
804
|
-
Input.prototype.__init3.call(this);
|
|
805
|
-
}
|
|
806
|
-
static __initStatic() {
|
|
807
|
-
this.propTypes = {
|
|
808
|
-
className: PropTypes$9.string,
|
|
809
|
-
classes: PropTypes$9.object.isRequired,
|
|
810
|
-
onClick: PropTypes$9.func,
|
|
811
|
-
onChange: PropTypes$9.func,
|
|
812
|
-
latex: PropTypes$9.string,
|
|
813
|
-
onFocus: PropTypes$9.func,
|
|
814
|
-
onBlur: PropTypes$9.func
|
|
815
|
-
};
|
|
816
|
-
}
|
|
817
|
-
componentDidMount() {
|
|
818
|
-
if (!MQ$1) {
|
|
819
|
-
throw new Error('MQ is not defined - but component has mounted?');
|
|
820
|
-
}
|
|
821
|
-
this.mathField = MQ$1.MathField(this.input, {
|
|
822
|
-
handlers: {
|
|
823
|
-
edit: this.onInputEdit.bind(this)
|
|
824
|
-
}
|
|
825
|
-
});
|
|
826
|
-
this.updateLatex();
|
|
827
|
-
}
|
|
828
|
-
componentDidUpdate() {
|
|
829
|
-
this.updateLatex();
|
|
830
|
-
}
|
|
831
|
-
updateLatex() {
|
|
832
|
-
if (!this.mathField) {
|
|
833
|
-
return;
|
|
834
|
-
}
|
|
835
|
-
const {latex} = this.props;
|
|
836
|
-
if (latex) {
|
|
837
|
-
this.mathField.latex(latex);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
clear() {
|
|
841
|
-
this.mathField.latex('');
|
|
842
|
-
return '';
|
|
843
|
-
}
|
|
844
|
-
blur() {
|
|
845
|
-
log$5('blur mathfield');
|
|
846
|
-
this.mathField.blur();
|
|
847
|
-
}
|
|
848
|
-
focus() {
|
|
849
|
-
log$5('focus mathfield...');
|
|
850
|
-
this.mathField.focus();
|
|
851
|
-
}
|
|
852
|
-
command(v) {
|
|
853
|
-
log$5('command: ', v);
|
|
854
|
-
if (Array.isArray(v)) {
|
|
855
|
-
v.forEach(vv => {
|
|
856
|
-
this.mathField.cmd(vv);
|
|
857
|
-
});
|
|
858
|
-
} else {
|
|
859
|
-
this.mathField.cmd(v);
|
|
860
|
-
}
|
|
861
|
-
this.mathField.focus();
|
|
862
|
-
return this.mathField.latex();
|
|
863
|
-
}
|
|
864
|
-
keystroke(v) {
|
|
865
|
-
this.mathField.keystroke(v);
|
|
866
|
-
this.mathField.focus();
|
|
867
|
-
return this.mathField.latex();
|
|
868
|
-
}
|
|
869
|
-
write(v) {
|
|
870
|
-
log$5('write: ', v);
|
|
871
|
-
this.mathField.write(v);
|
|
872
|
-
this.mathField.focus();
|
|
873
|
-
return this.mathField.latex();
|
|
874
|
-
}
|
|
875
|
-
__init() {
|
|
876
|
-
this.onInputEdit = () => {
|
|
877
|
-
log$5('[onInputEdit] ...');
|
|
878
|
-
const {onChange} = this.props;
|
|
879
|
-
if (!this.mathField) {
|
|
880
|
-
return;
|
|
881
|
-
}
|
|
882
|
-
if (onChange) {
|
|
883
|
-
onChange(this.mathField.latex());
|
|
884
|
-
}
|
|
885
|
-
};
|
|
886
|
-
}
|
|
887
|
-
__init2() {
|
|
888
|
-
this.refresh = () => {
|
|
889
|
-
this.blur();
|
|
890
|
-
this.focus();
|
|
891
|
-
};
|
|
892
|
-
}
|
|
893
|
-
__init3() {
|
|
894
|
-
this.onKeyPress = event => {
|
|
895
|
-
const keys = Object.keys(this.mathField.__controller.options);
|
|
896
|
-
if (keys.indexOf('ignoreNextMousedown') < 0) {
|
|
897
|
-
this.refresh();
|
|
898
|
-
}
|
|
899
|
-
if (event.charCode === 13) {
|
|
900
|
-
this.write('\\embed{newLine}[]');
|
|
901
|
-
this.onInputEdit();
|
|
902
|
-
}
|
|
903
|
-
};
|
|
904
|
-
}
|
|
905
|
-
shouldComponentUpdate(nextProps) {
|
|
906
|
-
log$5('next: ', nextProps.latex);
|
|
907
|
-
log$5('current: ', this.mathField.latex());
|
|
908
|
-
return nextProps.latex !== this.mathField.latex();
|
|
909
|
-
}
|
|
910
|
-
render() {
|
|
911
|
-
const {onClick, onFocus, onBlur, classes, className} = this.props;
|
|
912
|
-
return React$a.createElement('span', {
|
|
913
|
-
className: classNames$2(classes.input, className),
|
|
914
|
-
onKeyPress: this.onKeyPress,
|
|
915
|
-
onClick: onClick,
|
|
916
|
-
onFocus: onFocus,
|
|
917
|
-
onBlur: onBlur,
|
|
918
|
-
ref: r => this.input = r,
|
|
919
|
-
__self: this,
|
|
920
|
-
__source: {
|
|
921
|
-
fileName: _jsxFileName$9,
|
|
922
|
-
lineNumber: 149
|
|
923
|
-
}
|
|
924
|
-
});
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
Input.__initStatic();
|
|
928
|
-
const styles$5 = () => ({});
|
|
929
|
-
var input = withStyles$7(styles$5)(Input);
|
|
930
|
-
const PropTypes$8 = _dll_prop_types;
|
|
931
|
-
const React$9 = _dll_react;
|
|
932
|
-
const debug$4 = _dll_debug;
|
|
933
|
-
const MathQuill$2 = _dll_pie_framework__mathquill;
|
|
934
|
-
const _jsxFileName$8 = "/home/circleci/repo/node_modules/@pie-lib/math-input/src/mq/static.jsx";
|
|
935
|
-
let MQ;
|
|
936
|
-
if (typeof window !== 'undefined') {
|
|
937
|
-
MQ = MathQuill$2.getInterface(2);
|
|
938
|
-
}
|
|
939
|
-
const log$4 = debug$4('pie-lib:math-input:mq:static');
|
|
940
|
-
const REGEX$1 = /\\MathQuillMathField\[r\d*\]\{(.*?)\}/g;
|
|
941
|
-
const WHITESPACE_REGEX = / /g;
|
|
942
|
-
function stripSpaces(string = '') {
|
|
943
|
-
return string.replace(WHITESPACE_REGEX, '');
|
|
944
|
-
}
|
|
945
|
-
class Static extends React$9.Component {
|
|
946
|
-
constructor(...args) {
|
|
947
|
-
super(...args);
|
|
948
|
-
Static.prototype.__init.call(this);
|
|
949
|
-
}
|
|
950
|
-
static __initStatic() {
|
|
951
|
-
this.propTypes = {
|
|
952
|
-
latex: PropTypes$8.string.isRequired,
|
|
953
|
-
onFocus: PropTypes$8.func,
|
|
954
|
-
onBlur: PropTypes$8.func,
|
|
955
|
-
className: PropTypes$8.string,
|
|
956
|
-
getFieldName: PropTypes$8.func,
|
|
957
|
-
onSubFieldChange: PropTypes$8.func,
|
|
958
|
-
onSubFieldFocus: PropTypes$8.func,
|
|
959
|
-
setInput: PropTypes$8.func
|
|
960
|
-
};
|
|
961
|
-
}
|
|
962
|
-
componentDidMount() {
|
|
963
|
-
this.update();
|
|
964
|
-
updateSpans();
|
|
965
|
-
}
|
|
966
|
-
componentDidUpdate() {
|
|
967
|
-
this.update();
|
|
968
|
-
updateSpans();
|
|
969
|
-
}
|
|
970
|
-
onInputEdit(field) {
|
|
971
|
-
if (!this.mathField) {
|
|
972
|
-
return;
|
|
973
|
-
}
|
|
974
|
-
const name = this.props.getFieldName(field, this.mathField.innerFields);
|
|
975
|
-
if (this.props.onSubFieldChange) {
|
|
976
|
-
this.props.onSubFieldChange(name, field.latex());
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
update() {
|
|
980
|
-
if (!MQ) {
|
|
981
|
-
throw new Error('MQ is not defined - but component has mounted?');
|
|
982
|
-
}
|
|
983
|
-
if (!this.mathField) {
|
|
984
|
-
this.mathField = MQ.StaticMath(this.input, {
|
|
985
|
-
handlers: {
|
|
986
|
-
edit: this.onInputEdit.bind(this)
|
|
987
|
-
}
|
|
988
|
-
});
|
|
989
|
-
}
|
|
990
|
-
try {
|
|
991
|
-
this.mathField.parseLatex(this.props.latex);
|
|
992
|
-
this.mathField.latex(this.props.latex);
|
|
993
|
-
} catch (e) {
|
|
994
|
-
this.mathField.latex('\\MathQuillMathField[r1]{}');
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
blur() {
|
|
998
|
-
log$4('blur mathfield');
|
|
999
|
-
this.mathField.blur();
|
|
1000
|
-
}
|
|
1001
|
-
focus() {
|
|
1002
|
-
log$4('focus mathfield...');
|
|
1003
|
-
this.mathField.focus();
|
|
1004
|
-
}
|
|
1005
|
-
shouldComponentUpdate(nextProps) {
|
|
1006
|
-
try {
|
|
1007
|
-
const parsedLatex = this.mathField.parseLatex(nextProps.latex);
|
|
1008
|
-
const stripped = stripSpaces(parsedLatex);
|
|
1009
|
-
const newFieldCount = (nextProps.latex.match(REGEX$1) || []).length;
|
|
1010
|
-
const out = stripped !== stripSpaces(this.mathField.latex().trim()) || newFieldCount !== Object.keys(this.mathField.innerFields).length / 2;
|
|
1011
|
-
log$4('[shouldComponentUpdate] ', out);
|
|
1012
|
-
return out;
|
|
1013
|
-
} catch (e) {
|
|
1014
|
-
console.warn('Error parsing latex:', e.message, 'skip update');
|
|
1015
|
-
console.warn(e);
|
|
1016
|
-
return false;
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
__init() {
|
|
1020
|
-
this.onFocus = e => {
|
|
1021
|
-
try {
|
|
1022
|
-
let rootBlock = e.target.parentElement.nextSibling;
|
|
1023
|
-
let id = parseInt(rootBlock.getAttribute('mathquill-block-id'), 10);
|
|
1024
|
-
if (!id) {
|
|
1025
|
-
rootBlock = rootBlock.parentElement;
|
|
1026
|
-
id = parseInt(rootBlock.getAttribute('mathquill-block-id'), 10);
|
|
1027
|
-
}
|
|
1028
|
-
const innerField = this.mathField.innerFields.find(f => f.id === id);
|
|
1029
|
-
if (innerField) {
|
|
1030
|
-
const name = this.props.getFieldName(innerField, this.mathField.innerFields);
|
|
1031
|
-
if (this.props.setInput) {
|
|
1032
|
-
this.props.setInput(innerField);
|
|
1033
|
-
}
|
|
1034
|
-
this.props.onSubFieldFocus(name, innerField);
|
|
1035
|
-
}
|
|
1036
|
-
} catch (err) {
|
|
1037
|
-
console.error('error finding root block', err.message);
|
|
1038
|
-
}
|
|
1039
|
-
};
|
|
1040
|
-
}
|
|
1041
|
-
render() {
|
|
1042
|
-
const {onBlur, className} = this.props;
|
|
1043
|
-
return React$9.createElement('span', {
|
|
1044
|
-
className: className,
|
|
1045
|
-
onFocus: this.onFocus,
|
|
1046
|
-
onBlur: onBlur,
|
|
1047
|
-
ref: r => this.input = r,
|
|
1048
|
-
__self: this,
|
|
1049
|
-
__source: {
|
|
1050
|
-
fileName: _jsxFileName$8,
|
|
1051
|
-
lineNumber: 137
|
|
1052
|
-
}
|
|
1053
|
-
});
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
Static.__initStatic();
|
|
1057
|
-
const React$8 = _dll_react;
|
|
1058
|
-
const PropTypes$7 = _dll_prop_types;
|
|
1059
|
-
const {Button: Button$1} = _dll_material_ui__core;
|
|
1060
|
-
const {IconButton: IconButton$1} = _dll_material_ui__core;
|
|
1061
|
-
const {colors: {green: green}} = _dll_material_ui__core;
|
|
1062
|
-
const {withStyles: withStyles$6} = _dll_material_ui__core_styles;
|
|
1063
|
-
const classNames$1 = _dll_classnames;
|
|
1064
|
-
const {lighten: lighten} = _dll_material_ui__core_styles_color_manipulator;
|
|
1065
|
-
const {fade: fade} = _dll_material_ui__core_styles_color_manipulator;
|
|
1066
|
-
const debug$3 = _dll_debug;
|
|
1067
|
-
const _$1 = _dll_lodash;
|
|
1068
|
-
const _jsxFileName$7 = "/home/circleci/repo/node_modules/@pie-lib/math-input/src/keypad/index.jsx";
|
|
1069
|
-
const log$3 = debug$3('pie-lib:math-inline:keypad');
|
|
1070
|
-
const LatexButton = withStyles$6(theme => ({
|
|
1071
|
-
root: {
|
|
1072
|
-
textTransform: 'none',
|
|
1073
|
-
padding: 0,
|
|
1074
|
-
margin: 0,
|
|
1075
|
-
fontSize: '110% !important'
|
|
1076
|
-
},
|
|
1077
|
-
latexButton: {
|
|
1078
|
-
pointerEvents: 'none',
|
|
1079
|
-
textTransform: 'none !important',
|
|
1080
|
-
'& .mq-scaled.mq-sqrt-prefix': {
|
|
1081
|
-
transform: 'scale(1, 0.9) !important'
|
|
1082
|
-
},
|
|
1083
|
-
'& .mq-sup-only .mq-sup': {
|
|
1084
|
-
marginBottom: '0.9px !important'
|
|
1085
|
-
},
|
|
1086
|
-
'& .mq-empty': {
|
|
1087
|
-
backgroundColor: `${fade(theme.palette.secondary.main, 0.4)} !important`
|
|
1088
|
-
},
|
|
1089
|
-
'& .mq-overline .mq-overline-inner': {
|
|
1090
|
-
borderTop: '2px solid black'
|
|
1091
|
-
},
|
|
1092
|
-
'& .mq-overarrow': {
|
|
1093
|
-
width: '30px',
|
|
1094
|
-
marginTop: '0 !important',
|
|
1095
|
-
borderTop: '2px solid black',
|
|
1096
|
-
'&.mq-arrow-both': {
|
|
1097
|
-
'& *': {
|
|
1098
|
-
lineHeight: '1 !important'
|
|
1099
|
-
},
|
|
1100
|
-
'&:before': {
|
|
1101
|
-
fontSize: '80%',
|
|
1102
|
-
left: 'calc(-13%)',
|
|
1103
|
-
top: '-0.25em'
|
|
1104
|
-
},
|
|
1105
|
-
'&:after': {
|
|
1106
|
-
fontSize: '80% !important',
|
|
1107
|
-
right: 'calc(-13%) !important',
|
|
1108
|
-
top: '-1.5em'
|
|
1109
|
-
},
|
|
1110
|
-
'&.mq-empty:before': {
|
|
1111
|
-
fontSize: '80%',
|
|
1112
|
-
left: 'calc(-13%)',
|
|
1113
|
-
top: '-0.25em'
|
|
1114
|
-
},
|
|
1115
|
-
'&.mq-empty:after': {
|
|
1116
|
-
fontSize: '80%',
|
|
1117
|
-
right: 'calc(-13%)',
|
|
1118
|
-
top: '-0.25em'
|
|
1119
|
-
},
|
|
1120
|
-
'&.mq-empty': {
|
|
1121
|
-
minHeight: '1.4em'
|
|
1122
|
-
}
|
|
1123
|
-
},
|
|
1124
|
-
'&.mq-arrow-right:before': {
|
|
1125
|
-
fontSize: '80%',
|
|
1126
|
-
right: 'calc(-13%)',
|
|
1127
|
-
top: '-0.25em'
|
|
1128
|
-
},
|
|
1129
|
-
'& .mq-overarrow-inner': {
|
|
1130
|
-
border: 'none !important'
|
|
1131
|
-
},
|
|
1132
|
-
'& .mq-overarrow-inner .mq-overarrow-inner-right': {
|
|
1133
|
-
display: 'none !important'
|
|
1134
|
-
}
|
|
1135
|
-
},
|
|
1136
|
-
'& .mq-root-block': {
|
|
1137
|
-
padding: '5px'
|
|
1138
|
-
},
|
|
1139
|
-
'& .mq-overarrow.mq-arrow-both.mq-empty:after': {
|
|
1140
|
-
right: '-6px',
|
|
1141
|
-
fontSize: '80% !important',
|
|
1142
|
-
top: '-3px'
|
|
1143
|
-
},
|
|
1144
|
-
'& .mq-overarrow.mq-arrow-right.mq-empty:before': {
|
|
1145
|
-
right: '-5px',
|
|
1146
|
-
fontSize: '80% !important',
|
|
1147
|
-
top: '-3px'
|
|
1148
|
-
},
|
|
1149
|
-
'& .mq-overarrow.mq-arrow-both.mq-empty:before': {
|
|
1150
|
-
left: '-6px',
|
|
1151
|
-
fontSize: '80% !important',
|
|
1152
|
-
top: '-3px'
|
|
1153
|
-
},
|
|
1154
|
-
'& .mq-longdiv-inner': {
|
|
1155
|
-
borderTop: '1px solid !important',
|
|
1156
|
-
paddingTop: '1.5px !important'
|
|
1157
|
-
},
|
|
1158
|
-
'& .mq-parallelogram': {
|
|
1159
|
-
lineHeight: 0.85
|
|
1160
|
-
},
|
|
1161
|
-
'& .mq-overarc': {
|
|
1162
|
-
borderTop: '2px solid black !important',
|
|
1163
|
-
'& .mq-overline-inner': {
|
|
1164
|
-
borderTop: 'none !important',
|
|
1165
|
-
paddingTop: '0 !important'
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
},
|
|
1169
|
-
parallelButton: {
|
|
1170
|
-
fontStyle: 'italic'
|
|
1171
|
-
},
|
|
1172
|
-
leftRightArrowButton: {
|
|
1173
|
-
'& .mq-overarrow.mq-arrow-both': {
|
|
1174
|
-
'& .mq-overline-inner': {
|
|
1175
|
-
borderTop: 'none !important',
|
|
1176
|
-
paddingTop: '0 !important'
|
|
1177
|
-
},
|
|
1178
|
-
'&:after': {
|
|
1179
|
-
top: '-1.64em !important'
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
}))(props => {
|
|
1184
|
-
let buttonClass;
|
|
1185
|
-
if (props.latex === '\\parallel') {
|
|
1186
|
-
buttonClass = classNames$1(props.classes.latexButton, props.mqClassName, props.classes.parallelButton);
|
|
1187
|
-
} else if (props.latex === '\\overleftrightarrow{\\overline{}}') {
|
|
1188
|
-
buttonClass = classNames$1(props.classes.latexButton, props.mqClassName, props.classes.leftRightArrowButton);
|
|
1189
|
-
} else {
|
|
1190
|
-
buttonClass = classNames$1(props.classes.latexButton, props.mqClassName);
|
|
1191
|
-
}
|
|
1192
|
-
try {
|
|
1193
|
-
const MQ = MathQuill.getInterface(2);
|
|
1194
|
-
const span = document.createElement('span');
|
|
1195
|
-
span.innerHTML = '';
|
|
1196
|
-
const mathField = MQ.StaticMath(span);
|
|
1197
|
-
mathField.parseLatex(props.latex);
|
|
1198
|
-
mathField.latex(props.latex);
|
|
1199
|
-
} catch (e) {
|
|
1200
|
-
return React$8.createElement(React$8.Fragment, null);
|
|
1201
|
-
}
|
|
1202
|
-
return React$8.createElement(Button$1, {
|
|
1203
|
-
className: classNames$1(props.classes.root, props.className),
|
|
1204
|
-
onClick: props.onClick,
|
|
1205
|
-
__self: undefined,
|
|
1206
|
-
__source: {
|
|
1207
|
-
fileName: _jsxFileName$7,
|
|
1208
|
-
lineNumber: 163
|
|
1209
|
-
}
|
|
1210
|
-
}, React$8.createElement(Static, {
|
|
1211
|
-
className: buttonClass,
|
|
1212
|
-
latex: props.latex,
|
|
1213
|
-
__self: undefined,
|
|
1214
|
-
__source: {
|
|
1215
|
-
fileName: _jsxFileName$7,
|
|
1216
|
-
lineNumber: 164
|
|
1217
|
-
}
|
|
1218
|
-
}));
|
|
1219
|
-
});
|
|
1220
|
-
class KeyPad extends React$8.Component {
|
|
1221
|
-
constructor(...args) {
|
|
1222
|
-
super(...args);
|
|
1223
|
-
KeyPad.prototype.__init.call(this);
|
|
1224
|
-
KeyPad.prototype.__init2.call(this);
|
|
1225
|
-
KeyPad.prototype.__init3.call(this);
|
|
1226
|
-
}
|
|
1227
|
-
static __initStatic() {
|
|
1228
|
-
this.propTypes = {
|
|
1229
|
-
classes: PropTypes$7.object.isRequired,
|
|
1230
|
-
className: PropTypes$7.string,
|
|
1231
|
-
baseSet: PropTypes$7.array,
|
|
1232
|
-
additionalKeys: PropTypes$7.array,
|
|
1233
|
-
onPress: PropTypes$7.func.isRequired,
|
|
1234
|
-
onFocus: PropTypes$7.func,
|
|
1235
|
-
noDecimal: PropTypes$7.bool,
|
|
1236
|
-
mode: PropTypes$7.string
|
|
1237
|
-
};
|
|
1238
|
-
}
|
|
1239
|
-
static __initStatic2() {
|
|
1240
|
-
this.defaultProps = {
|
|
1241
|
-
baseSet: baseSet,
|
|
1242
|
-
noDecimal: false
|
|
1243
|
-
};
|
|
1244
|
-
}
|
|
1245
|
-
__init() {
|
|
1246
|
-
this.buttonClick = key => {
|
|
1247
|
-
log$3('[buttonClick]', key);
|
|
1248
|
-
const {onPress} = this.props;
|
|
1249
|
-
onPress(key);
|
|
1250
|
-
};
|
|
1251
|
-
}
|
|
1252
|
-
__init2() {
|
|
1253
|
-
this.flowKeys = (base, extras) => {
|
|
1254
|
-
const transposed = [...sortKeys(base), ...sortKeys(extras)];
|
|
1255
|
-
return _$1.flatten(transposed);
|
|
1256
|
-
};
|
|
1257
|
-
}
|
|
1258
|
-
__init3() {
|
|
1259
|
-
this.keyIsNotAllowed = key => {
|
|
1260
|
-
const {noDecimal} = this.props;
|
|
1261
|
-
if ((key.write === '.' && key.label === '.' || key.write === ',' && key.label === ',') && noDecimal) {
|
|
1262
|
-
return true;
|
|
1263
|
-
}
|
|
1264
|
-
return false;
|
|
1265
|
-
};
|
|
1266
|
-
}
|
|
1267
|
-
render() {
|
|
1268
|
-
const {classes, className, baseSet, additionalKeys, onFocus, mode} = this.props;
|
|
1269
|
-
const noBaseSet = ['non-negative-integers', 'integers', 'decimals', 'fractions', 'item-authoring'];
|
|
1270
|
-
const keysWithoutBaseSet = noBaseSet.includes(mode);
|
|
1271
|
-
const allKeys = keysWithoutBaseSet ? this.flowKeys([], additionalKeys || []) : this.flowKeys(baseSet, additionalKeys || []);
|
|
1272
|
-
const shift = allKeys.length % 5 ? 1 : 0;
|
|
1273
|
-
const style = {
|
|
1274
|
-
gridTemplateColumns: `repeat(${Math.floor(allKeys.length / 5) + shift}, minmax(min-content, 150px))`
|
|
1275
|
-
};
|
|
1276
|
-
return React$8.createElement('div', {
|
|
1277
|
-
className: classNames$1(classes.keys, className),
|
|
1278
|
-
style: style,
|
|
1279
|
-
onFocus: onFocus,
|
|
1280
|
-
__self: this,
|
|
1281
|
-
__source: {
|
|
1282
|
-
fileName: _jsxFileName$7,
|
|
1283
|
-
lineNumber: 231
|
|
1284
|
-
}
|
|
1285
|
-
}, allKeys.map((k, index) => {
|
|
1286
|
-
const onClick = this.buttonClick.bind(this, k);
|
|
1287
|
-
if (!k) {
|
|
1288
|
-
return React$8.createElement('span', {
|
|
1289
|
-
key: `empty-${index}`,
|
|
1290
|
-
__self: this,
|
|
1291
|
-
__source: {
|
|
1292
|
-
fileName: _jsxFileName$7,
|
|
1293
|
-
lineNumber: 236
|
|
1294
|
-
}
|
|
1295
|
-
});
|
|
1296
|
-
}
|
|
1297
|
-
const common = {
|
|
1298
|
-
onClick,
|
|
1299
|
-
className: classNames$1(classes.labelButton, !keysWithoutBaseSet && classes[k.category], k.label === ',' && classes.comma, k.label === '.' && classes.dot),
|
|
1300
|
-
disabled: this.keyIsNotAllowed(k),
|
|
1301
|
-
key: `${k.label || k.latex || k.command}-${index}`
|
|
1302
|
-
};
|
|
1303
|
-
if (k.latex) {
|
|
1304
|
-
return React$8.createElement(LatexButton, {
|
|
1305
|
-
latex: k.latex,
|
|
1306
|
-
...common,
|
|
1307
|
-
className: classes.latexButton,
|
|
1308
|
-
__self: this,
|
|
1309
|
-
__source: {
|
|
1310
|
-
fileName: _jsxFileName$7,
|
|
1311
|
-
lineNumber: 252
|
|
1312
|
-
}
|
|
1313
|
-
});
|
|
1314
|
-
}
|
|
1315
|
-
if (k.label) {
|
|
1316
|
-
return React$8.createElement(Button$1, {
|
|
1317
|
-
...common,
|
|
1318
|
-
__self: this,
|
|
1319
|
-
__source: {
|
|
1320
|
-
fileName: _jsxFileName$7,
|
|
1321
|
-
lineNumber: 256
|
|
1322
|
-
}
|
|
1323
|
-
}, k.label);
|
|
1324
|
-
} else {
|
|
1325
|
-
const Icon = k.icon ? k.icon : 'div';
|
|
1326
|
-
return React$8.createElement(IconButton$1, {
|
|
1327
|
-
tabIndex: '-1',
|
|
1328
|
-
...common,
|
|
1329
|
-
__self: this,
|
|
1330
|
-
__source: {
|
|
1331
|
-
fileName: _jsxFileName$7,
|
|
1332
|
-
lineNumber: 261
|
|
1333
|
-
}
|
|
1334
|
-
}, React$8.createElement(Icon, {
|
|
1335
|
-
className: classes.icon,
|
|
1336
|
-
__self: this,
|
|
1337
|
-
__source: {
|
|
1338
|
-
fileName: _jsxFileName$7,
|
|
1339
|
-
lineNumber: 262
|
|
1340
|
-
}
|
|
1341
|
-
}));
|
|
1342
|
-
}
|
|
1343
|
-
}));
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
KeyPad.__initStatic();
|
|
1347
|
-
KeyPad.__initStatic2();
|
|
1348
|
-
const styles$4 = theme => ({
|
|
1349
|
-
keys: {
|
|
1350
|
-
'& *': {
|
|
1351
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
1352
|
-
},
|
|
1353
|
-
width: '100%',
|
|
1354
|
-
display: 'grid',
|
|
1355
|
-
gridTemplateRows: 'repeat(5, minmax(40px, 60px))',
|
|
1356
|
-
gridRowGap: '0px',
|
|
1357
|
-
gridColumnGap: '0px',
|
|
1358
|
-
gridAutoFlow: 'column'
|
|
1359
|
-
},
|
|
1360
|
-
holder: {
|
|
1361
|
-
position: 'relative',
|
|
1362
|
-
width: '100%',
|
|
1363
|
-
height: '100%',
|
|
1364
|
-
backgroundColor: '#cef',
|
|
1365
|
-
borderRadius: 0,
|
|
1366
|
-
padding: `${theme.spacing.unit}px 0 ${theme.spacing.unit}px 0`
|
|
1367
|
-
},
|
|
1368
|
-
labelButton: {
|
|
1369
|
-
minWidth: 'auto',
|
|
1370
|
-
fontSize: '140% !important',
|
|
1371
|
-
backgroundColor: lighten(theme.palette.primary.light, 0.5),
|
|
1372
|
-
'&:hover': {
|
|
1373
|
-
backgroundColor: lighten(theme.palette.primary.light, 0.7)
|
|
1374
|
-
},
|
|
1375
|
-
borderRadius: 0
|
|
1376
|
-
},
|
|
1377
|
-
latexButton: {
|
|
1378
|
-
minWidth: 'auto',
|
|
1379
|
-
borderRadius: 0,
|
|
1380
|
-
backgroundColor: lighten(theme.palette.primary.light, 0.5),
|
|
1381
|
-
'&:hover': {
|
|
1382
|
-
backgroundColor: lighten(theme.palette.primary.light, 0.7)
|
|
1383
|
-
}
|
|
1384
|
-
},
|
|
1385
|
-
base: {},
|
|
1386
|
-
operators: {
|
|
1387
|
-
backgroundColor: lighten(theme.palette.secondary.light, 0.5),
|
|
1388
|
-
'&:hover': {
|
|
1389
|
-
backgroundColor: lighten(theme.palette.secondary.light, 0.7)
|
|
1390
|
-
}
|
|
1391
|
-
},
|
|
1392
|
-
comparison: {
|
|
1393
|
-
backgroundColor: lighten(green[500], 0.5),
|
|
1394
|
-
'&:hover': {
|
|
1395
|
-
backgroundColor: lighten(green[500], 0.7)
|
|
1396
|
-
}
|
|
1397
|
-
},
|
|
1398
|
-
comma: {
|
|
1399
|
-
fontSize: '200% !important',
|
|
1400
|
-
lineHeight: '100%'
|
|
1401
|
-
},
|
|
1402
|
-
dot: {
|
|
1403
|
-
fontSize: '200% !important',
|
|
1404
|
-
lineHeight: '100%'
|
|
1405
|
-
},
|
|
1406
|
-
icon: {
|
|
1407
|
-
height: '30px'
|
|
1408
|
-
}
|
|
1409
|
-
});
|
|
1410
|
-
var Keypad = withStyles$6(styles$4)(KeyPad);
|
|
1411
|
-
const React$7 = _dll_react;
|
|
1412
|
-
const PropTypes$6 = _dll_prop_types;
|
|
1413
|
-
const _jsxFileName$6 = "/home/circleci/repo/node_modules/@pie-lib/math-input/src/horizontal-keypad.jsx";
|
|
1414
|
-
const toOldModel = d => {
|
|
1415
|
-
if (d.command) {
|
|
1416
|
-
return {
|
|
1417
|
-
value: d.command,
|
|
1418
|
-
type: 'command'
|
|
1419
|
-
};
|
|
1420
|
-
} else if (d.write) {
|
|
1421
|
-
return {
|
|
1422
|
-
value: d.write
|
|
1423
|
-
};
|
|
1424
|
-
} else if (d.keystroke) {
|
|
1425
|
-
return {
|
|
1426
|
-
type: 'cursor',
|
|
1427
|
-
value: d.keystroke
|
|
1428
|
-
};
|
|
1429
|
-
}
|
|
1430
|
-
};
|
|
1431
|
-
class HorizontalKeypad extends React$7.Component {
|
|
1432
|
-
constructor(...args) {
|
|
1433
|
-
super(...args);
|
|
1434
|
-
HorizontalKeypad.prototype.__init.call(this);
|
|
1435
|
-
}
|
|
1436
|
-
static __initStatic() {
|
|
1437
|
-
this.propTypes = {
|
|
1438
|
-
className: PropTypes$6.string,
|
|
1439
|
-
mode: PropTypes$6.oneOfType([PropTypes$6.string, PropTypes$6.number]),
|
|
1440
|
-
onClick: PropTypes$6.func.isRequired,
|
|
1441
|
-
onFocus: PropTypes$6.func,
|
|
1442
|
-
noDecimal: PropTypes$6.bool,
|
|
1443
|
-
additionalKeys: PropTypes$6.array
|
|
1444
|
-
};
|
|
1445
|
-
}
|
|
1446
|
-
static __initStatic2() {
|
|
1447
|
-
this.defaultProps = {
|
|
1448
|
-
mode: 'scientific',
|
|
1449
|
-
noDecimal: false,
|
|
1450
|
-
additionalKeys: []
|
|
1451
|
-
};
|
|
1452
|
-
}
|
|
1453
|
-
__init() {
|
|
1454
|
-
this.keypadPress = data => {
|
|
1455
|
-
const {onClick} = this.props;
|
|
1456
|
-
onClick(toOldModel(data));
|
|
1457
|
-
};
|
|
1458
|
-
}
|
|
1459
|
-
render() {
|
|
1460
|
-
const {mode, onFocus, noDecimal, className, additionalKeys} = this.props;
|
|
1461
|
-
const normalizedKeys = normalizeAdditionalKeys(additionalKeys);
|
|
1462
|
-
return React$7.createElement(Keypad, {
|
|
1463
|
-
className: className,
|
|
1464
|
-
onFocus: onFocus,
|
|
1465
|
-
noDecimal: noDecimal,
|
|
1466
|
-
additionalKeys: extendKeySet(keysForGrade(mode), normalizedKeys),
|
|
1467
|
-
onPress: this.keypadPress,
|
|
1468
|
-
mode: mode,
|
|
1469
|
-
__self: this,
|
|
1470
|
-
__source: {
|
|
1471
|
-
fileName: _jsxFileName$6,
|
|
1472
|
-
lineNumber: 44
|
|
1473
|
-
}
|
|
1474
|
-
});
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
HorizontalKeypad.__initStatic();
|
|
1478
|
-
HorizontalKeypad.__initStatic2();
|
|
1479
|
-
const updateSpans = () => {
|
|
1480
|
-
const spans = Array.from(document.querySelectorAll('span[mathquill-command-id]'));
|
|
1481
|
-
(spans || []).forEach(span => {
|
|
1482
|
-
if (span && span.innerText === '∥' && span.className !== 'mq-editable-field') {
|
|
1483
|
-
span.style.fontSize = '32px';
|
|
1484
|
-
}
|
|
1485
|
-
});
|
|
1486
|
-
};
|
|
1487
|
-
const ResponseTypes$1 = {
|
|
1488
|
-
advanced: 'Advanced Multi',
|
|
1489
|
-
simple: 'Simple'
|
|
1490
|
-
};
|
|
1491
|
-
const React$6 = _dll_react;
|
|
1492
|
-
const debug$2 = _dll_debug;
|
|
1493
|
-
const PropTypes$5 = _dll_prop_types;
|
|
1494
|
-
const cx$3 = _dll_classnames;
|
|
1495
|
-
const {Button: Button} = _dll_material_ui__core;
|
|
1496
|
-
const {MenuItem: MenuItem} = _dll_material_ui__core;
|
|
1497
|
-
const {Select: Select} = _dll_material_ui__core;
|
|
1498
|
-
const {withStyles: withStyles$5} = _dll_material_ui__core_styles;
|
|
1499
|
-
const {color: color$2} = _dll_pie_lib__render_ui;
|
|
1500
|
-
const {InputContainer: InputContainer} = _dll_pie_lib__render_ui;
|
|
1501
|
-
const _jsxFileName$5 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/src/editor-and-pad.jsx";
|
|
1502
|
-
const log$2 = debug$2('@pie-lib:math-toolbar:editor-and-pad');
|
|
1503
|
-
const decimalRegex = /\.|,/g;
|
|
1504
|
-
const toNodeData = data => {
|
|
1505
|
-
if (!data) {
|
|
1506
|
-
return;
|
|
1507
|
-
}
|
|
1508
|
-
const {type, value} = data;
|
|
1509
|
-
if (type === 'command' || type === 'cursor') {
|
|
1510
|
-
return data;
|
|
1511
|
-
} else if (type === 'answer') {
|
|
1512
|
-
return {
|
|
1513
|
-
type: 'answer',
|
|
1514
|
-
...data
|
|
1515
|
-
};
|
|
1516
|
-
} else if (value === 'clear') {
|
|
1517
|
-
return {
|
|
1518
|
-
type: 'clear'
|
|
1519
|
-
};
|
|
1520
|
-
} else {
|
|
1521
|
-
return {
|
|
1522
|
-
type: 'write',
|
|
1523
|
-
value
|
|
1524
|
-
};
|
|
1525
|
-
}
|
|
1526
|
-
};
|
|
1527
|
-
class EditorAndPad extends React$6.Component {
|
|
1528
|
-
static __initStatic() {
|
|
1529
|
-
this.propTypes = {
|
|
1530
|
-
classNames: PropTypes$5.object,
|
|
1531
|
-
keypadMode: PropTypes$5.oneOfType([PropTypes$5.string, PropTypes$5.number]),
|
|
1532
|
-
autoFocus: PropTypes$5.bool,
|
|
1533
|
-
allowAnswerBlock: PropTypes$5.bool,
|
|
1534
|
-
showKeypad: PropTypes$5.bool,
|
|
1535
|
-
controlledKeypad: PropTypes$5.bool,
|
|
1536
|
-
controlledKeypadMode: PropTypes$5.bool,
|
|
1537
|
-
noDecimal: PropTypes$5.bool,
|
|
1538
|
-
additionalKeys: PropTypes$5.array,
|
|
1539
|
-
latex: PropTypes$5.string.isRequired,
|
|
1540
|
-
onAnswerBlockAdd: PropTypes$5.func,
|
|
1541
|
-
onFocus: PropTypes$5.func,
|
|
1542
|
-
onBlur: PropTypes$5.func,
|
|
1543
|
-
onChange: PropTypes$5.func.isRequired,
|
|
1544
|
-
classes: PropTypes$5.object
|
|
1545
|
-
};
|
|
1546
|
-
}
|
|
1547
|
-
constructor(props) {
|
|
1548
|
-
super(props);
|
|
1549
|
-
EditorAndPad.prototype.__init.call(this);
|
|
1550
|
-
EditorAndPad.prototype.__init2.call(this);
|
|
1551
|
-
EditorAndPad.prototype.__init3.call(this);
|
|
1552
|
-
EditorAndPad.prototype.__init4.call(this);
|
|
1553
|
-
this.state = {
|
|
1554
|
-
equationEditor: 'item-authoring'
|
|
1555
|
-
};
|
|
1556
|
-
}
|
|
1557
|
-
componentDidMount() {
|
|
1558
|
-
if (this.input && this.props.autoFocus) {
|
|
1559
|
-
this.input.focus();
|
|
1560
|
-
}
|
|
1561
|
-
}
|
|
1562
|
-
__init() {
|
|
1563
|
-
this.onClick = data => {
|
|
1564
|
-
const {noDecimal} = this.props;
|
|
1565
|
-
const c = toNodeData(data);
|
|
1566
|
-
log$2('mathChange: ', c);
|
|
1567
|
-
if (noDecimal && (c.value === '.' || c.value === ',')) {
|
|
1568
|
-
return;
|
|
1569
|
-
}
|
|
1570
|
-
if (c.type === 'clear') {
|
|
1571
|
-
log$2('call clear...');
|
|
1572
|
-
this.input.clear();
|
|
1573
|
-
} else if (c.type === 'command') {
|
|
1574
|
-
this.input.command(c.value);
|
|
1575
|
-
} else if (c.type === 'cursor') {
|
|
1576
|
-
this.input.keystroke(c.value);
|
|
1577
|
-
} else if (c.type === 'answer') {
|
|
1578
|
-
this.input.write('%response%');
|
|
1579
|
-
} else {
|
|
1580
|
-
this.input.write(c.value);
|
|
1581
|
-
}
|
|
1582
|
-
};
|
|
1583
|
-
}
|
|
1584
|
-
__init2() {
|
|
1585
|
-
this.onAnswerBlockClick = () => {
|
|
1586
|
-
this.props.onAnswerBlockAdd();
|
|
1587
|
-
this.onClick({
|
|
1588
|
-
type: 'answer'
|
|
1589
|
-
});
|
|
1590
|
-
};
|
|
1591
|
-
}
|
|
1592
|
-
__init3() {
|
|
1593
|
-
this.onEditorChange = latex => {
|
|
1594
|
-
const {onChange, noDecimal} = this.props;
|
|
1595
|
-
updateSpans();
|
|
1596
|
-
if (noDecimal && (latex.indexOf('.') !== -1 || latex.indexOf(',') !== -1) && this.input) {
|
|
1597
|
-
this.input.clear();
|
|
1598
|
-
this.input.write(latex.replace(decimalRegex, ''));
|
|
1599
|
-
return;
|
|
1600
|
-
}
|
|
1601
|
-
onChange(latex);
|
|
1602
|
-
};
|
|
1603
|
-
}
|
|
1604
|
-
shouldComponentUpdate(nextProps, nextState) {
|
|
1605
|
-
const inputIsDifferent = this.input.mathField.latex() !== nextProps.latex;
|
|
1606
|
-
log$2('[shouldComponentUpdate] ', 'inputIsDifferent: ', inputIsDifferent);
|
|
1607
|
-
if (!inputIsDifferent && this.props.keypadMode !== nextProps.keypadMode) {
|
|
1608
|
-
return true;
|
|
1609
|
-
}
|
|
1610
|
-
if (!inputIsDifferent && this.props.noDecimal !== nextProps.noDecimal) {
|
|
1611
|
-
return true;
|
|
1612
|
-
}
|
|
1613
|
-
if (!inputIsDifferent && this.state.equationEditor !== nextState.equationEditor) {
|
|
1614
|
-
return true;
|
|
1615
|
-
}
|
|
1616
|
-
if (!inputIsDifferent && this.props.controlledKeypad) {
|
|
1617
|
-
return this.props.showKeypad !== nextProps.showKeypad;
|
|
1618
|
-
}
|
|
1619
|
-
return inputIsDifferent;
|
|
1620
|
-
}
|
|
1621
|
-
__init4() {
|
|
1622
|
-
this.onEditorTypeChange = evt => {
|
|
1623
|
-
this.setState({
|
|
1624
|
-
equationEditor: evt.target.value
|
|
1625
|
-
});
|
|
1626
|
-
};
|
|
1627
|
-
}
|
|
1628
|
-
render() {
|
|
1629
|
-
const {classNames, keypadMode, allowAnswerBlock, additionalKeys, controlledKeypad, controlledKeypadMode, showKeypad, noDecimal, latex, onFocus, onBlur, classes} = this.props;
|
|
1630
|
-
const shouldShowKeypad = !controlledKeypad || controlledKeypad && showKeypad;
|
|
1631
|
-
log$2('[render]', latex);
|
|
1632
|
-
return React$6.createElement('div', {
|
|
1633
|
-
className: cx$3(classes.mathToolbar, classNames.mathToolbar),
|
|
1634
|
-
__self: this,
|
|
1635
|
-
__source: {
|
|
1636
|
-
fileName: _jsxFileName$5,
|
|
1637
|
-
lineNumber: 160
|
|
1638
|
-
}
|
|
1639
|
-
}, React$6.createElement('div', {
|
|
1640
|
-
className: classes.inputAndTypeContainer,
|
|
1641
|
-
__self: this,
|
|
1642
|
-
__source: {
|
|
1643
|
-
fileName: _jsxFileName$5,
|
|
1644
|
-
lineNumber: 161
|
|
1645
|
-
}
|
|
1646
|
-
}, controlledKeypadMode && React$6.createElement(InputContainer, {
|
|
1647
|
-
label: "Equation Editor",
|
|
1648
|
-
className: classes.selectContainer,
|
|
1649
|
-
__self: this,
|
|
1650
|
-
__source: {
|
|
1651
|
-
fileName: _jsxFileName$5,
|
|
1652
|
-
lineNumber: 163
|
|
1653
|
-
}
|
|
1654
|
-
}, React$6.createElement(Select, {
|
|
1655
|
-
className: classes.select,
|
|
1656
|
-
onChange: this.onEditorTypeChange,
|
|
1657
|
-
value: this.state.equationEditor,
|
|
1658
|
-
__self: this,
|
|
1659
|
-
__source: {
|
|
1660
|
-
fileName: _jsxFileName$5,
|
|
1661
|
-
lineNumber: 164
|
|
1662
|
-
}
|
|
1663
|
-
}, React$6.createElement(MenuItem, {
|
|
1664
|
-
value: "non-negative-integers",
|
|
1665
|
-
__self: this,
|
|
1666
|
-
__source: {
|
|
1667
|
-
fileName: _jsxFileName$5,
|
|
1668
|
-
lineNumber: 169
|
|
1669
|
-
}
|
|
1670
|
-
}, "Numeric - Non-Negative Integers"), React$6.createElement(MenuItem, {
|
|
1671
|
-
value: "integers",
|
|
1672
|
-
__self: this,
|
|
1673
|
-
__source: {
|
|
1674
|
-
fileName: _jsxFileName$5,
|
|
1675
|
-
lineNumber: 170
|
|
1676
|
-
}
|
|
1677
|
-
}, "Numeric - Integers"), React$6.createElement(MenuItem, {
|
|
1678
|
-
value: "decimals",
|
|
1679
|
-
__self: this,
|
|
1680
|
-
__source: {
|
|
1681
|
-
fileName: _jsxFileName$5,
|
|
1682
|
-
lineNumber: 171
|
|
1683
|
-
}
|
|
1684
|
-
}, "Numeric - Decimals"), React$6.createElement(MenuItem, {
|
|
1685
|
-
value: "fractions",
|
|
1686
|
-
__self: this,
|
|
1687
|
-
__source: {
|
|
1688
|
-
fileName: _jsxFileName$5,
|
|
1689
|
-
lineNumber: 172
|
|
1690
|
-
}
|
|
1691
|
-
}, "Numeric - Fractions"), React$6.createElement(MenuItem, {
|
|
1692
|
-
value: 1,
|
|
1693
|
-
__self: this,
|
|
1694
|
-
__source: {
|
|
1695
|
-
fileName: _jsxFileName$5,
|
|
1696
|
-
lineNumber: 173
|
|
1697
|
-
}
|
|
1698
|
-
}, "Grade 1 - 2"), React$6.createElement(MenuItem, {
|
|
1699
|
-
value: 3,
|
|
1700
|
-
__self: this,
|
|
1701
|
-
__source: {
|
|
1702
|
-
fileName: _jsxFileName$5,
|
|
1703
|
-
lineNumber: 174
|
|
1704
|
-
}
|
|
1705
|
-
}, "Grade 3 - 5"), React$6.createElement(MenuItem, {
|
|
1706
|
-
value: 6,
|
|
1707
|
-
__self: this,
|
|
1708
|
-
__source: {
|
|
1709
|
-
fileName: _jsxFileName$5,
|
|
1710
|
-
lineNumber: 175
|
|
1711
|
-
}
|
|
1712
|
-
}, "Grade 6 - 7"), React$6.createElement(MenuItem, {
|
|
1713
|
-
value: 8,
|
|
1714
|
-
__self: this,
|
|
1715
|
-
__source: {
|
|
1716
|
-
fileName: _jsxFileName$5,
|
|
1717
|
-
lineNumber: 176
|
|
1718
|
-
}
|
|
1719
|
-
}, "Grade 8 - HS"), React$6.createElement(MenuItem, {
|
|
1720
|
-
value: 'geometry',
|
|
1721
|
-
__self: this,
|
|
1722
|
-
__source: {
|
|
1723
|
-
fileName: _jsxFileName$5,
|
|
1724
|
-
lineNumber: 177
|
|
1725
|
-
}
|
|
1726
|
-
}, "Geometry"), React$6.createElement(MenuItem, {
|
|
1727
|
-
value: 'advanced-algebra',
|
|
1728
|
-
__self: this,
|
|
1729
|
-
__source: {
|
|
1730
|
-
fileName: _jsxFileName$5,
|
|
1731
|
-
lineNumber: 178
|
|
1732
|
-
}
|
|
1733
|
-
}, "Advanced Algebra"), React$6.createElement(MenuItem, {
|
|
1734
|
-
value: 'statistics',
|
|
1735
|
-
__self: this,
|
|
1736
|
-
__source: {
|
|
1737
|
-
fileName: _jsxFileName$5,
|
|
1738
|
-
lineNumber: 179
|
|
1739
|
-
}
|
|
1740
|
-
}, "Statistics"), React$6.createElement(MenuItem, {
|
|
1741
|
-
value: 'item-authoring',
|
|
1742
|
-
__self: this,
|
|
1743
|
-
__source: {
|
|
1744
|
-
fileName: _jsxFileName$5,
|
|
1745
|
-
lineNumber: 180
|
|
1746
|
-
}
|
|
1747
|
-
}, "Item Authoring"))), React$6.createElement(input, {
|
|
1748
|
-
onFocus: onFocus,
|
|
1749
|
-
onBlur: onBlur,
|
|
1750
|
-
className: cx$3(classes.mathEditor, classNames.editor, !controlledKeypadMode ? classes.longMathEditor : ''),
|
|
1751
|
-
innerRef: r => this.input = r,
|
|
1752
|
-
latex: latex,
|
|
1753
|
-
onChange: this.onEditorChange,
|
|
1754
|
-
__self: this,
|
|
1755
|
-
__source: {
|
|
1756
|
-
fileName: _jsxFileName$5,
|
|
1757
|
-
lineNumber: 184
|
|
1758
|
-
}
|
|
1759
|
-
})), allowAnswerBlock && React$6.createElement(Button, {
|
|
1760
|
-
className: classes.addAnswerBlockButton,
|
|
1761
|
-
type: "primary",
|
|
1762
|
-
style: {
|
|
1763
|
-
bottom: shouldShowKeypad ? '320px' : '20px'
|
|
1764
|
-
},
|
|
1765
|
-
onClick: this.onAnswerBlockClick,
|
|
1766
|
-
__self: this,
|
|
1767
|
-
__source: {
|
|
1768
|
-
fileName: _jsxFileName$5,
|
|
1769
|
-
lineNumber: 198
|
|
1770
|
-
}
|
|
1771
|
-
}, "+ Response Area"), React$6.createElement('hr', {
|
|
1772
|
-
className: classes.hr,
|
|
1773
|
-
__self: this,
|
|
1774
|
-
__source: {
|
|
1775
|
-
fileName: _jsxFileName$5,
|
|
1776
|
-
lineNumber: 207
|
|
1777
|
-
}
|
|
1778
|
-
}), shouldShowKeypad && React$6.createElement(HorizontalKeypad, {
|
|
1779
|
-
additionalKeys: additionalKeys,
|
|
1780
|
-
mode: controlledKeypadMode ? this.state.equationEditor : keypadMode,
|
|
1781
|
-
onClick: this.onClick,
|
|
1782
|
-
noDecimal: noDecimal,
|
|
1783
|
-
__self: this,
|
|
1784
|
-
__source: {
|
|
1785
|
-
fileName: _jsxFileName$5,
|
|
1786
|
-
lineNumber: 209
|
|
1787
|
-
}
|
|
1788
|
-
}));
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
|
-
EditorAndPad.__initStatic();
|
|
1792
|
-
const styles$3 = theme => ({
|
|
1793
|
-
inputAndTypeContainer: {
|
|
1794
|
-
display: 'flex',
|
|
1795
|
-
alignItems: 'center',
|
|
1796
|
-
'& *': {
|
|
1797
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
1798
|
-
},
|
|
1799
|
-
'& .mq-overarrow.mq-arrow-both': {
|
|
1800
|
-
minWidth: '1.23em',
|
|
1801
|
-
'& *': {
|
|
1802
|
-
lineHeight: '1 !important'
|
|
1803
|
-
},
|
|
1804
|
-
'&:before': {
|
|
1805
|
-
top: '-0.4em',
|
|
1806
|
-
left: '-1px'
|
|
1807
|
-
},
|
|
1808
|
-
'&:after': {
|
|
1809
|
-
top: '-2.36em',
|
|
1810
|
-
right: '-1px'
|
|
1811
|
-
},
|
|
1812
|
-
'&.mq-empty:after': {
|
|
1813
|
-
top: '-0.45em'
|
|
1814
|
-
}
|
|
1815
|
-
},
|
|
1816
|
-
'& .mq-overarrow.mq-arrow-right': {
|
|
1817
|
-
'&:before': {
|
|
1818
|
-
top: '-0.4em',
|
|
1819
|
-
right: '-1px'
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
},
|
|
1823
|
-
selectContainer: {
|
|
1824
|
-
flex: 'initial',
|
|
1825
|
-
width: '25%',
|
|
1826
|
-
minWidth: '100px',
|
|
1827
|
-
marginLeft: '15px',
|
|
1828
|
-
marginTop: '5px',
|
|
1829
|
-
marginBottom: '5px',
|
|
1830
|
-
marginRight: '5px'
|
|
1831
|
-
},
|
|
1832
|
-
mathEditor: {
|
|
1833
|
-
maxWidth: '400px',
|
|
1834
|
-
color: color$2.text(),
|
|
1835
|
-
backgroundColor: color$2.background(),
|
|
1836
|
-
padding: theme.spacing.unit,
|
|
1837
|
-
marginTop: theme.spacing.unit,
|
|
1838
|
-
marginBottom: theme.spacing.unit
|
|
1839
|
-
},
|
|
1840
|
-
longMathEditor: {
|
|
1841
|
-
maxWidth: '500px'
|
|
1842
|
-
},
|
|
1843
|
-
addAnswerBlockButton: {
|
|
1844
|
-
position: 'absolute',
|
|
1845
|
-
right: '12px',
|
|
1846
|
-
border: '1px solid lightgrey'
|
|
1847
|
-
},
|
|
1848
|
-
hr: {
|
|
1849
|
-
padding: 0,
|
|
1850
|
-
margin: 0,
|
|
1851
|
-
height: '1px',
|
|
1852
|
-
border: 'none',
|
|
1853
|
-
borderBottom: `solid 1px ${theme.palette.primary.main}`
|
|
1854
|
-
},
|
|
1855
|
-
mathToolbar: {
|
|
1856
|
-
zIndex: 9,
|
|
1857
|
-
position: 'relative',
|
|
1858
|
-
textAlign: 'center',
|
|
1859
|
-
width: 'auto',
|
|
1860
|
-
'& > .mq-math-mode': {
|
|
1861
|
-
border: 'solid 1px lightgrey'
|
|
1862
|
-
},
|
|
1863
|
-
'& > .mq-focused': {
|
|
1864
|
-
outline: 'none',
|
|
1865
|
-
boxShadow: 'none',
|
|
1866
|
-
border: `dotted 1px ${theme.palette.primary.main}`,
|
|
1867
|
-
borderRadius: '0px'
|
|
1868
|
-
},
|
|
1869
|
-
'& .mq-overarrow-inner': {
|
|
1870
|
-
border: 'none !important',
|
|
1871
|
-
paddingTop: '0 !important'
|
|
1872
|
-
},
|
|
1873
|
-
'& .mq-overarrow-inner-right': {
|
|
1874
|
-
display: 'none !important'
|
|
1875
|
-
},
|
|
1876
|
-
'& .mq-overarrow-inner-left': {
|
|
1877
|
-
display: 'none !important'
|
|
1878
|
-
},
|
|
1879
|
-
'& .mq-longdiv-inner': {
|
|
1880
|
-
borderTop: '1px solid !important',
|
|
1881
|
-
paddingTop: '1.5px !important'
|
|
1882
|
-
},
|
|
1883
|
-
'& .mq-overarrow.mq-arrow-both': {
|
|
1884
|
-
minWidth: '1.23em'
|
|
1885
|
-
},
|
|
1886
|
-
'& .mq-parallelogram': {
|
|
1887
|
-
lineHeight: 0.85
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
});
|
|
1891
|
-
var EditorAndPad$1 = withStyles$5(styles$3)(EditorAndPad);
|
|
1892
|
-
const React$5 = _dll_react;
|
|
1893
|
-
const {IconButton: IconButton} = _dll_material_ui__core;
|
|
1894
|
-
const {Check: Check} = _dll_material_ui__icons;
|
|
1895
|
-
const {withStyles: withStyles$4} = _dll_material_ui__core_styles;
|
|
1896
|
-
const PropTypes$4 = _dll_prop_types;
|
|
1897
|
-
const _jsxFileName$4 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/src/done-button.jsx";
|
|
1898
|
-
const RawDoneButton = ({classes, onClick}) => React$5.createElement(IconButton, {
|
|
1899
|
-
'aria-label': "Done",
|
|
1900
|
-
className: classes.iconRoot,
|
|
1901
|
-
onClick: onClick,
|
|
1902
|
-
classes: {
|
|
1903
|
-
label: classes.label,
|
|
1904
|
-
root: classes.iconRoot
|
|
1905
|
-
},
|
|
1906
|
-
__self: undefined,
|
|
1907
|
-
__source: {
|
|
1908
|
-
fileName: _jsxFileName$4,
|
|
1909
|
-
lineNumber: 9
|
|
1910
|
-
}
|
|
1911
|
-
}, React$5.createElement(Check, {
|
|
1912
|
-
__self: undefined,
|
|
1913
|
-
__source: {
|
|
1914
|
-
fileName: _jsxFileName$4,
|
|
1915
|
-
lineNumber: 18
|
|
1916
|
-
}
|
|
1917
|
-
}));
|
|
1918
|
-
RawDoneButton.propTypes = {
|
|
1919
|
-
classes: PropTypes$4.object.isRequired,
|
|
1920
|
-
onClick: PropTypes$4.func
|
|
1921
|
-
};
|
|
1922
|
-
const styles$2 = {
|
|
1923
|
-
iconRoot: {
|
|
1924
|
-
verticalAlign: 'top',
|
|
1925
|
-
width: '28px',
|
|
1926
|
-
height: '28px',
|
|
1927
|
-
color: '#00bb00'
|
|
1928
|
-
},
|
|
1929
|
-
label: {
|
|
1930
|
-
position: 'absolute',
|
|
1931
|
-
top: '2px'
|
|
1932
|
-
}
|
|
1
|
+
import {_dll_react, _dll_classnames, _dll_material_ui__core_styles, _dll_prop_types, _dll_pie_lib__render_ui, _dll_pie_lib__correct_answer_toggle, _dll_material_ui__core, _dll_lodash, _dll_react_dom, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.17/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__math_toolbar, _dll_pie_lib__math_input, _dll_pie_framework__mathquill} from "../../../@pie-lib/math-edit-module@^1.2.4/module/index.js";
|
|
3
|
+
import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.1.5/module/index.js";
|
|
4
|
+
const ResponseTypes$1 = {
|
|
5
|
+
advanced: 'Advanced Multi',
|
|
6
|
+
simple: 'Simple'
|
|
1933
7
|
};
|
|
1934
|
-
const DoneButton = withStyles$4(styles$2)(RawDoneButton);
|
|
1935
|
-
const React$4 = _dll_react;
|
|
1936
|
-
const classNames = _dll_classnames;
|
|
1937
|
-
const debug$1 = _dll_debug;
|
|
1938
|
-
const {withStyles: withStyles$3} = _dll_material_ui__core_styles;
|
|
1939
|
-
const PropTypes$3 = _dll_prop_types;
|
|
1940
|
-
const _jsxFileName$3 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/src/math-preview.jsx";
|
|
1941
|
-
const log$1 = debug$1('@pie-lib:math-toolbar:math-preview');
|
|
1942
|
-
class RawMathPreview extends React$4.Component {
|
|
1943
|
-
static __initStatic() {
|
|
1944
|
-
this.propTypes = {
|
|
1945
|
-
latex: PropTypes$3.string,
|
|
1946
|
-
node: PropTypes$3.object,
|
|
1947
|
-
classes: PropTypes$3.object,
|
|
1948
|
-
isSelected: PropTypes$3.bool,
|
|
1949
|
-
onFocus: PropTypes$3.func,
|
|
1950
|
-
onBlur: PropTypes$3.func
|
|
1951
|
-
};
|
|
1952
|
-
}
|
|
1953
|
-
render() {
|
|
1954
|
-
log$1('[render] data: ', this.props.node.data);
|
|
1955
|
-
const latex = this.props.node.data.get('latex');
|
|
1956
|
-
const {classes, isSelected, onFocus, onBlur} = this.props;
|
|
1957
|
-
return React$4.createElement('div', {
|
|
1958
|
-
className: classNames(classes.root, isSelected && classes.selected),
|
|
1959
|
-
__self: this,
|
|
1960
|
-
__source: {
|
|
1961
|
-
fileName: _jsxFileName$3,
|
|
1962
|
-
lineNumber: 25
|
|
1963
|
-
}
|
|
1964
|
-
}, ' ', React$4.createElement('span', {
|
|
1965
|
-
className: classes.insideOverlay,
|
|
1966
|
-
__self: this,
|
|
1967
|
-
__source: {
|
|
1968
|
-
fileName: _jsxFileName$3,
|
|
1969
|
-
lineNumber: 27
|
|
1970
|
-
}
|
|
1971
|
-
}), React$4.createElement(Static, {
|
|
1972
|
-
latex: latex,
|
|
1973
|
-
onFocus: onFocus,
|
|
1974
|
-
onBlur: onBlur,
|
|
1975
|
-
__self: this,
|
|
1976
|
-
__source: {
|
|
1977
|
-
fileName: _jsxFileName$3,
|
|
1978
|
-
lineNumber: 28
|
|
1979
|
-
}
|
|
1980
|
-
}));
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
RawMathPreview.__initStatic();
|
|
1984
|
-
const mp = theme => ({
|
|
1985
|
-
root: {
|
|
1986
|
-
display: 'inline-flex',
|
|
1987
|
-
alignItems: 'center',
|
|
1988
|
-
position: 'relative',
|
|
1989
|
-
'& > .mq-math-mode': {
|
|
1990
|
-
border: 'solid 1px lightgrey'
|
|
1991
|
-
},
|
|
1992
|
-
'& > .mq-focused': {
|
|
1993
|
-
outline: 'none',
|
|
1994
|
-
boxShadow: 'none',
|
|
1995
|
-
border: 'solid 1px black',
|
|
1996
|
-
borderRadius: '0px'
|
|
1997
|
-
},
|
|
1998
|
-
'& *': {
|
|
1999
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
2000
|
-
},
|
|
2001
|
-
'& .mq-overarrow-inner': {
|
|
2002
|
-
paddingTop: '0 !important',
|
|
2003
|
-
border: 'none !important'
|
|
2004
|
-
},
|
|
2005
|
-
'& .mq-overarrow.mq-arrow-both': {
|
|
2006
|
-
minWidth: '1.23em',
|
|
2007
|
-
'& *': {
|
|
2008
|
-
lineHeight: '1 !important'
|
|
2009
|
-
},
|
|
2010
|
-
'&:before': {
|
|
2011
|
-
top: '-0.4em',
|
|
2012
|
-
left: '-1px'
|
|
2013
|
-
},
|
|
2014
|
-
'&:after': {
|
|
2015
|
-
top: '-2.36em',
|
|
2016
|
-
right: '-1px'
|
|
2017
|
-
},
|
|
2018
|
-
'&.mq-empty:after': {
|
|
2019
|
-
top: '-0.45em'
|
|
2020
|
-
}
|
|
2021
|
-
},
|
|
2022
|
-
'& .mq-overarrow.mq-arrow-right': {
|
|
2023
|
-
'&:before': {
|
|
2024
|
-
top: '-0.4em',
|
|
2025
|
-
right: '-1px'
|
|
2026
|
-
}
|
|
2027
|
-
},
|
|
2028
|
-
'& .mq-overarrow-inner-right': {
|
|
2029
|
-
display: 'none !important'
|
|
2030
|
-
},
|
|
2031
|
-
'& .mq-overarrow-inner-left': {
|
|
2032
|
-
display: 'none !important'
|
|
2033
|
-
},
|
|
2034
|
-
'& .mq-longdiv-inner': {
|
|
2035
|
-
borderTop: '1px solid !important',
|
|
2036
|
-
paddingTop: '1.5px !important'
|
|
2037
|
-
},
|
|
2038
|
-
'& .mq-parallelogram': {
|
|
2039
|
-
lineHeight: 0.85
|
|
2040
|
-
}
|
|
2041
|
-
},
|
|
2042
|
-
selected: {
|
|
2043
|
-
border: `solid 1px ${theme.palette.primary.main}`,
|
|
2044
|
-
'& > .mq-math-mode': {
|
|
2045
|
-
border: 'solid 0px lightgrey'
|
|
2046
|
-
}
|
|
2047
|
-
},
|
|
2048
|
-
insideOverlay: {
|
|
2049
|
-
position: 'absolute',
|
|
2050
|
-
bottom: 0,
|
|
2051
|
-
left: 0,
|
|
2052
|
-
right: 0,
|
|
2053
|
-
top: 0
|
|
2054
|
-
}
|
|
2055
|
-
});
|
|
2056
|
-
withStyles$3(mp)(RawMathPreview);
|
|
2057
|
-
const React$3 = _dll_react;
|
|
2058
|
-
const PropTypes$2 = _dll_prop_types;
|
|
2059
|
-
const cx$2 = _dll_classnames;
|
|
2060
|
-
const {withStyles: withStyles$2} = _dll_material_ui__core_styles;
|
|
2061
|
-
const _jsxFileName$2 = "/home/circleci/repo/node_modules/@pie-lib/math-toolbar/src/index.jsx";
|
|
2062
|
-
class MathToolbar extends React$3.Component {
|
|
2063
|
-
static __initStatic() {
|
|
2064
|
-
this.propTypes = {
|
|
2065
|
-
autoFocus: PropTypes$2.bool,
|
|
2066
|
-
allowAnswerBlock: PropTypes$2.bool,
|
|
2067
|
-
controlledKeypad: PropTypes$2.bool,
|
|
2068
|
-
controlledKeypadMode: PropTypes$2.bool,
|
|
2069
|
-
keypadMode: PropTypes$2.oneOfType([PropTypes$2.string, PropTypes$2.number]),
|
|
2070
|
-
classNames: PropTypes$2.object,
|
|
2071
|
-
showKeypad: PropTypes$2.bool,
|
|
2072
|
-
noDecimal: PropTypes$2.bool,
|
|
2073
|
-
additionalKeys: PropTypes$2.array,
|
|
2074
|
-
latex: PropTypes$2.string.isRequired,
|
|
2075
|
-
onAnswerBlockAdd: PropTypes$2.func,
|
|
2076
|
-
onChange: PropTypes$2.func,
|
|
2077
|
-
onDone: PropTypes$2.func.isRequired,
|
|
2078
|
-
onFocus: PropTypes$2.func,
|
|
2079
|
-
onBlur: PropTypes$2.func,
|
|
2080
|
-
hideDoneButton: PropTypes$2.bool
|
|
2081
|
-
};
|
|
2082
|
-
}
|
|
2083
|
-
static __initStatic2() {
|
|
2084
|
-
this.defaultProps = {
|
|
2085
|
-
classNames: {},
|
|
2086
|
-
keypadMode: 'item-authoring',
|
|
2087
|
-
autoFocus: false,
|
|
2088
|
-
allowAnswerBlock: false,
|
|
2089
|
-
controlledKeypad: false,
|
|
2090
|
-
controlledKeypadMode: false,
|
|
2091
|
-
noDecimal: false,
|
|
2092
|
-
showKeypad: true,
|
|
2093
|
-
additionalKeys: [],
|
|
2094
|
-
onChange: () => {},
|
|
2095
|
-
onAnswerBlockAdd: () => {},
|
|
2096
|
-
onFocus: () => {},
|
|
2097
|
-
hideDoneButton: false
|
|
2098
|
-
};
|
|
2099
|
-
}
|
|
2100
|
-
constructor(props) {
|
|
2101
|
-
super(props);
|
|
2102
|
-
MathToolbar.prototype.__init.call(this);
|
|
2103
|
-
MathToolbar.prototype.__init2.call(this);
|
|
2104
|
-
this.state = {
|
|
2105
|
-
latex: props.latex
|
|
2106
|
-
};
|
|
2107
|
-
}
|
|
2108
|
-
__init() {
|
|
2109
|
-
this.done = () => {
|
|
2110
|
-
this.props.onDone(this.state.latex);
|
|
2111
|
-
};
|
|
2112
|
-
}
|
|
2113
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
2114
|
-
this.setState({
|
|
2115
|
-
latex: nextProps.latex
|
|
2116
|
-
});
|
|
2117
|
-
}
|
|
2118
|
-
__init2() {
|
|
2119
|
-
this.onChange = latex => {
|
|
2120
|
-
this.setState({
|
|
2121
|
-
latex
|
|
2122
|
-
});
|
|
2123
|
-
this.props.onChange(latex);
|
|
2124
|
-
};
|
|
2125
|
-
}
|
|
2126
|
-
render() {
|
|
2127
|
-
const {latex} = this.state;
|
|
2128
|
-
const {classNames, autoFocus, allowAnswerBlock, onAnswerBlockAdd, controlledKeypad, controlledKeypadMode, keypadMode, noDecimal, additionalKeys, showKeypad, onFocus, onBlur, hideDoneButton} = this.props;
|
|
2129
|
-
return React$3.createElement(PureToolbar, {
|
|
2130
|
-
autoFocus: autoFocus,
|
|
2131
|
-
classNames: classNames,
|
|
2132
|
-
onAnswerBlockAdd: onAnswerBlockAdd,
|
|
2133
|
-
allowAnswerBlock: allowAnswerBlock,
|
|
2134
|
-
latex: latex,
|
|
2135
|
-
additionalKeys: additionalKeys,
|
|
2136
|
-
noDecimal: noDecimal,
|
|
2137
|
-
keypadMode: keypadMode,
|
|
2138
|
-
onChange: this.onChange,
|
|
2139
|
-
onDone: this.done,
|
|
2140
|
-
onFocus: onFocus,
|
|
2141
|
-
onBlur: onBlur,
|
|
2142
|
-
showKeypad: showKeypad,
|
|
2143
|
-
controlledKeypad: controlledKeypad,
|
|
2144
|
-
controlledKeypadMode: controlledKeypadMode,
|
|
2145
|
-
hideDoneButton: hideDoneButton,
|
|
2146
|
-
__self: this,
|
|
2147
|
-
__source: {
|
|
2148
|
-
fileName: _jsxFileName$2,
|
|
2149
|
-
lineNumber: 86
|
|
2150
|
-
}
|
|
2151
|
-
});
|
|
2152
|
-
}
|
|
2153
|
-
}
|
|
2154
|
-
MathToolbar.__initStatic();
|
|
2155
|
-
MathToolbar.__initStatic2();
|
|
2156
|
-
class RawPureToolbar extends React$3.Component {
|
|
2157
|
-
static __initStatic3() {
|
|
2158
|
-
this.propTypes = {
|
|
2159
|
-
classNames: PropTypes$2.object,
|
|
2160
|
-
latex: PropTypes$2.string.isRequired,
|
|
2161
|
-
keypadMode: PropTypes$2.oneOfType([PropTypes$2.string, PropTypes$2.number]),
|
|
2162
|
-
onChange: PropTypes$2.func.isRequired,
|
|
2163
|
-
onDone: PropTypes$2.func.isRequired,
|
|
2164
|
-
onBlur: PropTypes$2.func,
|
|
2165
|
-
onAnswerBlockAdd: PropTypes$2.func,
|
|
2166
|
-
additionalKeys: PropTypes$2.array,
|
|
2167
|
-
onFocus: PropTypes$2.func,
|
|
2168
|
-
classes: PropTypes$2.object.isRequired,
|
|
2169
|
-
autoFocus: PropTypes$2.bool,
|
|
2170
|
-
noDecimal: PropTypes$2.bool,
|
|
2171
|
-
allowAnswerBlock: PropTypes$2.bool,
|
|
2172
|
-
controlledKeypad: PropTypes$2.bool,
|
|
2173
|
-
controlledKeypadMode: PropTypes$2.bool,
|
|
2174
|
-
showKeypad: PropTypes$2.bool,
|
|
2175
|
-
hideDoneButton: PropTypes$2.bool
|
|
2176
|
-
};
|
|
2177
|
-
}
|
|
2178
|
-
render() {
|
|
2179
|
-
const {classNames, autoFocus, allowAnswerBlock, onAnswerBlockAdd, controlledKeypad, controlledKeypadMode, additionalKeys, showKeypad, keypadMode, noDecimal, latex, onChange, onDone, onFocus, onBlur, hideDoneButton, classes} = this.props;
|
|
2180
|
-
return React$3.createElement('div', {
|
|
2181
|
-
className: cx$2(classes.pureToolbar, (classNames || ({})).toolbar),
|
|
2182
|
-
__self: this,
|
|
2183
|
-
__source: {
|
|
2184
|
-
fileName: _jsxFileName$2,
|
|
2185
|
-
lineNumber: 151
|
|
2186
|
-
}
|
|
2187
|
-
}, React$3.createElement('div', {
|
|
2188
|
-
__self: this,
|
|
2189
|
-
__source: {
|
|
2190
|
-
fileName: _jsxFileName$2,
|
|
2191
|
-
lineNumber: 152
|
|
2192
|
-
}
|
|
2193
|
-
}), React$3.createElement(EditorAndPad$1, {
|
|
2194
|
-
autoFocus: autoFocus,
|
|
2195
|
-
keypadMode: keypadMode,
|
|
2196
|
-
classNames: classNames || ({}),
|
|
2197
|
-
controlledKeypad: controlledKeypad,
|
|
2198
|
-
controlledKeypadMode: controlledKeypadMode,
|
|
2199
|
-
noDecimal: noDecimal,
|
|
2200
|
-
showKeypad: showKeypad,
|
|
2201
|
-
additionalKeys: additionalKeys,
|
|
2202
|
-
allowAnswerBlock: allowAnswerBlock,
|
|
2203
|
-
onAnswerBlockAdd: onAnswerBlockAdd,
|
|
2204
|
-
latex: latex,
|
|
2205
|
-
onChange: onChange,
|
|
2206
|
-
onFocus: onFocus,
|
|
2207
|
-
onBlur: onBlur,
|
|
2208
|
-
__self: this,
|
|
2209
|
-
__source: {
|
|
2210
|
-
fileName: _jsxFileName$2,
|
|
2211
|
-
lineNumber: 153
|
|
2212
|
-
}
|
|
2213
|
-
}), (!controlledKeypad || controlledKeypad && showKeypad) && !hideDoneButton && React$3.createElement(DoneButton, {
|
|
2214
|
-
onClick: onDone,
|
|
2215
|
-
__self: this,
|
|
2216
|
-
__source: {
|
|
2217
|
-
fileName: _jsxFileName$2,
|
|
2218
|
-
lineNumber: 170
|
|
2219
|
-
}
|
|
2220
|
-
}));
|
|
2221
|
-
}
|
|
2222
|
-
}
|
|
2223
|
-
RawPureToolbar.__initStatic3();
|
|
2224
|
-
const styles$1 = () => ({
|
|
2225
|
-
pureToolbar: {
|
|
2226
|
-
display: 'flex',
|
|
2227
|
-
width: '100%',
|
|
2228
|
-
zIndex: 8,
|
|
2229
|
-
alignItems: 'center'
|
|
2230
|
-
}
|
|
2231
|
-
});
|
|
2232
|
-
const PureToolbar = withStyles$2(styles$1)(RawPureToolbar);
|
|
2233
8
|
const React$2 = _dll_react;
|
|
2234
9
|
const cx$1 = _dll_classnames;
|
|
2235
10
|
const {withStyles: withStyles$1} = _dll_material_ui__core_styles;
|
|
2236
11
|
const PropTypes$1 = _dll_prop_types;
|
|
2237
12
|
const {color: color$1} = _dll_pie_lib__render_ui;
|
|
13
|
+
const {MathToolbar: MathToolbar} = _dll_pie_lib__math_toolbar;
|
|
14
|
+
const {mq: mq$1} = _dll_pie_lib__math_input;
|
|
2238
15
|
const _jsxFileName$1 = "/home/circleci/repo/packages/math-inline/src/simple-question-block.jsx";
|
|
2239
16
|
class SimpleQuestionBlockRaw extends React$2.Component {
|
|
2240
17
|
constructor(...args) {
|
|
@@ -2298,7 +75,7 @@ class SimpleQuestionBlockRaw extends React$2.Component {
|
|
|
2298
75
|
fileName: _jsxFileName$1,
|
|
2299
76
|
lineNumber: 56
|
|
2300
77
|
}
|
|
2301
|
-
}, React$2.createElement(Static, {
|
|
78
|
+
}, React$2.createElement(mq$1.Static, {
|
|
2302
79
|
latex: showCorrect ? responses && responses.length && responses[0].answer : session.response || '',
|
|
2303
80
|
__self: this,
|
|
2304
81
|
__source: {
|
|
@@ -2385,8 +162,11 @@ const {Tooltip: Tooltip} = _dll_material_ui__core;
|
|
|
2385
162
|
const {isEqual: isEqual} = _dll_lodash;
|
|
2386
163
|
const {isEmpty: isEmpty} = _dll_lodash;
|
|
2387
164
|
const cx = _dll_classnames;
|
|
165
|
+
const {mq: mq} = _dll_pie_lib__math_input;
|
|
166
|
+
const {HorizontalKeypad: HorizontalKeypad} = _dll_pie_lib__math_input;
|
|
167
|
+
const {updateSpans: updateSpans} = _dll_pie_lib__math_input;
|
|
168
|
+
const MathQuill = _dll_pie_framework__mathquill;
|
|
2388
169
|
const {renderMath: renderMath} = _dll_pie_lib__math_rendering;
|
|
2389
|
-
const MathQuill$1 = _dll_pie_framework__mathquill;
|
|
2390
170
|
const _jsxFileName = "/home/circleci/repo/packages/math-inline/src/main.jsx";
|
|
2391
171
|
function _optionalChain(ops) {
|
|
2392
172
|
let lastAccessLHS = undefined;
|
|
@@ -2492,7 +272,7 @@ class Main extends React$1.Component {
|
|
|
2492
272
|
UNSAFE_componentWillMount() {
|
|
2493
273
|
const {classes} = this.props;
|
|
2494
274
|
if (typeof window !== 'undefined') {
|
|
2495
|
-
let MQ = MathQuill
|
|
275
|
+
let MQ = MathQuill.getInterface(2);
|
|
2496
276
|
if (!registered) {
|
|
2497
277
|
MQ.registerEmbed('answerBlock', data => {
|
|
2498
278
|
return {
|
|
@@ -2520,7 +300,7 @@ class Main extends React$1.Component {
|
|
|
2520
300
|
const el = this.root.querySelector(`#${answerId}`);
|
|
2521
301
|
const indexEl = this.root.querySelector(`#${answerId}Index`);
|
|
2522
302
|
if (el) {
|
|
2523
|
-
let MQ = MathQuill
|
|
303
|
+
let MQ = MathQuill.getInterface(2);
|
|
2524
304
|
const answer = answers[answerId];
|
|
2525
305
|
el.textContent = answer && answer.value || '';
|
|
2526
306
|
if (!model.view) ; else {
|
|
@@ -2742,7 +522,7 @@ class Main extends React$1.Component {
|
|
|
2742
522
|
fileName: _jsxFileName,
|
|
2743
523
|
lineNumber: 411
|
|
2744
524
|
}
|
|
2745
|
-
}, React$1.createElement(Static, {
|
|
525
|
+
}, React$1.createElement(mq.Static, {
|
|
2746
526
|
ref: mqStatic => this.mqStatic = mqStatic || this.mqStatic,
|
|
2747
527
|
latex: staticLatex,
|
|
2748
528
|
onSubFieldChange: this.subFieldChanged,
|
|
@@ -2850,7 +630,7 @@ class Main extends React$1.Component {
|
|
|
2850
630
|
fileName: _jsxFileName,
|
|
2851
631
|
lineNumber: 451
|
|
2852
632
|
}
|
|
2853
|
-
}, React$1.createElement(Static, {
|
|
633
|
+
}, React$1.createElement(mq.Static, {
|
|
2854
634
|
ref: mqStatic => this.mqStatic = mqStatic || this.mqStatic,
|
|
2855
635
|
latex: staticLatex,
|
|
2856
636
|
onSubFieldChange: this.subFieldChanged,
|
|
@@ -3308,12 +1088,25 @@ var utils = {};
|
|
|
3308
1088
|
Object.defineProperty(utils, "__esModule", {
|
|
3309
1089
|
value: true
|
|
3310
1090
|
});
|
|
3311
|
-
utils.ResponseTypes = void 0;
|
|
1091
|
+
utils.generateValidationMessage = utils.ResponseTypes = void 0;
|
|
3312
1092
|
var ResponseTypes = {
|
|
3313
1093
|
advanced: 'Advanced Multi',
|
|
3314
1094
|
simple: 'Simple'
|
|
3315
1095
|
};
|
|
3316
1096
|
utils.ResponseTypes = ResponseTypes;
|
|
1097
|
+
var generateValidationMessage = function generateValidationMessage() {
|
|
1098
|
+
var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1099
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1100
|
+
var maxResponseAreas = config.maxResponseAreas;
|
|
1101
|
+
var responseType = model.responseType;
|
|
1102
|
+
var responseAreasMessage = '';
|
|
1103
|
+
var answersMessage = '\nAll correct answers (the primary and any alternates) should not be empty and should be unique.';
|
|
1104
|
+
if (responseType === 'Advanced Multi') {
|
|
1105
|
+
responseAreasMessage = '\nThere should be at least 1 ' + (maxResponseAreas ? ("and at most ").concat(maxResponseAreas, " ") : '') + 'response area' + (maxResponseAreas ? 's' : '') + ' defined.';
|
|
1106
|
+
}
|
|
1107
|
+
return 'Validation requirements:' + answersMessage + responseAreasMessage;
|
|
1108
|
+
};
|
|
1109
|
+
utils.generateValidationMessage = generateValidationMessage;
|
|
3317
1110
|
(function (exports) {
|
|
3318
1111
|
Object.defineProperty(exports, "__esModule", {
|
|
3319
1112
|
value: true
|