dash-core-components 2.0.0 → 2.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 (74) hide show
  1. package/README.md +7 -28
  2. package/dash_core_components/async-datepicker.js +1 -1
  3. package/dash_core_components/async-datepicker.js.map +1 -1
  4. package/dash_core_components/async-dropdown.js +1 -1
  5. package/dash_core_components/async-dropdown.js.map +1 -1
  6. package/dash_core_components/async-graph.js +1 -1
  7. package/dash_core_components/async-graph.js.map +1 -1
  8. package/dash_core_components/async-highlight.js +1 -1
  9. package/dash_core_components/async-highlight.js.map +1 -1
  10. package/dash_core_components/async-markdown.js +1 -1
  11. package/dash_core_components/async-markdown.js.map +1 -1
  12. package/dash_core_components/async-mathjax.js +1 -0
  13. package/dash_core_components/async-plotlyjs.js +1 -1
  14. package/dash_core_components/async-slider.js +1 -1
  15. package/dash_core_components/async-slider.js.map +1 -1
  16. package/dash_core_components/async-upload.js +1 -1
  17. package/dash_core_components/async-upload.js.map +1 -1
  18. package/dash_core_components/dash_core_components-shared.js +1 -1
  19. package/dash_core_components/dash_core_components-shared.js.map +1 -1
  20. package/dash_core_components/dash_core_components.js +1 -1
  21. package/dash_core_components/dash_core_components.js.map +1 -1
  22. package/dash_core_components/mathjax.js +1 -0
  23. package/dash_core_components/plotly.min.js +29 -22
  24. package/lib/components/Checklist.react.js +59 -23
  25. package/lib/components/Clipboard.react.js +4 -4
  26. package/lib/components/ConfirmDialog.react.js +4 -4
  27. package/lib/components/ConfirmDialogProvider.react.js +4 -4
  28. package/lib/components/DatePickerRange.react.js +85 -85
  29. package/lib/components/DatePickerSingle.react.js +68 -68
  30. package/lib/components/Download.react.js +4 -4
  31. package/lib/components/Dropdown.react.js +51 -35
  32. package/lib/components/Graph.react.js +23 -10
  33. package/lib/components/Input.react.js +83 -83
  34. package/lib/components/Interval.react.js +4 -4
  35. package/lib/components/Link.react.js +21 -21
  36. package/lib/components/Loading.react.js +4 -4
  37. package/lib/components/Location.react.js +4 -4
  38. package/lib/components/LogoutButton.react.js +4 -4
  39. package/lib/components/Markdown.react.js +46 -9
  40. package/lib/components/RadioItems.react.js +59 -23
  41. package/lib/components/RangeSlider.react.js +44 -44
  42. package/lib/components/Slider.react.js +35 -35
  43. package/lib/components/Store.react.js +4 -4
  44. package/lib/components/Tab.react.js +1 -1
  45. package/lib/components/Tabs.react.js +10 -10
  46. package/lib/components/Textarea.react.js +4 -4
  47. package/lib/components/Tooltip.react.js +2 -2
  48. package/lib/components/Upload.react.js +5 -5
  49. package/lib/components/css/Dropdown.css +1 -1
  50. package/lib/fragments/DatePickerRange.react.js +6 -6
  51. package/lib/fragments/DatePickerSingle.react.js +6 -6
  52. package/lib/fragments/Dropdown.react.js +13 -11
  53. package/lib/fragments/Graph.privateprops.js +1 -1
  54. package/lib/fragments/Graph.react.js +125 -68
  55. package/lib/fragments/Markdown.react.js +22 -4
  56. package/lib/fragments/Math.react.js +101 -0
  57. package/lib/fragments/RangeSlider.react.js +24 -13
  58. package/lib/fragments/Slider.react.js +22 -11
  59. package/lib/fragments/Upload.react.js +4 -4
  60. package/lib/utils/LazyLoader/datePickerRange.js +1 -1
  61. package/lib/utils/LazyLoader/datePickerSingle.js +1 -1
  62. package/lib/utils/LazyLoader/dropdown.js +1 -1
  63. package/lib/utils/LazyLoader/graph.js +1 -1
  64. package/lib/utils/LazyLoader/hljs.js +1 -1
  65. package/lib/utils/LazyLoader/markdown.js +1 -1
  66. package/lib/utils/LazyLoader/mathjax.js +22 -0
  67. package/lib/utils/LazyLoader/plotly.js +2 -2
  68. package/lib/utils/LazyLoader/rangeSlider.js +1 -1
  69. package/lib/utils/LazyLoader/slider.js +1 -1
  70. package/lib/utils/LazyLoader/upload.js +1 -1
  71. package/lib/utils/computeSliderMarkers.js +230 -0
  72. package/lib/utils/mathjax.js +5 -0
  73. package/lib/utils/optionTypes.js +52 -0
  74. package/package.json +36 -34
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _mathjax = _interopRequireDefault(require("../utils/LazyLoader/mathjax"));
9
+
8
10
  var _react = _interopRequireWildcard(require("react"));
