@pie-element/charting 2.7.2 → 2.7.3-next.1008
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 +153 -0
- package/configure/CHANGELOG.md +117 -0
- package/configure/lib/charting-config.js +25 -7
- package/configure/lib/charting-config.js.map +1 -1
- package/configure/lib/configure.js +27 -8
- package/configure/lib/configure.js.map +1 -1
- package/configure/lib/correct-response.js +11 -32
- package/configure/lib/correct-response.js.map +1 -1
- package/configure/lib/defaults.js +16 -4
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +3 -3
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +24 -0
- package/controller/lib/index.js +40 -21
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +79 -0
- package/docs/config-schema.json.md +61 -1
- package/docs/demo/generate.js +6 -20
- package/docs/demo/session.js +3 -9
- package/docs/pie-schema.json +27 -48
- package/docs/pie-schema.json.md +20 -8
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/main.js +12 -23
- package/lib/main.js.map +1 -1
- package/package.json +6 -6
- package/module/configure.js +0 -6102
- package/module/controller.js +0 -18875
- package/module/demo.js +0 -107
- package/module/element.js +0 -5602
- package/module/index.html +0 -16
- package/module/manifest.json +0 -14
package/docs/demo/generate.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
exports.model = (id, element) => ({
|
|
2
2
|
id,
|
|
3
3
|
element,
|
|
4
|
-
|
|
5
4
|
addCategoryEnabled: true,
|
|
6
5
|
categoryDefaultLabel: 'Category',
|
|
7
6
|
chartType: 'bar',
|
|
@@ -10,26 +9,20 @@ exports.model = (id, element) => ({
|
|
|
10
9
|
{
|
|
11
10
|
label: 'A',
|
|
12
11
|
value: 1,
|
|
13
|
-
initial: true,
|
|
14
12
|
interactive: false,
|
|
15
|
-
editable:
|
|
16
|
-
deletable: true
|
|
13
|
+
editable: false
|
|
17
14
|
},
|
|
18
15
|
{
|
|
19
16
|
label: 'B',
|
|
20
17
|
value: 1,
|
|
21
|
-
initial: true,
|
|
22
18
|
interactive: true,
|
|
23
|
-
editable:
|
|
24
|
-
deletable: true
|
|
19
|
+
editable: false
|
|
25
20
|
},
|
|
26
21
|
{
|
|
27
22
|
label: 'C',
|
|
28
23
|
value: 1,
|
|
29
|
-
initial: true,
|
|
30
24
|
interactive: true,
|
|
31
|
-
editable:
|
|
32
|
-
deletable: true
|
|
25
|
+
editable: false
|
|
33
26
|
},
|
|
34
27
|
]
|
|
35
28
|
},
|
|
@@ -37,32 +30,25 @@ exports.model = (id, element) => ({
|
|
|
37
30
|
{
|
|
38
31
|
label: 'A',
|
|
39
32
|
value: 1,
|
|
40
|
-
initial: true,
|
|
41
33
|
interactive: false,
|
|
42
|
-
editable:
|
|
43
|
-
deletable: true
|
|
34
|
+
editable: false
|
|
44
35
|
},
|
|
45
36
|
{
|
|
46
37
|
label: 'B',
|
|
47
38
|
value: 1,
|
|
48
|
-
initial: true,
|
|
49
39
|
interactive: true,
|
|
50
|
-
editable:
|
|
51
|
-
deletable: true
|
|
40
|
+
editable: false
|
|
52
41
|
},
|
|
53
42
|
{
|
|
54
43
|
label: 'D',
|
|
55
44
|
value: 2,
|
|
56
|
-
initial: true,
|
|
57
45
|
interactive: true,
|
|
58
|
-
editable:
|
|
59
|
-
deletable: true
|
|
46
|
+
editable: false
|
|
60
47
|
},
|
|
61
48
|
],
|
|
62
49
|
domain: {
|
|
63
50
|
label: 'Characters',
|
|
64
51
|
},
|
|
65
|
-
editCategoryEnabled: true,
|
|
66
52
|
graph: {
|
|
67
53
|
width: 480,
|
|
68
54
|
height: 480
|
package/docs/demo/session.js
CHANGED
|
@@ -6,26 +6,20 @@ module.exports = [
|
|
|
6
6
|
// {
|
|
7
7
|
// label: 'A',
|
|
8
8
|
// value: 1,
|
|
9
|
-
// initial: true,
|
|
10
9
|
// interactive: false,
|
|
11
|
-
// editable: true
|
|
12
|
-
// deletable: true
|
|
10
|
+
// editable: true
|
|
13
11
|
// },
|
|
14
12
|
// {
|
|
15
13
|
// label: 'B',
|
|
16
14
|
// value: 1,
|
|
17
|
-
// initial: true,
|
|
18
15
|
// interactive: true,
|
|
19
|
-
// editable: true
|
|
20
|
-
// deletable: true
|
|
16
|
+
// editable: true
|
|
21
17
|
// },
|
|
22
18
|
// {
|
|
23
19
|
// label: 'C',
|
|
24
20
|
// value: 1,
|
|
25
|
-
// initial: true,
|
|
26
21
|
// interactive: true,
|
|
27
|
-
// editable: true
|
|
28
|
-
// deletable: true
|
|
22
|
+
// editable: true
|
|
29
23
|
// }
|
|
30
24
|
// ]
|
|
31
25
|
},
|
package/docs/pie-schema.json
CHANGED
|
@@ -52,11 +52,6 @@
|
|
|
52
52
|
"type": "number",
|
|
53
53
|
"title": "value"
|
|
54
54
|
},
|
|
55
|
-
"initial": {
|
|
56
|
-
"description": "Indicates if category is default category",
|
|
57
|
-
"type": "boolean",
|
|
58
|
-
"title": "initial"
|
|
59
|
-
},
|
|
60
55
|
"interactive": {
|
|
61
56
|
"description": "Indicates if category label & value are interactive",
|
|
62
57
|
"type": "boolean",
|
|
@@ -104,7 +99,6 @@
|
|
|
104
99
|
"correctness",
|
|
105
100
|
"deletable",
|
|
106
101
|
"editable",
|
|
107
|
-
"initial",
|
|
108
102
|
"interactive",
|
|
109
103
|
"label",
|
|
110
104
|
"value"
|
|
@@ -128,11 +122,6 @@
|
|
|
128
122
|
"type": "number",
|
|
129
123
|
"title": "value"
|
|
130
124
|
},
|
|
131
|
-
"initial": {
|
|
132
|
-
"description": "Indicates if category is default category",
|
|
133
|
-
"type": "boolean",
|
|
134
|
-
"title": "initial"
|
|
135
|
-
},
|
|
136
125
|
"interactive": {
|
|
137
126
|
"description": "Indicates if category label & value are interactive",
|
|
138
127
|
"type": "boolean",
|
|
@@ -180,7 +169,6 @@
|
|
|
180
169
|
"correctness",
|
|
181
170
|
"deletable",
|
|
182
171
|
"editable",
|
|
183
|
-
"initial",
|
|
184
172
|
"interactive",
|
|
185
173
|
"label",
|
|
186
174
|
"value"
|
|
@@ -214,11 +202,6 @@
|
|
|
214
202
|
"type": "number",
|
|
215
203
|
"title": "value"
|
|
216
204
|
},
|
|
217
|
-
"initial": {
|
|
218
|
-
"description": "Indicates if category is default category",
|
|
219
|
-
"type": "boolean",
|
|
220
|
-
"title": "initial"
|
|
221
|
-
},
|
|
222
205
|
"interactive": {
|
|
223
206
|
"description": "Indicates if category label & value are interactive",
|
|
224
207
|
"type": "boolean",
|
|
@@ -266,7 +249,6 @@
|
|
|
266
249
|
"correctness",
|
|
267
250
|
"deletable",
|
|
268
251
|
"editable",
|
|
269
|
-
"initial",
|
|
270
252
|
"interactive",
|
|
271
253
|
"label",
|
|
272
254
|
"value"
|
|
@@ -290,11 +272,6 @@
|
|
|
290
272
|
"type": "number",
|
|
291
273
|
"title": "value"
|
|
292
274
|
},
|
|
293
|
-
"initial": {
|
|
294
|
-
"description": "Indicates if category is default category",
|
|
295
|
-
"type": "boolean",
|
|
296
|
-
"title": "initial"
|
|
297
|
-
},
|
|
298
275
|
"interactive": {
|
|
299
276
|
"description": "Indicates if category label & value are interactive",
|
|
300
277
|
"type": "boolean",
|
|
@@ -342,7 +319,6 @@
|
|
|
342
319
|
"correctness",
|
|
343
320
|
"deletable",
|
|
344
321
|
"editable",
|
|
345
|
-
"initial",
|
|
346
322
|
"interactive",
|
|
347
323
|
"label",
|
|
348
324
|
"value"
|
|
@@ -390,11 +366,6 @@
|
|
|
390
366
|
"step"
|
|
391
367
|
]
|
|
392
368
|
},
|
|
393
|
-
"editCategoryEnabled": {
|
|
394
|
-
"description": "Indicates if user can edit default categories",
|
|
395
|
-
"type": "boolean",
|
|
396
|
-
"title": "editCategoryEnabled"
|
|
397
|
-
},
|
|
398
369
|
"graph": {
|
|
399
370
|
"title": "Chart",
|
|
400
371
|
"type": "object",
|
|
@@ -497,6 +468,11 @@
|
|
|
497
468
|
"type": "boolean",
|
|
498
469
|
"title": "rationaleEnabled"
|
|
499
470
|
},
|
|
471
|
+
"spellCheckEnabled": {
|
|
472
|
+
"description": "Indicates if spellcheck is enabled for the author. Default value is true",
|
|
473
|
+
"type": "boolean",
|
|
474
|
+
"title": "spellCheckEnabled"
|
|
475
|
+
},
|
|
500
476
|
"studentInstructionsEnabled": {
|
|
501
477
|
"description": "Indicates if Student Instructions are enabled",
|
|
502
478
|
"type": "boolean",
|
|
@@ -525,12 +501,12 @@
|
|
|
525
501
|
"correctAnswer",
|
|
526
502
|
"data",
|
|
527
503
|
"domain",
|
|
528
|
-
"editCategoryEnabled",
|
|
529
504
|
"element",
|
|
530
505
|
"graph",
|
|
531
506
|
"id",
|
|
532
507
|
"range",
|
|
533
508
|
"rationaleEnabled",
|
|
509
|
+
"spellCheckEnabled",
|
|
534
510
|
"studentInstructionsEnabled",
|
|
535
511
|
"teacherInstructionsEnabled"
|
|
536
512
|
],
|
|
@@ -572,6 +548,27 @@
|
|
|
572
548
|
}
|
|
573
549
|
}
|
|
574
550
|
},
|
|
551
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
552
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
553
|
+
"type": "object",
|
|
554
|
+
"properties": {
|
|
555
|
+
"teacherInstructions": {
|
|
556
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
557
|
+
"type": "number",
|
|
558
|
+
"title": "teacherInstructions"
|
|
559
|
+
},
|
|
560
|
+
"prompt": {
|
|
561
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
562
|
+
"type": "number",
|
|
563
|
+
"title": "prompt"
|
|
564
|
+
},
|
|
565
|
+
"rationale": {
|
|
566
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
567
|
+
"type": "number",
|
|
568
|
+
"title": "rationale"
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
},
|
|
575
572
|
"Answer": {
|
|
576
573
|
"title": "Answer",
|
|
577
574
|
"type": "object",
|
|
@@ -599,11 +596,6 @@
|
|
|
599
596
|
"type": "number",
|
|
600
597
|
"title": "value"
|
|
601
598
|
},
|
|
602
|
-
"initial": {
|
|
603
|
-
"description": "Indicates if category is default category",
|
|
604
|
-
"type": "boolean",
|
|
605
|
-
"title": "initial"
|
|
606
|
-
},
|
|
607
599
|
"interactive": {
|
|
608
600
|
"description": "Indicates if category label & value are interactive",
|
|
609
601
|
"type": "boolean",
|
|
@@ -651,7 +643,6 @@
|
|
|
651
643
|
"correctness",
|
|
652
644
|
"deletable",
|
|
653
645
|
"editable",
|
|
654
|
-
"initial",
|
|
655
646
|
"interactive",
|
|
656
647
|
"label",
|
|
657
648
|
"value"
|
|
@@ -675,11 +666,6 @@
|
|
|
675
666
|
"type": "number",
|
|
676
667
|
"title": "value"
|
|
677
668
|
},
|
|
678
|
-
"initial": {
|
|
679
|
-
"description": "Indicates if category is default category",
|
|
680
|
-
"type": "boolean",
|
|
681
|
-
"title": "initial"
|
|
682
|
-
},
|
|
683
669
|
"interactive": {
|
|
684
670
|
"description": "Indicates if category label & value are interactive",
|
|
685
671
|
"type": "boolean",
|
|
@@ -727,7 +713,6 @@
|
|
|
727
713
|
"correctness",
|
|
728
714
|
"deletable",
|
|
729
715
|
"editable",
|
|
730
|
-
"initial",
|
|
731
716
|
"interactive",
|
|
732
717
|
"label",
|
|
733
718
|
"value"
|
|
@@ -757,11 +742,6 @@
|
|
|
757
742
|
"type": "number",
|
|
758
743
|
"title": "value"
|
|
759
744
|
},
|
|
760
|
-
"initial": {
|
|
761
|
-
"description": "Indicates if category is default category",
|
|
762
|
-
"type": "boolean",
|
|
763
|
-
"title": "initial"
|
|
764
|
-
},
|
|
765
745
|
"interactive": {
|
|
766
746
|
"description": "Indicates if category label & value are interactive",
|
|
767
747
|
"type": "boolean",
|
|
@@ -809,7 +789,6 @@
|
|
|
809
789
|
"correctness",
|
|
810
790
|
"deletable",
|
|
811
791
|
"editable",
|
|
812
|
-
"initial",
|
|
813
792
|
"interactive",
|
|
814
793
|
"label",
|
|
815
794
|
"value"
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -69,10 +69,6 @@ Label step value
|
|
|
69
69
|
|
|
70
70
|
Axis Label
|
|
71
71
|
|
|
72
|
-
# `editCategoryEnabled` (boolean, required)
|
|
73
|
-
|
|
74
|
-
Indicates if user can edit default categories
|
|
75
|
-
|
|
76
72
|
# `graph` (object, required)
|
|
77
73
|
|
|
78
74
|
Properties of the `graph` object:
|
|
@@ -146,6 +142,10 @@ Indicates chart title
|
|
|
146
142
|
|
|
147
143
|
Indicates if Rationale are enabled
|
|
148
144
|
|
|
145
|
+
# `spellCheckEnabled` (boolean, required)
|
|
146
|
+
|
|
147
|
+
Indicates if spellcheck is enabled for the author. Default value is true
|
|
148
|
+
|
|
149
149
|
# `studentInstructionsEnabled` (boolean, required)
|
|
150
150
|
|
|
151
151
|
Indicates if Student Instructions are enabled
|
|
@@ -197,6 +197,22 @@ Indicates the label for the item that has to be displayed in the Settings Panel
|
|
|
197
197
|
Indicates the value of the item if it affects config-ui
|
|
198
198
|
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
199
199
|
|
|
200
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
201
|
+
|
|
202
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
203
|
+
|
|
204
|
+
### `teacherInstructions` (number)
|
|
205
|
+
|
|
206
|
+
Indicates the max dimension for images in teacher instructions
|
|
207
|
+
|
|
208
|
+
### `prompt` (number)
|
|
209
|
+
|
|
210
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
211
|
+
|
|
212
|
+
### `rationale` (number)
|
|
213
|
+
|
|
214
|
+
Indicates the max dimension for images in rationale
|
|
215
|
+
|
|
200
216
|
## `Answer` (object)
|
|
201
217
|
|
|
202
218
|
Properties of the `Answer` object:
|
|
@@ -225,10 +241,6 @@ Indicates category label
|
|
|
225
241
|
|
|
226
242
|
Indicates category value
|
|
227
243
|
|
|
228
|
-
### `initial` (boolean, required)
|
|
229
|
-
|
|
230
|
-
Indicates if category is default category
|
|
231
|
-
|
|
232
244
|
### `interactive` (boolean, required)
|
|
233
245
|
|
|
234
246
|
Indicates if category label & value are interactive
|
package/lib/index.js
CHANGED
|
@@ -41,7 +41,7 @@ var _mathRendering = require("@pie-lib/math-rendering");
|
|
|
41
41
|
|
|
42
42
|
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); }; }
|
|
43
43
|
|
|
44
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
44
|
+
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; } }
|
|
45
45
|
|
|
46
46
|
var Graphing = /*#__PURE__*/function (_HTMLElement) {
|
|
47
47
|
(0, _inherits2["default"])(Graphing, _HTMLElement);
|
|
@@ -75,6 +75,9 @@ var Graphing = /*#__PURE__*/function (_HTMLElement) {
|
|
|
75
75
|
}
|
|
76
76
|
}, {
|
|
77
77
|
key: "session",
|
|
78
|
+
get: function get() {
|
|
79
|
+
return this._session;
|
|
80
|
+
},
|
|
78
81
|
set: function set(s) {
|
|
79
82
|
this._session = s;
|
|
80
83
|
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["Graphing","answer","Array","isArray","length","_session","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","isComplete","_render","m","_model","s","el","React","createElement","Main","model","categories","onAnswersChange","changeAnswers","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;IAIqBA,Q;;;;;AACnB,sBAAc;AAAA;;AAAA;AACZ;AADY,
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["Graphing","answer","Array","isArray","length","_session","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","isComplete","_render","m","_model","s","el","React","createElement","Main","model","categories","onAnswersChange","changeAnswers","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;IAIqBA,Q;;;;;AACnB,sBAAc;AAAA;;AAAA;AACZ;AADY,mGAsBD,UAAAC,MAAM;AAAA,aAAIC,KAAK,CAACC,OAAN,CAAcF,MAAd,KAAyBA,MAAM,CAACG,MAAP,GAAgB,CAA7C;AAAA,KAtBL;AAAA,sGAwBE,UAAAH,MAAM,EAAI;AACxB,YAAKI,QAAL,CAAcJ,MAAd,GAAuBA,MAAvB;;AAEA,YAAKK,aAAL,CACE,IAAIC,oCAAJ,CACE,MAAKC,OAAL,CAAaC,WAAb,EADF,EAEE,MAAKC,UAAL,CAAgB,MAAKL,QAAL,CAAcJ,MAA9B,CAFF,CADF;;AAOA,YAAKU,OAAL;AACD,KAnCa;AAAA;AAEb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKC,MAAL,GAAcD,CAAd;;AACA,WAAKD,OAAL;AACD;;;SAOD,eAAc;AACZ,aAAO,KAAKN,QAAZ;AACD,K;SAPD,aAAYS,CAAZ,EAAe;AACb,WAAKT,QAAL,GAAgBS,CAAhB;;AACA,WAAKH,OAAL;AACD;;;WAMD,6BAAoB;AAClB,WAAKA,OAAL;AACD;;;WAiBD,mBAAU;AAAA;;AACR,UAAI,CAAC,KAAKE,MAAN,IAAgB,CAAC,KAAKR,QAA1B,EAAoC;AAClC;AACD;;AAED,UAAMU,EAAE,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,QAAAA,KAAK,EAAE,KAAKN,MADuB;AAEnCO,QAAAA,UAAU,EAAE,KAAKf,QAAL,CAAcJ,MAFS;AAGnCoB,QAAAA,eAAe,EAAE,KAAKC;AAHa,OAA1B,CAAX;;AAMAC,2BAASC,MAAT,CAAgBT,EAAhB,EAAoB,IAApB,EAA0B,YAAM;AAC9B,uCAAW,MAAX;AACD,OAFD;AAGD;;;kDApDmCU,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Main from './main';\nimport { SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nexport { Main as Component };\n\nexport default class Graphing extends HTMLElement {\n constructor() {\n super();\n }\n\n set model(m) {\n this._model = m;\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n connectedCallback() {\n this._render();\n }\n\n isComplete = answer => Array.isArray(answer) && answer.length > 0;\n\n changeAnswers = answer => {\n this._session.answer = answer;\n\n this.dispatchEvent(\n new SessionChangedEvent(\n this.tagName.toLowerCase(),\n this.isComplete(this._session.answer)\n )\n );\n\n this._render();\n };\n\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n\n const el = React.createElement(Main, {\n model: this._model,\n categories: this._session.answer,\n onAnswersChange: this.changeAnswers\n });\n\n ReactDOM.render(el, this, () => {\n renderMath(this);\n });\n }\n}\n"],"file":"index.js"}
|
package/lib/main.js
CHANGED
|
@@ -35,13 +35,13 @@ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
|
35
35
|
|
|
36
36
|
var _correctAnswerToggle = _interopRequireDefault(require("@pie-lib/correct-answer-toggle"));
|
|
37
37
|
|
|
38
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
38
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
39
39
|
|
|
40
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
40
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
41
41
|
|
|
42
42
|
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); }; }
|
|
43
43
|
|
|
44
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
44
|
+
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; } }
|
|
45
45
|
|
|
46
46
|
var Main = /*#__PURE__*/function (_React$Component) {
|
|
47
47
|
(0, _inherits2["default"])(Main, _React$Component);
|
|
@@ -106,7 +106,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
106
106
|
domain = model.domain,
|
|
107
107
|
range = model.range,
|
|
108
108
|
title = model.title,
|
|
109
|
-
editCategoryEnabled = model.editCategoryEnabled,
|
|
110
109
|
addCategoryEnabled = model.addCategoryEnabled,
|
|
111
110
|
categoryDefaultLabel = model.categoryDefaultLabel,
|
|
112
111
|
rationale = model.rationale,
|
|
@@ -130,15 +129,11 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
130
129
|
hidden: 'Show Teacher Instructions',
|
|
131
130
|
visible: 'Hide Teacher Instructions'
|
|
132
131
|
}
|
|
133
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
className: classes.prompt,
|
|
139
|
-
dangerouslySetInnerHTML: {
|
|
140
|
-
__html: prompt
|
|
141
|
-
}
|
|
132
|
+
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
133
|
+
prompt: teacherInstructions
|
|
134
|
+
})), /*#__PURE__*/_react["default"].createElement("br", null)), prompt && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
135
|
+
className: "prompt",
|
|
136
|
+
prompt: prompt
|
|
142
137
|
}), /*#__PURE__*/_react["default"].createElement("br", null)), showingCorrect && showToggle ? /*#__PURE__*/_react["default"].createElement(_charting.Chart, {
|
|
143
138
|
chartType: chartType,
|
|
144
139
|
size: size,
|
|
@@ -148,7 +143,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
148
143
|
data: correctData || categories,
|
|
149
144
|
title: title,
|
|
150
145
|
onDataChange: this.changeData,
|
|
151
|
-
editCategoryEnabled: false,
|
|
152
146
|
addCategoryEnabled: false,
|
|
153
147
|
categoryDefaultLabel: categoryDefaultLabel
|
|
154
148
|
}) : /*#__PURE__*/_react["default"].createElement(_charting.Chart, {
|
|
@@ -160,7 +154,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
160
154
|
data: correctedAnswer || categories,
|
|
161
155
|
title: title,
|
|
162
156
|
onDataChange: this.changeData,
|
|
163
|
-
editCategoryEnabled: editCategoryEnabled,
|
|
164
157
|
addCategoryEnabled: addCategoryEnabled,
|
|
165
158
|
categoryDefaultLabel: categoryDefaultLabel
|
|
166
159
|
}), /*#__PURE__*/_react["default"].createElement("br", null), rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
@@ -168,10 +161,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
168
161
|
hidden: 'Show Rationale',
|
|
169
162
|
visible: 'Hide Rationale'
|
|
170
163
|
}
|
|
171
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
172
|
-
|
|
173
|
-
__html: rationale
|
|
174
|
-
}
|
|
164
|
+
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
165
|
+
prompt: rationale
|
|
175
166
|
})));
|
|
176
167
|
}
|
|
177
168
|
}]);
|
|
@@ -194,10 +185,8 @@ var styles = function styles(theme) {
|
|
|
194
185
|
mainContainer: {
|
|
195
186
|
padding: theme.spacing.unit,
|
|
196
187
|
color: _renderUi.color.text(),
|
|
197
|
-
backgroundColor: _renderUi.color.background()
|
|
198
|
-
|
|
199
|
-
prompt: {
|
|
200
|
-
verticalAlign: 'middle'
|
|
188
|
+
backgroundColor: _renderUi.color.background(),
|
|
189
|
+
overflow: 'hidden'
|
|
201
190
|
}
|
|
202
191
|
};
|
|
203
192
|
};
|
package/lib/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["Main","props","data","setState","categories","onAnswersChange","showingCorrect","state","model","nextProps","nextData","classes","teacherInstructions","prompt","chartType","size","domain","range","title","
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["Main","props","data","setState","categories","onAnswersChange","showingCorrect","state","model","nextProps","nextData","classes","teacherInstructions","prompt","chartType","size","domain","range","title","addCategoryEnabled","categoryDefaultLabel","rationale","correctedAnswer","correctAnswer","correctData","map","interactive","editable","showToggle","length","mainContainer","toggleCorrect","hidden","visible","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","changeData","React","Component","PropTypes","object","isRequired","func","array","styles","theme","padding","spacing","unit","color","text","backgroundColor","background","overflow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,I;;;;;AAUX,gBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,mGAkBN,UAACC,IAAD;AAAA,aACX,MAAKC,QAAL,CACE;AACEC,QAAAA,UAAU,EAAEF;AADd,OADF,EAIE;AAAA,eAAM,MAAKD,KAAL,CAAWI,eAAX,CAA2BH,IAA3B,CAAN;AAAA,OAJF,CADW;AAAA,KAlBM;AAAA,sGA0BH,UAACI,cAAD;AAAA,aAAoB,MAAKH,QAAL,CAAc;AAAEG,QAAAA,cAAc,EAAdA;AAAF,OAAd,CAApB;AAAA,KA1BG;AAGjB,UAAKC,KAAL,GAAa;AACXH,MAAAA,UAAU,EAAEH,KAAK,CAACG,UAAN,IAAoBH,KAAK,CAACO,KAAN,CAAYN,IADjC;AAEXI,MAAAA,cAAc,EAAE;AAFL,KAAb;AAHiB;AAOlB;;;;WAED,0CAAiCG,SAAjC,EAA4C;AAC1C,6BAAgDA,SAAhD,CAAQD,KAAR;AAAA,uDAAyC,EAAzC;AAAA,mDAAiBN,IAAjB;AAAA,UAAuBQ,QAAvB,sCAAkC,EAAlC;AACA,8BAAsC,KAAKT,KAA3C,CAAQO,KAAR;AAAA,yDAA+B,EAA/B;AAAA,oDAAiBN,IAAjB;AAAA,UAAiBA,IAAjB,sCAAwB,EAAxB;;AAEA,UAAI,CAAC,yBAAQQ,QAAR,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AAAA,QAAQ,EAAE;AAJG;AADU,GAAZ;AAAA,CAAf;;eASe,wBAAWT,MAAX,EAAmBjD,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport {color, Collapsible, hasText, PreviewPrompt} from '@pie-lib/render-ui';\nimport { Chart, chartTypes } from '@pie-lib/charting';\nimport isEqual from 'lodash/isEqual';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n model: PropTypes.object.isRequired,\n onAnswersChange: PropTypes.func,\n categories: PropTypes.array,\n };\n\n static defaultProps = { classes: {} };\n\n constructor(props) {\n super(props);\n\n this.state = {\n categories: props.categories || props.model.data,\n showingCorrect: false,\n };\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { model: { data: nextData = [] } = {} } = nextProps;\n const { model: { data = [] } = {} } = this.props;\n\n if (!isEqual(nextData, data)) {\n this.setState({ categories: nextData });\n }\n }\n\n changeData = (data) =>\n this.setState(\n {\n categories: data,\n },\n () => this.props.onAnswersChange(data)\n );\n\n toggleCorrect = (showingCorrect) => this.setState({ showingCorrect });\n\n render() {\n const { categories, showingCorrect } = this.state;\n const { model, classes } = this.props;\n const {\n teacherInstructions,\n prompt,\n chartType,\n size,\n domain,\n range,\n title,\n addCategoryEnabled,\n categoryDefaultLabel,\n rationale,\n correctedAnswer,\n correctAnswer,\n } = model;\n\n const correctData =\n correctAnswer && correctAnswer.data\n ? correctAnswer.data.map((data) => {\n return {\n ...data,\n interactive: false,\n editable: false,\n };\n })\n : [];\n\n const showToggle = correctData && correctData.length > 0;\n\n return (\n <div className={classes.mainContainer}>\n <CorrectAnswerToggle\n show={showToggle}\n toggled={showingCorrect}\n onToggle={this.toggleCorrect}\n />\n\n {teacherInstructions && hasText(teacherInstructions) && (\n <React.Fragment>\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </Collapsible>\n <br />\n </React.Fragment>\n )}\n\n {prompt && (\n <React.Fragment>\n <PreviewPrompt className=\"prompt\" prompt={prompt} />\n <br />\n </React.Fragment>\n )}\n\n {showingCorrect && showToggle ? (\n <Chart\n chartType={chartType}\n size={size}\n domain={domain}\n range={range}\n charts={[\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n ]}\n data={correctData || categories}\n title={title}\n onDataChange={this.changeData}\n addCategoryEnabled={false}\n categoryDefaultLabel={categoryDefaultLabel}\n />\n ) : (\n <Chart\n chartType={chartType}\n size={size}\n domain={domain}\n range={range}\n charts={[\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n ]}\n data={correctedAnswer || categories}\n title={title}\n onDataChange={this.changeData}\n addCategoryEnabled={addCategoryEnabled}\n categoryDefaultLabel={categoryDefaultLabel}\n />\n )}\n\n <br />\n {rationale && hasText(rationale) && (\n <Collapsible\n labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}\n >\n <PreviewPrompt prompt={rationale} />\n </Collapsible>\n )}\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n padding: theme.spacing.unit,\n color: color.text(),\n backgroundColor: color.background(),\n overflow: 'hidden'\n }\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"repository": "pie-framework/pie-elements",
|
|
7
|
-
"version": "2.7.
|
|
7
|
+
"version": "2.7.3-next.1008+7ab630754",
|
|
8
8
|
"description": "",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@material-ui/core": "^3.9.2",
|
|
15
15
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
16
|
-
"@pie-lib/charting": "^
|
|
17
|
-
"@pie-lib/correct-answer-toggle": "^2.3.
|
|
18
|
-
"@pie-lib/math-rendering": "^2.3
|
|
19
|
-
"@pie-lib/render-ui": "^4.
|
|
16
|
+
"@pie-lib/charting": "^5.0.0",
|
|
17
|
+
"@pie-lib/correct-answer-toggle": "^2.3.39",
|
|
18
|
+
"@pie-lib/math-rendering": "^2.4.3",
|
|
19
|
+
"@pie-lib/render-ui": "^4.12.9",
|
|
20
20
|
"classnames": "^2.2.5",
|
|
21
21
|
"debug": "^4.1.1",
|
|
22
22
|
"lodash": "^4.17.15",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"author": "",
|
|
27
27
|
"license": "ISC",
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "7ab6307548d6d1387d82263513e6483fe30872fa",
|
|
29
29
|
"main": "lib/index.js",
|
|
30
30
|
"module": "src/index.js"
|
|
31
31
|
}
|