dash-core-components 3.0.2 → 3.0.4
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-mathjax.js +1 -1
- package/dash_core_components/async-slider.js +1 -1
- package/dash_core_components/async-slider.js.map +1 -1
- package/dash_core_components/async-upload.js +1 -1
- package/dash_core_components/async-upload.js.map +1 -1
- package/dash_core_components/dash_core_components-shared.js +1 -1
- package/dash_core_components/dash_core_components-shared.js.map +1 -1
- package/dash_core_components/dash_core_components.js +1 -1
- package/dash_core_components/dash_core_components.js.map +1 -1
- package/lib/components/Checklist.react.js +46 -63
- package/lib/components/Clipboard.react.js +172 -218
- package/lib/components/ConfirmDialog.react.js +34 -61
- package/lib/components/ConfirmDialogProvider.react.js +21 -44
- package/lib/components/DatePickerRange.react.js +7 -26
- package/lib/components/DatePickerSingle.react.js +7 -26
- package/lib/components/Download.react.js +22 -45
- package/lib/components/Dropdown.react.js +7 -26
- package/lib/components/Geolocation.react.js +64 -91
- package/lib/components/Graph.react.js +70 -97
- package/lib/components/Input.react.js +119 -162
- package/lib/components/Interval.react.js +55 -86
- package/lib/components/Link.react.js +6 -6
- package/lib/components/Loading.react.js +31 -35
- package/lib/components/Location.react.js +97 -126
- package/lib/components/Markdown.react.js +15 -35
- package/lib/components/RadioItems.react.js +45 -63
- package/lib/components/RangeSlider.react.js +7 -26
- package/lib/components/Slider.react.js +7 -26
- package/lib/components/Store.react.js +128 -176
- package/lib/components/Tab.react.js +1 -1
- package/lib/components/Tabs.react.js +97 -126
- package/lib/components/Textarea.react.js +6 -6
- package/lib/components/Tooltip.react.js +3 -3
- package/lib/components/Upload.react.js +7 -26
- package/lib/fragments/DatePickerRange.react.js +150 -181
- package/lib/fragments/DatePickerSingle.react.js +103 -134
- package/lib/fragments/Dropdown.react.js +11 -19
- package/lib/fragments/Graph.privateprops.js +3 -9
- package/lib/fragments/Graph.react.js +302 -370
- package/lib/fragments/Loading/spinners/CircleSpinner.js +2 -4
- package/lib/fragments/Loading/spinners/CubeSpinner.js +2 -4
- package/lib/fragments/Loading/spinners/DefaultSpinner.js +2 -4
- package/lib/fragments/Loading/spinners/DotSpinner.js +2 -4
- package/lib/fragments/Loading/spinners/GraphSpinner.js +2 -4
- package/lib/fragments/Markdown.react.js +119 -158
- package/lib/fragments/Math.react.js +23 -47
- package/lib/fragments/RangeSlider.react.js +110 -133
- package/lib/fragments/Slider.react.js +110 -133
- package/lib/fragments/Upload.react.js +82 -99
- package/lib/utils/DatePickerPersistence.js +2 -4
- package/lib/utils/LazyLoader/datePickerRange.js +2 -3
- package/lib/utils/LazyLoader/datePickerSingle.js +2 -3
- package/lib/utils/LazyLoader/dropdown.js +2 -3
- package/lib/utils/LazyLoader/graph.js +2 -3
- package/lib/utils/LazyLoader/hljs.js +2 -5
- package/lib/utils/LazyLoader/markdown.js +2 -3
- package/lib/utils/LazyLoader/mathjax.js +2 -5
- package/lib/utils/LazyLoader/plotly.js +7 -6
- package/lib/utils/LazyLoader/rangeSlider.js +2 -3
- package/lib/utils/LazyLoader/slider.js +2 -3
- package/lib/utils/LazyLoader/upload.js +2 -3
- package/lib/utils/LoadingElement.js +2 -2
- package/lib/utils/MarkdownHighlighter.js +5 -6
- package/lib/utils/ResizeDetector.js +8 -12
- package/lib/utils/computeSliderMarkers.js +29 -49
- package/lib/utils/computeSliderStyle.js +4 -3
- package/lib/utils/convertToMoment.js +5 -6
- package/lib/utils/formatSliderTooltip.js +6 -8
- package/lib/utils/optionTypes.js +8 -9
- package/package.json +7 -7
|
@@ -7,75 +7,48 @@ exports.default = void 0;
|
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
|
-
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); } }
|
|
12
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
13
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
14
|
-
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); }
|
|
15
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
16
|
-
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); }
|
|
17
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
18
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
19
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
20
|
-
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); }
|
|
21
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
22
10
|
/**
|
|
23
11
|
* ConfirmDialog is used to display the browser's native "confirm" modal,
|
|
24
12
|
* with an optional message and two buttons ("OK" and "Cancel").
|
|
25
13
|
* This ConfirmDialog can be used in conjunction with buttons when the user
|
|
26
14
|
* is performing an action that should require an extra step of verification.
|
|
27
15
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return _callSuper(this, ConfirmDialog, arguments);
|
|
16
|
+
class ConfirmDialog extends _react.Component {
|
|
17
|
+
componentDidUpdate(prevProps) {
|
|
18
|
+
this._update(!prevProps.displayed && this.props.displayed);
|
|
32
19
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
submit_n_clicks: submit_n_clicks + 1,
|
|
59
|
-
submit_n_clicks_timestamp: Date.now(),
|
|
60
|
-
displayed: false
|
|
61
|
-
});
|
|
62
|
-
} else {
|
|
63
|
-
setProps({
|
|
64
|
-
cancel_n_clicks: cancel_n_clicks + 1,
|
|
65
|
-
cancel_n_clicks_timestamp: Date.now(),
|
|
66
|
-
displayed: false
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
key: "render",
|
|
74
|
-
value: function render() {
|
|
75
|
-
return null;
|
|
20
|
+
componentDidMount() {
|
|
21
|
+
this._update(this.props.displayed);
|
|
22
|
+
}
|
|
23
|
+
_update(shouldTriggerDisplay) {
|
|
24
|
+
var _this$props = this.props,
|
|
25
|
+
message = _this$props.message,
|
|
26
|
+
setProps = _this$props.setProps,
|
|
27
|
+
cancel_n_clicks = _this$props.cancel_n_clicks,
|
|
28
|
+
submit_n_clicks = _this$props.submit_n_clicks;
|
|
29
|
+
if (shouldTriggerDisplay) {
|
|
30
|
+
new Promise(resolve => resolve(window.confirm(message))).then(result => {
|
|
31
|
+
if (result) {
|
|
32
|
+
setProps({
|
|
33
|
+
submit_n_clicks: submit_n_clicks + 1,
|
|
34
|
+
submit_n_clicks_timestamp: Date.now(),
|
|
35
|
+
displayed: false
|
|
36
|
+
});
|
|
37
|
+
} else {
|
|
38
|
+
setProps({
|
|
39
|
+
cancel_n_clicks: cancel_n_clicks + 1,
|
|
40
|
+
cancel_n_clicks_timestamp: Date.now(),
|
|
41
|
+
displayed: false
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
76
45
|
}
|
|
77
|
-
}
|
|
78
|
-
|
|
46
|
+
}
|
|
47
|
+
render() {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.default = ConfirmDialog;
|
|
79
52
|
ConfirmDialog.defaultProps = {
|
|
80
53
|
submit_n_clicks: 0,
|
|
81
54
|
submit_n_clicks_timestamp: -1,
|
|
@@ -10,18 +10,6 @@ var _ConfirmDialog = _interopRequireDefault(require("./ConfirmDialog.react"));
|
|
|
10
10
|
var _LoadingElement = _interopRequireDefault(require("../utils/LoadingElement"));
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
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); }
|
|
13
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
14
|
-
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); } }
|
|
15
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
16
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
|
-
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); }
|
|
18
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
19
|
-
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); }
|
|
20
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
21
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
23
|
-
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); }
|
|
24
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
25
13
|
/**
|
|
26
14
|
* A wrapper component that will display a confirmation dialog
|
|
27
15
|
* when its child component has been clicked on.
|
|
@@ -34,39 +22,28 @@ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf
|
|
|
34
22
|
* id='confirm')
|
|
35
23
|
* ```
|
|
36
24
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
key: "render",
|
|
45
|
-
value: function render() {
|
|
46
|
-
var _this$props = this.props,
|
|
47
|
-
displayed = _this$props.displayed,
|
|
48
|
-
id = _this$props.id,
|
|
49
|
-
setProps = _this$props.setProps,
|
|
50
|
-
children = _this$props.children;
|
|
25
|
+
class ConfirmDialogProvider extends _react.default.Component {
|
|
26
|
+
render() {
|
|
27
|
+
var _this$props = this.props,
|
|
28
|
+
displayed = _this$props.displayed,
|
|
29
|
+
id = _this$props.id,
|
|
30
|
+
setProps = _this$props.setProps,
|
|
31
|
+
children = _this$props.children;
|
|
51
32
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
})));
|
|
67
|
-
}
|
|
68
|
-
}]);
|
|
69
|
-
}(_react.default.Component);
|
|
33
|
+
// Will lose the previous onClick of the child
|
|
34
|
+
var wrapClick = child => /*#__PURE__*/_react.default.cloneElement(child, {
|
|
35
|
+
onClick: () => setProps({
|
|
36
|
+
displayed: true
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
|
|
40
|
+
id: id
|
|
41
|
+
}, Array.isArray(children) ? children.map(wrapClick) : wrapClick(children), /*#__PURE__*/_react.default.createElement(_ConfirmDialog.default, _extends({}, this.props, {
|
|
42
|
+
displayed: displayed
|
|
43
|
+
})));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.default = ConfirmDialogProvider;
|
|
70
47
|
ConfirmDialogProvider.defaultProps = {
|
|
71
48
|
submit_n_clicks: 0,
|
|
72
49
|
submit_n_clicks_timestamp: -1,
|
|
@@ -11,18 +11,6 @@ var _DatePickerPersistence = _interopRequireDefault(require("../utils/DatePicker
|
|
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
12
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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); }
|
|
26
14
|
var RealDatePickerRange = /*#__PURE__*/(0, _react.lazy)(_datePickerRange.default);
|
|
27
15
|
|
|
28
16
|
/**
|
|
@@ -36,21 +24,14 @@ var RealDatePickerRange = /*#__PURE__*/(0, _react.lazy)(_datePickerRange.default
|
|
|
36
24
|
* This component is based off of Airbnb's react-dates react component
|
|
37
25
|
* which can be found here: https://github.com/airbnb/react-dates
|
|
38
26
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
class DatePickerRange extends _react.Component {
|
|
28
|
+
render() {
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
30
|
+
fallback: null
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement(RealDatePickerRange, this.props));
|
|
43
32
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
key: "render",
|
|
47
|
-
value: function render() {
|
|
48
|
-
return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
49
|
-
fallback: null
|
|
50
|
-
}, /*#__PURE__*/_react.default.createElement(RealDatePickerRange, this.props));
|
|
51
|
-
}
|
|
52
|
-
}]);
|
|
53
|
-
}(_react.Component);
|
|
33
|
+
}
|
|
34
|
+
exports.default = DatePickerRange;
|
|
54
35
|
DatePickerRange.propTypes = {
|
|
55
36
|
/**
|
|
56
37
|
* Specifies the starting date for the component.
|
|
@@ -11,18 +11,6 @@ var _DatePickerPersistence = _interopRequireDefault(require("../utils/DatePicker
|
|
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
12
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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); }
|
|
26
14
|
var RealDateSingleRange = /*#__PURE__*/(0, _react.lazy)(_datePickerSingle.default);
|
|
27
15
|
|
|
28
16
|
/**
|
|
@@ -36,21 +24,14 @@ var RealDateSingleRange = /*#__PURE__*/(0, _react.lazy)(_datePickerSingle.defaul
|
|
|
36
24
|
* This component is based off of Airbnb's react-dates react component
|
|
37
25
|
* which can be found here: https://github.com/airbnb/react-dates
|
|
38
26
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
class DatePickerSingle extends _react.Component {
|
|
28
|
+
render() {
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
30
|
+
fallback: null
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement(RealDateSingleRange, this.props));
|
|
43
32
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
key: "render",
|
|
47
|
-
value: function render() {
|
|
48
|
-
return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
49
|
-
fallback: null
|
|
50
|
-
}, /*#__PURE__*/_react.default.createElement(RealDateSingleRange, this.props));
|
|
51
|
-
}
|
|
52
|
-
}]);
|
|
53
|
-
}(_react.Component);
|
|
33
|
+
}
|
|
34
|
+
exports.default = DatePickerSingle;
|
|
54
35
|
DatePickerSingle.propTypes = {
|
|
55
36
|
/**
|
|
56
37
|
* Specifies the starting date for the component, best practice is to pass
|
|
@@ -9,56 +9,33 @@ var _react = require("react");
|
|
|
9
9
|
var _base64Js = require("base64-js");
|
|
10
10
|
var _fileSaver = require("file-saver");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
|
|
13
|
-
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); } }
|
|
14
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
15
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
-
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); }
|
|
17
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
18
|
-
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); }
|
|
19
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
20
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
22
|
-
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); }
|
|
23
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
24
|
-
var getValue = function getValue(src, fallback, key) {
|
|
25
|
-
return key in src ? src[key] : fallback[key];
|
|
26
|
-
};
|
|
12
|
+
var getValue = (src, fallback, key) => key in src ? src[key] : fallback[key];
|
|
27
13
|
|
|
28
14
|
/**
|
|
29
15
|
* The Download component opens a download dialog when the data property changes.
|
|
30
16
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return _createClass(Download, [{
|
|
38
|
-
key: "componentDidUpdate",
|
|
39
|
-
value: function componentDidUpdate(prevProps) {
|
|
40
|
-
var data = this.props.data;
|
|
41
|
-
// If the data hasn't changed, do nothing.
|
|
42
|
-
if (!data || data === prevProps.data) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
// Extract options from data if provided, fallback to props.
|
|
46
|
-
var type = getValue(data, this.props, 'type');
|
|
47
|
-
var base64 = getValue(data, this.props, 'base64');
|
|
48
|
-
// Invoke the download using a Blob.
|
|
49
|
-
var content = base64 ? (0, _base64Js.toByteArray)(data.content) : data.content;
|
|
50
|
-
var blob = new Blob([content], {
|
|
51
|
-
type: type
|
|
52
|
-
});
|
|
53
|
-
(0, _fileSaver.saveAs)(blob, data.filename);
|
|
54
|
-
}
|
|
55
|
-
}, {
|
|
56
|
-
key: "render",
|
|
57
|
-
value: function render() {
|
|
58
|
-
return null;
|
|
17
|
+
class Download extends _react.Component {
|
|
18
|
+
componentDidUpdate(prevProps) {
|
|
19
|
+
var data = this.props.data;
|
|
20
|
+
// If the data hasn't changed, do nothing.
|
|
21
|
+
if (!data || data === prevProps.data) {
|
|
22
|
+
return;
|
|
59
23
|
}
|
|
60
|
-
|
|
61
|
-
|
|
24
|
+
// Extract options from data if provided, fallback to props.
|
|
25
|
+
var type = getValue(data, this.props, 'type');
|
|
26
|
+
var base64 = getValue(data, this.props, 'base64');
|
|
27
|
+
// Invoke the download using a Blob.
|
|
28
|
+
var content = base64 ? (0, _base64Js.toByteArray)(data.content) : data.content;
|
|
29
|
+
var blob = new Blob([content], {
|
|
30
|
+
type: type
|
|
31
|
+
});
|
|
32
|
+
(0, _fileSaver.saveAs)(blob, data.filename);
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.default = Download;
|
|
62
39
|
Download.propTypes = {
|
|
63
40
|
/**
|
|
64
41
|
* The ID of this component, used to identify dash components in callbacks.
|
|
@@ -10,18 +10,6 @@ var _dropdown = _interopRequireDefault(require("../utils/LazyLoader/dropdown"));
|
|
|
10
10
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
11
11
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
14
|
-
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); } }
|
|
15
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
16
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
|
-
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); }
|
|
18
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
19
|
-
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); }
|
|
20
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
21
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
23
|
-
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); }
|
|
24
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
25
13
|
var RealDropdown = /*#__PURE__*/(0, _react.lazy)(_dropdown.default);
|
|
26
14
|
|
|
27
15
|
/**
|
|
@@ -34,21 +22,14 @@ var RealDropdown = /*#__PURE__*/(0, _react.lazy)(_dropdown.default);
|
|
|
34
22
|
* constrained for space. Otherwise, you can use RadioItems or a Checklist,
|
|
35
23
|
* which have the benefit of showing the users all of the items at once.
|
|
36
24
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
class Dropdown extends _react.Component {
|
|
26
|
+
render() {
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
28
|
+
fallback: null
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement(RealDropdown, this.props));
|
|
41
30
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
key: "render",
|
|
45
|
-
value: function render() {
|
|
46
|
-
return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
47
|
-
fallback: null
|
|
48
|
-
}, /*#__PURE__*/_react.default.createElement(RealDropdown, this.props));
|
|
49
|
-
}
|
|
50
|
-
}]);
|
|
51
|
-
}(_react.Component);
|
|
31
|
+
}
|
|
32
|
+
exports.default = Dropdown;
|
|
52
33
|
Dropdown.propTypes = {
|
|
53
34
|
/**
|
|
54
35
|
* An array of options {label: [string|number], value: [string|number]},
|
|
@@ -7,108 +7,81 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
|
-
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); } }
|
|
12
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
13
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
14
|
-
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); }
|
|
15
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
16
|
-
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); }
|
|
17
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
18
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
19
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
20
|
-
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); }
|
|
21
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
22
10
|
/**
|
|
23
11
|
* The CurrentLocation component gets geolocation of the device from the web browser. See more info here:
|
|
24
12
|
* https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API
|
|
25
13
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
_this.error = _this.error.bind(_this);
|
|
33
|
-
return _this;
|
|
14
|
+
|
|
15
|
+
class Geolocation extends _react.Component {
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(props);
|
|
18
|
+
this.success = this.success.bind(this);
|
|
19
|
+
this.error = this.error.bind(this);
|
|
34
20
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
key: "updatePosition",
|
|
38
|
-
value: function updatePosition() {
|
|
39
|
-
if (this.props.update_now) {
|
|
40
|
-
this.props.setProps({
|
|
41
|
-
update_now: false
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
if (!navigator.geolocation) {
|
|
45
|
-
this.error({
|
|
46
|
-
code: 999,
|
|
47
|
-
message: 'Your browser does not support Geolocation'
|
|
48
|
-
});
|
|
49
|
-
} else {
|
|
50
|
-
var positionOptions = {
|
|
51
|
-
enableHighAccuracy: this.props.high_accuracy,
|
|
52
|
-
maximumAge: this.props.maximum_age,
|
|
53
|
-
timeout: this.props.timeout
|
|
54
|
-
};
|
|
55
|
-
navigator.geolocation.getCurrentPosition(this.success, this.error, positionOptions);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "componentDidMount",
|
|
60
|
-
value: function componentDidMount() {
|
|
61
|
-
this.updatePosition();
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "componentDidUpdate",
|
|
65
|
-
value: function componentDidUpdate(prevProps) {
|
|
66
|
-
if (this.props.update_now || prevProps.maximum_age !== this.props.maximum_age || prevProps.timeout !== this.props.timeout || prevProps.high_accuracy !== this.props.high_accuracy) {
|
|
67
|
-
this.updatePosition();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
key: "success",
|
|
72
|
-
value: function success(pos) {
|
|
73
|
-
var _crd$latitude, _crd$longitude, _crd$accuracy, _crd$altitude, _crd$altitudeAccuracy, _crd$speed, _crd$heading;
|
|
74
|
-
var crd = pos.coords;
|
|
75
|
-
var position_obj = {
|
|
76
|
-
lat: (_crd$latitude = crd.latitude) !== null && _crd$latitude !== void 0 ? _crd$latitude : null,
|
|
77
|
-
lon: (_crd$longitude = crd.longitude) !== null && _crd$longitude !== void 0 ? _crd$longitude : null,
|
|
78
|
-
accuracy: (_crd$accuracy = crd.accuracy) !== null && _crd$accuracy !== void 0 ? _crd$accuracy : null,
|
|
79
|
-
alt: (_crd$altitude = crd.altitude) !== null && _crd$altitude !== void 0 ? _crd$altitude : null,
|
|
80
|
-
alt_accuracy: (_crd$altitudeAccuracy = crd.altitudeAccuracy) !== null && _crd$altitudeAccuracy !== void 0 ? _crd$altitudeAccuracy : null,
|
|
81
|
-
speed: (_crd$speed = crd.speed) !== null && _crd$speed !== void 0 ? _crd$speed : null,
|
|
82
|
-
heading: (_crd$heading = crd.heading) !== null && _crd$heading !== void 0 ? _crd$heading : null
|
|
83
|
-
};
|
|
21
|
+
updatePosition() {
|
|
22
|
+
if (this.props.update_now) {
|
|
84
23
|
this.props.setProps({
|
|
85
|
-
|
|
86
|
-
timestamp: pos.timestamp,
|
|
87
|
-
position: position_obj,
|
|
88
|
-
position_error: null
|
|
24
|
+
update_now: false
|
|
89
25
|
});
|
|
90
26
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
alert("ERROR(".concat(err.code, "): ").concat(err.message));
|
|
96
|
-
}
|
|
97
|
-
this.props.setProps({
|
|
98
|
-
position: null,
|
|
99
|
-
position_error: {
|
|
100
|
-
code: err.code,
|
|
101
|
-
message: err.message
|
|
102
|
-
}
|
|
27
|
+
if (!navigator.geolocation) {
|
|
28
|
+
this.error({
|
|
29
|
+
code: 999,
|
|
30
|
+
message: 'Your browser does not support Geolocation'
|
|
103
31
|
});
|
|
32
|
+
} else {
|
|
33
|
+
var positionOptions = {
|
|
34
|
+
enableHighAccuracy: this.props.high_accuracy,
|
|
35
|
+
maximumAge: this.props.maximum_age,
|
|
36
|
+
timeout: this.props.timeout
|
|
37
|
+
};
|
|
38
|
+
navigator.geolocation.getCurrentPosition(this.success, this.error, positionOptions);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
componentDidMount() {
|
|
42
|
+
this.updatePosition();
|
|
43
|
+
}
|
|
44
|
+
componentDidUpdate(prevProps) {
|
|
45
|
+
if (this.props.update_now || prevProps.maximum_age !== this.props.maximum_age || prevProps.timeout !== this.props.timeout || prevProps.high_accuracy !== this.props.high_accuracy) {
|
|
46
|
+
this.updatePosition();
|
|
104
47
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
48
|
+
}
|
|
49
|
+
success(pos) {
|
|
50
|
+
var _crd$latitude, _crd$longitude, _crd$accuracy, _crd$altitude, _crd$altitudeAccuracy, _crd$speed, _crd$heading;
|
|
51
|
+
var crd = pos.coords;
|
|
52
|
+
var position_obj = {
|
|
53
|
+
lat: (_crd$latitude = crd.latitude) !== null && _crd$latitude !== void 0 ? _crd$latitude : null,
|
|
54
|
+
lon: (_crd$longitude = crd.longitude) !== null && _crd$longitude !== void 0 ? _crd$longitude : null,
|
|
55
|
+
accuracy: (_crd$accuracy = crd.accuracy) !== null && _crd$accuracy !== void 0 ? _crd$accuracy : null,
|
|
56
|
+
alt: (_crd$altitude = crd.altitude) !== null && _crd$altitude !== void 0 ? _crd$altitude : null,
|
|
57
|
+
alt_accuracy: (_crd$altitudeAccuracy = crd.altitudeAccuracy) !== null && _crd$altitudeAccuracy !== void 0 ? _crd$altitudeAccuracy : null,
|
|
58
|
+
speed: (_crd$speed = crd.speed) !== null && _crd$speed !== void 0 ? _crd$speed : null,
|
|
59
|
+
heading: (_crd$heading = crd.heading) !== null && _crd$heading !== void 0 ? _crd$heading : null
|
|
60
|
+
};
|
|
61
|
+
this.props.setProps({
|
|
62
|
+
local_date: new Date(pos.timestamp).toLocaleString(),
|
|
63
|
+
timestamp: pos.timestamp,
|
|
64
|
+
position: position_obj,
|
|
65
|
+
position_error: null
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
error(err) {
|
|
69
|
+
if (this.props.show_alert) {
|
|
70
|
+
alert("ERROR(".concat(err.code, "): ").concat(err.message));
|
|
109
71
|
}
|
|
110
|
-
|
|
111
|
-
|
|
72
|
+
this.props.setProps({
|
|
73
|
+
position: null,
|
|
74
|
+
position_error: {
|
|
75
|
+
code: err.code,
|
|
76
|
+
message: err.message
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.default = Geolocation;
|
|
112
85
|
Geolocation.defaultProps = {
|
|
113
86
|
update_now: false,
|
|
114
87
|
high_accuracy: false,
|