|
| 1 | +from dash.development.base_component import Component |
| 2 | + |
| 3 | + |
| 4 | +class A(Component): |
| 5 | + """A A component. |
| 6 | +
|
| 7 | +
|
| 8 | +Keyword arguments: |
| 9 | +- children (a list of or a singular dash component, string or number; optional): The children of this component |
| 10 | +- id (string; optional): The ID of this component, used to identify dash components |
| 11 | +in callbacks. The ID needs to be unique across all of the |
| 12 | +components in an app. |
| 13 | +- n_clicks (optional): An integer that represents the number of times |
| 14 | +that this element has been clicked on. |
| 15 | +- n_clicks_timestamp (optional): An integer that represents the time (in ms since 1970) |
| 16 | +at which n_clicks changed. This can be used to tell |
| 17 | +which button was changed most recently. |
| 18 | +- key (string; optional): A unique identifier for the component, used to improve |
| 19 | +performance by React.js while rendering components |
| 20 | +See https://reactjs.org/docs/lists-and-keys.html for more info |
| 21 | +- role (string; optional): The ARIA role attribute |
| 22 | +- data-* (string; optional): A wildcard data attribute |
| 23 | +- aria-* (string; optional): A wildcard aria attribute |
| 24 | +- download (string; optional): Indicates that the hyperlink is to be used for downloading a resource. |
| 25 | +- href (string; optional): The URL of a linked resource. |
| 26 | +- hrefLang (string; optional): Specifies the language of the linked resource. |
| 27 | +- media (string; optional): Specifies a hint of the media for which the linked resource was designed. |
| 28 | +- rel (string; optional): Specifies the relationship of the target object to the link object. |
| 29 | +- shape (string; optional) |
| 30 | +- target (string; optional) |
| 31 | +- accessKey (string; optional): Defines a keyboard shortcut to activate or add focus to the element. |
| 32 | +- className (string; optional): Often used with CSS to style elements with common properties. |
| 33 | +- contentEditable (string; optional): Indicates whether the element's content is editable. |
| 34 | +- contextMenu (string; optional): Defines the ID of a <menu> element which will serve as the element's context menu. |
| 35 | +- dir (string; optional): Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left) |
| 36 | +- draggable (string; optional): Defines whether the element can be dragged. |
| 37 | +- hidden (string; optional): Prevents rendering of given element, while keeping child elements, e.g. script elements, active. |
| 38 | +- lang (string; optional): Defines the language used in the element. |
| 39 | +- spellCheck (string; optional): Indicates whether spell checking is allowed for the element. |
| 40 | +- style (dict; optional): Defines CSS styles which will override styles previously set. |
| 41 | +- tabIndex (string; optional): Overrides the browser's default tab order and follows the one specified instead. |
| 42 | +- title (string; optional): Text to be displayed in a tooltip when hovering over the element. |
| 43 | +
|
| 44 | +Available events: 'click'""" |
| 45 | + def __init__(self, children=None, **kwargs): |
| 46 | + self._prop_names = ['children', 'id', 'n_clicks', 'n_clicks_timestamp', 'key', 'role', 'data-*', 'aria-*', 'download', 'href', 'hrefLang', 'media', 'rel', 'shape', 'target', 'accessKey', 'className', 'contentEditable', 'contextMenu', 'dir', 'draggable', 'hidden', 'lang', 'spellCheck', 'style', 'tabIndex', 'title'] |
| 47 | + self._type = 'A' |
| 48 | + self._namespace = 'lib' |
| 49 | + self._valid_wildcard_attributes = ['data-', 'aria-'] |
| 50 | + self.available_events = ['click'] |
| 51 | + self.available_properties = ['children', 'id', 'n_clicks', 'n_clicks_timestamp', 'key', 'role', 'data-*', 'aria-*', 'download', 'href', 'hrefLang', 'media', 'rel', 'shape', 'target', 'accessKey', 'className', 'contentEditable', 'contextMenu', 'dir', 'draggable', 'hidden', 'lang', 'spellCheck', 'style', 'tabIndex', 'title'] |
| 52 | + self.available_wildcard_properties = ['data-', 'aria-'] |
| 53 | + |
| 54 | + for k in []: |
| 55 | + if k not in kwargs: |
| 56 | + raise TypeError( |
| 57 | + 'Required argument `' + k + '` was not specified.') |
| 58 | + |
| 59 | + super(A, self).__init__(children=children, **kwargs) |
| 60 | + |
| 61 | + def __repr__(self): |
| 62 | + if(any(getattr(self, c, None) is not None |
| 63 | + for c in self._prop_names |
| 64 | + if c is not self._prop_names[0]) |
| 65 | + or any(getattr(self, c, None) is not None |
| 66 | + for c in self.__dict__.keys() |
| 67 | + if any(c.startswith(wc_attr) |
| 68 | + for wc_attr in self._valid_wildcard_attributes))): |
| 69 | + props_string = ', '.join([c+'='+repr(getattr(self, c, None)) |
| 70 | + for c in self._prop_names |
| 71 | + if getattr(self, c, None) is not None]) |
| 72 | + wilds_string = ', '.join([c+'='+repr(getattr(self, c, None)) |
| 73 | + for c in self.__dict__.keys() |
| 74 | + if any([c.startswith(wc_attr) |
| 75 | + for wc_attr in |
| 76 | + self._valid_wildcard_attributes])]) |
| 77 | + return ('A(' + props_string + |
| 78 | + (', ' + wilds_string if wilds_string != '' else '') + ')') |
| 79 | + else: |
| 80 | + return ( |
| 81 | + 'A(' + |
| 82 | + repr(getattr(self, self._prop_names[0], None)) + ')') |
0 commit comments