@pie-element/charting 2.7.29 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,48 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting@3.0.0...@pie-element/charting@4.0.0) (2022-06-28)
7
+
8
+
9
+ ### chore
10
+
11
+ * Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
12
+
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * Image percent buttons were removed from toolbar.
17
+ New properties maxImageWidth and maxImageHeight were added.
18
+
19
+
20
+
21
+
22
+
23
+ # [3.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting@2.7.30...@pie-element/charting@3.0.0) (2022-06-13)
24
+
25
+
26
+ ### Features
27
+
28
+ * **charting:** remove editCategoryEnabled property checkbox and usage. ([b5e6a93](https://github.com/pie-framework/pie-elements/commit/b5e6a93fb99c957bec304bac7d7bf34ee3c98f27))
29
+
30
+
31
+ ### BREAKING CHANGES
32
+
33
+ * **charting:** The editCategoryEnabled checkbox and property was removed.
34
+ Enabled property will be used for each category.
35
+
36
+
37
+
38
+
39
+
40
+ ## [2.7.30](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting@2.7.29...@pie-element/charting@2.7.30) (2022-05-30)
41
+
42
+ **Note:** Version bump only for package @pie-element/charting
43
+
44
+
45
+
46
+
47
+
6
48
  ## [2.7.29](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting@2.7.28...@pie-element/charting@2.7.29) (2022-05-16)
7
49
 
8
50
  **Note:** Version bump only for package @pie-element/charting
@@ -3,6 +3,48 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-configure@3.0.0...@pie-element/charting-configure@4.0.0) (2022-06-28)
7
+
8
+
9
+ ### chore
10
+
11
+ * Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
12
+
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * Image percent buttons were removed from toolbar.
17
+ New properties maxImageWidth and maxImageHeight were added.
18
+
19
+
20
+
21
+
22
+
23
+ # [3.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-configure@2.1.49...@pie-element/charting-configure@3.0.0) (2022-06-13)
24
+
25
+
26
+ ### Features
27
+
28
+ * **charting:** remove editCategoryEnabled property checkbox and usage. ([b5e6a93](https://github.com/pie-framework/pie-elements/commit/b5e6a93fb99c957bec304bac7d7bf34ee3c98f27))
29
+
30
+
31
+ ### BREAKING CHANGES
32
+
33
+ * **charting:** The editCategoryEnabled checkbox and property was removed.
34
+ Enabled property will be used for each category.
35
+
36
+
37
+
38
+
39
+
40
+ ## [2.1.49](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-configure@2.1.48...@pie-element/charting-configure@2.1.49) (2022-05-30)
41
+
42
+ **Note:** Version bump only for package @pie-element/charting-configure
43
+
44
+
45
+
46
+
47
+
6
48
  ## [2.1.48](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-configure@2.1.47...@pie-element/charting-configure@2.1.48) (2022-05-16)
7
49
 
8
50
  **Note:** Version bump only for package @pie-element/charting-configure
@@ -31,6 +31,8 @@ var _styles = require("@material-ui/core/styles");
31
31
 
32
32
  var _charting = require("@pie-lib/charting");
33
33
 
34
+ var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
35
+
34
36
  var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
35
37
 
36
38
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -79,12 +81,19 @@ var ChartingConfig = /*#__PURE__*/function (_React$Component) {
79
81
  data: data
80
82
  }));
81
83
  });
84
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeAddRemoveEnabled", function (value) {
85
+ return _this.props.onChange(_objectSpread(_objectSpread({}, _this.props.model), {}, {
86
+ addCategoryEnabled: value
87
+ }));
88
+ });
82
89
  return _this;
83
90
  }
84
91
 
85
92
  (0, _createClass2["default"])(ChartingConfig, [{
86
93
  key: "render",
87
94
  value: function render() {
95
+ var _this2 = this;
96
+
88
97
  var _this$props = this.props,
89
98
  classes = _this$props.classes,
90
99
  model = _this$props.model,
@@ -98,18 +107,28 @@ var ChartingConfig = /*#__PURE__*/function (_React$Component) {
98
107
  component: "div",
99
108
  type: "body1"
100
109
  }, /*#__PURE__*/React.createElement("span", null, "Use the tools below to set background shapes")), /*#__PURE__*/React.createElement(_charting.Chart, {
110
+ defineChart: true,
101
111
  chartType: model.chartType,
102
112
  size: model.graph,
103
113
  domain: model.domain,
104
114
  range: model.range,
105
- charts: charts,
106
- data: model.data,
115
+ charts: charts // index is a property used for setting the correct answer data; it's needed in order to remove categories from other data sets from the same index it was removed from the initial data
116
+ ,
117
+ data: model.data.map(function (category, index) {
118
+ return _objectSpread(_objectSpread({}, category), {}, {
119
+ index: index
120
+ });
121
+ }),
107
122
  title: model.title,
108
123
  onDataChange: this.changeData,
109
- editCategoryEnabled: true,
110
124
  addCategoryEnabled: true,
111
125
  categoryDefaultLabel: model.categoryDefaultLabel
112
- }))));
126
+ }), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Checkbox["default"], {
127
+ checked: model.addCategoryEnabled,
128
+ onChange: function onChange(e) {
129
+ _this2.changeAddRemoveEnabled(e.target.checked);
130
+ }
131
+ }), "Student can add categories"))));
113
132
  }
