@pie-element/charting 2.7.3-next.133 → 2.7.3-next.1332

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.
@@ -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',
@@ -9,27 +8,15 @@ exports.model = (id, element) => ({
9
8
  data: [
10
9
  {
11
10
  label: 'A',
12
- value: 1,
13
- initial: true,
14
- interactive: false,
15
- editable: true,
16
- deletable: true
11
+ value: 1
17
12
  },
18
13
  {
19
14
  label: 'B',
20
- value: 1,
21
- initial: true,
22
- interactive: true,
23
- editable: true,
24
- deletable: true
15
+ value: 1
25
16
  },
26
17
  {
27
18
  label: 'C',
28
- value: 1,
29
- initial: true,
30
- interactive: true,
31
- editable: true,
32
- deletable: true
19
+ value: 1
33
20
  },
34
21
  ]
35
22
  },
@@ -37,32 +24,25 @@ exports.model = (id, element) => ({
37
24
  {
38
25
  label: 'A',
39
26
  value: 1,
40
- initial: true,
41
27
  interactive: false,
42
- editable: true,
43
- deletable: true
28
+ editable: false
44
29
  },
45
30
  {
46
31
  label: 'B',
47
32
  value: 1,
48
- initial: true,
49
33
  interactive: true,
50
- editable: true,
51
- deletable: true
34
+ editable: false
52
35
  },
53
36
  {
54
37
  label: 'D',
55
38
  value: 2,
56
- initial: true,
57
39
  interactive: true,
58
- editable: true,
59
- deletable: true
40
+ editable: false
60
41
  },
61
42
  ],
62
43
  domain: {
63
44
  label: 'Characters',
64
45
  },
65
- editCategoryEnabled: true,
66
46
  graph: {
67
47
  width: 480,
68
48
  height: 480
@@ -77,4 +57,5 @@ exports.model = (id, element) => ({
77
57
  labelStep: 1,
78
58
  },
79
59
  title: 'This is a chart!',
60
+ rubricEnabled: false
80
61
  });
@@ -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
  },
@@ -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",
@@ -492,11 +463,36 @@
492
463
  "type": "string",
493
464
  "title": "title"
494
465
  },
466
+ "placeholderMessages": {
467
+ "title": "Placeholder",
468
+ "type": "object",
469
+ "properties": {
470
+ "title": {
471
+ "description": "Indicates placeholder message if title is not defined",
472
+ "type": "string",
473
+ "title": "title"
474
+ },
475
+ "labels": {
476
+ "description": "Indicates placeholder message if labels for range or domain are not defined",
477
+ "type": "string",
478
+ "title": "labels"
479
+ }
480
+ },
481
+ "required": [
482
+ "labels",
483
+ "title"
484
+ ]
485
+ },
495
486
  "rationaleEnabled": {
496
487
  "description": "Indicates if Rationale are enabled",
497
488
  "type": "boolean",
498
489
  "title": "rationaleEnabled"
499
490
  },
491
+ "spellCheckEnabled": {
492
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
493
+ "type": "boolean",
494
+ "title": "spellCheckEnabled"
495
+ },
500
496
  "studentInstructionsEnabled": {
501
497
  "description": "Indicates if Student Instructions are enabled",
502
498
  "type": "boolean",
@@ -507,6 +503,11 @@
507
503
  "type": "boolean",
508
504
  "title": "teacherInstructionsEnabled"
509
505
  },
506
+ "rubricEnabled": {
507
+ "description": "Indicates if Rubric is enabled",
508
+ "type": "boolean",
509
+ "title": "rubricEnabled"
510
+ },
510
511
  "id": {
511
512
  "description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
512
513
  "type": "string",
@@ -525,12 +526,13 @@
525
526
  "correctAnswer",
526
527
  "data",
527
528
  "domain",
528
- "editCategoryEnabled",
529
529
  "element",
530
530
  "graph",
531
531
  "id",
532
532
  "range",
533
533
  "rationaleEnabled",
534
+ "rubricEnabled",
535
+ "spellCheckEnabled",
534
536
  "studentInstructionsEnabled",
535
537
  "teacherInstructionsEnabled"
536
538
  ],
@@ -572,6 +574,27 @@
572
574
  }
573
575
  }
574
576
  },
