dash-core-components 4.2.0 → 4.3.0

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.
Files changed (44) hide show
  1. package/dash_core_components/async-datepicker.js +1 -1
  2. package/dash_core_components/async-datepicker.js.map +1 -1
  3. package/dash_core_components/async-dropdown.js +1 -1
  4. package/dash_core_components/async-dropdown.js.map +1 -1
  5. package/dash_core_components/async-graph.js +1 -1
  6. package/dash_core_components/async-graph.js.map +1 -1
  7. package/dash_core_components/async-markdown.js +1 -1
  8. package/dash_core_components/async-markdown.js.map +1 -1
  9. package/dash_core_components/async-slider.js +1 -1
  10. package/dash_core_components/async-slider.js.map +1 -1
  11. package/dash_core_components/async-upload.js +1 -1
  12. package/dash_core_components/async-upload.js.map +1 -1
  13. package/dash_core_components/dash_core_components-shared.js +1 -1
  14. package/dash_core_components/dash_core_components-shared.js.map +1 -1
  15. package/dash_core_components/dash_core_components.js +1 -1
  16. package/dash_core_components/dash_core_components.js.map +1 -1
  17. package/dash_core_components/plotly.min.js +8 -0
  18. package/lib/components/Clipboard.react.js +220 -173
  19. package/lib/components/ConfirmDialog.react.js +62 -34
  20. package/lib/components/ConfirmDialogProvider.react.js +45 -21
  21. package/lib/components/Download.react.js +46 -22
  22. package/lib/components/Geolocation.react.js +92 -64
  23. package/lib/components/Graph.react.js +99 -71
  24. package/lib/components/Interval.react.js +88 -56
  25. package/lib/components/Link.react.js +6 -5
  26. package/lib/components/Location.react.js +127 -97
  27. package/lib/components/Markdown.react.js +37 -16
  28. package/lib/components/Store.react.js +177 -128
  29. package/lib/components/Upload.react.js +28 -8
  30. package/lib/fragments/Graph.privateprops.js +9 -3
  31. package/lib/fragments/Graph.react.js +411 -339
  32. package/lib/fragments/Markdown.react.js +160 -120
  33. package/lib/fragments/Math.react.js +49 -24
  34. package/lib/fragments/Upload.react.js +341 -302
  35. package/lib/utils/LazyLoader/graph.js +3 -2
  36. package/lib/utils/LazyLoader/hljs.js +5 -2
  37. package/lib/utils/LazyLoader/markdown.js +3 -2
  38. package/lib/utils/LazyLoader/mathjax.js +5 -2
  39. package/lib/utils/LazyLoader/plotly.js +6 -7
  40. package/lib/utils/LazyLoader/upload.js +3 -2
  41. package/lib/utils/LoadingElement.js +3 -2
  42. package/lib/utils/MarkdownHighlighter.js +6 -5
  43. package/lib/utils/ResizeDetector.js +14 -9
  44. package/package.json +3 -3
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -9,33 +10,56 @@ var _react = require("react");
9
10
  var _base64Js = require("base64-js");
10
11
  var _fileSaver = require("file-saver");
11
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- var getValue = (src, fallback, key) => key in src ? src[key] : fallback[key];
13
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
15
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
17
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
19
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
20
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
21
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
22
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
23
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
24
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
25
+ var getValue = function getValue(src, fallback, key) {
26
+ return key in src ? src[key] : fallback[key];
27
+ };
13
28
 
14
29
  /**
15
30
  * The Download component opens a download dialog when the data property changes.
16
31
  */