9
11
 
10
- var _reactResizeDetector = _interopRequireDefault(require("react-resize-detector"));
12
+ var _withPolyfill = _interopRequireDefault(require("react-resize-detector/build/withPolyfill"));
11
13
 
12
14
  var _ramda = require("ramda");
13
15
 
@@ -15,15 +17,15 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
15
17
 
16
18
  var _Graph = require("../components/Graph.react");
17
19
 
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
20
  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); }
21
21
 
22
22
  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; }
23
23
 
24
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+
26
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
25
27
 
26
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
28
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
27
29
 
28
30
  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; }
29
31
 
@@ -39,21 +41,19 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
39
41
 
40
42
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
41
43
 
42
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
43
-
44
44
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
45
45
 
46
46
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
47
47
 
48
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
48
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
49
49
 
50
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
50
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
51
51
 
52
52
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
53
53
 
54
54
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
55
55
 
56
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
56
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
57
57
 
58
58
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
59
59
 
@@ -61,6 +61,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
61
61
 
62
62
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
63
63
 
64
+ 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); }
65
+
64
66
  /* global Plotly:true */
65
67
 
66
68
  /**
@@ -99,48 +101,64 @@ var filterEventData = function filterEventData(gd, eventData, event) {
99
101
  var filteredEventData;
100
102
 
101
103
  if ((0, _ramda.includes)(event, ['click', 'hover', 'selected'])) {
102
- var points = [];
103
-
104
- if ((0, _ramda.isNil)(eventData)) {
105
- return null;
106
- }
107
- /*
108
- * remove `data`, `layout`, `xaxis`, etc
109
- * objects from the event data since they're so big
110
- * and cause JSON stringify ciricular structure errors.
111
- *
112
- * also, pull down the `customdata` point from the data array
113
- * into the event object
114
- */
115
-
104
+ var _ret = function () {
105
+ var points = [];
116
106
 
117
- var data = gd.data;
107
+ if ((0, _ramda.isNil)(eventData)) {
108
+ return {
109
+ v: null
110
+ };
111
+ }
112
+ /*
113
+ * remove `data`, `layout`, `xaxis`, etc
114
+ * objects from the event data since they're so big
115
+ * and cause JSON stringify ciricular structure errors.
116
+ *
117
+ * also, pull down the `customdata` point from the data array
118
+ * into the event object
119
+ */
120
+
121
+
122
+ var data = gd.data;
123
+
124
+ var _loop = function _loop(i) {
125
+ var fullPoint = eventData.points[i];
126
+ var pointData = (0, _ramda.filter)(function (o) {
127
+ return !(0, _ramda.includes)((0, _ramda.type)(o), ['Object', 'Array']);
128
+ }, fullPoint); // permit a bounding box to pass through, if present
129
+
130
+ if ((0, _ramda.has)('bbox', fullPoint)) {
131
+ pointData.bbox = fullPoint.bbox;
132
+ }
118
133
 
119
- for (var i = 0; i < eventData.points.length; i++) {
120
- var fullPoint = eventData.points[i];
121
- var pointData = (0, _ramda.filter)(function (o) {
122
- return !(0, _ramda.includes)((0, _ramda.type)(o), ['Object', 'Array']);
123
- }, fullPoint); // permit a bounding box to pass through, if present
134
+ if ((0, _ramda.has)('curveNumber', fullPoint) && (0, _ramda.has)('customdata', data[pointData.curveNumber])) {
135
+ if ((0, _ramda.has)('pointNumber', fullPoint)) {
136
+ pointData.customdata = data[pointData.curveNumber].customdata[fullPoint.pointNumber];
137
+ } else if ((0, _ramda.has)('pointNumbers', fullPoint)) {
138
+ pointData.customdata = fullPoint.pointNumbers.map(function (point) {
139
+ return data[pointData.curveNumber].customdata[point];
140
+ });
141
+ }
142
+ } // specific to histogram. see https://github.com/plotly/plotly.js/pull/2113/
124
143
 
125
- if ((0, _ramda.has)('bbox', fullPoint)) {
126
- pointData.bbox = fullPoint.bbox;
127
- }
128
144
 
129
- if ((0, _ramda.has)('curveNumber', fullPoint) && (0, _ramda.has)('pointNumber', fullPoint) && (0, _ramda.has)('customdata', data[pointData.curveNumber])) {
130
- pointData.customdata = data[pointData.curveNumber].customdata[fullPoint.pointNumber];
131
- } // specific to histogram. see https://github.com/plotly/plotly.js/pull/2113/
145
+ if ((0, _ramda.has)('pointNumbers', fullPoint)) {
146
+ pointData.pointNumbers = fullPoint.pointNumbers;
147
+ }
132
148
 
149
+ points[i] = pointData;
150
+ };
133
151
 
134
- if ((0, _ramda.has)('pointNumbers', fullPoint)) {
135
- pointData.pointNumbers = fullPoint.pointNumbers;
152
+ for (var i = 0; i < eventData.points.length; i++) {
153
+ _loop(i);
136
154
  }
137
155
 
138
- points[i] = pointData;
139
- }
156
+ filteredEventData = {
157
+ points: points
158
+ };
159
+ }();
140
160
 
141
- filteredEventData = {
142
- points: points
143
- };
161
+ if (_typeof(_ret) === "object") return _ret.v;
144
162
  } else if (event === 'relayout' || event === 'restyle') {
145
163
  /*
146
164
  * relayout shouldn't include any big objects
@@ -206,23 +224,39 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
206
224
  config = props.config;
207
225
  var animate = props.animate,
208
226
  animation_options = props.animation_options,
209
- responsive = props.responsive;
227
+ responsive = props.responsive,
228
+ mathjax = props.mathjax;
210
229
  var gd = this.gd.current;
211
230
  figure = props._dashprivate_transformFigure(figure, gd);
212
231
  config = props._dashprivate_transformConfig(config, gd);
232
+ var configClone = this.getConfig(config, responsive); // add typesetMath | not exposed to the dash API
233
+
234
+ configClone.typesetMath = mathjax;
235
+ var figureClone = {
236
+ data: figure.data,
237
+ layout: this.getLayout(figure.layout, responsive),
238
+ frames: figure.frames,
239
+ config: configClone
240
+ };
213
241
 
214
242
  if (animate && this._hasPlotted && figure.data.length === gd.data.length) {
215
- return Plotly.animate(gd, figure, animation_options);
243
+ // in case we've have figure frames,
244
+ // we need to recreate frames before animation
245
+ if (figure.frames) {
246
+ return Plotly.deleteFrames(gd).then(function () {
247
+ return Plotly.addFrames(gd, figure.frames);
248
+ }).then(function () {
249
+ return Plotly.animate(gd, figureClone, animation_options);
250
+ });
251
+ }
252
+
253
+ return Plotly.animate(gd, figureClone, animation_options);
216
254
  }
217
255
 
218
- var configClone = this.getConfig(config, responsive);
219
- var layoutClone = this.getLayout(figure.layout, responsive);
220
256
  gd.classList.add('dash-graph--pending');
221
- return Plotly.react(gd, {
222
- data: figure.data,
223
- layout: layoutClone,
224
- frames: figure.frames,
225
- config: configClone
257
+ return (0, _mathjax.default)(mathjax).then(function () {
258
+ var gd = _this2.gd.current;
259
+ return gd && Plotly.react(gd, figureClone);
226
260
  }).then(function () {
227
261
  var gd = _this2.gd.current; // double-check gd hasn't been unmounted
228
262
 
@@ -259,6 +293,7 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
259
293
 
260
294
  var clearState = props.clearState;
261
295
  var dataArray = props[dataKey];
296
+ var p = Promise.resolve();
262
297
  dataArray.forEach(function (data) {
263
298
  var updateData, traceIndices, maxPoints;
264
299
 
@@ -284,10 +319,14 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
284
319
  traceIndices = generateIndices(updateData);
285
320
  }
286
321
 
287
- var gd = _this3.gd.current;
288
- return Plotly[plotlyFnKey](gd, updateData, traceIndices, maxPoints);
322
+ p = p.then(function () {
323
+ var gd = _this3.gd.current;
324
+ return gd && Plotly[plotlyFnKey](gd, updateData, traceIndices, maxPoints);
325
+ });
326
+ });
327
+ p.then(function () {
328
+ return clearState(dataKey);
289
329
  });
290
- clearState(dataKey);
291
330
  }
292
331
  }, {
293
332
  key: "getConfig",
@@ -473,20 +512,28 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
473
512
  }, {
474
513
  key: "componentDidMount",
475
514
  value: function componentDidMount() {
476
- var _this$props$prependDa, _this$props$extendDat;
515
+ var _this4 = this,
516
+ _this$props$prependDa,
517
+ _this$props$extendDat;
477
518
 
478
- this.plot(this.props);
519
+ var p = this.plot(this.props);
479
520
 
480
521
  if (this.props.prependData) {
481
- this.mergeTraces(this.props, 'prependData', 'prependTraces');
522
+ p = p.then(function () {
523
+ return _this4.mergeTraces(_this4.props, 'prependData', 'prependTraces');
524
+ });
482
525
  }
483
526
 
484
527
  if (this.props.extendData) {
485
- this.mergeTraces(this.props, 'extendData', 'extendTraces');
528
+ p = p.then(function () {
529
+ return _this4.mergeTraces(_this4.props, 'extendData', 'extendTraces');
530
+ });
486
531
  }
487
532
 
488
533
  if ((_this$props$prependDa = this.props.prependData) !== null && _this$props$prependDa !== void 0 && _this$props$prependDa.length || (_this$props$extendDat = this.props.extendData) !== null && _this$props$extendDat !== void 0 && _this$props$extendDat.length) {
489
- this.props._dashprivate_onFigureModified(this.props.figure);
534
+ p.then(function () {
535
+ return _this4.props._dashprivate_onFigureModified(_this4.props.figure);
536
+ });
490
537
  }
491
538
  }
492
539
  }, {
@@ -510,7 +557,9 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
510
557
  }, {
511
558
  key: "UNSAFE_componentWillReceiveProps",
512
559
  value: function UNSAFE_componentWillReceiveProps(nextProps) {
513
- var _this$props$prependDa2, _this$props$extendDat2;
560
+ var _this5 = this,
561
+ _this$props$prependDa2,
562
+ _this$props$extendDat2;
514
563
 
515
564
  var idChanged = this.props.id !== nextProps.id;
516
565
 
@@ -522,26 +571,34 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
522
571
  return;
523
572
  }
524
573
 
525
- if (this.props.figure !== nextProps.figure || this.props._dashprivate_transformConfig !== nextProps._dashprivate_transformConfig || this.props._dashprivate_transformFigure !== nextProps._dashprivate_transformFigure) {
526
- this.plot(nextProps);
574
+ var p = Promise.resolve();
575
+
576
+ if (this.props.mathjax !== nextProps.mathjax || this.props.figure !== nextProps.figure || this.props._dashprivate_transformConfig !== nextProps._dashprivate_transformConfig || this.props._dashprivate_transformFigure !== nextProps._dashprivate_transformFigure) {
577
+ p = this.plot(nextProps);
527
578
  }
528
579
 
529
580
  if (this.props.prependData !== nextProps.prependData) {
530
- this.mergeTraces(nextProps, 'prependData', 'prependTraces');
581
+ p = p.then(function () {
582
+ return _this5.mergeTraces(nextProps, 'prependData', 'prependTraces');
583
+ });
531
584
  }
532
585
 
533
586
  if (this.props.extendData !== nextProps.extendData) {
534
- this.mergeTraces(nextProps, 'extendData', 'extendTraces');
587
+ p = p.then(function () {
588
+ return _this5.mergeTraces(nextProps, 'extendData', 'extendTraces');
589
+ });
535
590
  }
536
591
 
537
592
  if ((_this$props$prependDa2 = this.props.prependData) !== null && _this$props$prependDa2 !== void 0 && _this$props$prependDa2.length || (_this$props$extendDat2 = this.props.extendData) !== null && _this$props$extendDat2 !== void 0 && _this$props$extendDat2.length) {
538
- this.props._dashprivate_onFigureModified(this.props.figure);
593
+ p.then(function () {
594
+ return _this5.props._dashprivate_onFigureModified(_this5.props.figure);
595
+ });
539
596
  }
540
597
  }
541
598
  }, {
542
599
  key: "componentDidUpdate",
543
600
  value: function componentDidUpdate(prevProps) {
544
- if (prevProps.id !== this.props.id) {
601
+ if (prevProps.id !== this.props.id || prevProps.mathjax !== this.props.mathjax) {
545
602
  this.plot(this.props);
546
603
  }
547
604
  }
@@ -559,7 +616,7 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
559
616
  "data-dash-is-loading": loading_state && loading_state.is_loading || undefined,
560
617
  className: className,
561
618
  style: style
562
- }, /*#__PURE__*/_react.default.createElement(_reactResizeDetector.default, {
619
+ }, /*#__PURE__*/_react.default.createElement(_withPolyfill.default, {
563
620
  handleHeight: true,
564
621
  handleWidth: true,
565
622
  refreshMode: "debounce",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -15,6 +15,10 @@ var _reactJsxParser = _interopRequireDefault(require("react-jsx-parser"));
15
15
 
16
16
  var _reactMarkdown = _interopRequireDefault(require("react-markdown"));
17
17
 
18
+ var _remarkMath = _interopRequireDefault(require("remark-math"));
19
+
20
+ var _Math = _interopRequireDefault(require("./Math.react"));
21
+
18
22
  var _MarkdownHighlighter = _interopRequireDefault(require("../utils/MarkdownHighlighter"));
19
23
 
20
24
  var _Markdown = require("../components/Markdown.react");
@@ -37,15 +41,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
37
41
 
38
42
  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); } }
39
43
 
40
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
44
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
41
45
 
42
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
46
+ 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); }
43
47
 
