dash-core-components 4.2.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dash_core_components/async-datepicker.js +1 -1
  2. package/dash_core_components/async-datepicker.js.map +1 -1
  3. package/dash_core_components/async-dropdown.js +1 -1
  4. package/dash_core_components/async-dropdown.js.map +1 -1
  5. package/dash_core_components/async-graph.js +1 -1
  6. package/dash_core_components/async-graph.js.map +1 -1
  7. package/dash_core_components/async-markdown.js +1 -1
  8. package/dash_core_components/async-markdown.js.map +1 -1
  9. package/dash_core_components/async-slider.js +1 -1
  10. package/dash_core_components/async-slider.js.map +1 -1
  11. package/dash_core_components/async-upload.js +1 -1
  12. package/dash_core_components/async-upload.js.map +1 -1
  13. package/dash_core_components/dash_core_components-shared.js +1 -1
  14. package/dash_core_components/dash_core_components-shared.js.map +1 -1
  15. package/dash_core_components/dash_core_components.js +1 -1
  16. package/dash_core_components/dash_core_components.js.map +1 -1
  17. package/dash_core_components/plotly.min.js +8 -0
  18. package/lib/components/Clipboard.react.js +220 -173
  19. package/lib/components/ConfirmDialog.react.js +62 -34
  20. package/lib/components/ConfirmDialogProvider.react.js +45 -21
  21. package/lib/components/Download.react.js +46 -22
  22. package/lib/components/Geolocation.react.js +92 -64
  23. package/lib/components/Graph.react.js +99 -71
  24. package/lib/components/Interval.react.js +88 -56
  25. package/lib/components/Link.react.js +6 -5
  26. package/lib/components/Location.react.js +127 -97
  27. package/lib/components/Markdown.react.js +37 -16
  28. package/lib/components/Store.react.js +177 -128
  29. package/lib/components/Upload.react.js +28 -8
  30. package/lib/fragments/Graph.privateprops.js +9 -3
  31. package/lib/fragments/Graph.react.js +411 -339
  32. package/lib/fragments/Markdown.react.js +160 -120
  33. package/lib/fragments/Math.react.js +49 -24
  34. package/lib/fragments/Upload.react.js +341 -302
  35. package/lib/utils/LazyLoader/graph.js +3 -2
  36. package/lib/utils/LazyLoader/hljs.js +5 -2
  37. package/lib/utils/LazyLoader/markdown.js +3 -2
  38. package/lib/utils/LazyLoader/mathjax.js +5 -2
  39. package/lib/utils/LazyLoader/plotly.js +6 -7
  40. package/lib/utils/LazyLoader/upload.js +3 -2
  41. package/lib/utils/LoadingElement.js +3 -2
  42. package/lib/utils/MarkdownHighlighter.js +6 -5
  43. package/lib/utils/ResizeDetector.js +14 -9
  44. package/package.json +3 -3
@@ -10,202 +10,249 @@ var _reactFontawesome = require("@fortawesome/react-fontawesome");
10
10
  var _freeRegularSvgIcons = require("@fortawesome/free-regular-svg-icons");
11
11
  var _LoadingElement = _interopRequireDefault(require("../utils/LoadingElement"));
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- 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); }
13
+ 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); }
14
14
  function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
15
15
  function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
16
16
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
17
17
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
18
+ 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); }
19
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
20
+ 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); } }
21
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
22
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
23
+ 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); }
24
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
25
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
26
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
27
+ 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); }
28
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
18
29
  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); } // eslint-disable-line no-unused-vars
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); } // eslint-disable-line no-unused-vars
21
32
  var clipboardAPI = navigator.clipboard;
22
33
  function wait(ms) {
23
- return new Promise(r => setTimeout(r, ms));
34
+ return new Promise(function (r) {
35
+ return setTimeout(r, ms);
36
+ });
24
37
  }
25
38
 
26
39
  /**
27
40
  * The Clipboard component copies text to the clipboard
28
41
  */
