dash-core-components 2.1.0 → 2.4.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.
- package/README.md +1 -1
- package/dash_core_components/async-datepicker.js +1 -1
- package/dash_core_components/async-datepicker.js.map +1 -1
- package/dash_core_components/async-dropdown.js +1 -1
- package/dash_core_components/async-dropdown.js.map +1 -1
- package/dash_core_components/async-graph.js +1 -1
- package/dash_core_components/async-graph.js.map +1 -1
- package/dash_core_components/async-highlight.js +1 -1
- package/dash_core_components/async-highlight.js.map +1 -1
- package/dash_core_components/async-markdown.js +1 -1
- package/dash_core_components/async-markdown.js.map +1 -1
- package/dash_core_components/async-mathjax.js +1 -0
- package/dash_core_components/async-plotlyjs.js +1 -1
- package/dash_core_components/async-slider.js +1 -1
- package/dash_core_components/async-slider.js.map +1 -1
- package/dash_core_components/async-upload.js +1 -1
- package/dash_core_components/async-upload.js.map +1 -1
- package/dash_core_components/dash_core_components-shared.js +1 -1
- package/dash_core_components/dash_core_components-shared.js.map +1 -1
- package/dash_core_components/dash_core_components.js +1 -1
- package/dash_core_components/dash_core_components.js.map +1 -1
- package/dash_core_components/mathjax.js +1 -0
- package/dash_core_components/plotly.min.js +5 -5
- package/lib/components/Checklist.react.js +1 -1
- package/lib/components/Clipboard.react.js +1 -1
- package/lib/components/ConfirmDialog.react.js +1 -1
- package/lib/components/ConfirmDialogProvider.react.js +1 -1
- package/lib/components/DatePickerRange.react.js +1 -1
- package/lib/components/DatePickerSingle.react.js +1 -1
- package/lib/components/Download.react.js +1 -1
- package/lib/components/Dropdown.react.js +1 -1
- package/lib/components/Graph.react.js +18 -4
- package/lib/components/Input.react.js +1 -1
- package/lib/components/Interval.react.js +1 -1
- package/lib/components/Link.react.js +1 -1
- package/lib/components/Loading.react.js +1 -1
- package/lib/components/Location.react.js +1 -1
- package/lib/components/LogoutButton.react.js +1 -1
- package/lib/components/Markdown.react.js +47 -5
- package/lib/components/RadioItems.react.js +1 -1
- package/lib/components/RangeSlider.react.js +1 -1
- package/lib/components/Slider.react.js +1 -1
- package/lib/components/Store.react.js +1 -1
- package/lib/components/Tabs.react.js +1 -1
- package/lib/components/Textarea.react.js +1 -1
- package/lib/components/Tooltip.react.js +7 -5
- package/lib/components/Upload.react.js +1 -1
- package/lib/fragments/DatePickerRange.react.js +21 -14
- package/lib/fragments/DatePickerSingle.react.js +39 -11
- package/lib/fragments/Dropdown.react.js +106 -115
- package/lib/fragments/Graph.react.js +121 -64
- package/lib/fragments/Markdown.react.js +21 -1
- package/lib/fragments/Math.react.js +101 -0
- package/lib/fragments/RangeSlider.react.js +1 -1
- package/lib/fragments/Slider.react.js +1 -1
- package/lib/fragments/Upload.react.js +1 -1
- package/lib/utils/LazyLoader/mathjax.js +22 -0
- package/lib/utils/LazyLoader/plotly.js +1 -1
- package/lib/utils/computeSliderStyle.js +2 -2
- package/lib/utils/mathjax.js +5 -0
- package/package.json +30 -28
|
@@ -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
|
|
12
|
+
var _withPolyfill = _interopRequireDefault(require("react-resize-detector/build/withPolyfill"));
|
|
11
13
|
|
|
12
14
|
var _ramda = require("ramda");
|
|
13
15
|
|
|
@@ -15,12 +17,12 @@ 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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
24
26
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
27
|
|
|
26
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; }
|
|
@@ -39,15 +41,13 @@ 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"; 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); }
|
|
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
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"); }
|
|
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
|
|
|
@@ -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
|
|
104
|
+
var _ret = function () {
|
|
105
|
+
var points = [];
|
|
103
106
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
145
|
+
if ((0, _ramda.has)('pointNumbers', fullPoint)) {
|
|
146
|
+
pointData.pointNumbers = fullPoint.pointNumbers;
|
|
147
|
+
}
|
|
132
148
|
|
|
149
|
+
points[i] = pointData;
|
|
150
|
+
};
|
|
133
151
|
|
|
134
|
-
|
|
135
|
-
|
|
152
|
+
for (var i = 0; i < eventData.points.length; i++) {
|
|
153
|
+
_loop(i);
|
|
136
154
|
}
|
|
137
155
|
|
|
138
|
-
|
|
139
|
-
|
|
156
|
+
filteredEventData = {
|
|
157
|
+
points: points
|
|
158
|
+
};
|
|
159
|
+
}();
|
|
140
160
|
|
|
141
|
-
|
|
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
|
-
|
|
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
|
|
222
|
-
|
|
223
|
-
|
|
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
|
-
|
|
288
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
526
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
619
|
+
}, /*#__PURE__*/_react.default.createElement(_withPolyfill.default, {
|
|
563
620
|
handleHeight: true,
|
|
564
621
|
handleWidth: true,
|
|
565
622
|
refreshMode: "debounce",
|
|
@@ -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");
|
|
@@ -39,7 +43,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
39
43
|
|
|
40
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"); }
|
|
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
|
|
|
@@ -159,6 +163,8 @@ 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
|
+
link_target = _this$props.link_target,
|
|
167
|
+
mathjax = _this$props.mathjax,
|
|
162
168
|
children = _this$props.children,
|
|
163
169
|
dedent = _this$props.dedent;
|
|
164
170
|
var textProp = (0, _ramda.type)(children) === 'Array' ? children.join('\n') : children;
|
|
@@ -182,7 +188,21 @@ var DashMarkdown = /*#__PURE__*/function (_Component) {
|
|
|
182
188
|
}, /*#__PURE__*/_react.default.createElement(_reactMarkdown.default, {
|
|
183
189
|
source: displayText,
|
|
184
190
|
escapeHtml: !dangerously_allow_html,
|
|
191
|
+
linkTarget: link_target,
|
|
192
|
+
plugins: mathjax ? [_remarkMath.default] : [],
|
|
185
193
|
renderers: {
|
|
194
|
+
math: function math(props) {
|
|
195
|
+
return /*#__PURE__*/_react.default.createElement(_Math.default, {
|
|
196
|
+
tex: props.value,
|
|
197
|
+
inline: false
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
inlineMath: function inlineMath(props) {
|
|
201
|
+
return /*#__PURE__*/_react.default.createElement(_Math.default, {
|
|
202
|
+
tex: props.value,
|
|
203
|
+
inline: true
|
|
204
|
+
});
|
|
205
|
+
},
|
|
186
206
|
html: function html(props) {
|
|
187
207
|
return props.escapeHtml ? props.value : /*#__PURE__*/_react.default.createElement(_reactJsxParser.default, {
|
|
188
208
|
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;
|
|
@@ -41,7 +41,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
41
41
|
|
|
42
42
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
43
43
|
|
|
44
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); }
|
|
44
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
45
45
|
|
|
46
46
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
47
47
|
|
|
@@ -41,7 +41,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
41
41
|
|
|
42
42
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
43
43
|
|
|
44
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); }
|
|
44
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
45
45
|
|
|
46
46
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
47
47
|
|
|
@@ -25,7 +25,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
25
25
|
|
|
26
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
27
|
|
|
28
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); }
|
|
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
29
|
|
|
30
30
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
31
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
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); }
|
|
9
|
+
|
|
10
|
+
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); }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
var _default = function _default(mathjax) {
|
|
15
|
+
return Promise.resolve(window.MathJax || (mathjax === false ? undefined : Promise.resolve().then(function () {
|
|
16
|
+
return _interopRequireWildcard(require('../mathjax'));
|
|
17
|
+
}).then(function () {
|
|
18
|
+
return window.MathJax;
|
|
19
|
+
})));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.default = _default;
|
|
@@ -13,7 +13,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
13
13
|
|
|
14
14
|
var _default = function _default() {
|
|
15
15
|
return Promise.resolve(window.Plotly || Promise.resolve().then(function () {
|
|
16
|
-
return _interopRequireWildcard(require('plotly.js'));
|
|
16
|
+
return _interopRequireWildcard(require('plotly.js-dist-min'));
|
|
17
17
|
}).then(function (_ref) {
|
|
18
18
|
var Plotly = _ref.default;
|
|
19
19
|
window.Plotly = Plotly;
|
|
@@ -16,11 +16,11 @@ var _default = function _default() {
|
|
|
16
16
|
if (vertical) {
|
|
17
17
|
style.height = verticalHeight + 'px';
|
|
18
18
|
|
|
19
|
-
if (!tooltip || !tooltip.always_visible || !(0, _ramda.
|
|
19
|
+
if (!tooltip || !tooltip.always_visible || !(0, _ramda.includes)(tooltip.placement, ['left', 'topRight', 'bottomRight'])) {
|
|
20
20
|
style.paddingLeft = '0px';
|
|
21
21
|
}
|
|
22
22
|
} else {
|
|
23
|
-
if (!tooltip || !tooltip.always_visible || !(0, _ramda.
|
|
23
|
+
if (!tooltip || !tooltip.always_visible || !(0, _ramda.includes)(tooltip.placement, ['top', 'topLeft', 'topRight'])) {
|
|
24
24
|
style.paddingTop = '0px';
|
|
25
25
|
}
|
|
26
26
|
}
|