dash-core-components 2.6.1 → 2.7.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/LICENSE +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 -1
- package/dash_core_components/async-plotlyjs.js +1 -1
- package/dash_core_components/async-slider.js +2 -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/plotly.min.js +7 -7
- package/lib/components/Checklist.react.js +14 -61
- package/lib/components/Clipboard.react.js +12 -82
- package/lib/components/ConfirmDialog.react.js +5 -35
- package/lib/components/ConfirmDialogProvider.react.js +7 -45
- package/lib/components/DatePickerRange.react.js +3 -64
- package/lib/components/DatePickerSingle.react.js +3 -58
- package/lib/components/Download.react.js +8 -41
- package/lib/components/Dropdown.react.js +3 -51
- package/lib/components/Graph.react.js +17 -121
- package/lib/components/Input.react.js +9 -80
- package/lib/components/Interval.react.js +10 -42
- package/lib/components/Link.react.js +18 -62
- package/lib/components/Loading.react.js +12 -59
- package/lib/components/Location.react.js +18 -56
- package/lib/components/LogoutButton.react.js +8 -42
- package/lib/components/Markdown.react.js +4 -53
- package/lib/components/RadioItems.react.js +15 -63
- package/lib/components/RangeSlider.react.js +3 -53
- package/lib/components/Slider.react.js +3 -50
- package/lib/components/Store.react.js +17 -69
- package/lib/components/Tab.react.js +1 -23
- package/lib/components/Tabs.react.js +26 -92
- package/lib/components/Textarea.react.js +9 -70
- package/lib/components/Tooltip.react.js +4 -25
- package/lib/components/Upload.react.js +3 -50
- package/lib/fragments/DatePickerRange.react.js +36 -83
- package/lib/fragments/DatePickerSingle.react.js +27 -67
- package/lib/fragments/Dropdown.react.js +50 -86
- package/lib/fragments/Graph.privateprops.js +0 -3
- package/lib/fragments/Graph.react.js +135 -235
- package/lib/fragments/Loading/spinners/CircleSpinner.js +5 -14
- package/lib/fragments/Loading/spinners/CubeSpinner.js +5 -16
- package/lib/fragments/Loading/spinners/DefaultSpinner.js +5 -14
- package/lib/fragments/Loading/spinners/DotSpinner.js +5 -14
- package/lib/fragments/Loading/spinners/GraphSpinner.js +4 -13
- package/lib/fragments/Markdown.react.js +13 -60
- package/lib/fragments/Math.react.js +2 -28
- package/lib/fragments/RangeSlider.react.js +20 -60
- package/lib/fragments/Slider.react.js +20 -60
- package/lib/fragments/Upload.react.js +23 -52
- package/lib/index.js +0 -28
- package/lib/third-party/highlight.js +0 -40
- package/lib/utils/DatePickerPersistence.js +0 -5
- package/lib/utils/LazyLoader/datePickerRange.js +1 -5
- package/lib/utils/LazyLoader/datePickerSingle.js +1 -5
- package/lib/utils/LazyLoader/dropdown.js +1 -5
- package/lib/utils/LazyLoader/graph.js +1 -5
- package/lib/utils/LazyLoader/hljs.js +1 -5
- package/lib/utils/LazyLoader/markdown.js +1 -5
- package/lib/utils/LazyLoader/mathjax.js +1 -5
- package/lib/utils/LazyLoader/plotly.js +1 -5
- package/lib/utils/LazyLoader/rangeSlider.js +1 -5
- package/lib/utils/LazyLoader/slider.js +1 -5
- package/lib/utils/LazyLoader/upload.js +1 -5
- package/lib/utils/MarkdownHighlighter.js +0 -6
- package/lib/utils/computeSliderMarkers.js +17 -68
- package/lib/utils/computeSliderStyle.js +0 -6
- package/lib/utils/convertToMoment.js +0 -8
- package/lib/utils/mathjax.js +0 -1
- package/lib/utils/optionTypes.js +3 -18
- package/package.json +18 -18
- package/lib/components/css/react-virtualized-select@3.1.0.css +0 -22
|
@@ -1,46 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = void 0;
|
|
9
|
-
|
|
10
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
8
|
var _ramda = require("ramda");
|
|
13
|
-
|
|
14
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
10
|
var _optionTypes = require("../utils/optionTypes");
|
|
17
|
-
|
|
18
11
|
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); }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
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; }
|
|
22
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
-
|
|
26
15
|
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); } }
|
|
27
|
-
|
|
28
16
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
29
|
-
|
|
30
17
|
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); }
|
|
31
|
-
|
|
32
18
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
|
-
|
|
34
19
|
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); }; }
|
|
35
|
-
|
|
36
|
-
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); }
|
|
37
|
-
|
|
20
|
+
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); }
|
|
38
21
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
39
|
-
|
|
40
22
|
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; } }
|
|
41
|
-
|
|
42
23
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
|
-
|
|
44
24
|
/**
|
|
45
25
|
* Checklist is a component that encapsulates several checkboxes.
|
|
46
26
|
* The values and labels of the checklist are specified in the `options`
|
|
@@ -49,31 +29,27 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
49
29
|
*/
|
|
50
30
|
var Checklist = /*#__PURE__*/function (_Component) {
|
|
51
31
|
_inherits(Checklist, _Component);
|
|
52
|
-
|
|
53
32
|
var _super = _createSuper(Checklist);
|
|
54
|
-
|
|
55
33
|
function Checklist() {
|
|
56
34
|
_classCallCheck(this, Checklist);
|
|
57
|
-
|
|
58
35
|
return _super.apply(this, arguments);
|
|
59
36
|
}
|
|
60
|
-
|
|
61
37
|
_createClass(Checklist, [{
|
|
62
38
|
key: "render",
|
|
63
39
|
value: function render() {
|
|
64
40
|
var _this$props = this.props,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
41
|
+
className = _this$props.className,
|
|
42
|
+
id = _this$props.id,
|
|
43
|
+
inputClassName = _this$props.inputClassName,
|
|
44
|
+
inputStyle = _this$props.inputStyle,
|
|
45
|
+
labelClassName = _this$props.labelClassName,
|
|
46
|
+
labelStyle = _this$props.labelStyle,
|
|
47
|
+
options = _this$props.options,
|
|
48
|
+
setProps = _this$props.setProps,
|
|
49
|
+
style = _this$props.style,
|
|
50
|
+
loading_state = _this$props.loading_state,
|
|
51
|
+
value = _this$props.value,
|
|
52
|
+
inline = _this$props.inline;
|
|
77
53
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
78
54
|
"data-dash-is-loading": loading_state && loading_state.is_loading || undefined,
|
|
79
55
|
id: id,
|
|
@@ -94,13 +70,11 @@ var Checklist = /*#__PURE__*/function (_Component) {
|
|
|
94
70
|
type: "checkbox",
|
|
95
71
|
onChange: function onChange() {
|
|
96
72
|
var newValue;
|
|
97
|
-
|
|
98
73
|
if ((0, _ramda.includes)(option.value, value)) {
|
|
99
74
|
newValue = (0, _ramda.without)([option.value], value);
|
|
100
75
|
} else {
|
|
101
76
|
newValue = (0, _ramda.append)(option.value, value);
|
|
102
77
|
}
|
|
103
|
-
|
|
104
78
|
setProps({
|
|
105
79
|
value: newValue
|
|
106
80
|
});
|
|
@@ -109,10 +83,8 @@ var Checklist = /*#__PURE__*/function (_Component) {
|
|
|
109
83
|
}));
|
|
110
84
|
}
|
|
111
85
|
}]);
|
|
112
|
-
|
|
113
86
|
return Checklist;
|
|
114
87
|
}(_react.Component);
|
|
115
|
-
|
|
116
88
|
exports.default = Checklist;
|
|
117
89
|
Checklist.propTypes = {
|
|
118
90
|
/**
|
|
@@ -139,19 +111,16 @@ Checklist.propTypes = {
|
|
|
139
111
|
* The option's label
|
|
140
112
|
*/
|
|
141
113
|
label: _propTypes.default.node.isRequired,
|
|
142
|
-
|
|
143
114
|
/**
|
|
144
115
|
* The value of the option. This value
|
|
145
116
|
* corresponds to the items specified in the
|
|
146
117
|
* `value` property.
|
|
147
118
|
*/
|
|
148
119
|
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.bool]).isRequired,
|
|
149
|
-
|
|
150
120
|
/**
|
|
151
121
|
* If true, this option is disabled and cannot be selected.
|
|
152
122
|
*/
|
|
153
123
|
disabled: _propTypes.default.bool,
|
|
154
|
-
|
|
155
124
|
/**
|
|
156
125
|
* The HTML 'title' attribute for the option. Allows for
|
|
157
126
|
* information on hover. For more information on this attribute,
|
|
@@ -159,63 +128,52 @@ Checklist.propTypes = {
|
|
|
159
128
|
*/
|
|
160
129
|
title: _propTypes.default.string
|
|
161
130
|
}))]),
|
|
162
|
-
|
|
163
131
|
/**
|
|
164
132
|
* The currently selected value
|
|
165
133
|
*/
|
|
166
134
|
value: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.bool])),
|
|
167
|
-
|
|
168
135
|
/**
|
|
169
136
|
* Indicates whether labelStyle should be inline or not
|
|
170
137
|
* True: Automatically set { 'display': 'inline-block' } to labelStyle
|
|
171
138
|
* False: No additional styles are passed into labelStyle.
|
|
172
139
|
*/
|
|
173
140
|
inline: _propTypes.default.bool,
|
|
174
|
-
|
|
175
141
|
/**
|
|
176
142
|
* The class of the container (div)
|
|
177
143
|
*/
|
|
178
144
|
className: _propTypes.default.string,
|
|
179
|
-
|
|
180
145
|
/**
|
|
181
146
|
* The style of the container (div)
|
|
182
147
|
*/
|
|
183
148
|
style: _propTypes.default.object,
|
|
184
|
-
|
|
185
149
|
/**
|
|
186
150
|
* The style of the <input> checkbox element
|
|
187
151
|
*/
|
|
188
152
|
inputStyle: _propTypes.default.object,
|
|
189
|
-
|
|
190
153
|
/**
|
|
191
154
|
* The class of the <input> checkbox element
|
|
192
155
|
*/
|
|
193
156
|
inputClassName: _propTypes.default.string,
|
|
194
|
-
|
|
195
157
|
/**
|
|
196
158
|
* The style of the <label> that wraps the checkbox input
|
|
197
159
|
* and the option's label
|
|
198
160
|
*/
|
|
199
161
|
labelStyle: _propTypes.default.object,
|
|
200
|
-
|
|
201
162
|
/**
|
|
202
163
|
* The class of the <label> that wraps the checkbox input
|
|
203
164
|
* and the option's label
|
|
204
165
|
*/
|
|
205
166
|
labelClassName: _propTypes.default.string,
|
|
206
|
-
|
|
207
167
|
/**
|
|
208
168
|
* The ID of this component, used to identify dash components
|
|
209
169
|
* in callbacks. The ID needs to be unique across all of the
|
|
210
170
|
* components in an app.
|
|
211
171
|
*/
|
|
212
172
|
id: _propTypes.default.string,
|
|
213
|
-
|
|
214
173
|
/**
|
|
215
174
|
* Dash-assigned callback that gets fired when the value changes.
|
|
216
175
|
*/
|
|
217
176
|
setProps: _propTypes.default.func,
|
|
218
|
-
|
|
219
177
|
/**
|
|
220
178
|
* Object that holds the loading state object coming from dash-renderer
|
|
221
179
|
*/
|
|
@@ -224,18 +182,15 @@ Checklist.propTypes = {
|
|
|
224
182
|
* Determines if the component is loading or not
|
|
225
183
|
*/
|
|
226
184
|
is_loading: _propTypes.default.bool,
|
|
227
|
-
|
|
228
185
|
/**
|
|
229
186
|
* Holds which property is loading
|
|
230
187
|
*/
|
|
231
188
|
prop_name: _propTypes.default.string,
|
|
232
|
-
|
|
233
189
|
/**
|
|
234
190
|
* Holds the name of the component that is loading
|
|
235
191
|
*/
|
|
236
192
|
component_name: _propTypes.default.string
|
|
237
193
|
}),
|
|
238
|
-
|
|
239
194
|
/**
|
|
240
195
|
* Used to allow user interactions in this component to be persisted when
|
|
241
196
|
* the component - or the page - is refreshed. If `persisted` is truthy and
|
|
@@ -245,14 +200,12 @@ Checklist.propTypes = {
|
|
|
245
200
|
* Used in conjunction with `persistence_type`.
|
|
246
201
|
*/
|
|
247
202
|
persistence: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string, _propTypes.default.number]),
|
|
248
|
-
|
|
249
203
|
/**
|
|
250
204
|
* Properties whose user interactions will persist after refreshing the
|
|
251
205
|
* component or the page. Since only `value` is allowed this prop can
|
|
252
206
|
* normally be ignored.
|
|
253
207
|
*/
|
|
254
208
|
persisted_props: _propTypes.default.arrayOf(_propTypes.default.oneOf(['value'])),
|
|
255
|
-
|
|
256
209
|
/**
|
|
257
210
|
* Where persisted user changes will be stored:
|
|
258
211
|
* memory: only kept in memory, reset on page refresh.
|
|
@@ -4,71 +4,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
13
|
-
|
|
14
10
|
var _freeRegularSvgIcons = require("@fortawesome/free-regular-svg-icons");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
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); }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
22
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
23
|
-
|
|
13
|
+
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; }
|
|
14
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
24
15
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
25
|
-
|
|
26
16
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
27
|
-
|
|
28
|
-
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); }
|
|
29
|
-
|
|
30
17
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
31
|
-
|
|
32
18
|
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); } }
|
|
33
|
-
|
|
34
19
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
35
|
-
|
|
36
20
|
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); }
|
|
37
|
-
|
|
38
21
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
|
-
|
|
40
22
|
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); }; }
|
|
41
|
-
|
|
42
|
-
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); }
|
|
43
|
-
|
|
23
|
+
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); }
|
|
44
24
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
45
|
-
|
|
46
25
|
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; } }
|
|
47
|
-
|
|
48
26
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
49
|
-
|
|
50
27
|
var clipboardAPI = navigator.clipboard;
|
|
51
|
-
|
|
52
28
|
function wait(ms) {
|
|
53
29
|
return new Promise(function (r) {
|
|
54
30
|
return setTimeout(r, ms);
|
|
55
31
|
});
|
|
56
32
|
}
|
|
33
|
+
|
|
57
34
|
/**
|
|
58
35
|
* The Clipboard component copies text to the clipboard
|
|
59
36
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
37
|
var Clipboard = /*#__PURE__*/function (_React$Component) {
|
|
63
38
|
_inherits(Clipboard, _React$Component);
|
|
64
|
-
|
|
65
39
|
var _super = _createSuper(Clipboard);
|
|
66
|
-
|
|
67
40
|
function Clipboard(props) {
|
|
68
41
|
var _this;
|
|
69
|
-
|
|
70
42
|
_classCallCheck(this, Clipboard);
|
|
71
|
-
|
|
72
43
|
_this = _super.call(this, props);
|
|
73
44
|
_this.copyToClipboard = _this.copyToClipboard.bind(_assertThisInitialized(_this));
|
|
74
45
|
_this.copySuccess = _this.copySuccess.bind(_assertThisInitialized(_this));
|
|
@@ -79,20 +50,18 @@ var Clipboard = /*#__PURE__*/function (_React$Component) {
|
|
|
79
50
|
copied: false
|
|
80
51
|
};
|
|
81
52
|
return _this;
|
|
82
|
-
}
|
|
83
|
-
|
|
53
|
+
}
|
|
84
54
|
|
|
55
|
+
// stringifies object ids used in pattern matching callbacks
|
|
85
56
|
_createClass(Clipboard, [{
|
|
86
57
|
key: "stringifyId",
|
|
87
58
|
value: function stringifyId(id) {
|
|
88
|
-
if (
|
|
59
|
+
if (typeof id !== 'object') {
|
|
89
60
|
return id;
|
|
90
61
|
}
|
|
91
|
-
|
|
92
62
|
var stringifyVal = function stringifyVal(v) {
|
|
93
63
|
return v && v.wild || JSON.stringify(v);
|
|
94
64
|
};
|
|
95
|
-
|
|
96
65
|
var parts = Object.keys(id).sort().map(function (k) {
|
|
97
66
|
return JSON.stringify(k) + ':' + stringifyVal(id[k]);
|
|
98
67
|
});
|
|
@@ -110,19 +79,16 @@ var Clipboard = /*#__PURE__*/function (_React$Component) {
|
|
|
110
79
|
showCopiedIcon = 1000;
|
|
111
80
|
_context.next = 3;
|
|
112
81
|
return clipboardAPI.writeText(content);
|
|
113
|
-
|
|
114
82
|
case 3:
|
|
115
83
|
this.setState({
|
|
116
84
|
copied: true
|
|
117
85
|
});
|
|
118
86
|
_context.next = 6;
|
|
119
87
|
return wait(showCopiedIcon);
|
|
120
|
-
|
|
121
88
|
case 6:
|
|
122
89
|
this.setState({
|
|
123
90
|
copied: false
|
|
124
91
|
});
|
|
125
|
-
|
|
126
92
|
case 7:
|
|
127
93
|
case "end":
|
|
128
94
|
return _context.stop();
|
|
@@ -130,11 +96,9 @@ var Clipboard = /*#__PURE__*/function (_React$Component) {
|
|
|
130
96
|
}
|
|
131
97
|
}, _callee, this);
|
|
132
98
|
}));
|
|
133
|
-
|
|
134
99
|
function copySuccess(_x) {
|
|
135
100
|
return _copySuccess.apply(this, arguments);
|
|
136
101
|
}
|
|
137
|
-
|
|
138
102
|
return copySuccess;
|
|
139
103
|
}()
|
|
140
104
|
}, {
|
|
@@ -143,18 +107,14 @@ var Clipboard = /*#__PURE__*/function (_React$Component) {
|
|
|
143
107
|
// get the inner text. If none, use the content of the value param
|
|
144
108
|
var id = this.stringifyId(this.props.target_id);
|
|
145
109
|
var target = document.getElementById(id);
|
|
146
|
-
|
|
147
110
|
if (!target) {
|
|
148
111
|
throw new Error('Clipboard copy failed: no element found for target_id ' + this.props.target_id);
|
|
149
112
|
}
|
|
150
|
-
|
|
151
113
|
var content = target.innerText;
|
|
152
|
-
|
|
153
114
|
if (!content) {
|
|
154
115
|
content = target.value;
|
|
155
116
|
content = content === undefined ? null : content;
|
|
156
117
|
}
|
|
157
|
-
|
|
158
118
|
return content;
|
|
159
119
|
}
|
|
160
120
|
}, {
|
|
@@ -162,7 +122,6 @@ var Clipboard = /*#__PURE__*/function (_React$Component) {
|
|
|
162
122
|
value: function () {
|
|
163
123
|
var _loading = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
164
124
|
var _this$props$loading_s;
|
|
165
|
-
|
|
166
125
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
167
126
|
while (1) {
|
|
168
127
|
switch (_context2.prev = _context2.next) {
|
|
@@ -171,14 +130,11 @@ var Clipboard = /*#__PURE__*/function (_React$Component) {
|
|
|
171
130
|
_context2.next = 5;
|
|
172
131
|
break;
|
|
173
132
|
}
|
|
174
|
-
|
|
175
133
|
_context2.next = 3;
|
|
176
134
|
return wait(100);
|
|
177
|
-
|
|
178
135
|
case 3:
|
|
179
136
|
_context2.next = 0;
|
|
180
137
|
break;
|
|
181
|
-
|
|
182
138
|
case 5:
|
|
183
139
|
case "end":
|
|
184
140
|
return _context2.stop();
|
|
@@ -186,11 +142,9 @@ var Clipboard = /*#__PURE__*/function (_React$Component) {
|
|
|
186
142
|
}
|
|
187
143
|
}, _callee2, this);
|
|
188
144
|
}));
|
|
189
|
-
|
|
190
145
|
function loading() {
|
|
191
146
|
return _loading.apply(this, arguments);
|
|
192
147
|
}
|
|
193
|
-
|
|
194
148
|
return loading;
|
|
195
149
|
}()
|
|
196
150
|
}, {
|
|
@@ -205,32 +159,25 @@ var Clipboard = /*#__PURE__*/function (_React$Component) {
|
|
|
205
159
|
this.props.setProps({
|
|
206
160
|
n_clicks: this.props.n_clicks + 1
|
|
207
161
|
});
|
|
208
|
-
|
|
209
162
|
if (!this.props.target_id) {
|
|
210
163
|
_context3.next = 5;
|
|
211
164
|
break;
|
|
212
165
|
}
|
|
213
|
-
|
|
214
166
|
content = this.getTargetText();
|
|
215
167
|
_context3.next = 10;
|
|
216
168
|
break;
|
|
217
|
-
|
|
218
169
|
case 5:
|
|
219
170
|
_context3.next = 7;
|
|
220
171
|
return wait(100);
|
|
221
|
-
|
|
222
172
|
case 7:
|
|
223
173
|
_context3.next = 9;
|
|
224
174
|
return this.loading();
|
|
225
|
-
|
|
226
175
|
case 9:
|
|
227
176
|
content = this.props.content;
|
|
228
|
-
|
|
229
177
|
case 10:
|
|
230
178
|
if (content) {
|
|
231
179
|
this.copySuccess(content);
|
|
232
180
|
}
|
|
233
|
-
|
|
234
181
|
case 11:
|
|
235
182
|
case "end":
|
|
236
183
|
return _context3.stop();
|
|
@@ -238,11 +185,9 @@ var Clipboard = /*#__PURE__*/function (_React$Component) {
|
|
|
238
185
|
}
|
|
239
186
|
}, _callee3, this);
|
|
240
187
|
}));
|
|
241
|
-
|
|
242
188
|
function copyToClipboard() {
|
|
243
189
|
return _copyToClipboard.apply(this, arguments);
|
|
244
190
|
}
|
|
245
|
-
|
|
246
191
|
return copyToClipboard;
|
|
247
192
|
}()
|
|
248
193
|
}, {
|
|
@@ -256,20 +201,17 @@ var Clipboard = /*#__PURE__*/function (_React$Component) {
|
|
|
256
201
|
key: "render",
|
|
257
202
|
value: function render() {
|
|
258
203
|
var _this$props = this.props,
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
204
|
+
id = _this$props.id,
|
|
205
|
+
title = _this$props.title,
|
|
206
|
+
className = _this$props.className,
|
|
207
|
+
style = _this$props.style,
|
|
208
|
+
loading_state = _this$props.loading_state;
|
|
265
209
|
var copyIcon = /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
|
|
266
210
|
icon: _freeRegularSvgIcons.faCopy
|
|
267
211
|
});
|
|
268
|
-
|
|
269
212
|
var copiedIcon = /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
|
|
270
213
|
icon: _freeRegularSvgIcons.faCheckCircle
|
|
271
214
|
});
|
|
272
|
-
|
|
273
215
|
var btnIcon = this.state.copied ? copiedIcon : copyIcon;
|
|
274
216
|
return clipboardAPI ? /*#__PURE__*/_react.default.createElement("div", {
|
|
275
217
|
id: id,
|
|
@@ -281,10 +223,8 @@ var Clipboard = /*#__PURE__*/function (_React$Component) {
|
|
|
281
223
|
}, /*#__PURE__*/_react.default.createElement("i", null, " ", btnIcon)) : null;
|
|
282
224
|
}
|
|
283
225
|
}]);
|
|
284
|
-
|
|
285
226
|
return Clipboard;
|
|
286
227
|
}(_react.default.Component);
|
|
287
|
-
|
|
288
228
|
exports.default = Clipboard;
|
|
289
229
|
Clipboard.defaultProps = {
|
|
290
230
|
content: null,
|
|
@@ -296,39 +236,32 @@ Clipboard.propTypes = {
|
|
|
296
236
|
* The ID used to identify this component.
|
|
297
237
|
*/
|
|
298
238
|
id: _propTypes.default.string,
|
|
299
|
-
|
|
300
239
|
/**
|
|
301
240
|
* The id of target component containing text to copy to the clipboard.
|
|
302
241
|
* The inner text of the `children` prop will be copied to the clipboard. If none, then the text from the
|
|
303
242
|
* `value` prop will be copied.
|
|
304
243
|
*/
|
|
305
244
|
target_id: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
|
306
|
-
|
|
307
245
|
/**
|
|
308
246
|
* The text to be copied to the clipboard if the `target_id` is None.
|
|
309
247
|
*/
|
|
310
248
|
content: _propTypes.default.string,
|
|
311
|
-
|
|
312
249
|
/**
|
|
313
250
|
* The number of times copy button was clicked
|
|
314
251
|
*/
|
|
315
252
|
n_clicks: _propTypes.default.number,
|
|
316
|
-
|
|
317
253
|
/**
|
|
318
254
|
* The text shown as a tooltip when hovering over the copy icon.
|
|
319
255
|
*/
|
|
320
256
|
title: _propTypes.default.string,
|
|
321
|
-
|
|
322
257
|
/**
|
|
323
258
|
* The icon's styles
|
|
324
259
|
*/
|
|
325
260
|
style: _propTypes.default.object,
|
|
326
|
-
|
|
327
261
|
/**
|
|
328
262
|
* The class name of the icon element
|
|
329
263
|
*/
|
|
330
264
|
className: _propTypes.default.string,
|
|
331
|
-
|
|
332
265
|
/**
|
|
333
266
|
* Object that holds the loading state object coming from dash-renderer
|
|
334
267
|
*/
|
|
@@ -337,18 +270,15 @@ Clipboard.propTypes = {
|
|
|
337
270
|
* Determines if the component is loading or not
|
|
338
271
|
*/
|
|
339
272
|
is_loading: _propTypes.default.bool,
|
|
340
|
-
|
|
341
273
|
/**
|
|
342
274
|
* Holds which property is loading
|
|
343
275
|
*/
|
|
344
276
|
prop_name: _propTypes.default.string,
|
|
345
|
-
|
|
346
277
|
/**
|
|
347
278
|
* Holds the name of the component that is loading
|
|
348
279
|
*/
|
|
349
280
|
component_name: _propTypes.default.string
|
|
350
281
|
}),
|
|
351
|
-
|
|
352
282
|
/**
|
|
353
283
|
* Dash-assigned callback that gets fired when the value changes.
|
|
354
284
|
*/
|