@pie-element/charting 2.7.19 → 2.7.20-beta.1443

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.
@@ -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
  ],
@@ -551,6 +553,47 @@
551
553
  }
552
554
  }
553
555
  },
556
+ "LabelsPlaceholderConfigProp": {
557
+ "title": "LabelsPlaceholderConfigProp",
558
+ "type": "object",
559
+ "properties": {
560
+ "top": {
561
+ "description": "This value is empty for charting. The property exist in order to be consistent with graphing configuration.",
562
+ "type": "string",
563
+ "title": "top"
564
+ },
565
+ "right": {
566
+ "description": "This value is empty for charting. The property exist in order to be consistent with graphing configuration.",
567
+ "type": "string",
568
+ "title": "right"
569
+ },
570
+ "bottom": {
571
+ "description": "Indicates the placeholder for the bottom label",
572
+ "type": "string",
573
+ "title": "bottom"
574
+ },
575
+ "left": {
576
+ "description": "Indicates the placeholder for the left label",
577
+ "type": "string",
578
+ "title": "left"
579
+ },
580
+ "settings": {
581
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
582
+ "type": "boolean",
583
+ "title": "settings"
584
+ },
585
+ "label": {
586
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
587
+ "type": "string",
588
+ "title": "label"
589
+ },
590
+ "enabled": {
591
+ "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
592
+ "type": "boolean",
593
+ "title": "enabled"
594
+ }
595
+ }
596
+ },
554
597
  "ConfigurePropWithEnabled": {
555
598
  "title": "ConfigurePropWithEnabled",
556
599
  "type": "object",
@@ -572,6 +615,27 @@
572
615
  }
573
616
  }
574
617
  },
618
+ "ConfigureMaxImageDimensionsProp": {
619
+ "title": "ConfigureMaxImageDimensionsProp",
620
+ "type": "object",
621
+ "properties": {
622
+ "teacherInstructions": {
623
+ "description": "Indicates the max dimension for images in teacher instructions",
624
+ "type": "number",
625
+ "title": "teacherInstructions"
626
+ },
627
+ "prompt": {
628
+ "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",
629
+ "type": "number",
630
+ "title": "prompt"
631
+ },
632
+ "rationale": {
633
+ "description": "Indicates the max dimension for images in rationale",
634
+ "type": "number",
635
+ "title": "rationale"
636
+ }
637
+ }
638
+ },
575
639
  "Answer": {
576
640
  "title": "Answer",
577
641
  "type": "object",
@@ -599,11 +663,6 @@
599
663
  "type": "number",
600
664
  "title": "value"
601
665
  },
602
- "initial": {
603
- "description": "Indicates if category is default category",
604
- "type": "boolean",
605
- "title": "initial"
606
- },
607
666
  "interactive": {
608
667
  "description": "Indicates if category label & value are interactive",
609
668
  "type": "boolean",
@@ -651,7 +710,6 @@
651
710
  "correctness",
652
711
  "deletable",
653
712
  "editable",
654
- "initial",
655
713
  "interactive",
656
714
  "label",
657
715
  "value"
@@ -675,11 +733,6 @@
675
733
  "type": "number",
676
734
  "title": "value"
677
735
  },
678
- "initial": {
679
- "description": "Indicates if category is default category",
680
- "type": "boolean",
681
- "title": "initial"
682
- },
683
736
  "interactive": {
684
737
  "description": "Indicates if category label & value are interactive",
685
738
  "type": "boolean",
@@ -727,7 +780,6 @@
727
780
  "correctness",
728
781
  "deletable",
729
782
  "editable",
730
- "initial",
731
783
  "interactive",
732
784
  "label",
733
785
  "value"
@@ -757,11 +809,6 @@
757
809
  "type": "number",
758
810
  "title": "value"
759
811
  },
760
- "initial": {
761
- "description": "Indicates if category is default category",
762
- "type": "boolean",
763
- "title": "initial"
764
- },
765
812
  "interactive": {
766
813
  "description": "Indicates if category label & value are interactive",
767
814
  "type": "boolean",
@@ -809,7 +856,6 @@
809
856
  "correctness",
810
857
  "deletable",
811
858
  "editable",
812
- "initial",
813
859
  "interactive",
814
860
  "label",
815
861
  "value"
@@ -872,6 +918,26 @@
872
918
  "height",
873
919
  "width"
874
920
  ]
921
+ },
922
+ "Placeholder": {
923
+ "title": "Placeholder",
924
+ "type": "object",
925
+ "properties": {
926
+ "title": {
927
+ "description": "Indicates placeholder message if title is not defined",
928
+ "type": "string",
929
+ "title": "title"
930
+ },
931
+ "labels": {
932
+ "description": "Indicates placeholder message if labels for range or domain are not defined",
933
+ "type": "string",
934
+ "title": "labels"
935
+ }
936
+ },
937
+ "required": [
938
+ "labels",
939
+ "title"
940
+ ]
875
941
  }
876
942
  },
877
943
  "$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.
@@ -180,6 +196,39 @@ Indicates if the item has to be displayed in the Settings Panel
180
196
 
181
197
  Indicates the label for the item that has to be displayed in the Settings Panel
182
198
 
