aboutsummaryrefslogtreecommitdiff
path: root/venv/lib/python3.8/site-packages/dash/dcc/Upload.py
blob: fcccf3471b92d74101a2c822656f800a35c528ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# AUTO GENERATED FILE - DO NOT EDIT

import typing  # noqa: F401
from typing_extensions import TypedDict, NotRequired, Literal  # noqa: F401
from dash.development.base_component import Component, _explicitize_args

ComponentType = typing.Union[
    str,
    int,
    float,
    Component,
    None,
    typing.Sequence[typing.Union[str, int, float, Component, None]],
]

NumberType = typing.Union[
    typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex
]


class Upload(Component):
    """An Upload component.
    Upload components allow your app to accept user-uploaded files via drag'n'drop

    Keyword arguments:

    - children (a list of or a singular dash component, string or number | string; optional):
        Contents of the upload component.

    - id (string; optional):
        The ID of this component, used to identify dash components in
        callbacks. The ID needs to be unique across all of the components
        in an app.

    - accept (string; optional):
        Allow specific types of files. See
        https://github.com/okonet/attr-accept for more information. Keep
        in mind that mime type determination is not reliable across
        platforms. CSV files, for example, are reported as text/plain
        under macOS but as application/vnd.ms-excel under Windows. In some
        cases there might not be a mime type set at all. See:
        https://github.com/react-dropzone/react-dropzone/issues/276.

    - className (string; optional):
        HTML class name of the component.

    - className_active (string; optional):
        HTML class name of the component while active.

    - className_disabled (string; optional):
        HTML class name of the component if disabled.

    - className_reject (string; optional):
        HTML class name of the component if rejected.

    - contents (string | list of strings; optional):
        The contents of the uploaded file as a binary string.

    - disable_click (boolean; default False):
        Disallow clicking on the component to open the file dialog.

    - disabled (boolean; default False):
        Enable/disable the upload component entirely.

    - filename (string | list of strings; optional):
        The name of the file(s) that was(were) uploaded. Note that this
        does not include the path of the file (for security reasons).

    - last_modified (number | list of numbers; optional):
        The last modified date of the file that was uploaded in unix time
        (seconds since 1970).

    - max_size (number; default -1):
        Maximum file size in bytes. If `-1`, then infinite.

    - min_size (number; default 0):
        Minimum file size in bytes.

    - multiple (boolean; default False):
        Allow dropping multiple files.

    - style_active (dict; default {    borderStyle: 'solid',    borderColor: '#6c6',    backgroundColor: '#eee',}):
        CSS styles to apply while active.

    - style_disabled (dict; default {    opacity: 0.5,}):
        CSS styles if disabled.

    - style_reject (dict; default {    borderStyle: 'solid',    borderColor: '#c66',    backgroundColor: '#eee',}):
        CSS styles if rejected."""

    _children_props = []
    _base_nodes = ["children"]
    _namespace = "dash_core_components"
    _type = "Upload"

    def __init__(
        self,
        children: typing.Optional[ComponentType] = None,
        id: typing.Optional[typing.Union[str, dict]] = None,
        contents: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        filename: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
        last_modified: typing.Optional[
            typing.Union[NumberType, typing.Sequence[NumberType]]
        ] = None,
        accept: typing.Optional[str] = None,
        disabled: typing.Optional[bool] = None,
        disable_click: typing.Optional[bool] = None,
        max_size: typing.Optional[NumberType] = None,
        min_size: typing.Optional[NumberType] = None,
        multiple: typing.Optional[bool] = None,
        className: typing.Optional[str] = None,
        className_active: typing.Optional[str] = None,
        className_reject: typing.Optional[str] = None,
        className_disabled: typing.Optional[str] = None,
        style: typing.Optional[typing.Any] = None,
        style_active: typing.Optional[dict] = None,
        style_reject: typing.Optional[dict] = None,
        style_disabled: typing.Optional[dict] = None,
        **kwargs
    ):
        self._prop_names = [
            "children",
            "id",
            "accept",
            "className",
            "className_active",
            "className_disabled",
            "className_reject",
            "contents",
            "disable_click",
            "disabled",
            "filename",
            "last_modified",
            "max_size",
            "min_size",
            "multiple",
            "style",
            "style_active",
            "style_disabled",
            "style_reject",
        ]
        self._valid_wildcard_attributes = []
        self.available_properties = [
            "children",
            "id",
            "accept",
            "className",
            "className_active",
            "className_disabled",
            "className_reject",
            "contents",
            "disable_click",
            "disabled",
            "filename",
            "last_modified",
            "max_size",
            "min_size",
            "multiple",
            "style",
            "style_active",
            "style_disabled",
            "style_reject",
        ]
        self.available_wildcard_properties = []
        _explicit_args = kwargs.pop("_explicit_args")
        _locals = locals()
        _locals.update(kwargs)  # For wildcard attrs and excess named props
        args = {k: _locals[k] for k in _explicit_args if k != "children"}

        super(Upload, self).__init__(children=children, **args)


setattr(Upload, "__init__", _explicitize_args(Upload.__init__))