577
+ "ConfigureMaxImageDimensionsProp": {
578
+ "title": "ConfigureMaxImageDimensionsProp",
579
+ "type": "object",
580
+ "properties": {
581
+ "teacherInstructions": {
582
+ "description": "Indicates the max dimension for images in teacher instructions",
583
+ "type": "number",
584
+ "title": "teacherInstructions"
585
+ },
586
+ "prompt": {
587
+ "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",
588
+ "type": "number",
589
+ "title": "prompt"
590
+ },
591
+ "rationale": {
592
+ "description": "Indicates the max dimension for images in rationale",
593
+ "type": "number",
594
+ "title": "rationale"
595
+ }
596
+ }
597
+ },
575
598
  "Answer": {
576
599
  "title": "Answer",
577
600
  "type": "object",
@@ -599,11 +622,6 @@
599
622
  "type": "number",
600
623
  "title": "value"
601
624
  },
602
- "initial": {
603
- "description": "Indicates if category is default category",
604
- "type": "boolean",
605
- "title": "initial"
606
- },
607
625
  "interactive": {
608
626
  "description": "Indicates if category label & value are interactive",
609
627
  "type": "boolean",
@@ -651,7 +669,6 @@
651
669
  "correctness",
652
670
  "deletable",
653
671
  "editable",
654
- "initial",
655
672
  "interactive",
656
673
  "label",
657
674
  "value"
@@ -675,11 +692,6 @@
675
692
  "type": "number",
676
693
  "title": "value"
677
694
  },
678
- "initial": {
679
- "description": "Indicates if category is default category",
680
- "type": "boolean",
681
- "title": "initial"
682
- },
683
695
  "interactive": {
684
696
  "description": "Indicates if category label & value are interactive",
685
697
  "type": "boolean",
@@ -727,7 +739,6 @@
727
739
  "correctness",
728
740
  "deletable",
729
741
  "editable",
730
- "initial",
731
742
  "interactive",
732
743
  "label",
733
744
  "value"
@@ -757,11 +768,6 @@
757
768
  "type": "number",
758
769
  "title": "value"
759
770
  },
760
- "initial": {
761
- "description": "Indicates if category is default category",
762
- "type": "boolean",
763
- "title": "initial"
764
- },
765
771
  "interactive": {
766
772
  "description": "Indicates if category label & value are interactive",
767
773
  "type": "boolean",
@@ -809,7 +815,6 @@
809
815
  "correctness",
810
816
  "deletable",
811
817
  "editable",
812
- "initial",
813
818
  "interactive",
814
819
  "label",
815
820
  "value"
@@ -872,6 +877,26 @@
872
877
  "height",
873
878
  "width"
874
879
  ]
880
+ },
881
+ "Placeholder": {
882
+ "title": "Placeholder",
883
+ "type": "object",
884
+ "properties": {
885
+ "title": {
886
+ "description": "Indicates placeholder message if title is not defined",
887
+ "type": "string",
888
+ "title": "title"
889
+ },
890
+ "labels": {
891
+ "description": "Indicates placeholder message if labels for range or domain are not defined",
892
+ "type": "string",
893
+ "title": "labels"
894
+ }
895
+ },
896
+ "required": [
897
+ "labels",
898
+ "title"
899
+ ]
875
900
  }
876
901
  },
877
902
  "$schema": "http://json-schema.org/draft-07/schema#"
@@ -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:
@@ -142,10 +138,26 @@ Indicates teacher instructions
142
138
 
143
139
  Indicates chart title
144
140
 
141
+ # `placeholderMessages` (object)
142
+
143
+ Properties of the `placeholderMessages` object:
144
+
145
+ ## `title` (string, required)
146
+
147
+ Indicates placeholder message if title is not defined
148
+
149
+ ## `labels` (string, required)
150
+
151
+ Indicates placeholder message if labels for range or domain are not defined
152
+
145
153
  # `rationaleEnabled` (boolean, required)
146
154
 
147
155
  Indicates if Rationale are enabled
148
156
 
157
+ # `spellCheckEnabled` (boolean, required)
158
+
159
+ Indicates if spellcheck is enabled for the author. Default value is true
160
+
149
161
  # `studentInstructionsEnabled` (boolean, required)
150
162
 
151
163
  Indicates if Student Instructions are enabled
@@ -154,6 +166,10 @@ Indicates if Student Instructions are enabled
154
166
 
155
167
  Indicates if Teacher Instructions are enabled
156
168
 
169
+ # `rubricEnabled` (boolean, required)
170
+
171
+ Indicates if Rubric is enabled
172
+
157
173
  # `id` (string, required)
158
174
 
159
175
  Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
@@ -197,6 +213,22 @@ Indicates the label for the item that has to be displayed in the Settings Panel
197
213
  Indicates the value of the item if it affects config-ui
198
214
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
199
215
 
