@pie-element/number-line 8.9.1-next.1 → 8.9.1-next.10
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/configure/lib/arrows.js +124 -0
- package/configure/lib/arrows.js.map +1 -0
- package/configure/lib/card-bar.js +78 -0
- package/configure/lib/card-bar.js.map +1 -0
- package/configure/lib/defaults.js +144 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/domain.js +140 -0
- package/configure/lib/domain.js.map +1 -0
- package/configure/lib/index.js +225 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +867 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/lib/number-text-field.js +97 -0
- package/configure/lib/number-text-field.js.map +1 -0
- package/configure/lib/point-config.js +144 -0
- package/configure/lib/point-config.js.map +1 -0
- package/configure/lib/size.js +100 -0
- package/configure/lib/size.js.map +1 -0
- package/configure/lib/ticks.js +288 -0
- package/configure/lib/ticks.js.map +1 -0
- package/configure/lib/utils.js +14 -0
- package/configure/lib/utils.js.map +1 -0
- package/controller/lib/defaults.js +47 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +474 -0
- package/controller/lib/index.js.map +1 -0
- package/lib/data-converter.js +100 -0
- package/lib/data-converter.js.map +1 -0
- package/lib/draggable/index.js +53 -0
- package/lib/draggable/index.js.map +1 -0
- package/lib/index.js +241 -0
- package/lib/index.js.map +1 -0
- package/lib/number-line/colors.js +21 -0
- package/lib/number-line/colors.js.map +1 -0
- package/lib/number-line/feedback.js +108 -0
- package/lib/number-line/feedback.js.map +1 -0
- package/lib/number-line/graph/arrow.js +63 -0
- package/lib/number-line/graph/arrow.js.map +1 -0
- package/lib/number-line/graph/elements/base.js +26 -0
- package/lib/number-line/graph/elements/base.js.map +1 -0
- package/lib/number-line/graph/elements/builder.js +38 -0
- package/lib/number-line/graph/elements/builder.js.map +1 -0
- package/lib/number-line/graph/elements/line.js +317 -0
- package/lib/number-line/graph/elements/line.js.map +1 -0
- package/lib/number-line/graph/elements/point.js +233 -0
- package/lib/number-line/graph/elements/point.js.map +1 -0
- package/lib/number-line/graph/elements/ray.js +227 -0
- package/lib/number-line/graph/elements/ray.js.map +1 -0
- package/lib/number-line/graph/index.js +328 -0
- package/lib/number-line/graph/index.js.map +1 -0
- package/lib/number-line/graph/line.js +48 -0
- package/lib/number-line/graph/line.js.map +1 -0
- package/lib/number-line/graph/stacks.js +101 -0
- package/lib/number-line/graph/stacks.js.map +1 -0
- package/lib/number-line/graph/tick-utils.js +440 -0
- package/lib/number-line/graph/tick-utils.js.map +1 -0
- package/lib/number-line/graph/ticks.js +239 -0
- package/lib/number-line/graph/ticks.js.map +1 -0
- package/lib/number-line/index.js +425 -0
- package/lib/number-line/index.js.map +1 -0
- package/lib/number-line/point-chooser/button.js +74 -0
- package/lib/number-line/point-chooser/button.js.map +1 -0
- package/lib/number-line/point-chooser/img.js +9 -0
- package/lib/number-line/point-chooser/img.js.map +1 -0
- package/lib/number-line/point-chooser/index.js +193 -0
- package/lib/number-line/point-chooser/index.js.map +1 -0
- package/lib/number-line/point-chooser/styles.js +100 -0
- package/lib/number-line/point-chooser/styles.js.map +1 -0
- package/lib/number-line/transitions/fade.js +67 -0
- package/lib/number-line/transitions/fade.js.map +1 -0
- package/lib/number-line/transitions/index.js +16 -0
- package/lib/number-line/transitions/index.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,867 @@
|
|
|
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.toPointType = exports["default"] = exports.Main = void 0;
|
|
11
|
+
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
18
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
20
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
21
|
+
|
|
22
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
+
|
|
24
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
+
|
|
26
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
27
|
+
|
|
28
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
|
+
|
|
30
|
+
var _react = _interopRequireDefault(require("react"));
|
|
31
|
+
|
|
32
|
+
var _configUi = require("@pie-lib/pie-toolbox/config-ui");
|
|
33
|
+
|
|
34
|
+
var _editableHtml = require("@pie-lib/pie-toolbox/editable-html");
|
|
35
|
+
|
|
36
|
+
var _numberLine = require("@pie-element/number-line");
|
|
37
|
+
|
|
38
|
+
var _numberTextField = _interopRequireDefault(require("./number-text-field"));
|
|
39
|
+
|
|
40
|
+
var _cardBar = _interopRequireDefault(require("./card-bar"));
|
|
41
|
+
|
|
42
|
+
var _size = _interopRequireDefault(require("./size"));
|
|
43
|
+
|
|
44
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
45
|
+
|
|
46
|
+
var _domain = _interopRequireDefault(require("./domain"));
|
|
47
|
+
|
|
48
|
+
var _arrows = _interopRequireDefault(require("./arrows"));
|
|
49
|
+
|
|
50
|
+
var _pointConfig = _interopRequireDefault(require("./point-config"));
|
|
51
|
+
|
|
52
|
+
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
53
|
+
|
|
54
|
+
var _styles = require("@material-ui/core/styles");
|
|
55
|
+
|
|
56
|
+
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
|
|
57
|
+
|
|
58
|
+
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
|
59
|
+
|
|
60
|
+
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
61
|
+
|
|
62
|
+
var _ticks = _interopRequireDefault(require("./ticks"));
|
|
63
|
+
|
|
64
|
+
var _defaults = require("./defaults");
|
|
65
|
+
|
|
66
|
+
var _utils = require("./utils");
|
|
67
|
+
|
|
68
|
+
var math = _interopRequireWildcard(require("mathjs"));
|
|
69
|
+
|
|
70
|
+
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); }
|
|
71
|
+
|
|
72
|
+
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; }
|
|
73
|
+
|
|
74
|
+
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); }; }
|
|
75
|
+
|
|
76
|
+
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; } }
|
|
77
|
+
|
|
78
|
+
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; }
|
|
79
|
+
|
|
80
|
+
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; }
|
|
81
|
+
|
|
82
|
+
var trimModel = function trimModel(model) {
|
|
83
|
+
return _objectSpread(_objectSpread({}, model), {}, {
|
|
84
|
+
feedback: undefined,
|
|
85
|
+
prompt: undefined,
|
|
86
|
+
teacherInstructions: undefined,
|
|
87
|
+
graph: _objectSpread(_objectSpread({}, model.graph), {}, {
|
|
88
|
+
title: undefined,
|
|
89
|
+
disabled: true
|
|
90
|
+
}),
|
|
91
|
+
correctResponse: undefined
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
var lineIsSwitched = _numberLine.dataConverter.lineIsSwitched,
|
|
96
|
+
switchGraphLine = _numberLine.dataConverter.switchGraphLine,
|
|
97
|
+
toGraphFormat = _numberLine.dataConverter.toGraphFormat,
|
|
98
|
+
toSessionFormat = _numberLine.dataConverter.toSessionFormat;
|
|
99
|
+
var minorLimits = {};
|
|
100
|
+
var minorValues = {};
|
|
101
|
+
var majorValues = {};
|
|
102
|
+
|
|
103
|
+
var styles = function styles(theme) {
|
|
104
|
+
return {
|
|
105
|
+
maxNumberOfPoints: {
|
|
106
|
+
width: '150px'
|
|
107
|
+
},
|
|
108
|
+
checkbox: {
|
|
109
|
+
marginTop: theme.spacing.unit * 2,
|
|
110
|
+
marginBottom: theme.spacing.unit * 2
|
|
111
|
+
},
|
|
112
|
+
row: {
|
|
113
|
+
display: 'flex',
|
|
114
|
+
flexWrap: 'wrap',
|
|
115
|
+
'& > *': {
|
|
116
|
+
paddingRight: theme.spacing.unit * 2
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
pointTypeChooser: {
|
|
120
|
+
margin: "".concat(theme.spacing.unit * 2.5, "px 0")
|
|
121
|
+
},
|
|
122
|
+
promptContainer: {
|
|
123
|
+
paddingTop: theme.spacing.unit * 2,
|
|
124
|
+
marginBottom: theme.spacing.unit * 2,
|
|
125
|
+
width: '100%'
|
|
126
|
+
},
|
|
127
|
+
title: {
|
|
128
|
+
marginBottom: theme.spacing.unit * 4
|
|
129
|
+
},
|
|
130
|
+
tooltip: {
|
|
131
|
+
fontSize: theme.typography.fontSize - 2,
|
|
132
|
+
whiteSpace: 'pre',
|
|
133
|
+
maxWidth: '500px'
|
|
134
|
+
},
|
|
135
|
+
inlineFlexContainer: {
|
|
136
|
+
display: 'inline-flex'
|
|
137
|
+
},
|
|
138
|
+
resetButton: {
|
|
139
|
+
marginBottom: theme.spacing.unit * 2.5
|
|
140
|
+
},
|
|
141
|
+
errorText: {
|
|
142
|
+
fontSize: theme.typography.fontSize - 2,
|
|
143
|
+
color: theme.palette.error.main,
|
|
144
|
+
paddingTop: theme.spacing.unit
|
|
145
|
+
},
|
|
146
|
+
flexRow: {
|
|
147
|
+
display: 'flex',
|
|
148
|
+
alignItems: 'center',
|
|
149
|
+
gap: '10px'
|
|
150
|
+
},
|
|
151
|
+
description: {
|
|
152
|
+
marginBottom: theme.spacing.unit * 2.5
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
var toPointType = function toPointType(response) {
|
|
158
|
+
function rest(response) {
|
|
159
|
+
if (response.pointType) {
|
|
160
|
+
if (response.direction) {
|
|
161
|
+
return "".concat(response.pointType[0]).concat(response.direction[0]);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return response.pointType[0];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return "".concat(response.leftPoint[0]).concat(response.rightPoint[0]);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return "".concat(response.type[0]).concat(rest(response)).toUpperCase();
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
exports.toPointType = toPointType;
|
|
174
|
+
|
|
175
|
+
var Main = /*#__PURE__*/function (_React$Component) {
|
|
176
|
+
(0, _inherits2["default"])(Main, _React$Component);
|
|
177
|
+
|
|
178
|
+
var _super = _createSuper(Main);
|
|
179
|
+
|
|
180
|
+
function Main(props) {
|
|
181
|
+
var _this;
|
|
182
|
+
|
|
183
|
+
(0, _classCallCheck2["default"])(this, Main);
|
|
184
|
+
_this = _super.call(this, props);
|
|
185
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "graphChange", function (obj) {
|
|
186
|
+
var _this$props = _this.props,
|
|
187
|
+
model = _this$props.model,
|
|
188
|
+
onChange = _this$props.onChange;
|
|
189
|
+
|
|
190
|
+
var graph = _objectSpread(_objectSpread({}, model.graph), obj);
|
|
191
|
+
|
|
192
|
+
var respIndex = [];
|
|
193
|
+
model.correctResponse.forEach(function (correctResp, key) {
|
|
194
|
+
if (correctResp.domainPosition < graph.domain.min || correctResp.domainPosition > graph.domain.max || correctResp.size && (correctResp.domainPosition + correctResp.size < graph.domain.min || correctResp.domainPosition + correctResp.size > graph.domain.max)) {
|
|
195
|
+
respIndex.push(key);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
if (respIndex.length > 0) {
|
|
200
|
+
_this.setState({
|
|
201
|
+
correctAnswerDialog: {
|
|
202
|
+
open: true,
|
|
203
|
+
text: 'This\n' + 'change would make it impossible for students to plot one or more elements in the current\n' + 'correct answer. If you proceed, all such elements will be removed from the correct\n' + 'answer.',
|
|
204
|
+
indices: respIndex,
|
|
205
|
+
graph: model.graph
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
} //reload ticks value whenever domain and width is changed
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
graph = _this.reloadTicksData(graph);
|
|
212
|
+
onChange({
|
|
213
|
+
graph: graph
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeSize", function (_ref) {
|
|
217
|
+
var width = _ref.width,
|
|
218
|
+
height = _ref.height;
|
|
219
|
+
return _this.graphChange({
|
|
220
|
+
width: width,
|
|
221
|
+
height: height
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getAdjustedHeight", function (availableTypes, maxNumberOfPoints) {
|
|
225
|
+
var onlyPFAvailable = true;
|
|
226
|
+
Object.entries(availableTypes || {}).forEach(function (_ref2) {
|
|
227
|
+
var _ref3 = (0, _slicedToArray2["default"])(_ref2, 2),
|
|
228
|
+
type = _ref3[0],
|
|
229
|
+
value = _ref3[1];
|
|
230
|
+
|
|
231
|
+
if (type !== 'PF' && value) {
|
|
232
|
+
onlyPFAvailable = false;
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
return maxNumberOfPoints && (maxNumberOfPoints === 1 || onlyPFAvailable) ? 100 : 50 + (maxNumberOfPoints || 20) * 25;
|
|
237
|
+
});
|
|
238
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeMaxNoOfPoints", function (e, maxNumberOfPoints) {
|
|
239
|
+
maxNumberOfPoints = Math.floor(maxNumberOfPoints);
|
|
240
|
+
|
|
241
|
+
if (_this.props.model.correctResponse.length > maxNumberOfPoints) {
|
|
242
|
+
_this.setState({
|
|
243
|
+
dialog: {
|
|
244
|
+
open: true,
|
|
245
|
+
text: 'To use this value, you must first remove one or more elements from the correct answers.'
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
var availableTypes = _this.props.model.graph.availableTypes;
|
|
253
|
+
|
|
254
|
+
var height = _this.getAdjustedHeight(availableTypes, maxNumberOfPoints);
|
|
255
|
+
|
|
256
|
+
_this.graphChange({
|
|
257
|
+
maxNumberOfPoints: maxNumberOfPoints,
|
|
258
|
+
height: height
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeGraphTitle", function (title) {
|
|
262
|
+
return _this.graphChange({
|
|
263
|
+
title: title
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeTicks", function (object) {
|
|
267
|
+
var _this$props2 = _this.props,
|
|
268
|
+
model = _this$props2.model,
|
|
269
|
+
onChange = _this$props2.onChange;
|
|
270
|
+
var ticks = object.ticks;
|
|
271
|
+
|
|
272
|
+
var correctResponse = _numberLine.tickUtils.snapElements(model.graph.domain, ticks, model.correctResponse);
|
|
273
|
+
|
|
274
|
+
var initialElements = _numberLine.tickUtils.snapElements(model.graph.domain, ticks, model.graph.initialElements);
|
|
275
|
+
|
|
276
|
+
var updatedGraph = _this.updateMajorValue(_objectSpread(_objectSpread({}, model.graph), {}, {
|
|
277
|
+
ticks: ticks
|
|
278
|
+
}));
|
|
279
|
+
|
|
280
|
+
var graph = _objectSpread(_objectSpread({}, updatedGraph), {}, {
|
|
281
|
+
initialElements: initialElements
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
onChange({
|
|
285
|
+
graph: graph,
|
|
286
|
+
correctResponse: correctResponse
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "reloadTicksData", function (graph) {
|
|
290
|
+
var domain = graph.domain,
|
|
291
|
+
ticks = graph.ticks,
|
|
292
|
+
width = graph.width; //Set tick interval type if not present for legacy number line models depending upon minor value
|
|
293
|
+
|
|
294
|
+
if (!ticks.tickIntervalType) {
|
|
295
|
+
if (ticks.minor > 0.5) {
|
|
296
|
+
ticks.tickIntervalType = 'Integer';
|
|
297
|
+
} else {
|
|
298
|
+
ticks.tickIntervalType = 'Decimal';
|
|
299
|
+
}
|
|
300
|
+
} // This section will calculate minor and major values array and assign respective value
|
|
301
|
+
// to different tick types object
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
minorLimits = _numberLine.tickUtils.getMinorLimits(domain, width);
|
|
305
|
+
|
|
306
|
+
if (minorLimits.min >= 1) {
|
|
307
|
+
/*
|
|
308
|
+
* In this scenario only integer tick will be enabled
|
|
309
|
+
* */
|
|
310
|
+
ticks.tickIntervalType = 'Integer';
|
|
311
|
+
ticks.minor = ticks.minor < 1 ? math.number(math.ceil(minorLimits.min)) : ticks.minor >= math.number(math.ceil(minorLimits.min)) && ticks.minor <= math.number(math.floor(minorLimits.max)) ? ticks.minor : math.number(math.ceil(minorLimits.min));
|
|
312
|
+
ticks.integerTick = ticks.minor;
|
|
313
|
+
minorValues = {
|
|
314
|
+
decimal: [],
|
|
315
|
+
fraction: []
|
|
316
|
+
};
|
|
317
|
+
ticks.fractionTick = '0';
|
|
318
|
+
ticks.decimalTick = 0;
|
|
319
|
+
} else if (minorLimits.min >= 0 && minorLimits.max < 1) {
|
|
320
|
+
/*
|
|
321
|
+
* In this scenario only decimal or fraction tick will be enabled
|
|
322
|
+
* */
|
|
323
|
+
if (ticks.tickIntervalType === 'Integer') {
|
|
324
|
+
ticks.tickIntervalType = 'Fraction';
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
minorValues = _numberLine.tickUtils.generateMinorValues(minorLimits);
|
|
328
|
+
var minValue = math.number(math.fraction(minorValues.fraction[0]));
|
|
329
|
+
var maxValue = math.number(math.fraction(minorValues.fraction[minorValues.fraction.length - 1]));
|
|
330
|
+
|
|
331
|
+
if (ticks.minor < minValue || ticks.minor > maxValue) {
|
|
332
|
+
switch (ticks.tickIntervalType) {
|
|
333
|
+
case 'Fraction':
|
|
334
|
+
ticks.minor = math.number(math.fraction(minorValues.fraction[minorValues.fraction.length - 1]));
|
|
335
|
+
ticks.fractionTick = minorValues.fraction[minorValues.fraction.length - 1];
|
|
336
|
+
ticks.decimalTick = minorValues.decimal[0];
|
|
337
|
+
break;
|
|
338
|
+
|
|
339
|
+
case 'Decimal':
|
|
340
|
+
case 'Integer':
|
|
341
|
+
ticks.minor = minorValues.decimal[minorValues.decimal.length - 1];
|
|
342
|
+
ticks.decimalTick = minorValues.decimal[minorValues.decimal.length - 1];
|
|
343
|
+
ticks.fractionTick = minorValues.fraction[0];
|
|
344
|
+
}
|
|
345
|
+
} else {
|
|
346
|
+
switch (ticks.tickIntervalType) {
|
|
347
|
+
case 'Fraction':
|
|
348
|
+
var fraction = math.fraction(math.number(ticks.minor));
|
|
349
|
+
ticks.fractionTick = fraction.n + '/' + fraction.d;
|
|
350
|
+
ticks.decimalTick = ticks.decimalTick ? ticks.decimalTick : minorValues.decimal[0];
|
|
351
|
+
break;
|
|
352
|
+
|
|
353
|
+
case 'Decimal':
|
|
354
|
+
case 'Integer':
|
|
355
|
+
ticks.decimalTick = ticks.minor;
|
|
356
|
+
ticks.fractionTick = ticks.fractionTick ? ticks.fractionTick : minorValues.fraction[0];
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
ticks.integerTick = 1;
|
|
361
|
+
} else if (minorLimits.min < 1 && minorLimits.max >= 1) {
|
|
362
|
+
/*
|
|
363
|
+
* In this scenario all integer, decimal or fraction tick will be enabled
|
|
364
|
+
* */
|
|
365
|
+
minorValues = _numberLine.tickUtils.generateMinorValues(minorLimits);
|
|
366
|
+
|
|
367
|
+
if (!(ticks.minor >= minorLimits.min && ticks.minor <= minorLimits.max)) {
|
|
368
|
+
if (minorLimits.min > 0.5) {
|
|
369
|
+
ticks.tickIntervalType = 'Integer';
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
switch (ticks.tickIntervalType) {
|
|
373
|
+
case 'Integer':
|
|
374
|
+
ticks.minor = math.number(math.ceil(minorLimits.min));
|
|
375
|
+
ticks.integerTick = ticks.minor;
|
|
376
|
+
ticks.decimalTick = minorLimits.min > 0.5 ? 0 : minorValues.decimal[0];
|
|
377
|
+
ticks.fractionTick = minorLimits.min > 0.5 ? '0' : minorValues.fraction[0];
|
|
378
|
+
break;
|
|
379
|
+
|
|
380
|
+
case 'Decimal':
|
|
381
|
+
ticks.minor = minorValues.decimal[0];
|
|
382
|
+
ticks.integerTick = 1;
|
|
383
|
+
ticks.decimalTick = ticks.minor;
|
|
384
|
+
ticks.fractionTick = minorValues.fraction[0];
|
|
385
|
+
break;
|
|
386
|
+
|
|
387
|
+
case 'Fraction':
|
|
388
|
+
ticks.minor = math.number(math.fraction(minorValues.fraction[0]));
|
|
389
|
+
ticks.integerTick = 1;
|
|
390
|
+
ticks.decimalTick = minorValues.decimal[0];
|
|
391
|
+
ticks.fractionTick = minorValues.fraction[0];
|
|
392
|
+
}
|
|
393
|
+
} else {
|
|
394
|
+
switch (ticks.tickIntervalType) {
|
|
395
|
+
case 'Integer':
|
|
396
|
+
ticks.integerTick = ticks.minor;
|
|
397
|
+
ticks.decimalTick = minorLimits.min > 0.5 ? 0 : minorValues.decimal[0];
|
|
398
|
+
ticks.fractionTick = minorLimits.min > 0.5 ? '0' : minorValues.fraction[0];
|
|
399
|
+
break;
|
|
400
|
+
|
|
401
|
+
case 'Decimal':
|
|
402
|
+
ticks.integerTick = 1;
|
|
403
|
+
ticks.decimalTick = ticks.minor;
|
|
404
|
+
ticks.fractionTick = minorValues.fraction[0];
|
|
405
|
+
break;
|
|
406
|
+
|
|
407
|
+
case 'Fraction':
|
|
408
|
+
ticks.integerTick = 1;
|
|
409
|
+
ticks.decimalTick = minorValues.decimal[0];
|
|
410
|
+
|
|
411
|
+
var _fraction = math.fraction(math.number(ticks.minor));
|
|
412
|
+
|
|
413
|
+
ticks.fractionTick = _fraction.n + '/' + _fraction.d;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
return _this.updateMajorValue(_objectSpread(_objectSpread({}, graph), {}, {
|
|
419
|
+
ticks: ticks
|
|
420
|
+
}));
|
|
421
|
+
});
|
|
422
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateMajorValue", function (graph) {
|
|
423
|
+
var domain = graph.domain,
|
|
424
|
+
ticks = graph.ticks,
|
|
425
|
+
width = graph.width;
|
|
426
|
+
majorValues = _numberLine.tickUtils.generateMajorValuesForMinor(ticks.minor, domain, width);
|
|
427
|
+
|
|
428
|
+
if (majorValues.decimal.indexOf(ticks.major) === -1) {
|
|
429
|
+
var currIndex = 0;
|
|
430
|
+
|
|
431
|
+
if (ticks.tickIntervalType === 'Integer') {
|
|
432
|
+
currIndex = majorValues.decimal.length > 4 ? 4 : majorValues.decimal.length - 1;
|
|
433
|
+
} else {
|
|
434
|
+
currIndex = majorValues.decimal.length - 1;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
ticks.major = majorValues.decimal[currIndex];
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
graph.fraction = ticks.tickIntervalType === 'Fraction' && ticks.major < 1;
|
|
441
|
+
return _objectSpread(_objectSpread({}, graph), {}, {
|
|
442
|
+
ticks: ticks
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeArrows", function (arrows) {
|
|
446
|
+
return _this.graphChange({
|
|
447
|
+
arrows: arrows
|
|
448
|
+
});
|
|
449
|
+
});
|
|
450
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setDefaults", function () {
|
|
451
|
+
var _defaultModel$graph = _defaults.model.graph,
|
|
452
|
+
availableTypes = _defaultModel$graph.availableTypes,
|
|
453
|
+
maxNumberOfPoints = _defaultModel$graph.maxNumberOfPoints;
|
|
454
|
+
|
|
455
|
+
var height = _this.getAdjustedHeight(availableTypes, maxNumberOfPoints);
|
|
456
|
+
|
|
457
|
+
var graph = _objectSpread(_objectSpread({}, (0, _cloneDeep["default"])(_defaults.model.graph)), {}, {
|
|
458
|
+
height: height
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
_this.props.onChange({
|
|
462
|
+
graph: graph
|
|
463
|
+
});
|
|
464
|
+
});
|
|
465
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "moveCorrectResponse", function (index, el, position) {
|
|
466
|
+
el.position = position;
|
|
467
|
+
var _this$props3 = _this.props,
|
|
468
|
+
onChange = _this$props3.onChange,
|
|
469
|
+
model = _this$props3.model;
|
|
470
|
+
var update = toSessionFormat(el.type === 'line' && lineIsSwitched(el) ? switchGraphLine(el) : el);
|
|
471
|
+
var correctResponse = (0, _toConsumableArray2["default"])(model.correctResponse);
|
|
472
|
+
correctResponse[index] = update;
|
|
473
|
+
onChange({
|
|
474
|
+
correctResponse: correctResponse
|
|
475
|
+
});
|
|
476
|
+
});
|
|
477
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "availableTypesChange", function (availableTypes) {
|
|
478
|
+
var _this$props4 = _this.props,
|
|
479
|
+
model = _this$props4.model,
|
|
480
|
+
onChange = _this$props4.onChange;
|
|
481
|
+
var correctResponse = model.correctResponse,
|
|
482
|
+
maxNumberOfPoints = model.graph.maxNumberOfPoints;
|
|
483
|
+
new Set(correctResponse.map(toPointType)).forEach(function (pointType) {
|
|
484
|
+
availableTypes[pointType] = true;
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
var height = _this.getAdjustedHeight(availableTypes, maxNumberOfPoints);
|
|
488
|
+
|
|
489
|
+
var graph = _objectSpread(_objectSpread({}, model.graph), {}, {
|
|
490
|
+
availableTypes: availableTypes,
|
|
491
|
+
height: height
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
onChange({
|
|
495
|
+
graph: graph
|
|
496
|
+
});
|
|
497
|
+
});
|
|
498
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "deleteCorrectResponse", function (indices) {
|
|
499
|
+
var _this$props5 = _this.props,
|
|
500
|
+
model = _this$props5.model,
|
|
501
|
+
onChange = _this$props5.onChange;
|
|
502
|
+
var correctResponse = model.correctResponse.filter(function (v, index) {
|
|
503
|
+
return !indices.some(function (d) {
|
|
504
|
+
return d === index;
|
|
505
|
+
});
|
|
506
|
+
});
|
|
507
|
+
onChange({
|
|
508
|
+
correctResponse: correctResponse
|
|
509
|
+
});
|
|
510
|
+
});
|
|
511
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "addCorrectResponse", function (data) {
|
|
512
|
+
var _this$props6 = _this.props,
|
|
513
|
+
model = _this$props6.model,
|
|
514
|
+
onChange = _this$props6.onChange;
|
|
515
|
+
var correctResponse = (0, _toConsumableArray2["default"])(model.correctResponse);
|
|
516
|
+
correctResponse.push(toSessionFormat(data));
|
|
517
|
+
onChange({
|
|
518
|
+
correctResponse: correctResponse
|
|
519
|
+
});
|
|
520
|
+
});
|
|
521
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "clearCorrectResponse", function () {
|
|
522
|
+
var onChange = _this.props.onChange;
|
|
523
|
+
onChange({
|
|
524
|
+
correctResponse: []
|
|
525
|
+
});
|
|
526
|
+
});
|
|
527
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "undoCorrectResponse", function () {
|
|
528
|
+
var _this$props7 = _this.props,
|
|
529
|
+
model = _this$props7.model,
|
|
530
|
+
onChange = _this$props7.onChange;
|
|
531
|
+
var correctResponse = (0, _toConsumableArray2["default"])(model.correctResponse);
|
|
532
|
+
correctResponse.pop();
|
|
533
|
+
onChange({
|
|
534
|
+
correctResponse: correctResponse
|
|
535
|
+
});
|
|
536
|
+
});
|
|
537
|
+
var _props$model$graph = props.model.graph,
|
|
538
|
+
_availableTypes = _props$model$graph.availableTypes,
|
|
539
|
+
_maxNumberOfPoints = _props$model$graph.maxNumberOfPoints;
|
|
540
|
+
|
|
541
|
+
var _height = _this.getAdjustedHeight(_availableTypes, _maxNumberOfPoints);
|
|
542
|
+
|
|
543
|
+
_this.state = {
|
|
544
|
+
dialog: {
|
|
545
|
+
open: false,
|
|
546
|
+
text: ''
|
|
547
|
+
},
|
|
548
|
+
correctAnswerDialog: {
|
|
549
|
+
open: false,
|
|
550
|
+
text: ''
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
_this.graphChange({
|
|
555
|
+
height: _height
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
return _this;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
(0, _createClass2["default"])(Main, [{
|
|
562
|
+
key: "render",
|
|
563
|
+
value: function render() {
|
|
564
|
+
var _this2 = this;
|
|
565
|
+
|
|
566
|
+
var _this$props8 = this.props,
|
|
567
|
+
classes = _this$props8.classes,
|
|
568
|
+
model = _this$props8.model,
|
|
569
|
+
_onChange = _this$props8.onChange,
|
|
570
|
+
configuration = _this$props8.configuration,
|
|
571
|
+
uploadSoundSupport = _this$props8.uploadSoundSupport;
|
|
572
|
+
|
|
573
|
+
var _ref4 = configuration || {},
|
|
574
|
+
_ref4$baseInputConfig = _ref4.baseInputConfiguration,
|
|
575
|
+
baseInputConfiguration = _ref4$baseInputConfig === void 0 ? {} : _ref4$baseInputConfig,
|
|
576
|
+
_ref4$contentDimensio = _ref4.contentDimensions,
|
|
577
|
+
contentDimensions = _ref4$contentDimensio === void 0 ? {} : _ref4$contentDimensio,
|
|
578
|
+
_ref4$instruction = _ref4.instruction,
|
|
579
|
+
instruction = _ref4$instruction === void 0 ? {} : _ref4$instruction,
|
|
580
|
+
_ref4$teacherInstruct = _ref4.teacherInstructions,
|
|
581
|
+
teacherInstructions = _ref4$teacherInstruct === void 0 ? {} : _ref4$teacherInstruct,
|
|
582
|
+
_ref4$title = _ref4.title,
|
|
583
|
+
title = _ref4$title === void 0 ? {} : _ref4$title,
|
|
584
|
+
_ref4$prompt = _ref4.prompt,
|
|
585
|
+
prompt = _ref4$prompt === void 0 ? {} : _ref4$prompt,
|
|
586
|
+
_ref4$mathMlOptions = _ref4.mathMlOptions,
|
|
587
|
+
mathMlOptions = _ref4$mathMlOptions === void 0 ? {} : _ref4$mathMlOptions,
|
|
588
|
+
_ref4$numberLineDimen = _ref4.numberLineDimensions,
|
|
589
|
+
numberLineDimensions = _ref4$numberLineDimen === void 0 ? {} : _ref4$numberLineDimen,
|
|
590
|
+
_ref4$maxMaxElements = _ref4.maxMaxElements,
|
|
591
|
+
maxMaxElements = _ref4$maxMaxElements === void 0 ? 20 : _ref4$maxMaxElements,
|
|
592
|
+
_ref4$hidePointConfig = _ref4.hidePointConfigButtons,
|
|
593
|
+
hidePointConfigButtons = _ref4$hidePointConfig === void 0 ? false : _ref4$hidePointConfig,
|
|
594
|
+
_ref4$availableTools = _ref4.availableTools,
|
|
595
|
+
availableTools = _ref4$availableTools === void 0 ? ['PF'] : _ref4$availableTools;
|
|
596
|
+
|
|
597
|
+
var _ref5 = model || {},
|
|
598
|
+
_ref5$errors = _ref5.errors,
|
|
599
|
+
errors = _ref5$errors === void 0 ? {} : _ref5$errors,
|
|
600
|
+
spellCheckEnabled = _ref5.spellCheckEnabled,
|
|
601
|
+
toolbarEditorPosition = _ref5.toolbarEditorPosition;
|
|
602
|
+
|
|
603
|
+
var graph = model.graph;
|
|
604
|
+
graph = this.reloadTicksData(graph);
|
|
605
|
+
var _this$state = this.state,
|
|
606
|
+
dialog = _this$state.dialog,
|
|
607
|
+
correctAnswerDialog = _this$state.correctAnswerDialog;
|
|
608
|
+
|
|
609
|
+
var _ref6 = errors || {},
|
|
610
|
+
correctResponseError = _ref6.correctResponseError,
|
|
611
|
+
domainError = _ref6.domainError,
|
|
612
|
+
maxError = _ref6.maxError,
|
|
613
|
+
pointsError = _ref6.pointsError,
|
|
614
|
+
promptError = _ref6.prompt,
|
|
615
|
+
teacherInstructionsError = _ref6.teacherInstructions,
|
|
616
|
+
widthError = _ref6.widthError;
|
|
617
|
+
|
|
618
|
+
var validationMessage = (0, _utils.generateValidationMessage)();
|
|
619
|
+
var correctResponse = (0, _cloneDeep["default"])(model.correctResponse || []).map(toGraphFormat);
|
|
620
|
+
var initialModel = (0, _cloneDeep["default"])(model);
|
|
621
|
+
initialModel['disabled'] = true;
|
|
622
|
+
var toolbarOpts = {
|
|
623
|
+
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
var getPluginProps = function getPluginProps() {
|
|
627
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
628
|
+
return _objectSpread(_objectSpread({}, baseInputConfiguration), props);
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
632
|
+
dimensions: contentDimensions,
|
|
633
|
+
hideSettings: true,
|
|
634
|
+
settings: null
|
|
635
|
+
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
636
|
+
component: "div",
|
|
637
|
+
type: "body1",
|
|
638
|
+
className: classes.description
|
|
639
|
+
}, instruction.label), teacherInstructions.settings && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
640
|
+
label: teacherInstructions.label,
|
|
641
|
+
className: classes.promptContainer
|
|
642
|
+
}, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
|
|
643
|
+
className: classes.teacherInstructions,
|
|
644
|
+
markup: model.teacherInstructions || '',
|
|
645
|
+
onChange: function onChange(teacherInstructions) {
|
|
646
|
+
return _onChange({
|
|
647
|
+
teacherInstructions: teacherInstructions
|
|
648
|
+
});
|
|
649
|
+
},
|
|
650
|
+
nonEmpty: false,
|
|
651
|
+
disableUnderline: true,
|
|
652
|
+
error: teacherInstructionsError,
|
|
653
|
+
toolbarOpts: toolbarOpts,
|
|
654
|
+
pluginProps: getPluginProps(teacherInstructions === null || teacherInstructions === void 0 ? void 0 : teacherInstructions.inputConfiguration),
|
|
655
|
+
spellCheck: spellCheckEnabled,
|
|
656
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
657
|
+
languageCharactersProps: [{
|
|
658
|
+
language: 'spanish'
|
|
659
|
+
}, {
|
|
660
|
+
language: 'special'
|
|
661
|
+
}],
|
|
662
|
+
mathMlOptions: mathMlOptions
|
|
663
|
+
}), teacherInstructionsError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
664
|
+
className: classes.errorText
|
|
665
|
+
}, teacherInstructionsError)), prompt.settings && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
666
|
+
label: prompt.label,
|
|
667
|
+
className: classes.promptContainer
|
|
668
|
+
}, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
|
|
669
|
+
className: classes.prompt,
|
|
670
|
+
markup: model.prompt || '',
|
|
671
|
+
onChange: function onChange(prompt) {
|
|
672
|
+
return _onChange({
|
|
673
|
+
prompt: prompt
|
|
674
|
+
});
|
|
675
|
+
},
|
|
676
|
+
nonEmpty: false,
|
|
677
|
+
disableUnderline: true,
|
|
678
|
+
error: promptError,
|
|
679
|
+
toolbarOpts: toolbarOpts,
|
|
680
|
+
pluginProps: getPluginProps(prompt === null || prompt === void 0 ? void 0 : prompt.inputConfiguration),
|
|
681
|
+
spellCheck: spellCheckEnabled,
|
|
682
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
683
|
+
languageCharactersProps: [{
|
|
684
|
+
language: 'spanish'
|
|
685
|
+
}, {
|
|
686
|
+
language: 'special'
|
|
687
|
+
}],
|
|
688
|
+
mathMlOptions: mathMlOptions
|
|
689
|
+
}), promptError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
690
|
+
className: classes.errorText
|
|
691
|
+
}, promptError)), /*#__PURE__*/_react["default"].createElement(_cardBar["default"], {
|
|
692
|
+
header: "Set Up Number Line",
|
|
693
|
+
info: /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
694
|
+
classes: {
|
|
695
|
+
tooltip: classes.tooltip
|
|
696
|
+
},
|
|
697
|
+
disableFocusListener: true,
|
|
698
|
+
disableTouchListener: true,
|
|
699
|
+
placement: 'right',
|
|
700
|
+
title: validationMessage
|
|
701
|
+
}, /*#__PURE__*/_react["default"].createElement(_Info["default"], {
|
|
702
|
+
fontSize: 'small',
|
|
703
|
+
color: 'primary',
|
|
704
|
+
style: {
|
|
705
|
+
marginLeft: '8px'
|
|
706
|
+
}
|
|
707
|
+
}))
|
|
708
|
+
}, "Set up the number line by entering the domain and number of tick marks to display. Labels on the number line can be edited or removed by clicking on the label."), /*#__PURE__*/_react["default"].createElement("div", {
|
|
709
|
+
className: classes.row
|
|
710
|
+
}, /*#__PURE__*/_react["default"].createElement(_domain["default"], {
|
|
711
|
+
domain: graph.domain,
|
|
712
|
+
errors: errors,
|
|
713
|
+
onChange: function onChange(domain) {
|
|
714
|
+
return _this2.graphChange({
|
|
715
|
+
domain: domain
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
})), maxError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
719
|
+
className: classes.errorText
|
|
720
|
+
}, maxError), domainError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
721
|
+
className: classes.errorText
|
|
722
|
+
}, domainError), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_configUi.FormSection, null, /*#__PURE__*/_react["default"].createElement(_ticks["default"], {
|
|
723
|
+
ticks: graph.ticks,
|
|
724
|
+
minorLimits: minorLimits,
|
|
725
|
+
minorValues: minorValues,
|
|
726
|
+
majorValues: majorValues,
|
|
727
|
+
onChange: this.changeTicks
|
|
728
|
+
}))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
729
|
+
className: classes.flexRow
|
|
730
|
+
}, model.widthEnabled && /*#__PURE__*/_react["default"].createElement(_size["default"], {
|
|
731
|
+
size: graph,
|
|
732
|
+
min: numberLineDimensions.min,
|
|
733
|
+
max: numberLineDimensions.max,
|
|
734
|
+
step: numberLineDimensions.step,
|
|
735
|
+
onChange: this.changeSize
|
|
736
|
+
}), /*#__PURE__*/_react["default"].createElement("div", null), /*#__PURE__*/_react["default"].createElement(_arrows["default"], {
|
|
737
|
+
arrows: graph.arrows,
|
|
738
|
+
onChange: this.changeArrows
|
|
739
|
+
})), widthError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
740
|
+
className: classes.errorText
|
|
741
|
+
}, widthError), /*#__PURE__*/_react["default"].createElement(_numberLine.NumberLineComponent, {
|
|
742
|
+
onMoveElement: function onMoveElement() {},
|
|
743
|
+
onDeleteElements: function onDeleteElements() {},
|
|
744
|
+
onAddElement: function onAddElement() {},
|
|
745
|
+
onClearElements: function onClearElements() {},
|
|
746
|
+
onUndoElement: function onUndoElement() {},
|
|
747
|
+
minWidth: numberLineDimensions.min,
|
|
748
|
+
maxWidth: numberLineDimensions.max,
|
|
749
|
+
maxHeight: 70,
|
|
750
|
+
model: trimModel(initialModel)
|
|
751
|
+
}), /*#__PURE__*/_react["default"].createElement(_configUi.FormSection, {
|
|
752
|
+
label: (title === null || title === void 0 ? void 0 : title.label) || 'Title',
|
|
753
|
+
className: classes.title
|
|
754
|
+
}, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
|
|
755
|
+
markup: graph.title || '',
|
|
756
|
+
onChange: this.changeGraphTitle,
|
|
757
|
+
toolbarOpts: toolbarOpts,
|
|
758
|
+
activePlugins: ['bold', 'html', 'italic', 'underline', 'strikethrough', 'image', 'math', 'languageCharacters', 'responseArea'],
|
|
759
|
+
pluginProps: getPluginProps(title === null || title === void 0 ? void 0 : title.inputConfiguration),
|
|
760
|
+
spellCheck: spellCheckEnabled,
|
|
761
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
762
|
+
languageCharactersProps: [{
|
|
763
|
+
language: 'spanish'
|
|
764
|
+
}, {
|
|
765
|
+
language: 'special'
|
|
766
|
+
}],
|
|
767
|
+
mathMlOptions: mathMlOptions
|
|
768
|
+
})), !graph.exhibitOnly && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_cardBar["default"], {
|
|
769
|
+
header: "Define Tool Set and Correct Response"
|
|
770
|
+
}, "Select answer type and place it on the number line. Intersecting points, line segments and/or rays will appear above the number line. ", /*#__PURE__*/_react["default"].createElement("i", null, "Note: A maximum of 20 points, line segments or rays may be plotted.")), /*#__PURE__*/_react["default"].createElement(_cardBar["default"], {
|
|
771
|
+
header: "Available Tools",
|
|
772
|
+
mini: true
|
|
773
|
+
}, "Click on the input options to be displayed to the students. All inputs will display by default."), /*#__PURE__*/_react["default"].createElement("div", {
|
|
774
|
+
className: classes.pointTypeChooser
|
|
775
|
+
}, /*#__PURE__*/_react["default"].createElement(_pointConfig["default"], {
|
|
776
|
+
onSelectionChange: this.availableTypesChange,
|
|
777
|
+
selection: graph.availableTypes,
|
|
778
|
+
availableTools: availableTools,
|
|
779
|
+
hideButtons: hidePointConfigButtons
|
|
780
|
+
})), /*#__PURE__*/_react["default"].createElement(_configUi.FormSection, {
|
|
781
|
+
className: classes.flexRow
|
|
782
|
+
}, /*#__PURE__*/_react["default"].createElement("label", null, "Max No of Elements"), /*#__PURE__*/_react["default"].createElement(_numberTextField["default"], {
|
|
783
|
+
className: classes.maxNumberOfPoints,
|
|
784
|
+
min: 1,
|
|
785
|
+
max: maxMaxElements,
|
|
786
|
+
onlyIntegersAllowed: true,
|
|
787
|
+
value: graph.maxNumberOfPoints,
|
|
788
|
+
onChange: this.changeMaxNoOfPoints
|
|
789
|
+
}), pointsError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
790
|
+
className: classes.errorText
|
|
791
|
+
}, pointsError)), /*#__PURE__*/_react["default"].createElement("label", null, "Correct Answer"), /*#__PURE__*/_react["default"].createElement(_numberLine.NumberLineComponent, {
|
|
792
|
+
onMoveElement: this.moveCorrectResponse,
|
|
793
|
+
onDeleteElements: this.deleteCorrectResponse,
|
|
794
|
+
onAddElement: this.addCorrectResponse,
|
|
795
|
+
onClearElements: this.clearCorrectResponse,
|
|
796
|
+
onUndoElement: this.undoCorrectResponse,
|
|
797
|
+
minWidth: numberLineDimensions.min,
|
|
798
|
+
maxWidth: numberLineDimensions.max,
|
|
799
|
+
answer: correctResponse //strip feedback for this model
|
|
800
|
+
,
|
|
801
|
+
model: trimModel(model)
|
|
802
|
+
}), correctResponseError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
803
|
+
className: classes.errorText
|
|
804
|
+
}, correctResponseError)), /*#__PURE__*/_react["default"].createElement(_configUi.AlertDialog, {
|
|
805
|
+
open: dialog.open,
|
|
806
|
+
title: "Warning",
|
|
807
|
+
text: dialog.text,
|
|
808
|
+
onConfirm: function onConfirm() {
|
|
809
|
+
return _this2.setState({
|
|
810
|
+
dialog: {
|
|
811
|
+
open: false
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
}), /*#__PURE__*/_react["default"].createElement(_configUi.AlertDialog, {
|
|
816
|
+
open: correctAnswerDialog.open,
|
|
817
|
+
title: "Warning",
|
|
818
|
+
text: correctAnswerDialog.text,
|
|
819
|
+
onConfirm: function onConfirm() {
|
|
820
|
+
var indices = _this2.state.correctAnswerDialog.indices;
|
|
821
|
+
|
|
822
|
+
if (indices && indices.length > 0) {
|
|
823
|
+
_this2.deleteCorrectResponse(indices);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
_this2.setState({
|
|
827
|
+
correctAnswerDialog: {
|
|
828
|
+
open: false
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
},
|
|
832
|
+
onClose: function onClose() {
|
|
833
|
+
var graph = _this2.state.correctAnswerDialog.graph;
|
|
834
|
+
|
|
835
|
+
_onChange({
|
|
836
|
+
graph: graph
|
|
837
|
+
});
|
|
838
|
+
|
|
839
|
+
_this2.setState({
|
|
840
|
+
correctAnswerDialog: {
|
|
841
|
+
open: false
|
|
842
|
+
}
|
|
843
|
+
});
|
|
844
|
+
},
|
|
845
|
+
onConfirmText: 'OK',
|
|
846
|
+
onCloseText: 'Cancel'
|
|
847
|
+
}));
|
|
848
|
+
}
|
|
849
|
+
}]);
|
|
850
|
+
return Main;
|
|
851
|
+
}(_react["default"].Component);
|
|
852
|
+
|
|
853
|
+
exports.Main = Main;
|
|
854
|
+
(0, _defineProperty2["default"])(Main, "propTypes", {
|
|
855
|
+
classes: _propTypes["default"].object.isRequired,
|
|
856
|
+
model: _propTypes["default"].object.isRequired,
|
|
857
|
+
configuration: _propTypes["default"].object.isRequired,
|
|
858
|
+
onChange: _propTypes["default"].func.isRequired,
|
|
859
|
+
uploadSoundSupport: _propTypes["default"].object.isRequired
|
|
860
|
+
});
|
|
861
|
+
|
|
862
|
+
var _default = (0, _styles.withStyles)(styles, {
|
|
863
|
+
name: 'Main'
|
|
864
|
+
})(Main);
|
|
865
|
+
|
|
866
|
+
exports["default"] = _default;
|
|
867
|
+
//# sourceMappingURL=main.js.map
|