@pie-element/charting 5.11.2-next.45 → 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"));
@@ -66,7 +68,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
66
68
  });
67
69
  });
68
70
  _this.state = {
69
- categories: props.model.data,
71
+ categories: props.categories || props.model.data,
70
72
  showingCorrect: false
71
73
  };
72
74
  return _this;
@@ -89,7 +91,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
89
91
  range = model.range,
90
92
  title = model.title,
91
93
  addCategoryEnabled = model.addCategoryEnabled,
92
- categoryDefaultLabel = model.categoryDefaultLabel,
94
+ studentCategoryDefaultLabel = model.studentCategoryDefaultLabel,
93
95
  rationale = model.rationale,
94
96
  correctedAnswer = model.correctedAnswer,
95
97
  correctAnswer = model.correctAnswer;
@@ -128,7 +130,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
128
130
  title: title,
129
131
  onDataChange: this.changeData,
130
132
  addCategoryEnabled: false,
131
- categoryDefaultLabel: categoryDefaultLabel
133
+ categoryDefaultLabel: studentCategoryDefaultLabel
132
134
  }) : /*#__PURE__*/_react["default"].createElement(_charting.Chart, {
133
135
  className: classes.chart,
134
136
  chartType: chartType,
@@ -140,7 +142,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
140
142
  title: title,
141
143
  onDataChange: this.changeData,
142
144
  addCategoryEnabled: addCategoryEnabled,
143
- categoryDefaultLabel: categoryDefaultLabel
145
+ categoryDefaultLabel: studentCategoryDefaultLabel
144
146
  }), rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
145
147
  labels: {
146
148
  hidden: 'Show Rationale',
@@ -153,15 +155,17 @@ var Main = /*#__PURE__*/function (_React$Component) {
153
155
  }], [{
154
156
  key: "getDerivedStateFromProps",
155
157
  value: function getDerivedStateFromProps(nextProps, prevState) {
156
- var _nextProps$model = nextProps.model;
158
+ var newCategories = nextProps.categories,
159
+ _nextProps$model = nextProps.model;
157
160
  _nextProps$model = _nextProps$model === void 0 ? {} : _nextProps$model;
158
161
  var _nextProps$model$data = _nextProps$model.data,
159
- nextData = _nextProps$model$data === void 0 ? [] : _nextProps$model$data;
162
+ defaultCategories = _nextProps$model$data === void 0 ? [] : _nextProps$model$data;
160
163
  var categories = prevState.categories;
164
+ var nextCategories = (0, _isArray["default"])(newCategories) ? newCategories : defaultCategories;
161
165
 
162
- if (!(0, _isEqual["default"])(nextData, categories)) {
166
+ if (!(0, _isEqual["default"])(nextCategories, categories)) {
163
167
  return {
164
- categories: nextData
168
+ categories: nextCategories
165
169
  };
166
170
  }
167
171
 
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","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","nextProps","prevState","nextData","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;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mDAAiBN,IAAjB;AAAA,UAAuB0C,QAAvB,sCAAkC,EAAlC;AACA,UAAQxC,UAAR,GAAuBuC,SAAvB,CAAQvC,UAAR;;AAEA,UAAI,CAAC,yBAAQwC,QAAR,EAAkBxC,UAAlB,CAAL,EAAoC;AAClC,eAAO;AAAEA,UAAAA,UAAU,EAAEwC;AAAd,SAAP;AACD;;AAED,aAAO,IAAP;AACD;;;EA5BuBC,kBAAMC,S;;;iCAAnB9C,I,eACQ;AACjBS,EAAAA,OAAO,EAAEsC,sBAAUC,MADF;AAEjBxC,EAAAA,KAAK,EAAEuC,sBAAUC,MAAV,CAAiBC,UAFP;AAGjB5C,EAAAA,eAAe,EAAE0C,sBAAUG,IAHV;AAIjB9C,EAAAA,UAAU,EAAE2C,sBAAUI;AAJL,C;iCADRnD,I,kBAQW;AAAES,EAAAA,OAAO,EAAE;AAAX,C;;AAuIxB,IAAM2C,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBzB,IAAAA,aAAa,EAAE;AACb0B,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EADM;AAEbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN,EAFJ;AAGbC,MAAAA,SAAS,EAAE,QAHE;AAIbC,MAAAA,SAAS,EAAE;AAJE,KADU;AAOzB1B,IAAAA,KAAK,EAAE;AACL2B,MAAAA,SAAS,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB,CAD3B;AAELC,MAAAA,YAAY,EAAEV,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AAF9B,KAPkB;AAWzBjC,IAAAA,WAAW,EAAE;AACXkC,MAAAA,YAAY,EAAEV,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AADxB;AAXY,GAAZ;AAAA,CAAf;;eAgBe,wBAAWV,MAAX,EAAmBpD,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.model.data,\n showingCorrect: false,\n };\n }\n \n static getDerivedStateFromProps(nextProps, prevState) {\n const { model: { data: nextData = [] } = {} } = nextProps;\n const { categories } = prevState;\n\n if (!isEqual(nextData, categories)) {\n return { categories: nextData };\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 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"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B,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-next.45+2cf9ffa4f",
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.8.0",
17
- "@pie-lib/correct-answer-toggle": "^2.3.73",
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.23",
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": "2cf9ffa4fbef6f2ebc0924f305debc9fc6560a75",
28
+ "gitHead": "abe4a46fb31efadda5a6aefad3e384d8574fb335",
29
29
  "main": "lib/index.js",
30
30
  "module": "src/index.js"
31
31
  }