@pie-lib/plot 2.2.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,36 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.4.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.4.0...@pie-lib/plot@2.4.1) (2022-08-29)
7
+
8
+ **Note:** Version bump only for package @pie-lib/plot
9
+
10
+
11
+
12
+
13
+
14
+ # [2.4.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.3.0...@pie-lib/plot@2.4.0) (2022-08-15)
15
+
16
+
17
+ ### Features
18
+
19
+ * **graphing, plot:** added pixel guide lines + ui improvements ([02ddff1](https://github.com/pie-framework/pie-lib/commit/02ddff1aed6a279b8a4ae1fcf100c766596c29c4))
20
+
21
+
22
+
23
+
24
+
25
+ # [2.3.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.2.0...@pie-lib/plot@2.3.0) (2022-08-01)
26
+
27
+
28
+ ### Features
29
+
30
+ * **graphing, editable-html, plot:** Added the ability to edit/center title and lables PD-1605 PD-1690 ([dd18f92](https://github.com/pie-framework/pie-lib/commit/dd18f92e19d8be98917cd4f19eb7211122d2b7fb))
31
+
32
+
33
+
34
+
35
+
6
36
  # [2.2.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/plot@2.1.10...@pie-lib/plot@2.2.0) (2022-05-10)
7
37
 
8
38
 
package/lib/draggable.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
6
 
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
@@ -13,52 +15,42 @@ Object.defineProperty(exports, "DraggableCore", {
13
15
  });
14
16
  exports["default"] = void 0;
15
17
 
16
- var _reactDraggable = _interopRequireWildcard(require("react-draggable"));
17
-
18
- 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); }
19
-
20
- 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; }
21
-
22
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
23
19
 
24
- 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); } }
20
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
25
21
 
26
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
22
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
27
23
 
28
- function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
24
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
29
25
 
30
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
26
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
31
27
 
32
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
28
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
33
29
 
34
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
30
+ var _reactDraggable = _interopRequireWildcard(require("react-draggable"));
35
31
 
36
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
32
+ 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); }
37
33
 
38
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
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; }
39
35
 
40
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
36
+ 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); }; }
41
37
 
42
38
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
43
39
 
