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,287 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-unused-vars */
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import {pick} from 'ramda';
|
|
5
|
-
|
|
6
|
-
const textAreaProps = [
|
|
7
|
-
'id',
|
|
8
|
-
'autoFocus',
|
|
9
|
-
'cols',
|
|
10
|
-
'disabled',
|
|
11
|
-
'form',
|
|
12
|
-
'maxLength',
|
|
13
|
-
'minLength',
|
|
14
|
-
'name',
|
|
15
|
-
'placeholder',
|
|
16
|
-
'readOnly',
|
|
17
|
-
'required',
|
|
18
|
-
'rows',
|
|
19
|
-
'wrap',
|
|
20
|
-
'accessKey',
|
|
21
|
-
'className',
|
|
22
|
-
'contentEditable',
|
|
23
|
-
'contextMenu',
|
|
24
|
-
'dir',
|
|
25
|
-
'draggable',
|
|
26
|
-
'hidden',
|
|
27
|
-
'lang',
|
|
28
|
-
'spellCheck',
|
|
29
|
-
'style',
|
|
30
|
-
'tabIndex',
|
|
31
|
-
'title',
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* A basic HTML textarea for entering multiline text.
|
|
36
|
-
*
|
|
37
|
-
*/
|
|
38
|
-
const Textarea = ({
|
|
39
|
-
setProps,
|
|
40
|
-
value,
|
|
41
|
-
n_blur = 0,
|
|
42
|
-
n_blur_timestamp = -1,
|
|
43
|
-
n_clicks,
|
|
44
|
-
n_clicks_timestamp = -1,
|
|
45
|
-
persisted_props,
|
|
46
|
-
persistence_type,
|
|
47
|
-
...props
|
|
48
|
-
}) => {
|
|
49
|
-
const ctx = window.dash_component_api.useDashContext();
|
|
50
|
-
const isLoading = ctx.useLoading();
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<textarea
|
|
54
|
-
data-dash-is-loading={isLoading || undefined}
|
|
55
|
-
value={value}
|
|
56
|
-
onChange={e => {
|
|
57
|
-
setProps({value: e.target.value});
|
|
58
|
-
}}
|
|
59
|
-
onBlur={() => {
|
|
60
|
-
setProps({
|
|
61
|
-
n_blur: n_blur + 1,
|
|
62
|
-
n_blur_timestamp: Date.now(),
|
|
63
|
-
});
|
|
64
|
-
}}
|
|
65
|
-
onClick={() => {
|
|
66
|
-
setProps({
|
|
67
|
-
n_clicks: n_clicks + 1,
|
|
68
|
-
n_clicks_timestamp: Date.now(),
|
|
69
|
-
});
|
|
70
|
-
}}
|
|
71
|
-
{...pick(textAreaProps, props)}
|
|
72
|
-
/>
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
Textarea.dashPersistence = {
|
|
77
|
-
persisted_props: ['value'],
|
|
78
|
-
persistence_type: 'local',
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
Textarea.propTypes = {
|
|
82
|
-
/**
|
|
83
|
-
* The ID of this component, used to identify dash components
|
|
84
|
-
* in callbacks. The ID needs to be unique across all of the
|
|
85
|
-
* components in an app.
|
|
86
|
-
*/
|
|
87
|
-
id: PropTypes.string,
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* The value of the textarea
|
|
91
|
-
*/
|
|
92
|
-
value: PropTypes.string,
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* The element should be automatically focused after the page loaded.
|
|
96
|
-
*/
|
|
97
|
-
autoFocus: PropTypes.string,
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Defines the number of columns in a textarea.
|
|
101
|
-
*/
|
|
102
|
-
cols: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Indicates whether the user can interact with the element.
|
|
106
|
-
*/
|
|
107
|
-
disabled: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Indicates the form that is the owner of the element.
|
|
111
|
-
*/
|
|
112
|
-
form: PropTypes.string,
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Defines the maximum number of characters allowed in the element.
|
|
116
|
-
*/
|
|
117
|
-
maxLength: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Defines the minimum number of characters allowed in the element.
|
|
121
|
-
*/
|
|
122
|
-
minLength: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Name of the element. For example used by the server to identify the fields in form submits.
|
|
126
|
-
*/
|
|
127
|
-
name: PropTypes.string,
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Provides a hint to the user of what can be entered in the field.
|
|
131
|
-
*/
|
|
132
|
-
placeholder: PropTypes.string,
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Indicates whether the element can be edited.
|
|
136
|
-
* readOnly is an HTML boolean attribute - it is enabled by a boolean or
|
|
137
|
-
* 'readOnly'. Alternative capitalizations `readonly` & `READONLY`
|
|
138
|
-
* are also acccepted.
|
|
139
|
-
*/
|
|
140
|
-
readOnly: PropTypes.oneOfType([
|
|
141
|
-
PropTypes.bool,
|
|
142
|
-
PropTypes.oneOf(['readOnly', 'readonly', 'READONLY']),
|
|
143
|
-
]),
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Indicates whether this element is required to fill out or not.
|
|
147
|
-
* required is an HTML boolean attribute - it is enabled by a boolean or
|
|
148
|
-
* 'required'. Alternative capitalizations `REQUIRED`
|
|
149
|
-
* are also acccepted.
|
|
150
|
-
*/
|
|
151
|
-
required: PropTypes.oneOfType([
|
|
152
|
-
PropTypes.oneOf(['required', 'REQUIRED']),
|
|
153
|
-
PropTypes.bool,
|
|
154
|
-
]),
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Defines the number of rows in a text area.
|
|
158
|
-
*/
|
|
159
|
-
rows: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Indicates whether the text should be wrapped.
|
|
163
|
-
*/
|
|
164
|
-
wrap: PropTypes.string,
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Defines a keyboard shortcut to activate or add focus to the element.
|
|
168
|
-
*/
|
|
169
|
-
accessKey: PropTypes.string,
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Often used with CSS to style elements with common properties.
|
|
173
|
-
*/
|
|
174
|
-
className: PropTypes.string,
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Indicates whether the element's content is editable.
|
|
178
|
-
*/
|
|
179
|
-
contentEditable: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Defines the ID of a <menu> element which will serve as the element's context menu.
|
|
183
|
-
*/
|
|
184
|
-
contextMenu: PropTypes.string,
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
|
|
188
|
-
*/
|
|
189
|
-
dir: PropTypes.string,
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Defines whether the element can be dragged.
|
|
193
|
-
*/
|
|
194
|
-
draggable: PropTypes.oneOfType([
|
|
195
|
-
// enumerated property, not a boolean property: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/draggable
|
|
196
|
-
PropTypes.oneOf(['true', 'false']),
|
|
197
|
-
PropTypes.bool,
|
|
198
|
-
]),
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Prevents rendering of given element, while keeping child elements, e.g. script elements, active.
|
|
202
|
-
*/
|
|
203
|
-
hidden: PropTypes.string,
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Defines the language used in the element.
|
|
207
|
-
*/
|
|
208
|
-
lang: PropTypes.string,
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Indicates whether spell checking is allowed for the element.
|
|
212
|
-
*/
|
|
213
|
-
spellCheck: PropTypes.oneOfType([
|
|
214
|
-
// enumerated property, not a boolean property: https://www.w3.org/TR/html51/editing.html#spelling-and-grammar-checking
|
|
215
|
-
PropTypes.oneOf(['true', 'false']),
|
|
216
|
-
PropTypes.bool,
|
|
217
|
-
]),
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Defines CSS styles which will override styles previously set.
|
|
221
|
-
*/
|
|
222
|
-
style: PropTypes.object,
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Overrides the browser's default tab order and follows the one specified instead.
|
|
226
|
-
*/
|
|
227
|
-
tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Text to be displayed in a tooltip when hovering over the element.
|
|
231
|
-
*/
|
|
232
|
-
title: PropTypes.string,
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Number of times the textarea lost focus.
|
|
236
|
-
*/
|
|
237
|
-
n_blur: PropTypes.number,
|
|
238
|
-
/**
|
|
239
|
-
* Last time the textarea lost focus.
|
|
240
|
-
*/
|
|
241
|
-
n_blur_timestamp: PropTypes.number,
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Number of times the textarea has been clicked.
|
|
245
|
-
*/
|
|
246
|
-
n_clicks: PropTypes.number,
|
|
247
|
-
/**
|
|
248
|
-
* Last time the textarea was clicked.
|
|
249
|
-
*/
|
|
250
|
-
n_clicks_timestamp: PropTypes.number,
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Dash-assigned callback that gets fired when the value changes.
|
|
254
|
-
*/
|
|
255
|
-
setProps: PropTypes.func,
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Used to allow user interactions in this component to be persisted when
|
|
259
|
-
* the component - or the page - is refreshed. If `persisted` is truthy and
|
|
260
|
-
* hasn't changed from its previous value, a `value` that the user has
|
|
261
|
-
* changed while using the app will keep that change, as long as
|
|
262
|
-
* the new `value` also matches what was given originally.
|
|
263
|
-
* Used in conjunction with `persistence_type`.
|
|
264
|
-
*/
|
|
265
|
-
persistence: PropTypes.oneOfType([
|
|
266
|
-
PropTypes.bool,
|
|
267
|
-
PropTypes.string,
|
|
268
|
-
PropTypes.number,
|
|
269
|
-
]),
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Properties whose user interactions will persist after refreshing the
|
|
273
|
-
* component or the page. Since only `value` is allowed this prop can
|
|
274
|
-
* normally be ignored.
|
|
275
|
-
*/
|
|
276
|
-
persisted_props: PropTypes.arrayOf(PropTypes.oneOf(['value'])),
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Where persisted user changes will be stored:
|
|
280
|
-
* memory: only kept in memory, reset on page refresh.
|
|
281
|
-
* local: window.localStorage, data is kept after the browser quit.
|
|
282
|
-
* session: window.sessionStorage, data is cleared once the browser quit.
|
|
283
|
-
*/
|
|
284
|
-
persistence_type: PropTypes.oneOf(['local', 'session', 'memory']),
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
export default Textarea;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
10
|
-
var _excluded = ["show", "targetable", "direction", "border_color", "background_color", "className", "zindex", "loading_text"];
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
13
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
14
|
-
// eslint-disable-line no-unused-vars
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* A tooltip with an absolute position.
|
|
18
|
-
*/
|
|
19
|
-
var Tooltip = _ref => {
|
|
20
|
-
var _ref$show = _ref.show,
|
|
21
|
-
show = _ref$show === void 0 ? true : _ref$show,
|
|
22
|
-
_ref$targetable = _ref.targetable,
|
|
23
|
-
targetable = _ref$targetable === void 0 ? false : _ref$targetable,
|
|
24
|
-
_ref$direction = _ref.direction,
|
|
25
|
-
direction = _ref$direction === void 0 ? 'right' : _ref$direction,
|
|
26
|
-
_ref$border_color = _ref.border_color,
|
|
27
|
-
border_color = _ref$border_color === void 0 ? '#d6d6d6' : _ref$border_color,
|
|
28
|
-
_ref$background_color = _ref.background_color,
|
|
29
|
-
background_color = _ref$background_color === void 0 ? 'white' : _ref$background_color,
|
|
30
|
-
_ref$className = _ref.className,
|
|
31
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
32
|
-
_ref$zindex = _ref.zindex,
|
|
33
|
-
zindex = _ref$zindex === void 0 ? 1 : _ref$zindex,
|
|
34
|
-
_ref$loading_text = _ref.loading_text,
|
|
35
|
-
loading_text = _ref$loading_text === void 0 ? 'Loading...' : _ref$loading_text,
|
|
36
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
-
var bbox = props.bbox,
|
|
38
|
-
id = props.id;
|
|
39
|
-
var show_tooltip = show && bbox;
|
|
40
|
-
var ctx = window.dash_component_api.useDashContext();
|
|
41
|
-
var is_loading = ctx.useLoading();
|
|
42
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
-
className: "dcc-tooltip-bounding-box"
|
|
44
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
-
className: "hover hover-".concat(direction),
|
|
46
|
-
"data-dash-is-loading": is_loading
|
|
47
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
48
|
-
id: id,
|
|
49
|
-
className: "hover-content ".concat(className),
|
|
50
|
-
style: props.style
|
|
51
|
-
}, is_loading ? /*#__PURE__*/_react.default.createElement("span", null, loading_text) : props.children))), /*#__PURE__*/_react.default.createElement("style", {
|
|
52
|
-
jsx: true
|
|
53
|
-
}, "\n .dcc-tooltip-bounding-box {\n position: absolute;\n top: ".concat((bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, "px;\n left: ").concat((bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, "px;\n width: ").concat((bbox === null || bbox === void 0 ? void 0 : bbox.x1) - (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, "px;\n height: ").concat((bbox === null || bbox === void 0 ? void 0 : bbox.y1) - (bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, "px;\n display: ").concat(show_tooltip ? 'inline-block' : 'none', ";\n pointer-events: ").concat(targetable ? 'auto' : 'none', ";\n }\n .hover {\n position: absolute;\n }\n .hover-right {\n /* Offset so that the triangle caret lands directly on what's hovered */\n transform: translate(5px, 0);\n top: 50%;\n left: 100%;\n }\n .hover-left {\n transform: translate(-5px, 0);\n top: 50%;\n }\n .hover-bottom {\n transform: translate(0, 6px);\n top: 100%;\n left: 50%;\n }\n .hover-top {\n transform: translate(0, -5px);\n left: 50%;\n }\n .hover-content {\n position: absolute;\n border: 1px solid ").concat(border_color, ";\n border-radius: 2px;\n padding: 5px 10px;\n background: ").concat(background_color, ";\n white-space: nowrap;\n z-index: ").concat(zindex, ";\n pointer-events: none;\n }\n .hover .hover-content,\n .hover-right .hover-content {\n transform: translate(0, -50%);\n }\n .hover-left .hover-content {\n transform: translate(-100%, -50%);\n }\n .hover-top .hover-content {\n transform: translate(-50%, -100%);\n }\n .hover-bottom .hover-content {\n transform: translate(-50%, 0);\n }\n /* Add a small triangle on the left side of the box */\n .hover:before,\n .hover:after {\n content: '';\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n top: -6px;\n z-index: ").concat(zindex, ";\n }\n .hover:before,\n .hover:after,\n .hover-right:before,\n .hover-right:after {\n border-width: 6px 6px 6px 0;\n }\n .hover-top:before,\n .hover-top:after {\n border-width: 6px 6px 0 6px;\n }\n .hover-bottom:before,\n .hover-bottom:after {\n border-width: 0 6px 6px 6px;\n }\n .hover-left:before,\n .hover-left:after {\n border-width: 6px 0 6px 6px;\n }\n .hover:before,\n .hover-right:before {\n border-color: transparent ").concat(border_color, " transparent\n transparent;\n left: -5px;\n }\n .hover:after,\n .hover-right:after {\n border-color: transparent ").concat(background_color, " transparent\n transparent;\n left: -4px;\n }\n .hover-left:before {\n border-color: transparent transparent transparent\n ").concat(border_color, ";\n left: -1px;\n }\n .hover-left:after {\n border-color: transparent transparent transparent\n ").concat(background_color, ";\n left: -2px;\n }\n .hover-top:before,\n .hover-top:after,\n .hover-bottom:before,\n .hover-bottom:after {\n left: -6px;\n }\n .hover-bottom:before {\n border-color: transparent transparent ").concat(border_color, "\n transparent;\n }\n .hover-bottom:after {\n border-color: transparent transparent ").concat(background_color, "\n transparent;\n top: -5px;\n }\n .hover-top:before {\n border-color: ").concat(border_color, " transparent transparent\n transparent;\n top: -1px;\n }\n .hover-top:after {\n border-color: ").concat(background_color, " transparent transparent\n transparent;\n top: -2px;\n }\n ")));
|
|
54
|
-
};
|
|
55
|
-
Tooltip.propTypes = {
|
|
56
|
-
/**
|
|
57
|
-
* The contents of the tooltip
|
|
58
|
-
*/
|
|
59
|
-
children: _propTypes.default.node,
|
|
60
|
-
/**
|
|
61
|
-
* The ID of this component, used to identify dash components
|
|
62
|
-
* in callbacks. The ID needs to be unique across all of the
|
|
63
|
-
* components in an app.
|
|
64
|
-
*/
|
|
65
|
-
id: _propTypes.default.string,
|
|
66
|
-
/**
|
|
67
|
-
* The class of the tooltip
|
|
68
|
-
*/
|
|
69
|
-
className: _propTypes.default.string,
|
|
70
|
-
/**
|
|
71
|
-
* The style of the tooltip
|
|
72
|
-
*/
|
|
73
|
-
style: _propTypes.default.object,
|
|
74
|
-
/**
|
|
75
|
-
* The bounding box coordinates of the item to label, in px relative to
|
|
76
|
-
* the positioning parent of the Tooltip component.
|
|
77
|
-
*/
|
|
78
|
-
bbox: _propTypes.default.exact({
|
|
79
|
-
x0: _propTypes.default.number,
|
|
80
|
-
y0: _propTypes.default.number,
|
|
81
|
-
x1: _propTypes.default.number,
|
|
82
|
-
y1: _propTypes.default.number
|
|
83
|
-
}),
|
|
84
|
-
/**
|
|
85
|
-
* Whether to show the tooltip
|
|
86
|
-
*/
|
|
87
|
-
show: _propTypes.default.bool,
|
|
88
|
-
/**
|
|
89
|
-
* The side of the `bbox` on which the tooltip should open.
|
|
90
|
-
*/
|
|
91
|
-
direction: _propTypes.default.oneOf(['top', 'right', 'bottom', 'left']),
|
|
92
|
-
/**
|
|
93
|
-
* Color of the tooltip border, as a CSS color string.
|
|
94
|
-
*/
|
|
95
|
-
border_color: _propTypes.default.string,
|
|
96
|
-
/**
|
|
97
|
-
* Color of the tooltip background, as a CSS color string.
|
|
98
|
-
*/
|
|
99
|
-
background_color: _propTypes.default.string,
|
|
100
|
-
/**
|
|
101
|
-
* The text displayed in the tooltip while loading
|
|
102
|
-
*/
|
|
103
|
-
loading_text: _propTypes.default.string,
|
|
104
|
-
/**
|
|
105
|
-
* The `z-index` CSS property to assign to the tooltip. Components with
|
|
106
|
-
* higher values will be displayed on top of components with lower values.
|
|
107
|
-
*/
|
|
108
|
-
zindex: _propTypes.default.number,
|
|
109
|
-
/**
|
|
110
|
-
* Whether the tooltip itself can be targeted by pointer events.
|
|
111
|
-
* For tooltips triggered by hover events, typically this should be left
|
|
112
|
-
* `false` to avoid the tooltip interfering with those same events.
|
|
113
|
-
*/
|
|
114
|
-
targetable: _propTypes.default.bool,
|
|
115
|
-
/**
|
|
116
|
-
* Dash-assigned callback that gets fired when the value changes.
|
|
117
|
-
*/
|
|
118
|
-
setProps: _propTypes.default.func
|
|
119
|
-
};
|
|
120
|
-
var _default = exports.default = Tooltip;
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
require("react-dates/initialize");
|
|
8
|
-
var _reactDates = require("react-dates");
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _uniqid = _interopRequireDefault(require("uniqid"));
|
|
11
|
-
var _DatePickerRange = require("../components/DatePickerRange.react");
|
|
12
|
-
var _convertToMoment3 = _interopRequireDefault(require("../utils/convertToMoment"));
|
|
13
|
-
var _LoadingElement = _interopRequireDefault(require("../utils/LoadingElement"));
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
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); }
|
|
16
|
-
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; }
|
|
17
|
-
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; }
|
|
18
|
-
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; }
|
|
19
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
|
-
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); }
|
|
21
|
-
class DatePickerRange extends _react.Component {
|
|
22
|
-
constructor(props) {
|
|
23
|
-
super(props);
|
|
24
|
-
this.propsToState = this.propsToState.bind(this);
|
|
25
|
-
this.onDatesChange = this.onDatesChange.bind(this);
|
|
26
|
-
this.isOutsideRange = this.isOutsideRange.bind(this);
|
|
27
|
-
this.state = {
|
|
28
|
-
focused: false,
|
|
29
|
-
start_date_id: props.start_date_id || (0, _uniqid.default)(),
|
|
30
|
-
end_date_id: props.end_date_id || (0, _uniqid.default)()
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
propsToState(newProps) {
|
|
34
|
-
var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
35
|
-
var state = {};
|
|
36
|
-
if (force || newProps.start_date !== this.props.start_date) {
|
|
37
|
-
state.start_date = newProps.start_date;
|
|
38
|
-
}
|
|
39
|
-
if (force || newProps.end_date !== this.props.end_date) {
|
|
40
|
-
state.end_date = newProps.end_date;
|
|
41
|
-
}
|
|
42
|
-
if (force || newProps.max_date_allowed !== this.props.max_date_allowed) {
|
|
43
|
-
state.max_date_allowed = (0, _convertToMoment3.default)(newProps, ['max_date_allowed']).max_date_allowed;
|
|
44
|
-
}
|
|
45
|
-
if (force || newProps.min_date_allowed !== this.props.min_date_allowed) {
|
|
46
|
-
state.min_date_allowed = (0, _convertToMoment3.default)(newProps, ['min_date_allowed']).min_date_allowed;
|
|
47
|
-
}
|
|
48
|
-
if (force || newProps.disabled_days !== this.props.disabled_days) {
|
|
49
|
-
state.disabled_days = (0, _convertToMoment3.default)(newProps, ['disabled_days']).disabled_days;
|
|
50
|
-
}
|
|
51
|
-
if (Object.keys(state).length) {
|
|
52
|
-
this.setState(state);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
UNSAFE_componentWillReceiveProps(newProps) {
|
|
56
|
-
this.propsToState(newProps);
|
|
57
|
-
}
|
|
58
|
-
UNSAFE_componentWillMount() {
|
|
59
|
-
this.propsToState(this.props, true);
|
|
60
|
-
}
|
|
61
|
-
onDatesChange(_ref) {
|
|
62
|
-
var start_date = _ref.startDate,
|
|
63
|
-
end_date = _ref.endDate;
|
|
64
|
-
var _this$props = this.props,
|
|
65
|
-
setProps = _this$props.setProps,
|
|
66
|
-
updatemode = _this$props.updatemode,
|
|
67
|
-
clearable = _this$props.clearable;
|
|
68
|
-
var oldMomentDates = (0, _convertToMoment3.default)(this.state, ['start_date', 'end_date']);
|
|
69
|
-
if (start_date && !start_date.isSame(oldMomentDates.start_date)) {
|
|
70
|
-
if (updatemode === 'singledate') {
|
|
71
|
-
setProps({
|
|
72
|
-
start_date: start_date.format('YYYY-MM-DD')
|
|
73
|
-
});
|
|
74
|
-
} else {
|
|
75
|
-
this.setState({
|
|
76
|
-
start_date: start_date.format('YYYY-MM-DD')
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (end_date && !end_date.isSame(oldMomentDates.end_date)) {
|
|
81
|
-
if (updatemode === 'singledate') {
|
|
82
|
-
setProps({
|
|
83
|
-
end_date: end_date.format('YYYY-MM-DD')
|
|
84
|
-
});
|
|
85
|
-
} else if (updatemode === 'bothdates') {
|
|
86
|
-
setProps({
|
|
87
|
-
start_date: this.state.start_date,
|
|
88
|
-
end_date: end_date.format('YYYY-MM-DD')
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
if (clearable && !start_date && !end_date && (oldMomentDates.start_date !== start_date || oldMomentDates.end_date !== end_date)) {
|
|
93
|
-
setProps({
|
|
94
|
-
start_date: null,
|
|
95
|
-
end_date: null
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
isOutsideRange(date) {
|
|
100
|
-
return this.state.min_date_allowed && date.isBefore(this.state.min_date_allowed) || this.state.max_date_allowed && date.isAfter(this.state.max_date_allowed) || this.state.disabled_days && this.state.disabled_days.some(d => date.isSame(d, 'day'));
|
|
101
|
-
}
|
|
102
|
-
render() {
|
|
103
|
-
var focusedInput = this.state.focusedInput;
|
|
104
|
-
var _this$props2 = this.props,
|
|
105
|
-
calendar_orientation = _this$props2.calendar_orientation,
|
|
106
|
-
clearable = _this$props2.clearable,
|
|
107
|
-
day_size = _this$props2.day_size,
|
|
108
|
-
disabled = _this$props2.disabled,
|
|
109
|
-
display_format = _this$props2.display_format,
|
|
110
|
-
end_date_placeholder_text = _this$props2.end_date_placeholder_text,
|
|
111
|
-
first_day_of_week = _this$props2.first_day_of_week,
|
|
112
|
-
is_RTL = _this$props2.is_RTL,
|
|
113
|
-
minimum_nights = _this$props2.minimum_nights,
|
|
114
|
-
month_format = _this$props2.month_format,
|
|
115
|
-
number_of_months_shown = _this$props2.number_of_months_shown,
|
|
116
|
-
reopen_calendar_on_clear = _this$props2.reopen_calendar_on_clear,
|
|
117
|
-
show_outside_days = _this$props2.show_outside_days,
|
|
118
|
-
start_date_placeholder_text = _this$props2.start_date_placeholder_text,
|
|
119
|
-
stay_open_on_select = _this$props2.stay_open_on_select,
|
|
120
|
-
with_full_screen_portal = _this$props2.with_full_screen_portal,
|
|
121
|
-
with_portal = _this$props2.with_portal,
|
|
122
|
-
id = _this$props2.id,
|
|
123
|
-
style = _this$props2.style,
|
|
124
|
-
className = _this$props2.className,
|
|
125
|
-
start_date_id = _this$props2.start_date_id,
|
|
126
|
-
end_date_id = _this$props2.end_date_id;
|
|
127
|
-
var _convertToMoment = (0, _convertToMoment3.default)(this.props, ['initial_visible_month']),
|
|
128
|
-
initial_visible_month = _convertToMoment.initial_visible_month;
|
|
129
|
-
var _convertToMoment2 = (0, _convertToMoment3.default)(this.state, ['start_date', 'end_date']),
|
|
130
|
-
start_date = _convertToMoment2.start_date,
|
|
131
|
-
end_date = _convertToMoment2.end_date;
|
|
132
|
-
var verticalFlag = calendar_orientation !== 'vertical';
|
|
133
|
-
var DatePickerWrapperStyles = _objectSpread({
|
|
134
|
-
position: 'relative',
|
|
135
|
-
display: 'inline-block'
|
|
136
|
-
}, style);
|
|
137
|
-
|
|
138
|
-
// the height in px of the top part of the calendar (that holds
|
|
139
|
-
// the name of the month)
|
|
140
|
-
var baselineHeight = 145;
|
|
141
|
-
return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
|
|
142
|
-
id: id,
|
|
143
|
-
style: DatePickerWrapperStyles,
|
|
144
|
-
className: className
|
|
145
|
-
}, /*#__PURE__*/_react.default.createElement(_reactDates.DateRangePicker, {
|
|
146
|
-
daySize: day_size,
|
|
147
|
-
disabled: disabled,
|
|
148
|
-
displayFormat: display_format,
|
|
149
|
-
enableOutsideDays: show_outside_days,
|
|
150
|
-
endDate: end_date,
|
|
151
|
-
endDatePlaceholderText: end_date_placeholder_text,
|
|
152
|
-
firstDayOfWeek: first_day_of_week,
|
|
153
|
-
focusedInput: focusedInput,
|
|
154
|
-
initialVisibleMonth: () => {
|
|
155
|
-
if (initial_visible_month) {
|
|
156
|
-
return initial_visible_month;
|
|
157
|
-
} else if (end_date && focusedInput === 'endDate') {
|
|
158
|
-
return end_date;
|
|
159
|
-
} else if (start_date && focusedInput === 'startDate') {
|
|
160
|
-
return start_date;
|
|
161
|
-
}
|
|
162
|
-
return start_date;
|
|
163
|
-
},
|
|
164
|
-
isOutsideRange: this.isOutsideRange,
|
|
165
|
-
isRTL: is_RTL,
|
|
166
|
-
keepOpenOnDateSelect: stay_open_on_select,
|
|
167
|
-
minimumNights: minimum_nights,
|
|
168
|
-
monthFormat: month_format,
|
|
169
|
-
numberOfMonths: number_of_months_shown,
|
|
170
|
-
onDatesChange: this.onDatesChange,
|
|
171
|
-
onFocusChange: focusedInput => this.setState({
|
|
172
|
-
focusedInput
|
|
173
|
-
}),
|
|
174
|
-
orientation: calendar_orientation,
|
|
175
|
-
reopenPickerOnClearDates: reopen_calendar_on_clear,
|
|
176
|
-
showClearDates: clearable,
|
|
177
|
-
startDate: start_date,
|
|
178
|
-
startDatePlaceholderText: start_date_placeholder_text,
|
|
179
|
-
withFullScreenPortal: with_full_screen_portal && verticalFlag,
|
|
180
|
-
withPortal: with_portal && verticalFlag,
|
|
181
|
-
startDateId: start_date_id || this.state.start_date_id,
|
|
182
|
-
endDateId: end_date_id || this.state.end_date_id,
|
|
183
|
-
verticalHeight: baselineHeight + day_size * 6 + 'px'
|
|
184
|
-
}));
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
exports.default = DatePickerRange;
|
|
188
|
-
DatePickerRange.propTypes = _DatePickerRange.propTypes;
|