114
133
  }]);
115
134
  return ChartingConfig;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/charting-config.jsx"],"names":["styles","theme","container","marginTop","spacing","unit","marginBottom","display","flex","column","ChartingConfig","data","props","onChange","model","classes","charts","chartType","graph","domain","range","title","changeData","categoryDefaultLabel","React","Component","PropTypes","object","isRequired","func","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEF,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CADvB;AAETC,MAAAA,YAAY,EAAEL,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CAF1B;AAGTE,MAAAA,OAAO,EAAE,MAHA;AAITC,MAAAA,IAAI,EAAE;AAJG,KADY;AAOvBC,IAAAA,MAAM,EAAE;AACND,MAAAA,IAAI,EAAE;AADA;AAPe,GAAL;AAAA,CAApB;;IAYaE,c;;;;;;;;;;;;;;;mGAQE,UAAAC,IAAI;AAAA,aAAI,MAAKC,KAAL,CAAWC,QAAX,iCAAyB,MAAKD,KAAL,CAAWE,KAApC;AAA2CH,QAAAA,IAAI,EAAJA;AAA3C,SAAJ;AAAA,K;;;;;;WAEjB,kBAAS;AACP,wBAAmC,KAAKC,KAAxC;AAAA,UAAQG,OAAR,eAAQA,OAAR;AAAA,UAAiBD,KAAjB,eAAiBA,KAAjB;AAAA,UAAwBE,MAAxB,eAAwBA,MAAxB;AAEA,0BACE,yEAGE;AAAK,QAAA,SAAS,EAAED,OAAO,CAACb;AAAxB,sBACE;AAAK,QAAA,SAAS,EAAEa,OAAO,CAACN,MAAxB;AAAgC,QAAA,GAAG,EAAC;AAApC,sBACE,oBAAC,sBAAD;AAAY,QAAA,SAAS,EAAC,KAAtB;AAA4B,QAAA,IAAI,EAAC;AAAjC,sBACE,iFADF,CADF,eAKE,oBAAC,eAAD;AACE,QAAA,SAAS,EAAEK,KAAK,CAACG,SADnB;AAEE,QAAA,IAAI,EAAEH,KAAK,CAACI,KAFd;AAGE,QAAA,MAAM,EAAEJ,KAAK,CAACK,MAHhB;AAIE,QAAA,KAAK,EAAEL,KAAK,CAACM,KAJf;AAKE,QAAA,MAAM,EAAEJ,MALV;AAME,QAAA,IAAI,EAAEF,KAAK,CAACH,IANd;AAOE,QAAA,KAAK,EAAEG,KAAK,CAACO,KAPf;AAQE,QAAA,YAAY,EAAE,KAAKC,UARrB;AASE,QAAA,mBAAmB,EAAE,IATvB;AAUE,QAAA,kBAAkB,EAAE,IAVtB;AAWE,QAAA,oBAAoB,EAAER,KAAK,CAACS;AAX9B,QALF,CADF,CAHF,CADF;AA4BD;;;EAzCiCC,KAAK,CAACC,S;;;iCAA7Bf,c,eACQ;AACjBK,EAAAA,OAAO,EAAEW,sBAAUC,MAAV,CAAiBC,UADT;AAEjBd,EAAAA,KAAK,EAAEY,sBAAUC,MAAV,CAAiBC,UAFP;AAGjBf,EAAAA,QAAQ,EAAEa,sBAAUG,IAAV,CAAeD,UAHR;AAIjBZ,EAAAA,MAAM,EAAEU,sBAAUI;AAJD,C;;eA2CN,wBAAW9B,MAAX,EAAmBU,cAAnB,C","sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Chart } from '@pie-lib/charting';\n\nimport Typography from '@material-ui/core/Typography';\n\nconst styles = theme => ({\n container: {\n marginTop: theme.spacing.unit * 3,\n marginBottom: theme.spacing.unit * 3,\n display: 'flex',\n flex: 1,\n },\n column: {\n flex: 1\n }\n});\n\nexport class ChartingConfig extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n charts: PropTypes.array\n };\n\n changeData = data => this.props.onChange({ ...this.props.model, data });\n\n render() {\n const { classes, model, charts } = this.props;\n\n return (\n <div>\n Define Graph Attributes\n\n <div className={classes.container}>\n <div className={classes.column} key=\"graph\">\n <Typography component=\"div\" type=\"body1\">\n <span>Use the tools below to set background shapes</span>\n </Typography>\n\n <Chart\n chartType={model.chartType}\n size={model.graph}\n domain={model.domain}\n range={model.range}\n charts={charts}\n data={model.data}\n title={model.title}\n onDataChange={this.changeData}\n editCategoryEnabled={true}\n addCategoryEnabled={true}\n categoryDefaultLabel={model.categoryDefaultLabel}\n />\n </div>\n\n </div>\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(ChartingConfig);\n"],"file":"charting-config.js"}
