@pie-element/charting 5.11.2 → 5.11.3-next.105

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.
@@ -8,11 +8,6 @@
8
8
  "type": "boolean",
9
9
  "title": "addCategoryEnabled"
10
10
  },
11
- "categoryDefaultLabel": {
12
- "description": "Indicates default value for a new category's label",
13
- "type": "string",
14
- "title": "categoryDefaultLabel"
15
- },
16
11
  "chartType": {
17
12
  "enum": [
18
13
  "bar",
@@ -53,7 +48,7 @@
53
48
  "title": "value"
54
49
  },
55
50
  "interactive": {
56
- "description": "Indicates if category label & value are interactive",
51
+ "description": "Indicates if category value is interactive",
57
52
  "type": "boolean",
58
53
  "title": "interactive"
59
54
  },
@@ -123,7 +118,7 @@
123
118
  "title": "value"
124
119
  },
125
120
  "interactive": {
126
- "description": "Indicates if category label & value are interactive",
121
+ "description": "Indicates if category value is interactive",
127
122
  "type": "boolean",
128
123
  "title": "interactive"
129
124
  },
@@ -203,7 +198,7 @@
203
198
  "title": "value"
204
199
  },
205
200
  "interactive": {
206
- "description": "Indicates if category label & value are interactive",
201
+ "description": "Indicates if category value is interactive",
207
202
  "type": "boolean",
208
203
  "title": "interactive"
209
204
  },
@@ -273,7 +268,7 @@
273
268
  "title": "value"
274
269
  },
275
270
  "interactive": {
276
- "description": "Indicates if category label & value are interactive",
271
+ "description": "Indicates if category value is interactive",
277
272
  "type": "boolean",
278
273
  "title": "interactive"
279
274
  },
@@ -508,6 +503,21 @@
508
503
  "type": "boolean",
509
504
  "title": "rubricEnabled"
510
505
  },
506
+ "changeInteractiveEnabled": {
507
+ "description": "Indicates if teacher can enable/disable data[]:interactive",
508
+ "type": "boolean",
509
+ "title": "changeInteractiveEnabled"
510
+ },
511
+ "changeEditableEnabled": {
512
+ "description": "Indicates if teacher can enable/disable data[]:editable",
513
+ "type": "boolean",
514
+ "title": "changeEditableEnabled"
515
+ },
516
+ "changeAddCategoryEnabled": {
517
+ "description": "Indicates if teacher can enable/disable addCategoryEnabled",
518
+ "type": "boolean",
519
+ "title": "changeAddCategoryEnabled"
520
+ },
511
521
  "id": {
512
522
  "description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
513
523
  "type": "string",
@@ -521,7 +531,9 @@
521
531
  },
522
532
  "required": [
523
533
  "addCategoryEnabled",
524
- "categoryDefaultLabel",
534
+ "changeAddCategoryEnabled",
535
+ "changeEditableEnabled",
536
+ "changeInteractiveEnabled",
525
537
  "chartType",
526
538
  "correctAnswer",
527
539
  "data",
@@ -615,6 +627,32 @@
615
627
  }
616
628
  }
617
629
  },
630
+ "AuthorNewCategoryDefaults": {
631
+ "title": "AuthorNewCategoryDefaults",
632
+ "type": "object",
633
+ "properties": {
634
+ "settings": {
635
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
636
+ "type": "boolean",
637
+ "title": "settings"
638
+ },
639
+ "label": {
640
+ "description": "Indicates the label for the new category",
641
+ "type": "string",
642
+ "title": "label"
643
+ },
644
+ "interactive": {
645
+ "description": "Indicates if new category is interactive",
646
+ "type": "boolean",
647
+ "title": "interactive"
648
+ },
649
+ "editable": {
650
+ "description": "Indicates if new category is editable",
651
+ "type": "boolean",
652
+ "title": "editable"
653
+ }
654
+ }
655
+ },
618
656
  "ConfigureMaxImageDimensionsProp": {
619
657
  "title": "ConfigureMaxImageDimensionsProp",
620
658
  "type": "object",
@@ -636,6 +674,96 @@
636
674
  }
637
675
  }
638
676
  },