44
48
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
45
49
 
46
50
  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); }; }
47
51
 
48
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
52
+ 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); }
49
53
 
50
54
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
51
55
 
@@ -159,6 +163,7 @@ var DashMarkdown = /*#__PURE__*/function (_Component) {
159
163
  highlight_config = _this$props.highlight_config,
160
164
  loading_state = _this$props.loading_state,
161
165
  dangerously_allow_html = _this$props.dangerously_allow_html,
166
+ mathjax = _this$props.mathjax,
162
167
  children = _this$props.children,
163
168
  dedent = _this$props.dedent;
164
169
  var textProp = (0, _ramda.type)(children) === 'Array' ? children.join('\n') : children;
@@ -182,7 +187,20 @@ var DashMarkdown = /*#__PURE__*/function (_Component) {
182
187
  }, /*#__PURE__*/_react.default.createElement(_reactMarkdown.default, {
183
188
  source: displayText,
184
189
  escapeHtml: !dangerously_allow_html,
190
+ plugins: mathjax ? [_remarkMath.default] : [],
185
191
  renderers: {
192
+ math: function math(props) {
193
+ return /*#__PURE__*/_react.default.createElement(_Math.default, {
194
+ tex: props.value,
195
+ inline: false
196
+ });
197
+ },
198
+ inlineMath: function inlineMath(props) {
199
+ return /*#__PURE__*/_react.default.createElement(_Math.default, {
200
+ tex: props.value,
201
+ inline: true
202
+ });
203
+ },
186
204
  html: function html(props) {
187
205
  return props.escapeHtml ? props.value : /*#__PURE__*/_react.default.createElement(_reactJsxParser.default, {
188
206
  jsx: props.value,
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.propTypes = exports.defaultProps = exports.default = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _react = _interopRequireWildcard(require("react"));
13
+
14
+ var _mathjax = _interopRequireDefault(require("../utils/LazyLoader/mathjax"));
15
+
16
+ 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); }
17
+
18
+ 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; }
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23
+
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); } }
25
+
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; }
27
+
28
+ 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); }
29
+
30
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
31
+
32
+ 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); }; }
33
+
34
+ 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); }
35
+
36
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
37
+
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; } }
39
+
40
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
41
+
42
+ var DashMath = /*#__PURE__*/function (_Component) {
43
+ _inherits(DashMath, _Component);
44
+
45
+ var _super = _createSuper(DashMath);
46
+
47
+ function DashMath(props) {
48
+ var _this;
49
+
50
+ _classCallCheck(this, DashMath);
51
+
52
+ _this = _super.call(this, props);
53
+ _this.span_element = /*#__PURE__*/_react.default.createRef();
54
+ return _this;
55
+ }
56
+
57
+ _createClass(DashMath, [{
58
+ key: "componentDidMount",
59
+ value: function componentDidMount() {
60
+ this.renderMath();
61
+ }
62
+ }, {
63
+ key: "componentDidUpdate",
64
+ value: function componentDidUpdate(prevProps) {
65
+ if (prevProps.tex !== this.props.tex || prevProps.inline !== this.props.inline) {
66
+ this.renderMath();
67
+ }
68
+ }
69
+ }, {
70
+ key: "renderMath",
71
+ value: function renderMath() {
72
+ var current = this.span_element.current;
73
+ (0, _mathjax.default)().then(function () {
74
+ window.MathJax.typeset([current]);
75
+ });
76
+ }
77
+ }, {
78
+ key: "render",
79
+ value: function render() {
80
+ return /*#__PURE__*/_react.default.createElement("span", {
81
+ ref: this.span_element
82
+ }, this.props.inline ? '\\(' : '\\[', this.props.tex, this.props.inline ? '\\)' : '\\]');
83
+ }
84
+ }]);
85
+
86
+ return DashMath;
87
+ }(_react.Component);
88
+
89
+ exports.default = DashMath;
90
+ DashMath.propTypes = {
91
+ tex: _propTypes.default.string,
92
+ inline: _propTypes.default.bool
93
+ };
94
+ DashMath.defaultProps = {
95
+ tex: '',
96
+ inline: true
97
+ };
98
+ var propTypes = DashMath.propTypes;
99
+ exports.propTypes = propTypes;
100
+ var defaultProps = DashMath.defaultProps;
101
+ exports.defaultProps = defaultProps;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -17,6 +17,8 @@ var _computeSliderStyle = _interopRequireDefault(require("../utils/computeSlider
17
17
 
18
18
  require("rc-slider/assets/index.css");
19
19
 
20
+ var _computeSliderMarkers = require("../utils/computeSliderMarkers");
21
+
20
22
  var _RangeSlider = require("../components/RangeSlider.react");
21
23
 
22
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -27,9 +29,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
27
29
 
28
30
  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); }