1
+ {"version":3,"sources":["../src/charting-config.jsx"],"names":["styles","theme","container","marginTop","spacing","unit","marginBottom","display","flex","column","ChartingConfig","data","props","onChange","model","value","addCategoryEnabled","classes","charts","chartType","graph","domain","range","map","category","index","title","changeData","categoryDefaultLabel","e","changeAddRemoveEnabled","target","checked","React","Component","PropTypes","object","isRequired","func","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEF,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CADvB;AAETC,MAAAA,YAAY,EAAEL,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CAF1B;AAGTE,MAAAA,OAAO,EAAE,MAHA;AAITC,MAAAA,IAAI,EAAE;AAJG,KADY;AAOvBC,IAAAA,MAAM,EAAE;AACND,MAAAA,IAAI,EAAE;AADA;AAPe,GAAL;AAAA,CAApB;;IAYaE,c;;;;;;;;;;;;;;;mGAQE,UAAAC,IAAI;AAAA,aAAI,MAAKC,KAAL,CAAWC,QAAX,iCAAyB,MAAKD,KAAL,CAAWE,KAApC;AAA2CH,QAAAA,IAA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Ed,KAAK,CAACE,kBADjB;AAEE,QAAA,QAAQ,EAAE,kBAACa,CAAD,EAAO;AACf,UAAA,MAAI,CAACC,sBAAL,CAA4BD,CAAC,CAACE,MAAF,CAASC,OAArC;AACD;AAJH,QADD,+BAnBH,CADF,CAHF,CADF;AAsCD;;;EArDiCC,KAAK,CAACC,S;;;iCAA7BxB,c,eACQ;AACjBO,EAAAA,OAAO,EAAEkB,sBAAUC,MAAV,CAAiBC,UADT;AAEjBvB,EAAAA,KAAK,EAAEqB,sBAAUC,MAAV,CAAiBC,UAFP;AAGjBxB,EAAAA,QAAQ,EAAEsB,sBAAUG,IAAV,CAAeD,UAHR;AAIjBnB,EAAAA,MAAM,EAAEiB,sBAAUI;AAJD,C;;eAuDN,wBAAWvC,MAAX,EAAmBU,cAAnB,C","sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Chart } from '@pie-lib/charting';\nimport Checkbox from '@material-ui/core/Checkbox';\n\nimport Typography from '@material-ui/core/Typography';\n\nconst styles = theme => ({\n container: {\n marginTop: theme.spacing.unit * 3,\n marginBottom: theme.spacing.unit * 3,\n display: 'flex',\n flex: 1,\n },\n column: {\n flex: 1\n }\n});\n\nexport class ChartingConfig extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n charts: PropTypes.array\n };\n\n changeData = data => this.props.onChange({ ...this.props.model, data });\n\n changeAddRemoveEnabled = value => this.props.onChange({ ...this.props.model, addCategoryEnabled: value });\n\n render() {\n const { classes, model, charts } = this.props;\n\n return (\n <div>\n Define Graph Attributes\n\n <div className={classes.container}>\n <div className={classes.column} key=\"graph\">\n <Typography component=\"div\" type=\"body1\">\n <span>Use the tools below to set background shapes</span>\n </Typography>\n\n <Chart\n defineChart={true}\n chartType={model.chartType}\n size={model.graph}\n domain={model.domain}\n range={model.range}\n charts={charts}\n // index is a property used for setting the correct answer data; it's needed in order to remove categories from other data sets from the same index it was removed from the initial data\n data={model.data.map((category, index) => ({ ...category, index: index }))}\n title={model.title}\n onDataChange={this.changeData}\n addCategoryEnabled={true}\n categoryDefaultLabel={model.categoryDefaultLabel}\n />\n <div>\n <Checkbox\n checked={model.addCategoryEnabled}\n onChange={(e) => {\n this.changeAddRemoveEnabled(e.target.checked)\n }}\n />\n Student can add categories\n </div>\n </div>\n\n </div>\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(ChartingConfig);\n"],"file":"charting-config.js"}
@@ -41,8 +41,6 @@ var _chartingConfig = _interopRequireDefault(require("./charting-config"));
41
41
 
42
42
  var _correctResponse = _interopRequireDefault(require("./correct-response"));
43
43
 
44
- var _chartType = _interopRequireDefault(require("./chart-type"));
45
-
46
44
  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; }
47
45
 
48
46
  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; }