677
+ "ChartingOptions": {
678
+ "title": "ChartingOptions",
679
+ "type": "object",
680
+ "properties": {
681
+ "changeInteractive": {
682
+ "title": "ChartingOption",
683
+ "type": "object",
684
+ "properties": {
685
+ "settings": {
686
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
687
+ "type": "boolean",
688
+ "title": "settings"
689
+ },
690
+ "authoringLabel": {
691
+ "description": "Indicates the label for the option",
692
+ "type": "string",
693
+ "title": "authoringLabel"
694
+ },
695
+ "settingsLabel": {
696
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
697
+ "type": "string",
698
+ "title": "settingsLabel"
699
+ }
700
+ }
701
+ },
702
+ "changeEditable": {
703
+ "title": "ChartingOption",
704
+ "type": "object",
705
+ "properties": {
706
+ "settings": {
707
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
708
+ "type": "boolean",
709
+ "title": "settings"
710
+ },
711
+ "authoringLabel": {
712
+ "description": "Indicates the label for the option",
713
+ "type": "string",
714
+ "title": "authoringLabel"
715
+ },
716
+ "settingsLabel": {
717
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
718
+ "type": "string",
719
+ "title": "settingsLabel"
720
+ }
721
+ }
722
+ },
723
+ "addCategory": {
724
+ "title": "ChartingOption",
725
+ "type": "object",
726
+ "properties": {
727
+ "settings": {
728
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
729
+ "type": "boolean",
730
+ "title": "settings"
731
+ },
732
+ "authoringLabel": {
733
+ "description": "Indicates the label for the option",
734
+ "type": "string",
735
+ "title": "authoringLabel"
736
+ },
737
+ "settingsLabel": {
738
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
739
+ "type": "string",
740
+ "title": "settingsLabel"
741
+ }
742
+ }
743
+ }
744
+ }
745
+ },
746
+ "ChartingOption": {
747
+ "title": "ChartingOption",
748
+ "type": "object",
749
+ "properties": {
750
+ "settings": {
751
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
752
+ "type": "boolean",
753
+ "title": "settings"
754
+ },
755
+ "authoringLabel": {
756
+ "description": "Indicates the label for the option",
757
+ "type": "string",
758
+ "title": "authoringLabel"
759
+ },
760
+ "settingsLabel": {
761
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
762
+ "type": "string",
763
+ "title": "settingsLabel"
764
+ }
765
+ }
766
+ },
639
767
  "Answer": {
640
768
  "title": "Answer",
641
769
  "type": "object",
@@ -664,7 +792,7 @@
664
792
  "title": "value"
665
793
  },
666
794
  "interactive": {
667
- "description": "Indicates if category label & value are interactive",
795
+ "description": "Indicates if category value is interactive",
668
796
  "type": "boolean",
669
797
  "title": "interactive"
670
798
  },
@@ -734,7 +862,7 @@
734
862
  "title": "value"
735
863
  },
736
864
  "interactive": {
737
- "description": "Indicates if category label & value are interactive",
865
+ "description": "Indicates if category value is interactive",
738
866
  "type": "boolean",
739
867
  "title": "interactive"
740
868
  },
@@ -810,7 +938,7 @@
810
938
  "title": "value"
811
939
  },
812
940
  "interactive": {
813
- "description": "Indicates if category label & value are interactive",
941
+ "description": "Indicates if category value is interactive",
814
942
  "type": "boolean",
815
943
  "title": "interactive"
816
944
  },
@@ -6,10 +6,6 @@ The schema defines the following properties:
6
6
 
7
7
  Indicates if user can add more categories
8
8
 
9
- # `categoryDefaultLabel` (string, required)
10
-
11
- Indicates default value for a new category's label
12
-
13
9
  # `chartType` (string, enum, required)
14
10
 
15
11
  This element must be one of the following enum values:
@@ -170,6 +166,18 @@ Indicates if Teacher Instructions are enabled
170
166
 
171
167
  Indicates if Rubric is enabled
172
168
 
169
+ # `changeInteractiveEnabled` (boolean, required)
170
+
171
+ Indicates if teacher can enable/disable data[]:interactive
172
+
173
+ # `changeEditableEnabled` (boolean, required)
174
+
175
+ Indicates if teacher can enable/disable data[]:editable
176
+
177
+ # `changeAddCategoryEnabled` (boolean, required)
178
+
179
+ Indicates if teacher can enable/disable addCategoryEnabled
180
+
173
181
  # `id` (string, required)
174
182
 
175
183
  Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
@@ -246,6 +254,26 @@ Indicates the label for the item that has to be displayed in the Settings Panel
246
254
  Indicates the value of the item if it affects config-ui
