dash-core-components 4.1.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-slider.js +1 -1
- package/dash_core_components/async-slider.js.map +1 -1
- package/dash_core_components/async-upload.js +2 -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/proptypes.js +1 -0
- package/lib/components/Clipboard.react.js +220 -126
- package/lib/components/ConfirmDialog.react.js +62 -35
- package/lib/components/ConfirmDialogProvider.react.js +45 -22
- package/lib/components/Download.react.js +46 -24
- package/lib/components/Geolocation.react.js +92 -64
- package/lib/components/Graph.react.js +112 -75
- package/lib/components/Input.tsx +2 -2
- package/lib/components/Interval.react.js +88 -57
- package/lib/components/Link.react.js +16 -18
- package/lib/components/Location.react.js +127 -101
- package/lib/components/Markdown.react.js +43 -15
- package/lib/components/Store.react.js +177 -131
- package/lib/components/Upload.react.js +28 -8
- package/lib/components/css/dropdown.css +6 -0
- package/lib/components/css/sliders.css +1 -0
- package/lib/fragments/DatePickerRange.tsx +147 -148
- package/lib/fragments/DatePickerSingle.tsx +115 -116
- package/lib/fragments/Dropdown.tsx +42 -2
- package/lib/fragments/Graph.privateprops.js +9 -3
- package/lib/fragments/Graph.react.js +418 -322
- package/lib/fragments/Markdown.react.js +163 -112
- package/lib/fragments/Math.react.js +49 -24
- package/lib/fragments/Upload.react.js +344 -220
- package/lib/types.ts +7 -0
- package/lib/utils/LazyLoader/graph.js +3 -2
- package/lib/utils/LazyLoader/hljs.js +5 -2
- package/lib/utils/LazyLoader/markdown.js +3 -2
- package/lib/utils/LazyLoader/mathjax.js +5 -2
- package/lib/utils/LazyLoader/plotly.js +6 -7
- package/lib/utils/LazyLoader/upload.js +3 -2
- package/lib/utils/LoadingElement.js +5 -5
- package/lib/utils/MarkdownHighlighter.js +6 -5
- package/lib/utils/ResizeDetector.js +17 -14
- package/lib/utils/dropdownSearch.ts +32 -12
- package/lib/utils/optionRendering.tsx +3 -0
- package/package.json +3 -3
|
@@ -129,6 +129,7 @@ pk.Dropdown.propTypes = {options:pt.any,
|
|
|
129
129
|
style:pt.any,
|
|
130
130
|
labels:pt.oneOfType([pt.shape({select_all:pt.oneOfType([pt.string]),deselect_all:pt.oneOfType([pt.string]),selected_count:pt.oneOfType([pt.string]),search:pt.oneOfType([pt.string]),clear_search:pt.oneOfType([pt.string]),clear_selection:pt.oneOfType([pt.string]),no_options_found:pt.oneOfType([pt.string])})]),
|
|
131
131
|
debounce:pt.oneOfType([pt.bool]),
|
|
132
|
+
search_order:pt.oneOf(['index','original']),
|
|
132
133
|
className:pt.oneOfType([pt.string]),
|
|
133
134
|
setProps:pt.any,
|
|
134
135
|
persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
|
|
@@ -10,155 +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" !=
|
|
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
|
+
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
|
+
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); }
|
|
14
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); }
|
|
15
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); }
|
|
16
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; }
|
|
17
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" ==
|
|
18
|
-
function _toPrimitive(t, r) { if ("object" !=
|
|
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
|
|
19
32
|
var clipboardAPI = navigator.clipboard;
|
|
20
33
|
function wait(ms) {
|
|
21
|
-
return new Promise(
|
|
34
|
+
return new Promise(function (r) {
|
|
35
|
+
return setTimeout(r, ms);
|
|
36
|
+
});
|
|
22
37
|
}
|
|
23
38
|
|
|
24
39
|
/**
|
|
25
40
|
* The Clipboard component copies text to the clipboard
|
|
26
41
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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 = {
|
|
38
54
|
copied: false
|
|
39
55
|
};
|
|
56
|
+
return _this;
|
|
40
57
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (!this.props.n_clicks || this.props.n_clicks === prevProps.n_clicks) {
|
|
49
|
-
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
|
+
});
|
|
50
65
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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();
|
|
59
75
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var showCopiedIcon = 1000;
|
|
68
|
-
if (htmlContent) {
|
|
69
|
-
var blobHtml = new Blob([htmlContent], {
|
|
70
|
-
type: 'text/html'
|
|
71
|
-
});
|
|
72
|
-
var blobText = new Blob([content !== null && content !== void 0 ? content : htmlContent], {
|
|
73
|
-
type: 'text/plain'
|
|
74
|
-
});
|
|
75
|
-
var data = [new ClipboardItem({
|
|
76
|
-
['text/plain']: blobText,
|
|
77
|
-
['text/html']: blobHtml
|
|
78
|
-
})];
|
|
79
|
-
yield navigator.clipboard.write(data);
|
|
80
|
-
} else {
|
|
81
|
-
yield clipboardAPI.writeText(content);
|
|
76
|
+
|
|
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;
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
copied: false
|
|
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
89
|
});
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
getTargetText() {
|
|
93
|
-
// get the inner text. If none, use the content of the value param
|
|
94
|
-
var id = this.stringifyId(this.props.target_id);
|
|
95
|
-
var target = document.getElementById(id);
|
|
96
|
-
if (!target) {
|
|
97
|
-
throw new Error('Clipboard copy failed: no element found for target_id ' + this.props.target_id);
|
|
90
|
+
return '{' + parts.join(',') + '}';
|
|
98
91
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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;
|
|
119
|
+
break;
|
|
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;
|
|
103
158
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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;
|
|
174
|
+
break;
|
|
175
|
+
case 2:
|
|
176
|
+
return _context2.a(2);
|
|
177
|
+
}
|
|
178
|
+
}, _callee2, this);
|
|
179
|
+
}));
|
|
180
|
+
function loading() {
|
|
181
|
+
return _loading.apply(this, arguments);
|
|
111
182
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
var
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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;
|
|
199
|
+
break;
|
|
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);
|
|
126
220
|
}
|
|
127
|
-
|
|
128
|
-
|
|
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
|
|
129
228
|
}
|
|
130
|
-
})();
|
|
131
|
-
}
|
|
132
|
-
componentDidMount() {
|
|
133
|
-
if (!clipboardAPI) {
|
|
134
|
-
console.warn('Copy to clipboard not available with this browser'); // eslint-disable-line no-console
|
|
135
229
|
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
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);
|
|
162
256
|
_defineProperty(Clipboard, "contextType", window.dash_component_api.DashContext);
|
|
163
257
|
Clipboard.defaultProps = {
|
|
164
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,49 +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
|
-
|
|
17
|
-
|
|
18
|
-
this
|
|
29
|
+
var ConfirmDialog = exports.default = /*#__PURE__*/function (_Component) {
|
|
30
|
+
function ConfirmDialog() {
|
|
31
|
+
_classCallCheck(this, ConfirmDialog);
|
|
32
|
+
return _callSuper(this, ConfirmDialog, arguments);
|
|
19
33
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
message,
|
|
26
|
-
setProps,
|
|
27
|
-
cancel_n_clicks,
|
|
28
|
-
submit_n_clicks
|
|
29
|
-
} = this.props;
|
|
30
|
-
if (shouldTriggerDisplay) {
|
|
31
|
-
new Promise(resolve => resolve(window.confirm(message))).then(result => {
|
|
32
|
-
if (result) {
|
|
33
|
-
setProps({
|
|
34
|
-
submit_n_clicks: submit_n_clicks + 1,
|
|
35
|
-
submit_n_clicks_timestamp: Date.now(),
|
|
36
|
-
displayed: false
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
setProps({
|
|
40
|
-
cancel_n_clicks: cancel_n_clicks + 1,
|
|
41
|
-
cancel_n_clicks_timestamp: Date.now(),
|
|
42
|
-
displayed: false
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
34
|
+
_inherits(ConfirmDialog, _Component);
|
|
35
|
+
return _createClass(ConfirmDialog, [{
|
|
36
|
+
key: "componentDidUpdate",
|
|
37
|
+
value: function componentDidUpdate(prevProps) {
|
|
38
|
+
this._update(!prevProps.displayed && this.props.displayed);
|
|
46
39
|
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
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);
|
|
53
80
|
ConfirmDialog.defaultProps = {
|
|
54
81
|
submit_n_clicks: 0,
|
|
55
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,29 +35,39 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
22
35
|
* id='confirm')
|
|
23
36
|
* ```
|
|
24
37
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
id,
|
|
30
|
-
setProps,
|
|
31
|
-
children
|
|
32
|
-
} = this.props;
|
|
33
|
-
|
|
34
|
-
// Will lose the previous onClick of the child
|
|
35
|
-
var wrapClick = child => /*#__PURE__*/_react.default.cloneElement(child, {
|
|
36
|
-
onClick: () => setProps({
|
|
37
|
-
displayed: true
|
|
38
|
-
})
|
|
39
|
-
});
|
|
40
|
-
return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
|
|
41
|
-
id: id
|
|
42
|
-
}, Array.isArray(children) ? children.map(wrapClick) : wrapClick(children), /*#__PURE__*/_react.default.createElement(_ConfirmDialog.default, _extends({}, this.props, {
|
|
43
|
-
displayed: displayed
|
|
44
|
-
})));
|
|
38
|
+
var ConfirmDialogProvider = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
39
|
+
function ConfirmDialogProvider() {
|
|
40
|
+
_classCallCheck(this, ConfirmDialogProvider);
|
|
41
|
+
return _callSuper(this, ConfirmDialogProvider, arguments);
|
|
45
42
|
}
|
|
46
|
-
|
|
47
|
-
|
|
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);
|
|
48
71
|
ConfirmDialogProvider.defaultProps = {
|
|
49
72
|
submit_n_clicks: 0,
|
|
50
73
|
submit_n_clicks_timestamp: -1,
|