17
- class Download extends _react.Component {
18
- componentDidUpdate(prevProps) {
19
- var data = this.props.data;
20
- // If the data hasn't changed, do nothing.
21
- if (!data || data === prevProps.data) {
22
- return;
23
- }
24
- // Extract options from data if provided, fallback to props.
25
- var type = getValue(data, this.props, 'type');
26
- var base64 = getValue(data, this.props, 'base64');
27
- // Invoke the download using a Blob.
28
- var content = base64 ? (0, _base64Js.toByteArray)(data.content) : data.content;
29
- var blob = new Blob([content], {
30
- type: type
31
- });
32
- (0, _fileSaver.saveAs)(blob, data.filename);
33
- }
34
- render() {
35
- return null;
32
+ var Download = exports.default = /*#__PURE__*/function (_Component) {
33
+ function Download() {
34
+ _classCallCheck(this, Download);
35
+ return _callSuper(this, Download, arguments);
36
36
  }
37
- }
38
- exports.default = Download;
37
+ _inherits(Download, _Component);
38
+ return _createClass(Download, [{
39
+ key: "componentDidUpdate",
40
+ value: function componentDidUpdate(prevProps) {
41
+ var data = this.props.data;
42
+ // If the data hasn't changed, do nothing.
43
+ if (!data || data === prevProps.data) {
44
+ return;
45
+ }
46
+ // Extract options from data if provided, fallback to props.
47
+ var type = getValue(data, this.props, 'type');
48
+ var base64 = getValue(data, this.props, 'base64');
49
+ // Invoke the download using a Blob.
50
+ var content = base64 ? (0, _base64Js.toByteArray)(data.content) : data.content;
51
+ var blob = new Blob([content], {
52
+ type: type
53
+ });
54
+ (0, _fileSaver.saveAs)(blob, data.filename);
55
+ }
56
+ }, {
57
+ key: "render",
58
+ value: function render() {
59
+ return null;
60
+ }
61
+ }]);
62
+ }(_react.Component);
39
63
  Download.propTypes = {
40
64
  /**
41
65
  * The ID of this component, used to identify dash components in callbacks.
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -7,81 +8,108 @@ exports.default = void 0;
7
8
  var _react = require("react");
8
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
12
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
13
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
15
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
17
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
18
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
19
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
20
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
21
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
22
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
10
23
  /**
11
24
  * The CurrentLocation component gets geolocation of the device from the web browser. See more info here:
12
25
  * https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API
13
26
  */
14
-
15
- class Geolocation extends _react.Component {
16
- constructor(props) {
17
- super(props);
18
- this.success = this.success.bind(this);
19
- this.error = this.error.bind(this);
27
+ var Geolocation = exports.default = /*#__PURE__*/function (_Component) {
28
+ function Geolocation(props) {
29
+ var _this;
30
+ _classCallCheck(this, Geolocation);
31
+ _this = _callSuper(this, Geolocation, [props]);
32
+ _this.success = _this.success.bind(_this);
33
+ _this.error = _this.error.bind(_this);
34
+ return _this;
20
35
  }
21
- updatePosition() {
22
- if (this.props.update_now) {
36
+ _inherits(Geolocation, _Component);
37
+ return _createClass(Geolocation, [{
38
+ key: "updatePosition",
39
+ value: function updatePosition() {
40
+ if (this.props.update_now) {
41
+ this.props.setProps({
42
+ update_now: false
43
+ });
44
+ }
45
+ if (!navigator.geolocation) {
46
+ this.error({
47
+ code: 999,
48
+ message: 'Your browser does not support Geolocation'
49
+ });
50
+ } else {
51
+ var positionOptions = {
52
+ enableHighAccuracy: this.props.high_accuracy,
53
+ maximumAge: this.props.maximum_age,
54
+ timeout: this.props.timeout
55
+ };
56
+ navigator.geolocation.getCurrentPosition(this.success, this.error, positionOptions);
57
+ }
58
+ }
59
+ }, {
60
+ key: "componentDidMount",
61
+ value: function componentDidMount() {
62
+ this.updatePosition();
63
+ }
64
+ }, {
65
+ key: "componentDidUpdate",
66
+ value: function componentDidUpdate(prevProps) {
67
+ if (this.props.update_now || prevProps.maximum_age !== this.props.maximum_age || prevProps.timeout !== this.props.timeout || prevProps.high_accuracy !== this.props.high_accuracy) {
68
+ this.updatePosition();
69
+ }
70
+ }
71
+ }, {
72
+ key: "success",
73
+ value: function success(pos) {
74
+ var _crd$latitude, _crd$longitude, _crd$accuracy, _crd$altitude, _crd$altitudeAccuracy, _crd$speed, _crd$heading;
75
+ var crd = pos.coords;
76
+ var position_obj = {
77
+ lat: (_crd$latitude = crd.latitude) !== null && _crd$latitude !== void 0 ? _crd$latitude : null,
78
+ lon: (_crd$longitude = crd.longitude) !== null && _crd$longitude !== void 0 ? _crd$longitude : null,
79
+ accuracy: (_crd$accuracy = crd.accuracy) !== null && _crd$accuracy !== void 0 ? _crd$accuracy : null,
80
+ alt: (_crd$altitude = crd.altitude) !== null && _crd$altitude !== void 0 ? _crd$altitude : null,
81
+ alt_accuracy: (_crd$altitudeAccuracy = crd.altitudeAccuracy) !== null && _crd$altitudeAccuracy !== void 0 ? _crd$altitudeAccuracy : null,
82
+ speed: (_crd$speed = crd.speed) !== null && _crd$speed !== void 0 ? _crd$speed : null,
83
+ heading: (_crd$heading = crd.heading) !== null && _crd$heading !== void 0 ? _crd$heading : null
84
+ };
23
85
  this.props.setProps({
24
- update_now: false
86
+ local_date: new Date(pos.timestamp).toLocaleString(),
87
+ timestamp: pos.timestamp,
88
+ position: position_obj,
89
+ position_error: null
25
90
  });
26
91
  }
27
- if (!navigator.geolocation) {
28
- this.error({
29
- code: 999,
30
- message: 'Your browser does not support Geolocation'
92
+ }, {
93
+ key: "error",
94
+ value: function error(err) {
95
+ if (this.props.show_alert) {
96
+ alert("ERROR(".concat(err.code, "): ").concat(err.message));
97
+ }
98
+ this.props.setProps({
99
+ position: null,
100
+ position_error: {
101
+ code: err.code,
102
+ message: err.message
103
+ }
31
104
  });
32
- } else {
33
- var positionOptions = {
34
- enableHighAccuracy: this.props.high_accuracy,
35
- maximumAge: this.props.maximum_age,
36
- timeout: this.props.timeout
37
- };
38
- navigator.geolocation.getCurrentPosition(this.success, this.error, positionOptions);
39
- }
40
- }
41
- componentDidMount() {
42
- this.updatePosition();
43
- }
44
- componentDidUpdate(prevProps) {
45
- if (this.props.update_now || prevProps.maximum_age !== this.props.maximum_age || prevProps.timeout !== this.props.timeout || prevProps.high_accuracy !== this.props.high_accuracy) {
46
- this.updatePosition();
47
105
  }
48
- }
49
- success(pos) {
50
- var _crd$latitude, _crd$longitude, _crd$accuracy, _crd$altitude, _crd$altitudeAccuracy, _crd$speed, _crd$heading;
51
- var crd = pos.coords;
52
- var position_obj = {
53
- lat: (_crd$latitude = crd.latitude) !== null && _crd$latitude !== void 0 ? _crd$latitude : null,
54
- lon: (_crd$longitude = crd.longitude) !== null && _crd$longitude !== void 0 ? _crd$longitude : null,
55
- accuracy: (_crd$accuracy = crd.accuracy) !== null && _crd$accuracy !== void 0 ? _crd$accuracy : null,
56
- alt: (_crd$altitude = crd.altitude) !== null && _crd$altitude !== void 0 ? _crd$altitude : null,
57
- alt_accuracy: (_crd$altitudeAccuracy = crd.altitudeAccuracy) !== null && _crd$altitudeAccuracy !== void 0 ? _crd$altitudeAccuracy : null,
58
- speed: (_crd$speed = crd.speed) !== null && _crd$speed !== void 0 ? _crd$speed : null,
59
- heading: (_crd$heading = crd.heading) !== null && _crd$heading !== void 0 ? _crd$heading : null
60
- };
61
- this.props.setProps({
62
- local_date: new Date(pos.timestamp).toLocaleString(),
63
- timestamp: pos.timestamp,
64
- position: position_obj,
65
- position_error: null
66
- });
67
- }
68
- error(err) {
69
- if (this.props.show_alert) {
70
- alert("ERROR(".concat(err.code, "): ").concat(err.message));
106
+ }, {
107
+ key: "render",
108
+ value: function render() {
109
+ return null;
71
110
  }
72
- this.props.setProps({
73
- position: null,
74
- position_error: {
75
- code: err.code,
76
- message: err.message
77
- }
78
- });
79
- }
80
- render() {
81
- return null;
82
- }
83
- }
84
- exports.default = Geolocation;
111
+ }]);
112
+ }(_react.Component);
85
113
  Geolocation.defaultProps = {
86
114
  update_now: false,
87
115
  high_accuracy: false,
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -12,12 +13,10 @@ var _plotly = _interopRequireDefault(require("../utils/LazyLoader/plotly"));
12
13
  var _mathjax = _interopRequireDefault(require("../utils/LazyLoader/mathjax"));
13
14
  var _Graph = require("../fragments/Graph.privateprops");
14
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
16
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
16
17
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
18
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
19
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
19
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
20
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
21
20
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
22
21
  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."); }
23
22
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
@@ -25,6 +24,18 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
25
24
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
26
25
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
27
26
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
27
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
28
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
29
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
30
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
31
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
32
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
33
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
34
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
35
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
36
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
37
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
38
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
28
39
  var EMPTY_DATA = [];
29
40
 
30
41
  /**
@@ -33,89 +44,106 @@ var EMPTY_DATA = [];
33
44
  * You can define callbacks based on user interaction with Graphs such as
34
45
  * hovering, clicking or selecting
35
46
  */
36
- class PlotlyGraph extends _react.Component {
37
- constructor(props) {
38
- super(props);
47
+ var PlotlyGraph = /*#__PURE__*/function (_Component) {
48
+ function PlotlyGraph(props) {
49
+ var _this;
50
+ _classCallCheck(this, PlotlyGraph);
51
+ _this = _callSuper(this, PlotlyGraph, [props]);
39
52
  if (props.mathjax) {
40
53
  PlotlyGraph._loadMathjax = true;
41
54
  }
42
- this.state = {
55
+ _this.state = {
43
56
  prependData: [],
44
57
  extendData: []
45
58
  };
46
- this.clearState = this.clearState.bind(this);
59
+ _this.clearState = _this.clearState.bind(_this);
60
+ return _this;
47
61
  }
48
- componentDidMount() {
49
- if (this.props.prependData) {
50
- this.setState({
51
- prependData: [this.props.prependData]
52
- });
62
+ _inherits(PlotlyGraph, _Component);
63
+ return _createClass(PlotlyGraph, [{
64
+ key: "componentDidMount",
65
+ value: function componentDidMount() {
66
+ if (this.props.prependData) {
67
+ this.setState({
68
+ prependData: [this.props.prependData]
69
+ });
70
+ }
71
+ if (this.props.extendData) {
72
+ this.setState({
73
+ extendData: [this.props.extendData]
74
+ });
75
+ }
53
76
  }
54
- if (this.props.extendData) {
77
+ }, {
78
+ key: "componentWillUnmount",
79
+ value: function componentWillUnmount() {
55
80
  this.setState({
56
- extendData: [this.props.extendData]
81
+ prependData: [],
82
+ extendData: []
57
83
  });
58
84
  }
59
- }
60
- componentWillUnmount() {
61
- this.setState({
62
- prependData: [],
63
- extendData: []
64
- });
65
- }
66
- UNSAFE_componentWillReceiveProps(nextProps) {
67
- var prependData = this.state.prependData.slice(0);
68
- if (this.props.figure !== nextProps.figure) {
69
- prependData = EMPTY_DATA;
70
- }
71
- if (nextProps.prependData && this.props.prependData !== nextProps.prependData) {
72
- prependData.push(nextProps.prependData);
73
- } else {
74
- prependData = EMPTY_DATA;
85
+ }, {
86
+ key: "UNSAFE_componentWillReceiveProps",
87
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
88
+ var prependData = this.state.prependData.slice(0);
89
+ if (this.props.figure !== nextProps.figure) {
90
+ prependData = EMPTY_DATA;
91
+ }
92
+ if (nextProps.prependData && this.props.prependData !== nextProps.prependData) {
93
+ prependData.push(nextProps.prependData);
94
+ } else {
95
+ prependData = EMPTY_DATA;
96
+ }
97
+ if (prependData !== EMPTY_DATA) {
98
+ this.setState({
99
+ prependData
100
+ });
101
+ }
102
+ var extendData = this.state.extendData.slice(0);
103
+ if (this.props.figure !== nextProps.figure) {
104
+ extendData = EMPTY_DATA;
105
+ }
106
+ if (nextProps.extendData && this.props.extendData !== nextProps.extendData) {
107
+ extendData.push(nextProps.extendData);
108
+ } else {
109
+ extendData = EMPTY_DATA;
110
+ }
111
+ if (extendData !== EMPTY_DATA) {
112
+ this.setState({
113
+ extendData
114
+ });
115
+ }
75
116
  }
76
- if (prependData !== EMPTY_DATA) {
77
- this.setState({
78
- prependData
117
+ }, {
118
+ key: "clearState",
119
+ value: function clearState(dataKey) {
120
+ this.setState(function (props) {
121
+ var data = props[dataKey];
122
+ var res = data && data.length ? {
123
+ [dataKey]: EMPTY_DATA
124
+ } : undefined;
125
+ return res;
79
126
  });
80
127
  }
81
- var extendData = this.state.extendData.slice(0);
82
- if (this.props.figure !== nextProps.figure) {
83
- extendData = EMPTY_DATA;
128
+ }, {
129
+ key: "render",
130
+ value: function render() {
131
+ return /*#__PURE__*/_react.default.createElement(ControlledPlotlyGraph, _extends({}, this.props, {
132
+ prependData: this.state.prependData,
133
+ extendData: this.state.extendData,
134
+ clearState: this.clearState
135
+ }));
84
136
  }
85
- if (nextProps.extendData && this.props.extendData !== nextProps.extendData) {
86
- extendData.push(nextProps.extendData);
87
- } else {
88
- extendData = EMPTY_DATA;
89
- }
90
- if (extendData !== EMPTY_DATA) {
91
- this.setState({
92
- extendData
93
- });
94
- }
95
- }
96
- clearState(dataKey) {
97
- this.setState(props => {
98
- var data = props[dataKey];
99
- var res = data && data.length ? {
100
- [dataKey]: EMPTY_DATA
101
- } : undefined;
102
- return res;
103
- });
104
- }
105
- render() {
106
- return /*#__PURE__*/_react.default.createElement(ControlledPlotlyGraph, _extends({}, this.props, {
107
- prependData: this.state.prependData,
108
- extendData: this.state.extendData,
109
- clearState: this.clearState
110
- }));
111
- }
112
- }
113
- var RealPlotlyGraph = (0, _dashComponentPlugins.asyncDecorator)(PlotlyGraph, () => Promise.all([(0, _graph.default)(), (0, _plotly.default)(), PlotlyGraph._loadMathjax ? (0, _mathjax.default)() : undefined]).then(_ref => {
114
- var _ref2 = _slicedToArray(_ref, 1),
115
- graph = _ref2[0];
116
- return graph;
117
- }));
118
- var ControlledPlotlyGraph = /*#__PURE__*/(0, _react.memo)(props => {
137
+ }]);
138
+ }(_react.Component);
139
+ var RealPlotlyGraph = (0, _dashComponentPlugins.asyncDecorator)(PlotlyGraph, function () {
140
+ return Promise.all([(0, _graph.default)(), (0, _plotly.default)(), PlotlyGraph._loadMathjax ? (0, _mathjax.default)() : undefined]).then(function (_ref) {
141
+ var _ref2 = _slicedToArray(_ref, 1),
142
+ graph = _ref2[0];
143
+ return graph;
144
+ });
145
+ });
146
+ var ControlledPlotlyGraph = /*#__PURE__*/(0, _react.memo)(function (props) {
119
147
  var className = props.className,
120
148
  id = props.id;
121
149
  var extendedClassName = className ? 'dash-graph ' + className : 'dash-graph';