247
255
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
248
256
 
257
+ ## `AuthorNewCategoryDefaults` (object)
258
+
259
+ Properties of the `AuthorNewCategoryDefaults` object:
260
+
261
+ ### `settings` (boolean)
262
+
263
+ Indicates if the item has to be displayed in the Settings Panel
264
+
265
+ ### `label` (string)
266
+
267
+ Indicates the label for the new category
268
+
269
+ ### `interactive` (boolean)
270
+
271
+ Indicates if new category is interactive
272
+
273
+ ### `editable` (boolean)
274
+
275
+ Indicates if new category is editable
276
+
249
277
  ## `ConfigureMaxImageDimensionsProp` (object)
250
278
 
251
279
  Properties of the `ConfigureMaxImageDimensionsProp` object:
@@ -262,6 +290,74 @@ Indicates the max dimension for images in prompt - this is also the default dime
262
290
 
263
291
  Indicates the max dimension for images in rationale
264
292
 
293
+ ## `ChartingOptions` (object)
294
+
295
+ Properties of the `ChartingOptions` object:
296
+
297
+ ### `changeInteractive` (object)
298
+
299
+ Properties of the `changeInteractive` object:
300
+
301
+ #### `settings` (boolean)
302
+
303
+ Indicates if the item has to be displayed in the Settings Panel
304
+
305
+ #### `authoringLabel` (string)
306
+
307
+ Indicates the label for the option
308
+
309
+ #### `settingsLabel` (string)
310
+
311
+ Indicates the label for the item that has to be displayed in the Settings Panel
312
+
313
+ ### `changeEditable` (object)
314
+
315
+ Properties of the `changeEditable` object:
316
+
317
+ #### `settings` (boolean)
318
+
319
+ Indicates if the item has to be displayed in the Settings Panel
320
+
321
+ #### `authoringLabel` (string)
322
+
323
+ Indicates the label for the option
324
+
325
+ #### `settingsLabel` (string)
326
+
327
+ Indicates the label for the item that has to be displayed in the Settings Panel
328
+
329
+ ### `addCategory` (object)
330
+
331
+ Properties of the `addCategory` object:
332
+
333
+ #### `settings` (boolean)
334
+
335
+ Indicates if the item has to be displayed in the Settings Panel
336
+
337
+ #### `authoringLabel` (string)
338
+
339
+ Indicates the label for the option
340
+
341
+ #### `settingsLabel` (string)
342
+
343
+ Indicates the label for the item that has to be displayed in the Settings Panel
344
+
345
+ ## `ChartingOption` (object)
346
+
347
+ Properties of the `ChartingOption` object:
348
+
349
+ ### `settings` (boolean)
350
+
351
+ Indicates if the item has to be displayed in the Settings Panel
352
+
353
+ ### `authoringLabel` (string)
354
+
355
+ Indicates the label for the option
356
+
357
+ ### `settingsLabel` (string)
358
+
359
+ Indicates the label for the item that has to be displayed in the Settings Panel
360
+
265
361
  ## `Answer` (object)
266
362
 
267
363
  Properties of the `Answer` object:
@@ -292,7 +388,7 @@ Indicates category value
292
388
 
293
389
  ### `interactive` (boolean, required)
294
390
 
295
- Indicates if category label & value are interactive
391
+ Indicates if category value is interactive
296
392
 
297
393
  ### `editable` (boolean, required)
298
394
 
package/lib/main.js CHANGED
@@ -31,6 +31,8 @@ var _renderUi = require("@pie-lib/render-ui");
31
31
 
32
32
  var _charting = require("@pie-lib/charting");
33
33
 
34
+ var _isArray = _interopRequireDefault(require("lodash/isArray"));
35
+
34
36
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
35
37
 
36
38
  var _correctAnswerToggle = _interopRequireDefault(require("@pie-lib/correct-answer-toggle"));
@@ -73,24 +75,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
73
75
  }
74
76
 