29
-
30
- class Clipboard extends _react.default.Component {
31
- constructor(props) {
32
- super(props);
33
- this.copyToClipboard = this.copyToClipboard.bind(this);
34
- this.onClickHandler = this.onClickHandler.bind(this);
35
- this.copySuccess = this.copySuccess.bind(this);
36
- this.getTargetText = this.getTargetText.bind(this);
37
- this.loading = this.loading.bind(this);
38
- this.stringifyId = this.stringifyId.bind(this);
39
- this.state = {
42
+ var Clipboard = exports.default = /*#__PURE__*/function (_React$Component) {
43
+ function Clipboard(props) {
44
+ var _this;
45
+ _classCallCheck(this, Clipboard);
46
+ _this = _callSuper(this, Clipboard, [props]);
47
+ _this.copyToClipboard = _this.copyToClipboard.bind(_this);
48
+ _this.onClickHandler = _this.onClickHandler.bind(_this);
49
+ _this.copySuccess = _this.copySuccess.bind(_this);
50
+ _this.getTargetText = _this.getTargetText.bind(_this);
51
+ _this.loading = _this.loading.bind(_this);
52
+ _this.stringifyId = _this.stringifyId.bind(_this);
53
+ _this.state = {
40
54
  copied: false
41
55
  };
56
+ return _this;
42
57
  }
43
- onClickHandler() {
44
- this.props.setProps({
45
- n_clicks: this.props.n_clicks + 1
46
- });
47
- }
48
- componentDidUpdate(prevProps) {
49
- // If the clicks has not changed, do nothing
50
- if (!this.props.n_clicks || this.props.n_clicks === prevProps.n_clicks) {
51
- return;
58
+ _inherits(Clipboard, _React$Component);
59
+ return _createClass(Clipboard, [{
60
+ key: "onClickHandler",
61
+ value: function onClickHandler() {
62
+ this.props.setProps({
63
+ n_clicks: this.props.n_clicks + 1
64
+ });
65
+ }
66
+ }, {
67
+ key: "componentDidUpdate",
68
+ value: function componentDidUpdate(prevProps) {
69
+ // If the clicks has not changed, do nothing
70
+ if (!this.props.n_clicks || this.props.n_clicks === prevProps.n_clicks) {
71
+ return;
72
+ }
73
+ // If the clicks has changed, copy to clipboard
74
+ this.copyToClipboard();
52
75
  }
53
- // If the clicks has changed, copy to clipboard
54
- this.copyToClipboard();
55
- }
56
76
 
57
- // stringifies object ids used in pattern matching callbacks
58
- stringifyId(id) {
59
- if (typeof id !== 'object') {
60
- return id;
77
+ // stringifies object ids used in pattern matching callbacks
78
+ }, {
79
+ key: "stringifyId",
80
+ value: function stringifyId(id) {
81
+ if (_typeof(id) !== 'object') {
82
+ return id;
83
+ }
84
+ var stringifyVal = function stringifyVal(v) {
85
+ return v && v.wild || JSON.stringify(v);
86
+ };
87
+ var parts = Object.keys(id).sort().map(function (k) {
88
+ return JSON.stringify(k) + ':' + stringifyVal(id[k]);
89
+ });
90
+ return '{' + parts.join(',') + '}';
61
91
  }
62
- var stringifyVal = v => v && v.wild || JSON.stringify(v);
63
- var parts = Object.keys(id).sort().map(k => JSON.stringify(k) + ':' + stringifyVal(id[k]));
64
- return '{' + parts.join(',') + '}';
65
- }
66
- copySuccess(content, htmlContent) {
67
- var _this = this;
68
- return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
69
- var showCopiedIcon, blobHtml, blobText, data;
70
- return _regenerator().w(function (_context) {
71
- while (1) switch (_context.n) {
72
- case 0:
73
- showCopiedIcon = 1000;
74
- if (!htmlContent) {
75
- _context.n = 2;
92
+ }, {
93
+ key: "copySuccess",
94
+ value: function () {
95
+ var _copySuccess = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(content, htmlContent) {
96
+ var showCopiedIcon, blobHtml, blobText, data;
97
+ return _regenerator().w(function (_context) {
98
+ while (1) switch (_context.n) {
99
+ case 0:
100
+ showCopiedIcon = 1000;
101
+ if (!htmlContent) {
102
+ _context.n = 2;
103
+ break;
104
+ }
105
+ blobHtml = new Blob([htmlContent], {
106
+ type: 'text/html'
107
+ });
108
+ blobText = new Blob([content !== null && content !== void 0 ? content : htmlContent], {
109
+ type: 'text/plain'
110
+ });
111
+ data = [new ClipboardItem({
112
+ ['text/plain']: blobText,
113
+ ['text/html']: blobHtml
114
+ })];
115
+ _context.n = 1;
116
+ return navigator.clipboard.write(data);
117
+ case 1:
118
+ _context.n = 3;
76
119
  break;
77
- }
78
- blobHtml = new Blob([htmlContent], {
79
- type: 'text/html'
80
- });
81
- blobText = new Blob([content !== null && content !== void 0 ? content : htmlContent], {
82
- type: 'text/plain'
83
- });
84
- data = [new ClipboardItem({
85
- ['text/plain']: blobText,
86
- ['text/html']: blobHtml
87
- })];
88
- _context.n = 1;
89
- return navigator.clipboard.write(data);
90
- case 1:
91
- _context.n = 3;
92
- break;
93
- case 2:
94
- _context.n = 3;
95
- return clipboardAPI.writeText(content);
96
- case 3:
97
- _this.setState({
98
- copied: true
99
- });
100
- _context.n = 4;
101
- return wait(showCopiedIcon);
102
- case 4:
103
- _this.setState({
104
- copied: false
105
- });
106
- case 5:
107
- return _context.a(2);
108
- }
109
- }, _callee);
110
- }))();
111
- }
112
- getTargetText() {
113
- // get the inner text. If none, use the content of the value param
114
- var id = this.stringifyId(this.props.target_id);
115
- var target = document.getElementById(id);
116
- if (!target) {
117
- throw new Error('Clipboard copy failed: no element found for target_id ' + this.props.target_id);
118
- }
119
- var content = target.innerText;
120
- if (!content) {
121
- content = target.value;
122
- content = content === undefined ? null : content;
120
+ case 2:
121
+ _context.n = 3;
122
+ return clipboardAPI.writeText(content);
123
+ case 3:
124
+ this.setState({
125
+ copied: true
126
+ });
127
+ _context.n = 4;
128
+ return wait(showCopiedIcon);
129
+ case 4:
130
+ this.setState({
131
+ copied: false
132
+ });
133
+ case 5:
134
+ return _context.a(2);
135
+ }
136
+ }, _callee, this);
137
+ }));
138
+ function copySuccess(_x, _x2) {
139
+ return _copySuccess.apply(this, arguments);
140
+ }
141
+ return copySuccess;
142
+ }()
143
+ }, {
144
+ key: "getTargetText",
145
+ value: function getTargetText() {
146
+ // get the inner text. If none, use the content of the value param
147
+ var id = this.stringifyId(this.props.target_id);
148
+ var target = document.getElementById(id);
149
+ if (!target) {
150
+ throw new Error('Clipboard copy failed: no element found for target_id ' + this.props.target_id);
151
+ }
152
+ var content = target.innerText;
153
+ if (!content) {
154
+ content = target.value;
155
+ content = content === undefined ? null : content;
156
+ }
157
+ return content;
123
158
  }
124
- return content;
125
- }
126
- loading() {
127
- var _this2 = this;
128
- return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
129
- return _regenerator().w(function (_context2) {
130
- while (1) switch (_context2.n) {
131
- case 0:
132
- if (!_this2.context.isLoading()) {
133
- _context2.n = 2;
159
+ }, {
160
+ key: "loading",
161
+ value: function () {
162
+ var _loading = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
163
+ return _regenerator().w(function (_context2) {
164
+ while (1) switch (_context2.n) {
165
+ case 0:
166
+ if (!this.context.isLoading()) {
167
+ _context2.n = 2;
168
+ break;
169
+ }
170
+ _context2.n = 1;
171
+ return wait(100);
172
+ case 1:
173
+ _context2.n = 0;
134
174
  break;
135
- }
136
- _context2.n = 1;
137
- return wait(100);
138
- case 1:
139
- _context2.n = 0;
140
- break;
141
- case 2:
142
- return _context2.a(2);
143
- }
144
- }, _callee2);
145
- }))();
146
- }
147
- copyToClipboard() {
148
- var _this3 = this;
149
- return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
150
- var content, htmlContent;
151
- return _regenerator().w(function (_context3) {
152
- while (1) switch (_context3.n) {
153
- case 0:
154
- if (!_this3.props.target_id) {
155
- _context3.n = 1;
175
+ case 2:
176
+ return _context2.a(2);
177
+ }
178
+ }, _callee2, this);
179
+ }));
180
+ function loading() {
181
+ return _loading.apply(this, arguments);
182
+ }
183
+ return loading;
184
+ }()
185
+ }, {
186
+ key: "copyToClipboard",
187
+ value: function () {
188
+ var _copyToClipboard = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
189
+ var content, htmlContent;
190
+ return _regenerator().w(function (_context3) {
191
+ while (1) switch (_context3.n) {
192
+ case 0:
193
+ if (!this.props.target_id) {
194
+ _context3.n = 1;
195
+ break;
196
+ }
197
+ content = this.getTargetText();
198
+ _context3.n = 4;
156
199
  break;
157
- }
158
- content = _this3.getTargetText();
159
- _context3.n = 4;
160
- break;
161
- case 1:
162
- _context3.n = 2;
163
- return wait(100);
164
- case 2:
165
- _context3.n = 3;
166
- return _this3.loading();
167
- case 3:
168
- content = _this3.props.content;
169
- htmlContent = _this3.props.html_content;
170
- case 4:
171
- if (content || htmlContent) {
172
- _this3.copySuccess(content, htmlContent);
173
- }
174
- case 5:
175
- return _context3.a(2);
176
- }
177
- }, _callee3);
178
- }))();
179
- }
180
- componentDidMount() {
181
- if (!clipboardAPI) {
182
- console.warn('Copy to clipboard not available with this browser'); // eslint-disable-line no-console
200
+ case 1:
201
+ _context3.n = 2;
202
+ return wait(100);
203
+ case 2:
204
+ _context3.n = 3;
205
+ return this.loading();
206
+ case 3:
207
+ content = this.props.content;
208
+ htmlContent = this.props.html_content;
209
+ case 4:
210
+ if (content || htmlContent) {
211
+ this.copySuccess(content, htmlContent);
212
+ }
213
+ case 5:
214
+ return _context3.a(2);
215
+ }
216
+ }, _callee3, this);
217
+ }));
218
+ function copyToClipboard() {
219
+ return _copyToClipboard.apply(this, arguments);
220
+ }
221
+ return copyToClipboard;
222
+ }()
223
+ }, {
224
+ key: "componentDidMount",
225
+ value: function componentDidMount() {
226
+ if (!clipboardAPI) {
227
+ console.warn('Copy to clipboard not available with this browser'); // eslint-disable-line no-console
228
+ }
183
229
  }
184
- }
185
- render() {
186
- var _this$props = this.props,
187
- id = _this$props.id,
188
- title = _this$props.title,
189
- className = _this$props.className,
190
- style = _this$props.style,
191
- children = _this$props.children,
192
- copied_children = _this$props.copied_children;
193
- var isCopied = this.state.copied;
194
- var button_children = isCopied ? copied_children !== null && copied_children !== void 0 ? copied_children : /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
195
- icon: _freeRegularSvgIcons.faCheckCircle
196
- }) : children !== null && children !== void 0 ? children : /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
197
- icon: _freeRegularSvgIcons.faCopy
198
- });
199
- return clipboardAPI ? /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
200
- id: id,
201
- title: title,
202
- style: style,
203
- className: className,
204
- onClick: this.onClickHandler
205
- }, button_children) : null;
206
- }
207
- }
208
- exports.default = Clipboard;
230
+ }, {
231
+ key: "render",
232
+ value: function render() {
233
+ var _this$props = this.props,
234
+ id = _this$props.id,
235
+ title = _this$props.title,
236
+ className = _this$props.className,
237
+ style = _this$props.style,
238
+ children = _this$props.children,
239
+ copied_children = _this$props.copied_children;
240
+ var isCopied = this.state.copied;
241
+ var button_children = isCopied ? copied_children !== null && copied_children !== void 0 ? copied_children : /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
242
+ icon: _freeRegularSvgIcons.faCheckCircle
243
+ }) : children !== null && children !== void 0 ? children : /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
244
+ icon: _freeRegularSvgIcons.faCopy
245
+ });
246
+ return clipboardAPI ? /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
247
+ id: id,
248
+ title: title,
249
+ style: style,
250
+ className: className,
251
+ onClick: this.onClickHandler
252
+ }, button_children) : null;
253
+ }
254
+ }]);
255
+ }(_react.default.Component);
209
256
  _defineProperty(Clipboard, "contextType", window.dash_component_api.DashContext);
