@pie-lib/charting 4.5.18 → 5.1.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/lib/axes.js +100 -97
  3. package/lib/axes.js.map +1 -1
  4. package/lib/bars/bar.js +19 -30
  5. package/lib/bars/bar.js.map +1 -1
  6. package/lib/bars/common/bars.js +33 -47
  7. package/lib/bars/common/bars.js.map +1 -1
  8. package/lib/bars/histogram.js +19 -30
  9. package/lib/bars/histogram.js.map +1 -1
  10. package/lib/chart-setup.js +206 -0
  11. package/lib/chart-setup.js.map +1 -0
  12. package/lib/chart-type.js +68 -0
  13. package/lib/chart-type.js.map +1 -0
  14. package/lib/chart-types.js +2 -2
  15. package/lib/chart-types.js.map +1 -1
  16. package/lib/chart.js +44 -71
  17. package/lib/chart.js.map +1 -1
  18. package/lib/common/drag-handle.js +26 -41
  19. package/lib/common/drag-handle.js.map +1 -1
  20. package/lib/common/styles.js +7 -5
  21. package/lib/common/styles.js.map +1 -1
  22. package/lib/grid.js +19 -31
  23. package/lib/grid.js.map +1 -1
  24. package/lib/index.js +17 -1
  25. package/lib/index.js.map +1 -1
  26. package/lib/line/common/drag-handle.js +25 -39
  27. package/lib/line/common/drag-handle.js.map +1 -1
  28. package/lib/line/common/line.js +45 -73
  29. package/lib/line/common/line.js.map +1 -1
  30. package/lib/line/line-cross.js +25 -39
  31. package/lib/line/line-cross.js.map +1 -1
  32. package/lib/line/line-dot.js +24 -38
  33. package/lib/line/line-dot.js.map +1 -1
  34. package/lib/mark-label.js +10 -20
  35. package/lib/mark-label.js.map +1 -1
  36. package/lib/plot/common/plot.js +33 -47
  37. package/lib/plot/common/plot.js.map +1 -1
  38. package/lib/plot/dot.js +20 -31
  39. package/lib/plot/dot.js.map +1 -1
  40. package/lib/plot/line.js +21 -32
  41. package/lib/plot/line.js.map +1 -1
  42. package/lib/tool-menu.js +19 -32
  43. package/lib/tool-menu.js.map +1 -1
  44. package/lib/utils.js +5 -3
  45. package/lib/utils.js.map +1 -1
  46. package/package.json +2 -2
  47. package/src/axes.jsx +47 -11
  48. package/src/bars/common/bars.jsx +5 -2
  49. package/src/chart-setup.jsx +160 -0
  50. package/src/chart-type.js +39 -0
  51. package/src/chart.jsx +8 -6
  52. package/src/index.js +4 -1
  53. package/src/line/common/drag-handle.jsx +2 -1
  54. package/src/line/common/line.jsx +5 -3
  55. package/src/plot/common/plot.jsx +4 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,49 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.1.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.1.0...@pie-lib/charting@5.1.1) (2022-07-12)
7
+
8
+ **Note:** Version bump only for package @pie-lib/charting
9
+
10
+
11
+
12
+
13
+
14
+ # [5.1.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.0.0...@pie-lib/charting@5.1.0) (2022-06-27)
15
+
16
+
17
+ ### Features
18
+
19
+ * **charting:** add constraints on max value for charting setup panel ([595c301](https://github.com/pie-framework/pie-lib/commit/595c301c6b10caf1921aa25f38897729c56ed47c))
20
+
21
+
22
+
23
+
24
+
25
+ # [5.0.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.18...@pie-lib/charting@5.0.0) (2022-06-13)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * updated shapshot ([4f4975d](https://github.com/pie-framework/pie-lib/commit/4f4975d9abd2c52365f7081e280d860149e7edd0))
31
+
32
+
33
+ ### Features
34
+
35
+ * **charting:** remove editCategoryEnabled property checkbox and usage ([3181fc0](https://github.com/pie-framework/pie-lib/commit/3181fc02ea83e408af5d930d5e10a85a2ded3dd4))
36
+ * **charting:** remove editCategoryEnabled property checkbox and usage ([b72de39](https://github.com/pie-framework/pie-lib/commit/b72de39525c0f9c0439204e65b2a7d330bb9061d))
37
+
38
+
39
+ ### BREAKING CHANGES
40
+
41
+ * **charting:** The editCategoryEnabled checkbox and property was removed.
42
+ Enabeled property will be used for each category.
43
+ * **charting:** The editCategoryEnabled propery has been removed
44
+
45
+
46
+
47
+
48
+
6
49
  ## [4.5.18](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.17...@pie-lib/charting@4.5.18) (2022-06-13)
7
50
 
8
51
 
package/lib/axes.js CHANGED
@@ -1,12 +1,28 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports["default"] = exports.TickComponent = exports.RawChartAxes = void 0;
9
9
 
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
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
+
10
26
  var _react = _interopRequireDefault(require("react"));
11
27
 
12
28
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -25,63 +41,30 @@ var _markLabel = _interopRequireDefault(require("./mark-label"));
25
41
 
26
42
  var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
27
43
 
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
-
30
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
31
-
32
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
33
-
34
- 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); }
35
-
36
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
37
-
38
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
39
-
40
- 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; }
41
-
42
44
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
43
45
 
44
- 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) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
45
-
46
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
47
-
48
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
49
-
50
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
46
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
51
47
 
52
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
53
-
54
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
55
-
56
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
57
-
58
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
59
-
60
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
48
+ 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
49
 
62
50
  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
51
 
64
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
65
-
66
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
67
-
68
52
  var TickComponent = /*#__PURE__*/function (_React$Component) {
69
- _inherits(TickComponent, _React$Component);
53
+ (0, _inherits2["default"])(TickComponent, _React$Component);
70
54
 
71
55
  var _super = _createSuper(TickComponent);
72
56
 
73
57
  function TickComponent() {
74
58
  var _this;
75
59
 
76
- _classCallCheck(this, TickComponent);
60
+ (0, _classCallCheck2["default"])(this, TickComponent);
77
61
 
78
62
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
79
63
  args[_key] = arguments[_key];
80
64
  }
81
65
 
82
66
  _this = _super.call.apply(_super, [this].concat(args));
83
-
84
- _defineProperty(_assertThisInitialized(_this), "changeCategory", function (index, newLabel) {
67
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeCategory", function (index, newLabel) {
85
68
  var _this$props = _this.props,
86
69
  categories = _this$props.categories,
87
70
  onChangeCategory = _this$props.onChangeCategory;
@@ -90,18 +73,16 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
90
73
  label: newLabel
91
74
  }));
92
75
  });