75
77
  (0, _createClass2["default"])(Main, [{
76
- key: "UNSAFE_componentWillReceiveProps",
77
- value: function UNSAFE_componentWillReceiveProps(nextProps) {
78
- var _nextProps$model = nextProps.model;
79
- _nextProps$model = _nextProps$model === void 0 ? {} : _nextProps$model;
80
- var _nextProps$model$data = _nextProps$model.data,
81
- nextData = _nextProps$model$data === void 0 ? [] : _nextProps$model$data;
82
- var _this$props$model = this.props.model;
83
- _this$props$model = _this$props$model === void 0 ? {} : _this$props$model;
84
- var _this$props$model$dat = _this$props$model.data,
85
- data = _this$props$model$dat === void 0 ? [] : _this$props$model$dat;
86
-
87
- if (!(0, _isEqual["default"])(nextData, data)) {
88
- this.setState({
89
- categories: nextData
90
- });
91
- }
92
- }
93
- }, {
94
78
  key: "render",
95
79
  value: function render() {
96
80
  var _this$state = this.state,
@@ -107,7 +91,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
107
91
  range = model.range,
108
92
  title = model.title,
109
93
  addCategoryEnabled = model.addCategoryEnabled,
110
- categoryDefaultLabel = model.categoryDefaultLabel,
94
+ studentCategoryDefaultLabel = model.studentCategoryDefaultLabel,
111
95
  rationale = model.rationale,
112
96
  correctedAnswer = model.correctedAnswer,
113
97
  correctAnswer = model.correctAnswer;
@@ -146,7 +130,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
146
130
  title: title,
147
131
  onDataChange: this.changeData,
148
132
  addCategoryEnabled: false,
149
- categoryDefaultLabel: categoryDefaultLabel
133
+ categoryDefaultLabel: studentCategoryDefaultLabel
150
134
  }) : /*#__PURE__*/_react["default"].createElement(_charting.Chart, {
151
135
  className: classes.chart,
152
136
  chartType: chartType,
@@ -158,7 +142,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
158
142
  title: title,
159
143
  onDataChange: this.changeData,
160
144
  addCategoryEnabled: addCategoryEnabled,
161
- categoryDefaultLabel: categoryDefaultLabel
145
+ categoryDefaultLabel: studentCategoryDefaultLabel
162
146
  }), rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
163
147
  labels: {
164
148
  hidden: 'Show Rationale',
@@ -168,6 +152,25 @@ var Main = /*#__PURE__*/function (_React$Component) {
168
152
  prompt: rationale
169
153
  })));
170
154
  }
155
+ }], [{
156
+ key: "getDerivedStateFromProps",
157
+ value: function getDerivedStateFromProps(nextProps, prevState) {
158
+ var newCategories = nextProps.categories,
159
+ _nextProps$model = nextProps.model;
160
+ _nextProps$model = _nextProps$model === void 0 ? {} : _nextProps$model;
161
+ var _nextProps$model$data = _nextProps$model.data,
162
+ defaultCategories = _nextProps$model$data === void 0 ? [] : _nextProps$model$data;
163
+ var categories = prevState.categories;
164
+ var nextCategories = (0, _isArray["default"])(newCategories) ? newCategories : defaultCategories;
165
+
166
+ if (!(0, _isEqual["default"])(nextCategories, categories)) {
167
+ return {
168
+ categories: nextCategories
169
+ };
170
+ }
171
+
172
+ return null;
173
+ }
171
174
  }]);
172
175
  return Main;
