@pie-element/graphing-solution-set 1.0.1-next.6591
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.json +1 -0
- package/CHANGELOG.md +4 -0
- package/LICENSE.md +5 -0
- package/README.md +20 -0
- package/configure/CHANGELOG.json +1 -0
- package/configure/CHANGELOG.md +4 -0
- package/configure/lib/configure.js +398 -0
- package/configure/lib/configure.js.map +1 -0
- package/configure/lib/correct-response.js +596 -0
- package/configure/lib/correct-response.js.map +1 -0
- package/configure/lib/defaults.js +359 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/graphing-config.js +435 -0
- package/configure/lib/graphing-config.js.map +1 -0
- package/configure/lib/index.js +218 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/utils.js +754 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +23 -0
- package/controller/CHANGELOG.json +1 -0
- package/controller/CHANGELOG.md +4 -0
- package/controller/lib/defaults.js +71 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +419 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +273 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +23 -0
- package/demo-gss.gif +0 -0
- package/docs/config-schema.json +1564 -0
- package/docs/config-schema.json.md +1114 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +54 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +6 -0
- package/docs/pie-schema.json +969 -0
- package/docs/pie-schema.json.md +509 -0
- package/lib/index.js +203 -0
- package/lib/index.js.map +1 -0
- package/lib/main.js +440 -0
- package/lib/main.js.map +1 -0
- package/lib/utils.js +604 -0
- package/lib/utils.js.map +1 -0
- package/package.json +27 -0
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
Model Object for
|
|
2
|
+
|
|
3
|
+
The schema defines the following properties:
|
|
4
|
+
|
|
5
|
+
# `answers` (object, required)
|
|
6
|
+
|
|
7
|
+
Indicates marks that are set as answers
|
|
8
|
+
|
|
9
|
+
Properties of the `answers` object:
|
|
10
|
+
|
|
11
|
+
## `correctAnswer` (object, required)
|
|
12
|
+
|
|
13
|
+
Properties of the `correctAnswer` object:
|
|
14
|
+
|
|
15
|
+
### `name` (string, required)
|
|
16
|
+
|
|
17
|
+
Indicates name of answer
|
|
18
|
+
|
|
19
|
+
### `marks` (array, required)
|
|
20
|
+
|
|
21
|
+
Indicates marks for the answer
|
|
22
|
+
|
|
23
|
+
Additional restrictions:
|
|
24
|
+
|
|
25
|
+
* Minimum items: `1`
|
|
26
|
+
|
|
27
|
+
# `arrows` (object)
|
|
28
|
+
|
|
29
|
+
Properties of the `arrows` object:
|
|
30
|
+
|
|
31
|
+
## `left` (boolean, required)
|
|
32
|
+
|
|
33
|
+
Indicates if left arrow is enabled
|
|
34
|
+
|
|
35
|
+
## `right` (boolean, required)
|
|
36
|
+
|
|
37
|
+
Indicates if right arrow is enabled
|
|
38
|
+
|
|
39
|
+
## `up` (boolean, required)
|
|
40
|
+
|
|
41
|
+
Indicates if up arrow is enabled
|
|
42
|
+
|
|
43
|
+
## `down` (boolean, required)
|
|
44
|
+
|
|
45
|
+
Indicates if down arrow is enabled
|
|
46
|
+
|
|
47
|
+
# `defaultGridConfiguration` (object, required)
|
|
48
|
+
|
|
49
|
+
# `coordinatesOnHover` (boolean)
|
|
50
|
+
|
|
51
|
+
Indicates if coordinates of a point are displayed on hover
|
|
52
|
+
|
|
53
|
+
# `domain` (object, required)
|
|
54
|
+
|
|
55
|
+
Properties of the `domain` object:
|
|
56
|
+
|
|
57
|
+
## `min` (number, required)
|
|
58
|
+
|
|
59
|
+
Min value
|
|
60
|
+
|
|
61
|
+
## `max` (number, required)
|
|
62
|
+
|
|
63
|
+
Max value
|
|
64
|
+
|
|
65
|
+
## `padding` (number, required)
|
|
66
|
+
|
|
67
|
+
Padding value
|
|
68
|
+
|
|
69
|
+
## `step` (number, required)
|
|
70
|
+
|
|
71
|
+
Step value
|
|
72
|
+
|
|
73
|
+
## `labelStep` (number, required)
|
|
74
|
+
|
|
75
|
+
Label step value
|
|
76
|
+
|
|
77
|
+
## `axisLabel` (string, required)
|
|
78
|
+
|
|
79
|
+
Axis Label
|
|
80
|
+
|
|
81
|
+
# `graph` (object, required)
|
|
82
|
+
|
|
83
|
+
Properties of the `graph` object:
|
|
84
|
+
|
|
85
|
+
## `width` (number, required)
|
|
86
|
+
|
|
87
|
+
Width for graph representation
|
|
88
|
+
|
|
89
|
+
## `height` (number, required)
|
|
90
|
+
|
|
91
|
+
Height for graph representation
|
|
92
|
+
|
|
93
|
+
# `gssLineData` (object, required)
|
|
94
|
+
|
|
95
|
+
Properties of the `gssLineData` object:
|
|
96
|
+
|
|
97
|
+
## `numberOfLines` (number, required)
|
|
98
|
+
|
|
99
|
+
Indicates number of lines for GSS item
|
|
100
|
+
|
|
101
|
+
## `selectedTool` (string, enum, required)
|
|
102
|
+
|
|
103
|
+
Indicates selected tool default is lineA
|
|
104
|
+
|
|
105
|
+
This element must be one of the following enum values:
|
|
106
|
+
|
|
107
|
+
* `lineA`
|
|
108
|
+
* `lineB`
|
|
109
|
+
* `solutionSet`
|
|
110
|
+
|
|
111
|
+
## `sections` (array, required)
|
|
112
|
+
|
|
113
|
+
Indicates array of polygons points formed by intersection of lines drawn
|
|
114
|
+
|
|
115
|
+
Additional restrictions:
|
|
116
|
+
|
|
117
|
+
* Minimum items: `1`
|
|
118
|
+
|
|
119
|
+
## `lineA` (object, required)
|
|
120
|
+
|
|
121
|
+
Properties of the `lineA` object:
|
|
122
|
+
|
|
123
|
+
### `lineType` (string, enum, required)
|
|
124
|
+
|
|
125
|
+
Indicates if line is Solid or Dashed
|
|
126
|
+
|
|
127
|
+
This element must be one of the following enum values:
|
|
128
|
+
|
|
129
|
+
* `Dashed`
|
|
130
|
+
* `Solid`
|
|
131
|
+
|
|
132
|
+
## `lineB` (object, required)
|
|
133
|
+
|
|
134
|
+
Properties of the `lineB` object:
|
|
135
|
+
|
|
136
|
+
### `lineType` (string, enum, required)
|
|
137
|
+
|
|
138
|
+
Indicates if line is Solid or Dashed
|
|
139
|
+
|
|
140
|
+
This element must be one of the following enum values:
|
|
141
|
+
|
|
142
|
+
* `Dashed`
|
|
143
|
+
* `Solid`
|
|
144
|
+
|
|
145
|
+
# `includeAxes` (boolean)
|
|
146
|
+
|
|
147
|
+
Indicates if the graph axes and labels are enabled
|
|
148
|
+
|
|
149
|
+
# `labels` (object)
|
|
150
|
+
|
|
151
|
+
Properties of the `labels` object:
|
|
152
|
+
|
|
153
|
+
## `top` (string, required)
|
|
154
|
+
|
|
155
|
+
Label for top side of the graph
|
|
156
|
+
|
|
157
|
+
## `bottom` (string, required)
|
|
158
|
+
|
|
159
|
+
Label for bottom side of the graph
|
|
160
|
+
|
|
161
|
+
## `left` (string, required)
|
|
162
|
+
|
|
163
|
+
Label for left side of the graph
|
|
164
|
+
|
|
165
|
+
## `right` (string, required)
|
|
166
|
+
|
|
167
|
+
Label for right side of the graph
|
|
168
|
+
|
|
169
|
+
# `language` (string)
|
|
170
|
+
|
|
171
|
+
Indicates the language of the component
|
|
172
|
+
Supported options: en, es, en_US, en-US, es_ES, es-ES, es_MX, es-MX
|
|
173
|
+
|
|
174
|
+
# `padding` (boolean)
|
|
175
|
+
|
|
176
|
+
Indicates if padding is enabled
|
|
177
|
+
|
|
178
|
+
# `prompt` (string)
|
|
179
|
+
|
|
180
|
+
Indicates prompt value
|
|
181
|
+
|
|
182
|
+
# `promptEnabled` (boolean)
|
|
183
|
+
|
|
184
|
+
Indicates if the prompt is enabled
|
|
185
|
+
|
|
186
|
+
# `range` (object, required)
|
|
187
|
+
|
|
188
|
+
Properties of the `range` object:
|
|
189
|
+
|
|
190
|
+
## `min` (number, required)
|
|
191
|
+
|
|
192
|
+
Min value
|
|
193
|
+
|
|
194
|
+
## `max` (number, required)
|
|
195
|
+
|
|
196
|
+
Max value
|
|
197
|
+
|
|
198
|
+
## `padding` (number, required)
|
|
199
|
+
|
|
200
|
+
Padding value
|
|
201
|
+
|
|
202
|
+
## `step` (number, required)
|
|
203
|
+
|
|
204
|
+
Step value
|
|
205
|
+
|
|
206
|
+
## `labelStep` (number, required)
|
|
207
|
+
|
|
208
|
+
Label step value
|
|
209
|
+
|
|
210
|
+
## `axisLabel` (string, required)
|
|
211
|
+
|
|
212
|
+
Axis Label
|
|
213
|
+
|
|
214
|
+
# `rationale` (string)
|
|
215
|
+
|
|
216
|
+
Indicates rationale for the answer
|
|
217
|
+
|
|
218
|
+
# `scoringType` (string)
|
|
219
|
+
|
|
220
|
+
Indicates scoring type
|
|
221
|
+
|
|
222
|
+
# `studentInstructions` (string)
|
|
223
|
+
|
|
224
|
+
Indicates student instructions
|
|
225
|
+
|
|
226
|
+
# `teacherInstructions` (string)
|
|
227
|
+
|
|
228
|
+
Indicates teacher instructions
|
|
229
|
+
|
|
230
|
+
# `title` (string)
|
|
231
|
+
|
|
232
|
+
Indicates graph title
|
|
233
|
+
|
|
234
|
+
# `labelsEnabled` (boolean)
|
|
235
|
+
|
|
236
|
+
Indicates if the graph labels are displayed
|
|
237
|
+
|
|
238
|
+
# `dimensionsEnabled` (boolean)
|
|
239
|
+
|
|
240
|
+
Indicates if the graph dimensions are displayed
|
|
241
|
+
|
|
242
|
+
# `titleEnabled` (boolean)
|
|
243
|
+
|
|
244
|
+
Indicates if the graph title is displayed
|
|
245
|
+
|
|
246
|
+
# `rationaleEnabled` (boolean, required)
|
|
247
|
+
|
|
248
|
+
Indicates if Rationale are enabled
|
|
249
|
+
|
|
250
|
+
# `spellCheckEnabled` (boolean, required)
|
|
251
|
+
|
|
252
|
+
Indicates if spellcheck is enabled for the author. Default value is true
|
|
253
|
+
|
|
254
|
+
# `standardGrid` (boolean)
|
|
255
|
+
|
|
256
|
+
Indicates if some domain values will be synched to the range values
|
|
257
|
+
|
|
258
|
+
# `studentInstructionsEnabled` (boolean, required)
|
|
259
|
+
|
|
260
|
+
Indicates if Student Instructions are enabled
|
|
261
|
+
|
|
262
|
+
# `teacherInstructionsEnabled` (boolean, required)
|
|
263
|
+
|
|
264
|
+
Indicates if Teacher Instructions are enabled
|
|
265
|
+
|
|
266
|
+
# `rubricEnabled` (boolean, required)
|
|
267
|
+
|
|
268
|
+
Indicates if Rubric is enabled
|
|
269
|
+
|
|
270
|
+
# `id` (string, required)
|
|
271
|
+
|
|
272
|
+
Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
|
|
273
|
+
|
|
274
|
+
# `element` (string, required)
|
|
275
|
+
|
|
276
|
+
The html Element tag name
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
# Sub Schemas
|
|
281
|
+
|
|
282
|
+
The schema defines the following additional types:
|
|
283
|
+
|
|
284
|
+
## `Answer` (object)
|
|
285
|
+
|
|
286
|
+
Properties of the `Answer` object:
|
|
287
|
+
|
|
288
|
+
### `name` (string, required)
|
|
289
|
+
|
|
290
|
+
Indicates name of answer
|
|
291
|
+
|
|
292
|
+
### `marks` (array, required)
|
|
293
|
+
|
|
294
|
+
Indicates marks for the answer
|
|
295
|
+
|
|
296
|
+
Additional restrictions:
|
|
297
|
+
|
|
298
|
+
* Minimum items: `1`
|
|
299
|
+
|
|
300
|
+
## `Mark` (object)
|
|
301
|
+
|
|
302
|
+
Properties of the `Mark` object:
|
|
303
|
+
|
|
304
|
+
### `type` (string, required)
|
|
305
|
+
|
|
306
|
+
Indicates type of mark
|
|
307
|
+
|
|
308
|
+
### `showLabel` (boolean)
|
|
309
|
+
|
|
310
|
+
Indicates if label should be visible
|
|
311
|
+
|
|
312
|
+
### `label` (string)
|
|
313
|
+
|
|
314
|
+
Indicates label value for mark
|
|
315
|
+
|
|
316
|
+
### `building` (boolean, required)
|
|
317
|
+
|
|
318
|
+
Indicates if mark is in build process
|
|
319
|
+
|
|
320
|
+
### `x` (number)
|
|
321
|
+
|
|
322
|
+
Indicates x coordinate if type is point
|
|
323
|
+
|
|
324
|
+
### `y` (number)
|
|
325
|
+
|
|
326
|
+
Indicates y coordinate if type is point
|
|
327
|
+
|
|
328
|
+
### `from` (object)
|
|
329
|
+
|
|
330
|
+
Properties of the `from` object:
|
|
331
|
+
|
|
332
|
+
#### `x` (number, required)
|
|
333
|
+
|
|
334
|
+
Indicates x coordinate
|
|
335
|
+
|
|
336
|
+
#### `y` (number, required)
|
|
337
|
+
|
|
338
|
+
Indicates y coordinate
|
|
339
|
+
|
|
340
|
+
### `to` (object)
|
|
341
|
+
|
|
342
|
+
Properties of the `to` object:
|
|
343
|
+
|
|
344
|
+
#### `x` (number, required)
|
|
345
|
+
|
|
346
|
+
Indicates x coordinate
|
|
347
|
+
|
|
348
|
+
#### `y` (number, required)
|
|
349
|
+
|
|
350
|
+
Indicates y coordinate
|
|
351
|
+
|
|
352
|
+
## `Point` (object)
|
|
353
|
+
|
|
354
|
+
Properties of the `Point` object:
|
|
355
|
+
|
|
356
|
+
### `x` (number, required)
|
|
357
|
+
|
|
358
|
+
Indicates x coordinate
|
|
359
|
+
|
|
360
|
+
### `y` (number, required)
|
|
361
|
+
|
|
362
|
+
Indicates y coordinate
|
|
363
|
+
|
|
364
|
+
## `Arrows` (object)
|
|
365
|
+
|
|
366
|
+
Properties of the `Arrows` object:
|
|
367
|
+
|
|
368
|
+
### `left` (boolean, required)
|
|
369
|
+
|
|
370
|
+
Indicates if left arrow is enabled
|
|
371
|
+
|
|
372
|
+
### `right` (boolean, required)
|
|
373
|
+
|
|
374
|
+
Indicates if right arrow is enabled
|
|
375
|
+
|
|
376
|
+
### `up` (boolean, required)
|
|
377
|
+
|
|
378
|
+
Indicates if up arrow is enabled
|
|
379
|
+
|
|
380
|
+
### `down` (boolean, required)
|
|
381
|
+
|
|
382
|
+
Indicates if down arrow is enabled
|
|
383
|
+
|
|
384
|
+
## `Number` (object)
|
|
385
|
+
|
|
386
|
+
## `GraphSettings` (object)
|
|
387
|
+
|
|
388
|
+
Properties of the `GraphSettings` object:
|
|
389
|
+
|
|
390
|
+
### `min` (number, required)
|
|
391
|
+
|
|
392
|
+
Min value
|
|
393
|
+
|
|
394
|
+
### `max` (number, required)
|
|
395
|
+
|
|
396
|
+
Max value
|
|
397
|
+
|
|
398
|
+
### `padding` (number, required)
|
|
399
|
+
|
|
400
|
+
Padding value
|
|
401
|
+
|
|
402
|
+
### `step` (number, required)
|
|
403
|
+
|
|
404
|
+
Step value
|
|
405
|
+
|
|
406
|
+
### `labelStep` (number, required)
|
|
407
|
+
|
|
408
|
+
Label step value
|
|
409
|
+
|
|
410
|
+
### `axisLabel` (string, required)
|
|
411
|
+
|
|
412
|
+
Axis Label
|
|
413
|
+
|
|
414
|
+
## `Graph` (object)
|
|
415
|
+
|
|
416
|
+
Properties of the `Graph` object:
|
|
417
|
+
|
|
418
|
+
### `width` (number, required)
|
|
419
|
+
|
|
420
|
+
Width for graph representation
|
|
421
|
+
|
|
422
|
+
### `height` (number, required)
|
|
423
|
+
|
|
424
|
+
Height for graph representation
|
|
425
|
+
|
|
426
|
+
## `GssLineData` (object)
|
|
427
|
+
|
|
428
|
+
Properties of the `GssLineData` object:
|
|
429
|
+
|
|
430
|
+
### `numberOfLines` (number, required)
|
|
431
|
+
|
|
432
|
+
Indicates number of lines for GSS item
|
|
433
|
+
|
|
434
|
+
### `selectedTool` (string, enum, required)
|
|
435
|
+
|
|
436
|
+
Indicates selected tool default is lineA
|
|
437
|
+
|
|
438
|
+
This element must be one of the following enum values:
|
|
439
|
+
|
|
440
|
+
* `lineA`
|
|
441
|
+
* `lineB`
|
|
442
|
+
* `solutionSet`
|
|
443
|
+
|
|
444
|
+
### `sections` (array, required)
|
|
445
|
+
|
|
446
|
+
Indicates array of polygons points formed by intersection of lines drawn
|
|
447
|
+
|
|
448
|
+
Additional restrictions:
|
|
449
|
+
|
|
450
|
+
* Minimum items: `1`
|
|
451
|
+
|
|
452
|
+
### `lineA` (object, required)
|
|
453
|
+
|
|
454
|
+
Properties of the `lineA` object:
|
|
455
|
+
|
|
456
|
+
#### `lineType` (string, enum, required)
|
|
457
|
+
|
|
458
|
+
Indicates if line is Solid or Dashed
|
|
459
|
+
|
|
460
|
+
This element must be one of the following enum values:
|
|
461
|
+
|
|
462
|
+
* `Dashed`
|
|
463
|
+
* `Solid`
|
|
464
|
+
|
|
465
|
+
### `lineB` (object, required)
|
|
466
|
+
|
|
467
|
+
Properties of the `lineB` object:
|
|
468
|
+
|
|
469
|
+
#### `lineType` (string, enum, required)
|
|
470
|
+
|
|
471
|
+
Indicates if line is Solid or Dashed
|
|
472
|
+
|
|
473
|
+
This element must be one of the following enum values:
|
|
474
|
+
|
|
475
|
+
* `Dashed`
|
|
476
|
+
* `Solid`
|
|
477
|
+
|
|
478
|
+
## `LineType` (object)
|
|
479
|
+
|
|
480
|
+
Properties of the `LineType` object:
|
|
481
|
+
|
|
482
|
+
### `lineType` (string, enum, required)
|
|
483
|
+
|
|
484
|
+
Indicates if line is Solid or Dashed
|
|
485
|
+
|
|
486
|
+
This element must be one of the following enum values:
|
|
487
|
+
|
|
488
|
+
* `Dashed`
|
|
489
|
+
* `Solid`
|
|
490
|
+
|
|
491
|
+
## `Labels` (object)
|
|
492
|
+
|
|
493
|
+
Properties of the `Labels` object:
|
|
494
|
+
|
|
495
|
+
### `top` (string, required)
|
|
496
|
+
|
|
497
|
+
Label for top side of the graph
|
|
498
|
+
|
|
499
|
+
### `bottom` (string, required)
|
|
500
|
+
|
|
501
|
+
Label for bottom side of the graph
|
|
502
|
+
|
|
503
|
+
### `left` (string, required)
|
|
504
|
+
|
|
505
|
+
Label for left side of the graph
|
|
506
|
+
|
|
507
|
+
### `right` (string, required)
|
|
508
|
+
|
|
509
|
+
Label for right side of the graph
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "Component", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _main["default"];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
exports["default"] = void 0;
|
|
15
|
+
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
18
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
20
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
21
|
+
|
|
22
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
+
|
|
24
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
+
|
|
26
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
27
|
+
|
|
28
|
+
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
29
|
+
|
|
30
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
31
|
+
|
|
32
|
+
var _react = _interopRequireDefault(require("react"));
|
|
33
|
+
|
|
34
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
35
|
+
|
|
36
|
+
var _piePlayerEvents = require("@pie-framework/pie-player-events");
|
|
37
|
+
|
|
38
|
+
var _mathRendering = require("@pie-lib/pie-toolbox/math-rendering");
|
|
39
|
+
|
|
40
|
+
var _utils = require("./utils");
|
|
41
|
+
|
|
42
|
+
var _main = _interopRequireDefault(require("./main"));
|
|
43
|
+
|
|
44
|
+
var _lodash = require("lodash");
|
|
45
|
+
|
|
46
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
47
|
+
|
|
48
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
49
|
+
|
|
50
|
+
var Graphing = /*#__PURE__*/function (_HTMLElement) {
|
|
51
|
+
(0, _inherits2["default"])(Graphing, _HTMLElement);
|
|
52
|
+
|
|
53
|
+
var _super = _createSuper(Graphing);
|
|
54
|
+
|
|
55
|
+
function Graphing() {
|
|
56
|
+
var _this;
|
|
57
|
+
|
|
58
|
+
(0, _classCallCheck2["default"])(this, Graphing);
|
|
59
|
+
_this = _super.call(this);
|
|
60
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "isComplete", function (answer) {
|
|
61
|
+
return Array.isArray(answer) && answer.length > 0;
|
|
62
|
+
});
|
|
63
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeAnswers", function (answer, isUndoOperation) {
|
|
64
|
+
// avoid removeInvalidObjects when undo or redo operations are executed
|
|
65
|
+
// in order to preserve the logic of undo and redo
|
|
66
|
+
var gssData = _this._model.gssData;
|
|
67
|
+
|
|
68
|
+
if (gssData.selectedTool === 'lineA' && answer.length > 0) {
|
|
69
|
+
answer[0].fill = gssData['lineA'].lineType;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (gssData.selectedTool === 'lineB' && answer.length > 1) {
|
|
73
|
+
answer[1].fill = gssData['lineB'].lineType;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (answer.length === 0) {
|
|
77
|
+
gssData.selectedTool = 'lineA';
|
|
78
|
+
_this._model.gssData = gssData;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!isUndoOperation) {
|
|
82
|
+
_this._session.answer = (0, _utils.removeInvalidAnswers)(answer);
|
|
83
|
+
} else {
|
|
84
|
+
_this._session.answer = answer;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(_this.tagName.toLowerCase(), _this.isComplete(_this._session.answer)));
|
|
88
|
+
|
|
89
|
+
_this._render();
|
|
90
|
+
});
|
|
91
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setGssData", function (gssData, session) {
|
|
92
|
+
_this._model.gssData = gssData;
|
|
93
|
+
_this._session = session;
|
|
94
|
+
|
|
95
|
+
_this._render();
|
|
96
|
+
});
|
|
97
|
+
return _this;
|
|
98
|
+
}
|
|
99
|
+
/*
|
|
100
|
+
* Function to set model
|
|
101
|
+
* @param {object} m - Model object
|
|
102
|
+
* */
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
(0, _createClass2["default"])(Graphing, [{
|
|
106
|
+
key: "model",
|
|
107
|
+
set: function set(m) {
|
|
108
|
+
var _ref = this._session || {},
|
|
109
|
+
answer = _ref.answer;
|
|
110
|
+
|
|
111
|
+
var section = answer && answer.filter(function (mark) {
|
|
112
|
+
return mark.type === 'polygon';
|
|
113
|
+
}).length > 0;
|
|
114
|
+
this._model = m;
|
|
115
|
+
|
|
116
|
+
if (m.gssLineData.numberOfLines === 1) {
|
|
117
|
+
m.gssData = {
|
|
118
|
+
numberOfLines: 1,
|
|
119
|
+
selectedTool: section ? 'solutionSet' : 'lineA',
|
|
120
|
+
sections: [],
|
|
121
|
+
lineA: {
|
|
122
|
+
lineType: answer && answer.length > 0 ? answer[0].fill : 'Solid'
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
} else {
|
|
126
|
+
m.gssData = {
|
|
127
|
+
numberOfLines: 2,
|
|
128
|
+
selectedTool: section ? 'solutionSet' : 'lineA',
|
|
129
|
+
sections: [],
|
|
130
|
+
lineA: {
|
|
131
|
+
lineType: answer && answer.length > 0 ? answer[0].fill : 'Solid'
|
|
132
|
+
},
|
|
133
|
+
lineB: {
|
|
134
|
+
lineType: answer && answer.length > 1 ? answer[1].fill : 'Solid'
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (section) {
|
|
140
|
+
m.gssData = (0, _utils.findSectionsInSolutionSet)(m.gssData, answer, this._model.domain, this._model.range);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
this._render();
|
|
144
|
+
}
|
|
145
|
+
/*
|
|
146
|
+
* Function to set session
|
|
147
|
+
* @param {object} s - Session object
|
|
148
|
+
* */
|
|
149
|
+
|
|
150
|
+
}, {
|
|
151
|
+
key: "session",
|
|
152
|
+
get:
|
|
153
|
+
/*
|
|
154
|
+
* Function to get session
|
|
155
|
+
* */
|
|
156
|
+
function get() {
|
|
157
|
+
return this._session;
|
|
158
|
+
},
|
|
159
|
+
set: function set(s) {
|
|
160
|
+
this._session = s;
|
|
161
|
+
|
|
162
|
+
this._render();
|
|
163
|
+
}
|
|
164
|
+
}, {
|
|
165
|
+
key: "connectedCallback",
|
|
166
|
+
value: function connectedCallback() {
|
|
167
|
+
this._render();
|
|
168
|
+
}
|
|
169
|
+
/*
|
|
170
|
+
* Is complete function
|
|
171
|
+
* @param {object} answer - Answer object
|
|
172
|
+
* */
|
|
173
|
+
|
|
174
|
+
}, {
|
|
175
|
+
key: "_render",
|
|
176
|
+
value:
|
|
177
|
+
/*
|
|
178
|
+
* Render function
|
|
179
|
+
* */
|
|
180
|
+
function _render() {
|
|
181
|
+
var _this2 = this;
|
|
182
|
+
|
|
183
|
+
if (!this._model || !this._session) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
var el = /*#__PURE__*/_react["default"].createElement(_main["default"], {
|
|
188
|
+
model: this._model,
|
|
189
|
+
session: this._session,
|
|
190
|
+
onAnswersChange: this.changeAnswers,
|
|
191
|
+
setGssData: this.setGssData
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
_reactDom["default"].render(el, this, function () {
|
|
195
|
+
(0, _mathRendering.renderMath)(_this2);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}]);
|
|
199
|
+
return Graphing;
|
|
200
|
+
}( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(HTMLElement));
|
|
201
|
+
|
|
202
|
+
exports["default"] = Graphing;
|
|
203
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["Graphing","answer","Array","isArray","length","isUndoOperation","gssData","_model","selectedTool","fill","lineType","_session","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","isComplete","_render","session","m","section","filter","mark","type","gssLineData","numberOfLines","sections","lineA","lineB","domain","range","s","el","React","createElement","Main","model","onAnswersChange","changeAnswers","setGssData","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;IAIqBA,Q;;;;;AACnB,sBAAc;AAAA;;AAAA;AACZ;AADY,mGAgED,UAACC,MAAD;AAAA,aAAYC,KAAK,CAACC,OAAN,CAAcF,MAAd,KAAyBA,MAAM,CAACG,MAAP,GAAgB,CAArD;AAAA,KAhEC;AAAA,sGAuEE,UAACH,MAAD,EAASI,eAAT,EAA6B;AAC3C;AACA;AACA,UAAQC,OAAR,GAAoB,MAAKC,MAAzB,CAAQD,OAAR;;AACA,UAAIA,OAAO,CAACE,YAAR,KAAyB,OAAzB,IAAoCP,MAAM,CAACG,MAAP,GAAgB,CAAxD,EAA2D;AACzDH,QAAAA,MAAM,CAAC,CAAD,CAAN,CAAUQ,IAAV,GAAiBH,OAAO,CAAC,OAAD,CAAP,CAAiBI,QAAlC;AACD;;A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,QAAL,GAAgBoB,CAAhB;;AACA,WAAKd,OAAL;AACD;;;WASD,6BAAoB;AAClB,WAAKA,OAAL;AACD;AAED;AACF;AACA;AACA;;;;;AA0CE;AACF;AACA;AACE,uBAAU;AAAA;;AACR,UAAI,CAAC,KAAKV,MAAN,IAAgB,CAAC,KAAKI,QAA1B,EAAoC;AAClC;AACD;;AACD,UAAMqB,EAAE,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,QAAAA,KAAK,EAAE,KAAK7B,MADuB;AAEnCW,QAAAA,OAAO,EAAE,KAAKP,QAFqB;AAGnC0B,QAAAA,eAAe,EAAE,KAAKC,aAHa;AAInCC,QAAAA,UAAU,EAAE,KAAKA;AAJkB,OAA1B,CAAX;;AAMAC,2BAASC,MAAT,CAAgBT,EAAhB,EAAoB,IAApB,EAA0B,YAAM;AAC9B,uCAAW,MAAX;AACD,OAFD;AAGD;;;kDA1HmCU,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering';\nimport { findSectionsInSolutionSet, removeInvalidAnswers } from './utils';\nimport Main from './main';\nimport { set } from 'lodash';\n\nexport { Main as Component };\n\nexport default class Graphing extends HTMLElement {\n constructor() {\n super();\n }\n\n /*\n * Function to set model\n * @param {object} m - Model object\n * */\n set model(m) {\n const { answer } = this._session || {};\n let section = answer && answer.filter((mark) => mark.type === 'polygon').length > 0;\n this._model = m;\n if (m.gssLineData.numberOfLines === 1) {\n m.gssData = {\n numberOfLines: 1,\n selectedTool: section ? 'solutionSet' : 'lineA',\n sections: [],\n lineA: {\n lineType: answer && answer.length > 0 ? answer[0].fill : 'Solid',\n },\n };\n } else {\n m.gssData = {\n numberOfLines: 2,\n selectedTool: section ? 'solutionSet' : 'lineA',\n sections: [],\n lineA: {\n lineType: answer && answer.length > 0 ? answer[0].fill : 'Solid',\n },\n lineB: {\n lineType: answer && answer.length > 1 ? answer[1].fill : 'Solid',\n },\n };\n }\n if (section) {\n m.gssData = findSectionsInSolutionSet(m.gssData, answer, this._model.domain, this._model.range);\n }\n this._render();\n }\n\n /*\n * Function to set session\n * @param {object} s - Session object\n * */\n set session(s) {\n this._session = s;\n this._render();\n }\n\n /*\n * Function to get session\n * */\n get session() {\n return this._session;\n }\n\n connectedCallback() {\n this._render();\n }\n\n /*\n * Is complete function\n * @param {object} answer - Answer object\n * */\n isComplete = (answer) => Array.isArray(answer) && answer.length > 0;\n\n /*\n * Callback function to change answers\n * @param {object} answer - Answer object\n * @param {boolean} isUndoOperation - Boolean value to check if undo operation is performed\n * */\n changeAnswers = (answer, isUndoOperation) => {\n // avoid removeInvalidObjects when undo or redo operations are executed\n // in order to preserve the logic of undo and redo\n const { gssData } = this._model;\n if (gssData.selectedTool === 'lineA' && answer.length > 0) {\n answer[0].fill = gssData['lineA'].lineType;\n }\n if (gssData.selectedTool === 'lineB' && answer.length > 1) {\n answer[1].fill = gssData['lineB'].lineType;\n }\n if (answer.length === 0) {\n gssData.selectedTool = 'lineA';\n this._model.gssData = gssData;\n }\n if (!isUndoOperation) {\n this._session.answer = removeInvalidAnswers(answer);\n } else {\n this._session.answer = answer;\n }\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete(this._session.answer)));\n this._render();\n };\n\n /*\n * Function to set gssData object and session object\n * @param {object} gssData - GSS Data object\n * @param {object} session - Session object\n * */\n setGssData = (gssData, session) => {\n this._model.gssData = gssData;\n this._session = session;\n this._render();\n };\n\n /*\n * Render function\n * */\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onAnswersChange: this.changeAnswers,\n setGssData: this.setGssData,\n });\n ReactDOM.render(el, this, () => {\n renderMath(this);\n });\n }\n}\n"],"file":"index.js"}
|