@pie-lib/graphing 2.4.3-next.352 → 2.4.3-next.414
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/lib/axis/arrow.js +15 -25
- package/lib/axis/arrow.js.map +1 -1
- package/lib/axis/axes.js +41 -73
- package/lib/axis/axes.js.map +1 -1
- package/lib/axis/index.js +1 -1
- package/lib/bg.js +20 -31
- package/lib/bg.js.map +1 -1
- package/lib/container/index.js +27 -41
- package/lib/container/index.js.map +1 -1
- package/lib/container/reducer.js +2 -2
- package/lib/container/reducer.js.map +1 -1
- package/lib/coordinates-label.js +5 -5
- package/lib/coordinates-label.js.map +1 -1
- package/lib/graph-with-controls.js +81 -43
- package/lib/graph-with-controls.js.map +1 -1
- package/lib/graph.js +45 -69
- package/lib/graph.js.map +1 -1
- package/lib/grid-setup.js +44 -30
- package/lib/grid-setup.js.map +1 -1
- package/lib/grid.js +28 -46
- package/lib/grid.js.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/labels.js +22 -38
- package/lib/labels.js.map +1 -1
- package/lib/mark-label.js +10 -20
- package/lib/mark-label.js.map +1 -1
- package/lib/toggle-bar.js +22 -33
- package/lib/toggle-bar.js.map +1 -1
- package/lib/tool-menu.js +21 -32
- package/lib/tool-menu.js.map +1 -1
- package/lib/tools/circle/bg-circle.js +27 -38
- package/lib/tools/circle/bg-circle.js.map +1 -1
- package/lib/tools/circle/component.js +36 -54
- package/lib/tools/circle/component.js.map +1 -1
- package/lib/tools/circle/index.js +5 -5
- package/lib/tools/circle/index.js.map +1 -1
- package/lib/tools/line/component.js +11 -25
- package/lib/tools/line/component.js.map +1 -1
- package/lib/tools/line/index.js +2 -2
- package/lib/tools/line/index.js.map +1 -1
- package/lib/tools/parabola/component.js +2 -2
- package/lib/tools/parabola/component.js.map +1 -1
- package/lib/tools/parabola/index.js +5 -5
- package/lib/tools/parabola/index.js.map +1 -1
- package/lib/tools/point/component.js +30 -47
- package/lib/tools/point/component.js.map +1 -1
- package/lib/tools/point/index.js +5 -5
- package/lib/tools/point/index.js.map +1 -1
- package/lib/tools/polygon/component.js +59 -107
- package/lib/tools/polygon/component.js.map +1 -1
- package/lib/tools/polygon/index.js +9 -19
- package/lib/tools/polygon/index.js.map +1 -1
- package/lib/tools/polygon/line.js +28 -41
- package/lib/tools/polygon/line.js.map +1 -1
- package/lib/tools/polygon/polygon.js +28 -42
- package/lib/tools/polygon/polygon.js.map +1 -1
- package/lib/tools/ray/component.js +11 -25
- package/lib/tools/ray/component.js.map +1 -1
- package/lib/tools/ray/index.js +2 -2
- package/lib/tools/ray/index.js.map +1 -1
- package/lib/tools/segment/component.js +8 -11
- package/lib/tools/segment/component.js.map +1 -1
- package/lib/tools/segment/index.js +2 -2
- package/lib/tools/segment/index.js.map +1 -1
- package/lib/tools/shared/arrow-head.js +2 -2
- package/lib/tools/shared/arrow-head.js.map +1 -1
- package/lib/tools/shared/line/index.js +43 -66
- package/lib/tools/shared/line/index.js.map +1 -1
- package/lib/tools/shared/line/line-path.js +29 -42
- package/lib/tools/shared/line/line-path.js.map +1 -1
- package/lib/tools/shared/line/with-root-edge.js +12 -14
- package/lib/tools/shared/line/with-root-edge.js.map +1 -1
- package/lib/tools/shared/point/arrow-point.js +24 -39
- package/lib/tools/shared/point/arrow-point.js.map +1 -1
- package/lib/tools/shared/point/arrow.js +23 -37
- package/lib/tools/shared/point/arrow.js.map +1 -1
- package/lib/tools/shared/point/base-point.js +24 -38
- package/lib/tools/shared/point/base-point.js.map +1 -1
- package/lib/tools/shared/point/index.js +6 -6
- package/lib/tools/shared/point/index.js.map +1 -1
- package/lib/tools/shared/styles.js +7 -5
- package/lib/tools/shared/styles.js.map +1 -1
- package/lib/tools/shared/types.js +2 -2
- package/lib/tools/shared/types.js.map +1 -1
- package/lib/tools/sine/component.js +2 -2
- package/lib/tools/sine/component.js.map +1 -1
- package/lib/tools/sine/index.js +5 -5
- package/lib/tools/sine/index.js.map +1 -1
- package/lib/tools/vector/component.js +8 -11
- package/lib/tools/vector/component.js.map +1 -1
- package/lib/tools/vector/index.js +2 -2
- package/lib/tools/vector/index.js.map +1 -1
- package/lib/undo-redo.js +19 -31
- package/lib/undo-redo.js.map +1 -1
- package/lib/use-debounce.js +5 -13
- package/lib/use-debounce.js.map +1 -1
- package/lib/utils.js +2 -2
- package/lib/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/graph-with-controls.jsx +70 -13
- package/src/graph.jsx +2 -0
- package/src/grid-setup.jsx +19 -19
package/lib/bg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bg.js","names":["Bg","rect","props","onClick","graphProps","scale","coords","mouse","_groups","x","invert","y","rowTicks","getTickValues","range","columnTicks","domain","closest","ticks","value","length","reduce","prev","curr","currentDistance","Math","abs","previousDistance","snapped","indexOf","select","on","onRectClick","bind","nextProps","utils","isDomainRangeEqual","width","height","React","Component","PropTypes","number","isRequired","func","types","GraphPropsType"],"sources":["../src/bg.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { select, mouse } from 'd3-selection';\nimport { types, utils } from '@pie-lib/plot';\nimport { getTickValues } from './utils';\n\nexport default class Bg extends React.Component {\n static propTypes = {\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n onClick: PropTypes.func.isRequired,\n graphProps: types.GraphPropsType.isRequired\n };\n\n static defaultProps = {};\n\n componentDidMount() {\n const rect = select(this.rect);\n rect.on('click', this.onRectClick.bind(this, rect));\n }\n\n shouldComponentUpdate(nextProps) {\n return (\n !utils.isDomainRangeEqual(this.props.graphProps, nextProps.graphProps) ||\n this.props.width !== nextProps.width ||\n this.props.height !== nextProps.height\n );\n }\n /**\n * Note: we use d3 click + mouse to give us domain values directly.\n * Saves us having to calculate them ourselves from a MouseEvent.\n */\n onRectClick = rect => {\n const { onClick, graphProps } = this.props;\n const { scale } = graphProps;\n const coords = mouse(rect._groups[0][0]);\n const x = scale.x.invert(coords[0]);\n const y = scale.y.invert(coords[1]);\n const rowTicks = getTickValues(graphProps.range);\n const columnTicks = getTickValues(graphProps.domain);\n\n const closest = (ticks, value) => {\n return (\n ticks.length &&\n ticks.reduce((prev, curr) => {\n const currentDistance = Math.abs(curr - value);\n const previousDistance = Math.abs(prev - value);\n return currentDistance <= previousDistance ? curr : prev;\n })\n );\n };\n\n let snapped = {};\n\n if (columnTicks.indexOf(x) >= 0 && rowTicks.indexOf(y) >= 0) {\n snapped.x = x;\n snapped.y = y;\n } else {\n snapped.x = closest(columnTicks, x);\n snapped.y = closest(rowTicks, y);\n }\n\n onClick(snapped);\n };\n\n render() {\n const { width, height } = this.props;\n return (\n <rect\n ref={rect => (this.rect = rect)}\n fill=\"red\"\n fillOpacity=\"0.0\"\n width={width}\n height={height}\n />\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"bg.js","names":["Bg","rect","props","onClick","graphProps","scale","coords","mouse","_groups","x","invert","y","rowTicks","getTickValues","range","columnTicks","domain","closest","ticks","value","length","reduce","prev","curr","currentDistance","Math","abs","previousDistance","snapped","indexOf","select","on","onRectClick","bind","nextProps","utils","isDomainRangeEqual","width","height","React","Component","PropTypes","number","isRequired","func","types","GraphPropsType"],"sources":["../src/bg.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { select, mouse } from 'd3-selection';\nimport { types, utils } from '@pie-lib/plot';\nimport { getTickValues } from './utils';\n\nexport default class Bg extends React.Component {\n static propTypes = {\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n onClick: PropTypes.func.isRequired,\n graphProps: types.GraphPropsType.isRequired\n };\n\n static defaultProps = {};\n\n componentDidMount() {\n const rect = select(this.rect);\n rect.on('click', this.onRectClick.bind(this, rect));\n }\n\n shouldComponentUpdate(nextProps) {\n return (\n !utils.isDomainRangeEqual(this.props.graphProps, nextProps.graphProps) ||\n this.props.width !== nextProps.width ||\n this.props.height !== nextProps.height\n );\n }\n /**\n * Note: we use d3 click + mouse to give us domain values directly.\n * Saves us having to calculate them ourselves from a MouseEvent.\n */\n onRectClick = rect => {\n const { onClick, graphProps } = this.props;\n const { scale } = graphProps;\n const coords = mouse(rect._groups[0][0]);\n const x = scale.x.invert(coords[0]);\n const y = scale.y.invert(coords[1]);\n const rowTicks = getTickValues(graphProps.range);\n const columnTicks = getTickValues(graphProps.domain);\n\n const closest = (ticks, value) => {\n return (\n ticks.length &&\n ticks.reduce((prev, curr) => {\n const currentDistance = Math.abs(curr - value);\n const previousDistance = Math.abs(prev - value);\n return currentDistance <= previousDistance ? curr : prev;\n })\n );\n };\n\n let snapped = {};\n\n if (columnTicks.indexOf(x) >= 0 && rowTicks.indexOf(y) >= 0) {\n snapped.x = x;\n snapped.y = y;\n } else {\n snapped.x = closest(columnTicks, x);\n snapped.y = closest(rowTicks, y);\n }\n\n onClick(snapped);\n };\n\n render() {\n const { width, height } = this.props;\n return (\n <rect\n ref={rect => (this.rect = rect)}\n fill=\"red\"\n fillOpacity=\"0.0\"\n width={width}\n height={height}\n />\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;IAEqBA,E;;;;;;;;;;;;;;;oGA0BL,UAAAC,IAAI,EAAI;MACpB,kBAAgC,MAAKC,KAArC;MAAA,IAAQC,OAAR,eAAQA,OAAR;MAAA,IAAiBC,UAAjB,eAAiBA,UAAjB;MACA,IAAQC,KAAR,GAAkBD,UAAlB,CAAQC,KAAR;MACA,IAAMC,MAAM,GAAG,IAAAC,kBAAA,EAAMN,IAAI,CAACO,OAAL,CAAa,CAAb,EAAgB,CAAhB,CAAN,CAAf;MACA,IAAMC,CAAC,GAAGJ,KAAK,CAACI,CAAN,CAAQC,MAAR,CAAeJ,MAAM,CAAC,CAAD,CAArB,CAAV;MACA,IAAMK,CAAC,GAAGN,KAAK,CAACM,CAAN,CAAQD,MAAR,CAAeJ,MAAM,CAAC,CAAD,CAArB,C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D;;;WAED,+BAAsBiC,SAAtB,EAAiC;MAC/B,OACE,CAACC,WAAA,CAAMC,kBAAN,CAAyB,KAAKlC,KAAL,CAAWE,UAApC,EAAgD8B,SAAS,CAAC9B,UAA1D,CAAD,IACA,KAAKF,KAAL,CAAWmC,KAAX,KAAqBH,SAAS,CAACG,KAD/B,IAEA,KAAKnC,KAAL,CAAWoC,MAAX,KAAsBJ,SAAS,CAACI,MAHlC;IAKD;IACD;AACF;AACA;AACA;;;;WAkCE,kBAAS;MAAA;;MACP,mBAA0B,KAAKpC,KAA/B;MAAA,IAAQmC,KAAR,gBAAQA,KAAR;MAAA,IAAeC,MAAf,gBAAeA,MAAf;MACA,oBACE;QACE,GAAG,EAAE,aAAArC,IAAI;UAAA,OAAK,MAAI,CAACA,IAAL,GAAYA,IAAjB;QAAA,CADX;QAEE,IAAI,EAAC,KAFP;QAGE,WAAW,EAAC,KAHd;QAIE,KAAK,EAAEoC,KAJT;QAKE,MAAM,EAAEC;MALV,EADF;IASD;;;EAtE6BC,iBAAA,CAAMC,S;;;iCAAjBxC,E,eACA;EACjBqC,KAAK,EAAEI,qBAAA,CAAUC,MAAV,CAAiBC,UADP;EAEjBL,MAAM,EAAEG,qBAAA,CAAUC,MAAV,CAAiBC,UAFR;EAGjBxC,OAAO,EAAEsC,qBAAA,CAAUG,IAAV,CAAeD,UAHP;EAIjBvC,UAAU,EAAEyC,WAAA,CAAMC,cAAN,CAAqBH;AAJhB,C;iCADA3C,E,kBAQG,E"}
|
package/lib/container/index.js
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = exports.GraphContainer = void 0;
|
|
9
9
|
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
+
|
|
20
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
+
|
|
22
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
+
|
|
24
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
+
|
|
26
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
+
|
|
10
28
|
var _reactRedux = require("react-redux");
|
|
11
29
|
|
|
12
30
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -27,36 +45,10 @@ var _graphWithControls = _interopRequireDefault(require("../graph-with-controls"
|
|
|
27
45
|
|
|
28
46
|
var _excluded = ["onChangeMarks", "marks"];
|
|
29
47
|
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
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
|
-
|
|
34
|
-
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; }
|
|
35
|
-
|
|
36
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
37
|
-
|
|
38
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
39
|
-
|
|
40
|
-
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); } }
|
|
41
|
-
|
|
42
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
43
|
-
|
|
44
|
-
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); }
|
|
45
|
-
|
|
46
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
47
|
-
|
|
48
|
-
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); }; }
|
|
49
|
-
|
|
50
|
-
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
|
-
|
|
52
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
48
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
53
49
|
|
|
54
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; } }
|
|
55
51
|
|
|
56
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
57
|
-
|
|
58
|
-
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; }
|
|
59
|
-
|
|
60
52
|
var mapStateToProps = function mapStateToProps(s) {
|
|
61
53
|
return {
|
|
62
54
|
marks: s.marks.present
|
|
@@ -89,18 +81,16 @@ var GraphContainer = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProp
|
|
|
89
81
|
exports.GraphContainer = GraphContainer;
|
|
90
82
|
|
|
91
83
|
var Root = /*#__PURE__*/function (_React$Component) {
|
|
92
|
-
|
|
84
|
+
(0, _inherits2["default"])(Root, _React$Component);
|
|
93
85
|
|
|
94
86
|
var _super = _createSuper(Root);
|
|
95
87
|
|
|
96
88
|
function Root(props) {
|
|
97
89
|
var _this;
|
|
98
90
|
|
|
99
|
-
|
|
100
|
-
|
|
91
|
+
(0, _classCallCheck2["default"])(this, Root);
|
|
101
92
|
_this = _super.call(this, props);
|
|
102
|
-
|
|
103
|
-
_defineProperty(_assertThisInitialized(_this), "onStoreChange", function () {
|
|
93
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onStoreChange", function () {
|
|
104
94
|
var _this$props = _this.props,
|
|
105
95
|
marks = _this$props.marks,
|
|
106
96
|
onChangeMarks = _this$props.onChangeMarks;
|
|
@@ -111,7 +101,6 @@ var Root = /*#__PURE__*/function (_React$Component) {
|
|
|
111
101
|
onChangeMarks(storeState.marks.present);
|
|
112
102
|
}
|
|
113
103
|
});
|
|
114
|
-
|
|
115
104
|
var r = (0, _reducer["default"])();
|
|
116
105
|
_this.store = (0, _redux.createStore)(r, {
|
|
117
106
|
marks: props.marks
|
|
@@ -122,21 +111,20 @@ var Root = /*#__PURE__*/function (_React$Component) {
|
|
|
122
111
|
return _this;
|
|
123
112
|
}
|
|
124
113
|
|
|
125
|
-
|
|
114
|
+
(0, _createClass2["default"])(Root, [{
|
|
126
115
|
key: "render",
|
|
127
116
|
value: function render() {
|
|
128
117
|
// eslint-disable-next-line no-unused-vars
|
|
129
118
|
var _this$props2 = this.props,
|
|
130
119
|
onChangeMarks = _this$props2.onChangeMarks,
|
|
131
120
|
marks = _this$props2.marks,
|
|
132
|
-
rest =
|
|
133
|
-
|
|
121
|
+
rest = (0, _objectWithoutProperties2["default"])(_this$props2, _excluded);
|
|
134
122
|
var correctnessSet = marks && marks.find(function (m) {
|
|
135
123
|
return m.correctness;
|
|
136
124
|
});
|
|
137
125
|
|
|
138
126
|
if (correctnessSet) {
|
|
139
|
-
return /*#__PURE__*/_react["default"].createElement(_graphWithControls["default"],
|
|
127
|
+
return /*#__PURE__*/_react["default"].createElement(_graphWithControls["default"], (0, _extends2["default"])({}, rest, {
|
|
140
128
|
marks: marks,
|
|
141
129
|
disabled: correctnessSet
|
|
142
130
|
}));
|
|
@@ -147,15 +135,13 @@ var Root = /*#__PURE__*/function (_React$Component) {
|
|
|
147
135
|
}, /*#__PURE__*/_react["default"].createElement(GraphContainer, rest));
|
|
148
136
|
}
|
|
149
137
|
}]);
|
|
150
|
-
|
|
151
138
|
return Root;
|
|
152
139
|
}(_react["default"].Component);
|
|
153
140
|
|
|
154
|
-
|
|
141
|
+
(0, _defineProperty2["default"])(Root, "propTypes", {
|
|
155
142
|
onChangeMarks: _propTypes["default"].func,
|
|
156
143
|
marks: _propTypes["default"].array
|
|
157
144
|
});
|
|
158
|
-
|
|
159
145
|
var _default = Root;
|
|
160
146
|
exports["default"] = _default;
|
|
161
147
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["mapStateToProps","s","marks","present","mapDispatchToProps","dispatch","onChangeMarks","m","changeMarks","onUndo","ActionCreators","undo","onRedo","redo","onReset","GraphContainer","connect","GraphWithControls","Root","props","storeState","store","getState","isEqual","r","reducer","createStore","subscribe","onStoreChange","rest","correctnessSet","find","correctness","React","Component","PropTypes","func","array"],"sources":["../../src/container/index.jsx"],"sourcesContent":["import { connect } from 'react-redux';\nimport React from 'react';\nimport { Provider } from 'react-redux';\nimport { createStore } from 'redux';\nimport reducer from './reducer';\nimport { changeMarks } from './actions';\nimport PropTypes from 'prop-types';\nimport isEqual from 'lodash/isEqual';\nimport { ActionCreators } from 'redux-undo';\nimport GraphWithControls from '../graph-with-controls';\n\nconst mapStateToProps = s => ({\n marks: s.marks.present\n});\n\nconst mapDispatchToProps = dispatch => ({\n onChangeMarks: m => dispatch(changeMarks(m)),\n onUndo: () => dispatch(ActionCreators.undo()),\n onRedo: () => dispatch(ActionCreators.redo()),\n onReset: () => dispatch(changeMarks([]))\n});\n\nexport const GraphContainer = connect(mapStateToProps, mapDispatchToProps)(GraphWithControls);\n\n/**\n * The graph component entry point with undo/redo\n * Redux is an implementation detail, hide it in the react component.\n */\nclass Root extends React.Component {\n static propTypes = {\n onChangeMarks: PropTypes.func,\n marks: PropTypes.array\n };\n\n constructor(props) {\n super(props);\n\n const r = reducer();\n this.store = createStore(r, { marks: props.marks });\n\n this.store.subscribe(this.onStoreChange);\n }\n\n onStoreChange = () => {\n const { marks, onChangeMarks } = this.props;\n const storeState = this.store.getState();\n\n if (!isEqual(storeState.marks.present, marks)) {\n onChangeMarks(storeState.marks.present);\n }\n };\n\n render() {\n // eslint-disable-next-line no-unused-vars\n const { onChangeMarks, marks, ...rest } = this.props;\n const correctnessSet = marks && marks.find(m => m.correctness);\n\n if (correctnessSet) {\n return <GraphWithControls {...rest} marks={marks} disabled={correctnessSet} />;\n }\n\n return (\n <Provider store={this.store}>\n <GraphContainer {...rest} />\n </Provider>\n );\n }\n}\n\nexport default Root;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["mapStateToProps","s","marks","present","mapDispatchToProps","dispatch","onChangeMarks","m","changeMarks","onUndo","ActionCreators","undo","onRedo","redo","onReset","GraphContainer","connect","GraphWithControls","Root","props","storeState","store","getState","isEqual","r","reducer","createStore","subscribe","onStoreChange","rest","correctnessSet","find","correctness","React","Component","PropTypes","func","array"],"sources":["../../src/container/index.jsx"],"sourcesContent":["import { connect } from 'react-redux';\nimport React from 'react';\nimport { Provider } from 'react-redux';\nimport { createStore } from 'redux';\nimport reducer from './reducer';\nimport { changeMarks } from './actions';\nimport PropTypes from 'prop-types';\nimport isEqual from 'lodash/isEqual';\nimport { ActionCreators } from 'redux-undo';\nimport GraphWithControls from '../graph-with-controls';\n\nconst mapStateToProps = s => ({\n marks: s.marks.present\n});\n\nconst mapDispatchToProps = dispatch => ({\n onChangeMarks: m => dispatch(changeMarks(m)),\n onUndo: () => dispatch(ActionCreators.undo()),\n onRedo: () => dispatch(ActionCreators.redo()),\n onReset: () => dispatch(changeMarks([]))\n});\n\nexport const GraphContainer = connect(mapStateToProps, mapDispatchToProps)(GraphWithControls);\n\n/**\n * The graph component entry point with undo/redo\n * Redux is an implementation detail, hide it in the react component.\n */\nclass Root extends React.Component {\n static propTypes = {\n onChangeMarks: PropTypes.func,\n marks: PropTypes.array\n };\n\n constructor(props) {\n super(props);\n\n const r = reducer();\n this.store = createStore(r, { marks: props.marks });\n\n this.store.subscribe(this.onStoreChange);\n }\n\n onStoreChange = () => {\n const { marks, onChangeMarks } = this.props;\n const storeState = this.store.getState();\n\n if (!isEqual(storeState.marks.present, marks)) {\n onChangeMarks(storeState.marks.present);\n }\n };\n\n render() {\n // eslint-disable-next-line no-unused-vars\n const { onChangeMarks, marks, ...rest } = this.props;\n const correctnessSet = marks && marks.find(m => m.correctness);\n\n if (correctnessSet) {\n return <GraphWithControls {...rest} marks={marks} disabled={correctnessSet} />;\n }\n\n return (\n <Provider store={this.store}>\n <GraphContainer {...rest} />\n </Provider>\n );\n }\n}\n\nexport default Root;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAAAC,CAAC;EAAA,OAAK;IAC5BC,KAAK,EAAED,CAAC,CAACC,KAAF,CAAQC;EADa,CAAL;AAAA,CAAzB;;AAIA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB,CAAAC,QAAQ;EAAA,OAAK;IACtCC,aAAa,EAAE,uBAAAC,CAAC;MAAA,OAAIF,QAAQ,CAAC,IAAAG,oBAAA,EAAYD,CAAZ,CAAD,CAAZ;IAAA,CADsB;IAEtCE,MAAM,EAAE;MAAA,OAAMJ,QAAQ,CAACK,yBAAA,CAAeC,IAAf,EAAD,CAAd;IAAA,CAF8B;IAGtCC,MAAM,EAAE;MAAA,OAAMP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AAZ,CAAhC;;MAEA,IAAIF,cAAJ,EAAoB;QAClB,oBAAO,gCAAC,6BAAD,gCAAuBD,IAAvB;UAA6B,KAAK,EAAE3B,KAApC;UAA2C,QAAQ,EAAE4B;QAArD,GAAP;MACD;;MAED,oBACE,gCAAC,oBAAD;QAAU,KAAK,EAAE,KAAKT;MAAtB,gBACE,gCAAC,cAAD,EAAoBQ,IAApB,CADF,CADF;IAKD;;;EAtCgBI,iBAAA,CAAMC,S;;iCAAnBhB,I,eACe;EACjBZ,aAAa,EAAE6B,qBAAA,CAAUC,IADR;EAEjBlC,KAAK,EAAEiC,qBAAA,CAAUE;AAFA,C;eAwCNnB,I"}
|
package/lib/container/reducer.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -11,8 +13,6 @@ var _marks = _interopRequireDefault(require("./marks"));
|
|
|
11
13
|
|
|
12
14
|
var _reduxUndo = _interopRequireDefault(require("redux-undo"));
|
|
13
15
|
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
16
|
var _default = function _default() {
|
|
17
17
|
return (0, _redux.combineReducers)({
|
|
18
18
|
marks: (0, _reduxUndo["default"])(_marks["default"], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.js","names":["combineReducers","marks","undoable","debug"],"sources":["../../src/container/reducer.js"],"sourcesContent":["import { combineReducers } from 'redux';\nimport marks from './marks';\nimport undoable from 'redux-undo';\n\nexport default () => combineReducers({ marks: undoable(marks, { debug: false }) });\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"reducer.js","names":["combineReducers","marks","undoable","debug"],"sources":["../../src/container/reducer.js"],"sourcesContent":["import { combineReducers } from 'redux';\nimport marks from './marks';\nimport undoable from 'redux-undo';\n\nexport default () => combineReducers({ marks: undoable(marks, { debug: false }) });\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;eAEe;EAAA,OAAM,IAAAA,sBAAA,EAAgB;IAAEC,KAAK,EAAE,IAAAC,qBAAA,EAASD,iBAAT,EAAgB;MAAEE,KAAK,EAAE;IAAT,CAAhB;EAAT,CAAhB,CAAN;AAAA,C"}
|
package/lib/coordinates-label.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.getLabelPosition = exports["default"] = exports.CoordinatesLabel = void 0;
|
|
7
9
|
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
8
12
|
var _react = _interopRequireDefault(require("react"));
|
|
9
13
|
|
|
10
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -19,13 +23,9 @@ var _InputBase = _interopRequireDefault(require("@material-ui/core/InputBase"));
|
|
|
19
23
|
|
|
20
24
|
var _utils = require("./utils");
|
|
21
25
|
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
24
26
|
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; }
|
|
25
27
|
|
|
26
|
-
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) {
|
|
27
|
-
|
|
28
|
-
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; }
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
29
|
|
|
30
30
|
var styles = function styles(theme) {
|
|
31
31
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinates-label.js","names":["styles","theme","input","fontFamily","typography","fontSize","borderRadius","background","color","primaryDark","inputLabel","padding","getLabelPosition","graphProps","x","y","labelLength","scale","domain","topShift","leftShift","rightEdge","max","left","top","CoordinatesLabel","classes","label","roundNumber","length","labelPosition","style","position","pointerEvents","width","ariaLabel","propTypes","types","GraphPropsType","PropTypes","object","number","withStyles"],"sources":["../src/coordinates-label.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { color } from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport InputBase from '@material-ui/core/InputBase';\nimport { roundNumber } from './utils';\n\nconst styles = theme => ({\n input: {\n fontFamily: theme.typography.fontFamily,\n fontSize: theme.typography.fontSize,\n borderRadius: '8px',\n background: '#FFFFFF',\n color: color.primaryDark()\n },\n inputLabel: {\n padding: 0\n }\n});\n\nexport const getLabelPosition = (graphProps, x, y, labelLength) => {\n const { scale, domain } = graphProps;\n const topShift = 8;\n const leftShift = 10;\n const rightEdge = scale.x(x) + labelLength + leftShift;\n\n if (rightEdge >= scale.x(domain.max)) {\n return {\n left: scale.x(x) - leftShift - labelLength,\n top: scale.y(y) - topShift\n };\n }\n\n return {\n left: scale.x(x) + leftShift,\n top: scale.y(y) - topShift\n };\n};\n\nexport const CoordinatesLabel = ({ x, y, graphProps, classes }) => {\n const label = `(${roundNumber(x)}, ${roundNumber(y)})`;\n const labelLength = (label.length || 0) * 6;\n const labelPosition = getLabelPosition(graphProps, x, y, labelLength);\n\n const style = {\n position: 'absolute',\n pointerEvents: 'auto',\n width: labelLength,\n padding: 0,\n ...labelPosition\n };\n\n return (\n <InputBase\n style={style}\n classes={{ input: classes.inputLabel }}\n className={classes.input}\n value={label}\n inputProps={{ ariaLabel: 'naked' }}\n />\n );\n};\n\nCoordinatesLabel.propTypes = {\n graphProps: types.GraphPropsType,\n classes: PropTypes.object,\n x: PropTypes.number,\n y: PropTypes.number\n};\n\nexport default withStyles(styles)(CoordinatesLabel);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"coordinates-label.js","names":["styles","theme","input","fontFamily","typography","fontSize","borderRadius","background","color","primaryDark","inputLabel","padding","getLabelPosition","graphProps","x","y","labelLength","scale","domain","topShift","leftShift","rightEdge","max","left","top","CoordinatesLabel","classes","label","roundNumber","length","labelPosition","style","position","pointerEvents","width","ariaLabel","propTypes","types","GraphPropsType","PropTypes","object","number","withStyles"],"sources":["../src/coordinates-label.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { color } from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport InputBase from '@material-ui/core/InputBase';\nimport { roundNumber } from './utils';\n\nconst styles = theme => ({\n input: {\n fontFamily: theme.typography.fontFamily,\n fontSize: theme.typography.fontSize,\n borderRadius: '8px',\n background: '#FFFFFF',\n color: color.primaryDark()\n },\n inputLabel: {\n padding: 0\n }\n});\n\nexport const getLabelPosition = (graphProps, x, y, labelLength) => {\n const { scale, domain } = graphProps;\n const topShift = 8;\n const leftShift = 10;\n const rightEdge = scale.x(x) + labelLength + leftShift;\n\n if (rightEdge >= scale.x(domain.max)) {\n return {\n left: scale.x(x) - leftShift - labelLength,\n top: scale.y(y) - topShift\n };\n }\n\n return {\n left: scale.x(x) + leftShift,\n top: scale.y(y) - topShift\n };\n};\n\nexport const CoordinatesLabel = ({ x, y, graphProps, classes }) => {\n const label = `(${roundNumber(x)}, ${roundNumber(y)})`;\n const labelLength = (label.length || 0) * 6;\n const labelPosition = getLabelPosition(graphProps, x, y, labelLength);\n\n const style = {\n position: 'absolute',\n pointerEvents: 'auto',\n width: labelLength,\n padding: 0,\n ...labelPosition\n };\n\n return (\n <InputBase\n style={style}\n classes={{ input: classes.inputLabel }}\n className={classes.input}\n value={label}\n inputProps={{ ariaLabel: 'naked' }}\n />\n );\n};\n\nCoordinatesLabel.propTypes = {\n graphProps: types.GraphPropsType,\n classes: PropTypes.object,\n x: PropTypes.number,\n y: PropTypes.number\n};\n\nexport default withStyles(styles)(CoordinatesLabel);\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACvBC,KAAK,EAAE;MACLC,UAAU,EAAEF,KAAK,CAACG,UAAN,CAAiBD,UADxB;MAELE,QAAQ,EAAEJ,KAAK,CAACG,UAAN,CAAiBC,QAFtB;MAGLC,YAAY,EAAE,KAHT;MAILC,UAAU,EAAE,SAJP;MAKLC,KAAK,EAAEA,eAAA,CAAMC,WAAN;IALF,CADgB;IAQvBC,UAAU,EAAE;MACVC,OAAO,EAAE;IADC;EARW,CAAL;AAAA,CAApB;;AAaO,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,UAAD,EAAaC,CAAb,EAAgBC,CAAhB,EAAmBC,WAAnB,EAAmC;EACjE,IAAQC,KAAR,GAA0BJ,UAA1B,CAAQI,KAAR;EAAA,IAAeC,MAAf,GAA0BL,UAA1B,CAAeK,MAAf;EACA,IAAMC,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AO,EAAE;MAAE7B,KAAK,EAAEwB,OAAO,CAAChB;IAAjB,CAFX;IAGE,SAAS,EAAEgB,OAAO,CAACxB,KAHrB;IAIE,KAAK,EAAEyB,KAJT;IAKE,UAAU,EAAE;MAAEQ,SAAS,EAAE;IAAb;EALd,EADF;AASD,CAtBM;;;AAwBPV,gBAAgB,CAACW,SAAjB,GAA6B;EAC3BvB,UAAU,EAAEwB,WAAA,CAAMC,cADS;EAE3BZ,OAAO,EAAEa,qBAAA,CAAUC,MAFQ;EAG3B1B,CAAC,EAAEyB,qBAAA,CAAUE,MAHc;EAI3B1B,CAAC,EAAEwB,qBAAA,CAAUE;AAJc,CAA7B;;eAOe,IAAAC,kBAAA,EAAW1C,MAAX,EAAmByB,gBAAnB,C"}
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
6
|
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
exports.toolIsAvailable = exports.setToolbarAvailability = exports.getAvailableTool = exports.filterByVisibleToolTypes = exports.filterByValidToolTypes = exports["default"] = exports.GraphWithControls = void 0;
|
|
9
11
|
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
+
|
|
16
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
+
|
|
18
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
+
|
|
20
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
+
|
|
22
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
10
26
|
var _react = _interopRequireDefault(require("react"));
|
|
11
27
|
|
|
12
28
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -29,37 +45,21 @@ var _undoRedo = _interopRequireDefault(require("./undo-redo"));
|
|
|
29
45
|
|
|
30
46
|
var _tools = require("./tools");
|
|
31
47
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
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; }
|
|
35
|
-
|
|
36
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
37
|
-
|
|
38
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
39
|
-
|
|
40
|
-
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); } }
|
|
41
|
-
|
|
42
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
48
|
+
var _core = require("@material-ui/core");
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
var _ExpandMore = _interopRequireDefault(require("@material-ui/icons/ExpandMore"));
|
|
45
51
|
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
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); }; }
|
|
52
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
49
53
|
|
|
50
|
-
function
|
|
54
|
+
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; }
|
|
51
55
|
|
|
52
|
-
function
|
|
56
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
53
57
|
|
|
54
58
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
55
59
|
|
|
56
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
57
|
-
|
|
58
60
|
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
61
|
|
|
60
|
-
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) {
|
|
61
|
-
|
|
62
|
-
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; }
|
|
62
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
63
63
|
|
|
64
64
|
var setToolbarAvailability = function setToolbarAvailability(toolbarTools) {
|
|
65
65
|
return _tools.toolsArr.map(function (tA) {
|
|
@@ -115,34 +115,52 @@ var getDefaultCurrentTool = function getDefaultCurrentTool(toolType) {
|
|
|
115
115
|
}) || null;
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
+
var Collapsible = function Collapsible(_ref) {
|
|
119
|
+
var classes = _ref.classes,
|
|
120
|
+
children = _ref.children,
|
|
121
|
+
title = _ref.title;
|
|
122
|
+
return /*#__PURE__*/_react["default"].createElement(_core.ExpansionPanel, {
|
|
123
|
+
elevation: 0,
|
|
124
|
+
className: classes.expansionPanel,
|
|
125
|
+
disabledGutters: true,
|
|
126
|
+
square: true
|
|
127
|
+
}, /*#__PURE__*/_react["default"].createElement(_core.ExpansionPanelSummary, {
|
|
128
|
+
classes: {
|
|
129
|
+
root: classes.summaryRoot,
|
|
130
|
+
content: classes.summaryContent
|
|
131
|
+
},
|
|
132
|
+
expandIcon: /*#__PURE__*/_react["default"].createElement(_ExpandMore["default"], null)
|
|
133
|
+
}, /*#__PURE__*/_react["default"].createElement(_core.Typography, {
|
|
134
|
+
variant: "subheading"
|
|
135
|
+
}, title)), /*#__PURE__*/_react["default"].createElement(_core.ExpansionPanelDetails, {
|
|
136
|
+
className: classes.details
|
|
137
|
+
}, children));
|
|
138
|
+
};
|
|
139
|
+
|
|
118
140
|
var GraphWithControls = /*#__PURE__*/function (_React$Component) {
|
|
119
|
-
|
|
141
|
+
(0, _inherits2["default"])(GraphWithControls, _React$Component);
|
|
120
142
|
|
|
121
143
|
var _super = _createSuper(GraphWithControls);
|
|
122
144
|
|
|
123
145
|
function GraphWithControls(props) {
|
|
124
146
|
var _this;
|
|
125
147
|
|
|
126
|
-
|
|
127
|
-
|
|
148
|
+
(0, _classCallCheck2["default"])(this, GraphWithControls);
|
|
128
149
|
_this = _super.call(this, props);
|
|
129
|
-
|
|
130
|
-
_defineProperty(_assertThisInitialized(_this), "changeCurrentTool", function (tool, tools) {
|
|
150
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeCurrentTool", function (tool, tools) {
|
|
131
151
|
return _this.setState({
|
|
132
152
|
currentTool: tools.find(function (t) {
|
|
133
153
|
return t.type === tool;
|
|
134
154
|
})
|
|
135
155
|
});
|
|
136
156
|
});
|
|
137
|
-
|
|
138
|
-
_defineProperty(_assertThisInitialized(_this), "toggleLabelMode", function () {
|
|
157
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toggleLabelMode", function () {
|
|
139
158
|
return _this.setState(function (state) {
|
|
140
159
|
return {
|
|
141
160
|
labelModeEnabled: !state.labelModeEnabled
|
|
142
161
|
};
|
|
143
162
|
});
|
|
144
163
|
});
|
|
145
|
-
|
|
146
164
|
_this.state = {
|
|
147
165
|
currentTool: getDefaultCurrentTool(props.defaultTool),
|
|
148
166
|
labelModeEnabled: false
|
|
@@ -150,7 +168,7 @@ var GraphWithControls = /*#__PURE__*/function (_React$Component) {
|
|
|
150
168
|
return _this;
|
|
151
169
|
}
|
|
152
170
|
|
|
153
|
-
|
|
171
|
+
(0, _createClass2["default"])(GraphWithControls, [{
|
|
154
172
|
key: "componentDidUpdate",
|
|
155
173
|
value: function componentDidUpdate(prevProps) {
|
|
156
174
|
var defaultTool = this.props.defaultTool;
|
|
@@ -175,6 +193,8 @@ var GraphWithControls = /*#__PURE__*/function (_React$Component) {
|
|
|
175
193
|
classes = _this$props.classes,
|
|
176
194
|
className = _this$props.className,
|
|
177
195
|
coordinatesOnHover = _this$props.coordinatesOnHover,
|
|
196
|
+
collapsibleToolbar = _this$props.collapsibleToolbar,
|
|
197
|
+
collapsibleToolbarTitle = _this$props.collapsibleToolbarTitle,
|
|
178
198
|
disabled = _this$props.disabled,
|
|
179
199
|
domain = _this$props.domain,
|
|
180
200
|
labels = _this$props.labels,
|
|
@@ -203,11 +223,7 @@ var GraphWithControls = /*#__PURE__*/function (_React$Component) {
|
|
|
203
223
|
currentTool = getAvailableTool(tools);
|
|
204
224
|
}
|
|
205
225
|
|
|
206
|
-
|
|
207
|
-
className: (0, _classnames["default"])(classes.graphWithControls, className)
|
|
208
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
209
|
-
className: classes.controls
|
|
210
|
-
}, /*#__PURE__*/_react["default"].createElement(_toolMenu["default"], {
|
|
226
|
+
var graphActions = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_toolMenu["default"], {
|
|
211
227
|
currentToolType: currentTool && currentTool.type,
|
|
212
228
|
disabled: !!disabled,
|
|
213
229
|
labelModeEnabled: labelModeEnabled,
|
|
@@ -220,7 +236,16 @@ var GraphWithControls = /*#__PURE__*/function (_React$Component) {
|
|
|
220
236
|
onUndo: onUndo,
|
|
221
237
|
onRedo: onRedo,
|
|
222
238
|
onReset: onReset
|
|
223
|
-
}))
|
|
239
|
+
}));
|
|
240
|
+
|
|
241
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
242
|
+
className: (0, _classnames["default"])(classes.graphWithControls, className)
|
|
243
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
244
|
+
className: classes.controls
|
|
245
|
+
}, collapsibleToolbar ? /*#__PURE__*/_react["default"].createElement(Collapsible, {
|
|
246
|
+
classes: classes,
|
|
247
|
+
title: collapsibleToolbarTitle
|
|
248
|
+
}, graphActions) : graphActions), /*#__PURE__*/_react["default"].createElement("div", {
|
|
224
249
|
ref: function ref(r) {
|
|
225
250
|
return _this2.labelNode = r;
|
|
226
251
|
}
|
|
@@ -241,21 +266,20 @@ var GraphWithControls = /*#__PURE__*/function (_React$Component) {
|
|
|
241
266
|
}));
|
|
242
267
|
}
|
|
243
268
|
}]);
|
|
244
|
-
|
|
245
269
|
return GraphWithControls;
|
|
246
270
|
}(_react["default"].Component);
|
|
247
271
|
|
|
248
272
|
exports.GraphWithControls = GraphWithControls;
|
|
249
|
-
|
|
250
|
-
_defineProperty(GraphWithControls, "propTypes", _objectSpread(_objectSpread({}, _graph.graphPropTypes), {}, {
|
|
273
|
+
(0, _defineProperty2["default"])(GraphWithControls, "propTypes", _objectSpread(_objectSpread({}, _graph.graphPropTypes), {}, {
|
|
251
274
|
onUndo: _propTypes["default"].func,
|
|
252
275
|
onRedo: _propTypes["default"].func,
|
|
253
276
|
onReset: _propTypes["default"].func,
|
|
254
277
|
toolbarTools: _propTypes["default"].arrayOf(_propTypes["default"].string) // array of tool types that have to be displayed in the toolbar, same shape as 'allTools'
|
|
255
278
|
|
|
256
279
|
}));
|
|
257
|
-
|
|
258
|
-
|
|
280
|
+
(0, _defineProperty2["default"])(GraphWithControls, "defaultProps", {
|
|
281
|
+
collapsibleToolbar: false,
|
|
282
|
+
collapsibleToolbarTitle: '',
|
|
259
283
|
toolbarTools: []
|
|
260
284
|
});
|
|
261
285
|
|
|
@@ -276,6 +300,20 @@ var styles = function styles(theme) {
|
|
|
276
300
|
'& button': {
|
|
277
301
|
fontSize: theme.typography.fontSize
|
|
278
302
|
}
|
|
303
|
+
},
|
|
304
|
+
expansionPanel: {
|
|
305
|
+
backgroundColor: _renderUi.color.primaryLight()
|
|
306
|
+
},
|
|
307
|
+
summaryRoot: {
|
|
308
|
+
padding: "0 ".concat(theme.spacing.unit, "px"),
|
|
309
|
+
minHeight: '32px !important'
|
|
310
|
+
},
|
|
311
|
+
summaryContent: {
|
|
312
|
+
margin: '4px 0 !important'
|
|
313
|
+
},
|
|
314
|
+
details: {
|
|
315
|
+
padding: 0,
|
|
316
|
+
marginTop: theme.spacing.unit
|
|
279
317
|
}
|
|
280
318
|
};
|
|
281
319
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-with-controls.js","names":["setToolbarAvailability","toolbarTools","toolsArr","map","tA","toolbar","find","t","type","toolIsAvailable","tools","currentTool","tool","getAvailableTool","filterByValidToolTypes","backgroundMarks","filter","bM","allTools","filterByVisibleToolTypes","marks","getDefaultCurrentTool","toolType","GraphWithControls","props","setState","state","labelModeEnabled","defaultTool","prevProps","axesSettings","classes","className","coordinatesOnHover","disabled","domain","labels","onChangeMarks","onUndo","onRedo","onReset","range","size","title","uniq","tT","isString","classNames","graphWithControls","controls","changeCurrentTool","toggleLabelMode","r","labelNode","undefined","React","Component","graphPropTypes","PropTypes","func","arrayOf","string","styles","theme","width","display","justifyContent","padding","spacing","unit","color","text","backgroundColor","primaryLight","borderTop","primaryDark","borderBottom","borderLeft","borderRight","fontSize","typography","withStyles"],"sources":["../src/graph-with-controls.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport uniq from 'lodash/uniq';\nimport isString from 'lodash/isString';\nimport { color } from '@pie-lib/render-ui';\n\nimport ToolMenu from './tool-menu';\nimport Graph, { graphPropTypes } from './graph';\nimport UndoRedo from './undo-redo';\nimport { allTools, toolsArr } from './tools';\n\nexport const setToolbarAvailability = toolbarTools =>\n toolsArr.map(tA => ({ ...tA, toolbar: !!toolbarTools.find(t => t === tA.type) })) || [];\n\nexport const toolIsAvailable = (tools, currentTool) =>\n currentTool && tools && (tools.find(tool => tool.type === currentTool.type) || {}).toolbar;\n\nexport const getAvailableTool = tools => tools.find(tool => tool.toolbar);\n\nexport const filterByValidToolTypes = backgroundMarks =>\n backgroundMarks.filter(bM => !!allTools.find(tool => tool === bM.type));\n\nexport const filterByVisibleToolTypes = (toolbarTools, marks) =>\n marks.filter(bM => !!toolbarTools.find(tool => tool === bM.type));\n\nconst getDefaultCurrentTool = toolType => toolsArr.find(tool => tool.type === toolType) || null;\n\nexport class GraphWithControls extends React.Component {\n static propTypes = {\n ...graphPropTypes,\n onUndo: PropTypes.func,\n onRedo: PropTypes.func,\n onReset: PropTypes.func,\n toolbarTools: PropTypes.arrayOf(PropTypes.string) // array of tool types that have to be displayed in the toolbar, same shape as 'allTools'\n };\n\n static defaultProps = { toolbarTools: [] };\n\n constructor(props) {\n super(props);\n\n this.state = {\n currentTool: getDefaultCurrentTool(props.defaultTool),\n labelModeEnabled: false\n };\n }\n\n componentDidUpdate(prevProps) {\n const { defaultTool } = this.props;\n\n if (prevProps.defaultTool !== defaultTool) {\n const currentTool = getDefaultCurrentTool(defaultTool);\n\n this.setState({ currentTool });\n }\n }\n\n changeCurrentTool = (tool, tools) =>\n this.setState({ currentTool: tools.find(t => t.type === tool) });\n\n toggleLabelMode = () => this.setState(state => ({ labelModeEnabled: !state.labelModeEnabled }));\n\n render() {\n let { currentTool, labelModeEnabled } = this.state;\n\n const {\n axesSettings,\n classes,\n className,\n coordinatesOnHover,\n disabled,\n domain,\n labels,\n onChangeMarks,\n onUndo,\n onRedo,\n onReset,\n range,\n size,\n title\n } = this.props;\n\n let { backgroundMarks, marks, toolbarTools } = this.props;\n\n // make sure only valid tool types are kept (string) and without duplicates\n toolbarTools = uniq(toolbarTools || []).filter(tT => !!isString(tT)) || [];\n\n // keep only the backgroundMarks that have valid types\n backgroundMarks = filterByValidToolTypes(backgroundMarks || []);\n\n // keep only the marks that have types which appear in toolbar\n marks = filterByVisibleToolTypes(toolbarTools, marks || []);\n\n const tools = setToolbarAvailability(toolbarTools);\n\n // set current tool if there's no current tool or if the existing one is no longer available\n if (!currentTool || !toolIsAvailable(tools, currentTool)) {\n currentTool = getAvailableTool(tools);\n }\n\n return (\n <div className={classNames(classes.graphWithControls, className)}>\n <div className={classes.controls}>\n <ToolMenu\n currentToolType={currentTool && currentTool.type}\n disabled={!!disabled}\n labelModeEnabled={labelModeEnabled}\n onChange={tool => this.changeCurrentTool(tool, tools)}\n onToggleLabelMode={this.toggleLabelMode}\n toolbarTools={toolbarTools}\n />\n\n {!disabled && <UndoRedo onUndo={onUndo} onRedo={onRedo} onReset={onReset} />}\n </div>\n\n <div ref={r => (this.labelNode = r)} />\n\n <Graph\n axesSettings={axesSettings}\n backgroundMarks={backgroundMarks}\n coordinatesOnHover={coordinatesOnHover}\n currentTool={currentTool}\n domain={domain}\n labels={labels}\n labelModeEnabled={labelModeEnabled}\n marks={marks}\n onChangeMarks={!disabled ? onChangeMarks : undefined}\n range={range}\n size={size}\n title={title}\n tools={tools}\n />\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n graphWithControls: {},\n controls: {\n width: 'inherit',\n display: 'flex',\n justifyContent: 'space-between',\n padding: theme.spacing.unit,\n color: color.text(),\n backgroundColor: color.primaryLight(),\n borderTop: `solid 1px ${color.primaryDark()}`,\n borderBottom: `solid 0px ${color.primaryDark()}`,\n borderLeft: `solid 1px ${color.primaryDark()}`,\n borderRight: `solid 1px ${color.primaryDark()}`,\n '& button': {\n fontSize: theme.typography.fontSize\n }\n }\n});\n\nexport default withStyles(styles)(GraphWithControls);\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAyB,CAAAC,YAAY;EAAA,OAChDC,eAAA,CAASC,GAAT,CAAa,UAAAC,EAAE;IAAA,uCAAUA,EAAV;MAAcC,OAAO,EAAE,CAAC,CAACJ,YAAY,CAACK,IAAb,CAAkB,UAAAC,CAAC;QAAA,OAAIA,CAAC,KAAKH,EAAE,CAACI,IAAb;MAAA,CAAnB;IAAzB;EAAA,CAAf,KAAqF,EADrC;AAAA,CAA3C;;;;AAGA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD,EAAQC,WAAR;EAAA,OAC7BA,WAAW,IAAID,KAAf,IAAwB,CAACA,KAAK,CAACJ,IAAN,CAAW,UAAAM,IAAI;IAAA,OAAIA,IAAI,CAACJ,IAAL,KAAcG,WAAW,CAACH,IAA9B;EAAA,CAAf,KAAsD,EAAvD,EAA2DH,OADtD;AAAA,CAAxB;;;;AAGA,IAAMQ,gBAAgB,GAAG,SAAnBA,gBAAmB,CAAAH,K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AAA,CAAMK,WAAN,EAAf,CATF;MAURG,WAAW,sBAAeR,eAAA,CAAMK,WAAN,EAAf,CAVH;MAWR,YAAY;QACVI,QAAQ,EAAEhB,KAAK,CAACiB,UAAN,CAAiBD;MADjB;IAXJ;EAFa,CAAL;AAAA,CAApB;;eAmBe,IAAAE,kBAAA,EAAWnB,MAAX,EAAmBvC,iBAAnB,C"}
|
|
1
|
+
{"version":3,"file":"graph-with-controls.js","names":["setToolbarAvailability","toolbarTools","toolsArr","map","tA","toolbar","find","t","type","toolIsAvailable","tools","currentTool","tool","getAvailableTool","filterByValidToolTypes","backgroundMarks","filter","bM","allTools","filterByVisibleToolTypes","marks","getDefaultCurrentTool","toolType","Collapsible","classes","children","title","expansionPanel","root","summaryRoot","content","summaryContent","details","GraphWithControls","props","setState","state","labelModeEnabled","defaultTool","prevProps","axesSettings","className","coordinatesOnHover","collapsibleToolbar","collapsibleToolbarTitle","disabled","domain","labels","onChangeMarks","onUndo","onRedo","onReset","range","size","uniq","tT","isString","graphActions","changeCurrentTool","toggleLabelMode","classNames","graphWithControls","controls","r","labelNode","undefined","React","Component","graphPropTypes","PropTypes","func","arrayOf","string","styles","theme","width","display","justifyContent","padding","spacing","unit","color","text","backgroundColor","primaryLight","borderTop","primaryDark","borderBottom","borderLeft","borderRight","fontSize","typography","minHeight","margin","marginTop","withStyles"],"sources":["../src/graph-with-controls.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport uniq from 'lodash/uniq';\nimport isString from 'lodash/isString';\nimport { color } from '@pie-lib/render-ui';\n\nimport ToolMenu from './tool-menu';\nimport Graph, { graphPropTypes } from './graph';\nimport UndoRedo from './undo-redo';\nimport { allTools, toolsArr } from './tools';\nimport {\n ExpansionPanel,\n ExpansionPanelDetails,\n ExpansionPanelSummary,\n Typography\n} from '@material-ui/core';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\n\nexport const setToolbarAvailability = toolbarTools =>\n toolsArr.map(tA => ({ ...tA, toolbar: !!toolbarTools.find(t => t === tA.type) })) || [];\n\nexport const toolIsAvailable = (tools, currentTool) =>\n currentTool && tools && (tools.find(tool => tool.type === currentTool.type) || {}).toolbar;\n\nexport const getAvailableTool = tools => tools.find(tool => tool.toolbar);\n\nexport const filterByValidToolTypes = backgroundMarks =>\n backgroundMarks.filter(bM => !!allTools.find(tool => tool === bM.type));\n\nexport const filterByVisibleToolTypes = (toolbarTools, marks) =>\n marks.filter(bM => !!toolbarTools.find(tool => tool === bM.type));\n\nconst getDefaultCurrentTool = toolType => toolsArr.find(tool => tool.type === toolType) || null;\n\nconst Collapsible = ({ classes, children, title }) => (\n <ExpansionPanel\n elevation={0}\n className={classes.expansionPanel}\n disabledGutters={true}\n square={true}\n >\n <ExpansionPanelSummary\n classes={{\n root: classes.summaryRoot,\n content: classes.summaryContent\n }}\n expandIcon={<ExpandMoreIcon />}\n >\n <Typography variant=\"subheading\">{title}</Typography>\n </ExpansionPanelSummary>\n <ExpansionPanelDetails className={classes.details}>{children}</ExpansionPanelDetails>\n </ExpansionPanel>\n);\n\nexport class GraphWithControls extends React.Component {\n static propTypes = {\n ...graphPropTypes,\n onUndo: PropTypes.func,\n onRedo: PropTypes.func,\n onReset: PropTypes.func,\n toolbarTools: PropTypes.arrayOf(PropTypes.string) // array of tool types that have to be displayed in the toolbar, same shape as 'allTools'\n };\n\n static defaultProps = {\n collapsibleToolbar: false,\n collapsibleToolbarTitle: '',\n toolbarTools: []\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n currentTool: getDefaultCurrentTool(props.defaultTool),\n labelModeEnabled: false\n };\n }\n\n componentDidUpdate(prevProps) {\n const { defaultTool } = this.props;\n\n if (prevProps.defaultTool !== defaultTool) {\n const currentTool = getDefaultCurrentTool(defaultTool);\n\n this.setState({ currentTool });\n }\n }\n\n changeCurrentTool = (tool, tools) =>\n this.setState({ currentTool: tools.find(t => t.type === tool) });\n\n toggleLabelMode = () => this.setState(state => ({ labelModeEnabled: !state.labelModeEnabled }));\n\n render() {\n let { currentTool, labelModeEnabled } = this.state;\n const {\n axesSettings,\n classes,\n className,\n coordinatesOnHover,\n collapsibleToolbar,\n collapsibleToolbarTitle,\n disabled,\n domain,\n labels,\n onChangeMarks,\n onUndo,\n onRedo,\n onReset,\n range,\n size,\n title\n } = this.props;\n let { backgroundMarks, marks, toolbarTools } = this.props;\n\n // make sure only valid tool types are kept (string) and without duplicates\n toolbarTools = uniq(toolbarTools || []).filter(tT => !!isString(tT)) || [];\n\n // keep only the backgroundMarks that have valid types\n backgroundMarks = filterByValidToolTypes(backgroundMarks || []);\n\n // keep only the marks that have types which appear in toolbar\n marks = filterByVisibleToolTypes(toolbarTools, marks || []);\n\n const tools = setToolbarAvailability(toolbarTools);\n\n // set current tool if there's no current tool or if the existing one is no longer available\n if (!currentTool || !toolIsAvailable(tools, currentTool)) {\n currentTool = getAvailableTool(tools);\n }\n\n const graphActions = (\n <React.Fragment>\n <ToolMenu\n currentToolType={currentTool && currentTool.type}\n disabled={!!disabled}\n labelModeEnabled={labelModeEnabled}\n onChange={tool => this.changeCurrentTool(tool, tools)}\n onToggleLabelMode={this.toggleLabelMode}\n toolbarTools={toolbarTools}\n />\n\n {!disabled && <UndoRedo onUndo={onUndo} onRedo={onRedo} onReset={onReset} />}\n </React.Fragment>\n );\n\n return (\n <div className={classNames(classes.graphWithControls, className)}>\n <div className={classes.controls}>\n {collapsibleToolbar ? (\n <Collapsible classes={classes} title={collapsibleToolbarTitle}>\n {graphActions}\n </Collapsible>\n ) : (\n graphActions\n )}\n </div>\n\n <div ref={r => (this.labelNode = r)} />\n\n <Graph\n axesSettings={axesSettings}\n backgroundMarks={backgroundMarks}\n coordinatesOnHover={coordinatesOnHover}\n currentTool={currentTool}\n domain={domain}\n labels={labels}\n labelModeEnabled={labelModeEnabled}\n marks={marks}\n onChangeMarks={!disabled ? onChangeMarks : undefined}\n range={range}\n size={size}\n title={title}\n tools={tools}\n />\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n graphWithControls: {},\n controls: {\n width: 'inherit',\n display: 'flex',\n justifyContent: 'space-between',\n padding: theme.spacing.unit,\n color: color.text(),\n backgroundColor: color.primaryLight(),\n borderTop: `solid 1px ${color.primaryDark()}`,\n borderBottom: `solid 0px ${color.primaryDark()}`,\n borderLeft: `solid 1px ${color.primaryDark()}`,\n borderRight: `solid 1px ${color.primaryDark()}`,\n '& button': {\n fontSize: theme.typography.fontSize\n }\n },\n expansionPanel: {\n backgroundColor: color.primaryLight()\n },\n summaryRoot: {\n padding: `0 ${theme.spacing.unit}px`,\n minHeight: '32px !important'\n },\n summaryContent: {\n margin: '4px 0 !important'\n },\n details: {\n padding: 0,\n marginTop: theme.spacing.unit\n }\n});\n\nexport default withStyles(styles)(GraphWithControls);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAMA;;;;;;;;;;;;;;AAEO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAyB,CAAAC,YAAY;EAAA,OAChDC,eAAA,CAASC,GAAT,CAAa,UAAAC,EAAE;IAAA,uCAAUA,EAAV;MAAcC,OAAO,EAAE,CAAC,CAACJ,YAAY,CAACK,IAAb,CAAkB,UAAAC,CAAC;QAAA,OAAIA,CAAC,KAAKH,EAAE,CAACI,IAAb;MAAA,CAAnB;IAAzB;EAAA,CAAf,KAAqF,EADrC;AAAA,CAA3C;;;;AAGA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD,EAAQC,WAAR;EAAA,OAC7BA,WAAW,IAAID,KAAf,IAAwB,CAACA,KAAK,CAACJ,IAAN,CAAW,UAAAM,IAAI;IAAA,OAAIA,IAAI,CAACJ,IAAL,KAAcG,WAAW,CAACH,IAA9B;EAAA,CAAf,KAAsD,EAAvD,EAA2DH,OADtD;AAAA,CAAxB;;;;AAGA,IA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