173
176
  }(_react["default"].Component);
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","addCategoryEnabled","categoryDefaultLabel","rationale","correctedAnswer","correctAnswer","correctData","map","interactive","editable","showToggle","length","mainContainer","collapsible","hidden","visible","toggleCorrect","chart","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","changeData","React","Component","PropTypes","object","isRequired","func","array","styles","theme","color","text","backgroundColor","background","overflowX","overflowY","marginTop","spacing","unit","marginBottom"],"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,EAAkBR,IAAlB,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,EAAE;AAJE,KADU;AAOzBvB,IAAAA,KAAK,EAAE;AACLwB,MAAAA,SAAS,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB,CAD3B;AAELC,MAAAA,YAAY,EAAEV,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AAF9B,KAPkB;AAWzB9B,IAAAA,WAAW,EAAE;AACX+B,MAAAA,YAAY,EAAEV,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AADxB;AAXY,GAAZ;AAAA,CAAf;;eAgBe,wBAAWV,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, 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 {teacherInstructions && hasText(teacherInstructions) && (\n <Collapsible\n className={classes.collapsible}\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </Collapsible>\n )}\n\n {prompt && <PreviewPrompt className=\"prompt\" prompt={prompt} />}\n\n <CorrectAnswerToggle show={showToggle} toggled={showingCorrect} onToggle={this.toggleCorrect} />\n\n {showingCorrect && showToggle ? (\n <Chart\n className={classes.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 className={classes.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 {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 color: color.text(),\n backgroundColor: color.background(),\n overflowX: 'scroll',\n overflowY: 'hidden',\n },\n chart: {\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n collapsible: {\n marginBottom: theme.spacing.unit * 2,\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","classes","teacherInstructions","prompt","chartType","size","domain","range","title","addCategoryEnabled","studentCategoryDefaultLabel","rationale","correctedAnswer","correctAnswer","correctData","map","interactive","editable","showToggle","length","mainContainer","collapsible","hidden","visible","toggleCorrect","chart","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","changeData","nextProps","prevState","newCategories","defaultCategories","nextCategories","React","Component","PropTypes","object","isRequired","func","array","styles","theme","color","text","backgroundColor","background","overflowX","overflowY","marginTop","spacing","unit","marginBottom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,I;;;;;AAUX,gBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,mGAqBN,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,KArBM;AAAA,sGA6BH,UAACI,cAAD;AAAA,aAAoB,MAAKH,QAAL,CAAc;AAAEG,QAAAA,cAAc,EAAdA;AAAF,OAAd,CAApB;AAAA,KA7BG;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;;;;WAwBD,kBAAS;AACP,wBAAuC,KAAKC,KAA5C;AAAA,UAAQH,UAAR,eAAQA,UAAR;AAAA,UAAoBE,cAApB,eAAoBA,cAApB;AACA,wBAA2B,KAAKL,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AAA,OAAO,EAAE;AAAX,C;;AAwIxB,IAAM6C,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzB3B,IAAAA,aAAa,EAAE;AACb4B,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EADM;AAEbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN,EAFJ;AAGbC,MAAAA,SAAS,EAAE,QAHE;AAIbC,MAAAA,SAAS,EAAE;AAJE,KADU;AAOzB5B,IAAAA,KAAK,EAAE;AACL6B,MAAAA,SAAS,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB,CAD3B;AAELC,MAAAA,YAAY,EAAEV,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AAF9B,KAPkB;AAWzBnC,IAAAA,WAAW,EAAE;AACXoC,MAAAA,YAAY,EAAEV,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AADxB;AAXY,GAAZ;AAAA,CAAf;;eAgBe,wBAAWV,MAAX,EAAmBtD,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 isArray from 'lodash/isArray';\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 static getDerivedStateFromProps(nextProps, prevState) {\n const { categories: newCategories, model: { data: defaultCategories = [] } = {} } = nextProps;\n const { categories } = prevState;\n const nextCategories = isArray(newCategories) ? newCategories : defaultCategories;\n\n if (!isEqual(nextCategories, categories)) {\n return { categories: nextCategories };\n }\n\n return null;\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 studentCategoryDefaultLabel,\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 {teacherInstructions && hasText(teacherInstructions) && (\n <Collapsible\n className={classes.collapsible}\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </Collapsible>\n )}\n\n {prompt && <PreviewPrompt className=\"prompt\" prompt={prompt} />}\n\n <CorrectAnswerToggle show={showToggle} toggled={showingCorrect} onToggle={this.toggleCorrect} />\n\n {showingCorrect && showToggle ? (\n <Chart\n className={classes.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={studentCategoryDefaultLabel}\n />\n ) : (\n <Chart\n className={classes.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={studentCategoryDefaultLabel}\n />\n )}\n\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 color: color.text(),\n backgroundColor: color.background(),\n overflowX: 'scroll',\n overflowY: 'hidden',\n },\n chart: {\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n collapsible: {\n marginBottom: theme.spacing.unit * 2,\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": "5.11.2",
7
+ "version": "5.11.3-next.105+abe4a46fb",
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": "^5.7.2",
17
- "@pie-lib/correct-answer-toggle": "^2.3.72",
16
+ "@pie-lib/charting": "^5.9.0",
17
+ "@pie-lib/correct-answer-toggle": "^2.3.74",
18
18
  "@pie-lib/math-rendering": "^2.5.14",
19
- "@pie-lib/render-ui": "^4.14.22",
19
+ "@pie-lib/render-ui": "^4.14.24",
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": "f39573eef3b2bef5a26295defe4018f707c6a815",
28
+ "gitHead": "abe4a46fb31efadda5a6aefad3e384d8574fb335",
29
29
  "main": "lib/index.js",
30
30
  "module": "src/index.js"
31
31
  }