@@ -124,8 +122,6 @@ var Configure = /*#__PURE__*/function (_React$Component) {
124
122
  (0, _createClass2["default"])(Configure, [{
125
123
  key: "render",
126
124
  value: function render() {
127
- var _this2 = this;
128
-
129
125
  var _this$props = this.props,
130
126
  classes = _this$props.classes,
131
127
  model = _this$props.model,
@@ -150,7 +146,11 @@ var Configure = /*#__PURE__*/function (_React$Component) {
150
146
  _ref$prompt = _ref.prompt,
151
147
  prompt = _ref$prompt === void 0 ? {} : _ref$prompt,
152
148
  _ref$spellCheck = _ref.spellCheck,
153
- spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck;
149
+ spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck,
150
+ _ref$maxImageWidth = _ref.maxImageWidth,
151
+ maxImageWidth = _ref$maxImageWidth === void 0 ? {} : _ref$maxImageWidth,
152
+ _ref$maxImageHeight = _ref.maxImageHeight,
153
+ maxImageHeight = _ref$maxImageHeight === void 0 ? {} : _ref$maxImageHeight;
154
154
 
155
155
  var _ref2 = model || {},
156
156
  teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled,
@@ -158,6 +158,8 @@ var Configure = /*#__PURE__*/function (_React$Component) {
158
158
  rationaleEnabled = _ref2.rationaleEnabled,
159
159
  spellCheckEnabled = _ref2.spellCheckEnabled;
160
160
 
161
+ var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
162
+ var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
161
163
  return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
162
164
  settings: /*#__PURE__*/_react["default"].createElement(Panel, {
163
165
  model: model,
@@ -206,7 +208,9 @@ var Configure = /*#__PURE__*/function (_React$Component) {
206
208
  onChange: this.onTeacherInstructionsChange,
207
209
  imageSupport: imageSupport,
208
210
  nonEmpty: false,
209
- spellCheck: spellCheckEnabled
211
+ spellCheck: spellCheckEnabled,
212
+ maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
213
+ maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight
210
214
  })), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
211
215
  label: prompt.label,
212
216
  className: classes.promptHolder
@@ -217,7 +221,9 @@ var Configure = /*#__PURE__*/function (_React$Component) {
217
221
  imageSupport: imageSupport,
218
222
  nonEmpty: false,
219
223
  spellCheck: spellCheckEnabled,
220
- disableUnderline: true
224
+ disableUnderline: true,
225
+ maxImageWidth: defaultImageMaxWidth,
226
+ maxImageHeight: defaultImageMaxHeight
221
227
  })), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
222
228
  label: rationale.label || 'Rationale',
223
229
  className: classes.promptHolder
@@ -226,12 +232,14 @@ var Configure = /*#__PURE__*/function (_React$Component) {
226
232
  markup: model.rationale || '',
227
233
  onChange: this.onRationaleChange,
228
234
  imageSupport: imageSupport,
229
- spellCheck: spellCheckEnabled
230
- })), /*#__PURE__*/_react["default"].createElement(_chartType["default"], {
231
- value: model.chartType,
232
- onChange: function onChange(e) {
233
- return _this2.onChartTypeChange(e.target.value);
234
- }
235
+ spellCheck: spellCheckEnabled,
236
+ maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
237
+ maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight
238
+ })), /*#__PURE__*/_react["default"].createElement(_charting.ConfigureChartPanel, {
239
+ config: graph,
240
+ model: model,
241
+ onChange: this.props.onModelChanged,
242
+ charts: charts
235
243
  }), /*#__PURE__*/_react["default"].createElement(_chartingConfig["default"], {
236
244
  config: graph,
237
245
  model: model,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/configure.jsx"],"names":["log","Panel","settings","toggle","radio","numberFields","styles","theme","title","fontSize","display","marginTop","spacing","unit","marginBottom","content","promptHolder","width","paddingBottom","prompt","paddingTop","charts","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","Configure","rationale","props","onModelChanged","model","teacherInstructions","chartType","classes","configuration","onConfigurationChanged","imageSupport","graph","scoringType","studentInstructions","spellCheck","teacherInstructionsEnabled","promptEnabled","rationaleEnabled","spellCheckEnabled","label","suffix","min","max","height","Properties","studentInstructionsEnabled","onTeacherInstructionsChange","onPromptChange","onRationaleChange","e","onChartTypeChange","target","value","React","Component","PropTypes","func","object","isRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;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X;AAJV,QAtEF,CA/CF,CADF;AA+HD;;;EA9K4ByC,kBAAMC,S;;;iCAAxBlC,S,eACQ;AACjBG,EAAAA,cAAc,EAAEgC,sBAAUC,IADT;AAEjB3B,EAAAA,sBAAsB,EAAE0B,sBAAUC,IAFjB;AAGjB7B,EAAAA,OAAO,EAAE4B,sBAAUE,MAHF;AAIjB3B,EAAAA,YAAY,EAAEyB,sBAAUE,MAJP;AAKjBjC,EAAAA,KAAK,EAAE+B,sBAAUE,MAAV,CAAiBC,UALP;AAMjB9B,EAAAA,aAAa,EAAE2B,sBAAUE,MAAV,CAAiBC;AANf,C;iCADRtC,S,kBAUW;AAAEO,EAAAA,OAAO,EAAE;AAAX,C;;eAuKT,wBAAW9B,MAAX,EAAmBuB,SAAnB,C","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport { chartTypes } from '@pie-lib/charting';\nimport { settings, layout, InputContainer } from '@pie-lib/config-ui';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport Typography from '@material-ui/core/Typography';\nimport EditableHtml from '@pie-lib/editable-html';\n\nimport ChartingConfig from './charting-config';\nimport CorrectResponse from './correct-response';\nimport ChartType from './chart-type';\n\nconst log = debug('@pie-element:graphing:configure');\nconst { Panel, toggle, radio, numberFields } = settings;\n\nconst styles = (theme) => ({\n title: {\n fontSize: '1.1rem',\n display: 'block',\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit,\n },\n content: {\n marginTop: theme.spacing.unit * 2,\n },\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n marginTop: theme.spacing.unit * 2,\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n },\n});\n\nconst charts = [\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n];\n\nexport class Configure extends React.Component {\n static propTypes = {\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n classes: PropTypes.object,\n imageSupport: PropTypes.object,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n };\n\n static defaultProps = { classes: {} };\n\n onRationaleChange = (rationale) =>\n this.props.onModelChanged({ ...this.props.model, rationale });\n\n onPromptChange = (prompt) =>\n this.props.onModelChanged({ ...this.props.model, prompt });\n\n onTeacherInstructionsChange = (teacherInstructions) =>\n this.props.onModelChanged({ ...this.props.model, teacherInstructions });\n\n onChartTypeChange = (chartType) =>\n this.props.onModelChanged({ ...this.props.model, chartType });\n\n render() {\n const {\n classes,\n model,\n configuration,\n onConfigurationChanged,\n onModelChanged,\n imageSupport,\n } = this.props;\n log('[render] model', model);\n const { graph } = model;\n const {\n title = {},\n rationale = {},\n scoringType = {},\n studentInstructions = {},\n teacherInstructions = {},\n prompt = {},\n spellCheck = {}\n } = configuration || {};\n const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled, spellCheckEnabled } =\n model || {};\n\n return (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={onModelChanged}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n 'Item Type': {\n 'title.enabled': title.settings && toggle(title.label, true),\n graph: numberFields('Graph Display Size', {\n width: {\n label: 'Width',\n suffix: 'px',\n min: 400,\n max: 700,\n },\n height: {\n label: 'Height',\n suffix: 'px',\n min: 400,\n max: 700,\n },\n }),\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n studentInstructionsEnabled:\n studentInstructions.settings &&\n toggle(studentInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n scoringType:\n scoringType.settings &&\n radio(scoringType.label, [\n 'all or nothing',\n 'partial scoring',\n ]),\n },\n }}\n />\n }\n >\n <div className={classes.content}>\n <Typography component=\"div\" type=\"body1\">\n <span>\n This interaction asks a student to draw a chart that meets\n specific criteria. The student will draw a category on the chart\n by clicking Add Category and dragging the top part of the\n category.\n </span>\n </Typography>\n\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer\n label={prompt.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n spellCheck={spellCheckEnabled}\n disableUnderline\n />\n </InputContainer>\n )}\n\n {rationaleEnabled && (\n <InputContainer\n label={rationale.label || 'Rationale'}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChange}\n imageSupport={imageSupport}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n\n <ChartType\n value={model.chartType}\n onChange={(e) => this.onChartTypeChange(e.target.value)}\n />\n\n <ChartingConfig\n config={graph}\n model={model}\n onChange={onModelChanged}\n charts={charts}\n />\n\n <CorrectResponse\n config={graph}\n model={model}\n onChange={onModelChanged}\n charts={charts}\n />\n </div>\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default withStyles(styles)(Configure);\n"],"file":"configure.js"}
1
+ {"version":3,"sources":["../src/configure.jsx"],"names":["log","Panel","settings","toggle","radio","numberFields","styles","theme","title","fontSize","display","marginTop","spacing","unit","marginBottom","content","promptHolder","width","paddingBottom","prompt","paddingTop","charts","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","Configure","rationale","props","onModelChanged","model","teacherInstructions","chartType","classes","configuration","onConfigurationChanged","imageSupport","graph","scoringType","studentInstructions","spellCheck","maxImageWidth","maxImageHeight","teacherInstructionsEnabled","promptEnabled","rationaleEnabled","spellCheckEnabled","defaultImageMaxWidth","defaultImageMaxHeight","label","suffix","min","max","height","Properties","studentInstructionsEnabled","onTeacherInstructionsChange","onPromptChange","onRationaleChange","React","Component","PropTypes","func","object","isRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAGA,IAAMA,GAAG,GAAG,uBAAM,iCAAN,CAAZ;AACA,IAAQC,KAAR,GAA+CC,kBAA/C,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA+CD,kBAA/C,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAA+CF,kBAA/C,CAAuBE,KAAvB;AAAA,IAA8BC,YAA9B,GAA+CH,kBAA/C,CAA8BG,YAA9B;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,KAAK,EAAE;AACLC,MAAAA,QAAQ,EAAE,QADL;AAELC,MAAAA,OAAO,EAAE,OAFJ;AAGLC,MAAAA,SAAS,EAAEJ,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CAH3B;AAILC,MAAAA,YAAY,EAAEP,KAAK,CAACK,OAAN,CAAcC;AAJvB,KADkB;AAOzBE,IAAAA,OAAO,EAAE;AACPJ,MAAAA,SAAS,EAAEJ,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB;AADzB,KAPgB;AAUzBG,IAAAA,YAAY,EAAE;AACZC,MAAAA,KAAK,EAAE,MADK;AAEZC,MAAAA,aAAa,EAAEX,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CAFxB;AAGZC,MAAAA,YAAY,EAAEP,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CAHvB;AAIZF,MAAAA,SAAS,EAAEJ,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB;A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AE;AAAX,C;;eAoLT,wBAAW9B,MAAX,EAAmBuB,SAAnB,C","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport { chartTypes, ConfigureChartPanel } from '@pie-lib/charting';\nimport { settings, layout, InputContainer } from '@pie-lib/config-ui';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport Typography from '@material-ui/core/Typography';\nimport EditableHtml from '@pie-lib/editable-html';\n\nimport ChartingConfig from './charting-config';\nimport CorrectResponse from './correct-response';\n\n\nconst log = debug('@pie-element:graphing:configure');\nconst { Panel, toggle, radio, numberFields } = settings;\n\nconst styles = (theme) => ({\n title: {\n fontSize: '1.1rem',\n display: 'block',\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit,\n },\n content: {\n marginTop: theme.spacing.unit * 2,\n },\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n marginTop: theme.spacing.unit * 2,\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n },\n});\n\nconst charts = [\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n];\n\nexport class Configure extends React.Component {\n static propTypes = {\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n classes: PropTypes.object,\n imageSupport: PropTypes.object,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n };\n\n static defaultProps = { classes: {} };\n\n onRationaleChange = (rationale) =>\n this.props.onModelChanged({ ...this.props.model, rationale });\n\n onPromptChange = (prompt) =>\n this.props.onModelChanged({ ...this.props.model, prompt });\n\n onTeacherInstructionsChange = (teacherInstructions) =>\n this.props.onModelChanged({ ...this.props.model, teacherInstructions });\n\n onChartTypeChange = (chartType) =>\n this.props.onModelChanged({ ...this.props.model, chartType });\n\n render() {\n const {\n classes,\n model,\n configuration,\n onConfigurationChanged,\n onModelChanged,\n imageSupport,\n } = this.props;\n log('[render] model', model);\n const { graph } = model;\n const {\n title = {},\n rationale = {},\n scoringType = {},\n studentInstructions = {},\n teacherInstructions = {},\n prompt = {},\n spellCheck = {},\n maxImageWidth = {},\n maxImageHeight = {}\n } = configuration || {};\n const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled, spellCheckEnabled } =\n model || {};\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n return (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={onModelChanged}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n 'Item Type': {\n 'title.enabled': title.settings && toggle(title.label, true),\n graph: numberFields('Graph Display Size', {\n width: {\n label: 'Width',\n suffix: 'px',\n min: 400,\n max: 700,\n },\n height: {\n label: 'Height',\n suffix: 'px',\n min: 400,\n max: 700,\n },\n }),\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n studentInstructionsEnabled:\n studentInstructions.settings &&\n toggle(studentInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n scoringType:\n scoringType.settings &&\n radio(scoringType.label, [\n 'all or nothing',\n 'partial scoring',\n ]),\n },\n }}\n />\n }\n >\n <div className={classes.content}>\n <Typography component=\"div\" type=\"body1\">\n <span>\n This interaction asks a student to draw a chart that meets\n specific criteria. The student will draw a category on the chart\n by clicking Add Category and dragging the top part of the\n category.\n </span>\n </Typography>\n\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth}\n maxImageHeight={maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer\n label={prompt.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n spellCheck={spellCheckEnabled}\n disableUnderline\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n />\n </InputContainer>\n )}\n\n {rationaleEnabled && (\n <InputContainer\n label={rationale.label || 'Rationale'}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChange}\n imageSupport={imageSupport}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth}\n maxImageHeight={maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight}\n />\n </InputContainer>\n )}\n\n <ConfigureChartPanel\n config={graph}\n model={model}\n onChange={this.props.onModelChanged}\n charts={charts}\n />\n\n <ChartingConfig\n config={graph}\n model={model}\n onChange={onModelChanged}\n charts={charts}\n />\n\n <CorrectResponse\n config={graph}\n model={model}\n onChange={onModelChanged}\n charts={charts}\n />\n </div>\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default withStyles(styles)(Configure);\n"],"file":"configure.js"}
@@ -21,6 +21,10 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
21
21
 
22
22
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
23
 
24
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
25
+
26
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
27
+
24
28
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
29
 
26
30
  var React = _interopRequireWildcard(require("react"));
@@ -29,22 +33,27 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
29
33
 
30
34
  var _styles = require("@material-ui/core/styles");
31
35
 
32
- var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
33
-
34
36
  var _charting = require("@pie-lib/charting");
35
37
 
36
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
38
+ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
37
39
 
38
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
40
+ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
39
41
 
40
- 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; }
42
+ var _excluded = ["editable", "interactive", "deletable"],
43
+ _excluded2 = ["interactive", "editable", "index"];
41
44
 