93
-
94
- _defineProperty(_assertThisInitialized(_this), "deleteCategory", function (index) {
76
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "deleteCategory", function (index) {
95
77
  var _this$props2 = _this.props,
96
78
  categories = _this$props2.categories,
97
79
  onChange = _this$props2.onChange;
98
80
 
99
81
  if (index >= 0 && categories[index]) {
100
- onChange([].concat(_toConsumableArray(categories.slice(0, index)), _toConsumableArray(categories.slice(index + 1))));
82
+ onChange([].concat((0, _toConsumableArray2["default"])(categories.slice(0, index)), (0, _toConsumableArray2["default"])(categories.slice(index + 1))));
101
83
  }
102
84
  });
103
-
104
- _defineProperty(_assertThisInitialized(_this), "changeInteractive", function (index, value) {
85
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeInteractive", function (index, value) {
105
86
  var _this$props3 = _this.props,
106
87
  categories = _this$props3.categories,
107
88
  onChangeCategory = _this$props3.onChangeCategory;
@@ -110,28 +91,36 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
110
91
  interactive: !category.interactive
111
92
  }));
112
93
  });
113
-
94
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeEditable", function (index, value) {
95
+ var _this$props4 = _this.props,
96
+ categories = _this$props4.categories,
97
+ onChangeCategory = _this$props4.onChangeCategory;
98
+ var category = categories[index];
99
+ onChangeCategory(index, _objectSpread(_objectSpread({}, category), {}, {
100
+ editable: !category.editable || false
101
+ }));
102
+ });
114
103
  return _this;
115
104
  }
116
105
 
117
- _createClass(TickComponent, [{
106
+ (0, _createClass2["default"])(TickComponent, [{
118
107
  key: "render",
119
108
  value: function render() {
120
109
  var _this2 = this;
121
110
 
122
- var _this$props4 = this.props,
123
- classes = _this$props4.classes,
124
- categories = _this$props4.categories,
125
- xBand = _this$props4.xBand,
126
- bandWidth = _this$props4.bandWidth,
127
- barWidth = _this$props4.barWidth,
128
- rotate = _this$props4.rotate,
129
- top = _this$props4.top,
130
- graphProps = _this$props4.graphProps,
131
- defineChart = _this$props4.defineChart,
132
- x = _this$props4.x,
133
- y = _this$props4.y,
134
- formattedValue = _this$props4.formattedValue;
111
+ var _this$props5 = this.props,
112
+ classes = _this$props5.classes,
113
+ categories = _this$props5.categories,
114
+ xBand = _this$props5.xBand,
115
+ bandWidth = _this$props5.bandWidth,
116
+ barWidth = _this$props5.barWidth,
117
+ rotate = _this$props5.rotate,
118
+ top = _this$props5.top,
119
+ graphProps = _this$props5.graphProps,
120
+ defineChart = _this$props5.defineChart,
121
+ x = _this$props5.x,
122
+ y = _this$props5.y,
123
+ formattedValue = _this$props5.formattedValue;
135
124
 
136
125
  if (!formattedValue) {
137
126
  return null;
@@ -179,20 +168,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
179
168
  inputRef: function inputRef(r) {
180
169
  return _this2.input = r;
181
170
  },
182
- disabled: !(editable && interactive),
183
- mark: category,
184
- graphProps: graphProps,
185
- onChange: function onChange(newLabel) {
186
- return _this2.changeCategory(index, newLabel);
187
- },
188
- barWidth: barWidth,
189
- rotate: rotate,
190
- correctness: correctness
191
- }), /*#__PURE__*/_react["default"].createElement(_markLabel["default"], {
192
- inputRef: function inputRef(r) {
193
- return _this2.input = r;
194
- },
195
- disabled: !(editable && interactive),
171
+ disabled: !defineChart && !editable,
196
172
  mark: category,
197
173
  graphProps: graphProps,
198
174
  onChange: function onChange(newLabel) {
@@ -239,7 +215,26 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
239
215
  }, ' ', "Student can", ' '), /*#__PURE__*/_react["default"].createElement("tspan", {
240
216
  x: "0",
241
217
  dy: "1.2em"
242
- }, ' ', "set value")), defineChart && /*#__PURE__*/_react["default"].createElement("foreignObject", {
218
+ }, ' ', "set value")), defineChart && index === 0 && /*#__PURE__*/_react["default"].createElement("text", {
219
+ x: x - 80,
220
+ y: y + 80 + top,
221
+ width: barWidth,
222
+ height: 4,
223
+ style: {
224
+ position: 'absolute',
225
+ pointerEvents: 'none',
226
+ wordBreak: 'break-word',
227
+ overflow: 'visible',
228
+ maxWidth: barWidth,
229
+ display: 'inline-block'
230
+ }
231
+ }, /*#__PURE__*/_react["default"].createElement("tspan", {
232
+ x: "0",
233
+ dy: ".6em"
234
+ }, ' ', "Student can", ' '), /*#__PURE__*/_react["default"].createElement("tspan", {
235
+ x: "0",
236
+ dy: "1.2em"
237
+ }, ' ', "edit name")), defineChart && /*#__PURE__*/_react["default"].createElement("foreignObject", {
243
238
  x: x - 24,
244
239
  y: y + 20 + top,
245
240
  width: barWidth,
@@ -253,10 +248,23 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
253
248
  onChange: function onChange(e) {
254
249
  return _this2.changeInteractive(index, e.target.checked);
255
250
  }
251
+ })), defineChart && /*#__PURE__*/_react["default"].createElement("foreignObject", {
252
+ x: x - 24,
253
+ y: y + 70 + top,
254
+ width: barWidth,
255
+ height: 4,
256
+ style: {
257
+ pointerEvents: 'visible',
258
+ overflow: 'visible'
259
+ }
260
+ }, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
261
+ checked: editable,
262
+ onChange: function onChange(e) {
263
+ return _this2.changeEditable(index, e.target.checked);
264
+ }
256
265
  })));
257
266
  }
258
267
  }]);
259
-
260
268
  return TickComponent;
261
269
  }(_react["default"].Component);
262
270
 
@@ -278,29 +286,27 @@ TickComponent.propTypes = {
278
286
  };
279
287
 
280
288
  var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
281
- _inherits(RawChartAxes, _React$Component2);
289
+ (0, _inherits2["default"])(RawChartAxes, _React$Component2);
282
290
 
283
291
  var _super2 = _createSuper(RawChartAxes);
284
292
 
285
293
  function RawChartAxes() {
286
294
  var _this3;
287
295
 
288
- _classCallCheck(this, RawChartAxes);
296
+ (0, _classCallCheck2["default"])(this, RawChartAxes);
289
297
 
290
298
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
291
299
  args[_key2] = arguments[_key2];
292
300
  }
293
301
 
294
302
  _this3 = _super2.call.apply(_super2, [this].concat(args));
