@pie-element/charting 6.4.3 → 6.5.1-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,359 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = exports.CorrectResponse = void 0;
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
25
-
26
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
27
-
28
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
29
-
30
- var React = _interopRequireWildcard(require("react"));
31
-
32
- var _propTypes = _interopRequireDefault(require("prop-types"));
33
-
34
- var _styles = require("@material-ui/core/styles");
35
-
36
- var _charting = require("@pie-lib/charting");
37
-
38
- var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
39
-
40
- var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
41
-
42
- var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
43
-
44
- var _excluded = ["editable", "interactive", "deletable"],
45
- _excluded2 = ["interactive", "editable", "index"];
46
-
47
- 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); }
48
-
49
- 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; }
50
-
51
- 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); }; }
52
-
53
- 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; } }
54
-
55
- 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; }
56
-
57
- 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; }
58
-
59
- var styles = function styles(theme) {
60
- return {
61
- container: {
62
- marginBottom: theme.spacing.unit * 2.5,
63
- display: 'flex',
64
- flex: 1
65
- },
66
- button: {
67
- marginTop: theme.spacing.unit * 3,
68
- cursor: 'pointer',
69
- background: theme.palette.grey[200],
70
- padding: theme.spacing.unit * 2,
71
- width: 'fit-content',
72
- borderRadius: '4px'
73
- },
74
- column: {
75
- flex: 1
76
- },
77
- chartError: {
78
- border: "2px solid ".concat(theme.palette.error.main)
79
- },
80
- errorText: {
81
- fontSize: theme.typography.fontSize - 2,
82
- color: theme.palette.error.main,
83
- paddingTop: theme.spacing.unit
84
- },
85
- title: {
86
- marginBottom: theme.spacing.unit
87
- }
88
- };
89
- };
90
-
91
- var addCategoryProps = function addCategoryProps(correctAnswer, data) {
92
- return correctAnswer.map(function (correct, index) {
93
- return _objectSpread(_objectSpread({}, correct), {}, {
94
- editable: index < data.length ? data[index].editable : true,
95
- interactive: index < data.length ? data[index].interactive : true,
96
- deletable: index >= data.length ? true : false
97
- });
98
- });
99
- };
100
-
101
- var updateCorrectResponseData = function updateCorrectResponseData(correctAnswer, data) {
102
- if (!correctAnswer) {
103
- return data;
104
- }
105
-
106
- var correctAnswerData = (0, _toConsumableArray2["default"])(correctAnswer);
107
- var correctResponseDefinition = [];
108
- (data || []).forEach(function (category, currentIndex) {
109
- var _correctAnswer$curren, _correctAnswer$curren2, _correctAnswer$curren3;
110
-
111
- var editable = category.editable;
112
- var interactive = category.interactive;
113
- var label = editable && (_correctAnswer$curren = correctAnswer[currentIndex]) !== null && _correctAnswer$curren !== void 0 && _correctAnswer$curren.label ? correctAnswer[currentIndex].label : category.label;
114
- var value = interactive && (_correctAnswer$curren2 = correctAnswer[currentIndex]) !== null && _correctAnswer$curren2 !== void 0 && _correctAnswer$curren2.value || interactive && ((_correctAnswer$curren3 = correctAnswer[currentIndex]) === null || _correctAnswer$curren3 === void 0 ? void 0 : _correctAnswer$curren3.value) == 0 ? correctAnswer[currentIndex].value : category.value;
115
- correctResponseDefinition[currentIndex] = {
116
- label: label,
117
- value: value,
118
- editable: category.editable,
119
- interactive: category.interactive
120
- };
121
- });
122
-
123
- if (correctResponseDefinition.length < correctAnswer.length) {
124
- var missingCategories = (correctAnswerData || []).slice(correctResponseDefinition.length, correctAnswer.length);
125
- return addCategoryProps((correctResponseDefinition || []).concat(missingCategories), data);
126
- }
127
-
128
- return correctResponseDefinition;
129
- };
130
-
131
- var insertCategory = function insertCategory(correctAnswer, data) {
132
- var positionToInsert = data.length - 1; // eslint-disable-next-line no-unused-vars
133
-
134
- var _data = data[data.length - 1],
135
- editable = _data.editable,
136
- interactive = _data.interactive,
137
- deletable = _data.deletable,
138
- categoryToInsert = (0, _objectWithoutProperties2["default"])(_data, _excluded);
139
- (correctAnswer || []).splice(positionToInsert, 0, categoryToInsert);
140
- var correctAnswerData = (0, _toConsumableArray2["default"])(correctAnswer);
141
- return addCategoryProps(correctAnswerData, data);
142
- };
143
-
144
- var removeCategory = function removeCategory(correctAnswer, data, positionToRemove) {
145
- (correctAnswer || []).splice(positionToRemove, 1);
146
- var correctAnswerData = (0, _toConsumableArray2["default"])(correctAnswer);
147
- return addCategoryProps(correctAnswerData, data);
148
- };
149
-
150
- var CorrectResponse = /*#__PURE__*/function (_React$Component) {
151
- (0, _inherits2["default"])(CorrectResponse, _React$Component);
152
-
153
- var _super = _createSuper(CorrectResponse);
154
-
155
- function CorrectResponse(props) {
156
- var _this;
157
-
158
- (0, _classCallCheck2["default"])(this, CorrectResponse);
159
- _this = _super.call(this, props);
160
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeData", function (data) {
161
- var _this$props = _this.props,
162
- model = _this$props.model,
163
- onChange = _this$props.onChange;
164
-
165
- var _ref = model || {},
166
- correctAnswer = _ref.correctAnswer;
167
-
168
- onChange(_objectSpread(_objectSpread({}, model), {}, {
169
- correctAnswer: _objectSpread(_objectSpread({}, correctAnswer), {}, {
170
- // eslint-disable-next-line no-unused-vars
171
- data: data.map(function (_ref2) {
172
- var interactive = _ref2.interactive,
173
- editable = _ref2.editable,
174
- index = _ref2.index,
175
- keepAttrs = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
176
- return keepAttrs;
177
- })
178
- })
179
- }));
180
- });
181
- _this.state = {
182
- categories: []
183
- };
184
- return _this;
185
- }
186
-
187
- (0, _createClass2["default"])(CorrectResponse, [{
188
- key: "getUpdatedCategories",
189
- value: function getUpdatedCategories(nextProps) {
190
- var prevProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.props;
191
- var prevState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.state;
192
- var nextData = nextProps.model.data || [];
193
- var data = prevProps.model.data || [];
194
- var nextCorrectAnswerData = nextProps.model.correctAnswer.data || [];
195
- var categories = prevState ? prevState.categories : [];
196
- var nextCategories = [];
197
-
198
- if (nextData.length > data.length) {
199
- nextCategories = insertCategory(nextCorrectAnswerData, nextData);
200
- }
201
-
202
- if (nextData.length < data.length) {
203
- 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
204
- // index is a property of the nextData category
205
-
206
- for (var index = 0; index < nextData.length; index++) {
207
- if (nextData[index].index !== index) {
208
- removedIndex = index;
209
- break;
210
- }
211
- }
212
-
213
- (this.props.model.correctAnswer.data || []).splice(removedIndex, 1);
214
- nextCategories = removeCategory(categories, nextData, removedIndex);
215
- return nextCategories;
216
- }
217
-
218
- if (nextCorrectAnswerData.length > 0 && !(0, _isEqual["default"])(nextCorrectAnswerData, this.props.model.correctAnswer.data)) {
219
- nextCategories = nextCorrectAnswerData.map(function (correct, index) {
220
- return _objectSpread(_objectSpread({}, correct), {}, {
221
- editable: index < data.length ? data[index].editable : true,
222
- interactive: index < data.length ? data[index].interactive : true
223
- });
224
- });
225
- } else if ((0, _isEmpty["default"])(nextCategories)) {
226
- nextCategories = updateCorrectResponseData(nextCorrectAnswerData, nextData);
227
- nextCorrectAnswerData.map(function (answer, currentIndex) {
228
- var dataExists = currentIndex < nextData.length;
229
- var label;
230
- var value;
231
-
232
- if (dataExists) {
233
- label = nextData[currentIndex].editable ? answer.label : nextData[currentIndex].label;
234
- value = nextData[currentIndex].interactive ? answer.value : nextData[currentIndex].value;
235
- } else {
236
- label = answer.label;
237
- value = answer.value;
238
- }
239
-
240
- nextCorrectAnswerData[currentIndex] = {
241
- label: label,
242
- value: value
243
- };
244
- });
245
- }
246
-
247
- if (!(0, _isEqual["default"])(nextCategories, data) || !(0, _isEqual["default"])(nextCorrectAnswerData, prevProps.model.correctAnswer.data) || !(0, _isEqual["default"])(nextCategories, categories) || (0, _isEmpty["default"])(nextCategories) && (0, _isEmpty["default"])(data)) {
248
- return nextCategories;
249
- }
250
-
251
- return null;
252
- }
253
- }, {
254
- key: "componentDidMount",
255
- value: function componentDidMount() {
256
- var initialCategories = this.getUpdatedCategories(this.props, this.props, null);
257
- this.setState({
258
- categories: initialCategories || updateCorrectResponseData(this.props.model.correctAnswer.data, this.props.model.data)
259
- });
260
- }
261
- }, {
262
- key: "componentDidUpdate",
263
- value: function componentDidUpdate(prevProps, prevState) {
264
- var _this$state$categorie;
265
-
266
- var nextCategories = this.getUpdatedCategories(this.props, prevProps, prevState); // this check is needed when all the categories are removed from Chart1
267
-
268
- if ((nextCategories === null || nextCategories === void 0 ? void 0 : nextCategories.length) === 0 && ((_this$state$categorie = this.state.categories) === null || _this$state$categorie === void 0 ? void 0 : _this$state$categorie.length) === 0 && prevProps.model.data.length > 0) {
269
- this.setState({
270
- categories: nextCategories
271
- });
272
- }
273
-
274
- if (nextCategories && !(0, _isEqual["default"])(nextCategories, this.state.categories)) {
275
- this.changeData(nextCategories);
276
- this.setState({
277
- categories: nextCategories
278
- });
279
- }
280
- }
281
- }, {
282
- key: "render",
283
- value: function render() {
284
- var _this2 = this;
285
-
286
- var _this$props2 = this.props,
287
- classes = _this$props2.classes,
288
- model = _this$props2.model,
289
- charts = _this$props2.charts,
290
- error = _this$props2.error,
291
- studentNewCategoryDefaultLabel = _this$props2.studentNewCategoryDefaultLabel,
292
- correctAnswerErrors = _this$props2.correctAnswerErrors,
293
- _this$props2$mathMlOp = _this$props2.mathMlOptions,
294
- mathMlOptions = _this$props2$mathMlOp === void 0 ? {} : _this$props2$mathMlOp;
295
- var categories = this.state.categories;
296
-
297
- var _ref3 = model || {},
298
- _ref3$domain = _ref3.domain,
299
- domain = _ref3$domain === void 0 ? {} : _ref3$domain,
300
- _ref3$range = _ref3.range,
301
- range = _ref3$range === void 0 ? {} : _ref3$range;
302
-
303
- var _ref4 = correctAnswerErrors || {},
304
- identicalError = _ref4.identicalError,
305
- categoriesError = _ref4.categoriesError;
306
-
307
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
308
- className: classes.title
309
- }, "Define Correct Response"), /*#__PURE__*/React.createElement("div", {
310
- className: classes.container
311
- }, /*#__PURE__*/React.createElement("div", {
312
- className: classes.column,
313
- key: "graph"
314
- }, /*#__PURE__*/React.createElement(_Typography["default"], {
315
- component: "div",
316
- type: "body1"
317
- }, /*#__PURE__*/React.createElement("span", null, "Use the tools below to define the correct answer.")), /*#__PURE__*/React.createElement("div", {
318
- key: "correct-response-graph-".concat(model.correctAnswer.name),
319
- className: identicalError || categoriesError ? classes.chartError : ''
320
- }, /*#__PURE__*/React.createElement(_charting.Chart, {
321
- chartType: model.chartType,
322
- size: model.graph,
323
- domain: domain,
324
- range: range,
325
- charts: charts,
326
- data: categories,
327
- title: model.title,
328
- onDataChange: function onDataChange(data) {
329
- return _this2.changeData(data);
330
- },
331
- addCategoryEnabled: model.addCategoryEnabled,
332
- categoryDefaultLabel: studentNewCategoryDefaultLabel,
333
- error: error,
334
- mathMlOptions: mathMlOptions
335
- })), (identicalError || categoriesError) && /*#__PURE__*/React.createElement(_Typography["default"], {
336
- component: "div",
337
- type: "body1",
338
- className: classes.errorText
339
- }, /*#__PURE__*/React.createElement("span", null, identicalError || categoriesError)))));
340
- }
341
- }]);
342
- return CorrectResponse;
343
- }(React.Component);
344
-
345
- exports.CorrectResponse = CorrectResponse;
346
- (0, _defineProperty2["default"])(CorrectResponse, "propTypes", {
347
- classes: _propTypes["default"].object.isRequired,
348
- correctAnswerErrors: _propTypes["default"].object,
349
- studentNewCategoryDefaultLabel: _propTypes["default"].string,
350
- model: _propTypes["default"].object.isRequired,
351
- onChange: _propTypes["default"].func.isRequired,
352
- charts: _propTypes["default"].array,
353
- error: _propTypes["default"].string
354
- });
355
-
356
- var _default = (0, _styles.withStyles)(styles)(CorrectResponse);
357
-
358
- exports["default"] = _default;
359
- //# sourceMappingURL=correct-response.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/correct-response.jsx"],"names":["styles","theme","container","marginBottom","spacing","unit","display","flex","button","marginTop","cursor","background","palette","grey","padding","width","borderRadius","column","chartError","border","error","main","errorText","fontSize","typography","color","paddingTop","title","addCategoryProps","correctAnswer","data","map","correct","index","editable","length","interactive","deletable","updateCorrectResponseData","correctAnswerData","correctResponseDefinition","forEach","category","currentIndex","label","value","missingCategories","slice","concat","insertCategory","positionToInsert","categoryToInsert","splice","removeCategory","positionToRemove","CorrectResponse","props","model","onChange","keepAttrs","state","categories","nextProps","prevProps","prevState","nextData","nextCorrectAnswerData","nextCategories","removedIndex","answer","dataExists","initialCategories","getUpdatedCategories","setState","changeData","classes","charts","studentNewCategoryDefaultLabel","correctAnswerErrors","mathMlOptions","domain","range","identicalError","categoriesError","name","chartType","graph","addCategoryEnabled","React","Component","PropTypes","object","isRequired","string","func","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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withStyles } from '@material-ui/core/styles';\nimport { Chart } from '@pie-lib/charting';\nimport isEqual from 'lodash/isEqual';\nimport isEmpty from 'lodash/isEmpty';\n\nimport Typography from '@material-ui/core/Typography';\n\nconst styles = (theme) => ({\n container: {\n marginBottom: theme.spacing.unit * 2.5,\n display: 'flex',\n flex: 1,\n },\n button: {\n marginTop: theme.spacing.unit * 3,\n cursor: 'pointer',\n background: theme.palette.grey[200],\n padding: theme.spacing.unit * 2,\n width: 'fit-content',\n borderRadius: '4px',\n },\n column: {\n flex: 1,\n },\n chartError: {\n border: `2px solid ${theme.palette.error.main}`,\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit,\n },\n title: {\n marginBottom: theme.spacing.unit,\n },\n});\n\nconst addCategoryProps = (correctAnswer, data) =>\n correctAnswer.map((correct, index) => ({\n ...correct,\n editable: index < data.length ? data[index].editable : true,\n interactive: index < data.length ? data[index].interactive : true,\n deletable: index >= data.length ? true : false,\n }));\n\nconst updateCorrectResponseData = (correctAnswer, data) => {\n if (!correctAnswer) {\n return data;\n }\n\n const correctAnswerData = [...correctAnswer];\n let correctResponseDefinition = [];\n\n (data || []).forEach((category, currentIndex) => {\n const editable = category.editable;\n const interactive = category.interactive;\n const label = editable && correctAnswer[currentIndex]?.label ? correctAnswer[currentIndex].label : category.label;\n const value =\n (interactive && correctAnswer[currentIndex]?.value) || (interactive && correctAnswer[currentIndex]?.value == 0)\n ? correctAnswer[currentIndex].value\n : category.value;\n\n correctResponseDefinition[currentIndex] = {\n label: label,\n value: value,\n editable: category.editable,\n interactive: category.interactive,\n };\n });\n\n if (correctResponseDefinition.length < correctAnswer.length) {\n const missingCategories = (correctAnswerData || []).slice(correctResponseDefinition.length, correctAnswer.length);\n\n return addCategoryProps((correctResponseDefinition || []).concat(missingCategories), data);\n }\n\n return correctResponseDefinition;\n};\n\nconst insertCategory = (correctAnswer, data) => {\n const positionToInsert = data.length - 1;\n // eslint-disable-next-line no-unused-vars\n const { editable, interactive, deletable, ...categoryToInsert } = data[data.length - 1];\n\n (correctAnswer || []).splice(positionToInsert, 0, categoryToInsert);\n const correctAnswerData = [...correctAnswer];\n\n return addCategoryProps(correctAnswerData, data);\n};\n\nconst removeCategory = (correctAnswer, data, positionToRemove) => {\n (correctAnswer || []).splice(positionToRemove, 1);\n const correctAnswerData = [...correctAnswer];\n\n return addCategoryProps(correctAnswerData, data);\n};\n\nexport class CorrectResponse extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n correctAnswerErrors: PropTypes.object,\n studentNewCategoryDefaultLabel: PropTypes.string,\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n charts: PropTypes.array,\n error: PropTypes.string,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n categories: [],\n };\n }\n\n changeData = (data) => {\n const { model, onChange } = this.props;\n const { correctAnswer } = model || {};\n\n onChange({\n ...model,\n correctAnswer: {\n ...correctAnswer,\n // eslint-disable-next-line no-unused-vars\n data: data.map(({ interactive, editable, index, ...keepAttrs }) => keepAttrs),\n },\n });\n };\n\n getUpdatedCategories(nextProps, prevProps = this.props, prevState = this.state) {\n const nextData = nextProps.model.data || [];\n const data = prevProps.model.data || [];\n const nextCorrectAnswerData = nextProps.model.correctAnswer.data || [];\n const categories = prevState ? prevState.categories : [];\n\n let nextCategories = [];\n if (nextData.length > data.length) {\n nextCategories = insertCategory(nextCorrectAnswerData, nextData);\n }\n\n if (nextData.length < data.length) {\n let removedIndex = nextData.length;\n\n // we need to remove the category from the correct answer data and categories, from the same index it was removed from the data\n // index is a property of the nextData category\n for (let index = 0; index < nextData.length; index++) {\n if (nextData[index].index !== index) {\n removedIndex = index;\n break;\n }\n }\n\n (this.props.model.correctAnswer.data || []).splice(removedIndex, 1);\n nextCategories = removeCategory(categories, nextData, removedIndex);\n return nextCategories;\n }\n\n if (nextCorrectAnswerData.length > 0 && !isEqual(nextCorrectAnswerData, this.props.model.correctAnswer.data)) {\n nextCategories = nextCorrectAnswerData.map((correct, index) => ({\n ...correct,\n editable: index < data.length ? data[index].editable : true,\n interactive: index < data.length ? data[index].interactive : true,\n }));\n } else if (isEmpty(nextCategories)) {\n nextCategories = updateCorrectResponseData(nextCorrectAnswerData, nextData);\n\n nextCorrectAnswerData.map((answer, currentIndex) => {\n const dataExists = currentIndex < nextData.length;\n let label;\n let value;\n\n if (dataExists) {\n label = nextData[currentIndex].editable ? answer.label : nextData[currentIndex].label;\n value = nextData[currentIndex].interactive ? answer.value : nextData[currentIndex].value;\n } else {\n label = answer.label;\n value = answer.value;\n }\n\n nextCorrectAnswerData[currentIndex] = {\n label: label,\n value: value,\n };\n });\n }\n\n if (\n !isEqual(nextCategories, data) ||\n !isEqual(nextCorrectAnswerData, prevProps.model.correctAnswer.data) ||\n !isEqual(nextCategories, categories) ||\n (isEmpty(nextCategories) && isEmpty(data))\n ) {\n return nextCategories;\n }\n\n return null;\n }\n\n componentDidMount() {\n const initialCategories = this.getUpdatedCategories(this.props, this.props, null);\n\n this.setState({\n categories:\n initialCategories || updateCorrectResponseData(this.props.model.correctAnswer.data, this.props.model.data),\n });\n }\n\n componentDidUpdate(prevProps, prevState) {\n const nextCategories = this.getUpdatedCategories(this.props, prevProps, prevState);\n\n // this check is needed when all the categories are removed from Chart1\n if (nextCategories?.length === 0 && this.state.categories?.length === 0 && prevProps.model.data.length > 0) {\n this.setState({ categories: nextCategories });\n }\n\n if (nextCategories && !isEqual(nextCategories, this.state.categories)) {\n this.changeData(nextCategories);\n this.setState({ categories: nextCategories });\n }\n }\n\n render() {\n const { classes, model, charts, error, studentNewCategoryDefaultLabel, correctAnswerErrors, mathMlOptions = {} } = this.props;\n const { categories } = this.state;\n const { domain = {}, range = {} } = model || {};\n const { identicalError, categoriesError } = correctAnswerErrors || {};\n\n return (\n <div>\n <div className={classes.title}>Define Correct Response</div>\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 define the correct answer.</span>\n </Typography>\n\n <div\n key={`correct-response-graph-${model.correctAnswer.name}`}\n className={identicalError || categoriesError ? classes.chartError : ''}\n >\n <Chart\n chartType={model.chartType}\n size={model.graph}\n domain={domain}\n range={range}\n charts={charts}\n data={categories}\n title={model.title}\n onDataChange={(data) => this.changeData(data)}\n addCategoryEnabled={model.addCategoryEnabled}\n categoryDefaultLabel={studentNewCategoryDefaultLabel}\n error={error}\n mathMlOptions={mathMlOptions}\n />\n </div>\n\n {(identicalError || categoriesError) && (\n <Typography component=\"div\" type=\"body1\" className={classes.errorText}>\n <span>{identicalError || categoriesError}</span>\n </Typography>\n )}\n </div>\n </div>\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(CorrectResponse);\n"],"file":"correct-response.js"}
@@ -1,174 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- /**
9
- * NOTE: There's no functionality described for graphTitle,
10
- * rationale, scoringType, studentInstructions, teacherInstructions
11
- * so there's no implementation (they are only added in model)
12
- */
13
- // const createCategory = (label, value) => ({
14
- // label,
15
- // value,
16
- // interactive: true,
17
- // editable: true
18
- // });
19
- var _default = {
20
- model: {
21
- addCategoryEnabled: true,
22
- chartType: 'lineCross',
23
- correctAnswer: {},
24
- data: [],
25
- domain: {},
26
- graph: {
27
- width: 480,
28
- height: 480
29
- },
30
- prompt: '',
31
- promptEnabled: true,
32
- rationale: '',
33
- range: {
34
- label: '',
35
- max: 1,
36
- min: 0
37
- },
38
- scoringType: 'all or nothing',
39
- title: '',
40
- rationaleEnabled: true,
41
- teacherInstructionsEnabled: true,
42
- studentInstructionsEnabled: true,
43
- studentNewCategoryDefaultLabel: 'New Category',
44
- changeInteractiveEnabled: true,
45
- changeEditableEnabled: true,
46
- changeAddCategoryEnabled: true
47
- },
48
- configuration: {
49
- spellCheck: {
50
- label: 'Spellcheck',
51
- settings: false,
52
- enabled: true
53
- },
54
- chartDimensions: {
55
- settings: false,
56
- label: 'Chart Dimensions',
57
- showInConfigPanel: true,
58
- width: {
59
- min: 50,
60
- max: 700,
61
- step: 20
62
- },
63
- height: {
64
- min: 400,
65
- max: 700,
66
- step: 20
67
- }
68
- },
69
- authorNewCategoryDefaults: {
70
- settings: false,
71
- label: 'Category',
72
- interactive: true,
73
- editable: false
74
- },
75
- availableChartTypes: {
76
- bar: 'Bar Chart',
77
- histogram: 'Histogram',
78
- lineDot: 'Line Chart ●',
79
- lineCross: 'Line Chart x',
80
- dotPlot: 'Dot/Line Plot ⬤',
81
- linePlot: 'Dot/Line Plot X'
82
- },
83
- chartTypeLabel: 'ChartType',
84
- studentNewCategoryDefaultLabel: {
85
- settings: false,
86
- label: 'Category'
87
- },
88
- prompt: {
89
- settings: true,
90
- label: 'Item Stem'
91
- },
92
- rationale: {
93
- settings: true,
94
- label: 'Rationale'
95
- },
96
- scoringType: {
97
- settings: false,
98
- label: 'Scoring Type'
99
- },
100
- settingsPanelDisabled: false,
101
- studentInstructions: {
102
- settings: false,
103
- label: 'Student Instructions'
104
- },
105
- teacherInstructions: {
106
- settings: true,
107
- label: 'Teacher Instructions'
108
- },
109
- title: {
110
- settings: false,
111
- label: 'Chart Title'
112
- },
113
- instruction: {
114
- settings: false,
115
- label: 'This item type provides various types of interactive charts. Depending upon how an item is configured,\n' + ' students can change the heights of bars (or other similar chart elements) created by the author; relabel bars\n' + ' created by the author; and/or add new bars, label them, and set their heights.'
116
- },
117
- titlePlaceholder: {
118
- settings: false,
119
- label: 'Click here to add a title'
120
- },
121
- labelsPlaceholders: {
122
- left: 'Click here to add a label for this axis',
123
- right: '',
124
- top: '',
125
- bottom: 'Click here to add a label for this axis'
126
- },
127
- maxImageWidth: {
128
- teacherInstructions: 300,
129
- prompt: 300,
130
- rationale: 300
131
- },
132
- maxImageHeight: {
133
- teacherInstructions: 300,
134
- prompt: 300,
135
- rationale: 300
136
- },
137
- withRubric: {
138
- settings: false,
139
- label: 'Add Rubric'
140
- },
141
- language: {
142
- settings: false,
143
- label: 'Specify Language',
144
- enabled: false
145
- },
146
- languageChoices: {
147
- label: 'Language Choices',
148
- options: []
149
- },
150
- chartingOptions: {
151
- changeInteractive: {
152
- settings: false,
153
- authoringLabel: 'Student can set value',
154
- settingsLabel: 'Allow non-interactive categories'
155
- },
156
- changeEditable: {
157
- settings: false,
158
- authoringLabel: 'Student can edit name',
159
- settingsLabel: 'Allow editable category names'
160
- },
161
- addCategory: {
162
- settings: false,
163
- authoringLabel: 'Student can add categories',
164
- settingsLabel: 'Allow changes to whether students can add categories'
165
- },
166
- mathMlOptions: {
167
- mmlOutput: false,
168
- mmlEditing: false
169
- }
170
- }
171
- }
172
- };
173
- exports["default"] = _default;
174
- //# sourceMappingURL=defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/defaults.js"],"names":["model","addCategoryEnabled","chartType","correctAnswer","data","domain","graph","width","height","prompt","promptEnabled","rationale","range","label","max","min","scoringType","title","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","studentNewCategoryDefaultLabel","changeInteractiveEnabled","changeEditableEnabled","changeAddCategoryEnabled","configuration","spellCheck","settings","enabled","chartDimensions","showInConfigPanel","step","authorNewCategoryDefaults","interactive","editable","availableChartTypes","bar","histogram","lineDot","lineCross","dotPlot","linePlot","chartTypeLabel","settingsPanelDisabled","studentInstructions","teacherInstructions","instruction","titlePlaceholder","labelsPlaceholders","left","right","top","bottom","maxImageWidth","maxImageHeight","withRubric","language","languageChoices","options","chartingOptions","changeInteractive","authoringLabel","settingsLabel","changeEditable","addCategory","mathMlOptions","mmlOutput","mmlEditing"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;eAEe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,kBAAkB,EAAE,IADf;AAELC,IAAAA,SAAS,EAAE,WAFN;AAGLC,IAAAA,aAAa,EAAE,EAHV;AAILC,IAAAA,IAAI,EAAE,E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FF;AAGdC,QAAAA,aAAa,EAAE;AAHD,OAND;AAWfE,MAAAA,WAAW,EAAE;AACXrC,QAAAA,QAAQ,EAAE,KADC;AAEXkC,QAAAA,cAAc,EAAE,4BAFL;AAGXC,QAAAA,aAAa,EAAE;AAHJ,OAXE;AAgBfG,MAAAA,aAAa,EAAE;AACbC,QAAAA,SAAS,EAAE,KADE;AAEbC,QAAAA,UAAU,EAAE;AAFC;AAhBA;AAzGJ;AA7BF,C","sourcesContent":["/**\n * NOTE: There's no functionality described for graphTitle,\n * rationale, scoringType, studentInstructions, teacherInstructions\n * so there's no implementation (they are only added in model)\n */\n\n// const createCategory = (label, value) => ({\n// label,\n// value,\n// interactive: true,\n// editable: true\n// });\n\nexport default {\n model: {\n addCategoryEnabled: true,\n chartType: 'lineCross',\n correctAnswer: {},\n data: [],\n domain: {},\n graph: {\n width: 480,\n height: 480,\n },\n prompt: '',\n promptEnabled: true,\n rationale: '',\n range: {\n label: '',\n max: 1,\n min: 0,\n },\n scoringType: 'all or nothing',\n title: '',\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n studentNewCategoryDefaultLabel: 'New Category',\n changeInteractiveEnabled: true,\n changeEditableEnabled: true,\n changeAddCategoryEnabled: true,\n },\n configuration: {\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n chartDimensions: {\n settings: false,\n label: 'Chart Dimensions',\n showInConfigPanel: true,\n width: {\n min: 50,\n max: 700,\n step: 20,\n },\n height: {\n min: 400,\n max: 700,\n step: 20,\n },\n },\n authorNewCategoryDefaults: {\n settings: false,\n label: 'Category',\n interactive: true,\n editable: false,\n },\n availableChartTypes: {\n bar: 'Bar Chart',\n histogram: 'Histogram',\n lineDot: 'Line Chart ●',\n lineCross: 'Line Chart x',\n dotPlot: 'Dot/Line Plot ⬤',\n linePlot: 'Dot/Line Plot X',\n },\n chartTypeLabel: 'ChartType',\n studentNewCategoryDefaultLabel: {\n settings: false,\n label: 'Category',\n },\n prompt: {\n settings: true,\n label: 'Item Stem',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n settingsPanelDisabled: false,\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n },\n title: {\n settings: false,\n label: 'Chart Title',\n },\n instruction: {\n settings: false,\n label:\n 'This item type provides various types of interactive charts. Depending upon how an item is configured,\\n' +\n ' students can change the heights of bars (or other similar chart elements) created by the author; relabel bars\\n' +\n ' created by the author; and/or add new bars, label them, and set their heights.',\n },\n titlePlaceholder: {\n settings: false,\n label: 'Click here to add a title',\n },\n labelsPlaceholders: {\n left: 'Click here to add a label for this axis',\n right: '',\n top: '',\n bottom: 'Click here to add a label for this axis',\n },\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n language: {\n settings: false,\n label: 'Specify Language',\n enabled: false,\n },\n languageChoices: {\n label: 'Language Choices',\n options: [],\n },\n chartingOptions: {\n changeInteractive: {\n settings: false,\n authoringLabel: 'Student can set value',\n settingsLabel: 'Allow non-interactive categories',\n },\n changeEditable: {\n settings: false,\n authoringLabel: 'Student can edit name',\n settingsLabel: 'Allow editable category names',\n },\n addCategory: {\n settings: false,\n authoringLabel: 'Student can add categories',\n settingsLabel: 'Allow changes to whether students can add categories',\n },\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n },\n },\n};\n"],"file":"defaults.js"}