42
- 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; }
45
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
46
+
47
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
43
48
 
44
49
  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); }; }
45
50
 
46
51
  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; } }
47
52
 
53
+ 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; }
54
+
55
+ 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; }
56
+
48
57
  var styles = function styles(theme) {
49
58
  return {
50
59
  container: {
@@ -64,21 +73,74 @@ var styles = function styles(theme) {
64
73
  };
65
74
  };
66
75
 
76
+ var addCategoryProps = function addCategoryProps(correctAnswer, data) {
77
+ return correctAnswer.map(function (correct, index) {
78
+ return _objectSpread(_objectSpread({}, correct), {}, {
79
+ editable: index < data.length ? data[index].editable : true,
80
+ interactive: index < data.length ? data[index].interactive : true,
81
+ deletable: index >= data.length ? true : false
82
+ });
83
+ });
84
+ };
85
+
86
+ var updateCorrectResponseData = function updateCorrectResponseData(correctAnswer, data) {
87
+ if (!correctAnswer) {
88
+ return data;
89
+ }
90
+
91
+ var correctAnswerData = (0, _toConsumableArray2["default"])(correctAnswer);
92
+ var correctResponseDefinition = [];
93
+ data.forEach(function (category, currentIndex) {
94
+ var _correctAnswer$curren, _correctAnswer$curren2;
95
+
96
+ var editable = category.editable;
97
+ var interactive = category.interactive;
98
+ var label = editable && (_correctAnswer$curren = correctAnswer[currentIndex]) !== null && _correctAnswer$curren !== void 0 && _correctAnswer$curren.label ? correctAnswer[currentIndex].label : category.label;
99
+ var value = interactive && (_correctAnswer$curren2 = correctAnswer[currentIndex]) !== null && _correctAnswer$curren2 !== void 0 && _correctAnswer$curren2.value ? correctAnswer[currentIndex].value : category.value;
100
+ correctResponseDefinition[currentIndex] = {
101
+ label: label,
102
+ value: value,
103
+ editable: category.editable,
104
+ interactive: category.interactive
105
+ };
106
+ });
107
+
108
+ if (correctResponseDefinition.length < correctAnswer.length) {
109
+ var missingCategories = correctAnswerData.slice(correctResponseDefinition.length, correctAnswer.length);
110
+ return addCategoryProps(correctResponseDefinition.concat(missingCategories), data);
111
+ }
112
+
113
+ return correctResponseDefinition;
114
+ };
115
+
116
+ var insertCategory = function insertCategory(correctAnswer, data) {
117
+ var positionToInsert = data.length - 1;
118
+ var _data = data[data.length - 1],
119
+ editable = _data.editable,
120
+ interactive = _data.interactive,
121
+ deletable = _data.deletable,
122
+ categoryToInsert = (0, _objectWithoutProperties2["default"])(_data, _excluded);
123
+ correctAnswer.splice(positionToInsert, 0, categoryToInsert);
124
+ var correctAnswerData = (0, _toConsumableArray2["default"])(correctAnswer);
125
+ return addCategoryProps(correctAnswerData, data);
126
+ };
127
+
128
+ var removeCategory = function removeCategory(correctAnswer, data, positionToRemove) {
129
+ correctAnswer.splice(positionToRemove, 1);
130
+ var correctAnswerData = (0, _toConsumableArray2["default"])(correctAnswer);
131
+ return addCategoryProps(correctAnswerData, data);
132
+ };
133
+
67
134
  var CorrectResponse = /*#__PURE__*/function (_React$Component) {
68
135
  (0, _inherits2["default"])(CorrectResponse, _React$Component);
69
136
 
70
137
  var _super = _createSuper(CorrectResponse);
71
138
 
72
- function CorrectResponse() {
139
+ function CorrectResponse(props) {
73
140
  var _this;
74
141
 
75
142
  (0, _classCallCheck2["default"])(this, CorrectResponse);
76
-
77
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
78
- args[_key] = arguments[_key];
79
- }
80
-
81
- _this = _super.call.apply(_super, [this].concat(args));
143
+ _this = _super.call(this, props);
82
144
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeData", function (data) {
83
145
  var _this$props = _this.props,
84
146
  model = _this$props.model,
@@ -89,35 +151,104 @@ var CorrectResponse = /*#__PURE__*/function (_React$Component) {
89
151
 
90
152
  onChange(_objectSpread(_objectSpread({}, model), {}, {
91
153
  correctAnswer: _objectSpread(_objectSpread({}, correctAnswer), {}, {
92
- data: data
154
+ data: data.map(function (_ref2) {
155
+ var interactive = _ref2.interactive,
156
+ editable = _ref2.editable,
157
+ index = _ref2.index,
158
+ keepAttrs = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
159
+ return keepAttrs;
160
+ })
93
161
  })
94
162
  }));
95
163
  });
96
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeEditable", function (value) {
97
- return _this.props.onChange(_objectSpread(_objectSpread({}, _this.props.model), {}, {
98
- editCategoryEnabled: value
99
- }));
100
- });
101
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeAddRemoveEnabled", function (value) {
102
- return _this.props.onChange(_objectSpread(_objectSpread({}, _this.props.model), {}, {
103
- addCategoryEnabled: value
104
- }));
105
- });
164
+ _this.state = {
165
+ categories: updateCorrectResponseData(props.model.correctAnswer.data, props.model.data)
166
+ };
106
167
  return _this;