199
+ ## `LabelsPlaceholderConfigProp` (object)
200
+
201
+ Properties of the `LabelsPlaceholderConfigProp` object:
202
+
203
+ ### `top` (string)
204
+
205
+ This value is empty for charting. The property exist in order to be consistent with graphing configuration.
206
+
207
+ ### `right` (string)
208
+
209
+ This value is empty for charting. The property exist in order to be consistent with graphing configuration.
210
+
211
+ ### `bottom` (string)
212
+
213
+ Indicates the placeholder for the bottom label
214
+
215
+ ### `left` (string)
216
+
217
+ Indicates the placeholder for the left label
218
+
219
+ ### `settings` (boolean)
220
+
221
+ Indicates if the item has to be displayed in the Settings Panel
222
+
223
+ ### `label` (string)
224
+
225
+ Indicates the label for the item that has to be displayed in the Settings Panel
226
+
227
+ ### `enabled` (boolean)
228
+
229
+ Indicates the value of the item if it affects config-ui
230
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
231
+
183
232
  ## `ConfigurePropWithEnabled` (object)
184
233
 
185
234
  Properties of the `ConfigurePropWithEnabled` object:
@@ -197,6 +246,22 @@ Indicates the label for the item that has to be displayed in the Settings Panel
197
246
  Indicates the value of the item if it affects config-ui
198
247
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
199
248
 
249
+ ## `ConfigureMaxImageDimensionsProp` (object)
250
+
251
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
252
+
253
+ ### `teacherInstructions` (number)
254
+
255
+ Indicates the max dimension for images in teacher instructions
256
+
257
+ ### `prompt` (number)
258
+
259
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
260
+
261
+ ### `rationale` (number)
262
+
263
+ Indicates the max dimension for images in rationale
264
+
200
265
  ## `Answer` (object)
201
266
 
202
267
  Properties of the `Answer` object:
@@ -225,10 +290,6 @@ Indicates category label
225
290
 
226
291
  Indicates category value
227
292
 
228
- ### `initial` (boolean, required)
229
-
230
- Indicates if category is default category
231
-
232
293
  ### `interactive` (boolean, required)
233
294
 
234
295
  Indicates if category label & value are interactive
@@ -295,4 +356,16 @@ Width for chart representation
295
356
 
296
357
  ### `height` (number, required)
297
358
 
298
- Height for chart representation
359
+ Height for chart representation
360
+
361
+ ## `Placeholder` (object)
362
+
363
+ Properties of the `Placeholder` object:
364
+
365
+ ### `title` (string, required)
366
+
367
+ Indicates placeholder message if title is not defined
368
+
369
+ ### `labels` (string, required)
370
+
371
+ Indicates placeholder message if labels for range or domain are not defined
package/lib/index.js CHANGED
@@ -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,UAACC,MAAD;AAAA,aAAYC,KAAK,CAACC,OAAN,CAAcF,MAAd,KAAyBA,MAAM,CAACG,MAAP,GAAgB,CAArD;AAAA,KAtBC;AAAA,sGAwBE,UAACH,MAAD,EAAY;AAC1B,YAAKI,QAAL,CAAcJ,MAAd,GAAuBA,MAAvB;;AAEA,YAAKK,aAAL,CAAmB,IAAIC,oCAAJ,CAAwB,MAAKC,OAAL,CAAaC,WAAb,EAAxB,EAAoD,MAAKC,UAAL,CAAgB,MAAKL,QAAL,CAAcJ,MAA9B,CAApD,CAAnB;;AAEA,YAAKU,OAAL;AACD,KA9Ba;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;;;WAYD,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;;;kDA/CmCU,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(new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete(this._session.answer)));\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,9 +35,9 @@ 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
 
@@ -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,
@@ -144,7 +143,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
144
143
  data: correctData || categories,
145
144
  title: title,
146
145
  onDataChange: this.changeData,
147
- editCategoryEnabled: false,
148
146
  addCategoryEnabled: false,
149
147
  categoryDefaultLabel: categoryDefaultLabel
150
148
  }) : /*#__PURE__*/_react["default"].createElement(_charting.Chart, {
@@ -156,7 +154,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
156
154
  data: correctedAnswer || categories,
157
155
  title: title,
158
156
  onDataChange: this.changeData,
159
- editCategoryEnabled: editCategoryEnabled,
160
157
  addCategoryEnabled: addCategoryEnabled,
161
158
  categoryDefaultLabel: categoryDefaultLabel
162
159
  }), /*#__PURE__*/_react["default"].createElement("br", null), rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
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","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,EAA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AAEW,EAAAA,OAAO,EAAE;AAAX,C;;AAoJxB,IAAMuC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBpB,IAAAA,aAAa,EAAE;AACbqB,MAAAA,OAAO,EAAED,KAAK,CAACE,OAAN,CAAcC,IADV;AAEbC,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EAFM;AAGbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN,EAHJ;AAIbC,MAAAA,QAAQ,EAAE;AAJG;AADU,GAAZ;AAAA,CAAf;;eASe,wBAAWT,MAAX,EAAmBlD,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 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 <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 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 <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"}
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,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AO,EAAED,KAAK,CAACE,OAAN,CAAcC,IADV;AAEbC,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EAFM;AAGbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN,EAHJ;AAIbC,MAAAA,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 show={showToggle} toggled={showingCorrect} onToggle={this.toggleCorrect} />\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 labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>\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.19",
7
+ "version": "2.7.20-beta.1443+449763c04",
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": "^4.5.13",
17
- "@pie-lib/correct-answer-toggle": "^2.3.34",
18
- "@pie-lib/math-rendering": "^2.3.12",
19
- "@pie-lib/render-ui": "^4.12.4",
16
+ "@pie-lib/charting": "^5.6.12",
17
+ "@pie-lib/correct-answer-toggle": "^2.3.62",
18
+ "@pie-lib/math-rendering": "^2.5.12",
19
+ "@pie-lib/render-ui": "^4.14.12",
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": "510db2949732b8997ff2e1a496ca1a7bd3973088",
28
+ "gitHead": "449763c046b78327513c38ea5367b8d4da120760",
29
29
  "main": "lib/index.js",
30
30
  "module": "src/index.js"
31
31
  }