dash-core-components 4.1.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 (55) 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-highlight.js +1 -1
  8. package/dash_core_components/async-highlight.js.map +1 -1
  9. package/dash_core_components/async-markdown.js +1 -1
  10. package/dash_core_components/async-markdown.js.map +1 -1
  11. package/dash_core_components/async-slider.js +1 -1
  12. package/dash_core_components/async-slider.js.map +1 -1
  13. package/dash_core_components/async-upload.js +2 -1
  14. package/dash_core_components/async-upload.js.map +1 -1
  15. package/dash_core_components/dash_core_components-shared.js +1 -1
  16. package/dash_core_components/dash_core_components-shared.js.map +1 -1
  17. package/dash_core_components/dash_core_components.js +1 -1
  18. package/dash_core_components/dash_core_components.js.map +1 -1
  19. package/dash_core_components/proptypes.js +1 -0
  20. package/lib/components/Clipboard.react.js +220 -126
  21. package/lib/components/ConfirmDialog.react.js +62 -35
  22. package/lib/components/ConfirmDialogProvider.react.js +45 -22
  23. package/lib/components/Download.react.js +46 -24
  24. package/lib/components/Geolocation.react.js +92 -64
  25. package/lib/components/Graph.react.js +112 -75
  26. package/lib/components/Input.tsx +2 -2
  27. package/lib/components/Interval.react.js +88 -57
  28. package/lib/components/Link.react.js +16 -18
  29. package/lib/components/Location.react.js +127 -101
  30. package/lib/components/Markdown.react.js +43 -15
  31. package/lib/components/Store.react.js +177 -131
  32. package/lib/components/Upload.react.js +28 -8
  33. package/lib/components/css/dropdown.css +6 -0
  34. package/lib/components/css/sliders.css +1 -0
  35. package/lib/fragments/DatePickerRange.tsx +147 -148
  36. package/lib/fragments/DatePickerSingle.tsx +115 -116
  37. package/lib/fragments/Dropdown.tsx +42 -2
  38. package/lib/fragments/Graph.privateprops.js +9 -3
  39. package/lib/fragments/Graph.react.js +418 -322
  40. package/lib/fragments/Markdown.react.js +163 -112
  41. package/lib/fragments/Math.react.js +49 -24
  42. package/lib/fragments/Upload.react.js +344 -220
  43. package/lib/types.ts +7 -0
  44. package/lib/utils/LazyLoader/graph.js +3 -2
  45. package/lib/utils/LazyLoader/hljs.js +5 -2
  46. package/lib/utils/LazyLoader/markdown.js +3 -2
  47. package/lib/utils/LazyLoader/mathjax.js +5 -2
  48. package/lib/utils/LazyLoader/plotly.js +6 -7
  49. package/lib/utils/LazyLoader/upload.js +3 -2
  50. package/lib/utils/LoadingElement.js +5 -5
  51. package/lib/utils/MarkdownHighlighter.js +6 -5
  52. package/lib/utils/ResizeDetector.js +17 -14
  53. package/lib/utils/dropdownSearch.ts +32 -12
  54. package/lib/utils/optionRendering.tsx +3 -0
  55. 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,35 +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 {
20
- data
21
- } = this.props;
22
- // If the data hasn't changed, do nothing.
23
- if (!data || data === prevProps.data) {
24
- return;
25
- }
26
- // Extract options from data if provided, fallback to props.
27
- var type = getValue(data, this.props, 'type');
28
- var base64 = getValue(data, this.props, 'base64');
29
- // Invoke the download using a Blob.
30
- var content = base64 ? (0, _base64Js.toByteArray)(data.content) : data.content;
31
- var blob = new Blob([content], {
32
- type: type
33
- });
34
- (0, _fileSaver.saveAs)(blob, data.filename);
35
- }
36
- render() {
37
- return null;
32
+ var Download = exports.default = /*#__PURE__*/function (_Component) {
33
+ function Download() {
34
+ _classCallCheck(this, Download);
35
+ return _callSuper(this, Download, arguments);
38
36
  }
39
- }
40
- 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);
41
63
  Download.propTypes = {
42
64
  /**
43
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,13 +13,29 @@ 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); }
20
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
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."); }
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; } }
23
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
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; } }
25
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
21
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); }
22
39
  var EMPTY_DATA = [];
23
40
 
24
41
  /**
@@ -27,92 +44,108 @@ var EMPTY_DATA = [];
27
44
  * You can define callbacks based on user interaction with Graphs such as
28
45
  * hovering, clicking or selecting
29
46
  */
30
- class PlotlyGraph extends _react.Component {
31
- constructor(props) {
32
- 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]);
33
52
  if (props.mathjax) {
34
53
  PlotlyGraph._loadMathjax = true;
35
54
  }
36
- this.state = {
55
+ _this.state = {
37
56
  prependData: [],
38
57
  extendData: []
39
58
  };
40
- this.clearState = this.clearState.bind(this);
59
+ _this.clearState = _this.clearState.bind(_this);
60
+ return _this;
41
61
  }
42
- componentDidMount() {
43
- if (this.props.prependData) {
44
- this.setState({
45
- prependData: [this.props.prependData]
46
- });
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
+ }
47
76
  }
48
- if (this.props.extendData) {
77
+ }, {
78
+ key: "componentWillUnmount",
79
+ value: function componentWillUnmount() {
49
80
  this.setState({
50
- extendData: [this.props.extendData]
81
+ prependData: [],
82
+ extendData: []
51
83
  });
52
84
  }
53
- }
54
- componentWillUnmount() {
55
- this.setState({
56
- prependData: [],
57
- extendData: []
58
- });
59
- }
60
- UNSAFE_componentWillReceiveProps(nextProps) {
61
- var prependData = this.state.prependData.slice(0);
62
- if (this.props.figure !== nextProps.figure) {
63
- prependData = EMPTY_DATA;
64
- }
65
- if (nextProps.prependData && this.props.prependData !== nextProps.prependData) {
66
- prependData.push(nextProps.prependData);
67
- } else {
68
- 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
+ }
69
116
  }
70
- if (prependData !== EMPTY_DATA) {
71
- this.setState({
72
- 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;
73
126
  });
74
127
  }
75
- var extendData = this.state.extendData.slice(0);
76
- if (this.props.figure !== nextProps.figure) {
77
- extendData = EMPTY_DATA;
78
- }
79
- if (nextProps.extendData && this.props.extendData !== nextProps.extendData) {
80
- extendData.push(nextProps.extendData);
81
- } else {
82
- 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
+ }));
83
136
  }