107
168
  }
108
169
 
109
170
  (0, _createClass2["default"])(CorrectResponse, [{
171
+ key: "UNSAFE_componentWillReceiveProps",
172
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
173
+ var _nextProps$model = nextProps.model;
174
+ _nextProps$model = _nextProps$model === void 0 ? {} : _nextProps$model;
175
+ var _nextProps$model$data = _nextProps$model.data,
176
+ nextData = _nextProps$model$data === void 0 ? [] : _nextProps$model$data,
177
+ _nextProps$model$corr = _nextProps$model.correctAnswer.data,
178
+ nextCorrectAnswerData = _nextProps$model$corr === void 0 ? [] : _nextProps$model$corr;
179
+ var _this$props$model = this.props.model;
180
+ _this$props$model = _this$props$model === void 0 ? {} : _this$props$model;
181
+ var _this$props$model$dat = _this$props$model.data,
182
+ data = _this$props$model$dat === void 0 ? [] : _this$props$model$dat;
183
+ var categories = this.state.categories;
184
+ var nextCategories = [];
185
+
186
+ if (nextData.length > data.length && nextCorrectAnswerData.length > data.length) {
187
+ nextCategories = insertCategory(nextCorrectAnswerData, nextData);
188
+ }
189
+
190
+ if (nextData.length < data.length) {
191
+ var removedIndex = nextData.length; // we need to remove the category from the correct answer data and categories, from the same index it was removed from the data
192
+ // index is a property of the nextData category
193
+
194
+ for (var index = 0; index < nextData.length; index++) {
195
+ if (nextData[index].index !== index) {
196
+ removedIndex = index;
197
+ break;
198
+ }
199
+ }
200
+
201
+ this.props.model.correctAnswer.data.splice(removedIndex, 1);
202
+ nextCategories = removeCategory(categories, nextData, removedIndex);
203
+ }
204
+
205
+ if (!(0, _isEqual["default"])(nextCorrectAnswerData, this.props.model.correctAnswer.data)) {
206
+ nextCategories = nextCorrectAnswerData.map(function (correct, index) {
207
+ return _objectSpread(_objectSpread({}, correct), {}, {
208
+ editable: index < data.length ? data[index].editable : true,
209
+ interactive: index < data.length ? data[index].interactive : true
210
+ });
211
+ });
212
+ } else if ((0, _isEmpty["default"])(nextCategories)) {
213
+ nextCategories = updateCorrectResponseData(nextCorrectAnswerData, nextData);
214
+ nextCorrectAnswerData.map(function (answer, currentIndex) {
215
+ var dataExists = currentIndex < nextData.length;
216
+ var label;
217
+ var value;
218
+ var deletable;
219
+
220
+ if (dataExists) {
221
+ label = nextData[currentIndex].editable ? answer.label : nextData[currentIndex].label;
222
+ value = nextData[currentIndex].interactive ? answer.value : nextData[currentIndex].value;
223
+ } else {
224
+ label = answer.label;
225
+ value = answer.value;
226
+ deletable = true;
227
+ }
228
+
229
+ nextCorrectAnswerData[currentIndex] = {
230
+ label: label,
231
+ value: value
232
+ };
233
+ });
234
+ }
235
+
236
+ if (!(0, _isEqual["default"])(nextCategories, data)) {
237
+ this.setState({
238
+ categories: nextCategories
239
+ });
240
+ }
241
+ }
242
+ }, {
110
243
  key: "render",
111
244
  value: function render() {
112
245
  var _this2 = this;
113
246
 
114
247
  var _this$props2 = this.props,
115
- classes = _this$props2.classes,
116
248
  model = _this$props2.model,
117
249
  charts = _this$props2.charts;
250
+ var categories = this.state.categories;
118
251
  return /*#__PURE__*/React.createElement("div", null, "Define Correct Response", /*#__PURE__*/React.createElement("div", {
119
- className: classes.container
120
- }, /*#__PURE__*/React.createElement("div", {
121
252
  key: "correct-response-graph-".concat(model.correctAnswer.name)
122
253
  }, /*#__PURE__*/React.createElement("p", null, model.correctAnswer.name), /*#__PURE__*/React.createElement(_charting.Chart, {
123
254
  chartType: model.chartType,
@@ -125,25 +256,14 @@ var CorrectResponse = /*#__PURE__*/function (_React$Component) {
125
256
  domain: model.domain,
126
257
  range: model.range,
127
258
  charts: charts,
128
- data: model.correctAnswer.data || [],
259
+ data: categories,
129
260
  title: model.title,
130
261
  onDataChange: function onDataChange(data) {
131
262
  return _this2.changeData(data);
132
263
  },
133
- editCategoryEnabled: true,
134
- addCategoryEnabled: true,
264
+ addCategoryEnabled: model.addCategoryEnabled,
135
265
  categoryDefaultLabel: model.categoryDefaultLabel
136
- }), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Checkbox["default"], {
137
- checked: model.editCategoryEnabled,
138
- onChange: function onChange(e) {
139
- _this2.changeEditable(e.target.checked);
140
- }
141
- }), "Student can edit category labels"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Checkbox["default"], {
142
- checked: model.addCategoryEnabled,
143
- onChange: function onChange(e) {
144
- _this2.changeAddRemoveEnabled(e.target.checked);
145
- }
146
- }), "Student can add/remove category labels"))));
266
+ })));
147
267
  }
148
268
  }]);
149
269
  return CorrectResponse;