@pie-lib/charting 4.5.13 → 4.5.16

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.json CHANGED
@@ -534,6 +534,21 @@
534
534
  "isTagged": true,
535
535
  "tag": "@pie-lib/charting@4.5.10"
536
536
  },
537
+ {
538
+ "type": "fix",
539
+ "scope": "charting",
540
+ "subject": "Displayed the entire rightmost category label when space available PD-531",
541
+ "merge": null,
542
+ "header": "fix(charting): Displayed the entire rightmost category label when space available PD-531",
543
+ "body": null,
544
+ "footer": null,
545
+ "notes": [],
546
+ "hash": "4c96415952e13e789f5b67cf99e6a17d957a06e7",
547
+ "gitTags": " (origin/fix/PD-531)",
548
+ "committerDate": "2021-09-10 14:19:05 +0300",
549
+ "isTagged": true,
550
+ "tag": "@pie-lib/charting@4.5.13"
551
+ },
537
552
  {
538
553
  "type": "fix",
539
554
  "scope": "charting",
@@ -563,20 +578,5 @@
563
578
  "committerDate": "2021-03-19 19:13:17 +0200",
564
579
  "isTagged": true,
565
580
  "tag": "@pie-lib/charting@4.5.11"
566
- },
567
- {
568
- "type": "fix",
569
- "scope": "charting",
570
- "subject": "Displayed the entire rightmost category label when space available PD-531",
571
- "merge": null,
572
- "header": "fix(charting): Displayed the entire rightmost category label when space available PD-531",
573
- "body": null,
574
- "footer": null,
575
- "notes": [],
576
- "hash": "4c96415952e13e789f5b67cf99e6a17d957a06e7",
577
- "gitTags": " (origin/fix/PD-531)",
578
- "committerDate": "2021-09-10 14:19:05 +0300",
579
- "isTagged": true,
580
- "tag": "@pie-lib/charting@4.5.13"
581
581
  }
582
582
  ]
package/CHANGELOG.md CHANGED
@@ -3,6 +3,36 @@
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
+ ## [4.5.16](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.15...@pie-lib/charting@4.5.16) (2022-05-30)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * unable to load items locally ([17ab686](https://github.com/pie-framework/pie-lib/commit/17ab6864557288aef6ec1d9a130cb508e2591562))
12
+
13
+
14
+
15
+
16
+
17
+ ## [4.5.15](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.14...@pie-lib/charting@4.5.15) (2022-05-10)
18
+
19
+ **Note:** Version bump only for package @pie-lib/charting
20
+
21
+
22
+
23
+
24
+
25
+ ## [4.5.14](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.13...@pie-lib/charting@4.5.14) (2022-03-21)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * **charting:** Added custom modulo function to work with decimals PD-1645 ([70951ef](https://github.com/pie-framework/pie-lib/commit/70951ef055630f217094a42ec2d15282cf680c6b))
31
+
32
+
33
+
34
+
35
+
6
36
  ## [4.5.13](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@4.5.12...@pie-lib/charting@4.5.13) (2021-09-10)
7
37
 
8
38
 
package/lib/axes.js CHANGED
@@ -1,9 +1,11 @@
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); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
- exports["default"] = exports.RawChartAxes = exports.TickComponent = void 0;
8
+ exports["default"] = exports.TickComponent = exports.RawChartAxes = void 0;
7
9
 
8
10
  var _react = _interopRequireDefault(require("react"));
9
11
 
@@ -21,48 +23,54 @@ var _utils = require("./utils");
21
23
 
22
24
  var _markLabel = _interopRequireDefault(require("./mark-label"));
23
25
 
26
+ var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
27
+
24
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
29
 
26
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
30
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
27
31
 
28
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
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."); }
29
33
 
30
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
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); }
31
35
 
32
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
36
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
33
37
 
34
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
38
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
35
39
 
36
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
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; }
37
41
 
38
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
42
+ 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
+
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; }
39
45
 
40
46
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
41
47
 
42
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); } }
43
49
 
44
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
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; }
45
51
 
46
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
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); }
47
53
 
48
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
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); }
49
59
 
50
60
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
51
61
 
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
62
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
53
63
 
54
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
64
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
55
65
 