216
+ ## `ConfigureMaxImageDimensionsProp` (object)
217
+
218
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
219
+
220
+ ### `teacherInstructions` (number)
221
+
222
+ Indicates the max dimension for images in teacher instructions
223
+
224
+ ### `prompt` (number)
225
+
226
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
227
+
228
+ ### `rationale` (number)
229
+
230
+ Indicates the max dimension for images in rationale
231
+
200
232
  ## `Answer` (object)
201
233
 
202
234
  Properties of the `Answer` object:
@@ -225,10 +257,6 @@ Indicates category label
225
257
 
226
258
  Indicates category value
227
259
 
228
- ### `initial` (boolean, required)
229
-
230
- Indicates if category is default category
231
-
232
260
  ### `interactive` (boolean, required)
233
261
 
234
262
  Indicates if category label & value are interactive
@@ -295,4 +323,16 @@ Width for chart representation
295
323
 
296
324
  ### `height` (number, required)
297
325
 
298
- Height for chart representation
326
+ Height for chart representation
327
+
328
+ ## `Placeholder` (object)
329
+
330
+ Properties of the `Placeholder` object:
331
+
332
+ ### `title` (string, required)
333
+
334
+ Indicates placeholder message if title is not defined
335
+
336
+ ### `labels` (string, required)
337
+
338
+ Indicates placeholder message if labels for range or domain are not defined
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 { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
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,mGAkBD,UAAAC,MAAM;AAAA,aAAIC,KAAK,CAACC,OAAN,CAAcF,MAAd,KAAyBA,MAAM,CAACG,MAAP,GAAgB,CAA7C;AAAA,KAlBL;AAAA,sGAoBE,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,KA/Ba;AAAA;AAEb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKC,MAAL,GAAcD,CAAd;;AACA,WAAKD,OAAL;AACD;;;SAED,aAAYG,CAAZ,EAAe;AACb,WAAKT,QAAL,GAAgBS,CAAhB;;AACA,WAAKH,OAAL;AACD;;;WAED,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;;;kDAhDmCU,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 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"}
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); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
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] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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 { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
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("div", {
134
- dangerouslySetInnerHTML: {
135
- __html: teacherInstructions
136
- }
137
- })), /*#__PURE__*/_react["default"].createElement("br", null)), prompt && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
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("div", {
172
- dangerouslySetInnerHTML: {
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","editCategoryEnabled","addCategoryEnabled","categoryDefaultLabel","rationale","correctedAnswer","correctAnswer","correctData","map","interactive","editable","showToggle","length","mainContainer","toggleCorrect","hidden","visible","__html","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","changeData","React","Component","PropTypes","object","isRequired","func","array","styles","theme","padding","spacing","unit","color","text","backgroundColor","background","verticalAlign"],"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;AAAA,6BACMA,SADN,CAClCD,KADkC;AAAA,uDACD,EADC;AAAA,mDACzBN,IADyB;AAAA,UACnBQ,QADmB,sCACR,EADQ;AAAA,8BAEJ,KAAKT,KAFD,CAElCO,KAFkC;AAAA,yDAEX,EAFW;AAAA,oDAEzBN,IAFyB;AAAA,UAEzBA,IAFyB,sCAElB,EAFkB;;AAI1C,UAAI,CAAC,yBAAQQ,QAAR,EAAkBR,IAAlB,CAAL,EAA8B;AAC5B,aAAKC,QAAL,CAAc;AAAEC,UAAAA,UAAU,EAAEM;AAAd,SAAd;AACD;AACF;;;WAYD,kBAAS;AAAA,wBACgC,KA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MC,IAAN,EAFM;AAGbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN;AAHJ,KADU;AAMzB9C,IAAAA,MAAM,EAAE;AACN+C,MAAAA,aAAa,EAAE;AADT;AANiB,GAAZ;AAAA,CAAf;;eAWe,wBAAWT,MAAX,EAAmBnD,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color, Collapsible, hasText } 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 editCategoryEnabled,\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 <div dangerouslySetInnerHTML={{ __html: teacherInstructions }} />\n </Collapsible>\n <br />\n </React.Fragment>\n )}\n\n {prompt && (\n <React.Fragment>\n <div\n className={classes.prompt}\n dangerouslySetInnerHTML={{ __html: prompt }}\n />\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 editCategoryEnabled={false}\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 editCategoryEnabled={editCategoryEnabled}\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 <div dangerouslySetInnerHTML={{ __html: 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 },\n prompt: {\n verticalAlign: 'middle',\n },\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
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,EA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AA,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"}