44
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
45
-
46
40
  var LocalDraggable = /*#__PURE__*/function (_Draggable) {
47
- _inherits(LocalDraggable, _Draggable);
41
+ (0, _inherits2["default"])(LocalDraggable, _Draggable);
48
42
 
49
43
  var _super = _createSuper(LocalDraggable);
50
44
 
51
45
  function LocalDraggable() {
52
- _classCallCheck(this, LocalDraggable);
53
-
46
+ (0, _classCallCheck2["default"])(this, LocalDraggable);
54
47
  return _super.apply(this, arguments);
55
48
  }
56
49
 
57
- _createClass(LocalDraggable, [{
50
+ (0, _createClass2["default"])(LocalDraggable, [{
58
51
  key: "componentWillReceiveProps",
59
52
  value: function componentWillReceiveProps(next) {
60
- _get(_getPrototypeOf(LocalDraggable.prototype), "componentWillReceiveProps", this).call(this, next); //Remove the x/y state as these values have now been updated and will come through as props.
61
-
53
+ (0, _get2["default"])((0, _getPrototypeOf2["default"])(LocalDraggable.prototype), "componentWillReceiveProps", this).call(this, next); //Remove the x/y state as these values have now been updated and will come through as props.
62
54
 
63
55
  this.setState({
64
56
  x: 0,
@@ -66,7 +58,6 @@ var LocalDraggable = /*#__PURE__*/function (_Draggable) {
66
58
  });
67
59
  }
68
60
  }]);
69
-
70
61
  return LocalDraggable;
71
62
  }(_reactDraggable["default"]);
72
63
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/draggable.jsx"],"names":["LocalDraggable","next","setState","x","y","Draggable"],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEqBA,c;;;;;;;;;;;;;WACnB,mCAA0BC,IAA1B,EAAgC;AAC9B,oGAAgCA,IAAhC,EAD8B,CAE9B;;;AACA,WAAKC,QAAL,CAAc;AAAEC,QAAAA,CAAC,EAAE,CAAL;AAAQC,QAAAA,CAAC,EAAE;AAAX,OAAd;AACD;;;;EALyCC,0B","sourcesContent":["import Draggable, { DraggableCore } from 'react-draggable';\n\nexport default class LocalDraggable extends Draggable {\n componentWillReceiveProps(next) {\n super.componentWillReceiveProps(next);\n //Remove the x/y state as these values have now been updated and will come through as props.\n this.setState({ x: 0, y: 0 });\n }\n}\n\nexport { DraggableCore };\n"],"file":"draggable.js"}
1
+ {"version":3,"sources":["../src/draggable.jsx"],"names":["LocalDraggable","next","setState","x","y","Draggable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;IAEqBA,c;;;;;;;;;;;;WACnB,mCAA0BC,IAA1B,EAAgC;AAC9B,sIAAgCA,IAAhC,EAD8B,CAE9B;;AACA,WAAKC,QAAL,CAAc;AAAEC,QAAAA,CAAC,EAAE,CAAL;AAAQC,QAAAA,CAAC,EAAE;AAAX,OAAd;AACD;;;EALyCC,0B","sourcesContent":["import Draggable, { DraggableCore } from 'react-draggable';\n\nexport default class LocalDraggable extends Draggable {\n componentWillReceiveProps(next) {\n super.componentWillReceiveProps(next);\n //Remove the x/y state as these values have now been updated and will come through as props.\n this.setState({ x: 0, y: 0 });\n }\n}\n\nexport { DraggableCore };\n"],"file":"draggable.js"}
@@ -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 _utils = require("./utils");
11
13
 
12
14
  var _d3Scale = require("d3-scale");
13
15
 
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
16
  var createSnapMinAndMax = function createSnapMinAndMax(_ref) {
17
17
  var min = _ref.min,
18
18
  max = _ref.max,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph-props.js"],"names":["createSnapMinAndMax","min","max","step","parseInt","create","domain","range","size","getRootNode","domain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AC,EAAEK,cAAOC,IAAP,CAAY,IAAZ,EAAkBT,YAAY,CAACT,GAA/B,EAAoCS,YAAY,CAACR,GAAjD,EAAsDQ,YAAY,CAACP,IAAnE,CADQ;AAEXY,IAAAA,CAAC,EAAEG,cAAOC,IAAP,CAAY,IAAZ,EAAkBR,WAAW,CAACV,GAA9B,EAAmCU,WAAW,CAACT,GAA/C,EAAoDS,WAAW,CAACR,IAAhE;AAFQ,GAAb;AAKA,SAAO;AAAES,IAAAA,KAAK,EAALA,KAAF;AAASK,IAAAA,IAAI,EAAJA,IAAT;AAAeX,IAAAA,MAAM,EAANA,MAAf;AAAuBC,IAAAA,KAAK,EAALA,KAAvB;AAA8BC,IAAAA,IAAI,EAAJA,IAA9B;AAAoCC,IAAAA,WAAW,EAAXA;AAApC,GAAP;AACD,CAtBM","sourcesContent":["import invariant from 'invariant';\nimport { snapTo } from './utils';\nimport { scaleLinear } from 'd3-scale';\n\nconst createSnapMinAndMax = ({ min, max, step }) => {\n // for graphing, if step is a value with decimals, we have to calculate the min & max for the grid taking in consideration that 0 has to be exactly in the middle\n // for example, if min: -5 & max: 5 & step: 0.75, in order to keep 0 in the middle we have to set min: -4.5 & max: 4.5\n return {\n step,\n min: parseInt(min / step) * step,\n max: parseInt(max / step) * step\n };\n};\n\nexport const create = (domain, range, size, getRootNode) => {\n invariant(domain.min < domain.max, 'domain: min must be less than max');\n invariant(range.min < range.max, 'range: min must be less than max');\n\n const domainMinMax = createSnapMinAndMax(domain);\n const rangeMinMax = createSnapMinAndMax(range);\n\n const scale = {\n x: scaleLinear()\n .domain([domain.min, domain.max])\n .range([0, size.width]),\n y: scaleLinear()\n .domain([range.max, range.min])\n .range([0, size.height])\n };\n\n const snap = {\n x: snapTo.bind(null, domainMinMax.min, domainMinMax.max, domainMinMax.step),\n y: snapTo.bind(null, rangeMinMax.min, rangeMinMax.max, rangeMinMax.step)\n };\n\n return { scale, snap, domain, range, size, getRootNode };\n};\n"],"file":"graph-props.js"}
1
+ {"version":3,"sources":["../src/graph-props.js"],"names":["createSnapMinAndMax","min","max","step","parseInt","create","domain","range","size","getRootNode","domainMinMax","rangeMinMax","scale","x","width","y","height","snap","snapTo","bind"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAsB,OAAwB;AAAA,MAArBC,GAAqB,QAArBA,GAAqB;AAAA,MAAhBC,GAAgB,QAAhBA,GAAgB;AAAA,MAAXC,IAAW,QAAXA,IAAW;AAClD;AACA;AAEA,SAAO;AACLA,IAAAA,IAAI,EAAJA,IADK;AAELF,IAAAA,GAAG,EAAEG,QAAQ,CAACH,GAAG,GAAGE,IAAP,CAAR,GAAuBA,IAFvB;AAGLD,IAAAA,GAAG,EAAEE,QAAQ,CAACF,GAAG,GAAGC,IAAP,CAAR,GAAuBA;AAHvB,GAAP;AAKD,CATD;;AAWO,IAAME,MAAM,GAAG,SAATA,MAAS,CAACC,MAAD,EAASC,KAAT,EAAgBC,IAAhB,EAAsBC,WAAtB,EAAsC;AAC1D,6BAAUH,MAAM,CAACL,GAAP,GAAaK,MAAM,CAACJ,GAA9B,EAAmC,mCAAnC;AACA,6BAAUK,KAAK,CAACN,GAAN,GAAYM,KAAK,CAACL,GAA5B,EAAiC,kCAAjC;AAEA,MAAMQ,YAAY,GAAGV,mBAAmB,CAACM,MAAD,CAAxC;AACA,MAAMK,WAAW,GAAGX,mBAAmB,CAACO,KAAD,CAAvC;AAEA,MAAMK,KAAK,GAAG;AACZC,IAAAA,CAAC,EAAE,4BACAP,MADA,CACO,CAACA,MAAM,CAACL,GAAR,EAAaK,MAAM,CAACJ,GAApB,CADP,EAEAK,KAFA,CAEM,CAAC,CAAD,EAAIC,IAAI,CAACM,KAAT,CAFN,CADS;AAIZC,IAAAA,CAAC,EAAE,4BACAT,MADA,CACO,CAACC,KAAK,CAACL,GAAP,EAAYK,KAAK,CAACN,GAAlB,CADP,EAEAM,KAFA,CAEM,CAAC,CAAD,EAAIC,IAAI,CAACQ,MAAT,CAFN;AAJS,GAAd;AASA,MAAMC,IAAI,GAAG;AACXJ,IAAAA,CAAC,EAAEK,cAAOC,IAAP,CAAY,IAAZ,EAAkBT,YAAY,CAACT,GAA/B,EAAoCS,YAAY,CAACR,GAAjD,EAAsDQ,YAAY,CAACP,IAAnE,CADQ;AAEXY,IAAAA,CAAC,EAAEG,cAAOC,IAAP,CAAY,IAAZ,EAAkBR,WAAW,CAACV,GAA9B,EAAmCU,WAAW,CAACT,GAA/C,EAAoDS,WAAW,CAACR,IAAhE;AAFQ,GAAb;AAKA,SAAO;AAAES,IAAAA,KAAK,EAALA,KAAF;AAASK,IAAAA,IAAI,EAAJA,IAAT;AAAeX,IAAAA,MAAM,EAANA,MAAf;AAAuBC,IAAAA,KAAK,EAALA,KAAvB;AAA8BC,IAAAA,IAAI,EAAJA,IAA9B;AAAoCC,IAAAA,WAAW,EAAXA;AAApC,GAAP;AACD,CAtBM","sourcesContent":["import invariant from 'invariant';\nimport { snapTo } from './utils';\nimport { scaleLinear } from 'd3-scale';\n\nconst createSnapMinAndMax = ({ min, max, step }) => {\n // for graphing, if step is a value with decimals, we have to calculate the min & max for the grid taking in consideration that 0 has to be exactly in the middle\n // for example, if min: -5 & max: 5 & step: 0.75, in order to keep 0 in the middle we have to set min: -4.5 & max: 4.5\n\n return {\n step,\n min: parseInt(min / step) * step,\n max: parseInt(max / step) * step\n };\n};\n\nexport const create = (domain, range, size, getRootNode) => {\n invariant(domain.min < domain.max, 'domain: min must be less than max');\n invariant(range.min < range.max, 'range: min must be less than max');\n\n const domainMinMax = createSnapMinAndMax(domain);\n const rangeMinMax = createSnapMinAndMax(range);\n\n const scale = {\n x: scaleLinear()\n .domain([domain.min, domain.max])\n .range([0, size.width]),\n y: scaleLinear()\n .domain([range.max, range.min])\n .range([0, size.height])\n };\n\n const snap = {\n x: snapTo.bind(null, domainMinMax.min, domainMinMax.max, domainMinMax.step),\n y: snapTo.bind(null, rangeMinMax.min, rangeMinMax.max, rangeMinMax.step)\n };\n\n return { scale, snap, domain, range, size, getRootNode };\n};\n"],"file":"graph-props.js"}
@@ -1,12 +1,34 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
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.gridDraggable = exports.deltaFn = void 0;
9
11
 
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+
14
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
+
16
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
+
18
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
19
+
20
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
21
+
22
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
23
+
24
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
25
+
26
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
27
+
28
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
29
+
30
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
31
+
10
32
  var _react = _interopRequireDefault(require("react"));
11
33
 
12
34
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -31,55 +53,18 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
31
53
 
32
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; }
33
55
 
34
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
35
-
36
- 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); }
37
-
38
- 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; }
39
-
40
- 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; }
41
-
42
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
43
-
44
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
45
-
46
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
47
-
48
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
49
-
50
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
51
-
52
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
53
-
54
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
55
-
56
- 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); } }
57
-
58
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
59
-
60
- 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); }
61
-
62
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
63
-
64
- 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); }; }
65
-
66
- 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); }
67
-
68
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
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); }; }
69
57
 
