dash-core-components 2.8.0 → 2.9.1
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.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.map +1 -1
- package/dash_core_components/async-highlight.js.map +1 -1
- package/dash_core_components/async-plotlyjs.js +1 -1
- package/dash_core_components/async-slider.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 +2 -2
- package/lib/components/Checklist.react.js +8 -6
- package/lib/components/Geolocation.react.js +198 -0
- package/lib/components/Graph.react.js +7 -9
- package/lib/components/Input.react.js +2 -2
- package/lib/components/Location.react.js +17 -3
- package/lib/components/RadioItems.react.js +9 -7
- package/lib/components/Tabs.react.js +2 -2
- package/lib/fragments/DatePickerRange.react.js +1 -1
- package/lib/fragments/DatePickerSingle.react.js +1 -1
- package/lib/fragments/Dropdown.react.js +3 -3
- package/lib/fragments/Graph.react.js +5 -5
- package/lib/fragments/RangeSlider.react.js +5 -5
- package/lib/fragments/Slider.react.js +5 -5
- package/lib/index.js +7 -0
- package/lib/utils/optionTypes.js +1 -1
- package/package.json +4 -4
|
@@ -11,6 +11,9 @@ var _optionTypes = require("../utils/optionTypes");
|
|
|
11
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); }
|
|
12
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
17
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
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); } }
|
|
16
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; }
|
|
@@ -58,9 +61,9 @@ var Checklist = /*#__PURE__*/function (_Component) {
|
|
|
58
61
|
}, (0, _optionTypes.sanitizeOptions)(options).map(function (option) {
|
|
59
62
|
return /*#__PURE__*/_react.default.createElement("label", {
|
|
60
63
|
key: option.value,
|
|
61
|
-
style:
|
|
62
|
-
display: 'inline-block'
|
|
63
|
-
}
|
|
64
|
+
style: _objectSpread({
|
|
65
|
+
display: inline ? 'inline-block' : 'block'
|
|
66
|
+
}, labelStyle),
|
|
64
67
|
className: labelClassName
|
|
65
68
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
66
69
|
checked: (0, _ramda.includes)(option.value, value),
|
|
@@ -133,9 +136,8 @@ Checklist.propTypes = {
|
|
|
133
136
|
*/
|
|
134
137
|
value: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.bool])),
|
|
135
138
|
/**
|
|
136
|
-
* Indicates whether
|
|
137
|
-
*
|
|
138
|
-
* False: No additional styles are passed into labelStyle.
|
|
139
|
+
* Indicates whether the options labels should be displayed inline (true=horizontal)
|
|
140
|
+
* or in a block (false=vertical).
|
|
139
141
|
*/
|
|
140
142
|
inline: _propTypes.default.bool,
|
|
141
143
|
/**
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
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); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
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); }
|
|
14
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
+
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); }; }
|
|
16
|
+
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); }
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
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; } }
|
|
19
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
+
/**
|
|
21
|
+
* The CurrentLocation component gets geolocation of the device from the web browser. See more info here:
|
|
22
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API
|
|
23
|
+
*/
|
|
24
|
+
var Geolocation = /*#__PURE__*/function (_Component) {
|
|
25
|
+
_inherits(Geolocation, _Component);
|
|
26
|
+
var _super = _createSuper(Geolocation);
|
|
27
|
+
function Geolocation(props) {
|
|
28
|
+
var _this;
|
|
29
|
+
_classCallCheck(this, Geolocation);
|
|
30
|
+
_this = _super.call(this, props);
|
|
31
|
+
_this.success = _this.success.bind(_assertThisInitialized(_this));
|
|
32
|
+
_this.error = _this.error.bind(_assertThisInitialized(_this));
|
|
33
|
+
return _this;
|
|
34
|
+
}
|
|
35
|
+
_createClass(Geolocation, [{
|
|
36
|
+
key: "updatePosition",
|
|
37
|
+
value: function updatePosition() {
|
|
38
|
+
if (this.props.update_now) {
|
|
39
|
+
this.props.setProps({
|
|
40
|
+
update_now: false
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (!navigator.geolocation) {
|
|
44
|
+
this.error({
|
|
45
|
+
code: 999,
|
|
46
|
+
message: 'Your browser does not support Geolocation'
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
var positionOptions = {
|
|
50
|
+
enableHighAccuracy: this.props.high_accuracy,
|
|
51
|
+
maximumAge: this.props.maximum_age,
|
|
52
|
+
timeout: this.props.timeout
|
|
53
|
+
};
|
|
54
|
+
navigator.geolocation.getCurrentPosition(this.success, this.error, positionOptions);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "componentDidMount",
|
|
59
|
+
value: function componentDidMount() {
|
|
60
|
+
this.updatePosition();
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
key: "componentDidUpdate",
|
|
64
|
+
value: function componentDidUpdate(prevProps) {
|
|
65
|
+
if (this.props.update_now || prevProps.maximum_age !== this.props.maximum_age || prevProps.timeout !== this.props.timeout || prevProps.high_accuracy !== this.props.high_accuracy) {
|
|
66
|
+
this.updatePosition();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
key: "success",
|
|
71
|
+
value: function success(pos) {
|
|
72
|
+
var _crd$latitude, _crd$longitude, _crd$accuracy, _crd$altitude, _crd$altitudeAccuracy, _crd$speed, _crd$heading;
|
|
73
|
+
var crd = pos.coords;
|
|
74
|
+
var position_obj = {
|
|
75
|
+
lat: (_crd$latitude = crd.latitude) !== null && _crd$latitude !== void 0 ? _crd$latitude : null,
|
|
76
|
+
lon: (_crd$longitude = crd.longitude) !== null && _crd$longitude !== void 0 ? _crd$longitude : null,
|
|
77
|
+
accuracy: (_crd$accuracy = crd.accuracy) !== null && _crd$accuracy !== void 0 ? _crd$accuracy : null,
|
|
78
|
+
alt: (_crd$altitude = crd.altitude) !== null && _crd$altitude !== void 0 ? _crd$altitude : null,
|
|
79
|
+
alt_accuracy: (_crd$altitudeAccuracy = crd.altitudeAccuracy) !== null && _crd$altitudeAccuracy !== void 0 ? _crd$altitudeAccuracy : null,
|
|
80
|
+
speed: (_crd$speed = crd.speed) !== null && _crd$speed !== void 0 ? _crd$speed : null,
|
|
81
|
+
heading: (_crd$heading = crd.heading) !== null && _crd$heading !== void 0 ? _crd$heading : null
|
|
82
|
+
};
|
|
83
|
+
this.props.setProps({
|
|
84
|
+
local_date: new Date(pos.timestamp).toLocaleString(),
|
|
85
|
+
timestamp: pos.timestamp,
|
|
86
|
+
position: position_obj,
|
|
87
|
+
position_error: null
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "error",
|
|
92
|
+
value: function error(err) {
|
|
93
|
+
if (this.props.show_alert) {
|
|
94
|
+
alert("ERROR(".concat(err.code, "): ").concat(err.message));
|
|
95
|
+
}
|
|
96
|
+
this.props.setProps({
|
|
97
|
+
position: null,
|
|
98
|
+
position_error: {
|
|
99
|
+
code: err.code,
|
|
100
|
+
message: err.message
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
key: "render",
|
|
106
|
+
value: function render() {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
}]);
|
|
110
|
+
return Geolocation;
|
|
111
|
+
}(_react.Component);
|
|
112
|
+
exports.default = Geolocation;
|
|
113
|
+
Geolocation.defaultProps = {
|
|
114
|
+
update_now: false,
|
|
115
|
+
high_accuracy: false,
|
|
116
|
+
position_error: null,
|
|
117
|
+
maximum_age: 0,
|
|
118
|
+
timeout: Infinity,
|
|
119
|
+
show_alert: false
|
|
120
|
+
};
|
|
121
|
+
Geolocation.propTypes = {
|
|
122
|
+
/**
|
|
123
|
+
* The ID used to identify this component in Dash callbacks.
|
|
124
|
+
*/
|
|
125
|
+
id: _propTypes.default.string,
|
|
126
|
+
/**
|
|
127
|
+
* The local date and time when the device position was updated.
|
|
128
|
+
* Format: MM/DD/YYYY, hh:mm:ss p where p is AM or PM
|
|
129
|
+
*/
|
|
130
|
+
local_date: _propTypes.default.string,
|
|
131
|
+
/**
|
|
132
|
+
* The Unix timestamp from when the position was updated
|
|
133
|
+
*/
|
|
134
|
+
timestamp: _propTypes.default.number,
|
|
135
|
+
/**
|
|
136
|
+
* The position of the device. `lat`, `lon`, and `accuracy` will always be returned. The other data will be included
|
|
137
|
+
* when available, otherwise it will be NaN.
|
|
138
|
+
*
|
|
139
|
+
* `lat` is latitude in degrees.
|
|
140
|
+
* `lon` is longitude in degrees.
|
|
141
|
+
* `accuracy` is the accuracy of the lat/lon in meters. *
|
|
142
|
+
*
|
|
143
|
+
* `alt` is altitude above mean sea level in meters.
|
|
144
|
+
* `alt_accuracy` is the accuracy of the altitude in meters.
|
|
145
|
+
* `heading` is the compass heading in degrees.
|
|
146
|
+
* `speed` is the speed in meters per second.
|
|
147
|
+
*
|
|
148
|
+
*/
|
|
149
|
+
position: _propTypes.default.shape({
|
|
150
|
+
lat: _propTypes.default.number,
|
|
151
|
+
lon: _propTypes.default.number,
|
|
152
|
+
accuracy: _propTypes.default.number,
|
|
153
|
+
alt: _propTypes.default.number,
|
|
154
|
+
alt_accuracy: _propTypes.default.number,
|
|
155
|
+
heading: _propTypes.default.number,
|
|
156
|
+
speed: _propTypes.default.number
|
|
157
|
+
}),
|
|
158
|
+
/**
|
|
159
|
+
* Position error
|
|
160
|
+
*/
|
|
161
|
+
position_error: _propTypes.default.shape({
|
|
162
|
+
code: _propTypes.default.number,
|
|
163
|
+
message: _propTypes.default.string
|
|
164
|
+
}),
|
|
165
|
+
/**
|
|
166
|
+
* If true, error messages will be displayed as an alert
|
|
167
|
+
*/
|
|
168
|
+
show_alert: _propTypes.default.bool,
|
|
169
|
+
/**
|
|
170
|
+
* Forces a one-time update of the position data. If set to True in a callback, the browser
|
|
171
|
+
* will update the position data and reset update_now back to False. This can, for example, be used to update the
|
|
172
|
+
* position with a button or an interval timer.
|
|
173
|
+
*/
|
|
174
|
+
update_now: _propTypes.default.bool,
|
|
175
|
+
/**
|
|
176
|
+
* If true and if the device is able to provide a more accurate position,
|
|
177
|
+
* it will do so. Note that this can result in slower response times or increased power consumption (with a GPS
|
|
178
|
+
* chip on a mobile device for example). If false (the default value), the device can save resources by
|
|
179
|
+
* responding more quickly and/or using less power.
|
|
180
|
+
*/
|
|
181
|
+
high_accuracy: _propTypes.default.bool,
|
|
182
|
+
/**
|
|
183
|
+
* The maximum age in milliseconds of a possible cached position that is acceptable to return. If set to 0,
|
|
184
|
+
* it means that the device cannot use a cached position and must attempt to retrieve the real current position.
|
|
185
|
+
* If set to Infinity the device must return a cached position regardless of its age. Default: 0.
|
|
186
|
+
*/
|
|
187
|
+
maximum_age: _propTypes.default.number,
|
|
188
|
+
/**
|
|
189
|
+
* The maximum length of time (in milliseconds) the device is allowed to take in order to return a position.
|
|
190
|
+
* The default value is Infinity, meaning that data will not be return until the position is available.
|
|
191
|
+
*/
|
|
192
|
+
timeout: _propTypes.default.number,
|
|
193
|
+
/**
|
|
194
|
+
* Dash-assigned callback that should be called to report property changes
|
|
195
|
+
* to Dash, to make them available for callbacks.
|
|
196
|
+
*/
|
|
197
|
+
setProps: _propTypes.default.func
|
|
198
|
+
};
|
|
@@ -16,7 +16,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
16
16
|
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; }
|
|
17
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
19
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
20
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
21
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -24,6 +23,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
24
23
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
25
24
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
25
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
26
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
27
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
28
28
|
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); } }
|
|
29
29
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -95,7 +95,7 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
|
|
|
95
95
|
}
|
|
96
96
|
if (prependData !== EMPTY_DATA) {
|
|
97
97
|
this.setState({
|
|
98
|
-
prependData
|
|
98
|
+
prependData: prependData
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
var extendData = this.state.extendData.slice(0);
|
|
@@ -109,7 +109,7 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
|
|
|
109
109
|
}
|
|
110
110
|
if (extendData !== EMPTY_DATA) {
|
|
111
111
|
this.setState({
|
|
112
|
-
extendData
|
|
112
|
+
extendData: extendData
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -118,9 +118,7 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
|
|
|
118
118
|
value: function clearState(dataKey) {
|
|
119
119
|
this.setState(function (props) {
|
|
120
120
|
var data = props[dataKey];
|
|
121
|
-
var res = data && data.length ? {
|
|
122
|
-
[dataKey]: EMPTY_DATA
|
|
123
|
-
} : undefined;
|
|
121
|
+
var res = data && data.length ? _defineProperty({}, dataKey, EMPTY_DATA) : undefined;
|
|
124
122
|
return res;
|
|
125
123
|
});
|
|
126
124
|
}
|
|
@@ -137,9 +135,9 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
|
|
|
137
135
|
return PlotlyGraph;
|
|
138
136
|
}(_react.Component);
|
|
139
137
|
var RealPlotlyGraph = (0, _dashComponentPlugins.asyncDecorator)(PlotlyGraph, function () {
|
|
140
|
-
return Promise.all([(0, _graph.default)(), (0, _plotly.default)(), PlotlyGraph._loadMathjax ? (0, _mathjax.default)() : undefined]).then(function (
|
|
141
|
-
var
|
|
142
|
-
graph =
|
|
138
|
+
return Promise.all([(0, _graph.default)(), (0, _plotly.default)(), PlotlyGraph._loadMathjax ? (0, _mathjax.default)() : undefined]).then(function (_ref2) {
|
|
139
|
+
var _ref3 = _slicedToArray(_ref2, 1),
|
|
140
|
+
graph = _ref3[0];
|
|
143
141
|
return graph;
|
|
144
142
|
});
|
|
145
143
|
});
|
|
@@ -114,7 +114,7 @@ var Input = /*#__PURE__*/function (_PureComponent) {
|
|
|
114
114
|
value = this.input.current.checkValidity() ? convert(value) : NaN;
|
|
115
115
|
if (!isEquivalent(base, value)) {
|
|
116
116
|
this.props.setProps({
|
|
117
|
-
value
|
|
117
|
+
value: value
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -127,7 +127,7 @@ var Input = /*#__PURE__*/function (_PureComponent) {
|
|
|
127
127
|
this.setPropValue(this.props.value, (0, _ramda.isNil)(valueAsNumber) ? value : valueAsNumber);
|
|
128
128
|
} else {
|
|
129
129
|
this.props.setProps({
|
|
130
|
-
value
|
|
130
|
+
value: value
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -66,7 +66,7 @@ var Location = /*#__PURE__*/function (_Component) {
|
|
|
66
66
|
propsToSet[fieldName] = window.location[fieldName];
|
|
67
67
|
} else if (propVal !== window.location[fieldName]) {
|
|
68
68
|
// Prop has changed?
|
|
69
|
-
if (refresh) {
|
|
69
|
+
if (refresh === true) {
|
|
70
70
|
// Refresh the page?
|
|
71
71
|
window.location[fieldName] = propVal;
|
|
72
72
|
} else if (_this2.props[fieldName] !== propVal) {
|
|
@@ -94,11 +94,17 @@ var Location = /*#__PURE__*/function (_Component) {
|
|
|
94
94
|
// Special case -- overrides everything!
|
|
95
95
|
if (hrefUpdated) {
|
|
96
96
|
window.history.pushState({}, '', href);
|
|
97
|
+
if (refresh === 'callback-nav') {
|
|
98
|
+
window.dispatchEvent(new CustomEvent('_dashprivate_pushstate'));
|
|
99
|
+
}
|
|
97
100
|
} else if (pathnameUpdated || hashUpdated || searchUpdated) {
|
|
98
101
|
// Otherwise, we can mash everything together
|
|
99
102
|
var searchVal = (0, _ramda.type)(search) !== 'Undefined' ? search : '';
|
|
100
103
|
var hashVal = (0, _ramda.type)(hash) !== 'Undefined' ? hash : '';
|
|
101
104
|
window.history.pushState({}, '', "".concat(pathname).concat(searchVal).concat(hashVal));
|
|
105
|
+
if (refresh === 'callback-nav') {
|
|
106
|
+
window.dispatchEvent(new CustomEvent('_dashprivate_pushstate'));
|
|
107
|
+
}
|
|
102
108
|
}
|
|
103
109
|
}
|
|
104
110
|
}, {
|
|
@@ -157,8 +163,16 @@ Location.propTypes = {
|
|
|
157
163
|
hash: _propTypes.default.string,
|
|
158
164
|
/** href in window.location - e.g., "/my/full/pathname?myargument=1#myhash" */
|
|
159
165
|
href: _propTypes.default.string,
|
|
160
|
-
/**
|
|
161
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Use `True` to navigate outside the Dash app or to manually refresh a page.
|
|
168
|
+
* Use `False` if the same callback that updates the Location component is also
|
|
169
|
+
* updating the page content - typically used in multi-page apps that do not use Pages.
|
|
170
|
+
* Use 'callback-nav' if you are updating the URL in a callback, or a different
|
|
171
|
+
* callback will respond to the new Location with updated content. This is
|
|
172
|
+
* typical with multi-page apps that use Pages. This will allow for
|
|
173
|
+
* navigating to a new page without refreshing the page.
|
|
174
|
+
*/
|
|
175
|
+
refresh: _propTypes.default.oneOfType([_propTypes.default.oneOf(['callback-nav']), _propTypes.default.bool]),
|
|
162
176
|
/**
|
|
163
177
|
* Dash-assigned callback that gets fired when the value changes.
|
|
164
178
|
*/
|
|
@@ -12,6 +12,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
12
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
18
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
19
|
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); } }
|
|
17
20
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -54,7 +57,7 @@ var RadioItems = /*#__PURE__*/function (_Component) {
|
|
|
54
57
|
var ids = {};
|
|
55
58
|
if (id) {
|
|
56
59
|
ids = {
|
|
57
|
-
id,
|
|
60
|
+
id: id,
|
|
58
61
|
key: id
|
|
59
62
|
};
|
|
60
63
|
}
|
|
@@ -65,9 +68,9 @@ var RadioItems = /*#__PURE__*/function (_Component) {
|
|
|
65
68
|
style: style
|
|
66
69
|
}), (0, _optionTypes.sanitizeOptions)(options).map(function (option) {
|
|
67
70
|
return /*#__PURE__*/_react.default.createElement("label", {
|
|
68
|
-
style:
|
|
69
|
-
display: 'inline-block'
|
|
70
|
-
}
|
|
71
|
+
style: _objectSpread({
|
|
72
|
+
display: inline ? 'inline-block' : 'block'
|
|
73
|
+
}, labelStyle),
|
|
71
74
|
className: labelClassName,
|
|
72
75
|
key: option.value
|
|
73
76
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
@@ -135,9 +138,8 @@ RadioItems.propTypes = {
|
|
|
135
138
|
*/
|
|
136
139
|
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.bool]),
|
|
137
140
|
/**
|
|
138
|
-
* Indicates whether
|
|
139
|
-
*
|
|
140
|
-
* False: No additional styles are passed into labelStyle.
|
|
141
|
+
* Indicates whether the options labels should be displayed inline (true=horizontal)
|
|
142
|
+
* or in a block (false=vertical).
|
|
141
143
|
*/
|
|
142
144
|
inline: _propTypes.default.bool,
|
|
143
145
|
/**
|
|
@@ -49,12 +49,12 @@ var EnhancedTab = function EnhancedTab(_ref) {
|
|
|
49
49
|
var tabStyle = style;
|
|
50
50
|
if (disabled) {
|
|
51
51
|
tabStyle = _objectSpread({
|
|
52
|
-
tabStyle
|
|
52
|
+
tabStyle: tabStyle
|
|
53
53
|
}, disabled_style);
|
|
54
54
|
}
|
|
55
55
|
if (selected) {
|
|
56
56
|
tabStyle = _objectSpread({
|
|
57
|
-
tabStyle
|
|
57
|
+
tabStyle: tabStyle
|
|
58
58
|
}, selected_style);
|
|
59
59
|
}
|
|
60
60
|
var tabClassName = "tab ".concat(className || '');
|
|
@@ -200,7 +200,7 @@ var DatePickerRange = /*#__PURE__*/function (_Component) {
|
|
|
200
200
|
onDatesChange: this.onDatesChange,
|
|
201
201
|
onFocusChange: function onFocusChange(focusedInput) {
|
|
202
202
|
return _this2.setState({
|
|
203
|
-
focusedInput
|
|
203
|
+
focusedInput: focusedInput
|
|
204
204
|
});
|
|
205
205
|
},
|
|
206
206
|
orientation: calendar_orientation,
|
|
@@ -134,7 +134,7 @@ var DatePickerSingle = /*#__PURE__*/function (_Component) {
|
|
|
134
134
|
onFocusChange: function onFocusChange(_ref) {
|
|
135
135
|
var focused = _ref.focused;
|
|
136
136
|
return _this2.setState({
|
|
137
|
-
focused
|
|
137
|
+
focused: focused
|
|
138
138
|
});
|
|
139
139
|
},
|
|
140
140
|
initialVisibleMonth: function initialVisibleMonth() {
|
|
@@ -31,7 +31,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
31
31
|
// Split on spaces
|
|
32
32
|
var REGEX = /\s+/;
|
|
33
33
|
var TOKENIZER = {
|
|
34
|
-
tokenize(text) {
|
|
34
|
+
tokenize: function tokenize(text) {
|
|
35
35
|
return text.split(REGEX).filter(
|
|
36
36
|
// Filter empty tokens
|
|
37
37
|
function (text) {
|
|
@@ -83,7 +83,7 @@ var Dropdown = function Dropdown(props) {
|
|
|
83
83
|
return [sanitized, (0, _reactSelectFastFilterOptions.default)({
|
|
84
84
|
options: sanitized,
|
|
85
85
|
tokenizer: TOKENIZER,
|
|
86
|
-
indexes
|
|
86
|
+
indexes: indexes
|
|
87
87
|
})];
|
|
88
88
|
}, [persistentOptions.current]),
|
|
89
89
|
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
@@ -114,7 +114,7 @@ var Dropdown = function Dropdown(props) {
|
|
|
114
114
|
}, [multi]);
|
|
115
115
|
var onInputChange = (0, _react.useCallback)(function (search_value) {
|
|
116
116
|
return setProps({
|
|
117
|
-
search_value
|
|
117
|
+
search_value: search_value
|
|
118
118
|
});
|
|
119
119
|
}, []);
|
|
120
120
|
(0, _react.useEffect)(function () {
|
|
@@ -115,7 +115,7 @@ var filterEventData = function filterEventData(gd, eventData, event) {
|
|
|
115
115
|
_loop(i);
|
|
116
116
|
}
|
|
117
117
|
filteredEventData = {
|
|
118
|
-
points
|
|
118
|
+
points: points
|
|
119
119
|
};
|
|
120
120
|
}();
|
|
121
121
|
if (typeof _ret === "object") return _ret.v;
|
|
@@ -316,8 +316,8 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
this.setState({
|
|
319
|
-
override,
|
|
320
|
-
originals
|
|
319
|
+
override: override,
|
|
320
|
+
originals: originals
|
|
321
321
|
});
|
|
322
322
|
// Undo the previous override, but only for keys that the user did not change
|
|
323
323
|
for (var _key in prev_originals) {
|
|
@@ -397,14 +397,14 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
|
|
|
397
397
|
var clickData = filterEventData(gd, eventData, 'click');
|
|
398
398
|
if (!(0, _ramda.isNil)(clickData)) {
|
|
399
399
|
setProps({
|
|
400
|
-
clickData
|
|
400
|
+
clickData: clickData
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
403
|
});
|
|
404
404
|
gd.on('plotly_clickannotation', function (eventData) {
|
|
405
405
|
var clickAnnotationData = (0, _ramda.omit)(['event', 'fullAnnotation'], eventData);
|
|
406
406
|
setProps({
|
|
407
|
-
clickAnnotationData
|
|
407
|
+
clickAnnotationData: clickAnnotationData
|
|
408
408
|
});
|
|
409
409
|
});
|
|
410
410
|
gd.on('plotly_hover', function (eventData) {
|
|
@@ -123,7 +123,7 @@ var RangeSlider = /*#__PURE__*/function (_Component) {
|
|
|
123
123
|
onAfterChange: function onAfterChange(value) {
|
|
124
124
|
if (updatemode === 'mouseup') {
|
|
125
125
|
setProps({
|
|
126
|
-
value
|
|
126
|
+
value: value
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
}
|
|
@@ -141,10 +141,10 @@ var RangeSlider = /*#__PURE__*/function (_Component) {
|
|
|
141
141
|
},
|
|
142
142
|
value: value ? value : (0, _computeSliderMarkers.calcValue)(min, max, value),
|
|
143
143
|
marks: (0, _computeSliderMarkers.sanitizeMarks)({
|
|
144
|
-
min,
|
|
145
|
-
max,
|
|
146
|
-
marks,
|
|
147
|
-
step
|
|
144
|
+
min: min,
|
|
145
|
+
max: max,
|
|
146
|
+
marks: marks,
|
|
147
|
+
step: step
|
|
148
148
|
}),
|
|
149
149
|
max: (0, _computeSliderMarkers.setUndefined)(min, max, marks).max_mark,
|
|
150
150
|
min: (0, _computeSliderMarkers.setUndefined)(min, max, marks).min_mark,
|
|
@@ -126,7 +126,7 @@ var Slider = /*#__PURE__*/function (_Component) {
|
|
|
126
126
|
onAfterChange: function onAfterChange(value) {
|
|
127
127
|
if (updatemode === 'mouseup') {
|
|
128
128
|
setProps({
|
|
129
|
-
value
|
|
129
|
+
value: value
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -144,10 +144,10 @@ var Slider = /*#__PURE__*/function (_Component) {
|
|
|
144
144
|
},
|
|
145
145
|
value: value,
|
|
146
146
|
marks: (0, _computeSliderMarkers.sanitizeMarks)({
|
|
147
|
-
min,
|
|
148
|
-
max,
|
|
149
|
-
marks,
|
|
150
|
-
step
|
|
147
|
+
min: min,
|
|
148
|
+
max: max,
|
|
149
|
+
marks: marks,
|
|
150
|
+
step: step
|
|
151
151
|
}),
|
|
152
152
|
max: (0, _computeSliderMarkers.setUndefined)(min, max, marks).max_mark,
|
|
153
153
|
min: (0, _computeSliderMarkers.setUndefined)(min, max, marks).min_mark,
|
package/lib/index.js
CHANGED
|
@@ -51,6 +51,12 @@ Object.defineProperty(exports, "Dropdown", {
|
|
|
51
51
|
return _Dropdown.default;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
+
Object.defineProperty(exports, "Geolocation", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _Geolocation.default;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
54
60
|
Object.defineProperty(exports, "Graph", {
|
|
55
61
|
enumerable: true,
|
|
56
62
|
get: function get() {
|
|
@@ -161,6 +167,7 @@ var _DatePickerRange = _interopRequireDefault(require("./components/DatePickerRa
|
|
|
161
167
|
var _DatePickerSingle = _interopRequireDefault(require("./components/DatePickerSingle.react"));
|
|
162
168
|
var _Download = _interopRequireDefault(require("./components/Download.react"));
|
|
163
169
|
var _Dropdown = _interopRequireDefault(require("./components/Dropdown.react"));
|
|
170
|
+
var _Geolocation = _interopRequireDefault(require("./components/Geolocation.react"));
|
|
164
171
|
var _Graph = _interopRequireDefault(require("./components/Graph.react"));
|
|
165
172
|
var _Input = _interopRequireDefault(require("./components/Input.react"));
|
|
166
173
|
var _Interval = _interopRequireDefault(require("./components/Interval.react"));
|
package/lib/utils/optionTypes.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dash-core-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.1",
|
|
4
4
|
"description": "Core component suite for Dash",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"mathjax": "^3.2.2",
|
|
50
50
|
"moment": "^2.29.4",
|
|
51
51
|
"node-polyfill-webpack-plugin": "^2.0.1",
|
|
52
|
-
"plotly.js-dist-min": "2.
|
|
52
|
+
"plotly.js-dist-min": "2.20.0",
|
|
53
53
|
"prop-types": "^15.8.1",
|
|
54
54
|
"ramda": "^0.28.0",
|
|
55
55
|
"rc-slider": "^9.7.5",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"react-jsx-parser": "1.21.0",
|
|
91
91
|
"style-loader": "^3.3.1",
|
|
92
92
|
"styled-jsx": "^3.4.4",
|
|
93
|
-
"webpack": "^5.
|
|
93
|
+
"webpack": "^5.76.2",
|
|
94
94
|
"webpack-cli": "^4.10.0"
|
|
95
95
|
},
|
|
96
96
|
"files": [
|
|
@@ -102,6 +102,6 @@
|
|
|
102
102
|
"react-dom": ">=16"
|
|
103
103
|
},
|
|
104
104
|
"browserslist": [
|
|
105
|
-
"last
|
|
105
|
+
"last 8 years and not dead"
|
|
106
106
|
]
|
|
107
107
|
}
|