210
257
  Clipboard.defaultProps = {
211
258
  content: null,
@@ -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,48 +8,75 @@ exports.default = void 0;
7
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
8
9
  var _react = require("react");
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
  * ConfirmDialog is used to display the browser's native "confirm" modal,
12
25
  * with an optional message and two buttons ("OK" and "Cancel").
13
26
  * This ConfirmDialog can be used in conjunction with buttons when the user
14
27
  * is performing an action that should require an extra step of verification.
15
28
  */
16
- class ConfirmDialog extends _react.Component {
17
- componentDidUpdate(prevProps) {
18
- this._update(!prevProps.displayed && this.props.displayed);
29
+ var ConfirmDialog = exports.default = /*#__PURE__*/function (_Component) {
30
+ function ConfirmDialog() {
31
+ _classCallCheck(this, ConfirmDialog);
32
+ return _callSuper(this, ConfirmDialog, arguments);
19
33
  }
20
- componentDidMount() {
21
- this._update(this.props.displayed);
22
- }
23
- _update(shouldTriggerDisplay) {
24
- var _this$props = this.props,
25
- message = _this$props.message,
26
- setProps = _this$props.setProps,
27
- cancel_n_clicks = _this$props.cancel_n_clicks,
28
- submit_n_clicks = _this$props.submit_n_clicks;
29
- if (shouldTriggerDisplay) {
30
- new Promise(resolve => resolve(window.confirm(message))).then(result => {
31
- if (result) {
32
- setProps({
33
- submit_n_clicks: submit_n_clicks + 1,
34
- submit_n_clicks_timestamp: Date.now(),
35
- displayed: false
36
- });
37
- } else {
38
- setProps({
39
- cancel_n_clicks: cancel_n_clicks + 1,
40
- cancel_n_clicks_timestamp: Date.now(),
41
- displayed: false
42
- });
43
- }
44
- });
34
+ _inherits(ConfirmDialog, _Component);
35
+ return _createClass(ConfirmDialog, [{
36
+ key: "componentDidUpdate",
37
+ value: function componentDidUpdate(prevProps) {
38
+ this._update(!prevProps.displayed && this.props.displayed);
45
39
  }
46
- }
47
- render() {
48
- return null;
49
- }
50
- }
51
- exports.default = ConfirmDialog;
40
+ }, {
41
+ key: "componentDidMount",
42
+ value: function componentDidMount() {
43
+ this._update(this.props.displayed);
44
+ }
45
+ }, {
46
+ key: "_update",
47
+ value: function _update(shouldTriggerDisplay) {
48
+ var _this$props = this.props,
49
+ message = _this$props.message,
50
+ setProps = _this$props.setProps,
51
+ cancel_n_clicks = _this$props.cancel_n_clicks,
52
+ submit_n_clicks = _this$props.submit_n_clicks;
53
+ if (shouldTriggerDisplay) {
54
+ new Promise(function (resolve) {
55
+ return resolve(window.confirm(message));
56
+ }).then(function (result) {
57
+ if (result) {
58
+ setProps({
59
+ submit_n_clicks: submit_n_clicks + 1,
60
+ submit_n_clicks_timestamp: Date.now(),
61
+ displayed: false
62
+ });
63
+ } else {
64
+ setProps({
65
+ cancel_n_clicks: cancel_n_clicks + 1,
66
+ cancel_n_clicks_timestamp: Date.now(),
67
+ displayed: false
68
+ });
69
+ }
70
+ });
71
+ }
72
+ }
73
+ }, {
74
+ key: "render",
75
+ value: function render() {
76
+ return null;
77
+ }
78
+ }]);
79
+ }(_react.Component);
52
80
  ConfirmDialog.defaultProps = {
53
81
  submit_n_clicks: 0,
54
82
  submit_n_clicks_timestamp: -1,
@@ -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
  });
@@ -10,6 +11,18 @@ var _ConfirmDialog = _interopRequireDefault(require("./ConfirmDialog.react"));
10
11
  var _LoadingElement = _interopRequireDefault(require("../utils/LoadingElement"));
11
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
13
  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); }