56
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; }
57
67
 
58
- var TickComponent =
59
- /*#__PURE__*/
60
- function (_React$Component) {
68
+ var TickComponent = /*#__PURE__*/function (_React$Component) {
61
69
  _inherits(TickComponent, _React$Component);
62
70
 
63
- function TickComponent() {
64
- var _getPrototypeOf2;
71
+ var _super = _createSuper(TickComponent);
65
72
 
73
+ function TickComponent() {
66
74
  var _this;
67
75
 
68
76
  _classCallCheck(this, TickComponent);
@@ -71,14 +79,14 @@ function (_React$Component) {
71
79
  args[_key] = arguments[_key];
72
80
  }
73
81
 
74
- _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(TickComponent)).call.apply(_getPrototypeOf2, [this].concat(args)));
82
+ _this = _super.call.apply(_super, [this].concat(args));
75
83
 
76
84
  _defineProperty(_assertThisInitialized(_this), "changeCategory", function (index, newLabel) {
77
85
  var _this$props = _this.props,
78
86
  categories = _this$props.categories,
79
87
  onChangeCategory = _this$props.onChangeCategory;
80
88
  var category = categories[index];
81
- onChangeCategory(index, _objectSpread({}, category, {
89
+ onChangeCategory(index, _objectSpread(_objectSpread({}, category), {}, {
82
90
  label: newLabel
83
91
  }));
84
92
  });
@@ -93,6 +101,16 @@ function (_React$Component) {
93
101
  }
94
102
  });
95
103
 
104
+ _defineProperty(_assertThisInitialized(_this), "changeInteractive", function (index, value) {
105
+ var _this$props3 = _this.props,
106
+ categories = _this$props3.categories,
107
+ onChangeCategory = _this$props3.onChangeCategory;
108
+ var category = categories[index];
109
+ onChangeCategory(index, _objectSpread(_objectSpread({}, category), {}, {
110
+ interactive: !category.interactive
111
+ }));
112
+ });
113
+
96
114
  return _this;
97
115
  }
98
116
 
@@ -101,18 +119,19 @@ function (_React$Component) {
101
119
  value: function render() {
102
120
  var _this2 = this;
103
121
 
104
- var _this$props3 = this.props,
105
- classes = _this$props3.classes,
106
- categories = _this$props3.categories,
107
- xBand = _this$props3.xBand,
108
- bandWidth = _this$props3.bandWidth,
109
- barWidth = _this$props3.barWidth,
110
- rotate = _this$props3.rotate,
111
- top = _this$props3.top,
112
- graphProps = _this$props3.graphProps,
113
- x = _this$props3.x,
114
- y = _this$props3.y,
115
- formattedValue = _this$props3.formattedValue;
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;
116
135
 
117
136
  if (!formattedValue) {
118
137
  return null;
@@ -137,16 +156,16 @@ function (_React$Component) {
137
156
  return lengthA > lengthB ? a : b;
138
157
  });
139
158
  var longestLabel = longestCategory && longestCategory.label || '';
140
- return _react["default"].createElement("g", null, _react["default"].createElement("foreignObject", {
159
+ return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("foreignObject", {
141
160
  x: bandWidth ? barX : x - barWidth / 2,
142
161
  y: 6,
143
162
  width: barWidth,
144
- height: 24,
163
+ height: 4,
145
164
  style: {
146
165
  pointerEvents: 'none',
147
166
  overflow: 'visible'
148
167
  }
149
- }, index === 0 && _react["default"].createElement("div", {
168
+ }, index === 0 && /*#__PURE__*/_react["default"].createElement("div", {
150
169
  id: "hiddenLabel",
151
170
  style: {
152
171
  position: 'absolute',
@@ -156,7 +175,20 @@ function (_React$Component) {
156
175
  maxWidth: barWidth,
157
176
  display: 'block'
158
177
  }
159
- }, longestLabel), _react["default"].createElement(_markLabel["default"], {
178
+ }, longestLabel), /*#__PURE__*/_react["default"].createElement(_markLabel["default"], {
179
+ inputRef: function inputRef(r) {
180
+ return _this2.input = r;
181
+ },
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"], {
160
192
  inputRef: function inputRef(r) {
161
193
  return _this2.input = r;
162
194
  },
@@ -169,14 +201,14 @@ function (_React$Component) {
169
201
  barWidth: barWidth,
170
202
  rotate: rotate,
171
203
  correctness: correctness
172
- })), deletable && !correctness && _react["default"].createElement("line", {
204
+ })), deletable && !correctness && /*#__PURE__*/_react["default"].createElement("line", {
173
205
  x1: x,
174
206
  y1: 0,
175
207
  x2: x,
176
208
  y2: y + 4 + top,
177
209
  className: classes.dottedLine,
178
210
  strokeDasharray: "4 2"
179
- }), deletable && !correctness && _react["default"].createElement("svg", {
211
+ }), deletable && !correctness && /*#__PURE__*/_react["default"].createElement("svg", {
180
212
  xmlns: "http://www.w3.org/2000/svg",
181
213
  x: x - 8,
182
214
  y: y + 10 + top,
@@ -186,8 +218,41 @@ function (_React$Component) {
186
218
  onClick: function onClick() {
187
219
  return _this2.deleteCategory(index);
188
220
  }
189
- }, _react["default"].createElement("path", {
221
+ }, /*#__PURE__*/_react["default"].createElement("path", {
190
222
  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"
223
+ })), defineChart && index === 0 && /*#__PURE__*/_react["default"].createElement("text", {
224
+ x: x - 80,
225
+ y: y + 40 + top,
226
+ width: barWidth,
227
+ height: 4,
228
+ style: {
229
+ position: 'absolute',
230
+ pointerEvents: 'none',
231
+ wordBreak: 'break-word',
232
+ overflow: 'visible',
233
+ maxWidth: barWidth,
234
+ display: 'inline-block'
235
+ }
236
+ }, /*#__PURE__*/_react["default"].createElement("tspan", {
237
+ x: "0",
238
+ dy: ".6em"
239
+ }, ' ', "Student can", ' '), /*#__PURE__*/_react["default"].createElement("tspan", {
240
+ x: "0",
241
+ dy: "1.2em"
242
+ }, ' ', "set value")), defineChart && /*#__PURE__*/_react["default"].createElement("foreignObject", {
243
+ x: x - 24,
244
+ y: y + 20 + top,
245
+ width: barWidth,
246
+ height: 4,
247
+ style: {
248
+ pointerEvents: 'visible',
249
+ overflow: 'visible'
250
+ }
251
+ }, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
252
+ checked: interactive,
253
+ onChange: function onChange(e) {
254
+ return _this2.changeInteractive(index, e.target.checked);
255
+ }
191
256
  })));
192
257
  }
193
258
  }]);
@@ -212,14 +277,12 @@ TickComponent.propTypes = {
212
277
  classes: _propTypes["default"].object
213
278
  };
214
279
 
215
- var RawChartAxes =
216
- /*#__PURE__*/
217
- function (_React$Component2) {
280
+ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
218
281
  _inherits(RawChartAxes, _React$Component2);
219
282
 
220
- function RawChartAxes() {
221
- var _getPrototypeOf3;
283
+ var _super2 = _createSuper(RawChartAxes);
222
284
 
285
+ function RawChartAxes() {
223
286
  var _this3;
224
287
 
225
288
  _classCallCheck(this, RawChartAxes);
@@ -228,7 +291,7 @@ function (_React$Component2) {
228
291
  args[_key2] = arguments[_key2];
229
292
  }
230
293
 
231
- _this3 = _possibleConstructorReturn(this, (_getPrototypeOf3 = _getPrototypeOf(RawChartAxes)).call.apply(_getPrototypeOf3, [this].concat(args)));
294
+ _this3 = _super2.call.apply(_super2, [this].concat(args));
232
295
 
233
296
  _defineProperty(_assertThisInitialized(_this3), "state", {
234
297
  height: 0
@@ -248,17 +311,18 @@ function (_React$Component2) {
248
311
  }, {
249
312
  key: "render",
250
313
  value: function render() {
251
- var _this$props4 = this.props,
252
- classes = _this$props4.classes,
253
- graphProps = _this$props4.graphProps,
254
- xBand = _this$props4.xBand,
255
- leftAxis = _this$props4.leftAxis,
256
- onChange = _this$props4.onChange,
257
- onChangeCategory = _this$props4.onChangeCategory,
258
- _this$props4$categori = _this$props4.categories,
259
- categories = _this$props4$categori === void 0 ? [] : _this$props4$categori,
260
- top = _this$props4.top,
261
- theme = _this$props4.theme;
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;
262
326
  var axis = classes.axis,
263
327
  axisLine = classes.axisLine,
264
328
  tick = classes.tick,
@@ -279,7 +343,7 @@ function (_React$Component2) {
279
343
  var bandWidth = xBand && typeof xBand.bandwidth === 'function' && xBand.bandwidth(); // for chartType "line", bandWidth will be 0, so we have to calculate it
280
344
 
281
345
  var barWidth = bandWidth || scale.x && scale.x(domain.max) / categories.length;
282
- var rowTickValues = (0, _utils.getTickValues)(_objectSpread({}, range, {
346
+ var rowTickValues = (0, _utils.getTickValues)(_objectSpread(_objectSpread({}, range), {}, {
283
347
  step: range.labelStep
284
348
  }));
285
349
  var fontSize = theme && theme.typography ? theme.typography.fontSize : 14;
@@ -301,6 +365,7 @@ function (_React$Component2) {
301
365
  barWidth: barWidth,
302
366
  rotate: rotate,
303
367
  top: top,
368
+ defineChart: defineChart,
304
369
  onChangeCategory: onChangeCategory,
305
370
  onChange: onChange,
306
371
  graphProps: graphProps,
@@ -308,10 +373,10 @@ function (_React$Component2) {
308
373
  y: props.y,
309
374
  formattedValue: props.formattedValue
310
375
  };
311
- return _react["default"].createElement(TickComponent, properties);
376
+ return /*#__PURE__*/_react["default"].createElement(TickComponent, properties);
312
377
  };
313
378
 
314
- return _react["default"].createElement(_react["default"].Fragment, null, leftAxis && _react["default"].createElement(_axis.AxisLeft, {
379
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, leftAxis && /*#__PURE__*/_react["default"].createElement(_axis.AxisLeft, {
315
380
  scale: scale.y,
316
381
  className: axis,
317
382
  axisLineClassName: axisLine,
@@ -324,7 +389,7 @@ function (_React$Component2) {
324
389
  labelClassName: axisLabel,
325
390
  tickValues: rowTickValues,
326
391
  tickLabelProps: getTickLabelProps
327
- }), _react["default"].createElement(_axis.AxisBottom, {
392
+ }), /*#__PURE__*/_react["default"].createElement(_axis.AxisBottom, {
328
393
  axisLineClassName: axisLine,
329
394
  labelClassName: axisLabel,
330
395
  tickClassName: tick,
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","classes","xBand","bandWidth","barWidth","rotate","top","graphProps","x","y","formattedValue","parseInt","split","deletable","editable","interactive","correctness","barX","longestCategory","reduce","a","b","lengthA","length","lengthB","longestLabel","pointerEvents","overflow","position","visibility","wordBreak","maxWidth","display","r","input","changeCategory","dottedLine","deleteCategory","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","value","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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEaA,a;;;;;;;;;;;;;;;;;;qEACM,UAACC,KAAD,EAAQC,QAAR,EAAqB;AAAA,wBACK,MAAKC,KADV;AAAA,UAC5BC,UAD4B,eAC5BA,UAD4B;AAAA,UAChBC,gBADgB,eAChBA,gBADgB;AAEpC,UAAMC,QAAQ,GAAGF,UAAU,CAACH,KAAD,CAA3B;AAEAI,MAAAA,gBAAgB,CAACJ,KAAD,oBAAaK,QAAb;AAAuBC,QAAAA,KAAK,EAAEL;AAA9B,SAAhB;AACD,K;;qEAEgB,UAAAD,KAAK,EAAI;AAAA,yBACS,MAAKE,KADd;AAAA,UAChBC,UADgB,gBAChBA,UADgB;AAAA,UACJI,QADI,gBACJA,QADI;;AAGxB,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;;;;;;;6BAEQ;AAAA;;AAAA,yBAaH,KAAKE,KAbF;AAAA,UAELO,OAFK,gBAELA,OAFK;AAAA,UAGLN,UAHK,gBAGLA,UAHK;AAAA,UAILO,KAJK,gBAILA,KAJK;AAAA,UAKLC,SALK,gBAKLA,SALK;AAAA,UAMLC,QANK,gBAMLA,QANK;AAAA,UAOLC,M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,WAAW,EAAE;AAFH,OADR;AAKJL,MAAAA,IAAI,EAAEC,gBAAMG,WAAN,EALF;AAMJN,MAAAA,UAAU,EAAEnC,KAAK,CAACmB,UAAN,CAAiBiB,KAAjB,CAAuBD,UAN/B;AAOJjB,MAAAA,QAAQ,EAAElB,KAAK,CAACmB,UAAN,CAAiBD,QAPvB;AAQJU,MAAAA,UAAU,EAAE;AARR,KAdE;AAwBR9C,IAAAA,UAAU,EAAE;AACV0D,MAAAA,MAAM,EAAEF,gBAAMK,YAAN,EADE;AAEVC,MAAAA,OAAO,EAAE;AAFC;AAxBJ,GAAL;AAAA,CADW,EA8BhB;AAAEC,EAAAA,SAAS,EAAE;AAAb,CA9BgB,EA+BhBpD,YA/BgB,CAAlB;eAiCeyC,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';\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 render() {\n const {\n classes,\n categories,\n xBand,\n bandWidth,\n barWidth,\n rotate,\n top,\n graphProps,\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={24}\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 </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 </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 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 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 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","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;;;;;;;;;;;;;;;;;;;;;;;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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"}
package/lib/bars/bar.js CHANGED
@@ -1,5 +1,7 @@
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); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -17,37 +19,39 @@ var _bars = _interopRequireDefault(require("./common/bars"));
17
19
 
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
21
 
20
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
21
-
22
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); }
23
23
 
24
24
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
25
 
26
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
27
 
28
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
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; }
29
29
 
30
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
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); }
31
31
 
32
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
32
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
33
 
34
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
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); }; }
35
35
 
36
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
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); }
37
37
 
38
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
38
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
+
40
+ 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
+
42
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
43
 
40
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; }
41
45
 
42
- var Bar =
43
- /*#__PURE__*/
44
- function (_React$Component) {
46
+ var Bar = /*#__PURE__*/function (_React$Component) {
45
47
  _inherits(Bar, _React$Component);
46
48
 
49
+ var _super = _createSuper(Bar);
50
+
47
51
  function Bar() {
48
52
  _classCallCheck(this, Bar);
49
53
 
50
- return _possibleConstructorReturn(this, _getPrototypeOf(Bar).apply(this, arguments));
54
+ return _super.apply(this, arguments);
51
55
  }
52
56
 
53
57
  _createClass(Bar, [{
@@ -64,7 +68,7 @@ function (_React$Component) {
64
68
  size = _ref$size === void 0 ? {} : _ref$size;
65
69
 
66
70
  var xBand = (0, _utils.dataToXBand)(scale.x, data, size.width, 'bar');
67
- return _react["default"].createElement(_bars["default"], _extends({}, props, {
71
+ return /*#__PURE__*/_react["default"].createElement(_bars["default"], _extends({}, props, {
68
72
  xBand: xBand
69
73
  }));
70
74
  }
@@ -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;;;;;;;;;;;;;6BAOF;AACP,UAAMC,KAAK,GAAG,KAAKA,KAAnB;AADO,UAECC,IAFD,GAEsBD,KAFtB,CAECC,IAFD;AAAA,UAEOC,UAFP,GAEsBF,KAFtB,CAEOE,UAFP;;AAAA,iBAG2BA,UAAU,IAAI,EAHzC;AAAA,4BAGCC,KAHD;AAAA,UAGCA,KAHD,2BAGS,EAHT;AAAA,2BAGaC,IAHb;AAAA,UAGaA,IAHb,0BAGoB,EAHpB;;AAIP,UAAMC,KAAK,GAAG,wBAAYF,KAAK,CAACG,CAAlB,EAAqBL,IAArB,EAA2BG,IAAI,CAACG,KAAhC,EAAuC,KAAvC,CAAd;AAEA,aAAO,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,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"}