29
31
 
30
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
32
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
33
 
32
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
34
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
35
 
34
36
  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; }
35
37
 
@@ -37,15 +39,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
37
39
 
38
40
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
39
41
 
40
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
42
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
41
43
 
42
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
44
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
43
45
 
44
46
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
45
47
 
46
48
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
47
49
 
48
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
50
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
49
51
 
50
52
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
51
53
 
@@ -113,7 +115,11 @@ var RangeSlider = /*#__PURE__*/function (_Component) {
113
115
  tooltip = _this$props.tooltip,
114
116
  updatemode = _this$props.updatemode,
115
117
  vertical = _this$props.vertical,
116
- verticalHeight = _this$props.verticalHeight;
118
+ verticalHeight = _this$props.verticalHeight,
119
+ min = _this$props.min,
120
+ max = _this$props.max,
121
+ marks = _this$props.marks,
122
+ step = _this$props.step;
117
123
  var value = this.state.value;
118
124
  var tipProps;
119
125
 
@@ -129,9 +135,6 @@ var RangeSlider = /*#__PURE__*/function (_Component) {
129
135
  tipProps = tooltip;
130
136
  }
131
137
 
132
- var truncatedMarks = this.props.marks && (0, _ramda.pickBy)(function (k, mark) {
133
- return mark >= _this2.props.min && mark <= _this2.props.max;
134
- }, this.props.marks);
135
138
  return /*#__PURE__*/_react.default.createElement("div", {
136
139
  id: id,
137
140
  "data-dash-is-loading": loading_state && loading_state.is_loading || undefined,
@@ -174,9 +177,17 @@ var RangeSlider = /*#__PURE__*/function (_Component) {
174
177
  style: {
175
178
  position: 'relative'
176
179
  },
177
- value: value,
178
- marks: truncatedMarks
179
- }, (0, _ramda.omit)(['className', 'value', 'drag_value', 'setProps', 'marks', 'updatemode', 'verticalHeight'], this.props))));
180
+ value: value ? value : (0, _computeSliderMarkers.calcValue)(min, max, value),
181
+ marks: (0, _computeSliderMarkers.sanitizeMarks)({
182
+ min: min,
183
+ max: max,
184
+ marks: marks,
185
+ step: step
186
+ }),
187
+ max: (0, _computeSliderMarkers.setUndefined)(min, max, marks).max_mark,
188
+ min: (0, _computeSliderMarkers.setUndefined)(min, max, marks).min_mark,
189
+ step: step === null && !(0, _ramda.isNil)(marks) ? null : (0, _computeSliderMarkers.calcStep)(min, max, step)
190
+ }, (0, _ramda.omit)(['className', 'value', 'drag_value', 'setProps', 'marks', 'updatemode', 'verticalHeight', 'step'], this.props))));
180
191
  }
181
192
  }]);
182
193