@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 +15 -15
- package/CHANGELOG.md +30 -0
- package/lib/axes.js +125 -60
- package/lib/axes.js.map +1 -1
- package/lib/bars/bar.js +17 -13
- package/lib/bars/bar.js.map +1 -1
- package/lib/bars/common/bars.js +27 -21
- package/lib/bars/common/bars.js.map +1 -1
- package/lib/bars/histogram.js +17 -13
- package/lib/bars/histogram.js.map +1 -1
- package/lib/chart.js +43 -34
- package/lib/chart.js.map +1 -1
- package/lib/common/drag-handle.js +24 -18
- package/lib/common/drag-handle.js.map +1 -1
- package/lib/common/styles.js +1 -1
- package/lib/grid.js +17 -13
- package/lib/grid.js.map +1 -1
- package/lib/line/common/drag-handle.js +20 -14
- package/lib/line/common/drag-handle.js.map +1 -1
- package/lib/line/common/line.js +37 -29
- package/lib/line/common/line.js.map +1 -1
- package/lib/line/line-cross.js +23 -17
- package/lib/line/line-cross.js.map +1 -1
- package/lib/line/line-dot.js +21 -15
- package/lib/line/line-dot.js.map +1 -1
- package/lib/mark-label.js +15 -7
- package/lib/mark-label.js.map +1 -1
- package/lib/plot/common/plot.js +27 -21
- package/lib/plot/common/plot.js.map +1 -1
- package/lib/plot/dot.js +18 -14
- package/lib/plot/dot.js.map +1 -1
- package/lib/plot/line.js +19 -15
- package/lib/plot/line.js.map +1 -1
- package/lib/tool-menu.js +19 -15
- package/lib/tool-menu.js.map +1 -1
- package/lib/utils.js +20 -9
- package/lib/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/axes.jsx +62 -1
- package/src/chart.jsx +5 -2
- package/src/utils.js +16 -1
|
@@ -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.
|
|
8
|
+
exports["default"] = exports.RawDragHandle = exports.DragHandle = exports.D = void 0;
|
|
7
9
|
|
|
8
10
|
var _react = _interopRequireDefault(require("react"));
|
|
9
11
|
|
|
@@ -19,9 +21,9 @@ var _renderUi = require("@pie-lib/render-ui");
|
|
|
19
21
|
|
|
20
22
|
var _styles = require("./styles");
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
var _excluded = ["x", "y", "width", "graphProps", "classes", "className", "interactive", "correctness"];
|
|
23
25
|
|
|
24
|
-
function
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
27
|
|
|
26
28
|
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); }
|
|
27
29
|
|
|
@@ -33,29 +35,33 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
33
35
|
|
|
34
36
|
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); } }
|
|
35
37
|
|
|
36
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
38
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
37
39
|
|
|
38
|
-
function
|
|
40
|
+
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); }
|
|
39
41
|
|
|
40
|
-
function
|
|
42
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
41
43
|
|
|
42
|
-
function
|
|
44
|
+
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); }; }
|
|
43
45
|
|
|
44
|
-
function
|
|
46
|
+
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); }
|
|
45
47
|
|
|
46
|
-
function
|
|
48
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
49
|
+
|
|
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; } }
|
|
51
|
+
|
|
52
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
47
53
|
|
|
48
54
|
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; }
|
|
49
55
|
|
|
50
|
-
var RawDragHandle =
|
|
51
|
-
/*#__PURE__*/
|
|
52
|
-
function (_React$Component) {
|
|
56
|
+
var RawDragHandle = /*#__PURE__*/function (_React$Component) {
|
|
53
57
|
_inherits(RawDragHandle, _React$Component);
|
|
54
58
|
|
|
59
|
+
var _super = _createSuper(RawDragHandle);
|
|
60
|
+
|
|
55
61
|
function RawDragHandle() {
|
|
56
62
|
_classCallCheck(this, RawDragHandle);
|
|
57
63
|
|
|
58
|
-
return
|
|
64
|
+
return _super.apply(this, arguments);
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
_createClass(RawDragHandle, [{
|
|
@@ -70,23 +76,23 @@ function (_React$Component) {
|
|
|
70
76
|
className = _this$props.className,
|
|
71
77
|
interactive = _this$props.interactive,
|
|
72
78
|
correctness = _this$props.correctness,
|
|
73
|
-
rest = _objectWithoutProperties(_this$props,
|
|
79
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
74
80
|
|
|
75
81
|
var scale = graphProps.scale;
|
|
76
|
-
return _react["default"].createElement("svg", {
|
|
82
|
+
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
77
83
|
x: x,
|
|
78
84
|
y: scale.y(y) - 10,
|
|
79
85
|
width: width,
|
|
80
86
|
overflow: "visible",
|
|
81
87
|
className: (0, _classnames["default"])(classes.handleContainer, className, !interactive && 'non-interactive', interactive && correctness && correctness.value)
|
|
82
|
-
}, _react["default"].createElement("rect", _extends({
|
|
88
|
+
}, /*#__PURE__*/_react["default"].createElement("rect", _extends({
|
|
83
89
|
y: -10,
|
|
84
90
|
width: width,
|
|
85
91
|
className: (0, _classnames["default"])(classes.transparentHandle, className)
|
|
86
|
-
}, rest)), _react["default"].createElement("rect", _extends({
|
|
92
|
+
}, rest)), /*#__PURE__*/_react["default"].createElement("rect", _extends({
|
|
87
93
|
width: width,
|
|
88
94
|
className: (0, _classnames["default"])(classes.handle, 'handle', className, !interactive && 'non-interactive', interactive && correctness && correctness.value)
|
|
89
|
-
}, rest)), _react["default"].createElement("rect", _extends({
|
|
95
|
+
}, rest)), /*#__PURE__*/_react["default"].createElement("rect", _extends({
|
|
90
96
|
y: 10,
|
|
91
97
|
width: width,
|
|
92
98
|
className: (0, _classnames["default"])(classes.transparentHandle, className)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/common/drag-handle.jsx"],"names":["RawDragHandle","props","x","y","width","graphProps","classes","className","interactive","correctness","rest","scale","handleContainer","value","transparentHandle","handle","React","Component","PropTypes","number","isRequired","types","GraphPropsType","object","string","bool","shape","label","DragHandle","theme","height","fill","color","secondary","transition","secondaryDark","D","axis","fromDelta","delta","newPoint","utils","point","add","bounds","domain","range","area","left","top","bottom","right","anchorPoint"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/common/drag-handle.jsx"],"names":["RawDragHandle","props","x","y","width","graphProps","classes","className","interactive","correctness","rest","scale","handleContainer","value","transparentHandle","handle","React","Component","PropTypes","number","isRequired","types","GraphPropsType","object","string","bool","shape","label","DragHandle","theme","height","fill","color","secondary","transition","secondaryDark","D","axis","fromDelta","delta","newPoint","utils","point","add","bounds","domain","range","area","left","top","bottom","right","anchorPoint"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEaA,a;;;;;;;;;;;;;WAcX,kBAAS;AACP,wBAUI,KAAKC,KAVT;AAAA,UACEC,CADF,eACEA,CADF;AAAA,UAEEC,CAFF,eAEEA,CAFF;AAAA,UAGEC,KAHF,eAGEA,KAHF;AAAA,UAIEC,UAJF,eAIEA,UAJF;AAAA,UAKEC,OALF,eAKEA,OALF;AAAA,UAMEC,SANF,eAMEA,SANF;AAAA,UAOEC,WAPF,e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V;;AACA,QAAMsC,QAAQ,GAAGC,YAAMC,KAAN,CAAYzC,KAAZ,EAAmB0C,GAAnB,CAAuBF,YAAMC,KAAN,CAAYH,KAAZ,CAAvB,CAAjB;;AACA,WAAOC,QAAQ,CAACrC,CAAhB;AACD,GAP4B;AAQ7ByC,EAAAA,MAAM,EAAE,gBAAC3C,KAAD,QAA8B;AAAA,QAApB4C,MAAoB,QAApBA,MAAoB;AAAA,QAAZC,KAAY,QAAZA,KAAY;AACpC,QAAMC,IAAI,GAAG;AAAEC,MAAAA,IAAI,EAAE,CAAR;AAAWC,MAAAA,GAAG,EAAEhD,KAAK,CAACE,CAAtB;AAAyB+C,MAAAA,MAAM,EAAEjD,KAAK,CAACE,CAAvC;AAA0CgD,MAAAA,KAAK,EAAE;AAAjD,KAAb;AACA,WAAOV,YAAMG,MAAN,CAAaG,IAAb,EAAmBF,MAAnB,EAA2BC,KAA3B,CAAP;AACD,GAX4B;AAY7BM,EAAAA,WAAW,EAAE,qBAAAnD,KAAK,EAAI;AACpB,WAAO;AAAEC,MAAAA,CAAC,EAAED,KAAK,CAACC,CAAX;AAAcC,MAAAA,CAAC,EAAEF,KAAK,CAACE;AAAvB,KAAP;AACD;AAd4B,CAAd,EAedyB,UAfc,CAAV;;eAiBQQ,C","sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { gridDraggable, utils, types } from '@pie-lib/plot';\nimport { withStyles } from '@material-ui/core/styles/index';\nimport PropTypes from 'prop-types';\nimport { color } from '@pie-lib/render-ui';\nimport { correct, incorrect, disabled } from './styles';\n\nexport class RawDragHandle extends React.Component {\n static propTypes = {\n x: PropTypes.number.isRequired,\n y: PropTypes.number.isRequired,\n width: PropTypes.number,\n graphProps: types.GraphPropsType.isRequired,\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n interactive: PropTypes.bool,\n correctness: PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string\n })\n };\n render() {\n const {\n x,\n y,\n width,\n graphProps,\n classes,\n className,\n interactive,\n correctness,\n ...rest\n } = this.props;\n const { scale } = graphProps;\n return (\n <svg\n x={x}\n y={scale.y(y) - 10}\n width={width}\n overflow=\"visible\"\n className={classNames(\n classes.handleContainer,\n className,\n !interactive && 'non-interactive',\n interactive && correctness && correctness.value\n )}\n >\n <rect\n y={-10}\n width={width}\n className={classNames(classes.transparentHandle, className)}\n {...rest}\n />\n <rect\n width={width}\n className={classNames(\n classes.handle,\n 'handle',\n className,\n !interactive && 'non-interactive',\n interactive && correctness && correctness.value\n )}\n {...rest}\n />\n <rect\n y={10}\n width={width}\n className={classNames(classes.transparentHandle, className)}\n {...rest}\n />\n </svg>\n );\n }\n}\n\nexport const DragHandle = withStyles(theme => ({\n handle: {\n height: '10px',\n fill: color.secondary(),\n transition: 'fill 200ms linear, height 200ms linear',\n '&.correct': correct('fill'),\n '&.incorrect': incorrect('fill'),\n '&.non-interactive': disabled('fill')\n },\n transparentHandle: {\n height: '10px',\n fill: 'transparent'\n },\n handleContainer: {\n height: 30,\n '&:hover': {\n '& .handle': {\n fill: color.secondaryDark(),\n height: '16px'\n }\n },\n '&.non-interactive': disabled('fill'),\n '&.incorrect': incorrect('fill'),\n '&.correct': correct('fill')\n }\n}))(RawDragHandle);\n\nexport const D = gridDraggable({\n axis: 'y',\n fromDelta: (props, delta) => {\n //TODO: should be in grid-draggable, if axis is y delta.x should always be 0.\n delta.x = 0;\n const newPoint = utils.point(props).add(utils.point(delta));\n return newPoint.y;\n },\n bounds: (props, { domain, range }) => {\n const area = { left: 0, top: props.y, bottom: props.y, right: 0 };\n return utils.bounds(area, domain, range);\n },\n anchorPoint: props => {\n return { x: props.x, y: props.y };\n }\n})(DragHandle);\n\nexport default D;\n"],"file":"drag-handle.js"}
|
package/lib/common/styles.js
CHANGED
package/lib/grid.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
|
});
|
|
@@ -21,35 +23,37 @@ var _renderUi = require("@pie-lib/render-ui");
|
|
|
21
23
|
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
25
|
|
|
24
|
-
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); }
|
|
25
|
-
|
|
26
26
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
27
27
|
|
|
28
28
|
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); } }
|
|
29
29
|
|
|
30
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
30
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
31
31
|
|
|
32
|
-
function
|
|
32
|
+
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); }
|
|
33
33
|
|
|
34
|
-
function
|
|
34
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
35
|
|
|
36
|
-
function
|
|
36
|
+
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); }; }
|
|
37
37
|
|
|
38
|
-
function
|
|
38
|
+
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); }
|
|
39
39
|
|
|
40
|
-
function
|
|
40
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
41
|
+
|
|
42
|
+
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; } }
|
|
43
|
+
|
|
44
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
45
|
|
|
42
46
|
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; }
|
|
43
47
|
|
|
44
|
-
var Grid =
|
|
45
|
-
/*#__PURE__*/
|
|
46
|
-
function (_React$Component) {
|
|
48
|
+
var Grid = /*#__PURE__*/function (_React$Component) {
|
|
47
49
|
_inherits(Grid, _React$Component);
|
|
48
50
|
|
|
51
|
+
var _super = _createSuper(Grid);
|
|
52
|
+
|
|
49
53
|
function Grid() {
|
|
50
54
|
_classCallCheck(this, Grid);
|
|
51
55
|
|
|
52
|
-
return
|
|
56
|
+
return _super.apply(this, arguments);
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
_createClass(Grid, [{
|
|
@@ -69,7 +73,7 @@ function (_React$Component) {
|
|
|
69
73
|
_ref$size = _ref.size,
|
|
70
74
|
size = _ref$size === void 0 ? {} : _ref$size;
|
|
71
75
|
|
|
72
|
-
return _react["default"].createElement(_grid.Grid, {
|
|
76
|
+
return /*#__PURE__*/_react["default"].createElement(_grid.Grid, {
|
|
73
77
|
xScale: xBand,
|
|
74
78
|
yScale: scale.y,
|
|
75
79
|
className: (0, _classnames["default"])(classes.grid, className),
|
package/lib/grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/grid.jsx"],"names":["Grid","props","classes","className","graphProps","xBand","rowTickValues","columnTickValues","scale","size","y","grid","width","height","bandwidth","React","Component","PropTypes","object","isRequired","string","types","GraphPropsType","func","array","styles","stroke","color","primaryLight"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/grid.jsx"],"names":["Grid","props","classes","className","graphProps","xBand","rowTickValues","columnTickValues","scale","size","y","grid","width","height","bandwidth","React","Component","PropTypes","object","isRequired","string","types","GraphPropsType","func","array","styles","stroke","color","primaryLight"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;IAEaA,I;;;;;;;;;;;;;WAYX,kBAAS;AACP,wBAAmF,KAAKC,KAAxF;AAAA,UAAQC,OAAR,eAAQA,OAAR;AAAA,UAAiBC,SAAjB,eAAiBA,SAAjB;AAAA,UAA4BC,UA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ourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nimport { Grid as VxGrid } from '@vx/grid';\nimport { types } from '@pie-lib/plot';\nimport { color } from '@pie-lib/render-ui';\n\nexport class Grid extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n graphProps: types.GraphPropsType.isRequired,\n xBand: PropTypes.func,\n columnTickValues: PropTypes.array,\n rowTickValues: PropTypes.array\n };\n\n static defaultProps = {};\n\n render() {\n const { classes, className, graphProps, xBand, rowTickValues, columnTickValues } = this.props;\n const { scale = {}, size = {} } = graphProps || {};\n\n return (\n <VxGrid\n xScale={xBand}\n yScale={scale.y}\n className={classNames(classes.grid, className)}\n width={size.width}\n height={size.height}\n xOffset={xBand.bandwidth() / 2}\n rowTickValues={rowTickValues}\n columnTickValues={columnTickValues}\n />\n );\n }\n}\n\nconst styles = () => ({\n grid: {\n stroke: color.primaryLight()\n }\n});\n\nexport default withStyles(styles)(Grid);\n"],"file":"grid.js"}
|
|
@@ -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
|
});
|
|
@@ -19,9 +21,9 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
19
21
|
|
|
20
22
|
var _styles = require("../../common/styles");
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
var _excluded = ["x", "y", "graphProps", "classes", "className", "interactive", "CustomDraggableComponent", "correctness"];
|
|
23
25
|
|
|
24
|
-
function
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
27
|
|
|
26
28
|
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); }
|
|
27
29
|
|
|
@@ -33,29 +35,33 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
33
35
|
|
|
34
36
|
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); } }
|
|
35
37
|
|
|
36
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
38
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
37
39
|
|
|
38
|
-
function
|
|
40
|
+
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); }
|
|
39
41
|
|
|
40
|
-
function
|
|
42
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
41
43
|
|
|
42
|
-
function
|
|
44
|
+
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); }; }
|
|
43
45
|
|
|
44
|
-
function
|
|
46
|
+
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); }
|
|
45
47
|
|
|
46
|
-
function
|
|
48
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
49
|
+
|
|
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; } }
|
|
51
|
+
|
|
52
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
47
53
|
|
|
48
54
|
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; }
|
|
49
55
|
|
|
50
|
-
var RawDragHandle =
|
|
51
|
-
/*#__PURE__*/
|
|
52
|
-
function (_React$Component) {
|
|
56
|
+
var RawDragHandle = /*#__PURE__*/function (_React$Component) {
|
|
53
57
|
_inherits(RawDragHandle, _React$Component);
|
|
54
58
|
|
|
59
|
+
var _super = _createSuper(RawDragHandle);
|
|
60
|
+
|
|
55
61
|
function RawDragHandle() {
|
|
56
62
|
_classCallCheck(this, RawDragHandle);
|
|
57
63
|
|
|
58
|
-
return
|
|
64
|
+
return _super.apply(this, arguments);
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
_createClass(RawDragHandle, [{
|
|
@@ -70,10 +76,10 @@ function (_React$Component) {
|
|
|
70
76
|
interactive = _this$props.interactive,
|
|
71
77
|
CustomDraggableComponent = _this$props.CustomDraggableComponent,
|
|
72
78
|
correctness = _this$props.correctness,
|
|
73
|
-
rest = _objectWithoutProperties(_this$props,
|
|
79
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
74
80
|
|
|
75
81
|
var scale = graphProps.scale;
|
|
76
|
-
return _react["default"].createElement(CustomDraggableComponent, _extends({
|
|
82
|
+
return /*#__PURE__*/_react["default"].createElement(CustomDraggableComponent, _extends({
|
|
77
83
|
scale: scale,
|
|
78
84
|
x: x,
|
|
79
85
|
y: y,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/common/drag-handle.jsx"],"names":["RawDragHandle","props","x","y","graphProps","classes","className","interactive","CustomDraggableComponent","correctness","rest","scale","React","Component","PropTypes","number","isRequired","width","types","GraphPropsType","object","string","bool","func","shape","value","label","DragHandle","theme","handle","fill","color","secondary","transition","secondaryDark","line","stroke","DraggableHandle","axis","fromDelta","delta","newPoint","utils","point","add","bounds","domain","range","area","left","top","bottom","right","anchorPoint"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/line/common/drag-handle.jsx"],"names":["RawDragHandle","props","x","y","graphProps","classes","className","interactive","CustomDraggableComponent","correctness","rest","scale","React","Component","PropTypes","number","isRequired","width","types","GraphPropsType","object","string","bool","func","shape","value","label","DragHandle","theme","handle","fill","color","secondary","transition","secondaryDark","line","stroke","DraggableHandle","axis","fromDelta","delta","newPoint","utils","point","add","bounds","domain","range","area","left","top","bottom","right","anchorPoint"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEMA,a;;;;;;;;;;;;;WAgBJ,kBAAS;AACP,wBAUI,KAAKC,KAVT;AAAA,UACEC,CADF,eACEA,CADF;AAAA,UAEEC,CAFF,eAEEA,CA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,KAAK,EAAE;AAAjD,KAAb;AACA,WAAOV,YAAMG,MAAN,CAAaG,IAAb,EAAmBF,MAAnB,EAA2BC,KAA3B,CAAP;AACD,GAXmC;AAYpCM,EAAAA,WAAW,EAAE,qBAAApD,KAAK,EAAI;AACpB,WAAO;AAAEC,MAAAA,CAAC,EAAED,KAAK,CAACC,CAAX;AAAcC,MAAAA,CAAC,EAAEF,KAAK,CAACE;AAAvB,KAAP;AACD;AAdmC,CAAd,EAerBwB,UAfqB,CAAxB;eAiBeU,e","sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { gridDraggable, utils, types } from '@pie-lib/plot';\nimport { withStyles } from '@material-ui/core/styles/index';\nimport { color } from '@pie-lib/render-ui';\nimport PropTypes from 'prop-types';\nimport { correct, incorrect, disabled } from '../../common/styles';\n\nclass RawDragHandle extends React.Component {\n static propTypes = {\n x: PropTypes.number.isRequired,\n y: PropTypes.number.isRequired,\n width: PropTypes.number,\n graphProps: types.GraphPropsType.isRequired,\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n interactive: PropTypes.bool,\n CustomDraggableComponent: PropTypes.func,\n correctness: PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string\n })\n };\n\n render() {\n const {\n x,\n y,\n graphProps,\n classes,\n className,\n interactive,\n CustomDraggableComponent,\n correctness,\n ...rest\n } = this.props;\n const { scale } = graphProps;\n return (\n <CustomDraggableComponent\n scale={scale}\n x={x}\n y={y}\n classes={classes}\n className={classNames(className, !interactive && 'non-interactive')}\n correctness={interactive && correctness}\n {...rest}\n />\n );\n }\n}\n\nexport const DragHandle = withStyles(theme => ({\n handle: {\n fill: color.secondary(),\n transition: 'fill 200ms linear, height 200ms linear',\n '&:hover': {\n fill: color.secondaryDark()\n },\n '&.correct': correct('fill'),\n '&.incorrect': incorrect('fill'),\n '&.non-interactive': disabled('fill')\n },\n line: {\n stroke: color.secondary(),\n transition: 'fill 200ms linear, height 200ms linear',\n '&:hover': {\n stroke: color.secondaryDark()\n },\n '&.non-interactive': disabled('stroke'),\n '&.correct': correct('stroke'),\n '&.incorrect': incorrect('stroke')\n }\n}))(RawDragHandle);\n\nconst DraggableHandle = gridDraggable({\n axis: 'y',\n fromDelta: (props, delta) => {\n //TODO: should be in grid-draggable, if axis is y delta.x should always be 0.\n delta.x = 0;\n const newPoint = utils.point(props).add(utils.point(delta));\n return newPoint.y;\n },\n bounds: (props, { domain, range }) => {\n const area = { left: 0, top: props.y, bottom: props.y, right: 0 };\n return utils.bounds(area, domain, range);\n },\n anchorPoint: props => {\n return { x: props.x, y: props.y };\n }\n})(DragHandle);\n\nexport default DraggableHandle;\n"],"file":"drag-handle.js"}
|
package/lib/line/common/line.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.
|
|
8
|
+
exports["default"] = exports.RawLine = exports.Line = void 0;
|
|
7
9
|
|
|
8
10
|
var _react = _interopRequireDefault(require("react"));
|
|
9
11
|
|
|
@@ -23,41 +25,49 @@ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
|
23
25
|
|
|
24
26
|
var _renderUi = require("@pie-lib/render-ui");
|
|
25
27
|
|
|
26
|
-
function
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
29
|
|
|
28
|
-
function
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
31
|
|
|
30
|
-
function
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
31
33
|
|
|
32
34
|
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); }
|
|
33
35
|
|
|
34
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
36
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
37
|
+
|
|
38
|
+
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."); }
|
|
35
39
|
|
|
36
|
-
function
|
|
40
|
+
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); }
|
|
37
41
|
|
|
38
|
-
function _iterableToArray(iter) { if (Symbol.iterator
|
|
42
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
39
43
|
|
|
40
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr))
|
|
44
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
45
|
+
|
|
46
|
+
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
47
|
|
|
42
48
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
43
49
|
|
|
44
50
|
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); } }
|
|
45
51
|
|
|
46
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
52
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
47
53
|
|
|
48
|
-
function
|
|
54
|
+
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); }
|
|
49
55
|
|
|
50
|
-
function
|
|
56
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
57
|
+
|
|
58
|
+
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); }; }
|
|
59
|
+
|
|
60
|
+
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); }
|
|
51
61
|
|
|
52
62
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
53
63
|
|
|
54
|
-
function
|
|
64
|
+
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; } }
|
|
55
65
|
|
|
56
|
-
function
|
|
66
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
57
67
|
|
|
58
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
68
|
+
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; }
|
|
59
69
|
|
|
60
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
70
|
+
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; }
|
|
61
71
|
|
|
62
72
|
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; }
|
|
63
73
|
|
|
@@ -72,24 +82,24 @@ var getData = function getData(data, domain) {
|
|
|
72
82
|
}
|
|
73
83
|
|
|
74
84
|
return data.map(function (el, i) {
|
|
75
|
-
return _objectSpread({}, el, {
|
|
85
|
+
return _objectSpread(_objectSpread({}, el), {}, {
|
|
76
86
|
x: length > 1 ? i * (max / (length - 1)) : 0.5,
|
|
77
87
|
y: el.value
|
|
78
88
|
});
|
|
79
89
|
});
|
|
80
90
|
};
|
|
81
91
|
|
|
82
|
-
var RawLine =
|
|
83
|
-
/*#__PURE__*/
|
|
84
|
-
function (_React$Component) {
|
|
92
|
+
var RawLine = /*#__PURE__*/function (_React$Component) {
|
|
85
93
|
_inherits(RawLine, _React$Component);
|
|
86
94
|
|
|
95
|
+
var _super = _createSuper(RawLine);
|
|
96
|
+
|
|
87
97
|
function RawLine(props) {
|
|
88
98
|
var _this;
|
|
89
99
|
|
|
90
100
|
_classCallCheck(this, RawLine);
|
|
91
101
|
|
|
92
|
-
_this =
|
|
102
|
+
_this = _super.call(this, props);
|
|
93
103
|
|
|
94
104
|
_defineProperty(_assertThisInitialized(_this), "setDragValue", function (line) {
|
|
95
105
|
return _this.setState({
|
|
@@ -146,7 +156,7 @@ function (_React$Component) {
|
|
|
146
156
|
dragging = _this$state.dragging;
|
|
147
157
|
var scale = graphProps.scale;
|
|
148
158
|
var lineToUse = dragging ? lineState : getData(data, graphProps.domain);
|
|
149
|
-
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_shape.LinePath, {
|
|
159
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_shape.LinePath, {
|
|
150
160
|
data: lineToUse,
|
|
151
161
|
x: function x(d) {
|
|
152
162
|
return scale.x(d.x);
|
|
@@ -158,7 +168,7 @@ function (_React$Component) {
|
|
|
158
168
|
}), lineToUse && lineToUse.map(function (point, i) {
|
|
159
169
|
var r = 6;
|
|
160
170
|
var Component = point.interactive ? _dragHandle["default"] : _dragHandle.DragHandle;
|
|
161
|
-
return _react["default"].createElement(Component, {
|
|
171
|
+
return /*#__PURE__*/_react["default"].createElement(Component, {
|
|
162
172
|
key: "point-".concat(point.x, "-").concat(i),
|
|
163
173
|
x: point.x,
|
|
164
174
|
y: point.dragValue !== undefined ? point.dragValue : point.y,
|
|
@@ -222,14 +232,12 @@ var StyledLine = (0, _index.withStyles)(function (theme) {
|
|
|
222
232
|
};
|
|
223
233
|
})(RawLine);
|
|
224
234
|
|
|
225
|
-
var Line =
|
|
226
|
-
/*#__PURE__*/
|
|
227
|
-
function (_React$Component2) {
|
|
235
|
+
var Line = /*#__PURE__*/function (_React$Component2) {
|
|
228
236
|
_inherits(Line, _React$Component2);
|
|
229
237
|
|
|
230
|
-
|
|
231
|
-
var _getPrototypeOf2;
|
|
238
|
+
var _super2 = _createSuper(Line);
|
|
232
239
|
|
|
240
|
+
function Line() {
|
|
233
241
|
var _this3;
|
|
234
242
|
|
|
235
243
|
_classCallCheck(this, Line);
|
|
@@ -238,7 +246,7 @@ function (_React$Component2) {
|
|
|
238
246
|
args[_key] = arguments[_key];
|
|
239
247
|
}
|
|
240
248
|
|
|
241
|
-
_this3 =
|
|
249
|
+
_this3 = _super2.call.apply(_super2, [this].concat(args));
|
|
242
250
|
|
|
243
251
|
_defineProperty(_assertThisInitialized(_this3), "changeLine", function (index, category) {
|
|
244
252
|
var onChange = _this3.props.onChange;
|
|
@@ -258,7 +266,7 @@ function (_React$Component2) {
|
|
|
258
266
|
key: "render",
|
|
259
267
|
value: function render() {
|
|
260
268
|
var props = this.props;
|
|
261
|
-
return _react["default"].createElement(_group.Group, null, _react["default"].createElement(StyledLine, _extends({}, props, {
|
|
269
|
+
return /*#__PURE__*/_react["default"].createElement(_group.Group, null, /*#__PURE__*/_react["default"].createElement(StyledLine, _extends({}, props, {
|
|
262
270
|
onChange: this.changeLine
|
|
263
271
|
})));
|
|
264
272
|
}
|