70
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; } }
71
59
 
72
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
73
-
74
- 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; }
75
-
76
60
  var log = (0, _debug["default"])('pie-lib:plot:grid-draggable');
77
61
 
78
62
  var deltaFn = function deltaFn(scale, snap, val) {
79
63
  return function (delta) {
80
64
  var normalized = delta + scale(0);
81
65
  var inverted = scale.invert(normalized);
82
- return snap(val + inverted);
66
+ var fixDecimalsArithmetic = snap(val + inverted).toFixed(4) * 1000 / 1000;
67
+ return fixDecimalsArithmetic;
83
68
  };
84
69
  };
85
70
  /**
@@ -96,22 +81,21 @@ var gridDraggable = function gridDraggable(opts) {
96
81
 
97
82
  (0, _invariant["default"])(!!opts && (0, _isFunction["default"])(opts.fromDelta) && (0, _isFunction["default"])(opts.bounds) && (0, _isFunction["default"])(opts.anchorPoint), 'You must supply an object with: { anchorPoint: Function, fromDelta: Function, bounds: Function }');
98
83
  return _class = /*#__PURE__*/function (_React$Component) {
99
- _inherits(GridDraggable, _React$Component);
84
+ (0, _inherits2["default"])(GridDraggable, _React$Component);
100
85
 
101
86
  var _super = _createSuper(GridDraggable);
102
87
 
103
88
  function GridDraggable() {
104
89
  var _this;
105
90
 
106
- _classCallCheck(this, GridDraggable);
91
+ (0, _classCallCheck2["default"])(this, GridDraggable);
107
92
 
108
93
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
109
94
  args[_key] = arguments[_key];
110
95
  }
111
96
 
112
97
  _this = _super.call.apply(_super, [this].concat(args));
113
-
114
- _defineProperty(_assertThisInitialized(_this), "grid", function () {
98
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "grid", function () {
115
99
  var graphProps = _this.props.graphProps;
116
100
  var scale = graphProps.scale,
117
101
  domain = graphProps.domain,
@@ -121,8 +105,7 @@ var gridDraggable = function gridDraggable(opts) {
121
105
  y: scale.y(range.step) - scale.y(0)
122
106
  };
123
107
  });
124
-
125
- _defineProperty(_assertThisInitialized(_this), "onStart", function (e) {
108
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onStart", function (e) {
126
109
  var onDragStart = _this.props.onDragStart;
127
110
 
128
111
  if (document.activeElement) {
@@ -138,8 +121,7 @@ var gridDraggable = function gridDraggable(opts) {
138
121
  onDragStart();
139
122
  }
140
123
  });
141
-
142
- _defineProperty(_assertThisInitialized(_this), "position", function () {
124
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "position", function () {
143
125
  var _opts$anchorPoint = opts.anchorPoint(_this.props),
144
126
  x = _opts$anchorPoint.x,
145
127
  y = _opts$anchorPoint.y;
@@ -156,8 +138,7 @@ var gridDraggable = function gridDraggable(opts) {
156
138
  y: deltaFn(scale.y, snap.y, y)
157
139
  };
158
140
  });
159
-
160
- _defineProperty(_assertThisInitialized(_this), "tiny", function (key, event) {
141
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "tiny", function (key, event) {
161
142
  var K = key.toUpperCase();
162
143
  var end = event["client".concat(K)];
163
144
 
@@ -168,8 +149,7 @@ var gridDraggable = function gridDraggable(opts) {
168
149
  log('[tiny] key: ', key, 'delta: ', delta, 'out: ', out);
169
150
  return out;
170
151
  });
171
-
172
- _defineProperty(_assertThisInitialized(_this), "getScaledBounds", function () {
152
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getScaledBounds", function () {
173
153
  var bounds = opts.bounds(_this.props, _this.props.graphProps);
174
154
  log('bounds: ', bounds);
175
155
 
@@ -184,13 +164,12 @@ var gridDraggable = function gridDraggable(opts) {
184
164
  log('[getScaledBounds]: ', scaled);
185
165
  return scaled;
186
166
  });
187
-
188
- _defineProperty(_assertThisInitialized(_this), "skipDragOutsideOfBounds", function (dd, e, graphProps) {
167
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "skipDragOutsideOfBounds", function (dd, e, graphProps) {
189
168
  // ignore drag movement outside of the domain and range.
190
169
  var rootNode = graphProps.getRootNode();
191
170
 
192
171
  var _clientPoint = (0, _d3Selection.clientPoint)(rootNode, e),
193
- _clientPoint2 = _slicedToArray(_clientPoint, 2),
172
+ _clientPoint2 = (0, _slicedToArray2["default"])(_clientPoint, 2),
194
173
  rawX = _clientPoint2[0],
195
174
  rawY = _clientPoint2[1];
196
175
 
@@ -203,8 +182,7 @@ var gridDraggable = function gridDraggable(opts) {
203
182
  var yOutside = dd.deltaY > 0 && y > range.max || dd.deltaY < 0 && y < range.min;
204
183
  return xOutside || yOutside;
205
184
  });
206
-
207
- _defineProperty(_assertThisInitialized(_this), "onDrag", function (e, dd) {
185
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDrag", function (e, dd) {
208
186
  var _this$props = _this.props,
209
187
  onDrag = _this$props.onDrag,
210
188
  graphProps = _this$props.graphProps;
@@ -244,8 +222,7 @@ var gridDraggable = function gridDraggable(opts) {
244
222
  onDrag(dragArg);
245
223
  }
246
224
  });
247
-
248
- _defineProperty(_assertThisInitialized(_this), "getDelta", function (point) {
225
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDelta", function (point) {
249
226
  var pos = _this.position();
250
227
 
251
228
  var p = {
@@ -254,15 +231,13 @@ var gridDraggable = function gridDraggable(opts) {
254
231
  };
255
232
  return utils.getDelta(pos.anchorPoint, p);
256
233
  });
257
-
258
- _defineProperty(_assertThisInitialized(_this), "applyDelta", function (point) {
234
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "applyDelta", function (point) {
259
235
  var delta = _this.getDelta(point);
260
236
 
261
237
  log('[applyDelta] delta:', delta);
262
238
  return opts.fromDelta(_this.props, delta);
263
239
  });
264
-
265
- _defineProperty(_assertThisInitialized(_this), "onStop", function (e, dd) {
240
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onStop", function (e, dd) {
266
241
  log('[onStop] dd:', dd);
267
242
  var _this$props2 = _this.props,
268
243
  onDragStop = _this$props2.onDragStop,
@@ -289,7 +264,7 @@ var gridDraggable = function gridDraggable(opts) {
289
264
  snap = graphProps.snap;
290
265
 
291
266
  var _clientPoint3 = (0, _d3Selection.clientPoint)(e.target, e),
292
- _clientPoint4 = _slicedToArray(_clientPoint3, 2),
267
+ _clientPoint4 = (0, _slicedToArray2["default"])(_clientPoint3, 2),
293
268
  rawX = _clientPoint4[0],
294
269
  rawY = _clientPoint4[1];
295
270
 
@@ -313,11 +288,10 @@ var gridDraggable = function gridDraggable(opts) {
313
288
 
314
289
  return false;
315
290
  });
316
-
317
291
  return _this;
318
292
  }
319
293
 
320
- _createClass(GridDraggable, [{
294
+ (0, _createClass2["default"])(GridDraggable, [{
321
295
  key: "render",
322
296
  value: function render() {
323
297
  /* eslint-disable no-unused-vars */
@@ -325,10 +299,9 @@ var gridDraggable = function gridDraggable(opts) {
325
299
  var _this$props3 = this.props,
326
300
  disabled = _this$props3.disabled,
327
301
  onClick = _this$props3.onClick,
328
- rest = _objectWithoutProperties(_this$props3, _excluded);
302
+ rest = (0, _objectWithoutProperties2["default"])(_this$props3, _excluded);
329
303
  /* eslint-enable no-unused-vars */
330
304
 
331
-
332
305
  var grid = this.grid(); //prevent the text select icon from rendering.
333
306
 
334
307
  var onMouseDown = function onMouseDown(e) {
@@ -349,15 +322,14 @@ var gridDraggable = function gridDraggable(opts) {
349
322
  onStop: this.onStop,
350
323
  axis: opts.axis || 'both',
351
324
  grid: [grid.x, grid.y]
352
- }, /*#__PURE__*/_react["default"].createElement(Comp, _extends({}, rest, {
325
+ }, /*#__PURE__*/_react["default"].createElement(Comp, (0, _extends2["default"])({}, rest, {
353
326
  disabled: disabled,
354
327
  isDragging: isDragging
355
328
  })));
356
329
  }
357
330
  }]);
358
-
359
331
  return GridDraggable;
360
- }(_react["default"].Component), _defineProperty(_class, "propTypes", {
332
+ }(_react["default"].Component), (0, _defineProperty2["default"])(_class, "propTypes", {
361
333
  disabled: _propTypes["default"].bool,
362
334
  onDragStart: _propTypes["default"].func,
363
335
  onDrag: _propTypes["default"].func,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/grid-draggable.jsx"],"names":["log","deltaFn","scale","snap","val","delta","normalized","inverted","invert","gridDraggable","opts","Comp","fromDelta","bounds","anchorPoint","graphProps","props","domain","range","x","step","y","e","onDragStart","document","activeElement","blur","setState","startX","clientX","startY","clientY","key","event","K","toUpperCase","end","start","state","Math","abs","out","grid","scaled","left","interval","right","top","bottom","dd","rootNode","getRootNode","rawX","rawY","xOutside","deltaX","min","max","yOutside","deltaY","onDrag","getScaledBounds","skipDragOutsideOfBounds","dragArg","applyDelta","undefined","point","pos","position","p","utils","getDelta","onDragStop","onClick","lastX","lastY","isClick","tiny","target","disabled","rest","onMouseDown","nativeEvent","preventDefault","isDragging","onStart","onStop","axis","React","Component","PropTypes","bool","func","onMove","GraphPropsType","isRequired"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;;AACO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAQC,IAAR,EAAcC,GAAd;AAAA,SAAsB,UAAAC,KAAK,EAAI;AACpD,QAAMC,UAAU,GAAGD,KAAK,GAAGH,KAAK,CAAC,CAAD,CAAhC;AACA,QAAMK,QAAQ,GAAGL,KAAK,CAACM,MAAN,CAAaF,UAAb,CAAjB;AACA,WAAOH,IAAI,CAACC,GAAG,GAAGG,QAAP,CAAX;AACD,GAJsB;AAAA,CAAhB;AAKP;AACA;AACA;AACA;;;;;AACO,IAAME,aAAa,GAAG,SAAhBA,aAAgB,CAAAC,IAAI;AAAA,SAAI,UAAAC,IAAI,EAAI;AAAA;;AAC3C,+BACE,CAAC,CAACD,IAAF,IAAU,4BAAWA,IAAI,CAACE,SAAhB,CAAV,IAAwC,4BAAWF,IAAI,CAACG,MAAhB,CAAxC,IAAmE,4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3D,CAAC;AAAA,mBAAIA,CAAC,CAAC4D,WAAF,CAAcC,cAAd,EAAJ;AAAA,WAArB;AAEA;AACN;AACA;AACA;;;AACM,cAAMC,UAAU,GAAG,KAAK9C,KAAL,GAAa,CAAC,CAAC,KAAKA,KAAL,CAAWV,MAA1B,GAAmC,KAAtD;AAEA,8BACE,gCAAC,wBAAD;AACE,YAAA,QAAQ,EAAEmD,QADZ;AAEE,YAAA,WAAW,EAAEE,WAFf;AAGE,YAAA,OAAO,EAAE,KAAKI,OAHhB;AAIE,YAAA,MAAM,EAAE,KAAKzB,MAJf;AAKE,YAAA,MAAM,EAAE,KAAK0B,MALf;AAME,YAAA,IAAI,EAAE5E,IAAI,CAAC6E,IAAL,IAAa,MANrB;AAOE,YAAA,IAAI,EAAE,CAAC7C,IAAI,CAACvB,CAAN,EAASuB,IAAI,CAACrB,CAAd;AAPR,0BASE,gCAAC,IAAD,eAAU2D,IAAV;AAAgB,YAAA,QAAQ,EAAED,QAA1B;AAAoC,YAAA,UAAU,EAAEK;AAAhD,aATF,CADF;AAaD;AAlMH;;AAAA;AAAA,MAAmCI,kBAAMC,SAAzC,wCACqB;AACjBV,MAAAA,QAAQ,EAAEW,sBAAUC,IADH;AAEjBpE,MAAAA,WAAW,EAAEmE,sBAAUE,IAFN;AAGjBhC,MAAAA,MAAM,EAAE8B,sBAAUE,IAHD;AAIjBpB,MAAAA,UAAU,EAAEkB,sBAAUE,IAJL;AAKjBnB,MAAAA,OAAO,EAAEiB,sBAAUE,IALF;AAMjBC,MAAAA,MAAM,EAAEH,sBAAUE,IAND;AAOjB7E,MAAAA,UAAU,EAAE+E,sBAAeC;AAPV,KADrB;AAoMD,GAzMgC;AAAA,CAA1B","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { GraphPropsType } from './types';\nimport { DraggableCore } from './draggable';\nimport debug from 'debug';\nimport * as utils from './utils';\nimport isFunction from 'lodash/isFunction';\nimport invariant from 'invariant';\nimport { clientPoint } from 'd3-selection';\nconst log = debug('pie-lib:plot:grid-draggable');\nexport const deltaFn = (scale, snap, val) => delta => {\n const normalized = delta + scale(0);\n const inverted = scale.invert(normalized);\n return snap(val + inverted);\n};\n/**\n * Creates a Component that is draggable, within a bounded grid.\n * @param {*} opts\n */\nexport const gridDraggable = opts => Comp => {\n invariant(\n !!opts && isFunction(opts.fromDelta) && isFunction(opts.bounds) && isFunction(opts.anchorPoint),\n 'You must supply an object with: { anchorPoint: Function, fromDelta: Function, bounds: Function }'\n );\n return class GridDraggable extends React.Component {\n static propTypes = {\n disabled: PropTypes.bool,\n onDragStart: PropTypes.func,\n onDrag: PropTypes.func,\n onDragStop: PropTypes.func,\n onClick: PropTypes.func,\n onMove: PropTypes.func,\n graphProps: GraphPropsType.isRequired\n };\n grid = () => {\n const { graphProps } = this.props;\n const { scale, domain, range } = graphProps;\n return {\n x: scale.x(domain.step) - scale.x(0),\n y: scale.y(range.step) - scale.y(0)\n };\n };\n onStart = e => {\n const { onDragStart } = this.props;\n if (document.activeElement) {\n document.activeElement.blur();\n }\n this.setState({ startX: e.clientX, startY: e.clientY });\n if (onDragStart) {\n onDragStart();\n }\n };\n position = () => {\n const { x, y } = opts.anchorPoint(this.props);\n const { graphProps } = this.props;\n const { scale, snap } = graphProps;\n return {\n anchorPoint: {\n x,\n y\n },\n x: deltaFn(scale.x, snap.x, x),\n y: deltaFn(scale.y, snap.y, y)\n };\n };\n\n tiny = (key, event) => {\n const K = key.toUpperCase();\n const end = event[`client${K}`];\n const start = this.state[`start${K}`];\n const delta = Math.abs(end - start);\n const out = delta < Math.abs(this.grid()[key]) / 10;\n log('[tiny] key: ', key, 'delta: ', delta, 'out: ', out);\n return out;\n };\n\n getScaledBounds = () => {\n const bounds = opts.bounds(this.props, this.props.graphProps);\n log('bounds: ', bounds);\n const grid = this.grid();\n\n const scaled = {\n left: (bounds.left / grid.interval) * grid.x,\n right: (bounds.right / grid.interval) * grid.x,\n top: (bounds.top / grid.interval) * grid.y,\n bottom: (bounds.bottom / grid.interval) * grid.y\n };\n log('[getScaledBounds]: ', scaled);\n return scaled;\n };\n\n skipDragOutsideOfBounds = (dd, e, graphProps) => {\n // ignore drag movement outside of the domain and range.\n const rootNode = graphProps.getRootNode();\n const [rawX, rawY] = clientPoint(rootNode, e);\n const { scale, domain, range } = graphProps;\n let x = scale.x.invert(rawX);\n let y = scale.y.invert(rawY);\n\n const xOutside = (dd.deltaX > 0 && x < domain.min) || (dd.deltaX < 0 && x > domain.max);\n const yOutside = (dd.deltaY > 0 && y > range.max) || (dd.deltaY < 0 && y < range.min);\n return xOutside || yOutside;\n };\n\n onDrag = (e, dd) => {\n const { onDrag, graphProps } = this.props;\n\n if (!onDrag) {\n return;\n }\n\n const bounds = this.getScaledBounds();\n\n if (dd.deltaX < 0 && dd.deltaX < bounds.left) {\n return;\n }\n\n if (dd.deltaX > 0 && dd.deltaX > bounds.right) {\n return;\n }\n\n if (dd.deltaY < 0 && dd.deltaY < bounds.top) {\n return;\n }\n\n if (dd.deltaY > 0 && dd.deltaY > bounds.bottom) {\n return;\n }\n\n if (this.skipDragOutsideOfBounds(dd, e, graphProps)) {\n return;\n }\n\n const dragArg = this.applyDelta({ x: dd.deltaX, y: dd.deltaY });\n\n if (dragArg !== undefined || dragArg !== null) {\n onDrag(dragArg);\n }\n };\n\n getDelta = point => {\n const pos = this.position();\n\n const p = {\n x: pos.x(point.x),\n y: pos.y(point.y)\n };\n\n return utils.getDelta(pos.anchorPoint, p);\n };\n\n applyDelta = point => {\n const delta = this.getDelta(point);\n log('[applyDelta] delta:', delta);\n return opts.fromDelta(this.props, delta);\n };\n\n onStop = (e, dd) => {\n log('[onStop] dd:', dd);\n const { onDragStop, onClick } = this.props;\n\n if (onDragStop) {\n onDragStop();\n }\n\n log('[onStop] lastX/Y: ', dd.lastX, dd.lastY);\n const isClick = this.tiny('x', e) && this.tiny('y', e);\n\n if (isClick) {\n if (onClick) {\n log('call onClick');\n this.setState({ startX: null });\n const { graphProps } = this.props;\n const { scale, snap } = graphProps;\n const [rawX, rawY] = clientPoint(e.target, e);\n let x = scale.x.invert(rawX);\n let y = scale.y.invert(rawY);\n x = snap.x(x);\n y = snap.y(y);\n onClick({ x, y });\n return false;\n }\n }\n\n this.setState({ startX: null, startY: null });\n // return false to prevent state updates in the underlying draggable - a move will have triggered an update already.\n return false;\n };\n\n render() {\n /* eslint-disable no-unused-vars */\n //Note: we pull onClick out so that it's not in ...rest.\n const { disabled, onClick, ...rest } = this.props;\n /* eslint-enable no-unused-vars */\n\n const grid = this.grid();\n //prevent the text select icon from rendering.\n const onMouseDown = e => e.nativeEvent.preventDefault();\n\n /**\n * TODO: This shouldnt be necessary, we should be able to use the r-d classnames.\n * But they aren't being unset. If we continue with this lib, we'll have to fix this.\n */\n const isDragging = this.state ? !!this.state.startX : false;\n\n return (\n <DraggableCore\n disabled={disabled}\n onMouseDown={onMouseDown}\n onStart={this.onStart}\n onDrag={this.onDrag}\n onStop={this.onStop}\n axis={opts.axis || 'both'}\n grid={[grid.x, grid.y]}\n >\n <Comp {...rest} disabled={disabled} isDragging={isDragging} />\n </DraggableCore>\n );\n }\n };\n};\n"],"file":"grid-draggable.js"}
1
+ {"version":3,"sources":["../src/grid-draggable.jsx"],"names":["log","deltaFn","scale","snap","val","delta","normalized","inverted","invert","fixDecimalsArithmetic","toFixed","gridDraggable","opts","Comp","fromDelta","bounds","anchorPoint","graphProps","props","domain","range","x","step","y","e","onDragStart","document","activeElement","blur","setState","startX","clientX","startY","clientY","key","event","K","toUpperCase","end","start","state","Math","abs","out","grid","scaled","left","interval","right","top","bottom","dd","rootNode","getRootNode","rawX","rawY","xOutside","deltaX","min","max","yOutside","deltaY","onDrag","getScaledBounds","skipDragOutsideOfBounds","dragArg","applyDelta","undefined","point","pos","position","p","utils","getDelta","onDragStop","onClick","lastX","lastY","isClick","tiny","target","disabled","rest","onMouseDown","nativeEvent","preventDefault","isDragging","onStart","onStop","axis","React","Component","PropTypes","bool","func","onMove","GraphPropsType","isRequired"],"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IAAL,IAAa,MANrB;AAOE,YAAA,IAAI,EAAE,CAAC7C,IAAI,CAACvB,CAAN,EAASuB,IAAI,CAACrB,CAAd;AAPR,0BASE,gCAAC,IAAD,gCAAU2D,IAAV;AAAgB,YAAA,QAAQ,EAAED,QAA1B;AAAoC,YAAA,UAAU,EAAEK;AAAhD,aATF,CADF;AAaD;AAnMH;AAAA;AAAA,MAAmCI,kBAAMC,SAAzC,yDACqB;AACjBV,MAAAA,QAAQ,EAAEW,sBAAUC,IADH;AAEjBpE,MAAAA,WAAW,EAAEmE,sBAAUE,IAFN;AAGjBhC,MAAAA,MAAM,EAAE8B,sBAAUE,IAHD;AAIjBpB,MAAAA,UAAU,EAAEkB,sBAAUE,IAJL;AAKjBnB,MAAAA,OAAO,EAAEiB,sBAAUE,IALF;AAMjBC,MAAAA,MAAM,EAAEH,sBAAUE,IAND;AAOjB7E,MAAAA,UAAU,EAAE+E,sBAAeC;AAPV,KADrB;AAqMD,GA1MgC;AAAA,CAA1B","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { GraphPropsType } from './types';\nimport { DraggableCore } from './draggable';\nimport debug from 'debug';\nimport * as utils from './utils';\nimport isFunction from 'lodash/isFunction';\nimport invariant from 'invariant';\nimport { clientPoint } from 'd3-selection';\n\nconst log = debug('pie-lib:plot:grid-draggable');\n\nexport const deltaFn = (scale, snap, val) => delta => {\n const normalized = delta + scale(0);\n const inverted = scale.invert(normalized);\n\n const fixDecimalsArithmetic = (snap(val + inverted).toFixed(4) * 1000) / 1000;\n\n return fixDecimalsArithmetic;\n};\n\n/**\n * Creates a Component that is draggable, within a bounded grid.\n * @param {*} opts\n */\nexport const gridDraggable = opts => Comp => {\n invariant(\n !!opts && isFunction(opts.fromDelta) && isFunction(opts.bounds) && isFunction(opts.anchorPoint),\n 'You must supply an object with: { anchorPoint: Function, fromDelta: Function, bounds: Function }'\n );\n return class GridDraggable extends React.Component {\n static propTypes = {\n disabled: PropTypes.bool,\n onDragStart: PropTypes.func,\n onDrag: PropTypes.func,\n onDragStop: PropTypes.func,\n onClick: PropTypes.func,\n onMove: PropTypes.func,\n graphProps: GraphPropsType.isRequired\n };\n grid = () => {\n const { graphProps } = this.props;\n const { scale, domain, range } = graphProps;\n return {\n x: scale.x(domain.step) - scale.x(0),\n y: scale.y(range.step) - scale.y(0)\n };\n };\n onStart = e => {\n const { onDragStart } = this.props;\n if (document.activeElement) {\n document.activeElement.blur();\n }\n this.setState({ startX: e.clientX, startY: e.clientY });\n if (onDragStart) {\n onDragStart();\n }\n };\n position = () => {\n const { x, y } = opts.anchorPoint(this.props);\n const { graphProps } = this.props;\n const { scale, snap } = graphProps;\n\n return {\n anchorPoint: {\n x,\n y\n },\n x: deltaFn(scale.x, snap.x, x),\n y: deltaFn(scale.y, snap.y, y)\n };\n };\n\n tiny = (key, event) => {\n const K = key.toUpperCase();\n const end = event[`client${K}`];\n const start = this.state[`start${K}`];\n const delta = Math.abs(end - start);\n const out = delta < Math.abs(this.grid()[key]) / 10;\n log('[tiny] key: ', key, 'delta: ', delta, 'out: ', out);\n return out;\n };\n\n getScaledBounds = () => {\n const bounds = opts.bounds(this.props, this.props.graphProps);\n log('bounds: ', bounds);\n const grid = this.grid();\n\n const scaled = {\n left: (bounds.left / grid.interval) * grid.x,\n right: (bounds.right / grid.interval) * grid.x,\n top: (bounds.top / grid.interval) * grid.y,\n bottom: (bounds.bottom / grid.interval) * grid.y\n };\n log('[getScaledBounds]: ', scaled);\n return scaled;\n };\n\n skipDragOutsideOfBounds = (dd, e, graphProps) => {\n // ignore drag movement outside of the domain and range.\n const rootNode = graphProps.getRootNode();\n const [rawX, rawY] = clientPoint(rootNode, e);\n const { scale, domain, range } = graphProps;\n let x = scale.x.invert(rawX);\n let y = scale.y.invert(rawY);\n\n const xOutside = (dd.deltaX > 0 && x < domain.min) || (dd.deltaX < 0 && x > domain.max);\n const yOutside = (dd.deltaY > 0 && y > range.max) || (dd.deltaY < 0 && y < range.min);\n return xOutside || yOutside;\n };\n\n onDrag = (e, dd) => {\n const { onDrag, graphProps } = this.props;\n\n if (!onDrag) {\n return;\n }\n\n const bounds = this.getScaledBounds();\n\n if (dd.deltaX < 0 && dd.deltaX < bounds.left) {\n return;\n }\n\n if (dd.deltaX > 0 && dd.deltaX > bounds.right) {\n return;\n }\n\n if (dd.deltaY < 0 && dd.deltaY < bounds.top) {\n return;\n }\n\n if (dd.deltaY > 0 && dd.deltaY > bounds.bottom) {\n return;\n }\n\n if (this.skipDragOutsideOfBounds(dd, e, graphProps)) {\n return;\n }\n\n const dragArg = this.applyDelta({ x: dd.deltaX, y: dd.deltaY });\n\n if (dragArg !== undefined || dragArg !== null) {\n onDrag(dragArg);\n }\n };\n\n getDelta = point => {\n const pos = this.position();\n\n const p = {\n x: pos.x(point.x),\n y: pos.y(point.y)\n };\n\n return utils.getDelta(pos.anchorPoint, p);\n };\n\n applyDelta = point => {\n const delta = this.getDelta(point);\n log('[applyDelta] delta:', delta);\n return opts.fromDelta(this.props, delta);\n };\n\n onStop = (e, dd) => {\n log('[onStop] dd:', dd);\n const { onDragStop, onClick } = this.props;\n\n if (onDragStop) {\n onDragStop();\n }\n\n log('[onStop] lastX/Y: ', dd.lastX, dd.lastY);\n const isClick = this.tiny('x', e) && this.tiny('y', e);\n\n if (isClick) {\n if (onClick) {\n log('call onClick');\n this.setState({ startX: null });\n const { graphProps } = this.props;\n const { scale, snap } = graphProps;\n const [rawX, rawY] = clientPoint(e.target, e);\n let x = scale.x.invert(rawX);\n let y = scale.y.invert(rawY);\n x = snap.x(x);\n y = snap.y(y);\n onClick({ x, y });\n return false;\n }\n }\n\n this.setState({ startX: null, startY: null });\n // return false to prevent state updates in the underlying draggable - a move will have triggered an update already.\n return false;\n };\n\n render() {\n /* eslint-disable no-unused-vars */\n //Note: we pull onClick out so that it's not in ...rest.\n const { disabled, onClick, ...rest } = this.props;\n /* eslint-enable no-unused-vars */\n\n const grid = this.grid();\n //prevent the text select icon from rendering.\n const onMouseDown = e => e.nativeEvent.preventDefault();\n\n /**\n * TODO: This shouldnt be necessary, we should be able to use the r-d classnames.\n * But they aren't being unset. If we continue with this lib, we'll have to fix this.\n */\n const isDragging = this.state ? !!this.state.startX : false;\n\n return (\n <DraggableCore\n disabled={disabled}\n onMouseDown={onMouseDown}\n onStart={this.onStart}\n onDrag={this.onDrag}\n onStop={this.onStop}\n axis={opts.axis || 'both'}\n grid={[grid.x, grid.y]}\n >\n <Comp {...rest} disabled={disabled} isDragging={isDragging} />\n </DraggableCore>\n );\n }\n };\n};\n"],"file":"grid-draggable.js"}
package/lib/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
6
 
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
@@ -54,6 +56,4 @@ var _graphProps = require("./graph-props");
54
56
  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); }
55
57
 
56
58
  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; }
57
-
58
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
59
59
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AACA;;;;AACA;;;;AACA","sourcesContent":["import Root from './root';\nimport Draggable from './draggable';\nimport { gridDraggable } from './grid-draggable';\nimport * as utils from './utils';\nimport * as trig from './trig';\nimport * as types from './types';\nimport { create as createGraphProps } from './graph-props';\n\nexport { Root, Draggable, gridDraggable, utils, trig, types, createGraphProps };\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AACA;;;;AACA;;;;AACA","sourcesContent":["import Root from './root';\nimport Draggable from './draggable';\nimport { gridDraggable } from './grid-draggable';\nimport * as utils from './utils';\nimport * as trig from './trig';\nimport * as types from './types';\nimport { create as createGraphProps } from './graph-props';\n\nexport { Root, Draggable, gridDraggable, utils, trig, types, createGraphProps };\n"],"file":"index.js"}