dash-week-range-picker 0.0.1__py3-none-any.whl
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.
- dash_week_range_picker/WeekRangePickerInput.py +193 -0
- dash_week_range_picker/__init__.py +87 -0
- dash_week_range_picker/_imports_.py +5 -0
- dash_week_range_picker/dash_week_range_picker.min.js +3 -0
- dash_week_range_picker/dash_week_range_picker.min.js.map +1 -0
- dash_week_range_picker/metadata.json +1 -0
- dash_week_range_picker/package-info.json +57 -0
- dash_week_range_picker-0.0.1.dist-info/METADATA +115 -0
- dash_week_range_picker-0.0.1.dist-info/RECORD +12 -0
- dash_week_range_picker-0.0.1.dist-info/WHEEL +5 -0
- dash_week_range_picker-0.0.1.dist-info/licenses/LICENSE +0 -0
- dash_week_range_picker-0.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
import typing # noqa: F401
|
|
4
|
+
from typing_extensions import TypedDict, NotRequired, Literal # noqa: F401
|
|
5
|
+
from dash.development.base_component import Component, _explicitize_args
|
|
6
|
+
try:
|
|
7
|
+
from dash.types import NumberType # noqa: F401
|
|
8
|
+
except ImportError:
|
|
9
|
+
# Backwards compatibility for dash<=4.1.0
|
|
10
|
+
if typing.TYPE_CHECKING:
|
|
11
|
+
raise
|
|
12
|
+
NumberType = typing.Union[ # noqa: F401
|
|
13
|
+
typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
ComponentSingleType = typing.Union[str, int, float, Component, None]
|
|
17
|
+
ComponentType = typing.Union[
|
|
18
|
+
ComponentSingleType,
|
|
19
|
+
typing.Sequence[ComponentSingleType],
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class WeekRangePickerInput(Component):
|
|
24
|
+
"""A WeekRangePickerInput component.
|
|
25
|
+
WeekRangePickerInput - an ISO-week-granularity range picker (Mantine `Calendar` + `PickerInputBase`
|
|
26
|
+
composed by hand, the same public building blocks Mantine's own `YearPickerInput`/`MonthPickerInput`
|
|
27
|
+
are built from). Clicking any day selects/commits its whole ISO week (Monday-Sunday), instead of the
|
|
28
|
+
arbitrary single day a normal date-range picker would give you.
|
|
29
|
+
|
|
30
|
+
`value` is always `[startISO, endISO]` where both bounds already fall on a Monday/Sunday
|
|
31
|
+
respectively, or `[startISO, null]` while a range is mid-selection (exactly one week picked so far),
|
|
32
|
+
or `[null, null]` when empty - the same shape a Dash range DatePickerInput already emits, so it drops
|
|
33
|
+
into any callback written against `utils.dates.unpack_range`/`range_pending` unchanged.
|
|
34
|
+
|
|
35
|
+
Keyword arguments:
|
|
36
|
+
|
|
37
|
+
- id (string | dict; optional):
|
|
38
|
+
The ID used to identify this component in Dash callbacks. Works as
|
|
39
|
+
a normal Dash id, including pattern-matching (dict) ids.
|
|
40
|
+
|
|
41
|
+
- className (string; optional):
|
|
42
|
+
CSS class for the outer wrapper div.
|
|
43
|
+
|
|
44
|
+
- clearable (boolean; default True):
|
|
45
|
+
Shows a clear button (resets value to `[None, None]`) once a range
|
|
46
|
+
is selected.
|
|
47
|
+
|
|
48
|
+
- closeOnChange (boolean; default False):
|
|
49
|
+
Closes the calendar popover as soon as a range is completed (or a
|
|
50
|
+
preset is clicked).
|
|
51
|
+
|
|
52
|
+
- firstDayOfWeek (number; default 1):
|
|
53
|
+
0-6, where 1 = Monday. Do not change this - the
|
|
54
|
+
click-to-select-week snapping logic always snaps to the
|
|
55
|
+
Monday/Sunday of the ISO week regardless of this prop, so changing
|
|
56
|
+
it would only desync the visual grid from that logic, not the
|
|
57
|
+
weeks it actually selects.
|
|
58
|
+
|
|
59
|
+
- forceColorScheme (a value equal to: 'light', 'dark'; default undefined):
|
|
60
|
+
Forces a specific color scheme (\"light\" | \"dark\") on this
|
|
61
|
+
component's own `MantineProvider`, independent of the host app's
|
|
62
|
+
own scheme.
|
|
63
|
+
|
|
64
|
+
- highlightToday (boolean; default True):
|
|
65
|
+
Highlights today's date in the calendar.
|
|
66
|
+
|
|
67
|
+
- loading_state (dict; optional):
|
|
68
|
+
Object that holds the loading state object coming from
|
|
69
|
+
dash-renderer.
|
|
70
|
+
|
|
71
|
+
`loading_state` is a dict with keys:
|
|
72
|
+
|
|
73
|
+
- is_loading (boolean; optional):
|
|
74
|
+
Determines if the component is loading or not.
|
|
75
|
+
|
|
76
|
+
- prop_name (string; optional):
|
|
77
|
+
Holds which property is loading.
|
|
78
|
+
|
|
79
|
+
- component_name (string; optional):
|
|
80
|
+
Holds the name of the component that is loading.
|
|
81
|
+
|
|
82
|
+
- maxDate (string; optional):
|
|
83
|
+
Latest selectable date, ISO `YYYY-MM-DD`.
|
|
84
|
+
|
|
85
|
+
- minDate (string; optional):
|
|
86
|
+
Earliest selectable date, ISO `YYYY-MM-DD`. Does not need to be
|
|
87
|
+
week-aligned itself; days before it are disabled in the calendar
|
|
88
|
+
the normal Mantine way.
|
|
89
|
+
|
|
90
|
+
- persisted_props (list of a value equal to: 'value's; default ['value']):
|
|
91
|
+
Properties whose user interactions will persist after refreshing
|
|
92
|
+
the component or the page.
|
|
93
|
+
|
|
94
|
+
- persistence (boolean | string | number; default False):
|
|
95
|
+
Used to allow user interactions in this component to be persisted
|
|
96
|
+
when the component - or the page - is refreshed. If `persisted` is
|
|
97
|
+
truthy and `persistence_type` is `session`, the value is persisted
|
|
98
|
+
for the duration of the browser session.
|
|
99
|
+
|
|
100
|
+
- persistence_type (a value equal to: 'local', 'session', 'memory'; default 'local'):
|
|
101
|
+
Where persisted user changes will be stored: `memory` (only kept
|
|
102
|
+
in memory, reset on page refresh), `local` (window.localStorage,
|
|
103
|
+
data is kept after the browser quit), or `session`
|
|
104
|
+
(window.sessionStorage, data is cleared once the browser quit).
|
|
105
|
+
|
|
106
|
+
- placeholder (string; default 'Select Period'):
|
|
107
|
+
Text shown in the input when no range is selected.
|
|
108
|
+
|
|
109
|
+
- presets (list of dicts; optional):
|
|
110
|
+
Quick-pick shortcuts shown to the left of the calendar, each
|
|
111
|
+
`value` already a week-aligned `[startISO, endISO]` pair, e.g.
|
|
112
|
+
`{\"label\": \"Last 12 Weeks\", \"value\": [\"2026-03-16\",
|
|
113
|
+
\"2026-06-07\"]}`.
|
|
114
|
+
|
|
115
|
+
`presets` is a list of dicts with keys:
|
|
116
|
+
|
|
117
|
+
- label (string; optional)
|
|
118
|
+
|
|
119
|
+
- value (list of strings; optional)
|
|
120
|
+
|
|
121
|
+
- theme (dict; optional):
|
|
122
|
+
Mantine theme override, merged into this component's own isolated
|
|
123
|
+
`MantineProvider` (this component ships its own private copy of
|
|
124
|
+
`@mantine/core`, so it does not automatically inherit a host app's
|
|
125
|
+
`MantineProvider` theme - pass the same theme dict the host app
|
|
126
|
+
uses here instead).
|
|
127
|
+
|
|
128
|
+
- value (list of strings; default [None, None]):
|
|
129
|
+
`[startISO, endISO]`, both ISO `YYYY-MM-DD` and already
|
|
130
|
+
week-aligned (Monday/Sunday), e.g. `[\"2026-06-01\",
|
|
131
|
+
\"2026-06-07\"]`. `[startISO, None]` while a range is
|
|
132
|
+
mid-selection (one week picked so far). `[None, None]` (or unset)
|
|
133
|
+
when empty.
|
|
134
|
+
|
|
135
|
+
- withWeekNumbers (boolean; default True):
|
|
136
|
+
Shows the ISO week-number column next to the calendar grid."""
|
|
137
|
+
_children_props: typing.List[str] = []
|
|
138
|
+
_base_nodes = ['children']
|
|
139
|
+
_namespace = 'dash_week_range_picker'
|
|
140
|
+
_type = 'WeekRangePickerInput'
|
|
141
|
+
Presets = TypedDict(
|
|
142
|
+
"Presets",
|
|
143
|
+
{
|
|
144
|
+
"label": NotRequired[str],
|
|
145
|
+
"value": NotRequired[typing.Sequence[str]]
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
LoadingState = TypedDict(
|
|
150
|
+
"LoadingState",
|
|
151
|
+
{
|
|
152
|
+
"is_loading": NotRequired[bool],
|
|
153
|
+
"prop_name": NotRequired[str],
|
|
154
|
+
"component_name": NotRequired[str]
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def __init__(
|
|
160
|
+
self,
|
|
161
|
+
id: typing.Optional[typing.Union[str, dict]] = None,
|
|
162
|
+
value: typing.Optional[typing.Sequence[str]] = None,
|
|
163
|
+
minDate: typing.Optional[str] = None,
|
|
164
|
+
maxDate: typing.Optional[str] = None,
|
|
165
|
+
presets: typing.Optional[typing.Sequence["Presets"]] = None,
|
|
166
|
+
placeholder: typing.Optional[str] = None,
|
|
167
|
+
clearable: typing.Optional[bool] = None,
|
|
168
|
+
closeOnChange: typing.Optional[bool] = None,
|
|
169
|
+
withWeekNumbers: typing.Optional[bool] = None,
|
|
170
|
+
highlightToday: typing.Optional[bool] = None,
|
|
171
|
+
firstDayOfWeek: typing.Optional[NumberType] = None,
|
|
172
|
+
theme: typing.Optional[dict] = None,
|
|
173
|
+
forceColorScheme: typing.Optional[Literal["light", "dark"]] = None,
|
|
174
|
+
className: typing.Optional[str] = None,
|
|
175
|
+
style: typing.Optional[typing.Any] = None,
|
|
176
|
+
loading_state: typing.Optional["LoadingState"] = None,
|
|
177
|
+
persistence: typing.Optional[typing.Union[bool, str, NumberType]] = None,
|
|
178
|
+
persisted_props: typing.Optional[typing.Sequence[Literal["value"]]] = None,
|
|
179
|
+
persistence_type: typing.Optional[Literal["local", "session", "memory"]] = None,
|
|
180
|
+
**kwargs
|
|
181
|
+
):
|
|
182
|
+
self._prop_names = ['id', 'className', 'clearable', 'closeOnChange', 'firstDayOfWeek', 'forceColorScheme', 'highlightToday', 'loading_state', 'maxDate', 'minDate', 'persisted_props', 'persistence', 'persistence_type', 'placeholder', 'presets', 'style', 'theme', 'value', 'withWeekNumbers']
|
|
183
|
+
self._valid_wildcard_attributes = []
|
|
184
|
+
self.available_properties = ['id', 'className', 'clearable', 'closeOnChange', 'firstDayOfWeek', 'forceColorScheme', 'highlightToday', 'loading_state', 'maxDate', 'minDate', 'persisted_props', 'persistence', 'persistence_type', 'placeholder', 'presets', 'style', 'theme', 'value', 'withWeekNumbers']
|
|
185
|
+
self.available_wildcard_properties = []
|
|
186
|
+
_explicit_args = kwargs.pop('_explicit_args')
|
|
187
|
+
_locals = locals()
|
|
188
|
+
_locals.update(kwargs) # For wildcard attrs and excess named props
|
|
189
|
+
args = {k: _locals[k] for k in _explicit_args}
|
|
190
|
+
|
|
191
|
+
super(WeekRangePickerInput, self).__init__(**args)
|
|
192
|
+
|
|
193
|
+
setattr(WeekRangePickerInput, "__init__", _explicitize_args(WeekRangePickerInput.__init__))
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
from __future__ import print_function as _
|
|
2
|
+
|
|
3
|
+
import os as _os
|
|
4
|
+
import sys as _sys
|
|
5
|
+
import json
|
|
6
|
+
|
|
7
|
+
import dash as _dash
|
|
8
|
+
|
|
9
|
+
# noinspection PyUnresolvedReferences
|
|
10
|
+
from ._imports_ import *
|
|
11
|
+
from ._imports_ import __all__
|
|
12
|
+
|
|
13
|
+
if not hasattr(_dash, '__plotly_dash') and not hasattr(_dash, 'development'):
|
|
14
|
+
print('Dash was not successfully imported. '
|
|
15
|
+
'Make sure you don\'t have a file '
|
|
16
|
+
'named \n"dash.py" in your current directory.', file=_sys.stderr)
|
|
17
|
+
_sys.exit(1)
|
|
18
|
+
|
|
19
|
+
_basepath = _os.path.dirname(__file__)
|
|
20
|
+
_filepath = _os.path.abspath(_os.path.join(_basepath, 'package-info.json'))
|
|
21
|
+
with open(_filepath) as f:
|
|
22
|
+
package = json.load(f)
|
|
23
|
+
|
|
24
|
+
package_name = package['name'].replace(' ', '_').replace('-', '_')
|
|
25
|
+
__version__ = package['version']
|
|
26
|
+
|
|
27
|
+
_current_path = _os.path.dirname(_os.path.abspath(__file__))
|
|
28
|
+
|
|
29
|
+
_this_module = _sys.modules[__name__]
|
|
30
|
+
|
|
31
|
+
async_resources = []
|
|
32
|
+
|
|
33
|
+
_js_dist = []
|
|
34
|
+
|
|
35
|
+
_js_dist.extend(
|
|
36
|
+
[
|
|
37
|
+
{
|
|
38
|
+
"relative_package_path": "async-{}.js".format(async_resource),
|
|
39
|
+
"external_url": (
|
|
40
|
+
"https://unpkg.com/{0}@{2}"
|
|
41
|
+
"/{1}/async-{3}.js"
|
|
42
|
+
).format(package_name, __name__, __version__, async_resource),
|
|
43
|
+
"namespace": package_name,
|
|
44
|
+
"async": True,
|
|
45
|
+
}
|
|
46
|
+
for async_resource in async_resources
|
|
47
|
+
]
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
# TODO: Figure out if unpkg link works
|
|
51
|
+
_js_dist.extend(
|
|
52
|
+
[
|
|
53
|
+
{
|
|
54
|
+
"relative_package_path": "async-{}.js.map".format(async_resource),
|
|
55
|
+
"external_url": (
|
|
56
|
+
"https://unpkg.com/{0}@{2}"
|
|
57
|
+
"/{1}/async-{3}.js.map"
|
|
58
|
+
).format(package_name, __name__, __version__, async_resource),
|
|
59
|
+
"namespace": package_name,
|
|
60
|
+
"dynamic": True,
|
|
61
|
+
}
|
|
62
|
+
for async_resource in async_resources
|
|
63
|
+
]
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
_js_dist.extend(
|
|
67
|
+
[
|
|
68
|
+
{
|
|
69
|
+
'relative_package_path': 'dash_week_range_picker.min.js',
|
|
70
|
+
|
|
71
|
+
'namespace': package_name
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
'relative_package_path': 'dash_week_range_picker.min.js.map',
|
|
75
|
+
|
|
76
|
+
'namespace': package_name,
|
|
77
|
+
'dynamic': True
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
_css_dist = []
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
for _component in __all__:
|
|
86
|
+
setattr(locals()[_component], '_js_dist', _js_dist)
|
|
87
|
+
setattr(locals()[_component], '_css_dist', _css_dist)
|