84
- if (extendData !== EMPTY_DATA) {
85
- this.setState({
86
- extendData
87
- });
88
- }
89
- }
90
- clearState(dataKey) {
91
- this.setState(props => {
92
- var data = props[dataKey];
93
- var res = data && data.length ? {
94
- [dataKey]: EMPTY_DATA
95
- } : undefined;
96
- return res;
97
- });
98
- }
99
- render() {
100
- return /*#__PURE__*/_react.default.createElement(ControlledPlotlyGraph, _extends({}, this.props, {
101
- prependData: this.state.prependData,
102
- extendData: this.state.extendData,
103
- clearState: this.clearState
104
- }));
105
- }
106
- }
107
- var RealPlotlyGraph = (0, _dashComponentPlugins.asyncDecorator)(PlotlyGraph, () => Promise.all([(0, _graph.default)(), (0, _plotly.default)(), PlotlyGraph._loadMathjax ? (0, _mathjax.default)() : undefined]).then(_ref => {
108
- var [graph] = _ref;
109
- return graph;
110
- }));
111
- var ControlledPlotlyGraph = /*#__PURE__*/(0, _react.memo)(props => {
112
- var {
113
- className,
114
- id
115
- } = 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) {
147
+ var className = props.className,
148
+ id = props.id;
116
149
  var extendedClassName = className ? 'dash-graph ' + className : 'dash-graph';
117
150
  return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
118
151
  fallback: /*#__PURE__*/_react.default.createElement("div", {
@@ -453,7 +486,11 @@ PlotlyGraph.propTypes = _objectSpread(_objectSpread({}, _Graph.privatePropTypes)
453
486
  * Localization definitions, if you choose to provide them with the
454
487
  * plot rather than registering them globally.
455
488
  */
456
- locales: _propTypes.default.object
489
+ locales: _propTypes.default.object,
490
+ /**
491
+ * Determines whether or not notifier is displayed
492
+ */
493
+ displayNotifier: _propTypes.default.bool
457
494
  }),
458
495
  /**
459
496
  * Function that updates the state tree.
@@ -188,13 +188,13 @@ function Input({
188
188
 
189
189
  // Apply min/max constraints
190
190
  let constrainedValue = newValue;
191
- if (props.min !== undefined) {
191
+ if (props.min !== null && props.min !== undefined) {
192
192
  constrainedValue = Math.max(
193
193
  constrainedValue,
194
194
  parseFloat(props.min as string)
195
195
  );
196
196
  }
197
- if (props.max !== undefined) {
197
+ if (props.max !== null && props.min !== undefined) {
198
198
  constrainedValue = Math.min(
199
199
  constrainedValue,
200
200
  parseFloat(props.max as string)