@pie-element/graphing 3.5.0 → 3.5.1-beta.587
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +498 -0
- package/configure/CHANGELOG.md +482 -0
- package/configure/lib/configure.js +174 -56
- package/configure/lib/configure.js.map +1 -1
- package/configure/lib/correct-response.js +340 -62
- package/configure/lib/correct-response.js.map +1 -1
- package/configure/lib/defaults.js +281 -13
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/graphing-config.js +323 -177
- package/configure/lib/graphing-config.js.map +1 -1
- package/configure/lib/index.js +63 -18
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/utils.js +165 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +6 -5
- package/controller/CHANGELOG.md +114 -0
- package/controller/lib/defaults.js +11 -1
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +85 -23
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +8 -6
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +4 -4
- package/docs/config-schema.json +1166 -10
- package/docs/config-schema.json.md +816 -9
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +31 -19
- package/docs/pie-schema.json +725 -463
- package/docs/pie-schema.json.md +504 -87
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/main.js +23 -21
- package/lib/main.js.map +1 -1
- package/lib/utils.js +3 -1
- package/lib/utils.js.map +1 -1
- package/package.json +7 -6
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports["default"] = exports.GraphingConfig =
|
|
10
|
+
exports["default"] = exports.GraphingConfig = void 0;
|
|
11
|
+
|
|
12
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
15
|
|
|
12
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
17
|
|
|
@@ -25,134 +29,66 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
25
29
|
|
|
26
30
|
var React = _interopRequireWildcard(require("react"));
|
|
27
31
|
|
|
28
|
-
var _configUi = require("@pie-lib/config-ui");
|
|
29
|
-
|
|
30
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
31
|
-
|
|
32
32
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
33
33
|
|
|
34
|
-
var _styles = require("@material-ui/core/styles");
|
|
35
|
-
|
|
36
34
|
var _graphing = require("@pie-lib/graphing");
|
|
37
35
|
|
|
36
|
+
var _configUi = require("@pie-lib/config-ui");
|
|
37
|
+
|
|
38
38
|
var _core = require("@material-ui/core");
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _styles = require("@material-ui/core/styles");
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var _utils = require("./utils");
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var _lodash = require("lodash");
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
var _excluded = ["label"];
|
|
47
47
|
|
|
48
|
-
function
|
|
48
|
+
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); }
|
|
49
49
|
|
|
50
|
-
function
|
|
50
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(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; }
|
|
51
51
|
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
var AuthoringColumn = function AuthoringColumn(_ref) {
|
|
55
|
-
var columnKey = _ref.columnKey,
|
|
56
|
-
axis = _ref.axis,
|
|
57
|
-
classes = _ref.classes,
|
|
58
|
-
model = _ref.model;
|
|
59
|
-
var rows = [{
|
|
60
|
-
key: '${columnKey}-min-max',
|
|
61
|
-
inputs: [{
|
|
62
|
-
key: "".concat(columnKey, ".min"),
|
|
63
|
-
label: 'Min value',
|
|
64
|
-
className: classes.smallInput
|
|
65
|
-
}, {
|
|
66
|
-
key: "".concat(columnKey, ".max"),
|
|
67
|
-
label: 'Max value',
|
|
68
|
-
className: classes.smallInput
|
|
69
|
-
}]
|
|
70
|
-
}, {
|
|
71
|
-
key: "".concat(columnKey, "-tick-frequency"),
|
|
72
|
-
inputs: [{
|
|
73
|
-
key: "".concat(columnKey, ".step"),
|
|
74
|
-
label: 'Tick frequency'
|
|
75
|
-
}]
|
|
76
|
-
}, {
|
|
77
|
-
key: "".concat(columnKey, "-tick-label-frequency"),
|
|
78
|
-
inputs: [{
|
|
79
|
-
key: "".concat(columnKey, ".labelStep"),
|
|
80
|
-
label: 'Tick label frequency'
|
|
81
|
-
}]
|
|
82
|
-
}, {
|
|
83
|
-
key: "".concat(columnKey, "-axis-label"),
|
|
84
|
-
inputs: [{
|
|
85
|
-
type: 'text',
|
|
86
|
-
key: "".concat(axis, "-axis-label-input"),
|
|
87
|
-
label: "".concat(axis, " Axis Label")
|
|
88
|
-
}]
|
|
89
|
-
}];
|
|
90
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
91
|
-
className: classes.column,
|
|
92
|
-
key: columnKey
|
|
93
|
-
}, "".concat(columnKey.toUpperCase(), " (").concat(axis.toUpperCase(), ")"), rows.map(function (row) {
|
|
94
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
95
|
-
className: classes.row,
|
|
96
|
-
key: row.key
|
|
97
|
-
}, row.inputs.map(function (input) {
|
|
98
|
-
if (input.type === 'text') {
|
|
99
|
-
return /*#__PURE__*/React.createElement(_core.TextField, {
|
|
100
|
-
className: classes.input,
|
|
101
|
-
label: input.label.toUpperCase(),
|
|
102
|
-
value: model["".concat(axis, "AxisLabel")],
|
|
103
|
-
onChange: function onChange(_ref2) {
|
|
104
|
-
var target = _ref2.target;
|
|
105
|
-
return _this.onChangeInputValue("".concat(axis, "AxisLabel"), target.value);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
52
|
+
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; }
|
|
109
53
|
|
|
110
|
-
|
|
111
|
-
type: "number",
|
|
112
|
-
key: input.key,
|
|
113
|
-
label: input.label.toUpperCase(),
|
|
114
|
-
onChange: function onChange(event, value) {
|
|
115
|
-
return _this.onChangeInputValue(input.key, value);
|
|
116
|
-
},
|
|
117
|
-
value: (0, _lodash.get)(model, input.key),
|
|
118
|
-
className: input.className || classes.input
|
|
119
|
-
});
|
|
120
|
-
}));
|
|
121
|
-
}));
|
|
122
|
-
};
|
|
54
|
+
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; }
|
|
123
55
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
classes: _propTypes["default"].object,
|
|
128
|
-
columnKey: _propTypes["default"].String,
|
|
129
|
-
model: _propTypes["default"].object
|
|
130
|
-
};
|
|
56
|
+
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); }; }
|
|
57
|
+
|
|
58
|
+
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; } }
|
|
131
59
|
|
|
132
60
|
var styles = function styles(theme) {
|
|
133
61
|
return {
|
|
134
62
|
container: {
|
|
135
|
-
marginTop: theme.spacing.unit * 3,
|
|
136
|
-
marginBottom: theme.spacing.unit * 3,
|
|
137
63
|
display: 'flex',
|
|
138
|
-
|
|
64
|
+
flexWrap: 'wrap',
|
|
65
|
+
marginBottom: theme.spacing.unit * 7
|
|
66
|
+
},
|
|
67
|
+
gridConfigWrapper: {
|
|
68
|
+
display: 'flex',
|
|
69
|
+
flexDirection: 'column',
|
|
70
|
+
marginRight: theme.spacing.unit * 4,
|
|
71
|
+
marginBottom: theme.spacing.unit * 3
|
|
139
72
|
},
|
|
140
|
-
|
|
141
|
-
|
|
73
|
+
graphConfig: {
|
|
74
|
+
display: 'flex',
|
|
75
|
+
flexDirection: 'column'
|
|
142
76
|
},
|
|
143
|
-
|
|
144
|
-
marginTop: theme.spacing.unit *
|
|
145
|
-
|
|
77
|
+
subtitleText: {
|
|
78
|
+
marginTop: theme.spacing.unit * 1.5,
|
|
79
|
+
marginBottom: theme.spacing.unit
|
|
146
80
|
},
|
|
147
|
-
|
|
81
|
+
gridConfig: {
|
|
148
82
|
display: 'flex',
|
|
149
|
-
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
width: '100%',
|
|
85
|
+
marginBottom: '16px'
|
|
150
86
|
},
|
|
151
|
-
|
|
152
|
-
|
|
87
|
+
gridConfigLabel: {
|
|
88
|
+
padding: '0 8px'
|
|
153
89
|
},
|
|
154
|
-
|
|
155
|
-
|
|
90
|
+
gridConfigSelect: {
|
|
91
|
+
flex: '1'
|
|
156
92
|
}
|
|
157
93
|
};
|
|
158
94
|
};
|
|
@@ -162,113 +98,321 @@ var GraphingConfig = /*#__PURE__*/function (_React$Component) {
|
|
|
162
98
|
|
|
163
99
|
var _super = _createSuper(GraphingConfig);
|
|
164
100
|
|
|
165
|
-
function GraphingConfig() {
|
|
166
|
-
var
|
|
101
|
+
function GraphingConfig(props) {
|
|
102
|
+
var _this;
|
|
167
103
|
|
|
168
104
|
(0, _classCallCheck2["default"])(this, GraphingConfig);
|
|
105
|
+
_this = _super.call(this, props);
|
|
106
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeBackgroundMarks", function (backgroundMarks) {
|
|
107
|
+
var model = _objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
108
|
+
backgroundMarks: backgroundMarks
|
|
109
|
+
});
|
|
169
110
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
111
|
+
_this.props.onChange(model);
|
|
112
|
+
});
|
|
113
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeLabels", function (labels) {
|
|
114
|
+
var _this$props = _this.props,
|
|
115
|
+
model = _this$props.model,
|
|
116
|
+
onChange = _this$props.onChange;
|
|
117
|
+
onChange(_objectSpread(_objectSpread({}, model), {}, {
|
|
118
|
+
labels: labels
|
|
119
|
+
}));
|
|
120
|
+
});
|
|
121
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeTitle", function (title) {
|
|
122
|
+
var _this$props2 = _this.props,
|
|
123
|
+
model = _this$props2.model,
|
|
124
|
+
onChange = _this$props2.onChange;
|
|
125
|
+
onChange(_objectSpread(_objectSpread({}, model), {}, {
|
|
126
|
+
title: title
|
|
127
|
+
}));
|
|
128
|
+
});
|
|
129
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onConfigChange", function (config) {
|
|
130
|
+
var _this$props3 = _this.props,
|
|
131
|
+
model = _this$props3.model,
|
|
132
|
+
onChange = _this$props3.onChange;
|
|
133
|
+
var _this$state = _this.state,
|
|
134
|
+
oldGridValues = _this$state.gridValues,
|
|
135
|
+
oldLabelValues = _this$state.labelValues,
|
|
136
|
+
oldDomain = _this$state.domain,
|
|
137
|
+
oldRange = _this$state.range;
|
|
138
|
+
|
|
139
|
+
var updatedModel = _objectSpread(_objectSpread({}, model), config);
|
|
140
|
+
|
|
141
|
+
var answers = updatedModel.answers,
|
|
142
|
+
domain = updatedModel.domain,
|
|
143
|
+
includeAxes = updatedModel.includeAxes,
|
|
144
|
+
graph = updatedModel.graph,
|
|
145
|
+
range = updatedModel.range,
|
|
146
|
+
standardGrid = updatedModel.standardGrid;
|
|
147
|
+
var gridValues = {
|
|
148
|
+
domain: [],
|
|
149
|
+
range: []
|
|
150
|
+
};
|
|
151
|
+
var labelValues = {
|
|
152
|
+
domain: [],
|
|
153
|
+
range: []
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
if (includeAxes) {
|
|
157
|
+
var domainConstraints = (0, _utils.applyConstraints)(domain, graph.width, oldGridValues.domain, oldLabelValues.domain);
|
|
158
|
+
gridValues.domain = domainConstraints.gridValues || [];
|
|
159
|
+
labelValues.domain = domainConstraints.labelValues || [];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (standardGrid) {
|
|
163
|
+
gridValues.range = gridValues.domain;
|
|
164
|
+
labelValues.range = labelValues.domain;
|
|
165
|
+
range.step = domain.step;
|
|
166
|
+
range.labelStep = domain.labelStep;
|
|
167
|
+
} else {
|
|
168
|
+
if (includeAxes) {
|
|
169
|
+
var rangeConstraints = (0, _utils.applyConstraints)(range, graph.height, oldGridValues.range, oldLabelValues.range);
|
|
170
|
+
gridValues.range = rangeConstraints.gridValues || [];
|
|
171
|
+
labelValues.range = rangeConstraints.labelValues || [];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
173
174
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
var plotableAnswers = (0, _utils.filterPlotableMarks)(domain, range, answers);
|
|
176
|
+
|
|
177
|
+
if (!(0, _lodash.isEqual)(answers, plotableAnswers)) {
|
|
178
|
+
_this.setState({
|
|
179
|
+
dialog: {
|
|
180
|
+
isOpened: true,
|
|
181
|
+
onClose: function onClose() {
|
|
182
|
+
return _this.setState({
|
|
183
|
+
dialog: {
|
|
184
|
+
isOpened: false
|
|
185
|
+
}
|
|
186
|
+
}, onChange(_objectSpread(_objectSpread({}, model), {}, {
|
|
187
|
+
domain: oldDomain,
|
|
188
|
+
range: oldRange
|
|
189
|
+
})));
|
|
190
|
+
},
|
|
191
|
+
onConfirm: function onConfirm() {
|
|
192
|
+
_this.setState({
|
|
193
|
+
gridValues: gridValues,
|
|
194
|
+
labelValues: labelValues,
|
|
195
|
+
dialog: {
|
|
196
|
+
isOpened: false
|
|
197
|
+
},
|
|
198
|
+
domain: _objectSpread({}, domain),
|
|
199
|
+
range: _objectSpread({}, range)
|
|
200
|
+
}, onChange(_objectSpread(_objectSpread({}, updatedModel), {}, {
|
|
201
|
+
answers: plotableAnswers
|
|
202
|
+
})));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
});
|
|
178
206
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
label: label.toUpperCase(),
|
|
188
|
-
onChange: function onChange(event, value) {
|
|
189
|
-
return _this2.onChangeInputValue(key, value);
|
|
190
|
-
},
|
|
191
|
-
value: (0, _lodash.get)(model, key),
|
|
192
|
-
className: className || classes.input
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
_this.setState({
|
|
211
|
+
gridValues: gridValues,
|
|
212
|
+
labelValues: labelValues,
|
|
213
|
+
domain: _objectSpread({}, domain),
|
|
214
|
+
range: _objectSpread({}, range)
|
|
193
215
|
});
|
|
216
|
+
|
|
217
|
+
onChange(updatedModel);
|
|
194
218
|
});
|
|
195
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
|
196
|
-
var
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
219
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChangeView", function (event, expanded) {
|
|
220
|
+
var _this$props$graphDime = _this.props.graphDimensions;
|
|
221
|
+
_this$props$graphDime = _this$props$graphDime === void 0 ? {} : _this$props$graphDime;
|
|
222
|
+
var enabled = _this$props$graphDime.enabled;
|
|
223
|
+
|
|
224
|
+
if (enabled) {
|
|
225
|
+
_this.setState({
|
|
226
|
+
showPixelGuides: expanded
|
|
227
|
+
});
|
|
228
|
+
}
|
|
201
229
|
});
|
|
202
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(
|
|
203
|
-
var
|
|
204
|
-
|
|
230
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeGridConfiguration", function (event) {
|
|
231
|
+
var _this$props4 = _this.props,
|
|
232
|
+
gridConfigurations = _this$props4.gridConfigurations,
|
|
233
|
+
model = _this$props4.model,
|
|
234
|
+
onChange = _this$props4.onChange;
|
|
235
|
+
var value = event.target.value;
|
|
236
|
+
|
|
237
|
+
var _ref = gridConfigurations[value] || {},
|
|
238
|
+
label = _ref.label,
|
|
239
|
+
updatedModel = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
240
|
+
|
|
241
|
+
_this.setState({
|
|
242
|
+
selectedGrid: value
|
|
205
243
|
});
|
|
206
244
|
|
|
207
|
-
|
|
245
|
+
onChange(_objectSpread(_objectSpread({}, model), updatedModel));
|
|
208
246
|
});
|
|
209
|
-
|
|
247
|
+
|
|
248
|
+
var _ref2 = props.model || {},
|
|
249
|
+
_domain = _ref2.domain,
|
|
250
|
+
_range = _ref2.range,
|
|
251
|
+
_graph = _ref2.graph;
|
|
252
|
+
|
|
253
|
+
var _gridValues = {
|
|
254
|
+
domain: (0, _utils.getGridValues)(_domain, _graph.width, true),
|
|
255
|
+
range: (0, _utils.getGridValues)(_range, _graph.height, true)
|
|
256
|
+
};
|
|
257
|
+
var _labelValues = {
|
|
258
|
+
domain: (0, _utils.getLabelValues)(_domain.step),
|
|
259
|
+
range: (0, _utils.getLabelValues)(_range.step)
|
|
260
|
+
};
|
|
261
|
+
_this.state = {
|
|
262
|
+
gridValues: _gridValues,
|
|
263
|
+
labelValues: _labelValues,
|
|
264
|
+
selectedGrid: 0,
|
|
265
|
+
showPixelGuides: false,
|
|
266
|
+
dialog: {
|
|
267
|
+
isOpened: false
|
|
268
|
+
},
|
|
269
|
+
domain: _objectSpread({}, _domain),
|
|
270
|
+
range: _objectSpread({}, _range)
|
|
271
|
+
};
|
|
272
|
+
return _this;
|
|
210
273
|
}
|
|
211
274
|
|
|
212
275
|
(0, _createClass2["default"])(GraphingConfig, [{
|
|
213
276
|
key: "render",
|
|
214
277
|
value: function render() {
|
|
215
|
-
var _this$
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
278
|
+
var _this$props5 = this.props,
|
|
279
|
+
_this$props5$authorin = _this$props5.authoring,
|
|
280
|
+
authoring = _this$props5$authorin === void 0 ? {} : _this$props5$authorin,
|
|
281
|
+
_this$props5$availabl = _this$props5.availableTools,
|
|
282
|
+
availableTools = _this$props5$availabl === void 0 ? [] : _this$props5$availabl,
|
|
283
|
+
classes = _this$props5.classes,
|
|
284
|
+
_this$props5$gridConf = _this$props5.gridConfigurations,
|
|
285
|
+
gridConfigurations = _this$props5$gridConf === void 0 ? [] : _this$props5$gridConf,
|
|
286
|
+
_this$props5$graphDim = _this$props5.graphDimensions,
|
|
287
|
+
graphDimensions = _this$props5$graphDim === void 0 ? {} : _this$props5$graphDim,
|
|
288
|
+
labelsPlaceholders = _this$props5.labelsPlaceholders,
|
|
289
|
+
model = _this$props5.model,
|
|
290
|
+
showLabels = _this$props5.showLabels,
|
|
291
|
+
showTitle = _this$props5.showTitle,
|
|
292
|
+
titlePlaceholder = _this$props5.titlePlaceholder;
|
|
219
293
|
|
|
220
294
|
var _ref3 = model || {},
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
title =
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
295
|
+
arrows = _ref3.arrows,
|
|
296
|
+
backgroundMarks = _ref3.backgroundMarks,
|
|
297
|
+
coordinatesOnHover = _ref3.coordinatesOnHover,
|
|
298
|
+
domain = _ref3.domain,
|
|
299
|
+
includeAxes = _ref3.includeAxes,
|
|
300
|
+
labels = _ref3.labels,
|
|
301
|
+
range = _ref3.range,
|
|
302
|
+
standardGrid = _ref3.standardGrid,
|
|
303
|
+
title = _ref3.title;
|
|
304
|
+
|
|
305
|
+
var graph = (model || {}).graph || {};
|
|
306
|
+
|
|
307
|
+
var _ref4 = graphDimensions || {},
|
|
308
|
+
dimensionsEnabled = _ref4.enabled,
|
|
309
|
+
min = _ref4.min,
|
|
310
|
+
max = _ref4.max,
|
|
311
|
+
step = _ref4.step;
|
|
312
|
+
|
|
313
|
+
var _this$state2 = this.state,
|
|
314
|
+
_this$state2$dialog = _this$state2.dialog,
|
|
315
|
+
dialog = _this$state2$dialog === void 0 ? {} : _this$state2$dialog,
|
|
316
|
+
gridValues = _this$state2.gridValues,
|
|
317
|
+
labelValues = _this$state2.labelValues,
|
|
318
|
+
selectedGrid = _this$state2.selectedGrid,
|
|
319
|
+
showPixelGuides = _this$state2.showPixelGuides;
|
|
320
|
+
var sizeConstraints = {
|
|
321
|
+
min: Math.max(150, min),
|
|
322
|
+
max: Math.min(800, max),
|
|
323
|
+
step: step >= 1 ? Math.min(200, step) : 20
|
|
324
|
+
};
|
|
325
|
+
var displayedFields = {
|
|
326
|
+
axisLabel: authoring.axisLabel,
|
|
327
|
+
dimensionsEnabled: dimensionsEnabled,
|
|
328
|
+
includeAxesEnabled: authoring.includeAxesEnabled,
|
|
329
|
+
labelStep: authoring.labelStep,
|
|
330
|
+
min: authoring.min,
|
|
331
|
+
max: authoring.max,
|
|
332
|
+
standardGridEnabled: authoring.standardGridEnabled,
|
|
333
|
+
step: authoring.step
|
|
334
|
+
};
|
|
335
|
+
var displayGridSetup = authoring.enabled && Object.values(displayedFields).some(function (field) {
|
|
336
|
+
return (0, _typeof2["default"])(field) === 'object' ? field.enabled : field;
|
|
337
|
+
});
|
|
338
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
234
339
|
className: classes.container
|
|
235
|
-
},
|
|
236
|
-
className:
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}), /*#__PURE__*/React.createElement(
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
340
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
341
|
+
className: classes.gridConfigWrapper
|
|
342
|
+
}, gridConfigurations && gridConfigurations.length ? /*#__PURE__*/React.createElement("div", {
|
|
343
|
+
className: classes.gridConfig
|
|
344
|
+
}, /*#__PURE__*/React.createElement(_core.Typography, {
|
|
345
|
+
component: "div",
|
|
346
|
+
variant: "subheading",
|
|
347
|
+
className: classes.gridConfigLabel
|
|
348
|
+
}, /*#__PURE__*/React.createElement("span", null, "Grid Configuration")), /*#__PURE__*/React.createElement(_core.Select, {
|
|
349
|
+
input: /*#__PURE__*/React.createElement(_core.OutlinedInput, null),
|
|
350
|
+
className: classes.gridConfigSelect,
|
|
351
|
+
displayEmpty: true,
|
|
352
|
+
onChange: this.changeGridConfiguration,
|
|
353
|
+
value: selectedGrid
|
|
354
|
+
}, (gridConfigurations || []).map(function (config, index) {
|
|
355
|
+
return /*#__PURE__*/React.createElement(_core.MenuItem, {
|
|
356
|
+
key: index,
|
|
357
|
+
value: index
|
|
358
|
+
}, config.label);
|
|
359
|
+
}))) : null, displayGridSetup && /*#__PURE__*/React.createElement(_graphing.GridSetup, {
|
|
360
|
+
displayedFields: displayedFields,
|
|
361
|
+
domain: domain,
|
|
362
|
+
dimensionsEnabled: dimensionsEnabled,
|
|
363
|
+
gridValues: gridValues,
|
|
364
|
+
includeAxes: includeAxes,
|
|
365
|
+
labelValues: labelValues,
|
|
366
|
+
range: range,
|
|
367
|
+
size: graph,
|
|
368
|
+
sizeConstraints: sizeConstraints,
|
|
369
|
+
standardGrid: standardGrid,
|
|
370
|
+
onChange: this.onConfigChange,
|
|
371
|
+
onChangeView: this.onChangeView
|
|
248
372
|
})), /*#__PURE__*/React.createElement("div", {
|
|
249
|
-
className: classes.
|
|
373
|
+
className: classes.graphConfig,
|
|
250
374
|
key: "graph"
|
|
251
|
-
}, /*#__PURE__*/React.createElement(
|
|
375
|
+
}, /*#__PURE__*/React.createElement(_core.Typography, {
|
|
376
|
+
component: "div",
|
|
377
|
+
variant: "subheading"
|
|
378
|
+
}, /*#__PURE__*/React.createElement("span", null, "Define Graph Attributes")), /*#__PURE__*/React.createElement(_core.Typography, {
|
|
252
379
|
component: "div",
|
|
253
|
-
|
|
254
|
-
|
|
380
|
+
variant: "body1",
|
|
381
|
+
className: classes.subtitleText
|
|
382
|
+
}, /*#__PURE__*/React.createElement("span", null, "Use this interface to add/edit a title and/or labels, and to set background shapes")), /*#__PURE__*/React.createElement(_graphing.GraphContainer, {
|
|
255
383
|
axesSettings: {
|
|
256
384
|
includeArrows: arrows
|
|
257
385
|
},
|
|
258
386
|
backgroundMarks: [],
|
|
387
|
+
coordinatesOnHover: coordinatesOnHover,
|
|
388
|
+
collapsibleToolbar: true,
|
|
389
|
+
collapsibleToolbarTitle: 'Add Background Shapes to Graph',
|
|
259
390
|
domain: domain,
|
|
260
391
|
key: "graphing-config",
|
|
261
392
|
labels: labels,
|
|
393
|
+
labelsPlaceholders: labelsPlaceholders,
|
|
262
394
|
marks: backgroundMarks,
|
|
395
|
+
onChangeLabels: this.changeLabels,
|
|
263
396
|
onChangeMarks: this.changeBackgroundMarks,
|
|
397
|
+
onChangeTitle: this.changeTitle,
|
|
264
398
|
range: range,
|
|
399
|
+
showLabels: showLabels,
|
|
400
|
+
showPixelGuides: showPixelGuides,
|
|
401
|
+
showTitle: showTitle,
|
|
265
402
|
size: {
|
|
266
403
|
width: graph.width,
|
|
267
404
|
height: graph.height
|
|
268
405
|
},
|
|
269
406
|
title: title,
|
|
270
|
-
|
|
271
|
-
|
|
407
|
+
titlePlaceholder: titlePlaceholder,
|
|
408
|
+
toolbarTools: availableTools
|
|
409
|
+
})), /*#__PURE__*/React.createElement(_configUi.AlertDialog, {
|
|
410
|
+
open: dialog.isOpened,
|
|
411
|
+
title: "Warning",
|
|
412
|
+
text: "This change would make it impossible for students to plot one or more graph objects in the current correct answers. If you proceed, all such graph objects will be removed from the correct answers.",
|
|
413
|
+
onClose: dialog.onClose,
|
|
414
|
+
onConfirm: dialog.onConfirm
|
|
415
|
+
}));
|
|
272
416
|
}
|
|
273
417
|
}]);
|
|
274
418
|
return GraphingConfig;
|
|
@@ -277,9 +421,11 @@ var GraphingConfig = /*#__PURE__*/function (_React$Component) {
|
|
|
277
421
|
exports.GraphingConfig = GraphingConfig;
|
|
278
422
|
(0, _defineProperty2["default"])(GraphingConfig, "propTypes", {
|
|
279
423
|
classes: _propTypes["default"].object.isRequired,
|
|
424
|
+
authoring: _propTypes["default"].object,
|
|
425
|
+
graphDimensions: _propTypes["default"].object,
|
|
426
|
+
gridConfigurations: _propTypes["default"].array,
|
|
280
427
|
model: _propTypes["default"].object.isRequired,
|
|
281
|
-
onChange: _propTypes["default"].func.isRequired
|
|
282
|
-
authoringEnabled: _propTypes["default"].bool
|
|
428
|
+
onChange: _propTypes["default"].func.isRequired
|
|
283
429
|
});
|
|
284
430
|
|
|
285
431
|
var _default = (0, _styles.withStyles)(styles)(GraphingConfig);
|