@pie-element/graphing-solution-set 1.5.2-next.0 → 1.5.2-next.1

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,596 +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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
- var React = _interopRequireWildcard(require("react"));
27
-
28
- var _propTypes = _interopRequireDefault(require("prop-types"));
29
-
30
- var _styles = require("@material-ui/core/styles");
31
-
32
- var _graphingSolutionSet = require("@pie-lib/pie-toolbox/graphing-solution-set");
33
-
34
- var _configUi = require("@pie-lib/pie-toolbox/config-ui");
35
-
36
- var _lodash = require("lodash");
37
-
38
- var _core = require("@material-ui/core");
39
-
40
- var _Radio = _interopRequireDefault(require("@material-ui/core/Radio"));
41
-
42
- var _FormControlLabel = _interopRequireDefault(require("@material-ui/core/FormControlLabel"));
43
-
44
- var _utils = require("./utils");
45
-
46
- 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); }
47
-
48
- 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; }
49
-
50
- 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; }
51
-
52
- 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; }
53
-
54
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
55
-
56
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
57
-
58
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
59
-
60
- 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); }; }
61
-
62
- 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; } }
63
-
64
- var styles = function styles(theme) {
65
- return {
66
- column: {
67
- flex: 1
68
- },
69
- graphingTools: {
70
- color: theme.palette.grey['A200']
71
- },
72
- availableTool: {
73
- cursor: 'pointer',
74
- margin: theme.spacing.unit,
75
- padding: theme.spacing.unit,
76
- border: "2px solid ".concat(theme.palette.common.white),
77
- textTransform: 'capitalize',
78
- '&:hover': {
79
- color: theme.palette.grey[800]
80
- }
81
- },
82
- selectedTool: {
83
- background: theme.palette.grey['A100'],
84
- border: "2px solid ".concat(theme.palette.grey['A200'])
85
- },
86
- container: {
87
- border: "2px solid ".concat(theme.palette.grey['A200']),
88
- borderRadius: '4px',
89
- padding: "0 ".concat(theme.spacing.unit * 4, "px ").concat(theme.spacing.unit * 2, "px"),
90
- background: theme.palette.grey[50]
91
- },
92
- button: {
93
- margin: "".concat(theme.spacing.unit * 2.5, "px 0"),
94
- cursor: 'pointer',
95
- background: theme.palette.grey[200],
96
- padding: theme.spacing.unit * 1.5,
97
- width: 'fit-content',
98
- borderRadius: '4px',
99
- '&:hover': {
100
- background: theme.palette.grey['A100']
101
- }
102
- },
103
- responseTitle: {
104
- display: 'flex',
105
- alignItems: 'center',
106
- marginTop: theme.spacing.unit * 2.5
107
- },
108
- iconButton: {
109
- marginLeft: '6px',
110
- color: theme.palette.grey[600],
111
- '&:hover': {
112
- cursor: 'pointer',
113
- color: theme.palette.common.black
114
- }
115
- },
116
- name: {
117
- marginBottom: theme.spacing.unit / 2
118
- },
119
- tooltip: {
120
- fontSize: theme.typography.fontSize - 2,
121
- whiteSpace: 'pre',
122
- maxWidth: '500px'
123
- },
124
- subtitleText: {
125
- marginTop: theme.spacing.unit * 1.5,
126
- marginBottom: theme.spacing.unit
127
- },
128
- toolsHeader: {
129
- display: 'flex',
130
- alignItems: 'center',
131
- justifyContent: 'space-between'
132
- },
133
- defaultTool: {
134
- display: 'flex',
135
- alignItems: 'center',
136
- width: '300px'
137
- },
138
- defaultToolSelect: {
139
- marginLeft: theme.spacing.unit,
140
- textTransform: 'uppercase',
141
- color: theme.palette.grey[800]
142
- },
143
- menuItem: {
144
- textTransform: 'uppercase'
145
- },
146
- noDefaultTool: {
147
- padding: theme.spacing.unit / 2
148
- },
149
- error: {
150
- color: theme.palette.error.main
151
- },
152
- errorMessage: {
153
- fontSize: theme.typography.fontSize - 2,
154
- color: theme.palette.error.main,
155
- marginTop: theme.spacing.unit
156
- },
157
- graphError: {
158
- border: "2px solid ".concat(theme.palette.error.main)
159
- },
160
- radioButtonClass: {
161
- height: '20px',
162
- width: 'fit-content',
163
- padding: '.5rem 0'
164
- }
165
- };
166
- };
167
-
168
- var CorrectResponse = /*#__PURE__*/function (_React$Component) {
169
- (0, _inherits2["default"])(CorrectResponse, _React$Component);
170
-
171
- var _super = _createSuper(CorrectResponse);
172
-
173
- function CorrectResponse() {
174
- var _this;
175
-
176
- (0, _classCallCheck2["default"])(this, CorrectResponse);
177
-
178
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
179
- args[_key] = arguments[_key];
180
- }
181
-
182
- _this = _super.call.apply(_super, [this].concat(args));
183
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
184
- dialog: {
185
- open: false
186
- }
187
- });
188
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleAlertDialog", function (open, callback) {
189
- return _this.setState({
190
- dialog: {
191
- open: open
192
- }
193
- }, callback);
194
- });
195
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeMarks", function (marks) {
196
- var _this$props = _this.props,
197
- model = _this$props.model,
198
- onChange = _this$props.onChange;
199
- var gssLineData = model.gssLineData;
200
-
201
- if (gssLineData.selectedTool === 'lineA' && marks.length > 0) {
202
- marks[0].fill = gssLineData['lineA'].lineType;
203
- }
204
-
205
- if (gssLineData.selectedTool === 'lineB' && marks.length > 1) {
206
- marks[1].fill = gssLineData['lineB'].lineType;
207
- }
208
-
209
- if (marks.length === 0) {
210
- gssLineData.selectedTool = 'lineA';
211
- (0, _lodash.set)(model, "gssLineData", gssLineData);
212
- }
213
-
214
- (0, _lodash.set)(model, "answers.correctAnswer.marks", marks);
215
- onChange(model);
216
- });
217
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onResetClick", function () {
218
- var _this$props2 = _this.props,
219
- model = _this$props2.model,
220
- onChange = _this$props2.onChange;
221
- var gssLineData = model.gssLineData,
222
- answers = model.answers;
223
-
224
- _this.setState({
225
- dialog: {
226
- open: true,
227
- title: 'Warning',
228
- text: "This will remove all the elements added on the graph and reset graph to original state. Are you sure you want to continue?",
229
- onConfirm: function onConfirm() {
230
- // Reset the graph to original state
231
- answers.correctAnswer.marks = [];
232
- gssLineData.selectedTool = 'lineA';
233
- gssLineData.lineA.lineType = 'Solid';
234
- if (gssLineData.lineB) gssLineData.lineB.lineType = 'Solid';
235
- (0, _lodash.set)(model, "answers", answers);
236
- (0, _lodash.set)(model, "gssLineData", gssLineData);
237
- onChange(model);
238
-
239
- _this.handleAlertDialog(false);
240
- },
241
- onClose: function onClose() {
242
- return _this.handleAlertDialog(false);
243
- }
244
- }
245
- });
246
- });
247
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeNumberOfLines", function (e, value) {
248
- var model = _this.props.model;
249
- var gssLineData = model.gssLineData;
250
-
251
- if (gssLineData.selectedTool === 'solutionSet') {
252
- _this.setState({
253
- dialog: {
254
- open: true,
255
- title: 'Warning',
256
- text: "Changing number of lines after adding solution set will remove added solution set. Are you sure you want to continue?",
257
- onConfirm: function onConfirm() {
258
- _this.changeLine(e, value);
259
-
260
- _this.handleAlertDialog(false);
261
- },
262
- onClose: function onClose() {
263
- return _this.handleAlertDialog(false);
264
- }
265
- }
266
- });
267
- } else {
268
- _this.changeLine(e, value);
269
- }
270
- });
271
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeLine", function (e, value) {
272
- var _this$props3 = _this.props,
273
- model = _this$props3.model,
274
- onChange = _this$props3.onChange;
275
- var answers = model.answers;
276
- var gssLineData = model.gssLineData; //remove polygon from correct answer
277
-
278
- answers.correctAnswer.marks = answers.correctAnswer.marks.filter(function (mark) {
279
- return mark.type !== 'polygon';
280
- });
281
-
282
- if (Number.parseInt(value) === 1) {
283
- //remove lineB from gssLineData and correct answer
284
- delete gssLineData.lineB;
285
- if (answers.correctAnswer.marks.length > 1) answers.correctAnswer.marks.pop();
286
- gssLineData.numberOfLines = 1;
287
- gssLineData.selectedTool = 'lineA';
288
- } else {
289
- gssLineData.numberOfLines = 2;
290
- if (answers.correctAnswer.marks.length > 0) gssLineData.selectedTool = 'lineB';
291
- gssLineData.lineB = {
292
- lineType: 'Solid'
293
- };
294
- } //reset solution set
295
-
296
-
297
- (0, _lodash.set)(model, "answers", answers);
298
- (0, _lodash.set)(model, "gssLineData", gssLineData);
299
- onChange(model);
300
- });
301
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSolutionSetSelected", function (point) {
302
- var _this$props4 = _this.props,
303
- model = _this$props4.model,
304
- onChange = _this$props4.onChange;
305
- var answers = model.answers,
306
- gssLineData = model.gssLineData;
307
-
308
- var _iterator = _createForOfIteratorHelper(gssLineData.sections),
309
- _step;
310
-
311
- try {
312
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
313
- var section = _step.value;
314
-
315
- //check if the point is inside the polygon
316
- if ((0, _utils.pointInsidePolygon)(point, section)) {
317
- var polygon = {
318
- points: section,
319
- building: false,
320
- type: 'polygon',
321
- closed: true,
322
- isSolution: true
323
- }; //remove old answer section from correct answer
324
-
325
- answers.correctAnswer.marks = answers.correctAnswer.marks.filter(function (mark) {
326
- return mark.type !== 'polygon';
327
- }); //add new answer section to correct answer
328
-
329
- answers.correctAnswer.marks.push(polygon);
330
- break;
331
- }
332
- }
333
- } catch (err) {
334
- _iterator.e(err);
335
- } finally {
336
- _iterator.f();
337
- }
338
-
339
- (0, _lodash.set)(model, "answers", answers);
340
- onChange(model);
341
- });
342
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChangeGssLineData", function (gssLineData, oldSelectedTool) {
343
- var model = _this.props.model;
344
- var answers = model.answers,
345
- domain = model.domain,
346
- range = model.range; //handle solution set changes
347
-
348
- if (gssLineData.selectedTool === 'solutionSet') {
349
- var lines = answers.correctAnswer.marks.filter(function (mark) {
350
- return mark.type !== 'polygon';
351
- });
352
-
353
- if (!(0, _utils.checkIfLinesAreAdded)(gssLineData, lines)) {
354
- gssLineData.selectedTool = oldSelectedTool;
355
-
356
- _this.setState({
357
- dialog: {
358
- open: true,
359
- title: 'Warning',
360
- text: "Please define the line(s) and then select a solution set for the item.",
361
- onConfirm: function onConfirm() {
362
- return _this.handleAlertDialog(false);
363
- }
364
- }
365
- });
366
- } else {
367
- var _lines = answers.correctAnswer.marks.filter(function (mark) {
368
- return mark.type !== 'polygon';
369
- });
370
-
371
- gssLineData = (0, _utils.findSectionsInSolutionSet)(gssLineData, _lines, domain, range);
372
- }
373
-
374
- _this.handleGssLineDataChange(gssLineData, answers);
375
- } else {
376
- var polygons = answers.correctAnswer.marks.filter(function (mark) {
377
- return mark.type === 'polygon';
378
- });
379
-
380
- if (oldSelectedTool === 'solutionSet' && polygons.length > 0) {
381
- _this.setState({
382
- dialog: {
383
- open: true,
384
- title: 'Warning',
385
- text: "Changing a line after adding a solution set will clear your selected solution set. Click 'Clear Solution Set' to change the line. Otherwise, click 'Cancel'.",
386
- onConfirm: function onConfirm() {
387
- answers.correctAnswer.marks = answers.correctAnswer.marks.filter(function (mark) {
388
- return mark.type !== 'polygon';
389
- });
390
-
391
- _this.handleGssLineDataChange(gssLineData, answers);
392
-
393
- _this.handleAlertDialog(false);
394
- },
395
- onConfirmText: 'CLEAR SOLUTION SET',
396
- onClose: function onClose() {
397
- gssLineData.selectedTool = oldSelectedTool;
398
-
399
- _this.handleGssLineDataChange(gssLineData, answers);
400
-
401
- _this.handleAlertDialog(false);
402
- }
403
- }
404
- });
405
- } else {
406
- _this.handleGssLineDataChange(gssLineData, answers);
407
- }
408
- }
409
- });
410
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleGssLineDataChange", function (gssLineData, answers) {
411
- var _this$props5 = _this.props,
412
- model = _this$props5.model,
413
- onChange = _this$props5.onChange; //handle line type changes from solid to dashed and vice versa
414
-
415
- if (answers.correctAnswer.marks.length > 0 && answers.correctAnswer.marks[0] && gssLineData.lineA) {
416
- answers.correctAnswer.marks[0].fill = gssLineData.lineA.lineType;
417
- }
418
-
419
- if (answers.correctAnswer.marks.length > 1 && answers.correctAnswer.marks[1] && gssLineData.lineB) {
420
- answers.correctAnswer.marks[1].fill = gssLineData.lineB.lineType;
421
- } //check if line is added to the graph before switching to lineB
422
-
423
-
424
- if (gssLineData.selectedTool === 'lineB' && answers.correctAnswer.marks.length === 0 || gssLineData.selectedTool === 'lineB' && answers.correctAnswer.marks[0].building) {
425
- _this.setState({
426
- dialog: {
427
- open: true,
428
- title: 'Warning',
429
- text: "Please add Line A to the graph before adding Line B",
430
- onConfirm: function onConfirm() {
431
- return _this.handleAlertDialog(false);
432
- }
433
- }
434
- });
435
-
436
- gssLineData.selectedTool = 'lineA';
437
- } //check if lineB is added to the graph before switching to lineA
438
-
439
-
440
- if (gssLineData.selectedTool === 'lineA' && answers.correctAnswer.marks.length > 1 && answers.correctAnswer.marks[1].building) {
441
- _this.setState({
442
- dialog: {
443
- open: true,
444
- title: 'Warning',
445
- text: "Please add Line B to the graph before switching to Line A",
446
- onConfirm: function onConfirm() {
447
- return _this.handleAlertDialog(false);
448
- }
449
- }
450
- });
451
-
452
- gssLineData.selectedTool = 'lineB';
453
- }
454
-
455
- (0, _lodash.set)(model, "gssLineData", gssLineData);
456
- (0, _lodash.set)(model, "answers", answers);
457
- onChange(model);
458
- });
459
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateModel", function (props) {
460
- var _this$props6 = _this.props,
461
- model = _this$props6.model,
462
- onChange = _this$props6.onChange;
463
- onChange(_objectSpread(_objectSpread({}, model), props));
464
- });
465
- return _this;
466
- }
467
-
468
- (0, _createClass2["default"])(CorrectResponse, [{
469
- key: "render",
470
- value:
471
- /*
472
- * Render the component
473
- * */
474
- function render() {
475
- var _this2 = this;
476
-
477
- var _this$props7 = this.props,
478
- classes = _this$props7.classes,
479
- errors = _this$props7.errors,
480
- model = _this$props7.model,
481
- _this$props7$mathMlOp = _this$props7.mathMlOptions,
482
- mathMlOptions = _this$props7$mathMlOp === void 0 ? {} : _this$props7$mathMlOp;
483
- var dialog = this.state.dialog; //get the default values to GssLineData
484
-
485
- var _ref = model || {},
486
- _ref$gssLineData = _ref.gssLineData,
487
- gssLineData = _ref$gssLineData === void 0 ? {
488
- numberOfLines: 1,
489
- selectedTool: 'lineA',
490
- lineA: {
491
- lineType: 'Solid'
492
- }
493
- } : _ref$gssLineData,
494
- arrows = _ref.arrows,
495
- coordinatesOnHover = _ref.coordinatesOnHover,
496
- domain = _ref.domain,
497
- _ref$graph = _ref.graph,
498
- graph = _ref$graph === void 0 ? {} : _ref$graph,
499
- labels = _ref.labels,
500
- labelsEnabled = _ref.labelsEnabled,
501
- range = _ref.range,
502
- title = _ref.title,
503
- titleEnabled = _ref.titleEnabled,
504
- marks = _ref.marks,
505
- answers = _ref.answers;
506
-
507
- var _ref2 = errors || {},
508
- _ref2$correctAnswerEr = _ref2.correctAnswerErrors,
509
- correctAnswerErrors = _ref2$correctAnswerEr === void 0 ? '' : _ref2$correctAnswerEr;
510
-
511
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_core.Typography, {
512
- component: "div",
513
- variant: "subheading"
514
- }, "Define Line Type(s) and Correct Response"), /*#__PURE__*/React.createElement(_core.Typography, {
515
- component: "div",
516
- variant: "body1",
517
- className: classes.subtitleText
518
- }, "Use this interface to choose how many lines students will be able to use, and to define the correct answer"), /*#__PURE__*/React.createElement(_core.Typography, {
519
- component: "div",
520
- variant: "body1",
521
- className: classes.subtitleText
522
- }, "Choose Number of Lines"), /*#__PURE__*/React.createElement(_core.RadioGroup, {
523
- name: "numberOfLines",
524
- value: gssLineData.numberOfLines,
525
- onChange: this.changeNumberOfLines
526
- }, /*#__PURE__*/React.createElement(_FormControlLabel["default"], {
527
- className: classes.radioButtonClass,
528
- value: "1",
529
- control: /*#__PURE__*/React.createElement(_Radio["default"], {
530
- checked: gssLineData.numberOfLines === 1
531
- }),
532
- label: "One"
533
- }), /*#__PURE__*/React.createElement(_FormControlLabel["default"], {
534
- className: classes.radioButtonClass,
535
- value: "2",
536
- control: /*#__PURE__*/React.createElement(_Radio["default"], {
537
- checked: gssLineData.numberOfLines === 2
538
- }),
539
- label: "Two"
540
- })), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_graphingSolutionSet.GraphContainer, {
541
- className: correctAnswerErrors['correctAnswer'] && classes.graphError,
542
- axesSettings: {
543
- includeArrows: arrows
544
- },
545
- backgroundMarks: [],
546
- coordinatesOnHover: coordinatesOnHover,
547
- disabledLabels: true,
548
- disabledTitle: true,
549
- domain: domain,
550
- draggableTools: true,
551
- labels: labels,
552
- marks: answers && answers.correctAnswer && answers.correctAnswer.marks ? answers.correctAnswer.marks : [],
553
- onChangeMarks: function onChangeMarks(newMarks) {
554
- return _this2.changeMarks(newMarks);
555
- },
556
- onCustomReset: this.onResetClick,
557
- range: range,
558
- showLabels: labelsEnabled,
559
- showTitle: titleEnabled,
560
- size: {
561
- width: graph.width,
562
- height: graph.height
563
- },
564
- title: title,
565
- gssLineData: gssLineData,
566
- onChangeGssLineData: this.onChangeGssLineData,
567
- onSolutionSetSelected: this.onSolutionSetSelected,
568
- toolbarTools: ['line', 'polygon'],
569
- mathMlOptions: mathMlOptions
570
- }), correctAnswerErrors['correctAnswer'] && /*#__PURE__*/React.createElement("div", {
571
- className: classes.errorMessage
572
- }, correctAnswerErrors['correctAnswer'])), /*#__PURE__*/React.createElement(_configUi.AlertDialog, {
573
- open: dialog.open,
574
- title: dialog.title,
575
- text: dialog.text,
576
- onClose: dialog.onClose,
577
- onConfirm: dialog.onConfirm,
578
- onConfirmText: dialog.onConfirmText ? dialog.onConfirmText : 'OK'
579
- }));
580
- }
581
- }]);
582
- return CorrectResponse;
583
- }(React.Component);
584
-
585
- exports.CorrectResponse = CorrectResponse;
586
- (0, _defineProperty2["default"])(CorrectResponse, "propTypes", {
587
- classes: _propTypes["default"].object.isRequired,
588
- errors: _propTypes["default"].object,
589
- model: _propTypes["default"].object.isRequired,
590
- onChange: _propTypes["default"].func.isRequired
591
- });
592
-
593
- var _default = (0, _styles.withStyles)(styles)(CorrectResponse);
594
-
595
- exports["default"] = _default;
596
- //# sourceMappingURL=correct-response.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/correct-response.jsx"],"names":["styles","theme","column","flex","graphingTools","color","palette","grey","availableTool","cursor","margin","spacing","unit","padding","border","common","white","textTransform","selectedTool","background","container","borderRadius","button","width","responseTitle","display","alignItems","marginTop","iconButton","marginLeft","black","name","marginBottom","tooltip","fontSize","typography","whiteSpace","maxWidth","subtitleText","toolsHeader","justifyContent","defaultTool","defaultToolSelect","menuItem","noDefaultTool","error","main","errorMessage","graphError","radioButtonClass","height","CorrectResponse","dialog","open","callback","setState","marks","props","model","onChange","gssLineData","length","fill","lineType","answers","title","text","onConfirm","correctAnswer","lineA","lineB","handleAlertDialog","onClose","e","value","changeLine","filter","mark","type","Number","parseInt","pop","numberOfLines","point","sections","section","polygon","points","building","closed","isSolution","push","oldSelectedTool","domain","range","lines","handleGssLineDataChange","polygons","onConfirmText","classes","errors","mathMlOptions","state","arrows","coordinatesOnHover","graph","labels","labelsEnabled","titleEnabled","correctAnswerErrors","changeNumberOfLines","includeArrows","newMarks","changeMarks","onResetClick","onChangeGssLineData","onSolutionSetSelected","React","Component","PropTypes","object","isRequired","func"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,MAAM,EAAE;AACNC,MAAAA,IAAI,EAAE;AADA,KADiB;AAIzBC,IAAAA,aAAa,EAAE;AACbC,MAAAA,KAAK,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KC,qBApB9B;AAqBE,QAAA,YAAY,EAAE,CAAC,MAAD,EAAS,SAAT,CArBhB;AAsBE,QAAA,aAAa,EAAEf;AAtBjB,QADF,EAyBGQ,mBAAmB,CAAC,eAAD,CAAnB,iBACC;AAAK,QAAA,SAAS,EAAEV,OAAO,CAACpD;AAAxB,SAAuC8D,mBAAmB,CAAC,eAAD,CAA1D,CA1BJ,CAxBF,eAqDE,oBAAC,qBAAD;AACE,QAAA,IAAI,EAAEzD,MAAM,CAACC,IADf;AAEE,QAAA,KAAK,EAAED,MAAM,CAACa,KAFhB;AAGE,QAAA,IAAI,EAAEb,MAAM,CAACc,IAHf;AAIE,QAAA,OAAO,EAAEd,MAAM,CAACoB,OAJlB;AAKE,QAAA,SAAS,EAAEpB,MAAM,CAACe,SALpB;AAME,QAAA,aAAa,EAAEf,MAAM,CAAC8C,aAAP,GAAuB9C,MAAM,CAAC8C,aAA9B,GAA8C;AAN/D,QArDF,CADF;AAgED;;;EA9WkCmB,KAAK,CAACC,S;;;iCAA9BnE,e,eACQ;AACjBgD,EAAAA,OAAO,EAAEoB,sBAAUC,MAAV,CAAiBC,UADT;AAEjBrB,EAAAA,MAAM,EAAEmB,sBAAUC,MAFD;AAGjB9D,EAAAA,KAAK,EAAE6D,sBAAUC,MAAV,CAAiBC,UAHP;AAIjB9D,EAAAA,QAAQ,EAAE4D,sBAAUG,IAAV,CAAeD;AAJR,C;;eAgXN,wBAAWzH,MAAX,EAAmBmD,eAAnB,C","sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { GraphContainer as Graph } from '@pie-lib/pie-toolbox/graphing-solution-set';\nimport { AlertDialog } from '@pie-lib/pie-toolbox/config-ui';\nimport { set } from 'lodash';\nimport { RadioGroup, Typography } from '@material-ui/core';\nimport Radio from '@material-ui/core/Radio';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport { findSectionsInSolutionSet, pointInsidePolygon, checkIfLinesAreAdded } from './utils';\n\nconst styles = (theme) => ({\n column: {\n flex: 1,\n },\n graphingTools: {\n color: theme.palette.grey['A200'],\n },\n availableTool: {\n cursor: 'pointer',\n margin: theme.spacing.unit,\n padding: theme.spacing.unit,\n border: `2px solid ${theme.palette.common.white}`,\n textTransform: 'capitalize',\n '&:hover': {\n color: theme.palette.grey[800],\n },\n },\n selectedTool: {\n background: theme.palette.grey['A100'],\n border: `2px solid ${theme.palette.grey['A200']}`,\n },\n container: {\n border: `2px solid ${theme.palette.grey['A200']}`,\n borderRadius: '4px',\n padding: `0 ${theme.spacing.unit * 4}px ${theme.spacing.unit * 2}px`,\n background: theme.palette.grey[50],\n },\n button: {\n margin: `${theme.spacing.unit * 2.5}px 0`,\n cursor: 'pointer',\n background: theme.palette.grey[200],\n padding: theme.spacing.unit * 1.5,\n width: 'fit-content',\n borderRadius: '4px',\n '&:hover': {\n background: theme.palette.grey['A100'],\n },\n },\n responseTitle: {\n display: 'flex',\n alignItems: 'center',\n marginTop: theme.spacing.unit * 2.5,\n },\n iconButton: {\n marginLeft: '6px',\n color: theme.palette.grey[600],\n '&:hover': {\n cursor: 'pointer',\n color: theme.palette.common.black,\n },\n },\n name: {\n marginBottom: theme.spacing.unit / 2,\n },\n tooltip: {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n subtitleText: {\n marginTop: theme.spacing.unit * 1.5,\n marginBottom: theme.spacing.unit,\n },\n toolsHeader: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n defaultTool: {\n display: 'flex',\n alignItems: 'center',\n width: '300px',\n },\n defaultToolSelect: {\n marginLeft: theme.spacing.unit,\n textTransform: 'uppercase',\n color: theme.palette.grey[800],\n },\n menuItem: {\n textTransform: 'uppercase',\n },\n noDefaultTool: {\n padding: theme.spacing.unit / 2,\n },\n error: {\n color: theme.palette.error.main,\n },\n errorMessage: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n marginTop: theme.spacing.unit,\n },\n graphError: {\n border: `2px solid ${theme.palette.error.main}`,\n },\n radioButtonClass: {\n height: '20px',\n width: 'fit-content',\n padding: '.5rem 0',\n },\n});\n\nexport class CorrectResponse extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n errors: PropTypes.object,\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n };\n\n state = {\n dialog: {\n open: false,\n },\n };\n\n /*\n * Function to handle the alert dialog open and close\n * @param {boolean} open - open or close the dialog\n * @param {function} callback - callback function to be called after setting the state\n * */\n handleAlertDialog = (open, callback) =>\n this.setState(\n {\n dialog: { open },\n },\n callback,\n );\n\n /*\n * Function to change the marks on the graph\n * @param {array} marks - marks to be added on the graph\n * */\n changeMarks = (marks) => {\n const { model, onChange } = this.props;\n const { gssLineData } = model;\n if (gssLineData.selectedTool === 'lineA' && marks.length > 0) {\n marks[0].fill = gssLineData['lineA'].lineType;\n }\n if (gssLineData.selectedTool === 'lineB' && marks.length > 1) {\n marks[1].fill = gssLineData['lineB'].lineType;\n }\n if (marks.length === 0) {\n gssLineData.selectedTool = 'lineA';\n set(model, `gssLineData`, gssLineData);\n }\n set(model, `answers.correctAnswer.marks`, marks);\n onChange(model);\n };\n\n /*\n * Reset the graph to original state and remove all the elements added on the graph\n * */\n onResetClick = () => {\n const { model, onChange } = this.props;\n const { gssLineData, answers } = model;\n this.setState({\n dialog: {\n open: true,\n title: 'Warning',\n text: `This will remove all the elements added on the graph and reset graph to original state. Are you sure you want to continue?`,\n onConfirm: () => {\n // Reset the graph to original state\n answers.correctAnswer.marks = [];\n gssLineData.selectedTool = 'lineA';\n gssLineData.lineA.lineType = 'Solid';\n if (gssLineData.lineB) gssLineData.lineB.lineType = 'Solid';\n set(model, `answers`, answers);\n set(model, `gssLineData`, gssLineData);\n onChange(model);\n this.handleAlertDialog(false);\n },\n onClose: () => this.handleAlertDialog(false),\n },\n });\n };\n\n /*\n * Function to change the number of lines on the graph\n * @param {object} e - event object\n * @param {number} value - number of lines to be added on the graph\n * */\n changeNumberOfLines = (e, value) => {\n const { model } = this.props;\n let gssLineData = model.gssLineData;\n if (gssLineData.selectedTool === 'solutionSet') {\n this.setState({\n dialog: {\n open: true,\n title: 'Warning',\n text: `Changing number of lines after adding solution set will remove added solution set. Are you sure you want to continue?`,\n onConfirm: () => {\n this.changeLine(e, value);\n this.handleAlertDialog(false);\n },\n onClose: () => this.handleAlertDialog(false),\n },\n });\n } else {\n this.changeLine(e, value);\n }\n };\n\n /*\n * Function to change the number of line on the graph\n * @param {object} e - event object\n * @param {number} value - number of lines to be added on the graph\n * */\n changeLine = (e, value) => {\n const { model, onChange } = this.props;\n const { answers } = model;\n let gssLineData = model.gssLineData;\n //remove polygon from correct answer\n answers.correctAnswer.marks = answers.correctAnswer.marks.filter((mark) => mark.type !== 'polygon');\n if (Number.parseInt(value) === 1) {\n //remove lineB from gssLineData and correct answer\n delete gssLineData.lineB;\n if (answers.correctAnswer.marks.length > 1) answers.correctAnswer.marks.pop();\n gssLineData.numberOfLines = 1;\n gssLineData.selectedTool = 'lineA';\n } else {\n gssLineData.numberOfLines = 2;\n if (answers.correctAnswer.marks.length > 0) gssLineData.selectedTool = 'lineB';\n gssLineData.lineB = {\n lineType: 'Solid',\n };\n }\n //reset solution set\n set(model, `answers`, answers);\n set(model, `gssLineData`, gssLineData);\n onChange(model);\n };\n\n /*\n * Function to handle the changes to solution set on the graph\n * @param {object} point - point selected on the graph\n * */\n onSolutionSetSelected = (point) => {\n const { model, onChange } = this.props;\n const { answers, gssLineData } = model;\n for (const section of gssLineData.sections) {\n //check if the point is inside the polygon\n if (pointInsidePolygon(point, section)) {\n let polygon = {\n points: section,\n building: false,\n type: 'polygon',\n closed: true,\n isSolution: true,\n };\n //remove old answer section from correct answer\n answers.correctAnswer.marks = answers.correctAnswer.marks.filter((mark) => mark.type !== 'polygon');\n //add new answer section to correct answer\n answers.correctAnswer.marks.push(polygon);\n break;\n }\n }\n set(model, `answers`, answers);\n onChange(model);\n };\n\n /*\n * Function to handle the changes to line data on the graph\n * @param {object} gssLineData - line data on the graph\n * @param {string} oldSelectedTool - old selected tool\n * */\n onChangeGssLineData = (gssLineData, oldSelectedTool) => {\n const { model } = this.props;\n const { answers, domain, range } = model;\n //handle solution set changes\n if (gssLineData.selectedTool === 'solutionSet') {\n let lines = answers.correctAnswer.marks.filter((mark) => mark.type !== 'polygon');\n if (!checkIfLinesAreAdded(gssLineData, lines)) {\n gssLineData.selectedTool = oldSelectedTool;\n this.setState({\n dialog: {\n open: true,\n title: 'Warning',\n text: `Please define the line(s) and then select a solution set for the item.`,\n onConfirm: () => this.handleAlertDialog(false),\n },\n });\n } else {\n let lines = answers.correctAnswer.marks.filter((mark) => mark.type !== 'polygon');\n gssLineData = findSectionsInSolutionSet(gssLineData, lines, domain, range);\n }\n this.handleGssLineDataChange(gssLineData, answers);\n } else {\n let polygons = answers.correctAnswer.marks.filter((mark) => mark.type === 'polygon');\n if (oldSelectedTool === 'solutionSet' && polygons.length > 0) {\n this.setState({\n dialog: {\n open: true,\n title: 'Warning',\n text: `Changing a line after adding a solution set will clear your selected solution set. Click 'Clear Solution Set' to change the line. Otherwise, click 'Cancel'.`,\n onConfirm: () => {\n answers.correctAnswer.marks = answers.correctAnswer.marks.filter((mark) => mark.type !== 'polygon');\n this.handleGssLineDataChange(gssLineData, answers);\n this.handleAlertDialog(false);\n },\n onConfirmText: 'CLEAR SOLUTION SET',\n onClose: () => {\n gssLineData.selectedTool = oldSelectedTool;\n this.handleGssLineDataChange(gssLineData, answers);\n this.handleAlertDialog(false);\n },\n },\n });\n } else {\n this.handleGssLineDataChange(gssLineData, answers);\n }\n }\n };\n\n /*\n * Function to handle the changes to line data on the graph\n * @param {object} gssLineData - line data on the graph\n * @param {object} answers - correct answer\n * */\n handleGssLineDataChange = (gssLineData, answers) => {\n const { model, onChange } = this.props;\n //handle line type changes from solid to dashed and vice versa\n if (answers.correctAnswer.marks.length > 0 && answers.correctAnswer.marks[0] && gssLineData.lineA) {\n answers.correctAnswer.marks[0].fill = gssLineData.lineA.lineType;\n }\n if (answers.correctAnswer.marks.length > 1 && answers.correctAnswer.marks[1] && gssLineData.lineB) {\n answers.correctAnswer.marks[1].fill = gssLineData.lineB.lineType;\n }\n //check if line is added to the graph before switching to lineB\n if (\n (gssLineData.selectedTool === 'lineB' && answers.correctAnswer.marks.length === 0) ||\n (gssLineData.selectedTool === 'lineB' && answers.correctAnswer.marks[0].building)\n ) {\n this.setState({\n dialog: {\n open: true,\n title: 'Warning',\n text: `Please add Line A to the graph before adding Line B`,\n onConfirm: () => this.handleAlertDialog(false),\n },\n });\n gssLineData.selectedTool = 'lineA';\n }\n //check if lineB is added to the graph before switching to lineA\n if (\n gssLineData.selectedTool === 'lineA' &&\n answers.correctAnswer.marks.length > 1 &&\n answers.correctAnswer.marks[1].building\n ) {\n this.setState({\n dialog: {\n open: true,\n title: 'Warning',\n text: `Please add Line B to the graph before switching to Line A`,\n onConfirm: () => this.handleAlertDialog(false),\n },\n });\n gssLineData.selectedTool = 'lineB';\n }\n set(model, `gssLineData`, gssLineData);\n set(model, `answers`, answers);\n onChange(model);\n };\n\n /*\n * Function to update the model\n * @param {object} props - updated props\n * */\n updateModel = (props) => {\n const { model, onChange } = this.props;\n onChange({\n ...model,\n ...props,\n });\n };\n\n /*\n * Render the component\n * */\n render() {\n const { classes, errors, model, mathMlOptions = {} } = this.props;\n const { dialog } = this.state;\n //get the default values to GssLineData\n const {\n gssLineData = {\n numberOfLines: 1,\n selectedTool: 'lineA',\n lineA: {\n lineType: 'Solid',\n },\n },\n arrows,\n coordinatesOnHover,\n domain,\n graph = {},\n labels,\n labelsEnabled,\n range,\n title,\n titleEnabled,\n marks,\n answers,\n } = model || {};\n const { correctAnswerErrors = '' } = errors || {};\n return (\n <div>\n <Typography component=\"div\" variant=\"subheading\">\n Define Line Type(s) and Correct Response\n </Typography>\n <Typography component=\"div\" variant=\"body1\" className={classes.subtitleText}>\n Use this interface to choose how many lines students will be able to use, and to define the correct answer\n </Typography>\n <Typography component=\"div\" variant=\"body1\" className={classes.subtitleText}>\n Choose Number of Lines\n </Typography>\n <RadioGroup name=\"numberOfLines\" value={gssLineData.numberOfLines} onChange={this.changeNumberOfLines}>\n <FormControlLabel\n className={classes.radioButtonClass}\n value=\"1\"\n control={<Radio checked={gssLineData.numberOfLines === 1} />}\n label=\"One\"\n />\n <FormControlLabel\n className={classes.radioButtonClass}\n value=\"2\"\n control={<Radio checked={gssLineData.numberOfLines === 2} />}\n label=\"Two\"\n />\n </RadioGroup>\n <React.Fragment>\n <Graph\n className={correctAnswerErrors['correctAnswer'] && classes.graphError}\n axesSettings={{ includeArrows: arrows }}\n backgroundMarks={[]}\n coordinatesOnHover={coordinatesOnHover}\n disabledLabels={true}\n disabledTitle={true}\n domain={domain}\n draggableTools={true}\n labels={labels}\n marks={answers && answers.correctAnswer && answers.correctAnswer.marks ? answers.correctAnswer.marks : []}\n onChangeMarks={(newMarks) => this.changeMarks(newMarks)}\n onCustomReset={this.onResetClick}\n range={range}\n showLabels={labelsEnabled}\n showTitle={titleEnabled}\n size={{ width: graph.width, height: graph.height }}\n title={title}\n gssLineData={gssLineData}\n onChangeGssLineData={this.onChangeGssLineData}\n onSolutionSetSelected={this.onSolutionSetSelected}\n toolbarTools={['line', 'polygon']}\n mathMlOptions={mathMlOptions}\n />\n {correctAnswerErrors['correctAnswer'] && (\n <div className={classes.errorMessage}>{correctAnswerErrors['correctAnswer']}</div>\n )}\n </React.Fragment>\n <AlertDialog\n open={dialog.open}\n title={dialog.title}\n text={dialog.text}\n onClose={dialog.onClose}\n onConfirm={dialog.onConfirm}\n onConfirmText={dialog.onConfirmText ? dialog.onConfirmText : 'OK'}\n />\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(CorrectResponse);\n"],"file":"correct-response.js"}