295
-
296
- _defineProperty(_assertThisInitialized(_this3), "state", {
303
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this3), "state", {
297
304
  height: 0
298
305
  });
299
-
300
306
  return _this3;
301
307
  }
302
308
 
303
- _createClass(RawChartAxes, [{
309
+ (0, _createClass2["default"])(RawChartAxes, [{
304
310
  key: "componentDidMount",
305
311
  value: function componentDidMount() {
306
312
  var height = document.getElementById('hiddenLabel') ? document.getElementById('hiddenLabel').offsetHeight : 0;
@@ -311,18 +317,18 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
311
317
  }, {
312
318
  key: "render",
313
319
  value: function render() {
314
- var _this$props5 = this.props,
315
- classes = _this$props5.classes,
316
- graphProps = _this$props5.graphProps,
317
- xBand = _this$props5.xBand,
318
- leftAxis = _this$props5.leftAxis,
319
- onChange = _this$props5.onChange,
320
- onChangeCategory = _this$props5.onChangeCategory,
321
- _this$props5$categori = _this$props5.categories,
322
- categories = _this$props5$categori === void 0 ? [] : _this$props5$categori,
323
- top = _this$props5.top,
324
- defineChart = _this$props5.defineChart,
325
- theme = _this$props5.theme;
320
+ var _this$props6 = this.props,
321
+ classes = _this$props6.classes,
322
+ graphProps = _this$props6.graphProps,
323
+ xBand = _this$props6.xBand,
324
+ leftAxis = _this$props6.leftAxis,
325
+ onChange = _this$props6.onChange,
326
+ onChangeCategory = _this$props6.onChangeCategory,
327
+ _this$props6$categori = _this$props6.categories,
328
+ categories = _this$props6$categori === void 0 ? [] : _this$props6$categori,
329
+ top = _this$props6.top,
330
+ defineChart = _this$props6.defineChart,
331
+ theme = _this$props6.theme;
326
332
  var axis = classes.axis,
327
333
  axisLine = classes.axisLine,
328
334
  tick = classes.tick,
@@ -411,13 +417,11 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
411
417
  }));
412
418
  }
413
419
  }]);
414
-
415
420
  return RawChartAxes;
416
421
  }(_react["default"].Component);
417
422
 
418
423
  exports.RawChartAxes = RawChartAxes;
