dash-core-components 4.0.0-rc1 → 4.0.0-rc3
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 -2
- 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/dash_core_components/proptypes.js +209 -6
- package/lib/components/Checklist.tsx +67 -0
- package/lib/components/Clipboard.react.js +1 -1
- package/lib/components/DatePickerRange.tsx +70 -0
- package/lib/components/DatePickerSingle.tsx +72 -0
- package/lib/components/Dropdown.tsx +19 -3
- package/lib/components/Input.tsx +1 -1
- package/lib/components/Loading.tsx +185 -0
- package/lib/components/RadioItems.tsx +69 -0
- package/lib/components/RangeSlider.tsx +5 -1
- package/lib/components/Slider.tsx +12 -1
- package/lib/components/Tab.tsx +19 -0
- package/lib/components/Tabs.tsx +311 -0
- package/lib/components/Textarea.tsx +79 -0
- package/lib/components/Tooltip.tsx +66 -0
- package/lib/components/css/calendar.css +66 -0
- package/lib/components/css/checklist.css +4 -0
- package/lib/components/css/datepickers.css +233 -0
- package/lib/components/css/dcc.css +3 -0
- package/lib/components/css/dropdown.css +34 -50
- package/lib/components/css/input.css +29 -7
- package/lib/components/css/optionslist.css +34 -0
- package/lib/components/css/radioitems.css +4 -0
- package/lib/components/css/sliders.css +33 -7
- package/lib/components/css/tabs.css +113 -0
- package/lib/components/css/textarea.css +21 -0
- package/lib/components/css/tooltip.css +127 -0
- package/lib/fragments/DatePickerRange.tsx +444 -0
- package/lib/fragments/DatePickerSingle.tsx +249 -0
- package/lib/fragments/Dropdown.tsx +212 -272
- package/lib/fragments/Graph.react.js +18 -45
- package/lib/fragments/Loading/spinners/CircleSpinner.tsx +185 -0
- package/lib/fragments/Loading/spinners/CubeSpinner.tsx +193 -0
- package/lib/fragments/Loading/spinners/DebugTitle.tsx +11 -0
- package/lib/fragments/Loading/spinners/DefaultSpinner.tsx +110 -0
- package/lib/fragments/Loading/spinners/DotSpinner.tsx +96 -0
- package/lib/fragments/Loading/spinners/GraphSpinner.tsx +332 -0
- package/lib/fragments/Loading/types.ts +13 -0
- package/lib/fragments/RangeSlider.tsx +195 -63
- package/lib/index.ts +9 -11
- package/lib/types.ts +797 -132
- package/lib/utils/DatePickerPersistence.ts +14 -0
- package/lib/utils/LazyLoader/datePickerRange.ts +4 -0
- package/lib/utils/LazyLoader/datePickerSingle.ts +4 -0
- package/lib/utils/calendar/Calendar.tsx +382 -0
- package/lib/utils/calendar/CalendarDay.tsx +75 -0
- package/lib/utils/calendar/CalendarDayPadding.tsx +15 -0
- package/lib/utils/calendar/CalendarMonth.tsx +247 -0
- package/lib/utils/calendar/CalendarMonthHeader.tsx +23 -0
- package/lib/utils/calendar/createMonthGrid.ts +28 -0
- package/lib/utils/calendar/helpers.ts +272 -0
- package/lib/utils/computeSliderMarkers.ts +71 -116
- package/lib/utils/dropdownSearch.ts +4 -4
- package/lib/utils/optionRendering.tsx +175 -0
- package/lib/utils/optionTypes.ts +5 -5
- package/lib/utils/sliderRendering.tsx +63 -6
- package/package.json +16 -14
- package/lib/components/Checklist.react.js +0 -193
- package/lib/components/DatePickerRange.react.js +0 -244
- package/lib/components/DatePickerSingle.react.js +0 -209
- package/lib/components/Dropdown.react.js.old +0 -228
- package/lib/components/Input.react.js.old +0 -507
- package/lib/components/Loading.react.js +0 -254
- package/lib/components/RadioItems.react.js +0 -192
- package/lib/components/Slider.react.js.old +0 -214
- package/lib/components/Tab.react.js +0 -80
- package/lib/components/Tabs.react.js +0 -295
- package/lib/components/Textarea.react.js +0 -223
- package/lib/components/Textarea.react.js.old +0 -287
- package/lib/components/Tooltip.react.js +0 -120
- package/lib/components/css/Dropdown.css +0 -8
- package/lib/fragments/DatePickerRange.react.js +0 -188
- package/lib/fragments/DatePickerSingle.react.js +0 -132
- package/lib/fragments/Loading/spinners/CircleSpinner.js +0 -68
- package/lib/fragments/Loading/spinners/CubeSpinner.js +0 -57
- package/lib/fragments/Loading/spinners/DebugTitle.js +0 -15
- package/lib/fragments/Loading/spinners/DefaultSpinner.js +0 -54
- package/lib/fragments/Loading/spinners/DotSpinner.js +0 -50
- package/lib/fragments/Loading/spinners/GraphSpinner.js +0 -68
- package/lib/utils/DatePickerPersistence.js +0 -18
- package/lib/utils/LazyLoader/datePickerRange.js +0 -8
- package/lib/utils/LazyLoader/datePickerSingle.js +0 -8
- package/lib/utils/convertToMoment.js +0 -30
- package/lib/utils/optionTypes.js +0 -39
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _ramda = require("ramda");
|
|
9
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
-
var _GraphSpinner = _interopRequireDefault(require("../fragments/Loading/spinners/GraphSpinner.jsx"));
|
|
11
|
-
var _DefaultSpinner = _interopRequireDefault(require("../fragments/Loading/spinners/DefaultSpinner.jsx"));
|
|
12
|
-
var _CubeSpinner = _interopRequireDefault(require("../fragments/Loading/spinners/CubeSpinner.jsx"));
|
|
13
|
-
var _CircleSpinner = _interopRequireDefault(require("../fragments/Loading/spinners/CircleSpinner.jsx"));
|
|
14
|
-
var _DotSpinner = _interopRequireDefault(require("../fragments/Loading/spinners/DotSpinner.jsx"));
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
20
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
21
|
-
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); }
|
|
22
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
23
|
-
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."); }
|
|
24
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
25
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
26
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
27
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
28
|
-
var spinnerComponentOptions = {
|
|
29
|
-
graph: _GraphSpinner.default,
|
|
30
|
-
cube: _CubeSpinner.default,
|
|
31
|
-
circle: _CircleSpinner.default,
|
|
32
|
-
dot: _DotSpinner.default
|
|
33
|
-
};
|
|
34
|
-
var getSpinner = spinnerType => spinnerComponentOptions[spinnerType] || _DefaultSpinner.default;
|
|
35
|
-
var coveringSpinner = {
|
|
36
|
-
visibility: 'visible',
|
|
37
|
-
position: 'absolute',
|
|
38
|
-
top: '0',
|
|
39
|
-
height: '100%',
|
|
40
|
-
width: '100%',
|
|
41
|
-
display: 'flex',
|
|
42
|
-
justifyContent: 'center',
|
|
43
|
-
alignItems: 'center'
|
|
44
|
-
};
|
|
45
|
-
var loadingSelector = (componentPath, targetComponents) => state => {
|
|
46
|
-
var stringPath = JSON.stringify(componentPath);
|
|
47
|
-
// Remove the last ] for easy match and add `,` to make sure only children
|
|
48
|
-
// trigger the loading. See issue: https://github.com/plotly/dash/issues/3276
|
|
49
|
-
stringPath = stringPath.substring(0, stringPath.length - 1) + ',';
|
|
50
|
-
var loadingChildren = (0, _ramda.toPairs)(state.loading).reduce((acc, _ref) => {
|
|
51
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
52
|
-
path = _ref2[0],
|
|
53
|
-
load = _ref2[1];
|
|
54
|
-
if (path.startsWith(stringPath) && load.length) {
|
|
55
|
-
if (targetComponents && !(0, _ramda.any)(l => {
|
|
56
|
-
var target = targetComponents[l.id];
|
|
57
|
-
if (!target) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
if (target === '*') {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
if (Array.isArray(target)) {
|
|
64
|
-
return (0, _ramda.includes)(l.property, target);
|
|
65
|
-
}
|
|
66
|
-
return l.property === target;
|
|
67
|
-
}, load)) {
|
|
68
|
-
return acc;
|
|
69
|
-
}
|
|
70
|
-
return (0, _ramda.concat)(acc, load);
|
|
71
|
-
}
|
|
72
|
-
return acc;
|
|
73
|
-
}, []);
|
|
74
|
-
if (loadingChildren.length) {
|
|
75
|
-
return loadingChildren;
|
|
76
|
-
}
|
|
77
|
-
return null;
|
|
78
|
-
};
|
|
79
|
-
function Loading(_ref3) {
|
|
80
|
-
var children = _ref3.children,
|
|
81
|
-
_ref3$display = _ref3.display,
|
|
82
|
-
display = _ref3$display === void 0 ? 'auto' : _ref3$display,
|
|
83
|
-
_ref3$color = _ref3.color,
|
|
84
|
-
color = _ref3$color === void 0 ? '#119DFF' : _ref3$color,
|
|
85
|
-
id = _ref3.id,
|
|
86
|
-
className = _ref3.className,
|
|
87
|
-
style = _ref3.style,
|
|
88
|
-
parent_className = _ref3.parent_className,
|
|
89
|
-
parent_style = _ref3.parent_style,
|
|
90
|
-
overlay_style = _ref3.overlay_style,
|
|
91
|
-
fullscreen = _ref3.fullscreen,
|
|
92
|
-
debug = _ref3.debug,
|
|
93
|
-
_ref3$show_initially = _ref3.show_initially,
|
|
94
|
-
show_initially = _ref3$show_initially === void 0 ? true : _ref3$show_initially,
|
|
95
|
-
spinnerType = _ref3.type,
|
|
96
|
-
_ref3$delay_hide = _ref3.delay_hide,
|
|
97
|
-
delay_hide = _ref3$delay_hide === void 0 ? 0 : _ref3$delay_hide,
|
|
98
|
-
_ref3$delay_show = _ref3.delay_show,
|
|
99
|
-
delay_show = _ref3$delay_show === void 0 ? 0 : _ref3$delay_show,
|
|
100
|
-
target_components = _ref3.target_components,
|
|
101
|
-
custom_spinner = _ref3.custom_spinner;
|
|
102
|
-
var ctx = window.dash_component_api.useDashContext();
|
|
103
|
-
var loading = ctx.useSelector(loadingSelector(ctx.componentPath, target_components), _ramda.equals);
|
|
104
|
-
var _useState = (0, _react.useState)(show_initially),
|
|
105
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
106
|
-
showSpinner = _useState2[0],
|
|
107
|
-
setShowSpinner = _useState2[1];
|
|
108
|
-
var dismissTimer = (0, _react.useRef)();
|
|
109
|
-
var showTimer = (0, _react.useRef)();
|
|
110
|
-
var containerStyle = (0, _react.useMemo)(() => {
|
|
111
|
-
if (showSpinner) {
|
|
112
|
-
return _objectSpread(_objectSpread({
|
|
113
|
-
visibility: 'hidden'
|
|
114
|
-
}, overlay_style), parent_style);
|
|
115
|
-
}
|
|
116
|
-
return parent_style;
|
|
117
|
-
}, [showSpinner, parent_style]);
|
|
118
|
-
(0, _react.useEffect)(() => {
|
|
119
|
-
if (display === 'show' || display === 'hide') {
|
|
120
|
-
setShowSpinner(display === 'show');
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (loading) {
|
|
124
|
-
// if component is currently loading and there's a dismiss timer active
|
|
125
|
-
// we need to clear it.
|
|
126
|
-
if (dismissTimer.current) {
|
|
127
|
-
dismissTimer.current = clearTimeout(dismissTimer.current);
|
|
128
|
-
}
|
|
129
|
-
// if component is currently loading but the spinner is not showing and
|
|
130
|
-
// there is no timer set to show, then set a timeout to show
|
|
131
|
-
if (!showSpinner && !showTimer.current) {
|
|
132
|
-
showTimer.current = setTimeout(() => {
|
|
133
|
-
setShowSpinner(true);
|
|
134
|
-
showTimer.current = null;
|
|
135
|
-
}, delay_show);
|
|
136
|
-
}
|
|
137
|
-
} else {
|
|
138
|
-
// if component is not currently loading and there's a show timer
|
|
139
|
-
// active we need to clear it
|
|
140
|
-
if (showTimer.current) {
|
|
141
|
-
showTimer.current = clearTimeout(showTimer.current);
|
|
142
|
-
}
|
|
143
|
-
// if component is not currently loading and the spinner is showing and
|
|
144
|
-
// there's no timer set to dismiss it, then set a timeout to hide it
|
|
145
|
-
if (showSpinner && !dismissTimer.current) {
|
|
146
|
-
dismissTimer.current = setTimeout(() => {
|
|
147
|
-
setShowSpinner(false);
|
|
148
|
-
dismissTimer.current = null;
|
|
149
|
-
}, delay_hide);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}, [delay_hide, delay_show, loading, display, showSpinner]);
|
|
153
|
-
var Spinner = showSpinner && getSpinner(spinnerType);
|
|
154
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
155
|
-
style: _objectSpread({
|
|
156
|
-
position: 'relative'
|
|
157
|
-
}, parent_style),
|
|
158
|
-
className: parent_className
|
|
159
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
160
|
-
className: parent_className,
|
|
161
|
-
style: containerStyle
|
|
162
|
-
}, children), /*#__PURE__*/_react.default.createElement("div", {
|
|
163
|
-
id: id,
|
|
164
|
-
style: showSpinner ? coveringSpinner : {}
|
|
165
|
-
}, showSpinner && (custom_spinner || /*#__PURE__*/_react.default.createElement(Spinner, {
|
|
166
|
-
className: className,
|
|
167
|
-
style: style,
|
|
168
|
-
status: loading,
|
|
169
|
-
color: color,
|
|
170
|
-
debug: debug,
|
|
171
|
-
fullscreen: fullscreen
|
|
172
|
-
}))));
|
|
173
|
-
}
|
|
174
|
-
Loading.propTypes = {
|
|
175
|
-
/**
|
|
176
|
-
* The ID of this component, used to identify dash components
|
|
177
|
-
* in callbacks. The ID needs to be unique across all of the
|
|
178
|
-
* components in an app.
|
|
179
|
-
*/
|
|
180
|
-
id: _propTypes.default.string,
|
|
181
|
-
/**
|
|
182
|
-
* Array that holds components to render
|
|
183
|
-
*/
|
|
184
|
-
children: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.node), _propTypes.default.node]),
|
|
185
|
-
/**
|
|
186
|
-
* Property that determines which built-in spinner to show
|
|
187
|
-
* one of 'graph', 'cube', 'circle', 'dot', or 'default'.
|
|
188
|
-
*/
|
|
189
|
-
type: _propTypes.default.oneOf(['graph', 'cube', 'circle', 'dot', 'default']),
|
|
190
|
-
/**
|
|
191
|
-
* Boolean that makes the built-in spinner display full-screen
|
|
192
|
-
*/
|
|
193
|
-
fullscreen: _propTypes.default.bool,
|
|
194
|
-
/**
|
|
195
|
-
* If true, the built-in spinner will display the component_name and prop_name
|
|
196
|
-
* while loading
|
|
197
|
-
*/
|
|
198
|
-
debug: _propTypes.default.bool,
|
|
199
|
-
/**
|
|
200
|
-
* Additional CSS class for the built-in spinner root DOM node
|
|
201
|
-
*/
|
|
202
|
-
className: _propTypes.default.string,
|
|
203
|
-
/**
|
|
204
|
-
* Additional CSS class for the outermost dcc.Loading parent div DOM node
|
|
205
|
-
*/
|
|
206
|
-
parent_className: _propTypes.default.string,
|
|
207
|
-
/**
|
|
208
|
-
* Additional CSS styling for the built-in spinner root DOM node
|
|
209
|
-
*/
|
|
210
|
-
style: _propTypes.default.object,
|
|
211
|
-
/**
|
|
212
|
-
* Additional CSS styling for the outermost dcc.Loading parent div DOM node
|
|
213
|
-
*/
|
|
214
|
-
parent_style: _propTypes.default.object,
|
|
215
|
-
/**
|
|
216
|
-
* Additional CSS styling for the spinner overlay. This is applied to the
|
|
217
|
-
* dcc.Loading children while the spinner is active. The default is `{'visibility': 'hidden'}`
|
|
218
|
-
*/
|
|
219
|
-
overlay_style: _propTypes.default.object,
|
|
220
|
-
/**
|
|
221
|
-
* Primary color used for the built-in loading spinners
|
|
222
|
-
*/
|
|
223
|
-
color: _propTypes.default.string,
|
|
224
|
-
/**
|
|
225
|
-
* Setting display to "show" or "hide" will override the loading state coming from dash-renderer
|
|
226
|
-
*/
|
|
227
|
-
display: _propTypes.default.oneOf(['auto', 'show', 'hide']),
|
|
228
|
-
/**
|
|
229
|
-
* Add a time delay (in ms) to the spinner being removed to prevent flickering.
|
|
230
|
-
*/
|
|
231
|
-
delay_hide: _propTypes.default.number,
|
|
232
|
-
/**
|
|
233
|
-
* Add a time delay (in ms) to the spinner being shown after the loading_state
|
|
234
|
-
* is set to True.
|
|
235
|
-
*/
|
|
236
|
-
delay_show: _propTypes.default.number,
|
|
237
|
-
/**
|
|
238
|
-
* Whether the Spinner should show on app start-up before the loading state
|
|
239
|
-
* has been determined. Default True. Use when also setting `delay_show`.
|
|
240
|
-
*/
|
|
241
|
-
show_initially: _propTypes.default.bool,
|
|
242
|
-
/**
|
|
243
|
-
* Specify component and prop to trigger showing the loading spinner
|
|
244
|
-
* example: `{"output-container": "children", "grid": ["rowData", "columnDefs]}`
|
|
245
|
-
*
|
|
246
|
-
*/
|
|
247
|
-
target_components: _propTypes.default.objectOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)])),
|
|
248
|
-
/**
|
|
249
|
-
* Component to use rather than the built-in spinner specified in the `type` prop.
|
|
250
|
-
*
|
|
251
|
-
*/
|
|
252
|
-
custom_spinner: _propTypes.default.node
|
|
253
|
-
};
|
|
254
|
-
var _default = exports.default = Loading;
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
require("./css/react-select@1.0.0-rc.3.min.css");
|
|
10
|
-
var _optionTypes = require("../utils/optionTypes");
|
|
11
|
-
var _LoadingElement = _interopRequireDefault(require("../utils/LoadingElement"));
|
|
12
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
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); }
|
|
15
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
|
-
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); }
|
|
20
|
-
/**
|
|
21
|
-
* RadioItems is a component that encapsulates several radio item inputs.
|
|
22
|
-
* The values and labels of the RadioItems is specified in the `options`
|
|
23
|
-
* property and the seleced item is specified with the `value` property.
|
|
24
|
-
* Each radio item is rendered as an input with a surrounding label.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
class RadioItems extends _react.Component {
|
|
28
|
-
render() {
|
|
29
|
-
var _this$props = this.props,
|
|
30
|
-
id = _this$props.id,
|
|
31
|
-
className = _this$props.className,
|
|
32
|
-
style = _this$props.style,
|
|
33
|
-
inputClassName = _this$props.inputClassName,
|
|
34
|
-
inputStyle = _this$props.inputStyle,
|
|
35
|
-
labelClassName = _this$props.labelClassName,
|
|
36
|
-
labelStyle = _this$props.labelStyle,
|
|
37
|
-
options = _this$props.options,
|
|
38
|
-
setProps = _this$props.setProps,
|
|
39
|
-
value = _this$props.value,
|
|
40
|
-
inline = _this$props.inline;
|
|
41
|
-
var ids = {};
|
|
42
|
-
if (id) {
|
|
43
|
-
ids = {
|
|
44
|
-
id,
|
|
45
|
-
key: id
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, _extends({}, ids, {
|
|
49
|
-
className: className,
|
|
50
|
-
style: style
|
|
51
|
-
}), (0, _optionTypes.sanitizeOptions)(options).map(option => /*#__PURE__*/_react.default.createElement("label", {
|
|
52
|
-
style: _objectSpread({
|
|
53
|
-
display: inline ? 'inline-block' : 'block'
|
|
54
|
-
}, labelStyle),
|
|
55
|
-
className: labelClassName,
|
|
56
|
-
key: option.value,
|
|
57
|
-
title: option.title
|
|
58
|
-
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
59
|
-
checked: option.value === value,
|
|
60
|
-
className: inputClassName,
|
|
61
|
-
disabled: Boolean(option.disabled),
|
|
62
|
-
style: inputStyle,
|
|
63
|
-
type: "radio",
|
|
64
|
-
onChange: () => {
|
|
65
|
-
setProps({
|
|
66
|
-
value: option.value
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}), option.label)));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.default = RadioItems;
|
|
73
|
-
RadioItems.propTypes = {
|
|
74
|
-
/**
|
|
75
|
-
* An array of options, or inline dictionary of options
|
|
76
|
-
*/
|
|
77
|
-
options: _propTypes.default.oneOfType([
|
|
78
|
-
/**
|
|
79
|
-
* Array of options where the label and the value are the same thing - [string|number|bool]
|
|
80
|
-
*/
|
|
81
|
-
_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.bool])),
|
|
82
|
-
/**
|
|
83
|
-
* Simpler `options` representation in dictionary format. The order is not guaranteed.
|
|
84
|
-
* {`value1`: `label1`, `value2`: `label2`, ... }
|
|
85
|
-
* which is equal to
|
|
86
|
-
* [{label: `label1`, value: `value1`}, {label: `label2`, value: `value2`}, ...]
|
|
87
|
-
*/
|
|
88
|
-
_propTypes.default.object,
|
|
89
|
-
/**
|
|
90
|
-
* An array of options {label: [string|number], value: [string|number]},
|
|
91
|
-
* an optional disabled field can be used for each option
|
|
92
|
-
*/
|
|
93
|
-
_propTypes.default.arrayOf(_propTypes.default.exact({
|
|
94
|
-
/**
|
|
95
|
-
* The option's label
|
|
96
|
-
*/
|
|
97
|
-
label: _propTypes.default.node.isRequired,
|
|
98
|
-
/**
|
|
99
|
-
* The value of the option. This value
|
|
100
|
-
* corresponds to the items specified in the
|
|
101
|
-
* `value` property.
|
|
102
|
-
*/
|
|
103
|
-
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.bool]).isRequired,
|
|
104
|
-
/**
|
|
105
|
-
* If true, this option is disabled and cannot be selected.
|
|
106
|
-
*/
|
|
107
|
-
disabled: _propTypes.default.bool,
|
|
108
|
-
/**
|
|
109
|
-
* The HTML 'title' attribute for the option. Allows for
|
|
110
|
-
* information on hover. For more information on this attribute,
|
|
111
|
-
* see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title
|
|
112
|
-
*/
|
|
113
|
-
title: _propTypes.default.string
|
|
114
|
-
}))]),
|
|
115
|
-
/**
|
|
116
|
-
* The currently selected value
|
|
117
|
-
*/
|
|
118
|
-
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.bool]),
|
|
119
|
-
/**
|
|
120
|
-
* Indicates whether the options labels should be displayed inline (true=horizontal)
|
|
121
|
-
* or in a block (false=vertical).
|
|
122
|
-
*/
|
|
123
|
-
inline: _propTypes.default.bool,
|
|
124
|
-
/**
|
|
125
|
-
* The style of the container (div)
|
|
126
|
-
*/
|
|
127
|
-
style: _propTypes.default.object,
|
|
128
|
-
/**
|
|
129
|
-
* The class of the container (div)
|
|
130
|
-
*/
|
|
131
|
-
className: _propTypes.default.string,
|
|
132
|
-
/**
|
|
133
|
-
* The style of the <input> radio element
|
|
134
|
-
*/
|
|
135
|
-
inputStyle: _propTypes.default.object,
|
|
136
|
-
/**
|
|
137
|
-
* The class of the <input> radio element
|
|
138
|
-
*/
|
|
139
|
-
inputClassName: _propTypes.default.string,
|
|
140
|
-
/**
|
|
141
|
-
* The style of the <label> that wraps the radio input
|
|
142
|
-
* and the option's label
|
|
143
|
-
*/
|
|
144
|
-
labelStyle: _propTypes.default.object,
|
|
145
|
-
/**
|
|
146
|
-
* The class of the <label> that wraps the radio input
|
|
147
|
-
* and the option's label
|
|
148
|
-
*/
|
|
149
|
-
labelClassName: _propTypes.default.string,
|
|
150
|
-
/**
|
|
151
|
-
* The ID of this component, used to identify dash components
|
|
152
|
-
* in callbacks. The ID needs to be unique across all of the
|
|
153
|
-
* components in an app.
|
|
154
|
-
*/
|
|
155
|
-
id: _propTypes.default.string,
|
|
156
|
-
/**
|
|
157
|
-
* Dash-assigned callback that gets fired when the value changes.
|
|
158
|
-
*/
|
|
159
|
-
setProps: _propTypes.default.func,
|
|
160
|
-
/**
|
|
161
|
-
* Used to allow user interactions in this component to be persisted when
|
|
162
|
-
* the component - or the page - is refreshed. If `persisted` is truthy and
|
|
163
|
-
* hasn't changed from its previous value, a `value` that the user has
|
|
164
|
-
* changed while using the app will keep that change, as long as
|
|
165
|
-
* the new `value` also matches what was given originally.
|
|
166
|
-
* Used in conjunction with `persistence_type`.
|
|
167
|
-
*/
|
|
168
|
-
persistence: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string, _propTypes.default.number]),
|
|
169
|
-
/**
|
|
170
|
-
* Properties whose user interactions will persist after refreshing the
|
|
171
|
-
* component or the page. Since only `value` is allowed this prop can
|
|
172
|
-
* normally be ignored.
|
|
173
|
-
*/
|
|
174
|
-
persisted_props: _propTypes.default.arrayOf(_propTypes.default.oneOf(['value'])),
|
|
175
|
-
/**
|
|
176
|
-
* Where persisted user changes will be stored:
|
|
177
|
-
* memory: only kept in memory, reset on page refresh.
|
|
178
|
-
* local: window.localStorage, data is kept after the browser quit.
|
|
179
|
-
* session: window.sessionStorage, data is cleared once the browser quit.
|
|
180
|
-
*/
|
|
181
|
-
persistence_type: _propTypes.default.oneOf(['local', 'session', 'memory'])
|
|
182
|
-
};
|
|
183
|
-
RadioItems.defaultProps = {
|
|
184
|
-
inputStyle: {},
|
|
185
|
-
inputClassName: '',
|
|
186
|
-
labelStyle: {},
|
|
187
|
-
labelClassName: '',
|
|
188
|
-
options: [],
|
|
189
|
-
persisted_props: ['value'],
|
|
190
|
-
persistence_type: 'local',
|
|
191
|
-
inline: false
|
|
192
|
-
};
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import React, {Component, lazy, Suspense} from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import slider from '../utils/LazyLoader/slider';
|
|
4
|
-
|
|
5
|
-
import './css/sliders.css';
|
|
6
|
-
|
|
7
|
-
const RealSlider = lazy(slider);
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A slider component with a single handle.
|
|
11
|
-
*/
|
|
12
|
-
export default class Slider extends Component {
|
|
13
|
-
render() {
|
|
14
|
-
return (
|
|
15
|
-
<Suspense fallback={null}>
|
|
16
|
-
<RealSlider {...this.props} />
|
|
17
|
-
</Suspense>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
Slider.propTypes = {
|
|
23
|
-
/**
|
|
24
|
-
* Minimum allowed value of the slider
|
|
25
|
-
*/
|
|
26
|
-
min: PropTypes.number,
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Maximum allowed value of the slider
|
|
30
|
-
*/
|
|
31
|
-
max: PropTypes.number,
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Value by which increments or decrements are made
|
|
35
|
-
*/
|
|
36
|
-
step: PropTypes.number,
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Marks on the slider.
|
|
40
|
-
* The key determines the position (a number),
|
|
41
|
-
* and the value determines what will show.
|
|
42
|
-
* If you want to set the style of a specific mark point,
|
|
43
|
-
* the value should be an object which
|
|
44
|
-
* contains style and label properties.
|
|
45
|
-
*/
|
|
46
|
-
marks: PropTypes.objectOf(
|
|
47
|
-
PropTypes.oneOfType([
|
|
48
|
-
PropTypes.string,
|
|
49
|
-
PropTypes.exact({
|
|
50
|
-
label: PropTypes.string,
|
|
51
|
-
style: PropTypes.object,
|
|
52
|
-
}),
|
|
53
|
-
])
|
|
54
|
-
),
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The value of the input
|
|
58
|
-
*/
|
|
59
|
-
value: PropTypes.number,
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The value of the input during a drag
|
|
63
|
-
*/
|
|
64
|
-
drag_value: PropTypes.number,
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* If true, the handles can't be moved.
|
|
68
|
-
*/
|
|
69
|
-
disabled: PropTypes.bool,
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* When the step value is greater than 1,
|
|
73
|
-
* you can set the dots to true if you want to
|
|
74
|
-
* render the slider with dots.
|
|
75
|
-
*/
|
|
76
|
-
dots: PropTypes.bool,
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* If the value is true, it means a continuous
|
|
80
|
-
* value is included. Otherwise, it is an independent value.
|
|
81
|
-
*/
|
|
82
|
-
included: PropTypes.bool,
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Configuration for tooltips describing the current slider value
|
|
86
|
-
*/
|
|
87
|
-
tooltip: PropTypes.exact({
|
|
88
|
-
/**
|
|
89
|
-
* Determines whether tooltips should always be visible
|
|
90
|
-
* (as opposed to the default, visible on hover)
|
|
91
|
-
*/
|
|
92
|
-
always_visible: PropTypes.bool,
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Determines the placement of tooltips
|
|
96
|
-
* See https://github.com/react-component/tooltip#api
|
|
97
|
-
* top/bottom{*} sets the _origin_ of the tooltip, so e.g. `topLeft`
|
|
98
|
-
* will in reality appear to be on the top right of the handle
|
|
99
|
-
*/
|
|
100
|
-
placement: PropTypes.oneOf([
|
|
101
|
-
'left',
|
|
102
|
-
'right',
|
|
103
|
-
'top',
|
|
104
|
-
'bottom',
|
|
105
|
-
'topLeft',
|
|
106
|
-
'topRight',
|
|
107
|
-
'bottomLeft',
|
|
108
|
-
'bottomRight',
|
|
109
|
-
]),
|
|
110
|
-
/**
|
|
111
|
-
* Template string to display the tooltip in.
|
|
112
|
-
* Must contain `{value}`, which will be replaced with either
|
|
113
|
-
* the default string representation of the value or the result of the
|
|
114
|
-
* transform function if there is one.
|
|
115
|
-
*/
|
|
116
|
-
template: PropTypes.string,
|
|
117
|
-
/**
|
|
118
|
-
* Custom style for the tooltip.
|
|
119
|
-
*/
|
|
120
|
-
style: PropTypes.object,
|
|
121
|
-
/**
|
|
122
|
-
* Reference to a function in the `window.dccFunctions` namespace.
|
|
123
|
-
* This can be added in a script in the asset folder.
|
|
124
|
-
*
|
|
125
|
-
* For example, in `assets/tooltip.js`:
|
|
126
|
-
* ```
|
|
127
|
-
* window.dccFunctions = window.dccFunctions || {};
|
|
128
|
-
* window.dccFunctions.multByTen = function(value) {
|
|
129
|
-
* return value * 10;
|
|
130
|
-
* }
|
|
131
|
-
* ```
|
|
132
|
-
* Then in the component `tooltip={'transform': 'multByTen'}`
|
|
133
|
-
*/
|
|
134
|
-
transform: PropTypes.string,
|
|
135
|
-
}),
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Determines when the component should update its `value`
|
|
139
|
-
* property. If `mouseup` (the default) then the slider
|
|
140
|
-
* will only trigger its value when the user has finished
|
|
141
|
-
* dragging the slider. If `drag`, then the slider will
|
|
142
|
-
* update its value continuously as it is being dragged.
|
|
143
|
-
* If you want different actions during and after drag,
|
|
144
|
-
* leave `updatemode` as `mouseup` and use `drag_value`
|
|
145
|
-
* for the continuously updating value.
|
|
146
|
-
*/
|
|
147
|
-
updatemode: PropTypes.oneOf(['mouseup', 'drag']),
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* If true, the slider will be vertical
|
|
151
|
-
*/
|
|
152
|
-
vertical: PropTypes.bool,
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* The height, in px, of the slider if it is vertical.
|
|
156
|
-
*/
|
|
157
|
-
verticalHeight: PropTypes.number,
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Additional CSS class for the root DOM node
|
|
161
|
-
*/
|
|
162
|
-
className: PropTypes.string,
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* The ID of this component, used to identify dash components
|
|
166
|
-
* in callbacks. The ID needs to be unique across all of the
|
|
167
|
-
* components in an app.
|
|
168
|
-
*/
|
|
169
|
-
id: PropTypes.string,
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Dash-assigned callback that gets fired when the value or drag_value changes.
|
|
173
|
-
*/
|
|
174
|
-
setProps: PropTypes.func,
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Used to allow user interactions in this component to be persisted when
|
|
178
|
-
* the component - or the page - is refreshed. If `persisted` is truthy and
|
|
179
|
-
* hasn't changed from its previous value, a `value` that the user has
|
|
180
|
-
* changed while using the app will keep that change, as long as
|
|
181
|
-
* the new `value` also matches what was given originally.
|
|
182
|
-
* Used in conjunction with `persistence_type`.
|
|
183
|
-
*/
|
|
184
|
-
persistence: PropTypes.oneOfType([
|
|
185
|
-
PropTypes.bool,
|
|
186
|
-
PropTypes.string,
|
|
187
|
-
PropTypes.number,
|
|
188
|
-
]),
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Properties whose user interactions will persist after refreshing the
|
|
192
|
-
* component or the page. Since only `value` is allowed this prop can
|
|
193
|
-
* normally be ignored.
|
|
194
|
-
*/
|
|
195
|
-
persisted_props: PropTypes.arrayOf(PropTypes.oneOf(['value'])),
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Where persisted user changes will be stored:
|
|
199
|
-
* memory: only kept in memory, reset on page refresh.
|
|
200
|
-
* local: window.localStorage, data is kept after the browser quit.
|
|
201
|
-
* session: window.sessionStorage, data is cleared once the browser quit.
|
|
202
|
-
*/
|
|
203
|
-
persistence_type: PropTypes.oneOf(['local', 'session', 'memory']),
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
Slider.defaultProps = {
|
|
207
|
-
updatemode: 'mouseup',
|
|
208
|
-
persisted_props: ['value'],
|
|
209
|
-
persistence_type: 'local',
|
|
210
|
-
verticalHeight: 400,
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
export const propTypes = Slider.propTypes;
|
|
214
|
-
export const defaultProps = Slider.defaultProps;
|