14
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
15
+ 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); } }
16
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
17
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
18
+ 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); }
19
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
20
+ 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); }
21
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
22
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
23
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
24
+ 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); }
25
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
13
26
  /**
14
27
  * A wrapper component that will display a confirmation dialog
15
28
  * when its child component has been clicked on.
@@ -22,28 +35,39 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
22
35
  * id='confirm')
23
36
  * ```
24
37
  */
25
- class ConfirmDialogProvider extends _react.default.Component {
26
- render() {
27
- var _this$props = this.props,
28
- displayed = _this$props.displayed,
29
- id = _this$props.id,
30
- setProps = _this$props.setProps,
31
- children = _this$props.children;
32
-
33
- // Will lose the previous onClick of the child
34
- var wrapClick = child => /*#__PURE__*/_react.default.cloneElement(child, {
35
- onClick: () => setProps({
36
- displayed: true
37
- })
38
- });
39
- return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
40
- id: id
41
- }, Array.isArray(children) ? children.map(wrapClick) : wrapClick(children), /*#__PURE__*/_react.default.createElement(_ConfirmDialog.default, _extends({}, this.props, {
42
- displayed: displayed
43
- })));
38
+ var ConfirmDialogProvider = exports.default = /*#__PURE__*/function (_React$Component) {
39
+ function ConfirmDialogProvider() {
40
+ _classCallCheck(this, ConfirmDialogProvider);
41
+ return _callSuper(this, ConfirmDialogProvider, arguments);
44
42
  }
45
- }
46
- exports.default = ConfirmDialogProvider;
43
+ _inherits(ConfirmDialogProvider, _React$Component);
44
+ return _createClass(ConfirmDialogProvider, [{
45
+ key: "render",
46
+ value: function render() {
47
+ var _this$props = this.props,
48
+ displayed = _this$props.displayed,
49
+ id = _this$props.id,
50
+ setProps = _this$props.setProps,
51
+ children = _this$props.children;
52
+
53
+ // Will lose the previous onClick of the child
54
+ var wrapClick = function wrapClick(child) {
55
+ return /*#__PURE__*/_react.default.cloneElement(child, {
56
+ onClick: function onClick() {
57
+ return setProps({
58
+ displayed: true
59
+ });
60
+ }
61
+ });
62
+ };
63
+ return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
64
+ id: id
65
+ }, Array.isArray(children) ? children.map(wrapClick) : wrapClick(children), /*#__PURE__*/_react.default.createElement(_ConfirmDialog.default, _extends({}, this.props, {
66
+ displayed: displayed
67
+ })));
68
+ }
69
+ }]);
70
+ }(_react.default.Component);
47
71
  ConfirmDialogProvider.defaultProps = {
48
72
  submit_n_clicks: 0,
49
73
  submit_n_clicks_timestamp: -1,