@pie-lib/graphing 2.4.7 → 2.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/lib/axis/arrow.js +22 -18
- package/lib/axis/arrow.js.map +1 -1
- package/lib/axis/axes.js +74 -78
- package/lib/axis/axes.js.map +1 -1
- package/lib/axis/index.js +5 -1
- package/lib/axis/index.js.map +1 -1
- package/lib/bg.js +16 -14
- package/lib/bg.js.map +1 -1
- package/lib/container/index.js +21 -15
- package/lib/container/index.js.map +1 -1
- package/lib/coordinates-label.js +4 -4
- package/lib/coordinates-label.js.map +1 -1
- package/lib/graph-with-controls.js +29 -25
- package/lib/graph-with-controls.js.map +1 -1
- package/lib/graph.js +58 -45
- package/lib/graph.js.map +1 -1
- package/lib/grid.js +20 -14
- package/lib/grid.js.map +1 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/labels.js +28 -24
- package/lib/labels.js.map +1 -1
- package/lib/mark-label.js +16 -8
- package/lib/mark-label.js.map +1 -1
- package/lib/toggle-bar.js +18 -16
- package/lib/toggle-bar.js.map +1 -1
- package/lib/tool-menu.js +22 -16
- package/lib/tool-menu.js.map +1 -1
- package/lib/tools/circle/bg-circle.js +26 -18
- package/lib/tools/circle/bg-circle.js.map +1 -1
- package/lib/tools/circle/component.js +30 -28
- package/lib/tools/circle/component.js.map +1 -1
- package/lib/tools/circle/index.js +4 -4
- package/lib/tools/circle/index.js.map +1 -1
- package/lib/tools/index.js +16 -15
- package/lib/tools/index.js.map +1 -1
- package/lib/tools/line/component.js +17 -7
- package/lib/tools/line/component.js.map +1 -1
- package/lib/tools/parabola/component.js.map +1 -1
- package/lib/tools/parabola/index.js +4 -4
- package/lib/tools/parabola/index.js.map +1 -1
- package/lib/tools/point/component.js +21 -17
- package/lib/tools/point/component.js.map +1 -1
- package/lib/tools/point/index.js +2 -2
- package/lib/tools/polygon/component.js +55 -47
- package/lib/tools/polygon/component.js.map +1 -1
- package/lib/tools/polygon/index.js +12 -8
- package/lib/tools/polygon/index.js.map +1 -1
- package/lib/tools/polygon/line.js +26 -18
- package/lib/tools/polygon/line.js.map +1 -1
- package/lib/tools/polygon/polygon.js +26 -18
- package/lib/tools/polygon/polygon.js.map +1 -1
- package/lib/tools/ray/component.js +17 -7
- package/lib/tools/ray/component.js.map +1 -1
- package/lib/tools/segment/component.js +4 -2
- package/lib/tools/segment/component.js.map +1 -1
- package/lib/tools/shared/arrow-head.js +4 -4
- package/lib/tools/shared/arrow-head.js.map +1 -1
- package/lib/tools/shared/line/index.js +46 -44
- package/lib/tools/shared/line/index.js.map +1 -1
- package/lib/tools/shared/line/line-path.js +28 -20
- package/lib/tools/shared/line/line-path.js.map +1 -1
- package/lib/tools/shared/line/with-root-edge.js +8 -6
- package/lib/tools/shared/line/with-root-edge.js.map +1 -1
- package/lib/tools/shared/point/arrow-point.js +21 -15
- package/lib/tools/shared/point/arrow-point.js.map +1 -1
- package/lib/tools/shared/point/arrow.js +21 -15
- package/lib/tools/shared/point/arrow.js.map +1 -1
- package/lib/tools/shared/point/base-point.js +22 -16
- package/lib/tools/shared/point/base-point.js.map +1 -1
- package/lib/tools/shared/point/index.js +8 -4
- package/lib/tools/shared/point/index.js.map +1 -1
- package/lib/tools/shared/styles.js +1 -1
- package/lib/tools/shared/types.js +1 -1
- package/lib/tools/sine/component.js.map +1 -1
- package/lib/tools/sine/index.js +4 -4
- package/lib/tools/sine/index.js.map +1 -1
- package/lib/tools/vector/component.js +4 -2
- package/lib/tools/vector/component.js.map +1 -1
- package/lib/undo-redo.js +20 -16
- package/lib/undo-redo.js.map +1 -1
- package/lib/use-debounce.js +7 -3
- package/lib/use-debounce.js.map +1 -1
- package/lib/utils.js +93 -5
- package/lib/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/axis/arrow.jsx +5 -5
- package/src/axis/axes.jsx +25 -36
- package/src/graph.jsx +16 -10
- package/src/tools/line/component.jsx +4 -2
- package/src/tools/ray/component.jsx +4 -2
- package/src/utils.js +87 -4
|
@@ -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.
|
|
8
|
+
exports.RawLinePath = exports.LinePath = void 0;
|
|
7
9
|
|
|
8
10
|
var _react = _interopRequireDefault(require("react"));
|
|
9
11
|
|
|
@@ -21,15 +23,17 @@ var vx = _interopRequireWildcard(require("@vx/shape"));
|
|
|
21
23
|
|
|
22
24
|
var _renderUi = require("@pie-lib/render-ui");
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
var _excluded = ["data", "classes", "className", "disabled", "correctness", "from", "to", "graphProps", "isDragging"];
|
|
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; }
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
33
|
|
|
30
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
34
|
+
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; }
|
|
31
35
|
|
|
32
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
36
|
+
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; }
|
|
33
37
|
|
|
34
38
|
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); }
|
|
35
39
|
|
|
@@ -41,29 +45,33 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
41
45
|
|
|
42
46
|
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
47
|
|
|
44
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
48
|
+
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
49
|
|
|
46
|
-
function
|
|
50
|
+
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
51
|
|
|
48
|
-
function
|
|
52
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
49
53
|
|
|
50
|
-
function
|
|
54
|
+
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); }; }
|
|
51
55
|
|
|
52
|
-
function
|
|
56
|
+
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); }
|
|
53
57
|
|
|
54
|
-
function
|
|
58
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
59
|
+
|
|
60
|
+
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; } }
|
|
61
|
+
|
|
62
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
55
63
|
|
|
56
64
|
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
65
|
|
|
58
|
-
var RawLinePath =
|
|
59
|
-
/*#__PURE__*/
|
|
60
|
-
function (_React$Component) {
|
|
66
|
+
var RawLinePath = /*#__PURE__*/function (_React$Component) {
|
|
61
67
|
_inherits(RawLinePath, _React$Component);
|
|
62
68
|
|
|
69
|
+
var _super = _createSuper(RawLinePath);
|
|
70
|
+
|
|
63
71
|
function RawLinePath() {
|
|
64
72
|
_classCallCheck(this, RawLinePath);
|
|
65
73
|
|
|
66
|
-
return
|
|
74
|
+
return _super.apply(this, arguments);
|
|
67
75
|
}
|
|
68
76
|
|
|
69
77
|
_createClass(RawLinePath, [{
|
|
@@ -80,14 +88,14 @@ function (_React$Component) {
|
|
|
80
88
|
to = _this$props.to,
|
|
81
89
|
graphProps = _this$props.graphProps,
|
|
82
90
|
isDragging = _this$props.isDragging,
|
|
83
|
-
rest = _objectWithoutProperties(_this$props,
|
|
91
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
84
92
|
/* eslint-enable */
|
|
85
93
|
|
|
86
94
|
|
|
87
|
-
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(vx.LinePath, _extends({
|
|
95
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(vx.LinePath, _extends({
|
|
88
96
|
data: data,
|
|
89
97
|
className: (0, _classnames["default"])(classes.drawLine, disabled && classes.disabled, classes[correctness], className)
|
|
90
|
-
}, rest)), _react["default"].createElement(vx.LinePath, _extends({
|
|
98
|
+
}, rest)), /*#__PURE__*/_react["default"].createElement(vx.LinePath, _extends({
|
|
91
99
|
data: data,
|
|
92
100
|
className: (0, _classnames["default"])(classes.line, isDragging && classes.dragging, disabled && classes.disabled, classes[correctness], className)
|
|
93
101
|
}, rest)));
|
|
@@ -138,7 +146,7 @@ var LinePath = (0, _styles.withStyles)(function (theme) {
|
|
|
138
146
|
'&:hover': dragging(theme)
|
|
139
147
|
},
|
|
140
148
|
dragging: dragging(theme),
|
|
141
|
-
disabled: _objectSpread({}, (0, _styles2.disabled)('stroke'), {
|
|
149
|
+
disabled: _objectSpread(_objectSpread({}, (0, _styles2.disabled)('stroke')), {}, {
|
|
142
150
|
strokeWidth: 2
|
|
143
151
|
}),
|
|
144
152
|
correct: _objectSpread({}, (0, _styles2.correct)('stroke')),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/tools/shared/line/line-path.jsx"],"names":["RawLinePath","props","data","classes","className","disabled","correctness","from","to","graphProps","isDragging","rest","drawLine","line","dragging","React","Component","PropTypes","string","object","arrayOf","number","types","GraphPropsType","isRequired","bool","PointType","strokeWidth","stroke","color","secondaryLight","LinePath","theme","fill","transition","correct","incorrect"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/tools/shared/line/line-path.jsx"],"names":["RawLinePath","props","data","classes","className","disabled","correctness","from","to","graphProps","isDragging","rest","drawLine","line","dragging","React","Component","PropTypes","string","object","arrayOf","number","types","GraphPropsType","isRequired","bool","PointType","strokeWidth","stroke","color","secondaryLight","LinePath","theme","fill","transition","correct","incorrect"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEaA,W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AA,WAAW,EAAEW,sBAAUC,MANN;AAOjBX,EAAAA,IAAI,EAAEe,YAAMI,SAPK;AAQjBlB,EAAAA,EAAE,EAAEc,YAAMI,SARO;AASjBhB,EAAAA,UAAU,EAAEO,sBAAUQ;AATL,C;;gBADRzB,W,kBAaW;AACpBO,EAAAA,IAAI,EAAE,EADc;AAEpBC,EAAAA,EAAE,EAAE;AAFgB,C;;AAiDxB,IAAMM,QAAQ,GAAG,SAAXA,QAAW;AAAA,SAAO;AACtBa,IAAAA,WAAW,EAAE,CADS;AAEtBC,IAAAA,MAAM,EAAEC,gBAAMC,cAAN;AAFc,GAAP;AAAA,CAAjB;;AAKO,IAAMC,QAAQ,GAAG,wBAAW,UAAAC,KAAK;AAAA,SAAK;AAC3CpB,IAAAA,QAAQ,EAAE;AACRqB,MAAAA,IAAI,EAAE,MADE;AAERN,MAAAA,WAAW,EAAE,CAFL;AAGRC,MAAAA,MAAM,EAAEC,gBAAMC,cAAN;AAHA,KADiC;AAM3CjB,IAAAA,IAAI,EAAE;AACJc,MAAAA,WAAW,EAAE,CADT;AAEJM,MAAAA,IAAI,EAAE,MAFF;AAGJC,MAAAA,UAAU,EAAE,kDAHR;AAIJN,MAAAA,MAAM,EAAE,aAJJ;AAKJ,iBAAWd,QAAQ,CAACkB,KAAD;AALf,KANqC;AAa3ClB,IAAAA,QAAQ,EAAEA,QAAQ,CAACkB,KAAD,CAbyB;AAc3C3B,IAAAA,QAAQ,kCACH,uBAAS,QAAT,CADG;AAENsB,MAAAA,WAAW,EAAE;AAFP,MAdmC;AAkB3CQ,IAAAA,OAAO,oBACF,sBAAQ,QAAR,CADE,CAlBoC;AAqB3CC,IAAAA,SAAS,oBACJ,wBAAU,QAAV,CADI;AArBkC,GAAL;AAAA,CAAhB,EAwBpBpC,WAxBoB,CAAjB","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { types } from '@pie-lib/plot';\nimport classNames from 'classnames';\nimport { disabled, correct, incorrect } from '../styles';\nimport * as vx from '@vx/shape';\nimport { color } from '@pie-lib/render-ui';\n\nexport class RawLinePath extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n classes: PropTypes.object,\n data: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),\n graphProps: types.GraphPropsType.isRequired,\n disabled: PropTypes.bool,\n correctness: PropTypes.string,\n from: types.PointType,\n to: types.PointType,\n isDragging: PropTypes.bool\n };\n\n static defaultProps = {\n from: {},\n to: {}\n };\n\n render() {\n /* eslint-disable no-unused-vars */\n const {\n data,\n classes,\n className,\n disabled,\n correctness,\n from,\n to,\n graphProps,\n isDragging,\n ...rest\n } = this.props;\n /* eslint-enable */\n\n return (\n <React.Fragment>\n <vx.LinePath\n data={data}\n className={classNames(\n classes.drawLine,\n disabled && classes.disabled,\n classes[correctness],\n className\n )}\n {...rest}\n />\n <vx.LinePath\n data={data}\n className={classNames(\n classes.line,\n isDragging && classes.dragging,\n disabled && classes.disabled,\n classes[correctness],\n className\n )}\n {...rest}\n />\n </React.Fragment>\n );\n }\n}\n\nconst dragging = () => ({\n strokeWidth: 7,\n stroke: color.secondaryLight()\n});\n\nexport const LinePath = withStyles(theme => ({\n drawLine: {\n fill: 'none',\n strokeWidth: 2,\n stroke: color.secondaryLight()\n },\n line: {\n strokeWidth: 6,\n fill: 'none',\n transition: 'stroke-width 200ms ease-in, stroke 200ms ease-in',\n stroke: 'transparent',\n '&:hover': dragging(theme)\n },\n dragging: dragging(theme),\n disabled: {\n ...disabled('stroke'),\n strokeWidth: 2\n },\n correct: {\n ...correct('stroke')\n },\n incorrect: {\n ...incorrect('stroke')\n }\n}))(RawLinePath);\n"],"file":"line-path.js"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.withRootEdge = exports.
|
|
6
|
+
exports.withRootEdge = exports.rootEdgeToFromToWrapper = exports.rootEdgeComponent = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -17,6 +17,8 @@ var _curve = require("@vx/curve");
|
|
|
17
17
|
|
|
18
18
|
var _index = require("./index");
|
|
19
19
|
|
|
20
|
+
var _excluded = ["graphProps", "from", "to", "onClick", "onDragStart", "onDragStop", "onChange", "disabled", "correctness"];
|
|
21
|
+
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
23
|
|
|
22
24
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
@@ -25,9 +27,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
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
|
|
|
28
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
30
|
+
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; }
|
|
29
31
|
|
|
30
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
32
|
+
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; }
|
|
31
33
|
|
|
32
34
|
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; }
|
|
33
35
|
|
|
@@ -59,7 +61,7 @@ var rootEdgeToFromToWrapper = function rootEdgeToFromToWrapper(BaseComp) {
|
|
|
59
61
|
props.onChange(toRootEdge(current), toRootEdge(next));
|
|
60
62
|
};
|
|
61
63
|
|
|
62
|
-
return _react["default"].createElement(BaseComp, _extends({}, props, {
|
|
64
|
+
return /*#__PURE__*/_react["default"].createElement(BaseComp, _extends({}, props, {
|
|
63
65
|
mark: m,
|
|
64
66
|
onChange: onChange
|
|
65
67
|
}));
|
|
@@ -92,7 +94,7 @@ var withPointsGenerationLinePath = function withPointsGenerationLinePath(getPoin
|
|
|
92
94
|
onChange = props.onChange,
|
|
93
95
|
disabled = props.disabled,
|
|
94
96
|
correctness = props.correctness,
|
|
95
|
-
rest = _objectWithoutProperties(props,
|
|
97
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
96
98
|
|
|
97
99
|
var _getPoints = getPoints({
|
|
98
100
|
graphProps: props.graphProps,
|
|
@@ -113,7 +115,7 @@ var withPointsGenerationLinePath = function withPointsGenerationLinePath(getPoin
|
|
|
113
115
|
disabled: disabled,
|
|
114
116
|
correctness: correctness
|
|
115
117
|
};
|
|
116
|
-
return _react["default"].createElement(_linePath.LinePath, _extends({
|
|
118
|
+
return /*#__PURE__*/_react["default"].createElement(_linePath.LinePath, _extends({
|
|
117
119
|
data: raw,
|
|
118
120
|
from: from,
|
|
119
121
|
to: to,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/tools/shared/line/with-root-edge.jsx"],"names":["toRootEdge","m","out","root","from","edge","to","undefined","toFromTo","rootEdgeToFromToWrapper","BaseComp","Wrapper","props","mark","onChange","current","next","propTypes","PropTypes","func","object","rootEdgeComponent","RootEdgeComp","BaseComponent","withPointsGenerationLinePath","getPoints","LinePathComponent","graphProps","onClick","onDragStart","onDragStop","disabled","correctness","rest","dataPoints","raw","map","d","scale","x","y","common","curveMonotoneX","types","GraphPropsType","isRequired","PointType","bool","string","withRootEdge","LinePathComp"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA
|
|
1
|
+
{"version":3,"sources":["../../../../src/tools/shared/line/with-root-edge.jsx"],"names":["toRootEdge","m","out","root","from","edge","to","undefined","toFromTo","rootEdgeToFromToWrapper","BaseComp","Wrapper","props","mark","onChange","current","next","propTypes","PropTypes","func","object","rootEdgeComponent","RootEdgeComp","BaseComponent","withPointsGenerationLinePath","getPoints","LinePathComponent","graphProps","onClick","onDragStart","onDragStop","disabled","correctness","rest","dataPoints","raw","map","d","scale","x","y","common","curveMonotoneX","types","GraphPropsType","isRequired","PointType","bool","string","withRootEdge","LinePathComp"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;AAEA,IAAMA,UAAU,GAAG,SAAbA,UAAa,CAAAC,CAAC,EAAI;AACtB,MAAMC,GAAG,qBAAQD,CAAR,CAAT;;AACAC,EAAAA,GAAG,CAACC,IAAJ,qBAAgBF,CAAC,CAACG,IAAlB;AACAF,EAAAA,GAAG,CAACG,IAAJ,GAAWJ,CAAC,CAACK,EAAF,qBAAYL,CAAC,CAACK,EAAd,IAAqBC,SAAhC;AACA,SAAOL,GAAG,CAACE,IAAX;AACA,SAAOF,GAAG,CAACI,EAAX;AACA,SAAOJ,GAAP;AACD,CAPD;;AASA,IAAMM,QAAQ,GAAG,SA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,gCAAC,kBAAD;AAAU,MAAA,IAAI,EAAEG,GAAhB;AAAqB,MAAA,IAAI,EAAE/B,IAA3B;AAAiC,MAAA,EAAE,EAAEE,EAArC;AAAyC,MAAA,KAAK,EAAEoC;AAAhD,OAAoED,MAApE,EAAgFR,IAAhF,EAAP;AACD,GAhCD;;AAiCAP,EAAAA,iBAAiB,CAACT,SAAlB,GAA8B;AAC5BU,IAAAA,UAAU,EAAEgB,YAAMC,cAAN,CAAqBC,UADL;AAE5BzC,IAAAA,IAAI,EAAEuC,YAAMG,SAAN,CAAgBD,UAFM;AAG5BvC,IAAAA,EAAE,EAAEqC,YAAMG,SAHkB;AAI5BlB,IAAAA,OAAO,EAAEV,sBAAUC,IAJS;AAK5BU,IAAAA,WAAW,EAAEX,sBAAUC,IALK;AAM5BW,IAAAA,UAAU,EAAEZ,sBAAUC,IANM;AAO5BL,IAAAA,QAAQ,EAAEI,sBAAUC,IAPQ;AAQ5BY,IAAAA,QAAQ,EAAEb,sBAAU6B,IARQ;AAS5Bf,IAAAA,WAAW,EAAEd,sBAAU8B;AATK,GAA9B;AAWA,SAAOtB,iBAAP;AACD,CA9CD;;AAgDO,IAAMuB,YAAY,GAAG,SAAfA,YAAe,CAAAxB,SAAS,EAAI;AACvC,MAAMyB,YAAY,GAAG1B,4BAA4B,CAACC,SAAD,CAAjD;AACA,SAAO,qBAASyB,YAAT,CAAP;AACD,CAHM","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { LinePath } from '../line/line-path';\nimport { curveMonotoneX } from '@vx/curve';\nimport { lineBase, lineToolComponent } from './index';\n\nconst toRootEdge = m => {\n const out = { ...m };\n out.root = { ...m.from };\n out.edge = m.to ? { ...m.to } : undefined;\n delete out.from;\n delete out.to;\n return out;\n};\n\nconst toFromTo = m => {\n const out = { ...m };\n out.from = { ...m.root };\n out.to = m.edge ? { ...m.edge } : undefined;\n delete out.root;\n delete out.edge;\n return out;\n};\n\nexport const rootEdgeToFromToWrapper = BaseComp => {\n const Wrapper = props => {\n const m = toFromTo(props.mark);\n\n const onChange = (current, next) => {\n props.onChange(toRootEdge(current), toRootEdge(next));\n };\n\n return <BaseComp {...props} mark={m} onChange={onChange} />;\n };\n\n Wrapper.propTypes = {\n onChange: PropTypes.func,\n mark: PropTypes.object\n };\n\n return Wrapper;\n};\n\nexport const rootEdgeComponent = RootEdgeComp => {\n const BaseComponent = lineToolComponent(RootEdgeComp);\n return rootEdgeToFromToWrapper(BaseComponent);\n};\n\nconst withPointsGenerationLinePath = getPoints => {\n const LinePathComponent = props => {\n const {\n graphProps,\n from,\n to,\n onClick,\n onDragStart,\n onDragStop,\n onChange,\n disabled,\n correctness,\n ...rest\n } = props;\n\n const { dataPoints } = getPoints({\n graphProps: props.graphProps,\n root: from,\n edge: to\n });\n const raw = dataPoints.map(d => [graphProps.scale.x(d.x), graphProps.scale.y(d.y)]);\n\n const common = {\n onClick,\n graphProps,\n onDragStart,\n onDragStop,\n onChange,\n disabled,\n correctness\n };\n\n return <LinePath data={raw} from={from} to={to} curve={curveMonotoneX} {...common} {...rest} />;\n };\n LinePathComponent.propTypes = {\n graphProps: types.GraphPropsType.isRequired,\n from: types.PointType.isRequired,\n to: types.PointType,\n onClick: PropTypes.func,\n onDragStart: PropTypes.func,\n onDragStop: PropTypes.func,\n onChange: PropTypes.func,\n disabled: PropTypes.bool,\n correctness: PropTypes.string\n };\n return LinePathComponent;\n};\n\nexport const withRootEdge = getPoints => {\n const LinePathComp = withPointsGenerationLinePath(getPoints);\n return lineBase(LinePathComp);\n};\n"],"file":"with-root-edge.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
|
});
|
|
@@ -17,9 +19,9 @@ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
|
17
19
|
|
|
18
20
|
var _utils = require("../../../utils");
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
var _excluded = ["classes", "className", "x", "y", "disabled", "correctness", "graphProps", "from", "to"];
|
|
21
23
|
|
|
22
|
-
function
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
25
|
|
|
24
26
|
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); }
|
|
25
27
|
|
|
@@ -31,29 +33,33 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
31
33
|
|
|
32
34
|
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); } }
|
|
33
35
|
|
|
34
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
36
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
35
37
|
|
|
36
|
-
function
|
|
38
|
+
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); }
|
|
37
39
|
|
|
38
|
-
function
|
|
40
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
41
|
|
|
40
|
-
function
|
|
42
|
+
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); }; }
|
|
41
43
|
|
|
42
|
-
function
|
|
44
|
+
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); }
|
|
43
45
|
|
|
44
|
-
function
|
|
46
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
47
|
+
|
|
48
|
+
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; } }
|
|
49
|
+
|
|
50
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
45
51
|
|
|
46
52
|
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; }
|
|
47
53
|
|
|
48
|
-
var RawArrow =
|
|
49
|
-
/*#__PURE__*/
|
|
50
|
-
function (_React$Component) {
|
|
54
|
+
var RawArrow = /*#__PURE__*/function (_React$Component) {
|
|
51
55
|
_inherits(RawArrow, _React$Component);
|
|
52
56
|
|
|
57
|
+
var _super = _createSuper(RawArrow);
|
|
58
|
+
|
|
53
59
|
function RawArrow() {
|
|
54
60
|
_classCallCheck(this, RawArrow);
|
|
55
61
|
|
|
56
|
-
return
|
|
62
|
+
return _super.apply(this, arguments);
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
_createClass(RawArrow, [{
|
|
@@ -69,7 +75,7 @@ function (_React$Component) {
|
|
|
69
75
|
graphProps = _this$props.graphProps,
|
|
70
76
|
from = _this$props.from,
|
|
71
77
|
to = _this$props.to,
|
|
72
|
-
rest = _objectWithoutProperties(_this$props,
|
|
78
|
+
rest = _objectWithoutProperties(_this$props, _excluded); // x & y are the initial coordinates for the arrow
|
|
73
79
|
// from & to are used only to calculate the angle that the arrow should be rotated with
|
|
74
80
|
|
|
75
81
|
|
|
@@ -83,9 +89,9 @@ function (_React$Component) {
|
|
|
83
89
|
points = "0,0 ".concat(_utils.arrowDimensions.vector, ",").concat(_utils.arrowDimensions.vector * 2, " \n -").concat(_utils.arrowDimensions.vector, ",").concat(_utils.arrowDimensions.vector * 2);
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
return _react["default"].createElement("g", _extends({
|
|
92
|
+
return /*#__PURE__*/_react["default"].createElement("g", _extends({
|
|
87
93
|
className: (0, _classnames["default"])(classes.point, disabled && classes.disabled, classes[correctness], className)
|
|
88
|
-
}, rest), _react["default"].createElement("polygon", {
|
|
94
|
+
}, rest), /*#__PURE__*/_react["default"].createElement("polygon", {
|
|
89
95
|
points: points,
|
|
90
96
|
transform: "\n translate(".concat(scale.x(x), ", ").concat(scale.y(y), ")\n rotate(").concat(angle, " 0 0)")
|
|
91
97
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/tools/shared/point/arrow-point.jsx"],"names":["RawArrow","props","classes","className","x","y","disabled","correctness","graphProps","from","to","rest","scale","angle","points","arrowDimensions","vector","point","React","Component","PropTypes","object","string","bool","number","shape","isRequired","types","GraphPropsType"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/tools/shared/point/arrow-point.jsx"],"names":["RawArrow","props","classes","className","x","y","disabled","correctness","graphProps","from","to","rest","scale","angle","points","arrowDimensions","vector","point","React","Component","PropTypes","object","string","bool","number","shape","isRequired","types","GraphPropsType"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEaA,Q;;;;;;;;;;;;;WAwBX,kBAAS;AACP,wBAWI,KAAKC,KAXT;AAAA,UACEC,OADF,eACEA,OADF;AAAA,UAEEC,SAFF,eAEEA,SAFF;AAAA,UAGEC,CAHF,eAGEA,CAHF;AAAA,UAIEC,CAJF,eAIEA,CAJF;AAAA,UAKEC,QALF,eAKEA,QALF;AAAA,UAMEC,WANF,eAMEA,WANF;AAAA,UAOEC,UAPF,eAOEA,UAPF;AAAA,UAQEC,IARF,eAQEA,IARF;AAAA,UASEC,EATF,eASEA,EATF;AAAA,UAUKC,IAVL,oDADO,CAaP;AACA;;;AAEA,UAAQC,KAAR,GAAkBJ,UAAlB,CAAQI,KAAR;AACA,UAAMC,KAAK,GAAG,wBAAYJ,IAAI,CAACL,CAAjB,EAAoBK,IAAI,CAACJ,CAAzB,EAA4BK,EAAE,CAACN,CAA/B,EAAkCM,EAAE,CAACL,CAArC,CAAd;AAEA,UAAIS,MAAM,GAAG,EAAb;;AAEA,UAAI,yBAAQL,IAAR,EAAcC,EAAd,CAAJ,EAAuB;AACrBI,QAAAA,MAAM,GAAG,aAAT;AACD,OAFD,MAEO;AACLA,QAAAA,MAAM,iBAAUC,uBAAgBC,MAA1B,cAAoCD,uBAAgBC,MAAhB,GAAyB,CAA7D,uBACHD,uBAAgBC,MADb,cACuBD,uBAAgBC,MAAhB,GAAyB,CADhD,CAAN;AAED;;AAED,0BACE;AACE,QAAA,SAAS,EAAE,4BACTd,OAAO,CAACe,KADC,EAETX,QAAQ,IAAIJ,OAAO,CAACI,QAFX,EAGTJ,OAAO,CAACK,WAAD,CAHE,EAITJ,SAJS;AADb,SAOMQ,IAPN,gBASE;AACE,QAAA,MAAM,EAAEG,MADV;AAEE,QAAA,SAAS,kCACGF,KAAK,CAACR,CAAN,CAAQA,CAAR,CADH,eACkBQ,KAAK,CAACP,CAAN,CAAQA,CAAR,CADlB,iCAEAQ,KAFA;AAFX,QATF,CADF;AAkBD;;;;EAtE2BK,kBAAMC,S;;;;gBAAvBnB,Q,eACQ;AACjBE,EAAAA,OAAO,EAAEkB,sBAAUC,MADF;AAEjBlB,EAAAA,SAAS,EAAEiB,sBAAUE,MAFJ;AAGjBf,EAAAA,WAAW,EAAEa,sBAAUE,MAHN;AAIjBhB,EAAAA,QAAQ,EAAEc,sBAAUG,IAJH;AAKjBnB,EAAAA,CAAC,EAAEgB,sBAAUI,MALI;AAMjBnB,EAAAA,CAAC,EAAEe,sBAAUI,MANI;AAOjBf,EAAAA,IAAI,EAAEW,sBAAUK,KAAV,CAAgB;AACpBrB,IAAAA,CAAC,EAAEgB,sBAAUI,MADO;AAEpBnB,IAAAA,CAAC,EAAEe,sBAAUI;AAFO,GAAhB,EAGHE,UAVc;AAWjBhB,EAAAA,EAAE,EAAEU,sBAAUK,KAAV,CAAgB;AAClBrB,IAAAA,CAAC,EAAEgB,sBAAUI,MADK;AAElBnB,IAAAA,CAAC,EAAEe,sBAAUI;AAFK,GAAhB,CAXa;AAejBhB,EAAAA,UAAU,EAAEmB,YAAMC,cAAN,CAAqBF;AAfhB,C;;gBADR1B,Q,kBAmBW;AACpBS,EAAAA,IAAI,EAAE,EADc;AAEpBC,EAAAA,EAAE,EAAE;AAFgB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { types } from '@pie-lib/plot';\nimport isEqual from 'lodash/isEqual';\nimport { getAngleDeg, arrowDimensions } from '../../../utils';\n\nexport class RawArrow extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n className: PropTypes.string,\n correctness: PropTypes.string,\n disabled: PropTypes.bool,\n x: PropTypes.number,\n y: PropTypes.number,\n from: PropTypes.shape({\n x: PropTypes.number,\n y: PropTypes.number\n }).isRequired,\n to: PropTypes.shape({\n x: PropTypes.number,\n y: PropTypes.number\n }),\n graphProps: types.GraphPropsType.isRequired\n };\n\n static defaultProps = {\n from: {},\n to: {}\n };\n\n render() {\n const {\n classes,\n className,\n x,\n y,\n disabled,\n correctness,\n graphProps,\n from,\n to,\n ...rest\n } = this.props;\n // x & y are the initial coordinates for the arrow\n // from & to are used only to calculate the angle that the arrow should be rotated with\n\n const { scale } = graphProps;\n const angle = getAngleDeg(from.x, from.y, to.x, to.y);\n\n let points = '';\n\n if (isEqual(from, to)) {\n points = '0,0 0,0 0,0';\n } else {\n points = `0,0 ${arrowDimensions.vector},${arrowDimensions.vector * 2} \n -${arrowDimensions.vector},${arrowDimensions.vector * 2}`;\n }\n\n return (\n <g\n className={classNames(\n classes.point,\n disabled && classes.disabled,\n classes[correctness],\n className\n )}\n {...rest}\n >\n <polygon\n points={points}\n transform={`\n translate(${scale.x(x)}, ${scale.y(y)})\n rotate(${angle} 0 0)`}\n />\n </g>\n );\n }\n}\n"],"file":"arrow-point.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
|
});
|
|
@@ -17,9 +19,9 @@ var _arrowHead = require("../arrow-head");
|
|
|
17
19
|
|
|
18
20
|
var _utils = require("../../../utils");
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
var _excluded = ["classes", "angle", "className", "x", "y", "disabled", "correctness", "graphProps"];
|
|
21
23
|
|
|
22
|
-
function
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
25
|
|
|
24
26
|
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); }
|
|
25
27
|
|
|
@@ -31,29 +33,33 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
31
33
|
|
|
32
34
|
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); } }
|
|
33
35
|
|
|
34
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
36
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
35
37
|
|
|
36
|
-
function
|
|
38
|
+
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); }
|
|
37
39
|
|
|
38
|
-
function
|
|
40
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
41
|
|
|
40
|
-
function
|
|
42
|
+
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); }; }
|
|
41
43
|
|
|
42
|
-
function
|
|
44
|
+
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); }
|
|
43
45
|
|
|
44
|
-
function
|
|
46
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
47
|
+
|
|
48
|
+
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; } }
|
|
49
|
+
|
|
50
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
45
51
|
|
|
46
52
|
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; }
|
|
47
53
|
|
|
48
|
-
var Arrow =
|
|
49
|
-
/*#__PURE__*/
|
|
50
|
-
function (_React$Component) {
|
|
54
|
+
var Arrow = /*#__PURE__*/function (_React$Component) {
|
|
51
55
|
_inherits(Arrow, _React$Component);
|
|
52
56
|
|
|
57
|
+
var _super = _createSuper(Arrow);
|
|
58
|
+
|
|
53
59
|
function Arrow() {
|
|
54
60
|
_classCallCheck(this, Arrow);
|
|
55
61
|
|
|
56
|
-
return
|
|
62
|
+
return _super.apply(this, arguments);
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
_createClass(Arrow, [{
|
|
@@ -91,7 +97,7 @@ function (_React$Component) {
|
|
|
91
97
|
disabled = _this$props.disabled,
|
|
92
98
|
correctness = _this$props.correctness,
|
|
93
99
|
graphProps = _this$props.graphProps,
|
|
94
|
-
rest = _objectWithoutProperties(_this$props,
|
|
100
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
95
101
|
|
|
96
102
|
var size = (0, _utils.thinnerShapesNeeded)(graphProps) ? 12 : 14;
|
|
97
103
|
var scale = graphProps.scale;
|
|
@@ -110,9 +116,9 @@ function (_React$Component) {
|
|
|
110
116
|
transform = this.getRotationWithBreakpoint(angle, 280, scaledX, scaledY);
|
|
111
117
|
}
|
|
112
118
|
|
|
113
|
-
return _react["default"].createElement("g", _extends({
|
|
119
|
+
return /*#__PURE__*/_react["default"].createElement("g", _extends({
|
|
114
120
|
className: (0, _classnames["default"])(classes.point, disabled && classes.disabled, classes[correctness], className)
|
|
115
|
-
}, rest), _react["default"].createElement(_arrowHead.ArrowHead, {
|
|
121
|
+
}, rest), /*#__PURE__*/_react["default"].createElement(_arrowHead.ArrowHead, {
|
|
116
122
|
size: size,
|
|
117
123
|
transform: transform,
|
|
118
124
|
points: points
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/tools/shared/point/arrow.jsx"],"names":["Arrow","currentAngle","referenceAngle","x","y","breakpoint","firstBreakpoint","secondBreakpoint","t","props","classes","angle","className","disabled","correctness","graphProps","rest","size","scale","scaledX","scaledY","transform","points","getRotation","getRotationWithBreakpoint","point","React","Component","PropTypes","object","string","bool","number","isRequired","types","GraphPropsType"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/tools/shared/point/arrow.jsx"],"names":["Arrow","currentAngle","referenceAngle","x","y","breakpoint","firstBreakpoint","secondBreakpoint","t","props","classes","angle","className","disabled","correctness","graphProps","rest","size","scale","scaledX","scaledY","transform","points","getRotation","getRotationWithBreakpoint","point","React","Component","PropTypes","object","string","bool","number","isRequired","types","GraphPropsType"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEqBA,K;;;;;;;;;;;;;WAYnB,qBAAYC,YAAZ,EAA0BC,cAA1B,EAA0CC,CAA1C,EAA6CC,CAA7C,EAAgD;AAC9C,UAAMC,UAAU,GAAGH,cAAc,GAAG,EAApC;AACA,8BAAiB,CAACD,YAAD,IAAiBA,YAAY,GAAGI,UAAf,GAA4B,EAA5B,GAAiC,CAAlD,CAAjB,eAA0EF,CAA1E,cAA+EC,CAA/E;AACD;;;WAED,mCAA0BH,YAA1B,EAAwCC,cAAxC,EAAwDC,CAAxD,EAA2DC,CAA3D,EAA8D;AAC5D,UAAME,eAAe,GAAGJ,cAAc,GAAG,EAAzC;AACA,UAAMK,gBAAgB,GAAGL,cAAc,GAAG,EAA1C;AACA,UAAIM,CAAJ;;AACA,UAAIP,YAAY,IAAIK,eAAhB,IAAmCL,YAAY,GAAGM,gBAAtD,EAAwE;AACtEC,QAAAA,CAAC,GAAG,EAAJ;AACD,OAFD,MAEO,IAAIP,YAAY,GAAGM,gBAAnB,EAAqC;AAC1CC,QAAAA,CAAC,GAAG,CAAJ;AACD,OAFM,MAEA;AACLA,QAAAA,CAAC,GAAG,CAAJ;AACD;;AACD,8BAAiB,CAACP,YAAD,GAAgBO,CAAjC,eAAuCL,CAAvC,cAA4CC,CAA5C;AACD;;;WAED,kBAAS;AACP,wBAUI,KAAKK,KAVT;AAAA,UACEC,OADF,eACEA,OADF;AAAA,UAEEC,KAFF,eAEEA,KAFF;AAAA,UAGEC,SAHF,eAGEA,SAHF;AAAA,UAIET,CAJF,eAIEA,CAJF;AAAA,UAKEC,CALF,eAKEA,CALF;AAAA,UAMES,QANF,eAM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BACE;AACE,QAAA,SAAS,EAAE,4BACTV,OAAO,CAACe,KADC,EAETZ,QAAQ,IAAIH,OAAO,CAACG,QAFX,EAGTH,OAAO,CAACI,WAAD,CAHE,EAITF,SAJS;AADb,SAOMI,IAPN,gBASE,gCAAC,oBAAD;AAAW,QAAA,IAAI,EAAEC,IAAjB;AAAuB,QAAA,SAAS,EAAEI,SAAlC;AAA6C,QAAA,MAAM,EAAEC;AAArD,QATF,CADF;AAaD;;;;EA9EgCI,kBAAMC,S;;;;gBAApB3B,K,eACA;AACjBU,EAAAA,OAAO,EAAEkB,sBAAUC,MADF;AAEjBjB,EAAAA,SAAS,EAAEgB,sBAAUE,MAFJ;AAGjBhB,EAAAA,WAAW,EAAEc,sBAAUE,MAHN;AAIjBjB,EAAAA,QAAQ,EAAEe,sBAAUG,IAJH;AAKjB5B,EAAAA,CAAC,EAAEyB,sBAAUI,MAAV,CAAiBC,UALH;AAMjB7B,EAAAA,CAAC,EAAEwB,sBAAUI,MAAV,CAAiBC,UANH;AAOjBtB,EAAAA,KAAK,EAAEiB,sBAAUI,MAAV,CAAiBC,UAPP;AAQjBlB,EAAAA,UAAU,EAAEmB,YAAMC,cAAN,CAAqBF;AARhB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { types } from '@pie-lib/plot';\nimport { ArrowHead } from '../arrow-head';\nimport { thinnerShapesNeeded } from '../../../utils';\n\nexport default class Arrow extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n className: PropTypes.string,\n correctness: PropTypes.string,\n disabled: PropTypes.bool,\n x: PropTypes.number.isRequired,\n y: PropTypes.number.isRequired,\n angle: PropTypes.number.isRequired,\n graphProps: types.GraphPropsType.isRequired\n };\n\n getRotation(currentAngle, referenceAngle, x, y) {\n const breakpoint = referenceAngle + 10;\n return `rotate(${-currentAngle - (currentAngle > breakpoint ? 15 : 0)}, ${x},${y})`;\n }\n\n getRotationWithBreakpoint(currentAngle, referenceAngle, x, y) {\n const firstBreakpoint = referenceAngle + 10;\n const secondBreakpoint = referenceAngle + 65;\n let t;\n if (currentAngle >= firstBreakpoint && currentAngle < secondBreakpoint) {\n t = 15;\n } else if (currentAngle > secondBreakpoint) {\n t = 7;\n } else {\n t = 0;\n }\n return `rotate(${-currentAngle + t}, ${x},${y})`;\n }\n\n render() {\n const {\n classes,\n angle,\n className,\n x,\n y,\n disabled,\n correctness,\n graphProps,\n ...rest\n } = this.props;\n\n const size = thinnerShapesNeeded(graphProps) ? 12 : 14;\n const { scale } = graphProps;\n\n const scaledX = scale.x(x);\n const scaledY = scale.y(y);\n\n let transform;\n const points = `${scaledX},${scaledY}\n ${scaledX - size},${scaledY - size / 2}\n ${scaledX - size}, ${scaledY + size / 2}`;\n\n if (angle >= 0 && angle < 90) {\n transform = this.getRotation(angle, 0, scaledX, scaledY);\n } else if (angle >= 90 && angle < 180) {\n transform = this.getRotationWithBreakpoint(angle, 90, scaledX, scaledY);\n } else if (angle >= 180 && angle < 270) {\n transform = this.getRotation(angle, 180, scaledX, scaledY);\n } else {\n transform = this.getRotationWithBreakpoint(angle, 280, scaledX, scaledY);\n }\n\n return (\n <g\n className={classNames(\n classes.point,\n disabled && classes.disabled,\n classes[correctness],\n className\n )}\n {...rest}\n >\n <ArrowHead size={size} transform={transform} points={points} />\n </g>\n );\n }\n}\n"],"file":"arrow.js"}
|