419
-
420
- _defineProperty(RawChartAxes, "propTypes", {
424
+ (0, _defineProperty2["default"])(RawChartAxes, "propTypes", {
421
425
  bottomScale: _propTypes["default"].func,
422
426
  classes: _propTypes["default"].object.isRequired,
423
427
  categories: _propTypes["default"].array,
@@ -429,7 +433,6 @@ _defineProperty(RawChartAxes, "propTypes", {
429
433
  top: _propTypes["default"].number,
430
434
  theme: _propTypes["default"].object
431
435
  });
432
-
433
436
  var ChartAxes = (0, _styles.withStyles)(function (theme) {
434
437
  return {
435
438
  axisLabel: {
package/lib/axes.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/axes.jsx"],"names":["TickComponent","index","newLabel","props","categories","onChangeCategory","category","label","onChange","slice","value","interactive","classes","xBand","bandWidth","barWidth","rotate","top","graphProps","defineChart","x","y","formattedValue","parseInt","split","deletable","editable","correctness","barX","longestCategory","reduce","a","b","lengthA","length","lengthB","longestLabel","pointerEvents","overflow","position","visibility","wordBreak","maxWidth","display","r","input","changeCategory","dottedLine","deleteCategory","e","changeInteractive","target","checked","React","Component","propTypes","PropTypes","array","func","number","object","string","RawChartAxes","height","document","getElementById","offsetHeight","setState","leftAxis","theme","axis","axisLine","tick","axisLabel","scale","range","domain","size","state","bottomScale","rangeRound","width","bandwidth","max","rowTickValues","step","labelStep","fontSize","typography","getTickLabelProps","dy","dx","toLocaleString","getTickComponent","properties","min","textAnchor","count","isRequired","types","GraphPropsType","bool","ChartAxes","fontFamily","body1","fill","color","secondary","stroke","primaryDark","strokeWidth","primaryLight","opacity","withTheme"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEaA,a;;;;;;;;;;;;;;;;qEACM,UAACC,KAAD,EAAQC,QAAR,EAAqB;AACpC,wBAAyC,MAAKC,KAA9C;AAAA,UAAQC,UAAR,eAAQA,UAAR;AAAA,UAAoBC,gBAApB,eAAoBA,gBAApB;AACA,UAAMC,QAAQ,GAAGF,UAAU,CAACH,KAAD,CAA3B;AAEAI,MAAAA,gBAAgB,CAACJ,KAAD,kCAAaK,QAAb;AAAuBC,QAAAA,KAAK,EAAEL;AAA9B,SAAhB;AACD,K;;qEAEgB,UAAAD,KAAK,EAAI;AACxB,yBAAiC,MAAKE,KAAtC;AAAA,UAAQC,UAAR,gBAAQA,UAAR;AAAA,UAAoBI,QAApB,gBAAoBA,QAApB;;AAEA,UAAIP,KAAK,IAAI,CAAT,IAAcG,UAAU,CAACH,KAAD,CAA5B,EAAqC;AACnCO,QAAAA,QAAQ,8BAAKJ,UAAU,CAACK,KAAX,CAAiB,CAAjB,EAAoBR,KAApB,CAAL,sBAAoCG,UAAU,CAACK,KAAX,CAAiBR,KAAK,GAAG,CAAzB,CAApC,GAAR;AACD;AACF,K;;wEAEmB,UAACA,KAAD,EAAQS,KAAR,EAAkB;AACpC,yBAAyC,MAAKP,KAA9C;AAAA,UAAQC,UAAR,gBAAQA,UAAR;AAAA,UAAoBC,gBAApB,gBAAoBA,gBAApB;AACA,UAAMC,QAAQ,GAAGF,UAAU,CAACH,KAAD,CAA3B;AAEAI,MAAAA,gBAAgB,CAACJ,KAAD,kCAAaK,QAAb;AAAuBK,QAAAA,WAAW,EAAE,CAACL,QAAQ,CAACK;AAA9C,SAAhB;AACD,K;;;;;;;WAED,kBAAS;AAAA;;AACP,yBAaI,KAAKR,KAbT;A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,EAAAA,KAAK,EAAEb,sBAAUI;AAVA,C;;AA+GrB,IAAM0C,SAAS,GAAG,wBAChB,UAAAjC,KAAK;AAAA,SAAK;AACRI,IAAAA,SAAS,EAAE;AACT8B,MAAAA,UAAU,EAAElC,KAAK,CAACmB,UAAN,CAAiBgB,KAAjB,CAAuBD,UAD1B;AAEThB,MAAAA,QAAQ,EAAElB,KAAK,CAACmB,UAAN,CAAiBD,QAFlB;AAGTkB,MAAAA,IAAI,EAAEC,gBAAMC,SAAN;AAHG,KADH;AAMRrC,IAAAA,IAAI,EAAE;AACJsC,MAAAA,MAAM,EAAEF,gBAAMG,WAAN,EADJ;AAEJC,MAAAA,WAAW,EAAE;AAFT,KANE;AAURvC,IAAAA,QAAQ,EAAE;AACRqC,MAAAA,MAAM,EAAEF,gBAAMG,WAAN,EADA;AAERC,MAAAA,WAAW,EAAE;AAFL,KAVF;AAcRtC,IAAAA,IAAI,EAAE;AACJ,kBAAY;AACVoC,QAAAA,MAAM,EAAEF,gBAAMG,WAAN,EADE;AAEVC,QAAAA,WAAW,EAAE;AAFH,OADR;AAKJL,MAAAA,IAAI,EAAEC,gBAAMG,WAAN,EALF;AAMJN,MAAAA,UAAU,EAAElC,KAAK,CAACmB,UAAN,CAAiBgB,KAAjB,CAAuBD,UAN/B;AAOJhB,MAAAA,QAAQ,EAAElB,KAAK,CAACmB,UAAN,CAAiBD,QAPvB;AAQJS,MAAAA,UAAU,EAAE;AARR,KAdE;AAwBRjD,IAAAA,UAAU,EAAE;AACV6D,MAAAA,MAAM,EAAEF,gBAAMK,YAAN,EADE;AAEVC,MAAAA,OAAO,EAAE;AAFC;AAxBJ,GAAL;AAAA,CADW,EA8BhB;AAAEC,EAAAA,SAAS,EAAE;AAAb,CA9BgB,EA+BhBnD,YA/BgB,CAAlB;eAiCewC,S","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { types } from '@pie-lib/plot';\nimport { color } from '@pie-lib/render-ui';\nimport { AxisLeft, AxisBottom } from '@vx/axis';\nimport { bandKey, getTickValues, getRotateAngle } from './utils';\nimport MarkLabel from './mark-label';\nimport Checkbox from '@material-ui/core/Checkbox';\n\nexport class TickComponent extends React.Component {\n changeCategory = (index, newLabel) => {\n const { categories, onChangeCategory } = this.props;\n const category = categories[index];\n\n onChangeCategory(index, { ...category, label: newLabel });\n };\n\n deleteCategory = index => {\n const { categories, onChange } = this.props;\n\n if (index >= 0 && categories[index]) {\n onChange([...categories.slice(0, index), ...categories.slice(index + 1)]);\n }\n };\n\n changeInteractive = (index, value) => {\n const { categories, onChangeCategory } = this.props;\n const category = categories[index];\n\n onChangeCategory(index, { ...category, interactive: !category.interactive });\n };\n\n render() {\n const {\n classes,\n categories,\n xBand,\n bandWidth,\n barWidth,\n rotate,\n top,\n graphProps,\n defineChart,\n x,\n y,\n formattedValue\n } = this.props;\n\n if (!formattedValue) {\n return null;\n }\n\n const index = parseInt(formattedValue.split('-')[0], 10);\n const category = categories[index];\n const { deletable, editable, interactive, label, correctness } = category || {};\n const barX = xBand(bandKey({ label }, index));\n const longestCategory = (categories || []).reduce((a, b) => {\n const lengthA = a && a.label ? a.label.length : 0;\n const lengthB = b && b.label ? b.label.length : 0;\n\n return lengthA > lengthB ? a : b;\n });\n\n const longestLabel = (longestCategory && longestCategory.label) || '';\n\n return (\n <g>\n <foreignObject\n x={bandWidth ? barX : x - barWidth / 2}\n y={6}\n width={barWidth}\n height={4}\n style={{ pointerEvents: 'none', overflow: 'visible' }}\n >\n {index === 0 && (\n <div\n id=\"hiddenLabel\"\n style={{\n position: 'absolute',\n visibility: 'hidden',\n wordBreak: 'break-word',\n overflow: 'visible',\n maxWidth: barWidth,\n display: 'block'\n }}\n >\n {longestLabel}\n </div>\n )}\n <MarkLabel\n inputRef={r => (this.input = r)}\n disabled={!(editable && interactive)}\n mark={category}\n graphProps={graphProps}\n onChange={newLabel => this.changeCategory(index, newLabel)}\n barWidth={barWidth}\n rotate={rotate}\n correctness={correctness}\n />\n <MarkLabel\n inputRef={r => (this.input = r)}\n disabled={!(editable && interactive)}\n mark={category}\n graphProps={graphProps}\n onChange={newLabel => this.changeCategory(index, newLabel)}\n barWidth={barWidth}\n rotate={rotate}\n correctness={correctness}\n />\n </foreignObject>\n {deletable && !correctness && (\n <line\n x1={x}\n y1={0}\n x2={x}\n y2={y + 4 + top}\n className={classes.dottedLine}\n strokeDasharray=\"4 2\"\n />\n )}\n {deletable && !correctness && (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n x={x - 8}\n y={y + 10 + top}\n width={16}\n height={16}\n viewBox=\"0 0 512 512\"\n onClick={() => this.deleteCategory(index)}\n >\n <path d=\"M128 405.429C128 428.846 147.198 448 170.667 448h170.667C364.802 448 384 428.846 384 405.429V160H128v245.429zM416 96h-80l-26.785-32H202.786L176 96H96v32h320V96z\" />\n </svg>\n )}\n {defineChart && index === 0 && (\n <text\n x={x - 80}\n y={y + 40 + top}\n width={barWidth}\n height={4}\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n wordBreak: 'break-word',\n overflow: 'visible',\n maxWidth: barWidth,\n display: 'inline-block'\n }}\n >\n <tspan x=\"0\" dy=\".6em\">\n {' '}\n Student can{' '}\n </tspan>\n <tspan x=\"0\" dy=\"1.2em\">\n {' '}\n set value\n </tspan>\n </text>\n )}\n {defineChart && (\n <foreignObject\n x={x - 24}\n y={y + 20 + top}\n width={barWidth}\n height={4}\n style={{ pointerEvents: 'visible', overflow: 'visible' }}\n >\n <Checkbox\n checked={interactive}\n onChange={e => this.changeInteractive(index, e.target.checked)}\n />\n </foreignObject>\n )}\n </g>\n );\n }\n}\n\nTickComponent.propTypes = {\n categories: PropTypes.array,\n xBand: PropTypes.func,\n bandWidth: PropTypes.number,\n barWidth: PropTypes.number,\n rotate: PropTypes.number,\n top: PropTypes.number,\n x: PropTypes.number,\n y: PropTypes.number,\n graphProps: PropTypes.object,\n formattedValue: PropTypes.string,\n onChangeCategory: PropTypes.func,\n onChange: PropTypes.func,\n classes: PropTypes.object\n};\n\nexport class RawChartAxes extends React.Component {\n static propTypes = {\n bottomScale: PropTypes.func,\n classes: PropTypes.object.isRequired,\n categories: PropTypes.array,\n graphProps: types.GraphPropsType.isRequired,\n xBand: PropTypes.func,\n leftAxis: PropTypes.bool,\n onChange: PropTypes.func,\n onChangeCategory: PropTypes.func,\n top: PropTypes.number,\n theme: PropTypes.object\n };\n\n state = { height: 0 };\n\n componentDidMount() {\n const height = document.getElementById('hiddenLabel')\n ? document.getElementById('hiddenLabel').offsetHeight\n : 0;\n\n this.setState({ height });\n }\n\n render() {\n const {\n classes,\n graphProps,\n xBand,\n leftAxis,\n onChange,\n onChangeCategory,\n categories = [],\n top,\n defineChart,\n theme\n } = this.props;\n\n const { axis, axisLine, tick, axisLabel } = classes;\n const { scale = {}, range = {}, domain = {}, size = {} } = graphProps || {};\n const { height } = this.state;\n\n const bottomScale =\n xBand && typeof xBand.rangeRound === 'function' && xBand.rangeRound([0, size.width]);\n\n const bandWidth = xBand && typeof xBand.bandwidth === 'function' && xBand.bandwidth();\n // for chartType \"line\", bandWidth will be 0, so we have to calculate it\n const barWidth = bandWidth || (scale.x && scale.x(domain.max) / categories.length);\n\n const rowTickValues = getTickValues({ ...range, step: range.labelStep });\n const fontSize = theme && theme.typography ? theme.typography.fontSize : 14;\n const rotate = getRotateAngle(fontSize, height);\n\n const getTickLabelProps = value => ({\n dy: 4,\n dx: -10 - (value.toLocaleString().length || 1) * 5\n });\n\n const getTickComponent = props => {\n const properties = {\n classes,\n categories,\n xBand,\n bandWidth,\n barWidth,\n rotate,\n top,\n defineChart,\n onChangeCategory,\n onChange,\n graphProps,\n x: props.x,\n y: props.y,\n formattedValue: props.formattedValue\n };\n\n return <TickComponent {...properties} />;\n };\n\n return (\n <React.Fragment>\n {leftAxis && (\n <AxisLeft\n scale={scale.y}\n className={axis}\n axisLineClassName={axisLine}\n tickLength={10}\n tickClassName={tick}\n tickFormat={value => value}\n label={range.label}\n labelClassName={axisLabel}\n tickValues={rowTickValues}\n tickLabelProps={getTickLabelProps}\n />\n )}\n <AxisBottom\n axisLineClassName={axisLine}\n labelClassName={axisLabel}\n tickClassName={tick}\n scale={bottomScale}\n label={domain.label}\n labelProps={{ y: 60 + top }}\n top={scale.y && scale.y(range.min)}\n textLabelProps={() => ({ textAnchor: 'middle' })}\n tickFormat={count => count}\n tickComponent={getTickComponent}\n />\n </React.Fragment>\n );\n }\n}\n\nconst ChartAxes = withStyles(\n theme => ({\n axisLabel: {\n fontFamily: theme.typography.body1.fontFamily,\n fontSize: theme.typography.fontSize,\n fill: color.secondary()\n },\n axis: {\n stroke: color.primaryDark(),\n strokeWidth: 2\n },\n axisLine: {\n stroke: color.primaryDark(),\n strokeWidth: 2\n },\n tick: {\n '& > line': {\n stroke: color.primaryDark(),\n strokeWidth: 2\n },\n fill: color.primaryDark(),\n fontFamily: theme.typography.body1.fontFamily,\n fontSize: theme.typography.fontSize,\n textAnchor: 'middle'\n },\n dottedLine: {\n stroke: color.primaryLight(),\n opacity: 0.2\n }\n }),\n { withTheme: true }\n)(RawChartAxes);\n\nexport default ChartAxes;\n"],"file":"axes.js"}
1
+ {"version":3,"sources":["../src/axes.jsx"],"names":["TickComponent","index","newLabel","props","categories","onChangeCategory","category","label","onChange","slice","value","interactive","editable","classes","xBand","bandWidth","barWidth","rotate","top","graphProps","defineChart","x","y","formattedValue","parseInt","split","deletable","correctness","barX","longestCategory","reduce","a","b","lengthA","length","lengthB","longestLabel","pointerEvents","overflow","position","visibility","wordBreak","maxWidth","display","r","input","changeCategory","dottedLine","deleteCategory","e","changeInteractive","target","checked","changeEditable","React","Component","propTypes","PropTypes","array","func","number","object","string","RawChartAxes","height","document","getElementById","offsetHeight","setState","leftAxis","theme","axis","axisLine","tick","axisLabel","scale","range","domain","size","state","bottomScale","rangeRound","width","bandwidth","max","rowTickValues","step","labelStep","fontSize","typography","getTickLabelProps","dy","dx","toLocaleString","getTickComponent","properties","min","textAnchor","count","isRequired","types","GraphPropsType","bool","ChartAxes","fontFamily","body1","fill","color","secondary","stroke","primaryDark","strokeWidth","primaryLight","opacity","withTheme"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,a;;;;;;;;;;;;;;;uGACM,UAACC,KAAD,EAAQC,QAAR,EAAqB;AACpC,wBAAyC,MAAKC,KAA9C;AAAA,UAAQC,UAAR,eAAQA,UAAR;AAAA,UAAoBC,gBAApB,eAAoBA,gBAApB;AACA,UAAMC,QAAQ,GAAGF,UAAU,CAACH,KAAD,CAA3B;AAEAI,MAAAA,gBAAgB,CAACJ,KAAD,kCAAaK,QAAb;AAAuBC,QAAAA,KAAK,EAAEL;AAA9B,SAAhB;AACD,K;uGAEgB,UAAAD,KAAK,EAAI;AACxB,yBAAiC,MAAKE,KAAtC;AAAA,UAAQC,UAAR,gBAAQA,UAAR;AAAA,UAAoBI,QAApB,gBAAoBA,QAApB;;AAEA,UAAIP,KAAK,IAAI,CAAT,IAAcG,UAAU,CAACH,KAAD,CAA5B,EAAqC;AACnCO,QAAAA,QAAQ,+CAAKJ,UAAU,CAACK,KAAX,CAAiB,CAAjB,EAAoBR,KAApB,CAAL,uCAAoCG,UAAU,CAACK,KAAX,CAAiBR,KAAK,GAAG,CAAzB,CAApC,GAAR;AACD;AACF,K;0GAEmB,UAACA,KAAD,EAAQS,KAAR,EAAkB;AACpC,yBAAyC,MAAKP,KAA9C;AAAA,UAAQC,UAAR,gBAAQA,UAAR;AAAA,UAAoBC,gBAApB,gBAAoBA,gBAApB;AACA,UAAMC,QAAQ,GAAGF,UAAU,CAACH,KAAD,CAA3B;AAEAI,MAAAA,gBAAgB,CAACJ,KAAD,kCAAaK,QAAb;AAAuBK,QAAAA,WAAW,EAAE,CAACL,QAAQ,CAACK;AAA9C,SAAhB;AACD,K;uGAEgB,UAACV,KAAD,EAAQS,KAAR,EAAkB;AACjC,yBAAyC,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iBD,QAFlB;AAGTkB,MAAAA,IAAI,EAAEC,gBAAMC,SAAN;AAHG,KADH;AAMRrC,IAAAA,IAAI,EAAE;AACJsC,MAAAA,MAAM,EAAEF,gBAAMG,WAAN,EADJ;AAEJC,MAAAA,WAAW,EAAE;AAFT,KANE;AAURvC,IAAAA,QAAQ,EAAE;AACRqC,MAAAA,MAAM,EAAEF,gBAAMG,WAAN,EADA;AAERC,MAAAA,WAAW,EAAE;AAFL,KAVF;AAcRtC,IAAAA,IAAI,EAAE;AACJ,kBAAY;AACVoC,QAAAA,MAAM,EAAEF,gBAAMG,WAAN,EADE;AAEVC,QAAAA,WAAW,EAAE;AAFH,OADR;AAKJL,MAAAA,IAAI,EAAEC,gBAAMG,WAAN,EALF;AAMJN,MAAAA,UAAU,EAAElC,KAAK,CAACmB,UAAN,CAAiBgB,KAAjB,CAAuBD,UAN/B;AAOJhB,MAAAA,QAAQ,EAAElB,KAAK,CAACmB,UAAN,CAAiBD,QAPvB;AAQJS,MAAAA,UAAU,EAAE;AARR,KAdE;AAwBRlD,IAAAA,UAAU,EAAE;AACV8D,MAAAA,MAAM,EAAEF,gBAAMK,YAAN,EADE;AAEVC,MAAAA,OAAO,EAAE;AAFC;AAxBJ,GAAL;AAAA,CADW,EA8BhB;AAAEC,EAAAA,SAAS,EAAE;AAAb,CA9BgB,EA+BhBnD,YA/BgB,CAAlB;eAiCewC,S","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { types } from '@pie-lib/plot';\nimport { color } from '@pie-lib/render-ui';\nimport { AxisLeft, AxisBottom } from '@vx/axis';\nimport { bandKey, getTickValues, getRotateAngle } from './utils';\nimport MarkLabel from './mark-label';\nimport Checkbox from '@material-ui/core/Checkbox';\n\nexport class TickComponent extends React.Component {\n changeCategory = (index, newLabel) => {\n const { categories, onChangeCategory } = this.props;\n const category = categories[index];\n\n onChangeCategory(index, { ...category, label: newLabel });\n };\n\n deleteCategory = index => {\n const { categories, onChange } = this.props;\n\n if (index >= 0 && categories[index]) {\n onChange([...categories.slice(0, index), ...categories.slice(index + 1)]);\n }\n };\n\n changeInteractive = (index, value) => {\n const { categories, onChangeCategory } = this.props;\n const category = categories[index];\n\n onChangeCategory(index, { ...category, interactive: !category.interactive });\n };\n\n changeEditable = (index, value) => {\n const { categories, onChangeCategory } = this.props;\n const category = categories[index];\n\n onChangeCategory(index, { ...category, editable: !category.editable || false });\n };\n\n render() {\n const {\n classes,\n categories,\n xBand,\n bandWidth,\n barWidth,\n rotate,\n top,\n graphProps,\n defineChart,\n x,\n y,\n formattedValue\n } = this.props;\n\n if (!formattedValue) {\n return null;\n }\n\n const index = parseInt(formattedValue.split('-')[0], 10);\n const category = categories[index];\n const { deletable, editable, interactive, label, correctness } = category || {};\n const barX = xBand(bandKey({ label }, index));\n const longestCategory = (categories || []).reduce((a, b) => {\n const lengthA = a && a.label ? a.label.length : 0;\n const lengthB = b && b.label ? b.label.length : 0;\n\n return lengthA > lengthB ? a : b;\n });\n\n const longestLabel = (longestCategory && longestCategory.label) || '';\n\n return (\n <g>\n <foreignObject\n x={bandWidth ? barX : x - barWidth / 2}\n y={6}\n width={barWidth}\n height={4}\n style={{ pointerEvents: 'none', overflow: 'visible' }}\n >\n {index === 0 && (\n <div\n id=\"hiddenLabel\"\n style={{\n position: 'absolute',\n visibility: 'hidden',\n wordBreak: 'break-word',\n overflow: 'visible',\n maxWidth: barWidth,\n display: 'block'\n }}\n >\n {longestLabel}\n </div>\n )}\n <MarkLabel\n inputRef={r => (this.input = r)}\n disabled={!defineChart && !editable}\n mark={category}\n graphProps={graphProps}\n onChange={newLabel => this.changeCategory(index, newLabel)}\n barWidth={barWidth}\n rotate={rotate}\n correctness={correctness}\n />\n </foreignObject>\n {deletable && !correctness && (\n <line\n x1={x}\n y1={0}\n x2={x}\n y2={y + 4 + top}\n className={classes.dottedLine}\n strokeDasharray=\"4 2\"\n />\n )}\n {deletable && !correctness && (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n x={x - 8}\n y={y + 10 + top}\n width={16}\n height={16}\n viewBox=\"0 0 512 512\"\n onClick={() => this.deleteCategory(index)}\n >\n <path d=\"M128 405.429C128 428.846 147.198 448 170.667 448h170.667C364.802 448 384 428.846 384 405.429V160H128v245.429zM416 96h-80l-26.785-32H202.786L176 96H96v32h320V96z\" />\n </svg>\n )}\n {defineChart && index === 0 && (\n <text\n x={x - 80}\n y={y + 40 + top}\n width={barWidth}\n height={4}\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n wordBreak: 'break-word',\n overflow: 'visible',\n maxWidth: barWidth,\n display: 'inline-block'\n }}\n >\n <tspan x=\"0\" dy=\".6em\">\n {' '}\n Student can{' '}\n </tspan>\n <tspan x=\"0\" dy=\"1.2em\">\n {' '}\n set value\n </tspan>\n </text>\n )}\n {defineChart && index === 0 && (\n <text\n x={x - 80}\n y={y + 80 + top}\n width={barWidth}\n height={4}\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n wordBreak: 'break-word',\n overflow: 'visible',\n maxWidth: barWidth,\n display: 'inline-block'\n }}\n >\n <tspan x=\"0\" dy=\".6em\">\n {' '}\n Student can{' '}\n </tspan>\n <tspan x=\"0\" dy=\"1.2em\">\n {' '}\n edit name\n </tspan>\n </text>\n )}\n {defineChart && (\n <foreignObject\n x={x - 24}\n y={y + 20 + top}\n width={barWidth}\n height={4}\n style={{ pointerEvents: 'visible', overflow: 'visible' }}\n >\n <Checkbox\n checked={interactive}\n onChange={e => this.changeInteractive(index, e.target.checked)}\n />\n </foreignObject>\n )}\n {defineChart && (\n <foreignObject\n x={x - 24}\n y={y + 70 + top}\n width={barWidth}\n height={4}\n style={{ pointerEvents: 'visible', overflow: 'visible' }}\n >\n <Checkbox\n checked={editable}\n onChange={e => this.changeEditable(index, e.target.checked)}\n />\n </foreignObject>\n )}\n </g>\n );\n }\n}\n\nTickComponent.propTypes = {\n categories: PropTypes.array,\n xBand: PropTypes.func,\n bandWidth: PropTypes.number,\n barWidth: PropTypes.number,\n rotate: PropTypes.number,\n top: PropTypes.number,\n x: PropTypes.number,\n y: PropTypes.number,\n graphProps: PropTypes.object,\n formattedValue: PropTypes.string,\n onChangeCategory: PropTypes.func,\n onChange: PropTypes.func,\n classes: PropTypes.object\n};\n\nexport class RawChartAxes extends React.Component {\n static propTypes = {\n bottomScale: PropTypes.func,\n classes: PropTypes.object.isRequired,\n categories: PropTypes.array,\n graphProps: types.GraphPropsType.isRequired,\n xBand: PropTypes.func,\n leftAxis: PropTypes.bool,\n onChange: PropTypes.func,\n onChangeCategory: PropTypes.func,\n top: PropTypes.number,\n theme: PropTypes.object\n };\n\n state = { height: 0 };\n\n componentDidMount() {\n const height = document.getElementById('hiddenLabel')\n ? document.getElementById('hiddenLabel').offsetHeight\n : 0;\n\n this.setState({ height });\n }\n\n render() {\n const {\n classes,\n graphProps,\n xBand,\n leftAxis,\n onChange,\n onChangeCategory,\n categories = [],\n top,\n defineChart,\n theme\n } = this.props;\n\n const { axis, axisLine, tick, axisLabel } = classes;\n const { scale = {}, range = {}, domain = {}, size = {} } = graphProps || {};\n const { height } = this.state;\n\n const bottomScale =\n xBand && typeof xBand.rangeRound === 'function' && xBand.rangeRound([0, size.width]);\n\n const bandWidth = xBand && typeof xBand.bandwidth === 'function' && xBand.bandwidth();\n // for chartType \"line\", bandWidth will be 0, so we have to calculate it\n const barWidth = bandWidth || (scale.x && scale.x(domain.max) / categories.length);\n\n const rowTickValues = getTickValues({ ...range, step: range.labelStep });\n const fontSize = theme && theme.typography ? theme.typography.fontSize : 14;\n const rotate = getRotateAngle(fontSize, height);\n\n const getTickLabelProps = value => ({\n dy: 4,\n dx: -10 - (value.toLocaleString().length || 1) * 5\n });\n\n const getTickComponent = props => {\n const properties = {\n classes,\n categories,\n xBand,\n bandWidth,\n barWidth,\n rotate,\n top,\n defineChart,\n onChangeCategory,\n onChange,\n graphProps,\n x: props.x,\n y: props.y,\n formattedValue: props.formattedValue\n };\n\n return <TickComponent {...properties} />;\n };\n\n return (\n <React.Fragment>\n {leftAxis && (\n <AxisLeft\n scale={scale.y}\n className={axis}\n axisLineClassName={axisLine}\n tickLength={10}\n tickClassName={tick}\n tickFormat={value => value}\n label={range.label}\n labelClassName={axisLabel}\n tickValues={rowTickValues}\n tickLabelProps={getTickLabelProps}\n />\n )}\n <AxisBottom\n axisLineClassName={axisLine}\n labelClassName={axisLabel}\n tickClassName={tick}\n scale={bottomScale}\n label={domain.label}\n labelProps={{ y: 60 + top }}\n top={scale.y && scale.y(range.min)}\n textLabelProps={() => ({ textAnchor: 'middle' })}\n tickFormat={count => count}\n tickComponent={getTickComponent}\n />\n </React.Fragment>\n );\n }\n}\n\nconst ChartAxes = withStyles(\n theme => ({\n axisLabel: {\n fontFamily: theme.typography.body1.fontFamily,\n fontSize: theme.typography.fontSize,\n fill: color.secondary()\n },\n axis: {\n stroke: color.primaryDark(),\n strokeWidth: 2\n },\n axisLine: {\n stroke: color.primaryDark(),\n strokeWidth: 2\n },\n tick: {\n '& > line': {\n stroke: color.primaryDark(),\n strokeWidth: 2\n },\n fill: color.primaryDark(),\n fontFamily: theme.typography.body1.fontFamily,\n fontSize: theme.typography.fontSize,\n textAnchor: 'middle'\n },\n dottedLine: {\n stroke: color.primaryLight(),\n opacity: 0.2\n }\n }),\n { withTheme: true }\n)(RawChartAxes);\n\nexport default ChartAxes;\n"],"file":"axes.js"}
package/lib/bars/bar.js CHANGED
@@ -1,60 +1,51 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports["default"] = exports.Bar = void 0;
9
9
 
10
- var _react = _interopRequireDefault(require("react"));
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
12
- var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
13
 
14
- var _plot = require("@pie-lib/plot");
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
15
 
16
- var _utils = require("../utils");
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
17
 
18
- var _bars = _interopRequireDefault(require("./common/bars"));
18
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
19
 
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
20
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
21
 
22
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
22
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
23
 
24
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
-
26
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
27
-
28
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
24
+ var _react = _interopRequireDefault(require("react"));
29
25
 
30
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
26
+ var _propTypes = _interopRequireDefault(require("prop-types"));
31
27
 
32
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
28
+ var _plot = require("@pie-lib/plot");
33
29
 
34
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
30
+ var _utils = require("../utils");
35
31
 
36
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
32
+ var _bars = _interopRequireDefault(require("./common/bars"));
37
33
 
38
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
34
+ 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); }; }
39
35
 
40
36
  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; } }
41
37
 
42
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
-
44
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
45
-
46
38
  var Bar = /*#__PURE__*/function (_React$Component) {
47
- _inherits(Bar, _React$Component);
39
+ (0, _inherits2["default"])(Bar, _React$Component);
48
40
 
49
41
  var _super = _createSuper(Bar);
50
42
 
51
43
  function Bar() {
52
- _classCallCheck(this, Bar);
53
-
44
+ (0, _classCallCheck2["default"])(this, Bar);
54
45
  return _super.apply(this, arguments);
55
46
  }
56
47
 
57
- _createClass(Bar, [{
48
+ (0, _createClass2["default"])(Bar, [{
58
49
  key: "render",
59
50
  value: function render() {
60
51
  var props = this.props;
@@ -68,18 +59,16 @@ var Bar = /*#__PURE__*/function (_React$Component) {
68
59
  size = _ref$size === void 0 ? {} : _ref$size;
69
60
 
70
61
  var xBand = (0, _utils.dataToXBand)(scale.x, data, size.width, 'bar');
71
- return /*#__PURE__*/_react["default"].createElement(_bars["default"], _extends({}, props, {
62
+ return /*#__PURE__*/_react["default"].createElement(_bars["default"], (0, _extends2["default"])({}, props, {
72
63
  xBand: xBand
73
64
  }));
74
65
  }
75
66
  }]);
76
-
77
67
  return Bar;
78
68
  }(_react["default"].Component);
79
69
 
80
70
  exports.Bar = Bar;
81
-
82
- _defineProperty(Bar, "propTypes", {
71
+ (0, _defineProperty2["default"])(Bar, "propTypes", {
83
72
  data: _propTypes["default"].array,
84
73
  onChange: _propTypes["default"].func,
85
74
  graphProps: _plot.types.GraphPropsType.isRequired
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/bars/bar.js"],"names":["Bar","props","data","graphProps","scale","size","xBand","x","width","React","Component","PropTypes","array","onChange","func","types","GraphPropsType","isRequired","type","name"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEaA,G;;;;;;;;;;;;;WAOX,kBAAS;AACP,UAAMC,KAAK,GAAG,KAAKA,KAAnB;AACA,UAAQC,IAAR,GAA6BD,KAA7B,CAAQC,IAAR;AAAA,UAAcC,UAAd,GAA6BF,KAA7B,CAAcE,UAAd;;AACA,iBAAkCA,UAAU,IAAI,EAAhD;AAAA,4BAAQC,KAAR;AAAA,UAAQA,KAAR,2BAAgB,EAAhB;AAAA,2BAAoBC,IAApB;AAAA,UAAoBA,IAApB,0BAA2B,EAA3B;;AACA,UAAMC,KAAK,GAAG,wBAAYF,KAAK,CAACG,CAAlB,EAAqBL,IAArB,EAA2BG,IAAI,CAACG,KAAhC,EAAuC,KAAvC,CAAd;AAEA,0BAAO,gCAAC,gBAAD,eAAUP,KAAV;AAAiB,QAAA,KAAK,EAAEK;AAAxB,SAAP;AACD;;;;EAdsBG,kBAAMC,S;;;;gBAAlBV,G,eACQ;AACjBE,EAAAA,IAAI,EAAES,sBAAUC,KADC;AAEjBC,EAAAA,QAAQ,EAAEF,sBAAUG,IAFH;AAGjBX,EAAAA,UAAU,EAAEY,YAAMC,cAAN,CAAqBC;AAHhB,C;;eAgBN;AAAA,SAAO;AACpBC,IAAAA,IAAI,EAAE,KADc;AAEpBR,IAAAA,SAAS,EAAEV,GAFS;AAGpBmB,IAAAA,IAAI,EAAE;AAHc,GAAP;AAAA,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { dataToXBand } from '../utils';\nimport Bars from './common/bars';\n\nexport class Bar extends React.Component {\n static propTypes = {\n data: PropTypes.array,\n onChange: PropTypes.func,\n graphProps: types.GraphPropsType.isRequired\n };\n\n render() {\n const props = this.props;\n const { data, graphProps } = props;\n const { scale = {}, size = {} } = graphProps || {};\n const xBand = dataToXBand(scale.x, data, size.width, 'bar');\n\n return <Bars {...props} xBand={xBand} />;\n }\n}\n\nexport default () => ({\n type: 'bar',\n Component: Bar,\n name: 'Bar'\n});\n"],"file":"bar.js"}
1
+ {"version":3,"sources":["../../src/bars/bar.js"],"names":["Bar","props","data","graphProps","scale","size","xBand","x","width","React","Component","PropTypes","array","onChange","func","types","GraphPropsType","isRequired","type","name"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;IAEaA,G;;;;;;;;;;;;WAOX,kBAAS;AACP,UAAMC,KAAK,GAAG,KAAKA,KAAnB;AACA,UAAQC,IAAR,GAA6BD,KAA7B,CAAQC,IAAR;AAAA,UAAcC,UAAd,GAA6BF,KAA7B,CAAcE,UAAd;;AACA,iBAAkCA,UAAU,IAAI,EAAhD;AAAA,4BAAQC,KAAR;AAAA,UAAQA,KAAR,2BAAgB,EAAhB;AAAA,2BAAoBC,IAApB;AAAA,UAAoBA,IAApB,0BAA2B,EAA3B;;AACA,UAAMC,KAAK,GAAG,wBAAYF,KAAK,CAACG,CAAlB,EAAqBL,IAArB,EAA2BG,IAAI,CAACG,KAAhC,EAAuC,KAAvC,CAAd;AAEA,0BAAO,gCAAC,gBAAD,gCAAUP,KAAV;AAAiB,QAAA,KAAK,EAAEK;AAAxB,SAAP;AACD;;;EAdsBG,kBAAMC,S;;;iCAAlBV,G,eACQ;AACjBE,EAAAA,IAAI,EAAES,sBAAUC,KADC;AAEjBC,EAAAA,QAAQ,EAAEF,sBAAUG,IAFH;AAGjBX,EAAAA,UAAU,EAAEY,YAAMC,cAAN,CAAqBC;AAHhB,C;;eAgBN;AAAA,SAAO;AACpBC,IAAAA,IAAI,EAAE,KADc;AAEpBR,IAAAA,SAAS,EAAEV,GAFS;AAGpBmB,IAAAA,IAAI,EAAE;AAHc,GAAP;AAAA,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { dataToXBand } from '../utils';\nimport Bars from './common/bars';\n\nexport class Bar extends React.Component {\n static propTypes = {\n data: PropTypes.array,\n onChange: PropTypes.func,\n graphProps: types.GraphPropsType.isRequired\n };\n\n render() {\n const props = this.props;\n const { data, graphProps } = props;\n const { scale = {}, size = {} } = graphProps || {};\n const xBand = dataToXBand(scale.x, data, size.width, 'bar');\n\n return <Bars {...props} xBand={xBand} />;\n }\n}\n\nexport default () => ({\n type: 'bar',\n Component: Bar,\n name: 'Bar'\n});\n"],"file":"bar.js"}